Merge
diff --git a/.hgtags-top-repo b/.hgtags-top-repo
index 918c4e5..b44b5ca 100644
--- a/.hgtags-top-repo
+++ b/.hgtags-top-repo
@@ -372,3 +372,4 @@
 8fa686245bd2a072ece3392743460030f0854520 jdk-9+127
 b30ae794d974d7dd3eb4e84203f70021823fa6c6 jdk-9+128
 f5902d3841b82cac6e7716a20c24e8e916fb14a8 jdk-9+129
+d94d54a3192fea79234c3ac55cd0b4052d45e954 jdk-9+130
diff --git a/common/autoconf/flags.m4 b/common/autoconf/flags.m4
index e4cd491..cc32499b 100644
--- a/common/autoconf/flags.m4
+++ b/common/autoconf/flags.m4
@@ -684,7 +684,7 @@
   AC_SUBST(CXXFLAGS_TESTEXE)
 
   LDFLAGS_TESTLIB="$LDFLAGS_JDKLIB"
-  LDFLAGS_TESTEXE="$LDFLAGS_JDKEXE"
+  LDFLAGS_TESTEXE="$LDFLAGS_JDKEXE $JAVA_BASE_LDFLAGS"
 
   AC_SUBST(LDFLAGS_TESTLIB)
   AC_SUBST(LDFLAGS_TESTEXE)
@@ -713,20 +713,17 @@
     FLAGS_CXX_COMPILER_CHECK_ARGUMENTS(ARGUMENT: [[$]$2CXXSTD_CXXFLAG -Werror],
     						 IF_FALSE: [$2CXXSTD_CXXFLAG=""])
     $2CXXFLAGS_JDK="${$2CXXFLAGS_JDK} ${$2CXXSTD_CXXFLAG}"
+    $2JVM_CFLAGS="${$2JVM_CFLAGS} ${$2CXXSTD_CXXFLAG}"
     AC_SUBST([$2CXXSTD_CXXFLAG])
   fi
   if test "x$OPENJDK_TARGET_OS" = xsolaris; then
     $2CFLAGS_JDK="${$2CFLAGS_JDK} -D__solaris__"
     $2CXXFLAGS_JDK="${$2CXXFLAGS_JDK} -D__solaris__"
-    $2CFLAGS_JDKLIB_EXTRA='-xstrconst'
-    CFLAGS_JDK="${CFLAGS_JDK} -qchars=signed -qfullpath -qsaveopt"
-    CXXFLAGS_JDK="${CXXFLAGS_JDK} -qchars=signed -qfullpath -qsaveopt"
   fi
 
   if test "x$OPENJDK_TARGET_OS" = xsolaris; then
     $2CFLAGS_JDK="${$2CFLAGS_JDK} -D__solaris__"
     $2CXXFLAGS_JDK="${$2CXXFLAGS_JDK} -D__solaris__"
-    $2CFLAGS_JDKLIB_EXTRA='-xstrconst'
   fi
 
   $2CFLAGS_JDK="${$2CFLAGS_JDK} ${$2EXTRA_CFLAGS}"
@@ -768,7 +765,7 @@
         $2CFLAGS_JDK="${$2CFLAGS_JDK} -fno-strict-aliasing"
         ;;
     esac
-    TOOLCHAIN_CHECK_COMPILER_VERSION(VERSION: 6, PREFIX: $2, IF_AT_LEAST: FLAGS_SETUP_GCC6_COMPILER_FLAGS)
+    TOOLCHAIN_CHECK_COMPILER_VERSION(VERSION: 6, PREFIX: $2, IF_AT_LEAST: FLAGS_SETUP_GCC6_COMPILER_FLAGS($2))
   elif test "x$TOOLCHAIN_TYPE" = xclang; then
     $2JVM_CFLAGS="[$]$2JVM_CFLAGS -D_GNU_SOURCE"
 
@@ -1112,7 +1109,7 @@
     fi
   elif test "x$TOOLCHAIN_TYPE" = xsolstudio; then
     LDFLAGS_SOLSTUDIO="-Wl,-z,defs"
-    $2LDFLAGS_JDK="[$]$2LDFLAGS_JDK $LDFLAGS_SOLSTUDIO -xildoff -ztext"
+    $2LDFLAGS_JDK="[$]$2LDFLAGS_JDK $LDFLAGS_SOLSTUDIO -ztext"
     LDFLAGS_CXX_SOLSTUDIO="-norunpath"
     $2LDFLAGS_CXX_JDK="[$]$2LDFLAGS_CXX_JDK $LDFLAGS_CXX_SOLSTUDIO -xnolib"
     $2JVM_LDFLAGS="[$]$2JVM_LDFLAGS $LDFLAGS_SOLSTUDIO -library=%none -mt $LDFLAGS_CXX_SOLSTUDIO -z noversion"
@@ -1147,11 +1144,11 @@
 
   $2LDFLAGS_JDKLIB="${$2LDFLAGS_JDKLIB} ${SHARED_LIBRARY_FLAGS}"
   if test "x$TOOLCHAIN_TYPE" = xmicrosoft; then
-    $2LDFLAGS_JDKLIB="${$2LDFLAGS_JDKLIB} \
+    $2JAVA_BASE_LDFLAGS="${$2JAVA_BASE_LDFLAGS} \
         -libpath:${OUTPUT_ROOT}/support/modules_libs/java.base"
     $2JDKLIB_LIBS=""
   else
-    $2LDFLAGS_JDKLIB="${$2LDFLAGS_JDKLIB} \
+    $2JAVA_BASE_LDFLAGS="${$2JAVA_BASE_LDFLAGS} \
         -L\$(SUPPORT_OUTPUTDIR)/modules_libs/java.base\$(OPENJDK_$1_CPU_LIBDIR)"
 
     if test "x$1" = "xTARGET"; then
@@ -1160,17 +1157,17 @@
       # Only add client/minimal dir if client/minimal is being built.
     # Default to server for other variants.
       if HOTSPOT_CHECK_JVM_VARIANT(server); then
-        $2LDFLAGS_JDKLIB="${$2LDFLAGS_JDKLIB} -L\$(SUPPORT_OUTPUTDIR)/modules_libs/java.base\$(OPENJDK_$1_CPU_LIBDIR)/server"
+        $2JAVA_BASE_LDFLAGS="${$2JAVA_BASE_LDFLAGS} -L\$(SUPPORT_OUTPUTDIR)/modules_libs/java.base\$(OPENJDK_$1_CPU_LIBDIR)/server"
       elif HOTSPOT_CHECK_JVM_VARIANT(client); then
-        $2LDFLAGS_JDKLIB="${$2LDFLAGS_JDKLIB} -L\$(SUPPORT_OUTPUTDIR)/modules_libs/java.base\$(OPENJDK_$1_CPU_LIBDIR)/client"
+        $2JAVA_BASE_LDFLAGS="${$2JAVA_BASE_LDFLAGS} -L\$(SUPPORT_OUTPUTDIR)/modules_libs/java.base\$(OPENJDK_$1_CPU_LIBDIR)/client"
       elif HOTSPOT_CHECK_JVM_VARIANT(minimal); then
-        $2LDFLAGS_JDKLIB="${$2LDFLAGS_JDKLIB} -L\$(SUPPORT_OUTPUTDIR)/modules_libs/java.base\$(OPENJDK_$1_CPU_LIBDIR)/minimal"
+        $2JAVA_BASE_LDFLAGS="${$2JAVA_BASE_LDFLAGS} -L\$(SUPPORT_OUTPUTDIR)/modules_libs/java.base\$(OPENJDK_$1_CPU_LIBDIR)/minimal"
     else
-        $2LDFLAGS_JDKLIB="${$2LDFLAGS_JDKLIB} -L\$(SUPPORT_OUTPUTDIR)/modules_libs/java.base\$(OPENJDK_$1_CPU_LIBDIR)/server"
+        $2JAVA_BASE_LDFLAGS="${$2JAVA_BASE_LDFLAGS} -L\$(SUPPORT_OUTPUTDIR)/modules_libs/java.base\$(OPENJDK_$1_CPU_LIBDIR)/server"
     fi
     elif test "x$1" = "xBUILD"; then
       # When building a buildjdk, it's always only the server variant
-      $2LDFLAGS_JDKLIB="${$2LDFLAGS_JDKLIB} \
+      $2JAVA_BASE_LDFLAGS="${$2JAVA_BASE_LDFLAGS} \
           -L\$(SUPPORT_OUTPUTDIR)/modules_libs/java.base\$(OPENJDK_$1_CPU_LIBDIR)/server"
     fi
 
@@ -1181,6 +1178,8 @@
 
   fi
 
+$2LDFLAGS_JDKLIB="${$2LDFLAGS_JDKLIB} ${$2JAVA_BASE_LDFLAGS}"
+
   # Set $2JVM_LIBS (per os)
   if test "x$OPENJDK_$1_OS" = xlinux; then
     $2JVM_LIBS="[$]$2JVM_LIBS -lm -ldl -lpthread"
@@ -1447,19 +1446,24 @@
   AC_SUBST(CFLAGS_WARNINGS_ARE_ERRORS)
 ])
 
-AC_DEFUN_ONCE([FLAGS_SETUP_GCC6_COMPILER_FLAGS],
+# FLAGS_SETUP_GCC6_COMPILER_FLAGS([PREFIX])
+# Arguments:
+# $1 - Optional prefix for each variable defined.
+AC_DEFUN([FLAGS_SETUP_GCC6_COMPILER_FLAGS],
 [
   # These flags are required for GCC 6 builds as undefined behaviour in OpenJDK code
   # runs afoul of the more aggressive versions of these optimisations.
   # Notably, value range propagation now assumes that the this pointer of C++
   # member functions is non-null.
-  NO_NULL_POINTER_CHECK_CFLAG="-fno-delete-null-pointer-checks"
-  FLAGS_COMPILER_CHECK_ARGUMENTS(ARGUMENT: [$NO_NULL_POINTER_CHECK_CFLAG -Werror],
-  					     IF_FALSE: [NO_NULL_POINTER_CHECK_CFLAG=""])
-  AC_SUBST([NO_NULL_POINTER_CHECK_CFLAG])
+  NO_DELETE_NULL_POINTER_CHECKS_CFLAG="-fno-delete-null-pointer-checks"
+  dnl Argument check is disabled until FLAGS_COMPILER_CHECK_ARGUMENTS handles cross-compilation
+  dnl FLAGS_COMPILER_CHECK_ARGUMENTS(ARGUMENT: [$NO_DELETE_NULL_POINTER_CHECKS_CFLAG -Werror],
+  dnl					     IF_FALSE: [NO_DELETE_NULL_POINTER_CHECKS_CFLAG=""])
   NO_LIFETIME_DSE_CFLAG="-fno-lifetime-dse"
-  FLAGS_COMPILER_CHECK_ARGUMENTS(ARGUMENT: [$NO_LIFETIME_DSE_CFLAG -Werror],
-  					     IF_FALSE: [NO_LIFETIME_DSE_CFLAG=""])
-  CFLAGS_JDK="${CFLAGS_JDK} ${NO_NULL_POINTER_CHECK_CFLAG} ${NO_LIFETIME_DSE_CFLAG}"
-  AC_SUBST([NO_LIFETIME_DSE_CFLAG])
+  dnl Argument check is disabled until FLAGS_COMPILER_CHECK_ARGUMENTS handles cross-compilation
+  dnl FLAGS_COMPILER_CHECK_ARGUMENTS(ARGUMENT: [$NO_LIFETIME_DSE_CFLAG -Werror],
+  dnl					     IF_FALSE: [NO_LIFETIME_DSE_CFLAG=""])
+  AC_MSG_NOTICE([GCC >= 6 detected; adding ${NO_DELETE_NULL_POINTER_CHECKS_CFLAG} and ${NO_LIFETIME_DSE_CFLAG}])
+  $1CFLAGS_JDK="[$]$1CFLAGS_JDK ${NO_DELETE_NULL_POINTER_CHECKS_CFLAG} ${NO_LIFETIME_DSE_CFLAG}"
+  $1JVM_CFLAGS="[$]$1JVM_CFLAGS ${NO_DELETE_NULL_POINTER_CHECKS_CFLAG} ${NO_LIFETIME_DSE_CFLAG}"
 ])
diff --git a/common/autoconf/generated-configure.sh b/common/autoconf/generated-configure.sh
index 961e90e..02375c6 100644
--- a/common/autoconf/generated-configure.sh
+++ b/common/autoconf/generated-configure.sh
@@ -749,8 +749,6 @@
 CFLAGS_JDKEXE
 CFLAGS_JDKLIB
 MACOSX_VERSION_MIN
-NO_LIFETIME_DSE_CFLAG
-NO_NULL_POINTER_CHECK_CFLAG
 CXXSTD_CXXFLAG
 CXX_O_FLAG_SIZE
 CXX_O_FLAG_NONE
@@ -4092,6 +4090,9 @@
 
 
 
+# FLAGS_SETUP_GCC6_COMPILER_FLAGS([PREFIX])
+# Arguments:
+# $1 - Optional prefix for each variable defined.
 
 
 #
@@ -4913,7 +4914,7 @@
 TOOLCHAIN_MINIMUM_VERSION_clang="3.2"
 TOOLCHAIN_MINIMUM_VERSION_gcc="4.3"
 TOOLCHAIN_MINIMUM_VERSION_microsoft=""
-TOOLCHAIN_MINIMUM_VERSION_solstudio="5.12"
+TOOLCHAIN_MINIMUM_VERSION_solstudio="5.13"
 TOOLCHAIN_MINIMUM_VERSION_xlc=""
 
 # Prepare the system so that TOOLCHAIN_CHECK_COMPILER_VERSION can be called.
@@ -5094,7 +5095,7 @@
 #CUSTOM_AUTOCONF_INCLUDE
 
 # Do not change or remove the following line, it is needed for consistency checks:
-DATE_WHEN_GENERATED=1469202305
+DATE_WHEN_GENERATED=1470415803
 
 ###############################################################################
 #
@@ -43767,8 +43768,12 @@
   fi
 
 
-  # Restore old path.
-  PATH="$OLD_PATH"
+  # Restore old path, except for the microsoft toolchain, which requires VS_PATH
+  # to remain in place. Otherwise the compiler will not work in some siutations
+  # in later configure checks.
+  if test "x$TOOLCHAIN_TYPE" != "xmicrosoft"; then
+    PATH="$OLD_PATH"
+  fi
 
   # Restore the flags to the user specified values.
   # This is necessary since AC_PROG_CC defaults CFLAGS to "-g -O2"
@@ -47232,6 +47237,28 @@
     BUILD_SYSROOT_CFLAGS="$SYSROOT_CFLAGS"
     BUILD_SYSROOT_LDFLAGS="$SYSROOT_LDFLAGS"
     BUILD_AR="$AR"
+
+
+  if test "x$CC_VERSION_NUMBER" != "x$CXX_VERSION_NUMBER"; then
+    { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: C and C++ compiler have different version numbers, $CC_VERSION_NUMBER vs $CXX_VERSION_NUMBER." >&5
+$as_echo "$as_me: WARNING: C and C++ compiler have different version numbers, $CC_VERSION_NUMBER vs $CXX_VERSION_NUMBER." >&2;}
+    { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: This typically indicates a broken setup, and is not supported" >&5
+$as_echo "$as_me: WARNING: This typically indicates a broken setup, and is not supported" >&2;}
+  fi
+
+  # We only check CC_VERSION_NUMBER since we assume CXX_VERSION_NUMBER is equal.
+  if  [[ "[$]CC_VERSION_NUMBER" =~ (.*\.){3} ]] ; then
+    { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: C compiler version number has more than three parts (X.Y.Z): $CC_VERSION_NUMBER. Comparisons might be wrong." >&5
+$as_echo "$as_me: WARNING: C compiler version number has more than three parts (X.Y.Z): $CC_VERSION_NUMBER. Comparisons might be wrong." >&2;}
+  fi
+
+  if  [[  "[$]CC_VERSION_NUMBER" =~ [0-9]{6} ]] ; then
+    { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: C compiler version number has a part larger than 99999: $CC_VERSION_NUMBER. Comparisons might be wrong." >&5
+$as_echo "$as_me: WARNING: C compiler version number has a part larger than 99999: $CC_VERSION_NUMBER. Comparisons might be wrong." >&2;}
+  fi
+
+  OPENJDK_BUILD_COMPARABLE_ACTUAL_VERSION=`$AWK -F. '{ printf("%05d%05d%05d\n", $1, $2, $3) }' <<< "$CC_VERSION_NUMBER"`
+
   fi
 
 
@@ -49781,20 +49808,17 @@
 
 
     CXXFLAGS_JDK="${CXXFLAGS_JDK} ${CXXSTD_CXXFLAG}"
+    JVM_CFLAGS="${JVM_CFLAGS} ${CXXSTD_CXXFLAG}"
 
   fi
   if test "x$OPENJDK_TARGET_OS" = xsolaris; then
     CFLAGS_JDK="${CFLAGS_JDK} -D__solaris__"
     CXXFLAGS_JDK="${CXXFLAGS_JDK} -D__solaris__"
-    CFLAGS_JDKLIB_EXTRA='-xstrconst'
-    CFLAGS_JDK="${CFLAGS_JDK} -qchars=signed -qfullpath -qsaveopt"
-    CXXFLAGS_JDK="${CXXFLAGS_JDK} -qchars=signed -qfullpath -qsaveopt"
   fi
 
   if test "x$OPENJDK_TARGET_OS" = xsolaris; then
     CFLAGS_JDK="${CFLAGS_JDK} -D__solaris__"
     CXXFLAGS_JDK="${CXXFLAGS_JDK} -D__solaris__"
-    CFLAGS_JDKLIB_EXTRA='-xstrconst'
   fi
 
   CFLAGS_JDK="${CFLAGS_JDK} ${EXTRA_CFLAGS}"
@@ -49913,542 +49937,12 @@
   # runs afoul of the more aggressive versions of these optimisations.
   # Notably, value range propagation now assumes that the this pointer of C++
   # member functions is non-null.
-  NO_NULL_POINTER_CHECK_CFLAG="-fno-delete-null-pointer-checks"
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-    # Execute function body
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-    # Execute function body
-
-  { $as_echo "$as_me:${as_lineno-$LINENO}: checking if the C compiler supports \"$NO_NULL_POINTER_CHECK_CFLAG -Werror\"" >&5
-$as_echo_n "checking if the C compiler supports \"$NO_NULL_POINTER_CHECK_CFLAG -Werror\"... " >&6; }
-  supports=yes
-
-  saved_cflags="$CFLAGS"
-  CFLAGS="$CFLAGS $NO_NULL_POINTER_CHECK_CFLAG -Werror"
-  ac_ext=c
-ac_cpp='$CPP $CPPFLAGS'
-ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5'
-ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5'
-ac_compiler_gnu=$ac_cv_c_compiler_gnu
-
-  cat confdefs.h - <<_ACEOF >conftest.$ac_ext
-/* end confdefs.h.  */
-int i;
-_ACEOF
-if ac_fn_c_try_compile "$LINENO"; then :
-
-else
-  supports=no
-fi
-rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
-  ac_ext=cpp
-ac_cpp='$CXXCPP $CPPFLAGS'
-ac_compile='$CXX -c $CXXFLAGS $CPPFLAGS conftest.$ac_ext >&5'
-ac_link='$CXX -o conftest$ac_exeext $CXXFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5'
-ac_compiler_gnu=$ac_cv_cxx_compiler_gnu
-
-  CFLAGS="$saved_cflags"
-
-  { $as_echo "$as_me:${as_lineno-$LINENO}: result: $supports" >&5
-$as_echo "$supports" >&6; }
-  if test "x$supports" = "xyes" ; then
-    :
-    C_COMP_SUPPORTS="yes"
-  else
-    :
-    C_COMP_SUPPORTS="no"
-  fi
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-    # Execute function body
-
-  { $as_echo "$as_me:${as_lineno-$LINENO}: checking if the C++ compiler supports \"$NO_NULL_POINTER_CHECK_CFLAG -Werror\"" >&5
-$as_echo_n "checking if the C++ compiler supports \"$NO_NULL_POINTER_CHECK_CFLAG -Werror\"... " >&6; }
-  supports=yes
-
-  saved_cxxflags="$CXXFLAGS"
-  CXXFLAGS="$CXXFLAG $NO_NULL_POINTER_CHECK_CFLAG -Werror"
-  ac_ext=cpp
-ac_cpp='$CXXCPP $CPPFLAGS'
-ac_compile='$CXX -c $CXXFLAGS $CPPFLAGS conftest.$ac_ext >&5'
-ac_link='$CXX -o conftest$ac_exeext $CXXFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5'
-ac_compiler_gnu=$ac_cv_cxx_compiler_gnu
-
-  cat confdefs.h - <<_ACEOF >conftest.$ac_ext
-/* end confdefs.h.  */
-int i;
-_ACEOF
-if ac_fn_cxx_try_compile "$LINENO"; then :
-
-else
-  supports=no
-fi
-rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
-  ac_ext=cpp
-ac_cpp='$CXXCPP $CPPFLAGS'
-ac_compile='$CXX -c $CXXFLAGS $CPPFLAGS conftest.$ac_ext >&5'
-ac_link='$CXX -o conftest$ac_exeext $CXXFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5'
-ac_compiler_gnu=$ac_cv_cxx_compiler_gnu
-
-  CXXFLAGS="$saved_cxxflags"
-
-  { $as_echo "$as_me:${as_lineno-$LINENO}: result: $supports" >&5
-$as_echo "$supports" >&6; }
-  if test "x$supports" = "xyes" ; then
-    :
-    CXX_COMP_SUPPORTS="yes"
-  else
-    :
-    CXX_COMP_SUPPORTS="no"
-  fi
-
-
-
-
-
-
-
-
-
-
-
-
-
-  { $as_echo "$as_me:${as_lineno-$LINENO}: checking if both compilers support \"$NO_NULL_POINTER_CHECK_CFLAG -Werror\"" >&5
-$as_echo_n "checking if both compilers support \"$NO_NULL_POINTER_CHECK_CFLAG -Werror\"... " >&6; }
-  supports=no
-  if test "x$C_COMP_SUPPORTS" = "xyes" -a "x$CXX_COMP_SUPPORTS" = "xyes"; then supports=yes; fi
-
-  { $as_echo "$as_me:${as_lineno-$LINENO}: result: $supports" >&5
-$as_echo "$supports" >&6; }
-  if test "x$supports" = "xyes" ; then
-    :
-
-  else
-    :
-    NO_NULL_POINTER_CHECK_CFLAG=""
-  fi
-
-
-
-
-
-
-
-  NO_LIFETIME_DSE_CFLAG="-fno-lifetime-dse"
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-    # Execute function body
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-    # Execute function body
-
-  { $as_echo "$as_me:${as_lineno-$LINENO}: checking if the C compiler supports \"$NO_LIFETIME_DSE_CFLAG -Werror\"" >&5
-$as_echo_n "checking if the C compiler supports \"$NO_LIFETIME_DSE_CFLAG -Werror\"... " >&6; }
-  supports=yes
-
-  saved_cflags="$CFLAGS"
-  CFLAGS="$CFLAGS $NO_LIFETIME_DSE_CFLAG -Werror"
-  ac_ext=c
-ac_cpp='$CPP $CPPFLAGS'
-ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5'
-ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5'
-ac_compiler_gnu=$ac_cv_c_compiler_gnu
-
-  cat confdefs.h - <<_ACEOF >conftest.$ac_ext
-/* end confdefs.h.  */
-int i;
-_ACEOF
-if ac_fn_c_try_compile "$LINENO"; then :
-
-else
-  supports=no
-fi
-rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
-  ac_ext=cpp
-ac_cpp='$CXXCPP $CPPFLAGS'
-ac_compile='$CXX -c $CXXFLAGS $CPPFLAGS conftest.$ac_ext >&5'
-ac_link='$CXX -o conftest$ac_exeext $CXXFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5'
-ac_compiler_gnu=$ac_cv_cxx_compiler_gnu
-
-  CFLAGS="$saved_cflags"
-
-  { $as_echo "$as_me:${as_lineno-$LINENO}: result: $supports" >&5
-$as_echo "$supports" >&6; }
-  if test "x$supports" = "xyes" ; then
-    :
-    C_COMP_SUPPORTS="yes"
-  else
-    :
-    C_COMP_SUPPORTS="no"
-  fi
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-    # Execute function body
-
-  { $as_echo "$as_me:${as_lineno-$LINENO}: checking if the C++ compiler supports \"$NO_LIFETIME_DSE_CFLAG -Werror\"" >&5
-$as_echo_n "checking if the C++ compiler supports \"$NO_LIFETIME_DSE_CFLAG -Werror\"... " >&6; }
-  supports=yes
-
-  saved_cxxflags="$CXXFLAGS"
-  CXXFLAGS="$CXXFLAG $NO_LIFETIME_DSE_CFLAG -Werror"
-  ac_ext=cpp
-ac_cpp='$CXXCPP $CPPFLAGS'
-ac_compile='$CXX -c $CXXFLAGS $CPPFLAGS conftest.$ac_ext >&5'
-ac_link='$CXX -o conftest$ac_exeext $CXXFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5'
-ac_compiler_gnu=$ac_cv_cxx_compiler_gnu
-
-  cat confdefs.h - <<_ACEOF >conftest.$ac_ext
-/* end confdefs.h.  */
-int i;
-_ACEOF
-if ac_fn_cxx_try_compile "$LINENO"; then :
-
-else
-  supports=no
-fi
-rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
-  ac_ext=cpp
-ac_cpp='$CXXCPP $CPPFLAGS'
-ac_compile='$CXX -c $CXXFLAGS $CPPFLAGS conftest.$ac_ext >&5'
-ac_link='$CXX -o conftest$ac_exeext $CXXFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5'
-ac_compiler_gnu=$ac_cv_cxx_compiler_gnu
-
-  CXXFLAGS="$saved_cxxflags"
-
-  { $as_echo "$as_me:${as_lineno-$LINENO}: result: $supports" >&5
-$as_echo "$supports" >&6; }
-  if test "x$supports" = "xyes" ; then
-    :
-    CXX_COMP_SUPPORTS="yes"
-  else
-    :
-    CXX_COMP_SUPPORTS="no"
-  fi
-
-
-
-
-
-
-
-
-
-
-
-
-
-  { $as_echo "$as_me:${as_lineno-$LINENO}: checking if both compilers support \"$NO_LIFETIME_DSE_CFLAG -Werror\"" >&5
-$as_echo_n "checking if both compilers support \"$NO_LIFETIME_DSE_CFLAG -Werror\"... " >&6; }
-  supports=no
-  if test "x$C_COMP_SUPPORTS" = "xyes" -a "x$CXX_COMP_SUPPORTS" = "xyes"; then supports=yes; fi
-
-  { $as_echo "$as_me:${as_lineno-$LINENO}: result: $supports" >&5
-$as_echo "$supports" >&6; }
-  if test "x$supports" = "xyes" ; then
-    :
-
-  else
-    :
-    NO_LIFETIME_DSE_CFLAG=""
-  fi
-
-
-
-
-
-
-  CFLAGS_JDK="${CFLAGS_JDK} ${NO_NULL_POINTER_CHECK_CFLAG} ${NO_LIFETIME_DSE_CFLAG}"
-
-
+  NO_DELETE_NULL_POINTER_CHECKS_CFLAG="-fno-delete-null-pointer-checks"
+        NO_LIFETIME_DSE_CFLAG="-fno-lifetime-dse"
+        { $as_echo "$as_me:${as_lineno-$LINENO}: GCC >= 6 detected; adding ${NO_DELETE_NULL_POINTER_CHECKS_CFLAG} and ${NO_LIFETIME_DSE_CFLAG}" >&5
+$as_echo "$as_me: GCC >= 6 detected; adding ${NO_DELETE_NULL_POINTER_CHECKS_CFLAG} and ${NO_LIFETIME_DSE_CFLAG}" >&6;}
+  CFLAGS_JDK="$CFLAGS_JDK ${NO_DELETE_NULL_POINTER_CHECKS_CFLAG} ${NO_LIFETIME_DSE_CFLAG}"
+  JVM_CFLAGS="$JVM_CFLAGS ${NO_DELETE_NULL_POINTER_CHECKS_CFLAG} ${NO_LIFETIME_DSE_CFLAG}"
 
   else
     :
@@ -50900,7 +50394,7 @@
     fi
   elif test "x$TOOLCHAIN_TYPE" = xsolstudio; then
     LDFLAGS_SOLSTUDIO="-Wl,-z,defs"
-    LDFLAGS_JDK="$LDFLAGS_JDK $LDFLAGS_SOLSTUDIO -xildoff -ztext"
+    LDFLAGS_JDK="$LDFLAGS_JDK $LDFLAGS_SOLSTUDIO -ztext"
     LDFLAGS_CXX_SOLSTUDIO="-norunpath"
     LDFLAGS_CXX_JDK="$LDFLAGS_CXX_JDK $LDFLAGS_CXX_SOLSTUDIO -xnolib"
     JVM_LDFLAGS="$JVM_LDFLAGS $LDFLAGS_SOLSTUDIO -library=%none -mt $LDFLAGS_CXX_SOLSTUDIO -z noversion"
@@ -50935,11 +50429,11 @@
 
   LDFLAGS_JDKLIB="${LDFLAGS_JDKLIB} ${SHARED_LIBRARY_FLAGS}"
   if test "x$TOOLCHAIN_TYPE" = xmicrosoft; then
-    LDFLAGS_JDKLIB="${LDFLAGS_JDKLIB} \
+    JAVA_BASE_LDFLAGS="${JAVA_BASE_LDFLAGS} \
         -libpath:${OUTPUT_ROOT}/support/modules_libs/java.base"
     JDKLIB_LIBS=""
   else
-    LDFLAGS_JDKLIB="${LDFLAGS_JDKLIB} \
+    JAVA_BASE_LDFLAGS="${JAVA_BASE_LDFLAGS} \
         -L\$(SUPPORT_OUTPUTDIR)/modules_libs/java.base\$(OPENJDK_TARGET_CPU_LIBDIR)"
 
     if test "xTARGET" = "xTARGET"; then
@@ -50948,17 +50442,17 @@
       # Only add client/minimal dir if client/minimal is being built.
     # Default to server for other variants.
       if   [[ " $JVM_VARIANTS " =~ " server " ]]  ; then
-        LDFLAGS_JDKLIB="${LDFLAGS_JDKLIB} -L\$(SUPPORT_OUTPUTDIR)/modules_libs/java.base\$(OPENJDK_TARGET_CPU_LIBDIR)/server"
+        JAVA_BASE_LDFLAGS="${JAVA_BASE_LDFLAGS} -L\$(SUPPORT_OUTPUTDIR)/modules_libs/java.base\$(OPENJDK_TARGET_CPU_LIBDIR)/server"
       elif   [[ " $JVM_VARIANTS " =~ " client " ]]  ; then
-        LDFLAGS_JDKLIB="${LDFLAGS_JDKLIB} -L\$(SUPPORT_OUTPUTDIR)/modules_libs/java.base\$(OPENJDK_TARGET_CPU_LIBDIR)/client"
+        JAVA_BASE_LDFLAGS="${JAVA_BASE_LDFLAGS} -L\$(SUPPORT_OUTPUTDIR)/modules_libs/java.base\$(OPENJDK_TARGET_CPU_LIBDIR)/client"
       elif   [[ " $JVM_VARIANTS " =~ " minimal " ]]  ; then
-        LDFLAGS_JDKLIB="${LDFLAGS_JDKLIB} -L\$(SUPPORT_OUTPUTDIR)/modules_libs/java.base\$(OPENJDK_TARGET_CPU_LIBDIR)/minimal"
+        JAVA_BASE_LDFLAGS="${JAVA_BASE_LDFLAGS} -L\$(SUPPORT_OUTPUTDIR)/modules_libs/java.base\$(OPENJDK_TARGET_CPU_LIBDIR)/minimal"
     else
-        LDFLAGS_JDKLIB="${LDFLAGS_JDKLIB} -L\$(SUPPORT_OUTPUTDIR)/modules_libs/java.base\$(OPENJDK_TARGET_CPU_LIBDIR)/server"
+        JAVA_BASE_LDFLAGS="${JAVA_BASE_LDFLAGS} -L\$(SUPPORT_OUTPUTDIR)/modules_libs/java.base\$(OPENJDK_TARGET_CPU_LIBDIR)/server"
     fi
     elif test "xTARGET" = "xBUILD"; then
       # When building a buildjdk, it's always only the server variant
-      LDFLAGS_JDKLIB="${LDFLAGS_JDKLIB} \
+      JAVA_BASE_LDFLAGS="${JAVA_BASE_LDFLAGS} \
           -L\$(SUPPORT_OUTPUTDIR)/modules_libs/java.base\$(OPENJDK_TARGET_CPU_LIBDIR)/server"
     fi
 
@@ -50969,6 +50463,8 @@
 
   fi
 
+LDFLAGS_JDKLIB="${LDFLAGS_JDKLIB} ${JAVA_BASE_LDFLAGS}"
+
   # Set JVM_LIBS (per os)
   if test "x$OPENJDK_TARGET_OS" = xlinux; then
     JVM_LIBS="$JVM_LIBS -lm -ldl -lpthread"
@@ -51127,20 +50623,17 @@
 
 
     OPENJDK_BUILD_CXXFLAGS_JDK="${OPENJDK_BUILD_CXXFLAGS_JDK} ${OPENJDK_BUILD_CXXSTD_CXXFLAG}"
+    OPENJDK_BUILD_JVM_CFLAGS="${OPENJDK_BUILD_JVM_CFLAGS} ${OPENJDK_BUILD_CXXSTD_CXXFLAG}"
 
   fi
   if test "x$OPENJDK_TARGET_OS" = xsolaris; then
     OPENJDK_BUILD_CFLAGS_JDK="${OPENJDK_BUILD_CFLAGS_JDK} -D__solaris__"
     OPENJDK_BUILD_CXXFLAGS_JDK="${OPENJDK_BUILD_CXXFLAGS_JDK} -D__solaris__"
-    OPENJDK_BUILD_CFLAGS_JDKLIB_EXTRA='-xstrconst'
-    CFLAGS_JDK="${CFLAGS_JDK} -qchars=signed -qfullpath -qsaveopt"
-    CXXFLAGS_JDK="${CXXFLAGS_JDK} -qchars=signed -qfullpath -qsaveopt"
   fi
 
   if test "x$OPENJDK_TARGET_OS" = xsolaris; then
     OPENJDK_BUILD_CFLAGS_JDK="${OPENJDK_BUILD_CFLAGS_JDK} -D__solaris__"
     OPENJDK_BUILD_CXXFLAGS_JDK="${OPENJDK_BUILD_CXXFLAGS_JDK} -D__solaris__"
-    OPENJDK_BUILD_CFLAGS_JDKLIB_EXTRA='-xstrconst'
   fi
 
   OPENJDK_BUILD_CFLAGS_JDK="${OPENJDK_BUILD_CFLAGS_JDK} ${OPENJDK_BUILD_EXTRA_CFLAGS}"
@@ -51255,6 +50748,17 @@
   if test $OPENJDK_BUILD_COMPARABLE_ACTUAL_VERSION -ge $COMPARABLE_REFERENCE_VERSION ; then
     :
 
+  # These flags are required for GCC 6 builds as undefined behaviour in OpenJDK code
+  # runs afoul of the more aggressive versions of these optimisations.
+  # Notably, value range propagation now assumes that the this pointer of C++
+  # member functions is non-null.
+  NO_DELETE_NULL_POINTER_CHECKS_CFLAG="-fno-delete-null-pointer-checks"
+        NO_LIFETIME_DSE_CFLAG="-fno-lifetime-dse"
+        { $as_echo "$as_me:${as_lineno-$LINENO}: GCC >= 6 detected; adding ${NO_DELETE_NULL_POINTER_CHECKS_CFLAG} and ${NO_LIFETIME_DSE_CFLAG}" >&5
+$as_echo "$as_me: GCC >= 6 detected; adding ${NO_DELETE_NULL_POINTER_CHECKS_CFLAG} and ${NO_LIFETIME_DSE_CFLAG}" >&6;}
+  OPENJDK_BUILD_CFLAGS_JDK="$OPENJDK_BUILD_CFLAGS_JDK ${NO_DELETE_NULL_POINTER_CHECKS_CFLAG} ${NO_LIFETIME_DSE_CFLAG}"
+  OPENJDK_BUILD_JVM_CFLAGS="$OPENJDK_BUILD_JVM_CFLAGS ${NO_DELETE_NULL_POINTER_CHECKS_CFLAG} ${NO_LIFETIME_DSE_CFLAG}"
+
   else
     :
 
@@ -51705,7 +51209,7 @@
     fi
   elif test "x$TOOLCHAIN_TYPE" = xsolstudio; then
     LDFLAGS_SOLSTUDIO="-Wl,-z,defs"
-    OPENJDK_BUILD_LDFLAGS_JDK="$OPENJDK_BUILD_LDFLAGS_JDK $LDFLAGS_SOLSTUDIO -xildoff -ztext"
+    OPENJDK_BUILD_LDFLAGS_JDK="$OPENJDK_BUILD_LDFLAGS_JDK $LDFLAGS_SOLSTUDIO -ztext"
     LDFLAGS_CXX_SOLSTUDIO="-norunpath"
     OPENJDK_BUILD_LDFLAGS_CXX_JDK="$OPENJDK_BUILD_LDFLAGS_CXX_JDK $LDFLAGS_CXX_SOLSTUDIO -xnolib"
     OPENJDK_BUILD_JVM_LDFLAGS="$OPENJDK_BUILD_JVM_LDFLAGS $LDFLAGS_SOLSTUDIO -library=%none -mt $LDFLAGS_CXX_SOLSTUDIO -z noversion"
@@ -51740,11 +51244,11 @@
 
   OPENJDK_BUILD_LDFLAGS_JDKLIB="${OPENJDK_BUILD_LDFLAGS_JDKLIB} ${SHARED_LIBRARY_FLAGS}"
   if test "x$TOOLCHAIN_TYPE" = xmicrosoft; then
-    OPENJDK_BUILD_LDFLAGS_JDKLIB="${OPENJDK_BUILD_LDFLAGS_JDKLIB} \
+    OPENJDK_BUILD_JAVA_BASE_LDFLAGS="${OPENJDK_BUILD_JAVA_BASE_LDFLAGS} \
         -libpath:${OUTPUT_ROOT}/support/modules_libs/java.base"
     OPENJDK_BUILD_JDKLIB_LIBS=""
   else
-    OPENJDK_BUILD_LDFLAGS_JDKLIB="${OPENJDK_BUILD_LDFLAGS_JDKLIB} \
+    OPENJDK_BUILD_JAVA_BASE_LDFLAGS="${OPENJDK_BUILD_JAVA_BASE_LDFLAGS} \
         -L\$(SUPPORT_OUTPUTDIR)/modules_libs/java.base\$(OPENJDK_BUILD_CPU_LIBDIR)"
 
     if test "xBUILD" = "xTARGET"; then
@@ -51753,17 +51257,17 @@
       # Only add client/minimal dir if client/minimal is being built.
     # Default to server for other variants.
       if   [[ " $JVM_VARIANTS " =~ " server " ]]  ; then
-        OPENJDK_BUILD_LDFLAGS_JDKLIB="${OPENJDK_BUILD_LDFLAGS_JDKLIB} -L\$(SUPPORT_OUTPUTDIR)/modules_libs/java.base\$(OPENJDK_BUILD_CPU_LIBDIR)/server"
+        OPENJDK_BUILD_JAVA_BASE_LDFLAGS="${OPENJDK_BUILD_JAVA_BASE_LDFLAGS} -L\$(SUPPORT_OUTPUTDIR)/modules_libs/java.base\$(OPENJDK_BUILD_CPU_LIBDIR)/server"
       elif   [[ " $JVM_VARIANTS " =~ " client " ]]  ; then
-        OPENJDK_BUILD_LDFLAGS_JDKLIB="${OPENJDK_BUILD_LDFLAGS_JDKLIB} -L\$(SUPPORT_OUTPUTDIR)/modules_libs/java.base\$(OPENJDK_BUILD_CPU_LIBDIR)/client"
+        OPENJDK_BUILD_JAVA_BASE_LDFLAGS="${OPENJDK_BUILD_JAVA_BASE_LDFLAGS} -L\$(SUPPORT_OUTPUTDIR)/modules_libs/java.base\$(OPENJDK_BUILD_CPU_LIBDIR)/client"
       elif   [[ " $JVM_VARIANTS " =~ " minimal " ]]  ; then
-        OPENJDK_BUILD_LDFLAGS_JDKLIB="${OPENJDK_BUILD_LDFLAGS_JDKLIB} -L\$(SUPPORT_OUTPUTDIR)/modules_libs/java.base\$(OPENJDK_BUILD_CPU_LIBDIR)/minimal"
+        OPENJDK_BUILD_JAVA_BASE_LDFLAGS="${OPENJDK_BUILD_JAVA_BASE_LDFLAGS} -L\$(SUPPORT_OUTPUTDIR)/modules_libs/java.base\$(OPENJDK_BUILD_CPU_LIBDIR)/minimal"
     else
-        OPENJDK_BUILD_LDFLAGS_JDKLIB="${OPENJDK_BUILD_LDFLAGS_JDKLIB} -L\$(SUPPORT_OUTPUTDIR)/modules_libs/java.base\$(OPENJDK_BUILD_CPU_LIBDIR)/server"
+        OPENJDK_BUILD_JAVA_BASE_LDFLAGS="${OPENJDK_BUILD_JAVA_BASE_LDFLAGS} -L\$(SUPPORT_OUTPUTDIR)/modules_libs/java.base\$(OPENJDK_BUILD_CPU_LIBDIR)/server"
     fi
     elif test "xBUILD" = "xBUILD"; then
       # When building a buildjdk, it's always only the server variant
-      OPENJDK_BUILD_LDFLAGS_JDKLIB="${OPENJDK_BUILD_LDFLAGS_JDKLIB} \
+      OPENJDK_BUILD_JAVA_BASE_LDFLAGS="${OPENJDK_BUILD_JAVA_BASE_LDFLAGS} \
           -L\$(SUPPORT_OUTPUTDIR)/modules_libs/java.base\$(OPENJDK_BUILD_CPU_LIBDIR)/server"
     fi
 
@@ -51774,6 +51278,8 @@
 
   fi
 
+OPENJDK_BUILD_LDFLAGS_JDKLIB="${OPENJDK_BUILD_LDFLAGS_JDKLIB} ${OPENJDK_BUILD_JAVA_BASE_LDFLAGS}"
+
   # Set OPENJDK_BUILD_JVM_LIBS (per os)
   if test "x$OPENJDK_BUILD_OS" = xlinux; then
     OPENJDK_BUILD_JVM_LIBS="$OPENJDK_BUILD_JVM_LIBS -lm -ldl -lpthread"
@@ -51838,7 +51344,7 @@
 
 
   LDFLAGS_TESTLIB="$LDFLAGS_JDKLIB"
-  LDFLAGS_TESTEXE="$LDFLAGS_JDKEXE"
+  LDFLAGS_TESTEXE="$LDFLAGS_JDKEXE $JAVA_BASE_LDFLAGS"
 
 
 
@@ -53328,8 +52834,8 @@
     as_fn_error $? "Specified JVM feature 'management' requires feature 'nmt'" "$LINENO" 5
   fi
 
-  if   [[ " $JVM_FEATURES " =~ " jvmci " ]]   && !   [[ " $JVM_FEATURES " =~ " compiler2 " ]]  ; then
-    as_fn_error $? "Specified JVM feature 'jvmci' requires feature 'compiler2'" "$LINENO" 5
+  if   [[ " $JVM_FEATURES " =~ " jvmci " ]]   && ! (  [[ " $JVM_FEATURES " =~ " compiler1 " ]]   ||   [[ " $JVM_FEATURES " =~ " compiler2 " ]]  ); then
+    as_fn_error $? "Specified JVM feature 'jvmci' requires feature 'compiler2' or 'compiler1'" "$LINENO" 5
   fi
 
   if   [[ " $JVM_FEATURES " =~ " compiler2 " ]]   && !   [[ " $JVM_FEATURES " =~ " all-gcs " ]]  ; then
@@ -53369,7 +52875,7 @@
     fi
   fi
 
-  # Only enable jvmci on x86_64, sparcv9 and aarch64, and only on server.
+  # Only enable jvmci on x86_64, sparcv9 and aarch64.
   if test "x$OPENJDK_TARGET_CPU" = "xx86_64" || \
       test "x$OPENJDK_TARGET_CPU" = "xsparcv9" || \
       test "x$OPENJDK_TARGET_CPU" = "xaarch64" ; then
@@ -53383,7 +52889,7 @@
 
   # Enable features depending on variant.
   JVM_FEATURES_server="compiler1 compiler2 $NON_MINIMAL_FEATURES $JVM_FEATURES $JVM_FEATURES_jvmci"
-  JVM_FEATURES_client="compiler1 $NON_MINIMAL_FEATURES $JVM_FEATURES"
+  JVM_FEATURES_client="compiler1 $NON_MINIMAL_FEATURES $JVM_FEATURES $JVM_FEATURES_jvmci"
   JVM_FEATURES_core="$NON_MINIMAL_FEATURES $JVM_FEATURES"
   JVM_FEATURES_minimal="compiler1 minimal $JVM_FEATURES"
   JVM_FEATURES_zero="zero $NON_MINIMAL_FEATURES $JVM_FEATURES"
diff --git a/common/autoconf/hotspot.m4 b/common/autoconf/hotspot.m4
index 306e2db..cda292e 100644
--- a/common/autoconf/hotspot.m4
+++ b/common/autoconf/hotspot.m4
@@ -198,8 +198,8 @@
     AC_MSG_ERROR([Specified JVM feature 'management' requires feature 'nmt'])
   fi
 
-  if HOTSPOT_CHECK_JVM_FEATURE(jvmci) && ! HOTSPOT_CHECK_JVM_FEATURE(compiler2); then
-    AC_MSG_ERROR([Specified JVM feature 'jvmci' requires feature 'compiler2'])
+  if HOTSPOT_CHECK_JVM_FEATURE(jvmci) && ! (HOTSPOT_CHECK_JVM_FEATURE(compiler1) || HOTSPOT_CHECK_JVM_FEATURE(compiler2)); then
+    AC_MSG_ERROR([Specified JVM feature 'jvmci' requires feature 'compiler2' or 'compiler1'])
   fi
 
   if HOTSPOT_CHECK_JVM_FEATURE(compiler2) && ! HOTSPOT_CHECK_JVM_FEATURE(all-gcs); then
@@ -239,7 +239,7 @@
     fi
   fi
 
-  # Only enable jvmci on x86_64, sparcv9 and aarch64, and only on server.
+  # Only enable jvmci on x86_64, sparcv9 and aarch64.
   if test "x$OPENJDK_TARGET_CPU" = "xx86_64" || \
       test "x$OPENJDK_TARGET_CPU" = "xsparcv9" || \
       test "x$OPENJDK_TARGET_CPU" = "xaarch64" ; then
@@ -253,7 +253,7 @@
 
   # Enable features depending on variant.
   JVM_FEATURES_server="compiler1 compiler2 $NON_MINIMAL_FEATURES $JVM_FEATURES $JVM_FEATURES_jvmci"
-  JVM_FEATURES_client="compiler1 $NON_MINIMAL_FEATURES $JVM_FEATURES"
+  JVM_FEATURES_client="compiler1 $NON_MINIMAL_FEATURES $JVM_FEATURES $JVM_FEATURES_jvmci"
   JVM_FEATURES_core="$NON_MINIMAL_FEATURES $JVM_FEATURES"
   JVM_FEATURES_minimal="compiler1 minimal $JVM_FEATURES"
   JVM_FEATURES_zero="zero $NON_MINIMAL_FEATURES $JVM_FEATURES"
diff --git a/common/autoconf/spec.gmk.in b/common/autoconf/spec.gmk.in
index 0efabd4..5107640 100644
--- a/common/autoconf/spec.gmk.in
+++ b/common/autoconf/spec.gmk.in
@@ -391,8 +391,6 @@
 WARNINGS_AS_ERRORS := @WARNINGS_AS_ERRORS@
 
 CFLAGS_CCACHE:=@CFLAGS_CCACHE@
-NO_NULL_POINTER_CHECK_FLAG=@NO_NULL_POINTER_CHECK_CFLAG@
-NO_LIFETIME_DSE_CFLAG=@NO_LIFETIME_DSE_CFLAG@
 CXXSTD_CXXFLAG=@CXXSTD_CXXFLAG@
 
 # Tools that potentially need to be cross compilation aware.
diff --git a/common/autoconf/toolchain.m4 b/common/autoconf/toolchain.m4
index e87cb24..6a563f0 100644
--- a/common/autoconf/toolchain.m4
+++ b/common/autoconf/toolchain.m4
@@ -54,7 +54,7 @@
 TOOLCHAIN_MINIMUM_VERSION_clang="3.2"
 TOOLCHAIN_MINIMUM_VERSION_gcc="4.3"
 TOOLCHAIN_MINIMUM_VERSION_microsoft=""
-TOOLCHAIN_MINIMUM_VERSION_solstudio="5.12"
+TOOLCHAIN_MINIMUM_VERSION_solstudio="5.13"
 TOOLCHAIN_MINIMUM_VERSION_xlc=""
 
 # Prepare the system so that TOOLCHAIN_CHECK_COMPILER_VERSION can be called.
@@ -312,8 +312,12 @@
 # Restore path, etc
 AC_DEFUN_ONCE([TOOLCHAIN_POST_DETECTION],
 [
-  # Restore old path.
-  PATH="$OLD_PATH"
+  # Restore old path, except for the microsoft toolchain, which requires VS_PATH
+  # to remain in place. Otherwise the compiler will not work in some siutations
+  # in later configure checks.
+  if test "x$TOOLCHAIN_TYPE" != "xmicrosoft"; then
+    PATH="$OLD_PATH"
+  fi
 
   # Restore the flags to the user specified values.
   # This is necessary since AC_PROG_CC defaults CFLAGS to "-g -O2"
@@ -831,6 +835,8 @@
     BUILD_SYSROOT_CFLAGS="$SYSROOT_CFLAGS"
     BUILD_SYSROOT_LDFLAGS="$SYSROOT_LDFLAGS"
     BUILD_AR="$AR"
+    
+    TOOLCHAIN_PREPARE_FOR_VERSION_COMPARISONS([], [OPENJDK_BUILD_])
   fi
 
   AC_SUBST(BUILD_CC)
diff --git a/common/bin/hgforest.sh b/common/bin/hgforest.sh
index ff0bcdf..7320aa0 100644
--- a/common/bin/hgforest.sh
+++ b/common/bin/hgforest.sh
@@ -335,7 +335,10 @@
     for j in ${repos_extra} ; do
       if [ "${i}" = "${j}" ] ; then
         # it's an "extra"
-        pull_base="${pull_extra}"
+        if [ -n "${pull_extra}" ]; then
+          # if no pull_extra is defined, assume that pull_default is valid
+          pull_base="${pull_extra}"
+        fi
       fi
     done
 
diff --git a/common/conf/jib-profiles.js b/common/conf/jib-profiles.js
index cefedb0..2fa29a7 100644
--- a/common/conf/jib-profiles.js
+++ b/common/conf/jib-profiles.js
@@ -357,6 +357,18 @@
     var boot_jdk_platform = input.build_os + "-"
         + (input.build_cpu == "x86" ? "i586" : input.build_cpu);
 
+    var boot_jdk_revision = "8";
+    var boot_jdk_subdirpart = "1.8.0";
+    // JDK 8 does not work on sparc M7 cpus, need a newer update when building
+    // on such hardware.
+    if (input.build_cpu == "sparcv9") {
+       var cpu_brand = $EXEC("bash -c \"kstat -m cpu_info | grep brand | head -n1 | awk '{ print \$2 }'\"");
+       if (cpu_brand.trim() == 'SPARC-M7') {
+           boot_jdk_revision = "8u20";
+           boot_jdk_subdirpart = "1.8.0_20";
+       }
+    }
+
     var devkit_platform_revisions = {
         linux_x64: "gcc4.9.2-OEL6.4+1.0",
         macosx_x64: "Xcode6.3-MacOSX10.9+1.0",
@@ -374,12 +386,12 @@
         boot_jdk: {
             server: "javare",
             module: "jdk",
-            revision: "8",
+            revision: boot_jdk_revision,
             checksum_file: boot_jdk_platform + "/MD5_VALUES",
-            file: boot_jdk_platform + "/jdk-8-" + boot_jdk_platform + ".tar.gz",
+            file: boot_jdk_platform + "/jdk-" + boot_jdk_revision + "-" + boot_jdk_platform + ".tar.gz",
             configure_args: (input.build_os == "macosx"
-                ? "--with-boot-jdk=" + input.get("boot_jdk", "install_path") + "/jdk1.8.0.jdk/Contents/Home"
-                : "--with-boot-jdk=" + input.get("boot_jdk", "install_path") + "/jdk1.8.0")
+                ? "--with-boot-jdk=" + input.get("boot_jdk", "install_path") + "/jdk" + boot_jdk_subdirpart + ".jdk/Contents/Home"
+                : "--with-boot-jdk=" + input.get("boot_jdk", "install_path") + "/jdk" + boot_jdk_subdirpart)
         },
 
         devkit: {
diff --git a/corba/.hgtags b/corba/.hgtags
index 8cb5ff1..c046996 100644
--- a/corba/.hgtags
+++ b/corba/.hgtags
@@ -372,3 +372,4 @@
 8fab452b6f4710762ba1d8e55fd62db00b1355fe jdk-9+127
 1f093d3f8cd99cd37c3b0af4cf5c3bffaa9c8b98 jdk-9+128
 c3e83ccab3bb1733ae903d681879a33f85ed465c jdk-9+129
+77f9692d5976ae155773dd3e07533616bb95bae1 jdk-9+130
diff --git a/hotspot/.hgtags b/hotspot/.hgtags
index 16c8be5..dcd6fc2 100644
--- a/hotspot/.hgtags
+++ b/hotspot/.hgtags
@@ -532,3 +532,4 @@
 352357128f602dcf0426b1cbe011a4685a4d9f97 jdk-9+127
 22bf6db9767b1b3a1994cbf32eb3331f31ae2093 jdk-9+128
 e96b34b76d863ed1fa04e0eeb3f297ac17b490fd jdk-9+129
+7d54c7056328b6a2bf4877458b8f4d8cd870f93b jdk-9+130
diff --git a/hotspot/.mx.jvmci/mx_jvmci.py b/hotspot/.mx.jvmci/mx_jvmci.py
index ede9029..daa27f5 100644
--- a/hotspot/.mx.jvmci/mx_jvmci.py
+++ b/hotspot/.mx.jvmci/mx_jvmci.py
@@ -64,7 +64,7 @@
 _jdkDebugLevels = ['release', 'fastdebug', 'slowdebug']
 
 # TODO: add client once/if it can be built on 64-bit platforms
-_jdkJvmVariants = ['server']
+_jdkJvmVariants = ['server', 'client']
 
 """
 Translation table from mx_jvmci:8 --vmbuild values to mx_jvmci:9 --jdk-debug-level values.
diff --git a/hotspot/make/gensrc/GensrcAdlc.gmk b/hotspot/make/gensrc/GensrcAdlc.gmk
index a33d42d..abe6fd4 100644
--- a/hotspot/make/gensrc/GensrcAdlc.gmk
+++ b/hotspot/make/gensrc/GensrcAdlc.gmk
@@ -51,6 +51,9 @@
     ADLC_CFLAGS_WARNINGS := -W3 -D_CRT_SECURE_NO_WARNINGS
   endif
 
+  # Set the C++ standard if supported
+  ADLC_CFLAGS += $(CXXSTD_CXXFLAG)
+  
   # NOTE: The old build didn't set -DASSERT for windows but it doesn't seem to
   # hurt.
   ADLC_CFLAGS += -DASSERT
@@ -153,10 +156,10 @@
 	$(call MakeDir, $(@D))
 	$(call ExecuteWithLog, $(ADLC_SUPPORT_DIR)/adlc_run, \
 	    $(FIXPATH) $(ADLC_TOOL) $(ADLCFLAGS) $(SINGLE_AD_SRCFILE) \
-	        -c$(ADLC_SUPPORT_DIR)/ad_$(HOTSPOT_TARGET_CPU).cpp \
-	        -h$(ADLC_SUPPORT_DIR)/ad_$(HOTSPOT_TARGET_CPU).hpp \
-	        -a$(ADLC_SUPPORT_DIR)/dfa_$(HOTSPOT_TARGET_CPU).cpp \
-	        -v$(ADLC_SUPPORT_DIR)/adGlobals_$(HOTSPOT_TARGET_CPU).hpp)
+	        -c$(ADLC_SUPPORT_DIR)/ad_$(HOTSPOT_TARGET_CPU_ARCH).cpp \
+	        -h$(ADLC_SUPPORT_DIR)/ad_$(HOTSPOT_TARGET_CPU_ARCH).hpp \
+	        -a$(ADLC_SUPPORT_DIR)/dfa_$(HOTSPOT_TARGET_CPU_ARCH).cpp \
+	        -v$(ADLC_SUPPORT_DIR)/adGlobals_$(HOTSPOT_TARGET_CPU_ARCH).hpp)
 	$(TOUCH) $@
 
   ##############################################################################
@@ -164,17 +167,17 @@
   # and postprocess them by fixing dummy #line directives.
 
   ADLC_GENERATED_FILES := $(addprefix $(JVM_VARIANT_OUTPUTDIR)/gensrc/adfiles/, \
-      ad_$(HOTSPOT_TARGET_CPU).cpp \
-      ad_$(HOTSPOT_TARGET_CPU).hpp \
-      ad_$(HOTSPOT_TARGET_CPU)_clone.cpp \
-      ad_$(HOTSPOT_TARGET_CPU)_expand.cpp \
-      ad_$(HOTSPOT_TARGET_CPU)_format.cpp \
-      ad_$(HOTSPOT_TARGET_CPU)_gen.cpp \
-      ad_$(HOTSPOT_TARGET_CPU)_misc.cpp \
-      ad_$(HOTSPOT_TARGET_CPU)_peephole.cpp \
-      ad_$(HOTSPOT_TARGET_CPU)_pipeline.cpp \
-      adGlobals_$(HOTSPOT_TARGET_CPU).hpp \
-      dfa_$(HOTSPOT_TARGET_CPU).cpp \
+      ad_$(HOTSPOT_TARGET_CPU_ARCH).cpp \
+      ad_$(HOTSPOT_TARGET_CPU_ARCH).hpp \
+      ad_$(HOTSPOT_TARGET_CPU_ARCH)_clone.cpp \
+      ad_$(HOTSPOT_TARGET_CPU_ARCH)_expand.cpp \
+      ad_$(HOTSPOT_TARGET_CPU_ARCH)_format.cpp \
+      ad_$(HOTSPOT_TARGET_CPU_ARCH)_gen.cpp \
+      ad_$(HOTSPOT_TARGET_CPU_ARCH)_misc.cpp \
+      ad_$(HOTSPOT_TARGET_CPU_ARCH)_peephole.cpp \
+      ad_$(HOTSPOT_TARGET_CPU_ARCH)_pipeline.cpp \
+      adGlobals_$(HOTSPOT_TARGET_CPU_ARCH).hpp \
+      dfa_$(HOTSPOT_TARGET_CPU_ARCH).cpp \
   )
 
   $(JVM_VARIANT_OUTPUTDIR)/gensrc/adfiles/%: $(ADLC_RUN_MARKER)
diff --git a/hotspot/make/lib/CompileGtest.gmk b/hotspot/make/lib/CompileGtest.gmk
index 2a052a1..803413b 100644
--- a/hotspot/make/lib/CompileGtest.gmk
+++ b/hotspot/make/lib/CompileGtest.gmk
@@ -104,7 +104,7 @@
         -I$(GTEST_FRAMEWORK_SRC)/include, \
     CFLAGS_DEBUG_SYMBOLS := $(JVM_CFLAGS_SYMBOLS), \
     CXXFLAGS_DEBUG_SYMBOLS := $(JVM_CFLAGS_SYMBOLS), \
-    LDFLAGS := $(LDFLAGS_TESTEXE), \
+    LDFLAGS := $(LDFLAGS_JDKEXE), \
     LDFLAGS_unix := -L$(JVM_OUTPUTDIR)/gtest $(call SET_SHARED_LIBRARY_ORIGIN), \
     LDFLAGS_solaris := -library=stlport4, \
     LIBS_unix := -ljvm, \
diff --git a/hotspot/make/lib/CompileJvm.gmk b/hotspot/make/lib/CompileJvm.gmk
index b6404cf..65d58e4 100644
--- a/hotspot/make/lib/CompileJvm.gmk
+++ b/hotspot/make/lib/CompileJvm.gmk
@@ -60,12 +60,15 @@
     -I$(HOTSPOT_TOPDIR)/src/share/vm/prims \
     #
 
+# INCLUDE_SUFFIX_* is only meant for including the proper
+# platform files. Don't use it to guard code. Use the value of
+# HOTSPOT_TARGET_CPU_DEFINE etc. instead.
+# Remaining TARGET_ARCH_* is needed to distinguish closed and open
+# 64-bit ARM ports (also called AARCH64).
 JVM_CFLAGS_TARGET_DEFINES += \
-    -DTARGET_OS_FAMILY_$(HOTSPOT_TARGET_OS) \
-    -DTARGET_ARCH_MODEL_$(HOTSPOT_TARGET_CPU) \
     -DTARGET_ARCH_$(HOTSPOT_TARGET_CPU_ARCH) \
-    -DTARGET_OS_ARCH_MODEL_$(HOTSPOT_TARGET_OS)_$(HOTSPOT_TARGET_CPU) \
-    -DTARGET_OS_ARCH_$(HOTSPOT_TARGET_OS)_$(HOTSPOT_TARGET_CPU_ARCH) \
+    -DINCLUDE_SUFFIX_OS=_$(HOTSPOT_TARGET_OS) \
+    -DINCLUDE_SUFFIX_CPU=_$(HOTSPOT_TARGET_CPU_ARCH) \
     -DTARGET_COMPILER_$(HOTSPOT_TOOLCHAIN_TYPE) \
     -D$(HOTSPOT_TARGET_CPU_DEFINE) \
     -DHOTSPOT_LIB_ARCH='"$(OPENJDK_TARGET_CPU_LEGACY_LIB)"' \
diff --git a/hotspot/make/test/JtregNative.gmk b/hotspot/make/test/JtregNative.gmk
index e89506b..efb108a 100644
--- a/hotspot/make/test/JtregNative.gmk
+++ b/hotspot/make/test/JtregNative.gmk
@@ -53,6 +53,8 @@
     $(HOTSPOT_TOPDIR)/test/compiler/native \
     $(HOTSPOT_TOPDIR)/test/serviceability/jvmti/GetNamedModule \
     $(HOTSPOT_TOPDIR)/test/testlibrary/jvmti \
+    $(HOTSPOT_TOPDIR)/test/compiler/jvmci/jdk.vm.ci.code.test \
+    $(HOTSPOT_TOPDIR)/test/serviceability/jvmti/GetModulesInfo \
     #
 
 # Add conditional directories here when needed.
@@ -62,12 +64,26 @@
     $(HOTSPOT_TOPDIR)/test/runtime/ThreadSignalMask
 endif
 
+ifeq ($(OPENJDK_TARGET_OS), linux)
+BUILD_HOTSPOT_JTREG_NATIVE_SRC += \
+    $(HOTSPOT_TOPDIR)/test/runtime/execstack \
+    $(HOTSPOT_TOPDIR)/test/runtime/jsig \
+    $(HOTSPOT_TOPDIR)/test/runtime/StackGuardPages
+endif
+
 ifeq ($(TOOLCHAIN_TYPE), solstudio)
     BUILD_HOTSPOT_JTREG_LIBRARIES_LDFLAGS_liboverflow := -lc
     BUILD_HOTSPOT_JTREG_LIBRARIES_LDFLAGS_libSimpleClassFileLoadHook := -lc
     BUILD_HOTSPOT_JTREG_LIBRARIES_LDFLAGS_libGetNamedModuleTest := -lc
 endif
 
+ifeq ($(OPENJDK_TARGET_OS), linux)
+    BUILD_HOTSPOT_JTREG_LIBRARIES_LDFLAGS_libtest-rw := -z noexecstack
+    BUILD_HOTSPOT_JTREG_LIBRARIES_LDFLAGS_libtest-rwx := -z execstack
+    BUILD_HOTSPOT_JTREG_EXECUTABLES_LDFLAGS_exeinvoke := -ljvm -lpthread
+    BUILD_TEST_invoke_exeinvoke.c_OPTIMIZATION := NONE
+endif
+
 BUILD_HOTSPOT_JTREG_OUTPUT_DIR := $(BUILD_OUTPUT)/support/test/hotspot/jtreg/native
 
 BUILD_HOTSPOT_JTREG_IMAGE_DIR := $(TEST_IMAGE_DIR)/hotspot/jtreg
diff --git a/hotspot/src/cpu/aarch64/vm/aarch64.ad b/hotspot/src/cpu/aarch64/vm/aarch64.ad
index 89fac8f..50c6d33 100644
--- a/hotspot/src/cpu/aarch64/vm/aarch64.ad
+++ b/hotspot/src/cpu/aarch64/vm/aarch64.ad
@@ -1942,12 +1942,35 @@
 
   bool is_CAS(int opcode)
   {
-    return (opcode == Op_CompareAndSwapI ||
-	    opcode == Op_CompareAndSwapL ||
-	    opcode == Op_CompareAndSwapN ||
-	    opcode == Op_CompareAndSwapP);
+    switch(opcode) {
+      // We handle these
+    case Op_CompareAndSwapI:
+    case Op_CompareAndSwapL:
+    case Op_CompareAndSwapP:
+    case Op_CompareAndSwapN:
+ // case Op_CompareAndSwapB:
+ // case Op_CompareAndSwapS:
+      return true;
+      // These are TBD
+    case Op_WeakCompareAndSwapB:
+    case Op_WeakCompareAndSwapS:
+    case Op_WeakCompareAndSwapI:
+    case Op_WeakCompareAndSwapL:
+    case Op_WeakCompareAndSwapP:
+    case Op_WeakCompareAndSwapN:
+    case Op_CompareAndExchangeB:
+    case Op_CompareAndExchangeS:
+    case Op_CompareAndExchangeI:
+    case Op_CompareAndExchangeL:
+    case Op_CompareAndExchangeP:
+    case Op_CompareAndExchangeN:
+      return false;
+    default:
+      return false;
+    }
   }
 
+
   // leading_to_trailing
   //
   //graph traversal helper which detects the normal case Mem feed from
@@ -3330,9 +3353,6 @@
 const bool Matcher::match_rule_supported(int opcode) {
 
   switch (opcode) {
-  case Op_StrComp:
-    if (CompactStrings)  return false;
-    break;
   default:
     break;
   }
@@ -4241,14 +4261,16 @@
     MacroAssembler _masm(&cbuf);
     guarantee($mem$$index == -1 && $mem$$disp == 0, "impossible encoding");
     __ cmpxchg($mem$$base$$Register, $oldval$$Register, $newval$$Register,
-               Assembler::xword, /*acquire*/ false, /*release*/ true);
+               Assembler::xword, /*acquire*/ false, /*release*/ true,
+               /*weak*/ false, noreg);
   %}
 
   enc_class aarch64_enc_cmpxchgw(memory mem, iRegINoSp oldval, iRegINoSp newval) %{
     MacroAssembler _masm(&cbuf);
     guarantee($mem$$index == -1 && $mem$$disp == 0, "impossible encoding");
     __ cmpxchg($mem$$base$$Register, $oldval$$Register, $newval$$Register,
-               Assembler::word, /*acquire*/ false, /*release*/ true);
+               Assembler::word, /*acquire*/ false, /*release*/ true,
+               /*weak*/ false, noreg);
   %}
 
 
@@ -4260,14 +4282,16 @@
     MacroAssembler _masm(&cbuf);
     guarantee($mem$$index == -1 && $mem$$disp == 0, "impossible encoding");
     __ cmpxchg($mem$$base$$Register, $oldval$$Register, $newval$$Register,
-               Assembler::xword, /*acquire*/ true, /*release*/ true);
+               Assembler::xword, /*acquire*/ true, /*release*/ true,
+               /*weak*/ false, noreg);
   %}
 
   enc_class aarch64_enc_cmpxchgw_acq(memory mem, iRegINoSp oldval, iRegINoSp newval) %{
     MacroAssembler _masm(&cbuf);
     guarantee($mem$$index == -1 && $mem$$disp == 0, "impossible encoding");
     __ cmpxchg($mem$$base$$Register, $oldval$$Register, $newval$$Register,
-               Assembler::word, /*acquire*/ true, /*release*/ true);
+               Assembler::word, /*acquire*/ true, /*release*/ true,
+               /*weak*/ false, noreg);
   %}
 
 
@@ -5806,6 +5830,7 @@
 %{
   constraint(ALLOC_IN_RC(no_special_reg));
   match(RegL);
+  match(iRegL_R0);
   format %{ %}
   interface(REG_INTER);
 %}
@@ -5927,6 +5952,39 @@
   interface(REG_INTER);
 %}
 
+// Long 64 bit Register R0 only
+operand iRegL_R0()
+%{
+  constraint(ALLOC_IN_RC(r0_reg));
+  match(RegL);
+  match(iRegLNoSp);
+  op_cost(0);
+  format %{ %}
+  interface(REG_INTER);
+%}
+
+// Long 64 bit Register R2 only
+operand iRegL_R2()
+%{
+  constraint(ALLOC_IN_RC(r2_reg));
+  match(RegL);
+  match(iRegLNoSp);
+  op_cost(0);
+  format %{ %}
+  interface(REG_INTER);
+%}
+
+// Long 64 bit Register R3 only
+operand iRegL_R3()
+%{
+  constraint(ALLOC_IN_RC(r3_reg));
+  match(RegL);
+  match(iRegLNoSp);
+  op_cost(0);
+  format %{ %}
+  interface(REG_INTER);
+%}
+
 // Long 64 bit Register R11 only
 operand iRegL_R11()
 %{
@@ -5983,7 +6041,7 @@
 %}
 
 
-// Register R2 only
+// Register R4 only
 operand iRegI_R4()
 %{
   constraint(ALLOC_IN_RC(int_r4_reg));
@@ -6007,6 +6065,33 @@
   interface(REG_INTER);
 %}
 
+operand iRegN_R0()
+%{
+  constraint(ALLOC_IN_RC(r0_reg));
+  match(iRegN);
+  op_cost(0);
+  format %{ %}
+  interface(REG_INTER);
+%}
+
+operand iRegN_R2()
+%{
+  constraint(ALLOC_IN_RC(r2_reg));
+  match(iRegN);
+  op_cost(0);
+  format %{ %}
+  interface(REG_INTER);
+%}
+
+operand iRegN_R3()
+%{
+  constraint(ALLOC_IN_RC(r3_reg));
+  match(iRegN);
+  op_cost(0);
+  format %{ %}
+  interface(REG_INTER);
+%}
+
 // Integer 64 bit Register not Special
 operand iRegNNoSp()
 %{
@@ -9393,12 +9478,12 @@
   ins_pipe(pipe_slow);
 %}
 
-// XXX No flag versions for CompareAndSwap{I,L,P,N} because matcher
-// can't match them
-
 // standard CompareAndSwapX when we are using barriers
 // these have higher priority than the rules selected by a predicate
 
+// XXX No flag versions for CompareAndSwap{I,L,P,N} because matcher
+// can't match them
+
 instruct compareAndSwapI(iRegINoSp res, indirect mem, iRegINoSp oldval, iRegINoSp newval, rFlagsReg cr) %{
 
   match(Set res (CompareAndSwapI mem (Binary oldval newval)));
@@ -9550,6 +9635,216 @@
 %}
 
 
+// ---------------------------------------------------------------------
+// Sundry CAS operations.  Note that release is always true,
+// regardless of the memory ordering of the CAS.  This is because we
+// need the volatile case to be sequentially consistent but there is
+// no trailing StoreLoad barrier emitted by C2.  Unfortunately we
+// can't check the type of memory ordering here, so we always emit a
+// STLXR.
+
+// This section is generated from aarch64_ad_cas.m4
+
+
+instruct compareAndExchangeB(iRegI_R0 res, indirect mem, iRegI_R2 oldval, iRegI_R3 newval, rFlagsReg cr) %{
+  match(Set res (CompareAndExchangeB mem (Binary oldval newval)));
+  ins_cost(2 * VOLATILE_REF_COST);
+  effect(KILL cr);
+  format %{
+    "cmpxchg $res = $mem, $oldval, $newval\t# (byte, weak) if $mem == $oldval then $mem <-- $newval"
+  %}
+  ins_encode %{
+    __ uxtbw(rscratch2, $oldval$$Register);
+    __ cmpxchg($mem$$Register, rscratch2, $newval$$Register,
+               Assembler::byte, /*acquire*/ false, /*release*/ true,
+               /*weak*/ false, $res$$Register);
+    __ sxtbw($res$$Register, $res$$Register);
+  %}
+  ins_pipe(pipe_slow);
+%}
+
+instruct compareAndExchangeS(iRegI_R0 res, indirect mem, iRegI_R2 oldval, iRegI_R3 newval, rFlagsReg cr) %{
+  match(Set res (CompareAndExchangeS mem (Binary oldval newval)));
+  ins_cost(2 * VOLATILE_REF_COST);
+  effect(KILL cr);
+  format %{
+    "cmpxchg $res = $mem, $oldval, $newval\t# (short, weak) if $mem == $oldval then $mem <-- $newval"
+  %}
+  ins_encode %{
+    __ uxthw(rscratch2, $oldval$$Register);
+    __ cmpxchg($mem$$Register, rscratch2, $newval$$Register,
+               Assembler::halfword, /*acquire*/ false, /*release*/ true,
+               /*weak*/ false, $res$$Register);
+    __ sxthw($res$$Register, $res$$Register);
+  %}
+  ins_pipe(pipe_slow);
+%}
+
+instruct compareAndExchangeI(iRegI_R0 res, indirect mem, iRegI_R2 oldval, iRegI_R3 newval, rFlagsReg cr) %{
+  match(Set res (CompareAndExchangeI mem (Binary oldval newval)));
+  ins_cost(2 * VOLATILE_REF_COST);
+  effect(KILL cr);
+  format %{
+    "cmpxchg $res = $mem, $oldval, $newval\t# (int, weak) if $mem == $oldval then $mem <-- $newval"
+  %}
+  ins_encode %{
+    __ cmpxchg($mem$$Register, $oldval$$Register, $newval$$Register,
+               Assembler::word, /*acquire*/ false, /*release*/ true,
+               /*weak*/ false, $res$$Register);
+  %}
+  ins_pipe(pipe_slow);
+%}
+
+instruct compareAndExchangeL(iRegL_R0 res, indirect mem, iRegL_R2 oldval, iRegL_R3 newval, rFlagsReg cr) %{
+  match(Set res (CompareAndExchangeL mem (Binary oldval newval)));
+  ins_cost(2 * VOLATILE_REF_COST);
+  effect(KILL cr);
+  format %{
+    "cmpxchg $res = $mem, $oldval, $newval\t# (long, weak) if $mem == $oldval then $mem <-- $newval"
+  %}
+  ins_encode %{
+    __ cmpxchg($mem$$Register, $oldval$$Register, $newval$$Register,
+               Assembler::xword, /*acquire*/ false, /*release*/ true,
+               /*weak*/ false, $res$$Register);
+  %}
+  ins_pipe(pipe_slow);
+%}
+
+instruct compareAndExchangeN(iRegN_R0 res, indirect mem, iRegN_R2 oldval, iRegN_R3 newval, rFlagsReg cr) %{
+  match(Set res (CompareAndExchangeN mem (Binary oldval newval)));
+  ins_cost(2 * VOLATILE_REF_COST);
+  effect(KILL cr);
+  format %{
+    "cmpxchg $res = $mem, $oldval, $newval\t# (narrow oop, weak) if $mem == $oldval then $mem <-- $newval"
+  %}
+  ins_encode %{
+    __ cmpxchg($mem$$Register, $oldval$$Register, $newval$$Register,
+               Assembler::word, /*acquire*/ false, /*release*/ true,
+               /*weak*/ false, $res$$Register);
+  %}
+  ins_pipe(pipe_slow);
+%}
+
+instruct compareAndExchangeP(iRegP_R0 res, indirect mem, iRegP_R2 oldval, iRegP_R3 newval, rFlagsReg cr) %{
+  match(Set res (CompareAndExchangeP mem (Binary oldval newval)));
+  ins_cost(2 * VOLATILE_REF_COST);
+  effect(KILL cr);
+  format %{
+    "cmpxchg $res = $mem, $oldval, $newval\t# (ptr, weak) if $mem == $oldval then $mem <-- $newval"
+  %}
+  ins_encode %{
+    __ cmpxchg($mem$$Register, $oldval$$Register, $newval$$Register,
+               Assembler::xword, /*acquire*/ false, /*release*/ true,
+               /*weak*/ false, $res$$Register);
+  %}
+  ins_pipe(pipe_slow);
+%}
+
+instruct weakCompareAndSwapB(iRegINoSp res, indirect mem, iRegI oldval, iRegI newval, rFlagsReg cr) %{
+  match(Set res (WeakCompareAndSwapB mem (Binary oldval newval)));
+  ins_cost(2 * VOLATILE_REF_COST);
+  effect(KILL cr);
+  format %{
+    "cmpxchg $res = $mem, $oldval, $newval\t# (byte, weak) if $mem == $oldval then $mem <-- $newval"
+    "csetw $res, EQ\t# $res <-- (EQ ? 1 : 0)"
+  %}
+  ins_encode %{
+    __ uxtbw(rscratch2, $oldval$$Register);
+    __ cmpxchg($mem$$Register, rscratch2, $newval$$Register,
+               Assembler::byte, /*acquire*/ false, /*release*/ true,
+               /*weak*/ true, noreg);
+    __ csetw($res$$Register, Assembler::EQ);
+  %}
+  ins_pipe(pipe_slow);
+%}
+
+instruct weakCompareAndSwapS(iRegINoSp res, indirect mem, iRegI oldval, iRegI newval, rFlagsReg cr) %{
+  match(Set res (WeakCompareAndSwapS mem (Binary oldval newval)));
+  ins_cost(2 * VOLATILE_REF_COST);
+  effect(KILL cr);
+  format %{
+    "cmpxchg $res = $mem, $oldval, $newval\t# (short, weak) if $mem == $oldval then $mem <-- $newval"
+    "csetw $res, EQ\t# $res <-- (EQ ? 1 : 0)"
+  %}
+  ins_encode %{
+    __ uxthw(rscratch2, $oldval$$Register);
+    __ cmpxchg($mem$$Register, rscratch2, $newval$$Register,
+               Assembler::halfword, /*acquire*/ false, /*release*/ true,
+               /*weak*/ true, noreg);
+    __ csetw($res$$Register, Assembler::EQ);
+  %}
+  ins_pipe(pipe_slow);
+%}
+
+instruct weakCompareAndSwapI(iRegINoSp res, indirect mem, iRegI oldval, iRegI newval, rFlagsReg cr) %{
+  match(Set res (WeakCompareAndSwapI mem (Binary oldval newval)));
+  ins_cost(2 * VOLATILE_REF_COST);
+  effect(KILL cr);
+  format %{
+    "cmpxchg $res = $mem, $oldval, $newval\t# (int, weak) if $mem == $oldval then $mem <-- $newval"
+    "csetw $res, EQ\t# $res <-- (EQ ? 1 : 0)"
+  %}
+  ins_encode %{
+    __ cmpxchg($mem$$Register, $oldval$$Register, $newval$$Register,
+               Assembler::word, /*acquire*/ false, /*release*/ true,
+               /*weak*/ true, noreg);
+    __ csetw($res$$Register, Assembler::EQ);
+  %}
+  ins_pipe(pipe_slow);
+%}
+
+instruct weakCompareAndSwapL(iRegINoSp res, indirect mem, iRegL oldval, iRegL newval, rFlagsReg cr) %{
+  match(Set res (WeakCompareAndSwapL mem (Binary oldval newval)));
+  ins_cost(2 * VOLATILE_REF_COST);
+  effect(KILL cr);
+  format %{
+    "cmpxchg $res = $mem, $oldval, $newval\t# (long, weak) if $mem == $oldval then $mem <-- $newval"
+    "csetw $res, EQ\t# $res <-- (EQ ? 1 : 0)"
+  %}
+  ins_encode %{
+    __ cmpxchg($mem$$Register, $oldval$$Register, $newval$$Register,
+               Assembler::xword, /*acquire*/ false, /*release*/ true,
+               /*weak*/ true, noreg);
+    __ csetw($res$$Register, Assembler::EQ);
+  %}
+  ins_pipe(pipe_slow);
+%}
+
+instruct weakCompareAndSwapN(iRegINoSp res, indirect mem, iRegN oldval, iRegN newval, rFlagsReg cr) %{
+  match(Set res (WeakCompareAndSwapN mem (Binary oldval newval)));
+  ins_cost(2 * VOLATILE_REF_COST);
+  effect(KILL cr);
+  format %{
+    "cmpxchg $res = $mem, $oldval, $newval\t# (narrow oop, weak) if $mem == $oldval then $mem <-- $newval"
+    "csetw $res, EQ\t# $res <-- (EQ ? 1 : 0)"
+  %}
+  ins_encode %{
+    __ cmpxchg($mem$$Register, $oldval$$Register, $newval$$Register,
+               Assembler::word, /*acquire*/ false, /*release*/ true,
+               /*weak*/ true, noreg);
+    __ csetw($res$$Register, Assembler::EQ);
+  %}
+  ins_pipe(pipe_slow);
+%}
+
+instruct weakCompareAndSwapP(iRegINoSp res, indirect mem, iRegP oldval, iRegP newval, rFlagsReg cr) %{
+  match(Set res (WeakCompareAndSwapP mem (Binary oldval newval)));
+  ins_cost(2 * VOLATILE_REF_COST);
+  effect(KILL cr);
+  format %{
+    "cmpxchg $res = $mem, $oldval, $newval\t# (ptr, weak) if $mem == $oldval then $mem <-- $newval"
+    "csetw $res, EQ\t# $res <-- (EQ ? 1 : 0)"
+  %}
+  ins_encode %{
+    __ cmpxchg($mem$$Register, $oldval$$Register, $newval$$Register,
+               Assembler::xword, /*acquire*/ false, /*release*/ true,
+               /*weak*/ true, noreg);
+    __ csetw($res$$Register, Assembler::EQ);
+  %}
+  ins_pipe(pipe_slow);
+%}
+// ---------------------------------------------------------------------
+
 instruct get_and_setI(indirect mem, iRegINoSp newv, iRegI prev) %{
   match(Set prev (GetAndSetI mem newv));
   format %{ "atomic_xchgw  $prev, $newv, [$mem]" %}
@@ -14988,11 +15283,61 @@
   format %{ "String Compare $str1,$cnt1,$str2,$cnt2 -> $result   # KILL $tmp1" %}
   ins_encode %{
     // Count is in 8-bit bytes; non-Compact chars are 16 bits.
-    __ asrw($cnt1$$Register, $cnt1$$Register, 1);
-    __ asrw($cnt2$$Register, $cnt2$$Register, 1);
     __ string_compare($str1$$Register, $str2$$Register,
                       $cnt1$$Register, $cnt2$$Register, $result$$Register,
-                      $tmp1$$Register);
+                      $tmp1$$Register,
+                      fnoreg, fnoreg, StrIntrinsicNode::UU);
+  %}
+  ins_pipe(pipe_class_memory);
+%}
+
+instruct string_compareL(iRegP_R1 str1, iRegI_R2 cnt1, iRegP_R3 str2, iRegI_R4 cnt2,
+                        iRegI_R0 result, iRegP_R10 tmp1, rFlagsReg cr)
+%{
+  predicate(((StrCompNode*)n)->encoding() == StrIntrinsicNode::LL);
+  match(Set result (StrComp (Binary str1 cnt1) (Binary str2 cnt2)));
+  effect(KILL tmp1, USE_KILL str1, USE_KILL str2, USE_KILL cnt1, USE_KILL cnt2, KILL cr);
+
+  format %{ "String Compare $str1,$cnt1,$str2,$cnt2 -> $result   # KILL $tmp1" %}
+  ins_encode %{
+    __ string_compare($str1$$Register, $str2$$Register,
+                      $cnt1$$Register, $cnt2$$Register, $result$$Register,
+                      $tmp1$$Register,
+                      fnoreg, fnoreg, StrIntrinsicNode::LL);
+  %}
+  ins_pipe(pipe_class_memory);
+%}
+
+instruct string_compareUL(iRegP_R1 str1, iRegI_R2 cnt1, iRegP_R3 str2, iRegI_R4 cnt2,
+                        iRegI_R0 result, vRegD vtmp1, vRegD vtmp2, iRegP_R10 tmp1, rFlagsReg cr)
+%{
+  predicate(((StrCompNode*)n)->encoding() == StrIntrinsicNode::UL);
+  match(Set result (StrComp (Binary str1 cnt1) (Binary str2 cnt2)));
+  effect(KILL tmp1, USE_KILL str1, USE_KILL str2, USE_KILL cnt1, USE_KILL cnt2, TEMP vtmp1, TEMP vtmp2, KILL cr);
+
+  format %{ "String Compare $str1,$cnt1,$str2,$cnt2 -> $result   # KILL $tmp1" %}
+  ins_encode %{
+    __ string_compare($str1$$Register, $str2$$Register,
+                      $cnt1$$Register, $cnt2$$Register, $result$$Register,
+                      $tmp1$$Register,
+                      $vtmp1$$FloatRegister, $vtmp2$$FloatRegister, StrIntrinsicNode::UL);
+  %}
+  ins_pipe(pipe_class_memory);
+%}
+
+instruct string_compareLU(iRegP_R1 str1, iRegI_R2 cnt1, iRegP_R3 str2, iRegI_R4 cnt2,
+                        iRegI_R0 result, vRegD vtmp1, vRegD vtmp2, iRegP_R10 tmp1, rFlagsReg cr)
+%{
+  predicate(((StrCompNode*)n)->encoding() == StrIntrinsicNode::LU);
+  match(Set result (StrComp (Binary str1 cnt1) (Binary str2 cnt2)));
+  effect(KILL tmp1, USE_KILL str1, USE_KILL str2, USE_KILL cnt1, USE_KILL cnt2, TEMP vtmp1, TEMP vtmp2, KILL cr);
+
+  format %{ "String Compare $str1,$cnt1,$str2,$cnt2 -> $result   # KILL $tmp1" %}
+  ins_encode %{
+    __ string_compare($str1$$Register, $str2$$Register,
+                      $cnt1$$Register, $cnt2$$Register, $result$$Register,
+                      $tmp1$$Register,
+                      $vtmp1$$FloatRegister, $vtmp2$$FloatRegister, StrIntrinsicNode::LU);
   %}
   ins_pipe(pipe_class_memory);
 %}
diff --git a/hotspot/src/cpu/aarch64/vm/bytes_aarch64.hpp b/hotspot/src/cpu/aarch64/vm/bytes_aarch64.hpp
index e2a4965..fc7890e 100644
--- a/hotspot/src/cpu/aarch64/vm/bytes_aarch64.hpp
+++ b/hotspot/src/cpu/aarch64/vm/bytes_aarch64.hpp
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1997, 2010, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1997, 2016, Oracle and/or its affiliates. All rights reserved.
  * Copyright (c) 2014, Red Hat Inc. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
@@ -67,9 +67,6 @@
 
 
 // The following header contains the implementations of swap_u2, swap_u4, and swap_u8[_base]
-
-#ifdef TARGET_OS_ARCH_linux_aarch64
-# include "bytes_linux_aarch64.inline.hpp"
-#endif
+#include OS_CPU_HEADER_INLINE(bytes)
 
 #endif // CPU_AARCH64_VM_BYTES_AARCH64_HPP
diff --git a/hotspot/src/cpu/aarch64/vm/c1_LIRAssembler_aarch64.cpp b/hotspot/src/cpu/aarch64/vm/c1_LIRAssembler_aarch64.cpp
index e34c6fa..a2d1631 100644
--- a/hotspot/src/cpu/aarch64/vm/c1_LIRAssembler_aarch64.cpp
+++ b/hotspot/src/cpu/aarch64/vm/c1_LIRAssembler_aarch64.cpp
@@ -1556,13 +1556,13 @@
 }
 
 void LIR_Assembler::casw(Register addr, Register newval, Register cmpval) {
-  __ cmpxchg(addr, cmpval, newval, Assembler::word, /* acquire*/ true, /* release*/ true, rscratch1);
+  __ cmpxchg(addr, cmpval, newval, Assembler::word, /* acquire*/ true, /* release*/ true, /* weak*/ false, rscratch1);
   __ cset(rscratch1, Assembler::NE);
   __ membar(__ AnyAny);
 }
 
 void LIR_Assembler::casl(Register addr, Register newval, Register cmpval) {
-  __ cmpxchg(addr, cmpval, newval, Assembler::xword, /* acquire*/ true, /* release*/ true, rscratch1);
+  __ cmpxchg(addr, cmpval, newval, Assembler::xword, /* acquire*/ true, /* release*/ true, /* weak*/ false, rscratch1);
   __ cset(rscratch1, Assembler::NE);
   __ membar(__ AnyAny);
 }
diff --git a/hotspot/src/cpu/aarch64/vm/c1_LIRGenerator_aarch64.cpp b/hotspot/src/cpu/aarch64/vm/c1_LIRGenerator_aarch64.cpp
index 4690e75..e66f6ff 100644
--- a/hotspot/src/cpu/aarch64/vm/c1_LIRGenerator_aarch64.cpp
+++ b/hotspot/src/cpu/aarch64/vm/c1_LIRGenerator_aarch64.cpp
@@ -808,7 +808,6 @@
   } else {
     a = new LIR_Address(obj.result(),
                         offset.result(),
-                        LIR_Address::times_1,
                         0,
                         as_BasicType(type));
   }
@@ -1002,7 +1001,6 @@
 
       LIR_Address* a = new LIR_Address(base_op,
                                        index,
-                                       LIR_Address::times_1,
                                        offset,
                                        T_BYTE);
       BasicTypeList signature(3);
diff --git a/hotspot/src/cpu/aarch64/vm/c1_LIR_aarch64.cpp b/hotspot/src/cpu/aarch64/vm/c1_LIR_aarch64.cpp
new file mode 100644
index 0000000..ce75dc5
--- /dev/null
+++ b/hotspot/src/cpu/aarch64/vm/c1_LIR_aarch64.cpp
@@ -0,0 +1,54 @@
+/*
+ * 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.
+ *
+ */
+
+#include "precompiled.hpp"
+#include "asm/register.hpp"
+#include "c1/c1_LIR.hpp"
+
+FloatRegister LIR_OprDesc::as_float_reg() const {
+  return as_FloatRegister(fpu_regnr());
+}
+
+FloatRegister LIR_OprDesc::as_double_reg() const {
+  return as_FloatRegister(fpu_regnrLo());
+}
+
+// Reg2 unused.
+LIR_Opr LIR_OprFact::double_fpu(int reg1, int reg2) {
+  assert(as_FloatRegister(reg2) == fnoreg, "Not used on this platform");
+  return (LIR_Opr)(intptr_t)((reg1 << LIR_OprDesc::reg1_shift) |
+                             (reg1 << LIR_OprDesc::reg2_shift) |
+                             LIR_OprDesc::double_type          |
+                             LIR_OprDesc::fpu_register         |
+                             LIR_OprDesc::double_size);
+}
+
+#ifndef PRODUCT
+void LIR_Address::verify() const {
+  assert(base()->is_cpu_register(), "wrong base operand");
+  assert(index()->is_illegal() || index()->is_double_cpu() || index()->is_single_cpu(), "wrong index operand");
+  assert(base()->type() == T_OBJECT || base()->type() == T_LONG || base()->type() == T_METADATA,
+         "wrong type for addresses");
+}
+#endif // PRODUCT
diff --git a/hotspot/src/cpu/aarch64/vm/cas.m4 b/hotspot/src/cpu/aarch64/vm/cas.m4
new file mode 100644
index 0000000..eb276df
--- /dev/null
+++ b/hotspot/src/cpu/aarch64/vm/cas.m4
@@ -0,0 +1,109 @@
+// Sundry CAS operations.  Note that release is always true,
+// regardless of the memory ordering of the CAS.  This is because we
+// need the volatile case to be sequentially consistent but there is
+// no trailing StoreLoad barrier emitted by C2.  Unfortunately we
+// can't check the type of memory ordering here, so we always emit a
+// STLXR.
+
+define(`CAS_INSN',
+`
+instruct compareAndExchange$1$5(iReg$2_R0 res, indirect mem, iReg$2_R2 oldval, iReg$2_R3 newval, rFlagsReg cr) %{
+  match(Set res (CompareAndExchange$1 mem (Binary oldval newval)));
+  ifelse($5,Acq,'  predicate(needs_acquiring_load_exclusive(n));
+  ins_cost(VOLATILE_REF_COST);`,'  ins_cost(2 * VOLATILE_REF_COST);`)
+  effect(KILL cr);
+  format %{
+    "cmpxchg $res = $mem, $oldval, $newval\t# ($3, weak) if $mem == $oldval then $mem <-- $newval"
+  %}
+  ins_encode %{
+    __ cmpxchg($mem$$Register, $oldval$$Register, $newval$$Register,
+               Assembler::$4, /*acquire*/ ifelse($5,Acq,true,false), /*release*/ true,
+               /*weak*/ false, $res$$Register);
+  %}
+  ins_pipe(pipe_slow);
+%}')dnl
+define(`CAS_INSN4',
+`
+instruct compareAndExchange$1$7(iReg$2_R0 res, indirect mem, iReg$2_R2 oldval, iReg$2_R3 newval, rFlagsReg cr) %{
+  match(Set res (CompareAndExchange$1 mem (Binary oldval newval)));
+  ifelse($7,Acq,'  predicate(needs_acquiring_load_exclusive(n));
+  ins_cost(VOLATILE_REF_COST);`,'  ins_cost(2 * VOLATILE_REF_COST);`)
+  effect(KILL cr);
+  format %{
+    "cmpxchg $res = $mem, $oldval, $newval\t# ($3, weak) if $mem == $oldval then $mem <-- $newval"
+  %}
+  ins_encode %{
+    __ $5(rscratch2, $oldval$$Register);
+    __ cmpxchg($mem$$Register, rscratch2, $newval$$Register,
+               Assembler::$4, /*acquire*/ ifelse($5,Acq,true,false), /*release*/ true,
+               /*weak*/ false, $res$$Register);
+    __ $6($res$$Register, $res$$Register);
+  %}
+  ins_pipe(pipe_slow);
+%}')dnl
+CAS_INSN4(B,I,byte,byte,uxtbw,sxtbw)
+CAS_INSN4(S,I,short,halfword,uxthw,sxthw)
+CAS_INSN(I,I,int,word)
+CAS_INSN(L,L,long,xword)
+CAS_INSN(N,N,narrow oop,word)
+CAS_INSN(P,P,ptr,xword)
+dnl
+dnl CAS_INSN4(B,I,byte,byte,uxtbw,sxtbw,Acq)
+dnl CAS_INSN4(S,I,short,halfword,uxthw,sxthw,Acq)
+dnl CAS_INSN(I,I,int,word,Acq)
+dnl CAS_INSN(L,L,long,xword,Acq)
+dnl CAS_INSN(N,N,narrow oop,word,Acq)
+dnl CAS_INSN(P,P,ptr,xword,Acq)
+dnl
+define(`CAS_INSN2',
+`
+instruct weakCompareAndSwap$1$6(iRegINoSp res, indirect mem, iReg$2 oldval, iReg$2 newval, rFlagsReg cr) %{
+  match(Set res (WeakCompareAndSwap$1 mem (Binary oldval newval)));
+  ifelse($6,Acq,'  predicate(needs_acquiring_load_exclusive(n));
+  ins_cost(VOLATILE_REF_COST);`,'  ins_cost(2 * VOLATILE_REF_COST);`)
+  effect(KILL cr);
+  format %{
+    "cmpxchg $res = $mem, $oldval, $newval\t# ($3, weak) if $mem == $oldval then $mem <-- $newval"
+    "csetw $res, EQ\t# $res <-- (EQ ? 1 : 0)"
+  %}
+  ins_encode %{
+    __ uxt$5(rscratch2, $oldval$$Register);
+    __ cmpxchg($mem$$Register, rscratch2, $newval$$Register,
+               Assembler::$4, /*acquire*/ ifelse($6,Acq,true,false), /*release*/ true,
+               /*weak*/ true, noreg);
+    __ csetw($res$$Register, Assembler::EQ);
+  %}
+  ins_pipe(pipe_slow);
+%}')dnl
+define(`CAS_INSN3',
+`
+instruct weakCompareAndSwap$1$5(iRegINoSp res, indirect mem, iReg$2 oldval, iReg$2 newval, rFlagsReg cr) %{
+  match(Set res (WeakCompareAndSwap$1 mem (Binary oldval newval)));
+  ifelse($5,Acq,'  predicate(needs_acquiring_load_exclusive(n));
+  ins_cost(VOLATILE_REF_COST);`,'  ins_cost(2 * VOLATILE_REF_COST);`)
+  effect(KILL cr);
+  format %{
+    "cmpxchg $res = $mem, $oldval, $newval\t# ($3, weak) if $mem == $oldval then $mem <-- $newval"
+    "csetw $res, EQ\t# $res <-- (EQ ? 1 : 0)"
+  %}
+  ins_encode %{
+    __ cmpxchg($mem$$Register, $oldval$$Register, $newval$$Register,
+               Assembler::$4, /*acquire*/ ifelse($5,Acq,true,false), /*release*/ true,
+               /*weak*/ true, noreg);
+    __ csetw($res$$Register, Assembler::EQ);
+  %}
+  ins_pipe(pipe_slow);
+%}')dnl
+CAS_INSN2(B,I,byte,byte,bw)
+CAS_INSN2(S,I,short,halfword,hw)
+CAS_INSN3(I,I,int,word)
+CAS_INSN3(L,L,long,xword)
+CAS_INSN3(N,N,narrow oop,word)
+CAS_INSN3(P,P,ptr,xword)
+dnl CAS_INSN2(B,I,byte,byte,bw,Acq)
+dnl CAS_INSN2(S,I,short,halfword,hw,Acq)
+dnl CAS_INSN3(I,I,int,word,Acq)
+dnl CAS_INSN3(L,L,long,xword,Acq)
+dnl CAS_INSN3(N,N,narrow oop,word,Acq)
+dnl CAS_INSN3(P,P,ptr,xword,Acq)
+dnl
diff --git a/hotspot/src/cpu/aarch64/vm/copy_aarch64.hpp b/hotspot/src/cpu/aarch64/vm/copy_aarch64.hpp
index 7977b6e..2b7a36a 100644
--- a/hotspot/src/cpu/aarch64/vm/copy_aarch64.hpp
+++ b/hotspot/src/cpu/aarch64/vm/copy_aarch64.hpp
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2003, 2010, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2003, 2016, Oracle and/or its affiliates. All rights reserved.
  * Copyright (c) 2014, Red Hat Inc. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
@@ -29,9 +29,7 @@
 // Inline functions for memory copy and fill.
 
 // Contains inline asm implementations
-#ifdef TARGET_OS_ARCH_linux_aarch64
-# include "copy_linux_aarch64.inline.hpp"
-#endif
+#include OS_CPU_HEADER_INLINE(copy)
 
 
 static void pd_fill_to_words(HeapWord* tohw, size_t count, juint value) {
diff --git a/hotspot/src/cpu/aarch64/vm/globals_aarch64.hpp b/hotspot/src/cpu/aarch64/vm/globals_aarch64.hpp
index 604b8cd..6fb7e5f1 100644
--- a/hotspot/src/cpu/aarch64/vm/globals_aarch64.hpp
+++ b/hotspot/src/cpu/aarch64/vm/globals_aarch64.hpp
@@ -70,11 +70,7 @@
 
 define_pd_global(uintx, TypeProfileLevel, 111);
 
-// No performance work done here yet.
-define_pd_global(bool, CompactStrings, false);
-
-// avoid biased locking while we are bootstrapping the aarch64 build
-define_pd_global(bool, UseBiasedLocking, false);
+define_pd_global(bool, CompactStrings, true);
 
 // Clear short arrays bigger than one word in an arch-specific way
 define_pd_global(intx, InitArrayShortSize, BytesPerLong);
@@ -118,6 +114,7 @@
 // Don't attempt to use Neon on builtin sim until builtin sim supports it
 #define UseCRC32 false
 #define UseSIMDForMemoryOps    false
+#define AvoidUnalignedAcesses false
 
 #else
 #define UseBuiltinSim           false
@@ -144,6 +141,8 @@
           "Use CRC32 instructions for CRC32 computation")               \
   product(bool, UseSIMDForMemoryOps, false,                             \
           "Use SIMD instructions in generated memory move code")        \
+  product(bool, AvoidUnalignedAccesses, false,                          \
+          "Avoid generating unaligned memory accesses")                 \
   product(bool, UseLSE, false,                                          \
           "Use LSE instructions")                                       \
   product(bool, UseBlockZeroing, true,                                  \
diff --git a/hotspot/src/cpu/aarch64/vm/macroAssembler_aarch64.cpp b/hotspot/src/cpu/aarch64/vm/macroAssembler_aarch64.cpp
index f8e4c85..6e686f5 100644
--- a/hotspot/src/cpu/aarch64/vm/macroAssembler_aarch64.cpp
+++ b/hotspot/src/cpu/aarch64/vm/macroAssembler_aarch64.cpp
@@ -36,6 +36,7 @@
 #include "oops/klass.inline.hpp"
 #include "oops/oop.inline.hpp"
 #include "opto/compile.hpp"
+#include "opto/intrinsicnode.hpp"
 #include "opto/node.hpp"
 #include "runtime/biasedLocking.hpp"
 #include "runtime/icache.hpp"
@@ -565,11 +566,6 @@
   br(Assembler::EQ, done);
 }
 
-
-// added to make this compile
-
-REGISTER_DEFINITION(Register, noreg);
-
 static void pass_arg0(MacroAssembler* masm, Register arg) {
   if (c_rarg0 != arg ) {
     masm->mov(c_rarg0, arg);
@@ -2145,30 +2141,40 @@
     b(*fail);
 }
 
-// A generic CAS; success or failure is in the EQ flag.
+// A generic CAS; success or failure is in the EQ flag.  A weak CAS
+// doesn't retry and may fail spuriously.  If the oldval is wanted,
+// Pass a register for the result, otherwise pass noreg.
+
+// Clobbers rscratch1
 void MacroAssembler::cmpxchg(Register addr, Register expected,
                              Register new_val,
                              enum operand_size size,
                              bool acquire, bool release,
-                             Register tmp) {
+                             bool weak,
+                             Register result) {
+  if (result == noreg)  result = rscratch1;
   if (UseLSE) {
-    mov(tmp, expected);
-    lse_cas(tmp, new_val, addr, size, acquire, release, /*not_pair*/ true);
-    cmp(tmp, expected);
+    mov(result, expected);
+    lse_cas(result, new_val, addr, size, acquire, release, /*not_pair*/ true);
+    cmp(result, expected);
   } else {
     BLOCK_COMMENT("cmpxchg {");
     Label retry_load, done;
     if ((VM_Version::features() & VM_Version::CPU_STXR_PREFETCH))
       prfm(Address(addr), PSTL1STRM);
     bind(retry_load);
-    load_exclusive(tmp, addr, size, acquire);
+    load_exclusive(result, addr, size, acquire);
     if (size == xword)
-      cmp(tmp, expected);
+      cmp(result, expected);
     else
-      cmpw(tmp, expected);
+      cmpw(result, expected);
     br(Assembler::NE, done);
-    store_exclusive(tmp, new_val, addr, size, release);
-    cbnzw(tmp, retry_load);
+    store_exclusive(rscratch1, new_val, addr, size, release);
+    if (weak) {
+      cmpw(rscratch1, 0u);  // If the store fails, return NE to our caller.
+    } else {
+      cbnzw(rscratch1, retry_load);
+    }
     bind(done);
     BLOCK_COMMENT("} cmpxchg");
   }
@@ -4500,21 +4506,49 @@
   BIND(DONE);
 }
 
+typedef void (MacroAssembler::* chr_insn)(Register Rt, const Address &adr);
+typedef void (MacroAssembler::* uxt_insn)(Register Rd, Register Rn);
+
 // Compare strings.
 void MacroAssembler::string_compare(Register str1, Register str2,
                                     Register cnt1, Register cnt2, Register result,
-                                    Register tmp1) {
+                                    Register tmp1,
+                                    FloatRegister vtmp, FloatRegister vtmpZ, int ae) {
   Label LENGTH_DIFF, DONE, SHORT_LOOP, SHORT_STRING,
     NEXT_WORD, DIFFERENCE;
 
+  bool isLL = ae == StrIntrinsicNode::LL;
+  bool isLU = ae == StrIntrinsicNode::LU;
+  bool isUL = ae == StrIntrinsicNode::UL;
+
+  bool str1_isL = isLL || isLU;
+  bool str2_isL = isLL || isUL;
+
+  int str1_chr_shift = str1_isL ? 0 : 1;
+  int str2_chr_shift = str2_isL ? 0 : 1;
+  int str1_chr_size = str1_isL ? 1 : 2;
+  int str2_chr_size = str2_isL ? 1 : 2;
+
+  chr_insn str1_load_chr = str1_isL ? (chr_insn)&MacroAssembler::ldrb :
+                                      (chr_insn)&MacroAssembler::ldrh;
+  chr_insn str2_load_chr = str2_isL ? (chr_insn)&MacroAssembler::ldrb :
+                                      (chr_insn)&MacroAssembler::ldrh;
+  uxt_insn ext_chr = isLL ? (uxt_insn)&MacroAssembler::uxtbw :
+                            (uxt_insn)&MacroAssembler::uxthw;
+
   BLOCK_COMMENT("string_compare {");
 
+  // Bizzarely, the counts are passed in bytes, regardless of whether they
+  // are L or U strings, however the result is always in characters.
+  if (!str1_isL) asrw(cnt1, cnt1, 1);
+  if (!str2_isL) asrw(cnt2, cnt2, 1);
+
   // Compute the minimum of the string lengths and save the difference.
   subsw(tmp1, cnt1, cnt2);
   cselw(cnt2, cnt1, cnt2, Assembler::LE); // min
 
   // A very short string
-  cmpw(cnt2, 4);
+  cmpw(cnt2, isLL ? 8:4);
   br(Assembler::LT, SHORT_STRING);
 
   // Check if the strings start at the same location.
@@ -4523,20 +4557,37 @@
 
   // Compare longwords
   {
-    subw(cnt2, cnt2, 4); // The last longword is a special case
+    subw(cnt2, cnt2, isLL ? 8:4); // The last longword is a special case
 
     // Move both string pointers to the last longword of their
     // strings, negate the remaining count, and convert it to bytes.
-    lea(str1, Address(str1, cnt2, Address::uxtw(1)));
-    lea(str2, Address(str2, cnt2, Address::uxtw(1)));
-    sub(cnt2, zr, cnt2, LSL, 1);
+    lea(str1, Address(str1, cnt2, Address::uxtw(str1_chr_shift)));
+    lea(str2, Address(str2, cnt2, Address::uxtw(str2_chr_shift)));
+    if (isLU || isUL) {
+      sub(cnt1, zr, cnt2, LSL, str1_chr_shift);
+      eor(vtmpZ, T16B, vtmpZ, vtmpZ);
+    }
+    sub(cnt2, zr, cnt2, LSL, str2_chr_shift);
 
     // Loop, loading longwords and comparing them into rscratch2.
     bind(NEXT_WORD);
-    ldr(result, Address(str1, cnt2));
-    ldr(cnt1, Address(str2, cnt2));
-    adds(cnt2, cnt2, wordSize);
-    eor(rscratch2, result, cnt1);
+    if (isLU) {
+      ldrs(vtmp, Address(str1, cnt1));
+      zip1(vtmp, T8B, vtmp, vtmpZ);
+      umov(result, vtmp, D, 0);
+    } else {
+      ldr(result, Address(str1, isUL ? cnt1:cnt2));
+    }
+    if (isUL) {
+      ldrs(vtmp, Address(str2, cnt2));
+      zip1(vtmp, T8B, vtmp, vtmpZ);
+      umov(rscratch1, vtmp, D, 0);
+    } else {
+      ldr(rscratch1, Address(str2, cnt2));
+    }
+    adds(cnt2, cnt2, isUL ? 4:8);
+    if (isLU || isUL) add(cnt1, cnt1, isLU ? 4:8);
+    eor(rscratch2, result, rscratch1);
     cbnz(rscratch2, DIFFERENCE);
     br(Assembler::LT, NEXT_WORD);
 
@@ -4544,9 +4595,21 @@
     // same longword twice, but that's still faster than another
     // conditional branch.
 
-    ldr(result, Address(str1));
-    ldr(cnt1, Address(str2));
-    eor(rscratch2, result, cnt1);
+    if (isLU) {
+      ldrs(vtmp, Address(str1));
+      zip1(vtmp, T8B, vtmp, vtmpZ);
+      umov(result, vtmp, D, 0);
+    } else {
+      ldr(result, Address(str1));
+    }
+    if (isUL) {
+      ldrs(vtmp, Address(str2));
+      zip1(vtmp, T8B, vtmp, vtmpZ);
+      umov(rscratch1, vtmp, D, 0);
+    } else {
+      ldr(rscratch1, Address(str2));
+    }
+    eor(rscratch2, result, rscratch1);
     cbz(rscratch2, LENGTH_DIFF);
 
     // Find the first different characters in the longwords and
@@ -4554,12 +4617,12 @@
     bind(DIFFERENCE);
     rev(rscratch2, rscratch2);
     clz(rscratch2, rscratch2);
-    andr(rscratch2, rscratch2, -16);
+    andr(rscratch2, rscratch2, isLL ? -8 : -16);
     lsrv(result, result, rscratch2);
-    uxthw(result, result);
-    lsrv(cnt1, cnt1, rscratch2);
-    uxthw(cnt1, cnt1);
-    subw(result, result, cnt1);
+    (this->*ext_chr)(result, result);
+    lsrv(rscratch1, rscratch1, rscratch2);
+    (this->*ext_chr)(rscratch1, rscratch1);
+    subw(result, result, rscratch1);
     b(DONE);
   }
 
@@ -4568,8 +4631,8 @@
   cbz(cnt2, LENGTH_DIFF);
 
   bind(SHORT_LOOP);
-  load_unsigned_short(result, Address(post(str1, 2)));
-  load_unsigned_short(cnt1, Address(post(str2, 2)));
+  (this->*str1_load_chr)(result, Address(post(str1, str1_chr_size)));
+  (this->*str2_load_chr)(cnt1, Address(post(str2, str2_chr_size)));
   subw(result, result, cnt1);
   cbnz(result, DONE);
   sub(cnt2, cnt2, 1);
@@ -4853,7 +4916,7 @@
   // alignment.
   if (!is_large || !(BlockZeroingLowLimit >= zva_length * 2)) {
     int low_limit = MAX2(zva_length * 2, (int)BlockZeroingLowLimit);
-    cmp(cnt, low_limit >> 3);
+    subs(tmp, cnt, low_limit >> 3);
     br(Assembler::LT, small);
   }
 
diff --git a/hotspot/src/cpu/aarch64/vm/macroAssembler_aarch64.hpp b/hotspot/src/cpu/aarch64/vm/macroAssembler_aarch64.hpp
index 2a9d0a9..51a47b7 100644
--- a/hotspot/src/cpu/aarch64/vm/macroAssembler_aarch64.hpp
+++ b/hotspot/src/cpu/aarch64/vm/macroAssembler_aarch64.hpp
@@ -995,10 +995,11 @@
   }
 
   // A generic CAS; success or failure is in the EQ flag.
+  // Clobbers rscratch1
   void cmpxchg(Register addr, Register expected, Register new_val,
                enum operand_size size,
-               bool acquire, bool release,
-               Register tmp = rscratch1);
+               bool acquire, bool release, bool weak,
+               Register result);
 
   // Calls
 
@@ -1198,7 +1199,8 @@
 
   void string_compare(Register str1, Register str2,
                       Register cnt1, Register cnt2, Register result,
-                      Register tmp1);
+                      Register tmp1,
+                      FloatRegister vtmp, FloatRegister vtmpZ, int ae);
 
   void arrays_equals(Register a1, Register a2,
                      Register result, Register cnt1,
diff --git a/hotspot/src/cpu/aarch64/vm/register_definitions_aarch64.cpp b/hotspot/src/cpu/aarch64/vm/register_definitions_aarch64.cpp
index 2c67be1..5411d06 100644
--- a/hotspot/src/cpu/aarch64/vm/register_definitions_aarch64.cpp
+++ b/hotspot/src/cpu/aarch64/vm/register_definitions_aarch64.cpp
@@ -29,6 +29,8 @@
 #include "register_aarch64.hpp"
 # include "interp_masm_aarch64.hpp"
 
+REGISTER_DEFINITION(Register, noreg);
+
 REGISTER_DEFINITION(Register, r0);
 REGISTER_DEFINITION(Register, r1);
 REGISTER_DEFINITION(Register, r2);
@@ -62,6 +64,8 @@
 REGISTER_DEFINITION(Register, r30);
 REGISTER_DEFINITION(Register, sp);
 
+REGISTER_DEFINITION(FloatRegister, fnoreg);
+
 REGISTER_DEFINITION(FloatRegister, v0);
 REGISTER_DEFINITION(FloatRegister, v1);
 REGISTER_DEFINITION(FloatRegister, v2);
diff --git a/hotspot/src/cpu/aarch64/vm/stubGenerator_aarch64.cpp b/hotspot/src/cpu/aarch64/vm/stubGenerator_aarch64.cpp
index b93e9b1..13071f5 100644
--- a/hotspot/src/cpu/aarch64/vm/stubGenerator_aarch64.cpp
+++ b/hotspot/src/cpu/aarch64/vm/stubGenerator_aarch64.cpp
@@ -801,6 +801,12 @@
     StubCodeMark mark(this, "StubRoutines", stub_name);
     __ align(CodeEntryAlignment);
     __ bind(start);
+
+    Label unaligned_copy_long;
+    if (AvoidUnalignedAccesses) {
+      __ tbnz(d, 3, unaligned_copy_long);
+    }
+
     if (direction == copy_forwards) {
       __ sub(s, s, bias);
       __ sub(d, d, bias);
@@ -901,6 +907,198 @@
     }
 
     __ ret(lr);
+
+    if (AvoidUnalignedAccesses) {
+      Label drain, again;
+      // Register order for storing. Order is different for backward copy.
+
+      __ bind(unaligned_copy_long);
+
+      // source address is even aligned, target odd aligned
+      //
+      // when forward copying word pairs we read long pairs at offsets
+      // {0, 2, 4, 6} (in long words). when backwards copying we read
+      // long pairs at offsets {-2, -4, -6, -8}. We adjust the source
+      // address by -2 in the forwards case so we can compute the
+      // source offsets for both as {2, 4, 6, 8} * unit where unit = 1
+      // or -1.
+      //
+      // when forward copying we need to store 1 word, 3 pairs and
+      // then 1 word at offsets {0, 1, 3, 5, 7}. Rather thna use a
+      // zero offset We adjust the destination by -1 which means we
+      // have to use offsets { 1, 2, 4, 6, 8} * unit for the stores.
+      //
+      // When backwards copyng we need to store 1 word, 3 pairs and
+      // then 1 word at offsets {-1, -3, -5, -7, -8} i.e. we use
+      // offsets {1, 3, 5, 7, 8} * unit.
+
+      if (direction == copy_forwards) {
+        __ sub(s, s, 16);
+        __ sub(d, d, 8);
+      }
+
+      // Fill 8 registers
+      //
+      // for forwards copy s was offset by -16 from the original input
+      // value of s so the register contents are at these offsets
+      // relative to the 64 bit block addressed by that original input
+      // and so on for each successive 64 byte block when s is updated
+      //
+      // t0 at offset 0,  t1 at offset 8
+      // t2 at offset 16, t3 at offset 24
+      // t4 at offset 32, t5 at offset 40
+      // t6 at offset 48, t7 at offset 56
+
+      // for backwards copy s was not offset so the register contents
+      // are at these offsets into the preceding 64 byte block
+      // relative to that original input and so on for each successive
+      // preceding 64 byte block when s is updated. this explains the
+      // slightly counter-intuitive looking pattern of register usage
+      // in the stp instructions for backwards copy.
+      //
+      // t0 at offset -16, t1 at offset -8
+      // t2 at offset -32, t3 at offset -24
+      // t4 at offset -48, t5 at offset -40
+      // t6 at offset -64, t7 at offset -56
+
+      __ ldp(t0, t1, Address(s, 2 * unit));
+      __ ldp(t2, t3, Address(s, 4 * unit));
+      __ ldp(t4, t5, Address(s, 6 * unit));
+      __ ldp(t6, t7, Address(__ pre(s, 8 * unit)));
+
+      __ subs(count, count, 16);
+      __ br(Assembler::LO, drain);
+
+      int prefetch = PrefetchCopyIntervalInBytes;
+      bool use_stride = false;
+      if (direction == copy_backwards) {
+         use_stride = prefetch > 256;
+         prefetch = -prefetch;
+         if (use_stride) __ mov(stride, prefetch);
+      }
+
+      __ bind(again);
+
+      if (PrefetchCopyIntervalInBytes > 0)
+        __ prfm(use_stride ? Address(s, stride) : Address(s, prefetch), PLDL1KEEP);
+
+      if (direction == copy_forwards) {
+       // allowing for the offset of -8 the store instructions place
+       // registers into the target 64 bit block at the following
+       // offsets
+       //
+       // t0 at offset 0
+       // t1 at offset 8,  t2 at offset 16
+       // t3 at offset 24, t4 at offset 32
+       // t5 at offset 40, t6 at offset 48
+       // t7 at offset 56
+
+        __ str(t0, Address(d, 1 * unit));
+        __ stp(t1, t2, Address(d, 2 * unit));
+        __ ldp(t0, t1, Address(s, 2 * unit));
+        __ stp(t3, t4, Address(d, 4 * unit));
+        __ ldp(t2, t3, Address(s, 4 * unit));
+        __ stp(t5, t6, Address(d, 6 * unit));
+        __ ldp(t4, t5, Address(s, 6 * unit));
+        __ str(t7, Address(__ pre(d, 8 * unit)));
+        __ ldp(t6, t7, Address(__ pre(s, 8 * unit)));
+      } else {
+       // d was not offset when we started so the registers are
+       // written into the 64 bit block preceding d with the following
+       // offsets
+       //
+       // t1 at offset -8
+       // t3 at offset -24, t0 at offset -16
+       // t5 at offset -48, t2 at offset -32
+       // t7 at offset -56, t4 at offset -48
+       //                   t6 at offset -64
+       //
+       // note that this matches the offsets previously noted for the
+       // loads
+
+        __ str(t1, Address(d, 1 * unit));
+        __ stp(t3, t0, Address(d, 3 * unit));
+        __ ldp(t0, t1, Address(s, 2 * unit));
+        __ stp(t5, t2, Address(d, 5 * unit));
+        __ ldp(t2, t3, Address(s, 4 * unit));
+        __ stp(t7, t4, Address(d, 7 * unit));
+        __ ldp(t4, t5, Address(s, 6 * unit));
+        __ str(t6, Address(__ pre(d, 8 * unit)));
+        __ ldp(t6, t7, Address(__ pre(s, 8 * unit)));
+      }
+
+      __ subs(count, count, 8);
+      __ br(Assembler::HS, again);
+
+      // Drain
+      //
+      // this uses the same pattern of offsets and register arguments
+      // as above
+      __ bind(drain);
+      if (direction == copy_forwards) {
+        __ str(t0, Address(d, 1 * unit));
+        __ stp(t1, t2, Address(d, 2 * unit));
+        __ stp(t3, t4, Address(d, 4 * unit));
+        __ stp(t5, t6, Address(d, 6 * unit));
+        __ str(t7, Address(__ pre(d, 8 * unit)));
+      } else {
+        __ str(t1, Address(d, 1 * unit));
+        __ stp(t3, t0, Address(d, 3 * unit));
+        __ stp(t5, t2, Address(d, 5 * unit));
+        __ stp(t7, t4, Address(d, 7 * unit));
+        __ str(t6, Address(__ pre(d, 8 * unit)));
+      }
+      // now we need to copy any remaining part block which may
+      // include a 4 word block subblock and/or a 2 word subblock.
+      // bits 2 and 1 in the count are the tell-tale for whetehr we
+      // have each such subblock
+      {
+        Label L1, L2;
+        __ tbz(count, exact_log2(4), L1);
+       // this is the same as above but copying only 4 longs hence
+       // with ony one intervening stp between the str instructions
+       // but note that the offsets and registers still follow the
+       // same pattern
+        __ ldp(t0, t1, Address(s, 2 * unit));
+        __ ldp(t2, t3, Address(__ pre(s, 4 * unit)));
+        if (direction == copy_forwards) {
+          __ str(t0, Address(d, 1 * unit));
+          __ stp(t1, t2, Address(d, 2 * unit));
+          __ str(t3, Address(__ pre(d, 4 * unit)));
+        } else {
+          __ str(t1, Address(d, 1 * unit));
+          __ stp(t3, t0, Address(d, 3 * unit));
+          __ str(t2, Address(__ pre(d, 4 * unit)));
+        }
+        __ bind(L1);
+
+        __ tbz(count, 1, L2);
+       // this is the same as above but copying only 2 longs hence
+       // there is no intervening stp between the str instructions
+       // but note that the offset and register patterns are still
+       // the same
+        __ ldp(t0, t1, Address(__ pre(s, 2 * unit)));
+        if (direction == copy_forwards) {
+          __ str(t0, Address(d, 1 * unit));
+          __ str(t1, Address(__ pre(d, 2 * unit)));
+        } else {
+          __ str(t1, Address(d, 1 * unit));
+          __ str(t0, Address(__ pre(d, 2 * unit)));
+        }
+        __ bind(L2);
+
+       // for forwards copy we need to re-adjust the offsets we
+       // applied so that s and d are follow the last words written
+
+       if (direction == copy_forwards) {
+         __ add(s, s, 16);
+         __ add(d, d, 8);
+       }
+
+      }
+
+      __ ret(lr);
+      }
   }
 
   // Small copy: less than 16 bytes.
@@ -1024,11 +1222,9 @@
     // (96 bytes if SIMD because we do 32 byes per instruction)
     __ bind(copy80);
     if (UseSIMDForMemoryOps) {
-      __ ldpq(v0, v1, Address(s, 0));
-      __ ldpq(v2, v3, Address(s, 32));
+      __ ld4(v0, v1, v2, v3, __ T16B, Address(s, 0));
       __ ldpq(v4, v5, Address(send, -32));
-      __ stpq(v0, v1, Address(d, 0));
-      __ stpq(v2, v3, Address(d, 32));
+      __ st4(v0, v1, v2, v3, __ T16B, Address(d, 0));
       __ stpq(v4, v5, Address(dend, -32));
     } else {
       __ ldp(t0, t1, Address(s, 0));
@@ -2150,8 +2346,9 @@
     __ subw(count, count, cnt_words, Assembler::LSL, 3 - shift);
     if (UseBlockZeroing) {
       Label non_block_zeroing, rest;
+      Register tmp = rscratch1;
       // count >= BlockZeroingLowLimit && value == 0
-      __ cmp(cnt_words, BlockZeroingLowLimit >> 3);
+      __ subs(tmp, cnt_words, BlockZeroingLowLimit >> 3);
       __ ccmp(value, 0 /* comparing value */, 0 /* NZCV */, Assembler::GE);
       __ br(Assembler::NE, non_block_zeroing);
       __ mov(bz_base, to);
diff --git a/hotspot/src/cpu/aarch64/vm/templateInterpreterGenerator_aarch64.cpp b/hotspot/src/cpu/aarch64/vm/templateInterpreterGenerator_aarch64.cpp
index 4c54f8e..293024c 100644
--- a/hotspot/src/cpu/aarch64/vm/templateInterpreterGenerator_aarch64.cpp
+++ b/hotspot/src/cpu/aarch64/vm/templateInterpreterGenerator_aarch64.cpp
@@ -437,6 +437,21 @@
   __ restore_locals();
   __ restore_constant_pool_cache();
   __ get_method(rmethod);
+  __ get_dispatch();
+
+  // Calculate stack limit
+  __ ldr(rscratch1, Address(rmethod, Method::const_offset()));
+  __ ldrh(rscratch1, Address(rscratch1, ConstMethod::max_stack_offset()));
+  __ add(rscratch1, rscratch1, frame::interpreter_frame_monitor_size() + 2);
+  __ ldr(rscratch2,
+         Address(rfp, frame::interpreter_frame_initial_sp_offset * wordSize));
+  __ sub(rscratch1, rscratch2, rscratch1, ext::uxtx, 3);
+  __ andr(sp, rscratch1, -16);
+
+  // Restore expression stack pointer
+  __ ldr(esp, Address(rfp, frame::interpreter_frame_last_sp_offset * wordSize));
+  // NULL last_sp until next java call
+  __ str(zr, Address(rfp, frame::interpreter_frame_last_sp_offset * wordSize));
 
 #if INCLUDE_JVMCI
   // Check if we need to take lock at entry of synchronized method.
@@ -463,22 +478,6 @@
     __ bind(L);
   }
 
-  __ get_dispatch();
-
-  // Calculate stack limit
-  __ ldr(rscratch1, Address(rmethod, Method::const_offset()));
-  __ ldrh(rscratch1, Address(rscratch1, ConstMethod::max_stack_offset()));
-  __ add(rscratch1, rscratch1, frame::interpreter_frame_monitor_size() + 2);
-  __ ldr(rscratch2,
-         Address(rfp, frame::interpreter_frame_initial_sp_offset * wordSize));
-  __ sub(rscratch1, rscratch2, rscratch1, ext::uxtx, 3);
-  __ andr(sp, rscratch1, -16);
-
-  // Restore expression stack pointer
-  __ ldr(esp, Address(rfp, frame::interpreter_frame_last_sp_offset * wordSize));
-  // NULL last_sp until next java call
-  __ str(zr, Address(rfp, frame::interpreter_frame_last_sp_offset * wordSize));
-
   __ dispatch_next(state, step);
   return entry;
 }
diff --git a/hotspot/src/cpu/aarch64/vm/templateTable_aarch64.cpp b/hotspot/src/cpu/aarch64/vm/templateTable_aarch64.cpp
index 68827fc..3fd9dbe 100644
--- a/hotspot/src/cpu/aarch64/vm/templateTable_aarch64.cpp
+++ b/hotspot/src/cpu/aarch64/vm/templateTable_aarch64.cpp
@@ -2434,7 +2434,7 @@
   __ ldrsb(r0, field);
   __ push(ztos);
   // Rewrite bytecode to be faster
-  if (!is_static) {
+  if (rc == may_rewrite) {
     // use btos rewriting, no truncating to t/f bit is needed for getfield.
     patch_bytecode(Bytecodes::_fast_bgetfield, bc, r1);
   }
@@ -2670,7 +2670,7 @@
     if (!is_static) pop_and_check_object(obj);
     __ andw(r0, r0, 0x1);
     __ strb(r0, field);
-    if (!is_static) {
+    if (rc == may_rewrite) {
       patch_bytecode(Bytecodes::_fast_zputfield, bc, r1, true, byte_no);
     }
     __ b(Done);
diff --git a/hotspot/src/cpu/aarch64/vm/vm_version_aarch64.cpp b/hotspot/src/cpu/aarch64/vm/vm_version_aarch64.cpp
index 070fcbd..f147016 100644
--- a/hotspot/src/cpu/aarch64/vm/vm_version_aarch64.cpp
+++ b/hotspot/src/cpu/aarch64/vm/vm_version_aarch64.cpp
@@ -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.
  * Copyright (c) 2015, Red Hat Inc. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
@@ -29,10 +29,10 @@
 #include "memory/resourceArea.hpp"
 #include "runtime/java.hpp"
 #include "runtime/stubCodeGenerator.hpp"
+#include "utilities/macros.hpp"
 #include "vm_version_aarch64.hpp"
-#ifdef TARGET_OS_FAMILY_linux
-# include "os_linux.inline.hpp"
-#endif
+
+#include OS_HEADER_INLINE(os)
 
 #ifndef BUILTIN_SIM
 #include <sys/auxv.h>
@@ -175,7 +175,15 @@
   }
 
   // Enable vendor specific features
-  if (_cpu == CPU_CAVIUM && _variant == 0) _features |= CPU_DMB_ATOMICS;
+  if (_cpu == CPU_CAVIUM) {
+    if (_variant == 0) _features |= CPU_DMB_ATOMICS;
+    if (FLAG_IS_DEFAULT(AvoidUnalignedAccesses)) {
+      FLAG_SET_DEFAULT(AvoidUnalignedAccesses, true);
+    }
+    if (FLAG_IS_DEFAULT(UseSIMDForMemoryOps)) {
+      FLAG_SET_DEFAULT(UseSIMDForMemoryOps, (_variant > 0));
+    }
+  }
   if (_cpu == CPU_ARM && (_model == 0xd03 || _model2 == 0xd03)) _features |= CPU_A53MAC;
   if (_cpu == CPU_ARM && (_model == 0xd07 || _model2 == 0xd07)) _features |= CPU_STXR_PREFETCH;
   // If an olde style /proc/cpuinfo (cpu_lines == 1) then if _model is an A57 (0xd07)
diff --git a/hotspot/src/cpu/ppc/vm/bytes_ppc.hpp b/hotspot/src/cpu/ppc/vm/bytes_ppc.hpp
index be005cb..b75b0f0 100644
--- a/hotspot/src/cpu/ppc/vm/bytes_ppc.hpp
+++ b/hotspot/src/cpu/ppc/vm/bytes_ppc.hpp
@@ -1,6 +1,6 @@
 /*
- * Copyright (c) 1997, 2013, Oracle and/or its affiliates. All rights reserved.
- * Copyright (c) 2012, 2013 SAP SE. All rights reserved.
+ * Copyright (c) 1997, 2016, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2012, 2016 SAP SE. 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
@@ -274,8 +274,6 @@
 #endif // VM_LITTLE_ENDIAN
 };
 
-#if defined(TARGET_OS_ARCH_linux_ppc)
-#include "bytes_linux_ppc.inline.hpp"
-#endif
+#include OS_CPU_HEADER_INLINE(bytes)
 
 #endif // CPU_PPC_VM_BYTES_PPC_HPP
diff --git a/hotspot/src/cpu/ppc/vm/c1_LIR_ppc.cpp b/hotspot/src/cpu/ppc/vm/c1_LIR_ppc.cpp
new file mode 100644
index 0000000..ef9b083
--- /dev/null
+++ b/hotspot/src/cpu/ppc/vm/c1_LIR_ppc.cpp
@@ -0,0 +1,64 @@
+/*
+ * Copyright (c) 2016, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2016 SAP SE. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ *
+ */
+
+#include "precompiled.hpp"
+#include "asm/register.hpp"
+#include "c1/c1_LIR.hpp"
+
+FloatRegister LIR_OprDesc::as_float_reg() const {
+  return as_FloatRegister(fpu_regnr());
+}
+
+FloatRegister LIR_OprDesc::as_double_reg() const {
+  return as_FloatRegister(fpu_regnrLo());
+}
+
+// Reg2 unused.
+LIR_Opr LIR_OprFact::double_fpu(int reg1, int reg2) {
+  assert(!as_FloatRegister(reg2)->is_valid(), "Not used on this platform");
+  return (LIR_Opr)(intptr_t)((reg1 << LIR_OprDesc::reg1_shift) |
+                             (reg1 << LIR_OprDesc::reg2_shift) |
+                             LIR_OprDesc::double_type          |
+                             LIR_OprDesc::fpu_register         |
+                             LIR_OprDesc::double_size);
+}
+
+#ifndef PRODUCT
+void LIR_Address::verify() const {
+  assert(scale() == times_1, "Scaled addressing mode not available on PPC and should not be used");
+  assert(disp() == 0 || index()->is_illegal(), "can't have both");
+#ifdef _LP64
+  assert(base()->is_cpu_register(), "wrong base operand");
+  assert(index()->is_illegal() || index()->is_double_cpu(), "wrong index operand");
+  assert(base()->type() == T_OBJECT || base()->type() == T_LONG || base()->type() == T_METADATA,
+         "wrong type for addresses");
+#else
+  assert(base()->is_single_cpu(), "wrong base operand");
+  assert(index()->is_illegal() || index()->is_single_cpu(), "wrong index operand");
+  assert(base()->type() == T_OBJECT || base()->type() == T_INT || base()->type() == T_METADATA,
+         "wrong type for addresses");
+#endif
+}
+#endif // PRODUCT
diff --git a/hotspot/src/cpu/ppc/vm/globalDefinitions_ppc.hpp b/hotspot/src/cpu/ppc/vm/globalDefinitions_ppc.hpp
index 941a65f..5e36654 100644
--- a/hotspot/src/cpu/ppc/vm/globalDefinitions_ppc.hpp
+++ b/hotspot/src/cpu/ppc/vm/globalDefinitions_ppc.hpp
@@ -47,7 +47,7 @@
 // The expected size in bytes of a cache line, used to pad data structures.
 #define DEFAULT_CACHE_LINE_SIZE 128
 
-#if defined(COMPILER2) && (defined(AIX) || defined(linux))
+#if defined(COMPILER2) && (defined(AIX) || defined(LINUX))
 // Include Transactional Memory lock eliding optimization
 #define INCLUDE_RTM_OPT 1
 #endif
diff --git a/hotspot/src/cpu/ppc/vm/interp_masm_ppc_64.hpp b/hotspot/src/cpu/ppc/vm/interp_masm_ppc.hpp
similarity index 98%
rename from hotspot/src/cpu/ppc/vm/interp_masm_ppc_64.hpp
rename to hotspot/src/cpu/ppc/vm/interp_masm_ppc.hpp
index 3da602d..d2085ea 100644
--- a/hotspot/src/cpu/ppc/vm/interp_masm_ppc_64.hpp
+++ b/hotspot/src/cpu/ppc/vm/interp_masm_ppc.hpp
@@ -23,8 +23,8 @@
  *
  */
 
-#ifndef CPU_PPC_VM_INTERP_MASM_PPC_64_HPP
-#define CPU_PPC_VM_INTERP_MASM_PPC_64_HPP
+#ifndef CPU_PPC_VM_INTERP_MASM_PPC_HPP
+#define CPU_PPC_VM_INTERP_MASM_PPC_HPP
 
 #include "asm/macroAssembler.hpp"
 #include "interpreter/invocationCounter.hpp"
@@ -263,4 +263,4 @@
                           NotifyMethodExitMode mode, bool check_exceptions);
 };
 
-#endif // CPU_PPC_VM_INTERP_MASM_PPC_64_HPP
+#endif // CPU_PPC_VM_INTERP_MASM_PPC_HPP
diff --git a/hotspot/src/cpu/ppc/vm/interp_masm_ppc_64.cpp b/hotspot/src/cpu/ppc/vm/interp_masm_ppc_64.cpp
index 2a8eddf..70544e9 100644
--- a/hotspot/src/cpu/ppc/vm/interp_masm_ppc_64.cpp
+++ b/hotspot/src/cpu/ppc/vm/interp_masm_ppc_64.cpp
@@ -26,7 +26,7 @@
 
 #include "precompiled.hpp"
 #include "asm/macroAssembler.inline.hpp"
-#include "interp_masm_ppc_64.hpp"
+#include "interp_masm_ppc.hpp"
 #include "interpreter/interpreterRuntime.hpp"
 #include "prims/jvmtiThreadState.hpp"
 #include "runtime/sharedRuntime.hpp"
diff --git a/hotspot/src/cpu/ppc/vm/ppc_64.ad b/hotspot/src/cpu/ppc/vm/ppc_64.ad
deleted file mode 100644
index 712f18f..0000000
--- a/hotspot/src/cpu/ppc/vm/ppc_64.ad
+++ /dev/null
@@ -1,24 +0,0 @@
-//
-// Copyright (c) 2011, 2013, Oracle and/or its affiliates. All rights reserved.
-// Copyright (c) 2012, 2013 SAP SE. 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.
-//
-//
diff --git a/hotspot/src/cpu/ppc/vm/register_ppc.hpp b/hotspot/src/cpu/ppc/vm/register_ppc.hpp
index fffd7dc..e73dc18 100644
--- a/hotspot/src/cpu/ppc/vm/register_ppc.hpp
+++ b/hotspot/src/cpu/ppc/vm/register_ppc.hpp
@@ -1,6 +1,6 @@
 /*
- * Copyright (c) 2000, 2014, Oracle and/or its affiliates. All rights reserved.
- * Copyright (c) 2012, 2014 SAP SE. All rights reserved.
+ * Copyright (c) 2000, 2016, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2012, 2016 SAP SE. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -76,7 +76,7 @@
 typedef RegisterImpl* Register;
 
 inline Register as_Register(int encoding) {
-  assert(encoding >= 0 && encoding < 32, "bad register encoding");
+  assert(encoding >= -1 && encoding < 32, "bad register encoding");
   return (Register)(intptr_t)encoding;
 }
 
@@ -91,7 +91,7 @@
   inline friend Register as_Register(int encoding);
 
   // accessors
-  int encoding()  const { assert(is_valid(), "invalid register"); return value(); }
+  int encoding() const { assert(is_valid(), "invalid register"); return value(); }
   inline VMReg as_VMReg();
   Register successor() const { return as_Register(encoding() + 1); }
 
@@ -247,7 +247,7 @@
 typedef FloatRegisterImpl* FloatRegister;
 
 inline FloatRegister as_FloatRegister(int encoding) {
-  assert(encoding >= 0 && encoding < 32, "bad float register encoding");
+  assert(encoding >= -1 && encoding < 32, "bad float register encoding");
   return (FloatRegister)(intptr_t)encoding;
 }
 
@@ -267,7 +267,7 @@
   FloatRegister successor() const { return as_FloatRegister(encoding() + 1); }
 
   // testers
-  bool is_valid()       const { return (0  <=  value()       &&  value()       < number_of_registers); }
+  bool is_valid() const { return (0 <= value() && value() < number_of_registers); }
 
   const char* name() const;
 };
diff --git a/hotspot/src/cpu/ppc/vm/sharedRuntime_ppc.cpp b/hotspot/src/cpu/ppc/vm/sharedRuntime_ppc.cpp
index 38c83d3..609420a 100644
--- a/hotspot/src/cpu/ppc/vm/sharedRuntime_ppc.cpp
+++ b/hotspot/src/cpu/ppc/vm/sharedRuntime_ppc.cpp
@@ -40,7 +40,7 @@
 #include "c1/c1_Runtime1.hpp"
 #endif
 #ifdef COMPILER2
-#include "adfiles/ad_ppc_64.hpp"
+#include "opto/ad.hpp"
 #include "opto/runtime.hpp"
 #endif
 
diff --git a/hotspot/src/cpu/ppc/vm/stubRoutines_ppc_64.hpp b/hotspot/src/cpu/ppc/vm/stubRoutines_ppc.hpp
similarity index 87%
rename from hotspot/src/cpu/ppc/vm/stubRoutines_ppc_64.hpp
rename to hotspot/src/cpu/ppc/vm/stubRoutines_ppc.hpp
index a005677..b04c99c 100644
--- a/hotspot/src/cpu/ppc/vm/stubRoutines_ppc_64.hpp
+++ b/hotspot/src/cpu/ppc/vm/stubRoutines_ppc.hpp
@@ -1,6 +1,6 @@
 /*
- * Copyright (c) 2002, 2015, Oracle and/or its affiliates. All rights reserved.
- * Copyright (c) 2012, 2015 SAP SE. All rights reserved.
+ * Copyright (c) 2002, 2016, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2012, 2016 SAP SE. 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
@@ -23,8 +23,8 @@
  *
  */
 
-#ifndef CPU_PPC_VM_STUBROUTINES_PPC_64_HPP
-#define CPU_PPC_VM_STUBROUTINES_PPC_64_HPP
+#ifndef CPU_PPC_VM_STUBROUTINES_PPC_HPP
+#define CPU_PPC_VM_STUBROUTINES_PPC_HPP
 
 // This file holds the platform specific parts of the StubRoutines
 // definition. See stubRoutines.hpp for a description on how to
@@ -61,4 +61,4 @@
 
 };
 
-#endif // CPU_PPC_VM_STUBROUTINES_PPC_64_HPP
+#endif // CPU_PPC_VM_STUBROUTINES_PPC_HPP
diff --git a/hotspot/src/cpu/ppc/vm/templateInterpreterGenerator_ppc.cpp b/hotspot/src/cpu/ppc/vm/templateInterpreterGenerator_ppc.cpp
index 591db70..c37887f 100644
--- a/hotspot/src/cpu/ppc/vm/templateInterpreterGenerator_ppc.cpp
+++ b/hotspot/src/cpu/ppc/vm/templateInterpreterGenerator_ppc.cpp
@@ -881,10 +881,6 @@
   BLOCK_COMMENT("} stack_overflow_check_with_compare");
 }
 
-void TemplateInterpreterGenerator::unlock_method(bool check_exceptions) {
-  __ unlock_object(R26_monitor, check_exceptions);
-}
-
 // Lock the current method, interpreter register window must be set up!
 void TemplateInterpreterGenerator::lock_method(Register Rflags, Register Rscratch1, Register Rscratch2, bool flags_preloaded) {
   const Register Robj_to_lock = Rscratch2;
@@ -1566,7 +1562,7 @@
   if (synchronized) {
     // Don't check for exceptions since we're still in the i2n frame. Do that
     // manually afterwards.
-    unlock_method(false);
+    __ unlock_object(R26_monitor, false); // Can also unlock methods.
   }
 
   // Reset active handles after returning from native.
@@ -1609,7 +1605,7 @@
   if (synchronized) {
     // Don't check for exceptions since we're still in the i2n frame. Do that
     // manually afterwards.
-    unlock_method(false);
+    __ unlock_object(R26_monitor, false); // Can also unlock methods.
   }
   BIND(exception_return_sync_check_already_unlocked);
 
diff --git a/hotspot/src/cpu/ppc/vm/templateTable_ppc_64.hpp b/hotspot/src/cpu/ppc/vm/templateTable_ppc.hpp
similarity index 86%
rename from hotspot/src/cpu/ppc/vm/templateTable_ppc_64.hpp
rename to hotspot/src/cpu/ppc/vm/templateTable_ppc.hpp
index 943f12a..05ce690 100644
--- a/hotspot/src/cpu/ppc/vm/templateTable_ppc_64.hpp
+++ b/hotspot/src/cpu/ppc/vm/templateTable_ppc.hpp
@@ -1,6 +1,6 @@
 /*
- * Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved.
- * Copyright (c) 2013, 2014 SAP SE. All rights reserved.
+ * Copyright (c) 2014, 2016, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2013, 2016 SAP SE. 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
@@ -23,8 +23,8 @@
  *
  */
 
-#ifndef CPU_PPC_VM_TEMPLATETABLE_PPC_64_HPP
-#define CPU_PPC_VM_TEMPLATETABLE_PPC_64_HPP
+#ifndef CPU_PPC_VM_TEMPLATETABLE_PPC_HPP
+#define CPU_PPC_VM_TEMPLATETABLE_PPC_HPP
 
   static void prepare_invoke(int byte_no, Register Rmethod, Register Rret_addr, Register Rindex, Register Rrecv, Register Rflags, Register Rscratch);
   static void invokevfinal_helper(Register Rmethod, Register Rflags, Register Rscratch1, Register Rscratch2);
@@ -35,4 +35,4 @@
   static void branch_conditional(ConditionRegister crx, TemplateTable::Condition cc, Label& L, bool invert = false);
   static void if_cmp_common(Register Rfirst, Register Rsecond, Register Rscratch1, Register Rscratch2, Condition cc, bool is_jint, bool cmp0);
 
-#endif // CPU_PPC_VM_TEMPLATETABLE_PPC_64_HPP
+#endif // CPU_PPC_VM_TEMPLATETABLE_PPC_HPP
diff --git a/hotspot/src/cpu/ppc/vm/templateTable_ppc_64.cpp b/hotspot/src/cpu/ppc/vm/templateTable_ppc_64.cpp
index e27601c..37934b4 100644
--- a/hotspot/src/cpu/ppc/vm/templateTable_ppc_64.cpp
+++ b/hotspot/src/cpu/ppc/vm/templateTable_ppc_64.cpp
@@ -1668,9 +1668,13 @@
         __ lwz(Rscratch3, in_bytes(MethodData::backedge_mask_offset()), Rmdo);
         __ addi(Rscratch2, Rscratch2, increment);
         __ stw(Rscratch2, mdo_bc_offs, Rmdo);
-        __ and_(Rscratch3, Rscratch2, Rscratch3);
-        __ bne(CCR0, Lforward);
-        __ b(Loverflow);
+        if (UseOnStackReplacement) {
+          __ and_(Rscratch3, Rscratch2, Rscratch3);
+          __ bne(CCR0, Lforward);
+          __ b(Loverflow);
+        } else {
+          __ b(Lforward);
+        }
       }
 
       // If there's no MDO, increment counter in method.
@@ -1680,9 +1684,12 @@
       __ lwz(Rscratch3, in_bytes(MethodCounters::backedge_mask_offset()), R4_counters);
       __ addi(Rscratch2, Rscratch2, increment);
       __ stw(Rscratch2, mo_bc_offs, R4_counters);
-      __ and_(Rscratch3, Rscratch2, Rscratch3);
-      __ bne(CCR0, Lforward);
-
+      if (UseOnStackReplacement) {
+        __ and_(Rscratch3, Rscratch2, Rscratch3);
+        __ bne(CCR0, Lforward);
+      } else {
+        __ b(Lforward);
+      }
       __ bind(Loverflow);
 
       // Notify point for loop, pass branch bytecode.
diff --git a/hotspot/src/cpu/ppc/vm/vm_version_ppc.cpp b/hotspot/src/cpu/ppc/vm/vm_version_ppc.cpp
index 3b0800d..d83c3cd 100644
--- a/hotspot/src/cpu/ppc/vm/vm_version_ppc.cpp
+++ b/hotspot/src/cpu/ppc/vm/vm_version_ppc.cpp
@@ -278,7 +278,7 @@
       os_too_old = false;
     }
 #endif
-#ifdef linux
+#ifdef LINUX
     // At least Linux kernel 4.2, as the problematic behavior of syscalls
     // being called in the middle of a transaction has been addressed.
     // Please, refer to commit b4b56f9ecab40f3b4ef53e130c9f6663be491894
diff --git a/hotspot/src/cpu/ppc/vm/vtableStubs_ppc_64.cpp b/hotspot/src/cpu/ppc/vm/vtableStubs_ppc_64.cpp
index 9345db6..d2f6117 100644
--- a/hotspot/src/cpu/ppc/vm/vtableStubs_ppc_64.cpp
+++ b/hotspot/src/cpu/ppc/vm/vtableStubs_ppc_64.cpp
@@ -1,6 +1,6 @@
 /*
  * Copyright (c) 1997, 2016, Oracle and/or its affiliates. All rights reserved.
- * Copyright (c) 2012, 2015 SAP SE. All rights reserved.
+ * Copyright (c) 2012, 2016 SAP SE. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -26,7 +26,7 @@
 #include "precompiled.hpp"
 #include "asm/macroAssembler.inline.hpp"
 #include "code/vtableStubs.hpp"
-#include "interp_masm_ppc_64.hpp"
+#include "interp_masm_ppc.hpp"
 #include "memory/resourceArea.hpp"
 #include "oops/instanceKlass.hpp"
 #include "oops/klassVtable.hpp"
@@ -243,7 +243,7 @@
 }
 
 int VtableStub::pd_code_size_limit(bool is_vtable_stub) {
-  if (TraceJumps || DebugVtables || CountCompiledCalls || VerifyOops) {
+  if (DebugVtables || CountCompiledCalls || VerifyOops) {
     return 1000;
   } else {
     int decode_klass_size = MacroAssembler::instr_size_for_decode_klass_not_null();
diff --git a/hotspot/src/cpu/sparc/vm/c1_LIR_sparc.cpp b/hotspot/src/cpu/sparc/vm/c1_LIR_sparc.cpp
new file mode 100644
index 0000000..e946776
--- /dev/null
+++ b/hotspot/src/cpu/sparc/vm/c1_LIR_sparc.cpp
@@ -0,0 +1,63 @@
+/*
+ * 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.
+ *
+ */
+
+#include "precompiled.hpp"
+#include "asm/register.hpp"
+#include "c1/c1_FrameMap.hpp"
+#include "c1/c1_LIR.hpp"
+
+FloatRegister LIR_OprDesc::as_float_reg() const {
+  return FrameMap::nr2floatreg(fpu_regnr());
+}
+
+FloatRegister LIR_OprDesc::as_double_reg() const {
+  return FrameMap::nr2floatreg(fpu_regnrHi());
+}
+
+LIR_Opr LIR_OprFact::double_fpu(int reg1, int reg2) {
+  assert(as_FloatRegister(reg2) != fnoreg, "Sparc holds double in two regs.");
+  return (LIR_Opr)(intptr_t)((reg1 << LIR_OprDesc::reg1_shift) |
+                             (reg2 << LIR_OprDesc::reg2_shift) |
+                             LIR_OprDesc::double_type          |
+                             LIR_OprDesc::fpu_register         |
+                             LIR_OprDesc::double_size);
+}
+
+#ifndef PRODUCT
+void LIR_Address::verify() const {
+  assert(scale() == times_1, "Scaled addressing mode not available on SPARC and should not be used");
+  assert(disp() == 0 || index()->is_illegal(), "can't have both");
+#ifdef _LP64
+  assert(base()->is_cpu_register(), "wrong base operand");
+  assert(index()->is_illegal() || index()->is_double_cpu(), "wrong index operand");
+  assert(base()->type() == T_OBJECT || base()->type() == T_LONG || base()->type() == T_METADATA,
+         "wrong type for addresses");
+#else
+  assert(base()->is_single_cpu(), "wrong base operand");
+  assert(index()->is_illegal() || index()->is_single_cpu(), "wrong index operand");
+  assert(base()->type() == T_OBJECT || base()->type() == T_INT || base()->type() == T_METADATA,
+         "wrong type for addresses");
+#endif
+}
+#endif // PRODUCT
diff --git a/hotspot/src/cpu/sparc/vm/compiledIC_sparc.cpp b/hotspot/src/cpu/sparc/vm/compiledIC_sparc.cpp
index 3536718..4602434 100644
--- a/hotspot/src/cpu/sparc/vm/compiledIC_sparc.cpp
+++ b/hotspot/src/cpu/sparc/vm/compiledIC_sparc.cpp
@@ -77,8 +77,7 @@
   // This doesn't need to be accurate but it must be larger or equal to
   // the real size of the stub.
   return (NativeMovConstReg::instruction_size +  // sethi/setlo;
-          NativeJump::instruction_size + // sethi; jmp; nop
-          (TraceJumps ? 20 * BytesPerInstWord : 0) );
+          NativeJump::instruction_size); // sethi; jmp; nop
 }
 
 // Relocation entries for call stub, compiled java to interpreter.
diff --git a/hotspot/src/cpu/sparc/vm/globalDefinitions_sparc.hpp b/hotspot/src/cpu/sparc/vm/globalDefinitions_sparc.hpp
index ddda080..ba6d99c 100644
--- a/hotspot/src/cpu/sparc/vm/globalDefinitions_sparc.hpp
+++ b/hotspot/src/cpu/sparc/vm/globalDefinitions_sparc.hpp
@@ -32,7 +32,7 @@
 
 // Indicates whether the C calling conventions require that
 // 32-bit integer argument values are extended to 64 bits.
-const bool CCallingConventionRequiresIntsAsLongs = false;
+const bool CCallingConventionRequiresIntsAsLongs = true;
 
 #define SUPPORTS_NATIVE_CX8
 
diff --git a/hotspot/src/cpu/sparc/vm/icBuffer_sparc.cpp b/hotspot/src/cpu/sparc/vm/icBuffer_sparc.cpp
index 641da12..d6942f6 100644
--- a/hotspot/src/cpu/sparc/vm/icBuffer_sparc.cpp
+++ b/hotspot/src/cpu/sparc/vm/icBuffer_sparc.cpp
@@ -33,12 +33,10 @@
 
 int InlineCacheBuffer::ic_stub_code_size() {
 #ifdef _LP64
-  if (TraceJumps) return 600 * wordSize;
   return (NativeMovConstReg::instruction_size +  // sethi;add
           NativeJump::instruction_size +          // sethi; jmp; delay slot
           (1*BytesPerInstWord) + 1);            // flush + 1 extra byte
 #else
-  if (TraceJumps) return 300 * wordSize;
   return (2+2+ 1) * wordSize + 1; // set/jump_to/nop + 1 byte so that code_end can be set in CodeBuffer
 #endif
 }
diff --git a/hotspot/src/cpu/sparc/vm/macroAssembler_sparc.cpp b/hotspot/src/cpu/sparc/vm/macroAssembler_sparc.cpp
index 5fe78ad..e006540 100644
--- a/hotspot/src/cpu/sparc/vm/macroAssembler_sparc.cpp
+++ b/hotspot/src/cpu/sparc/vm/macroAssembler_sparc.cpp
@@ -184,72 +184,10 @@
 
 void MacroAssembler::jmp2(Register r1, Register r2, const char* file, int line ) {
   assert_not_delayed();
-  // This can only be traceable if r1 & r2 are visible after a window save
-  if (TraceJumps) {
-#ifndef PRODUCT
-    save_frame(0);
-    verify_thread();
-    ld(G2_thread, in_bytes(JavaThread::jmp_ring_index_offset()), O0);
-    add(G2_thread, in_bytes(JavaThread::jmp_ring_offset()), O1);
-    sll(O0, exact_log2(4*sizeof(intptr_t)), O2);
-    add(O2, O1, O1);
-
-    add(r1->after_save(), r2->after_save(), O2);
-    set((intptr_t)file, O3);
-    set(line, O4);
-    Label L;
-    // get nearby pc, store jmp target
-    call(L, relocInfo::none);  // No relocation for call to pc+0x8
-    delayed()->st(O2, O1, 0);
-    bind(L);
-
-    // store nearby pc
-    st(O7, O1, sizeof(intptr_t));
-    // store file
-    st(O3, O1, 2*sizeof(intptr_t));
-    // store line
-    st(O4, O1, 3*sizeof(intptr_t));
-    add(O0, 1, O0);
-    and3(O0, JavaThread::jump_ring_buffer_size  - 1, O0);
-    st(O0, G2_thread, in_bytes(JavaThread::jmp_ring_index_offset()));
-    restore();
-#endif /* PRODUCT */
-  }
   jmpl(r1, r2, G0);
 }
 void MacroAssembler::jmp(Register r1, int offset, const char* file, int line ) {
   assert_not_delayed();
-  // This can only be traceable if r1 is visible after a window save
-  if (TraceJumps) {
-#ifndef PRODUCT
-    save_frame(0);
-    verify_thread();
-    ld(G2_thread, in_bytes(JavaThread::jmp_ring_index_offset()), O0);
-    add(G2_thread, in_bytes(JavaThread::jmp_ring_offset()), O1);
-    sll(O0, exact_log2(4*sizeof(intptr_t)), O2);
-    add(O2, O1, O1);
-
-    add(r1->after_save(), offset, O2);
-    set((intptr_t)file, O3);
-    set(line, O4);
-    Label L;
-    // get nearby pc, store jmp target
-    call(L, relocInfo::none);  // No relocation for call to pc+0x8
-    delayed()->st(O2, O1, 0);
-    bind(L);
-
-    // store nearby pc
-    st(O7, O1, sizeof(intptr_t));
-    // store file
-    st(O3, O1, 2*sizeof(intptr_t));
-    // store line
-    st(O4, O1, 3*sizeof(intptr_t));
-    add(O0, 1, O0);
-    and3(O0, JavaThread::jump_ring_buffer_size  - 1, O0);
-    st(O0, G2_thread, in_bytes(JavaThread::jmp_ring_index_offset()));
-    restore();
-#endif /* PRODUCT */
-  }
   jmp(r1, offset);
 }
 
@@ -260,44 +198,7 @@
   // variable length instruction streams.
   patchable_sethi(addrlit, temp);
   Address a(temp, addrlit.low10() + offset);  // Add the offset to the displacement.
-  if (TraceJumps) {
-#ifndef PRODUCT
-    // Must do the add here so relocation can find the remainder of the
-    // value to be relocated.
-    add(a.base(), a.disp(), a.base(), addrlit.rspec(offset));
-    save_frame(0);
-    verify_thread();
-    ld(G2_thread, in_bytes(JavaThread::jmp_ring_index_offset()), O0);
-    add(G2_thread, in_bytes(JavaThread::jmp_ring_offset()), O1);
-    sll(O0, exact_log2(4*sizeof(intptr_t)), O2);
-    add(O2, O1, O1);
-
-    set((intptr_t)file, O3);
-    set(line, O4);
-    Label L;
-
-    // get nearby pc, store jmp target
-    call(L, relocInfo::none);  // No relocation for call to pc+0x8
-    delayed()->st(a.base()->after_save(), O1, 0);
-    bind(L);
-
-    // store nearby pc
-    st(O7, O1, sizeof(intptr_t));
-    // store file
-    st(O3, O1, 2*sizeof(intptr_t));
-    // store line
-    st(O4, O1, 3*sizeof(intptr_t));
-    add(O0, 1, O0);
-    and3(O0, JavaThread::jump_ring_buffer_size  - 1, O0);
-    st(O0, G2_thread, in_bytes(JavaThread::jmp_ring_index_offset()));
-    restore();
-    jmpl(a.base(), G0, d);
-#else
-    jmpl(a.base(), a.disp(), d);
-#endif /* PRODUCT */
-  } else {
-    jmpl(a.base(), a.disp(), d);
-  }
+  jmpl(a.base(), a.disp(), d);
 }
 
 void MacroAssembler::jump(const AddressLiteral& addrlit, Register temp, int offset, const char* file, int line) {
diff --git a/hotspot/src/cpu/sparc/vm/macroAssembler_sparc.hpp b/hotspot/src/cpu/sparc/vm/macroAssembler_sparc.hpp
index d94de09..a401859 100644
--- a/hotspot/src/cpu/sparc/vm/macroAssembler_sparc.hpp
+++ b/hotspot/src/cpu/sparc/vm/macroAssembler_sparc.hpp
@@ -703,8 +703,8 @@
 
   inline void tst( Register s );
 
-  inline void ret(  bool trace = TraceJumps );
-  inline void retl( bool trace = TraceJumps );
+  inline void ret(  bool trace = false );
+  inline void retl( bool trace = false );
 
   // Required platform-specific helpers for Label::patch_instructions.
   // They _shadow_ the declarations in AbstractAssembler, which are undefined.
diff --git a/hotspot/src/cpu/sparc/vm/nativeInst_sparc.cpp b/hotspot/src/cpu/sparc/vm/nativeInst_sparc.cpp
index d175508..103c712 100644
--- a/hotspot/src/cpu/sparc/vm/nativeInst_sparc.cpp
+++ b/hotspot/src/cpu/sparc/vm/nativeInst_sparc.cpp
@@ -760,8 +760,7 @@
   Register rd = inv_rd(i0);
 #ifndef _LP64
   if (!(is_op2(i0, Assembler::sethi_op2) && rd != G0 &&
-        (is_op3(i1, Assembler::jmpl_op3, Assembler::arith_op) ||
-        (TraceJumps && is_op3(i1, Assembler::add_op3, Assembler::arith_op))) &&
+        (is_op3(i1, Assembler::jmpl_op3, Assembler::arith_op)) &&
         inv_immed(i1) && (unsigned)get_simm13(i1) < (1 << 10) &&
         rd == inv_rs1(i1))) {
     fatal("not a jump_to instruction");
diff --git a/hotspot/src/cpu/sparc/vm/register_definitions_sparc.cpp b/hotspot/src/cpu/sparc/vm/register_definitions_sparc.cpp
index a27dc43..8fd22e2 100644
--- a/hotspot/src/cpu/sparc/vm/register_definitions_sparc.cpp
+++ b/hotspot/src/cpu/sparc/vm/register_definitions_sparc.cpp
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2002, 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2002, 2016, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -25,7 +25,9 @@
 // make sure the defines don't screw up the declarations later on in this file
 #define DONT_USE_REGISTER_DEFINES
 
-#include "precompiled.hpp"
+// Note: precompiled headers can not be used in this file because of the above
+//       definition
+
 #include "asm/assembler.hpp"
 #include "asm/register.hpp"
 #include "interp_masm_sparc.hpp"
diff --git a/hotspot/src/cpu/sparc/vm/sharedRuntime_sparc.cpp b/hotspot/src/cpu/sparc/vm/sharedRuntime_sparc.cpp
index a587b55..aa54e3b 100644
--- a/hotspot/src/cpu/sparc/vm/sharedRuntime_sparc.cpp
+++ b/hotspot/src/cpu/sparc/vm/sharedRuntime_sparc.cpp
@@ -3368,9 +3368,7 @@
   // setup code generation tools
   // Measured 8/7/03 at 896 in 32bit debug build (no VerifyThread)
   // Measured 8/7/03 at 1080 in 32bit debug build (VerifyThread)
-  // even larger with TraceJumps
-  int pad = TraceJumps ? 512 : 0;
-  CodeBuffer buffer("handler_blob", 1600 + pad, 512);
+  CodeBuffer buffer("handler_blob", 1600, 512);
   MacroAssembler* masm                = new MacroAssembler(&buffer);
   int             frame_size_words;
   OopMapSet *oop_maps = new OopMapSet();
@@ -3462,9 +3460,7 @@
   // setup code generation tools
   // Measured 8/7/03 at 896 in 32bit debug build (no VerifyThread)
   // Measured 8/7/03 at 1080 in 32bit debug build (VerifyThread)
-  // even larger with TraceJumps
-  int pad = TraceJumps ? 512 : 0;
-  CodeBuffer buffer(name, 1600 + pad, 512);
+  CodeBuffer buffer(name, 1600, 512);
   MacroAssembler* masm                = new MacroAssembler(&buffer);
   int             frame_size_words;
   OopMapSet *oop_maps = new OopMapSet();
diff --git a/hotspot/src/cpu/sparc/vm/sparc.ad b/hotspot/src/cpu/sparc/vm/sparc.ad
index 653da26..f0a897f 100644
--- a/hotspot/src/cpu/sparc/vm/sparc.ad
+++ b/hotspot/src/cpu/sparc/vm/sparc.ad
@@ -501,16 +501,10 @@
   static int emit_deopt_handler(CodeBuffer& cbuf);
 
   static uint size_exception_handler() {
-    if (TraceJumps) {
-      return (400); // just a guess
-    }
     return ( NativeJump::instruction_size ); // sethi;jmp;nop
   }
 
   static uint size_deopt_handler() {
-    if (TraceJumps) {
-      return (400); // just a guess
-    }
     return ( 4+  NativeJump::instruction_size ); // save;sethi;jmp;restore
   }
 };
@@ -720,7 +714,7 @@
   return offset;
 }
 
-static inline jdouble replicate_immI(int con, int count, int width) {
+static inline jlong replicate_immI(int con, int count, int width) {
   // Load a constant replicated "count" times with width "width"
   assert(count*width == 8 && width <= 4, "sanity");
   int bit_width = width * 8;
@@ -729,17 +723,15 @@
   for (int i = 0; i < count - 1; i++) {
     val |= (val << bit_width);
   }
-  jdouble dval = *((jdouble*) &val);  // coerce to double type
-  return dval;
+  return val;
 }
 
-static inline jdouble replicate_immF(float con) {
+static inline jlong replicate_immF(float con) {
   // Replicate float con 2 times and pack into vector.
   int val = *((int*)&con);
   jlong lval = val;
   lval = (lval << 32) | (lval & 0xFFFFFFFFl);
-  jdouble dval = *((jdouble*) &lval);  // coerce to double type
-  return dval;
+  return lval;
 }
 
 // Standard Sparc opcode form2 field breakdown
@@ -2661,8 +2653,7 @@
 
       // Emit stub for static call.
       address stub = CompiledStaticCall::emit_to_interp_stub(cbuf);
-      // Stub does not fit into scratch buffer if TraceJumps is enabled
-      if (stub == NULL && !(TraceJumps && Compile::current()->in_scratch_emit_size())) {
+      if (stub == NULL) {
         ciEnv::current()->record_failure("CodeCache is full");
         return;
       }
diff --git a/hotspot/src/cpu/sparc/vm/templateInterpreterGenerator_sparc.cpp b/hotspot/src/cpu/sparc/vm/templateInterpreterGenerator_sparc.cpp
index 7df0e98..d8973ed 100644
--- a/hotspot/src/cpu/sparc/vm/templateInterpreterGenerator_sparc.cpp
+++ b/hotspot/src/cpu/sparc/vm/templateInterpreterGenerator_sparc.cpp
@@ -1560,13 +1560,7 @@
     __ bind(ok);
   }
 #endif
-  if (TraceJumps) {
-    // Move target to register that is recordable
-    __ mov(Lscratch, G3_scratch);
-    __ JMP(G3_scratch, 0);
-  } else {
-    __ jmp(Lscratch, 0);
-  }
+  __ jmp(Lscratch, 0);
   __ delayed()->nop();
 
 
diff --git a/hotspot/src/cpu/sparc/vm/templateTable_sparc.cpp b/hotspot/src/cpu/sparc/vm/templateTable_sparc.cpp
index 2976383..44bee0c 100644
--- a/hotspot/src/cpu/sparc/vm/templateTable_sparc.cpp
+++ b/hotspot/src/cpu/sparc/vm/templateTable_sparc.cpp
@@ -1636,7 +1636,7 @@
                                                  in_bytes(InvocationCounter::counter_offset()));
         Address mask(G4_scratch, in_bytes(MethodData::backedge_mask_offset()));
         __ increment_mask_and_jump(mdo_backedge_counter, increment, mask, G3_scratch, O0,
-                                   Assembler::notZero, &Lforward);
+                                   (UseOnStackReplacement ? Assembler::notZero : Assembler::always), &Lforward);
         __ ba_short(Loverflow);
       }
 
@@ -1647,7 +1647,7 @@
               in_bytes(InvocationCounter::counter_offset()));
       Address mask(G3_method_counters, in_bytes(MethodCounters::backedge_mask_offset()));
       __ increment_mask_and_jump(backedge_counter, increment, mask, G4_scratch, O0,
-                                 Assembler::notZero, &Lforward);
+                                 (UseOnStackReplacement ? Assembler::notZero : Assembler::always), &Lforward);
       __ bind(Loverflow);
 
       // notify point for loop, pass branch bytecode
diff --git a/hotspot/src/cpu/sparc/vm/vtableStubs_sparc.cpp b/hotspot/src/cpu/sparc/vm/vtableStubs_sparc.cpp
index 4e717ee..9e825aa 100644
--- a/hotspot/src/cpu/sparc/vm/vtableStubs_sparc.cpp
+++ b/hotspot/src/cpu/sparc/vm/vtableStubs_sparc.cpp
@@ -221,7 +221,7 @@
 
 
 int VtableStub::pd_code_size_limit(bool is_vtable_stub) {
-  if (TraceJumps || DebugVtables || CountCompiledCalls || VerifyOops) return 1000;
+  if (DebugVtables || CountCompiledCalls || VerifyOops) return 1000;
   else {
     const int slop = 2*BytesPerInstWord; // sethi;add  (needed for long offsets)
     if (is_vtable_stub) {
diff --git a/hotspot/src/cpu/x86/vm/bytes_x86.hpp b/hotspot/src/cpu/x86/vm/bytes_x86.hpp
index 9f939a3..eb5ab17 100644
--- a/hotspot/src/cpu/x86/vm/bytes_x86.hpp
+++ b/hotspot/src/cpu/x86/vm/bytes_x86.hpp
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1997, 2010, 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
@@ -26,6 +26,7 @@
 #define CPU_X86_VM_BYTES_X86_HPP
 
 #include "memory/allocation.hpp"
+#include "utilities/macros.hpp"
 
 class Bytes: AllStatic {
  private:
@@ -70,20 +71,7 @@
   static inline u8   swap_u8(u8 x);
 };
 
-
 // The following header contains the implementations of swap_u2, swap_u4, and swap_u8[_base]
-#ifdef TARGET_OS_ARCH_linux_x86
-# include "bytes_linux_x86.inline.hpp"
-#endif
-#ifdef TARGET_OS_ARCH_solaris_x86
-# include "bytes_solaris_x86.inline.hpp"
-#endif
-#ifdef TARGET_OS_ARCH_windows_x86
-# include "bytes_windows_x86.inline.hpp"
-#endif
-#ifdef TARGET_OS_ARCH_bsd_x86
-# include "bytes_bsd_x86.inline.hpp"
-#endif
-
+#include OS_CPU_HEADER_INLINE(bytes)
 
 #endif // CPU_X86_VM_BYTES_X86_HPP
diff --git a/hotspot/src/cpu/x86/vm/c1_LIRGenerator_x86.cpp b/hotspot/src/cpu/x86/vm/c1_LIRGenerator_x86.cpp
index 26488c9..43e98a7 100644
--- a/hotspot/src/cpu/x86/vm/c1_LIRGenerator_x86.cpp
+++ b/hotspot/src/cpu/x86/vm/c1_LIRGenerator_x86.cpp
@@ -761,7 +761,6 @@
   } else {
     a = new LIR_Address(obj.result(),
                         offset.result(),
-                        LIR_Address::times_1,
                         0,
                         as_BasicType(type));
   }
@@ -1081,7 +1080,6 @@
 
       LIR_Address* a = new LIR_Address(base_op,
                                        index,
-                                       LIR_Address::times_1,
                                        offset,
                                        T_BYTE);
       BasicTypeList signature(3);
@@ -1157,13 +1155,11 @@
 
   LIR_Address* addr_a = new LIR_Address(result_a,
                                         result_aOffset,
-                                        LIR_Address::times_1,
                                         constant_aOffset,
                                         T_BYTE);
 
   LIR_Address* addr_b = new LIR_Address(result_b,
                                         result_bOffset,
-                                        LIR_Address::times_1,
                                         constant_bOffset,
                                         T_BYTE);
 
diff --git a/hotspot/src/cpu/x86/vm/c1_LIR_x86.cpp b/hotspot/src/cpu/x86/vm/c1_LIR_x86.cpp
new file mode 100644
index 0000000..92277ee
--- /dev/null
+++ b/hotspot/src/cpu/x86/vm/c1_LIR_x86.cpp
@@ -0,0 +1,74 @@
+/*
+ * 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.
+ *
+ */
+
+#include "precompiled.hpp"
+#include "asm/register.hpp"
+#include "c1/c1_FrameMap.hpp"
+#include "c1/c1_LIR.hpp"
+
+
+FloatRegister LIR_OprDesc::as_float_reg() const {
+  ShouldNotReachHere();
+  return fnoreg;
+}
+
+FloatRegister LIR_OprDesc::as_double_reg() const {
+  ShouldNotReachHere();
+  return fnoreg;
+}
+
+XMMRegister LIR_OprDesc::as_xmm_float_reg() const {
+  return FrameMap::nr2xmmreg(xmm_regnr());
+}
+
+XMMRegister LIR_OprDesc::as_xmm_double_reg() const {
+  assert(xmm_regnrLo() == xmm_regnrHi(), "assumed in calculation");
+  return FrameMap::nr2xmmreg(xmm_regnrLo());
+}
+
+// Reg2 unused.
+LIR_Opr LIR_OprFact::double_fpu(int reg1, int reg2) {
+  assert(as_FloatRegister(reg2) == fnoreg, "Not used on this platform");
+  return (LIR_Opr)(intptr_t)((reg1 << LIR_OprDesc::reg1_shift) |
+                             (reg1 << LIR_OprDesc::reg2_shift) |
+                             LIR_OprDesc::double_type          |
+                             LIR_OprDesc::fpu_register         |
+                             LIR_OprDesc::double_size);
+}
+
+#ifndef PRODUCT
+void LIR_Address::verify() const {
+#ifdef _LP64
+  assert(base()->is_cpu_register(), "wrong base operand");
+  assert(index()->is_illegal() || index()->is_double_cpu(), "wrong index operand");
+  assert(base()->type() == T_OBJECT || base()->type() == T_LONG || base()->type() == T_METADATA,
+         "wrong type for addresses");
+#else
+  assert(base()->is_single_cpu(), "wrong base operand");
+  assert(index()->is_illegal() || index()->is_single_cpu(), "wrong index operand");
+  assert(base()->type() == T_OBJECT || base()->type() == T_INT || base()->type() == T_METADATA,
+         "wrong type for addresses");
+#endif
+}
+#endif // PRODUCT
diff --git a/hotspot/src/cpu/x86/vm/copy_x86.hpp b/hotspot/src/cpu/x86/vm/copy_x86.hpp
index d5c6d5e..e07b64e 100644
--- a/hotspot/src/cpu/x86/vm/copy_x86.hpp
+++ b/hotspot/src/cpu/x86/vm/copy_x86.hpp
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2003, 2010, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2003, 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
@@ -28,19 +28,7 @@
 // Inline functions for memory copy and fill.
 
 // Contains inline asm implementations
-#ifdef TARGET_OS_ARCH_linux_x86
-# include "copy_linux_x86.inline.hpp"
-#endif
-#ifdef TARGET_OS_ARCH_solaris_x86
-# include "copy_solaris_x86.inline.hpp"
-#endif
-#ifdef TARGET_OS_ARCH_windows_x86
-# include "copy_windows_x86.inline.hpp"
-#endif
-#ifdef TARGET_OS_ARCH_bsd_x86
-# include "copy_bsd_x86.inline.hpp"
-#endif
-
+#include OS_CPU_HEADER_INLINE(copy)
 
 static void pd_fill_to_words(HeapWord* tohw, size_t count, juint value) {
 #ifdef AMD64
diff --git a/hotspot/src/cpu/x86/vm/globalDefinitions_x86.hpp b/hotspot/src/cpu/x86/vm/globalDefinitions_x86.hpp
index 40f3d2f..681dcc8 100644
--- a/hotspot/src/cpu/x86/vm/globalDefinitions_x86.hpp
+++ b/hotspot/src/cpu/x86/vm/globalDefinitions_x86.hpp
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1999, 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1999, 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
@@ -56,7 +56,7 @@
   #endif
 #endif
 
-#if defined(COMPILER2) && !defined(JAVASE_EMBEDDED)
+#if defined(COMPILER2)
 // Include Restricted Transactional Memory lock eliding optimization
 #define INCLUDE_RTM_OPT 1
 #endif
diff --git a/hotspot/test/compiler/native/libTestDirtyInt.c b/hotspot/src/cpu/x86/vm/macroAssembler_x86.inline.hpp
similarity index 83%
copy from hotspot/test/compiler/native/libTestDirtyInt.c
copy to hotspot/src/cpu/x86/vm/macroAssembler_x86.inline.hpp
index b688a36..d23bdb4 100644
--- a/hotspot/test/compiler/native/libTestDirtyInt.c
+++ b/hotspot/src/cpu/x86/vm/macroAssembler_x86.inline.hpp
@@ -19,15 +19,12 @@
  * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
  * or visit www.oracle.com if you need additional information or have any
  * questions.
+ *
  */
 
-#include "jni.h"
-#include <stdio.h>
+#ifndef CPU_X86_VM_MACROASSEMBLER_X86_INLINE_HPP
+#define CPU_X86_VM_MACROASSEMBLER_X86_INLINE_HPP
 
-static int array = 0x42;
+// Still empty.
 
-JNIEXPORT jint JNICALL Java_TestDirtyInt_test(JNIEnv* env, jclass jclazz, jint v)
-{
-  int* ptr = &array + v + 4;
-  return *ptr;
-}
+#endif // CPU_X86_VM_MACROASSEMBLER_X86_INLINE_HPP
diff --git a/hotspot/src/cpu/x86/vm/macroAssembler_x86_tan.cpp b/hotspot/src/cpu/x86/vm/macroAssembler_x86_tan.cpp
index 18fe151..1097991 100644
--- a/hotspot/src/cpu/x86/vm/macroAssembler_x86_tan.cpp
+++ b/hotspot/src/cpu/x86/vm/macroAssembler_x86_tan.cpp
@@ -1060,7 +1060,7 @@
 
   bind(B1_4);
   addq(rsp, 16);
-
+  pop(rbx);
 }
 #else
 // The 32 bit code is at most SSE2 compliant
diff --git a/hotspot/src/cpu/x86/vm/register_definitions_x86.cpp b/hotspot/src/cpu/x86/vm/register_definitions_x86.cpp
index 6c0ca8e..e63d711 100644
--- a/hotspot/src/cpu/x86/vm/register_definitions_x86.cpp
+++ b/hotspot/src/cpu/x86/vm/register_definitions_x86.cpp
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2002, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2002, 2016, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -26,9 +26,7 @@
 #include "asm/assembler.hpp"
 #include "asm/register.hpp"
 #include "register_x86.hpp"
-#ifdef TARGET_ARCH_x86
-# include "interp_masm_x86.hpp"
-#endif
+#include "interp_masm_x86.hpp"
 
 REGISTER_DEFINITION(Register, noreg);
 REGISTER_DEFINITION(Register, rax);
@@ -50,6 +48,8 @@
 REGISTER_DEFINITION(Register, r15);
 #endif // AMD64
 
+REGISTER_DEFINITION(FloatRegister, fnoreg);
+
 REGISTER_DEFINITION(XMMRegister, xnoreg);
 REGISTER_DEFINITION(XMMRegister, xmm0 );
 REGISTER_DEFINITION(XMMRegister, xmm1 );
diff --git a/hotspot/src/cpu/x86/vm/register_x86.hpp b/hotspot/src/cpu/x86/vm/register_x86.hpp
index 1d1c6ee..f5c4496 100644
--- a/hotspot/src/cpu/x86/vm/register_x86.hpp
+++ b/hotspot/src/cpu/x86/vm/register_x86.hpp
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2000, 2014, 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
@@ -124,6 +124,8 @@
 
 };
 
+CONSTANT_REGISTER_DECLARATION(FloatRegister, fnoreg, (-1));
+
 // Use XMMRegister as shortcut
 class XMMRegisterImpl;
 typedef XMMRegisterImpl* XMMRegister;
diff --git a/hotspot/src/cpu/x86/vm/stubRoutines_x86.hpp b/hotspot/src/cpu/x86/vm/stubRoutines_x86.hpp
index eeceb01..3caac41 100644
--- a/hotspot/src/cpu/x86/vm/stubRoutines_x86.hpp
+++ b/hotspot/src/cpu/x86/vm/stubRoutines_x86.hpp
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2013, 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2013, 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
@@ -29,6 +29,83 @@
 // definition. See stubRoutines.hpp for a description on how to
 // extend it.
 
+static bool returns_to_call_stub(address return_pc) { return return_pc == _call_stub_return_address; }
+
+enum platform_dependent_constants {
+  code_size1 = 20000 LP64_ONLY(+10000),         // simply increase if too small (assembler will crash if too small)
+  code_size2 = 33800 LP64_ONLY(+1200)           // simply increase if too small (assembler will crash if too small)
+};
+
+class x86 {
+ friend class StubGenerator;
+ friend class VMStructs;
+
+#ifdef _LP64
+ private:
+  static address _get_previous_fp_entry;
+  static address _get_previous_sp_entry;
+
+  static address _f2i_fixup;
+  static address _f2l_fixup;
+  static address _d2i_fixup;
+  static address _d2l_fixup;
+
+  static address _float_sign_mask;
+  static address _float_sign_flip;
+  static address _double_sign_mask;
+  static address _double_sign_flip;
+
+ public:
+
+  static address get_previous_fp_entry() {
+    return _get_previous_fp_entry;
+  }
+
+  static address get_previous_sp_entry() {
+    return _get_previous_sp_entry;
+  }
+
+  static address f2i_fixup() {
+    return _f2i_fixup;
+  }
+
+  static address f2l_fixup() {
+    return _f2l_fixup;
+  }
+
+  static address d2i_fixup() {
+    return _d2i_fixup;
+  }
+
+  static address d2l_fixup() {
+    return _d2l_fixup;
+  }
+
+  static address float_sign_mask() {
+    return _float_sign_mask;
+  }
+
+  static address float_sign_flip() {
+    return _float_sign_flip;
+  }
+
+  static address double_sign_mask() {
+    return _double_sign_mask;
+  }
+
+  static address double_sign_flip() {
+    return _double_sign_flip;
+  }
+#else // !LP64
+
+ private:
+  static address _verify_fpu_cntrl_wrd_entry;
+
+ public:
+  static address verify_fpu_cntrl_wrd_entry() { return _verify_fpu_cntrl_wrd_entry; }
+
+#endif // !LP64
+
  private:
   static address _verify_mxcsr_entry;
   // shuffle mask for fixing up 128-bit words consisting of big-endian 32-bit integers
@@ -138,4 +215,6 @@
   static address _Pi4x4_addr()      { return _Pi4x4_adr; }
   static address _ones_addr()      { return _ones_adr; }
 
-#endif // CPU_X86_VM_STUBROUTINES_X86_32_HPP
+};
+
+#endif // CPU_X86_VM_STUBROUTINES_X86_HPP
diff --git a/hotspot/src/cpu/x86/vm/stubRoutines_x86_32.hpp b/hotspot/src/cpu/x86/vm/stubRoutines_x86_32.hpp
deleted file mode 100644
index 17f76e8..0000000
--- a/hotspot/src/cpu/x86/vm/stubRoutines_x86_32.hpp
+++ /dev/null
@@ -1,53 +0,0 @@
-/*
- * Copyright (c) 1997, 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.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- *
- */
-
-#ifndef CPU_X86_VM_STUBROUTINES_X86_32_HPP
-#define CPU_X86_VM_STUBROUTINES_X86_32_HPP
-
-// This file holds the platform specific parts of the StubRoutines
-// definition. See stubRoutines.hpp for a description on how to
-// extend it.
-
-enum platform_dependent_constants {
-  code_size1 =  20000,           // simply increase if too small (assembler will crash if too small)
-  code_size2 = 33800            // simply increase if too small (assembler will crash if too small)
-};
-
-class x86 {
- friend class StubGenerator;
- friend class VMStructs;
-
- private:
-  static address _verify_fpu_cntrl_wrd_entry;
-
- public:
-  static address verify_fpu_cntrl_wrd_entry()                { return _verify_fpu_cntrl_wrd_entry; }
-
-# include "stubRoutines_x86.hpp"
-
-};
-
-  static bool    returns_to_call_stub(address return_pc)     { return return_pc == _call_stub_return_address; }
-
-#endif // CPU_X86_VM_STUBROUTINES_X86_32_HPP
diff --git a/hotspot/src/cpu/x86/vm/stubRoutines_x86_64.hpp b/hotspot/src/cpu/x86/vm/stubRoutines_x86_64.hpp
deleted file mode 100644
index b4750ff..0000000
--- a/hotspot/src/cpu/x86/vm/stubRoutines_x86_64.hpp
+++ /dev/null
@@ -1,112 +0,0 @@
-/*
- * Copyright (c) 2003, 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.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- *
- */
-
-#ifndef CPU_X86_VM_STUBROUTINES_X86_64_HPP
-#define CPU_X86_VM_STUBROUTINES_X86_64_HPP
-
-// This file holds the platform specific parts of the StubRoutines
-// definition. See stubRoutines.hpp for a description on how to
-// extend it.
-
-static bool    returns_to_call_stub(address return_pc)   { return return_pc == _call_stub_return_address; }
-
-enum platform_dependent_constants {
-  code_size1 = 30000,          // simply increase if too small (assembler will crash if too small)
-  code_size2 = 35000           // simply increase if too small (assembler will crash if too small)
-};
-
-class x86 {
- friend class StubGenerator;
-
- private:
-  static address _get_previous_fp_entry;
-  static address _get_previous_sp_entry;
-
-  static address _f2i_fixup;
-  static address _f2l_fixup;
-  static address _d2i_fixup;
-  static address _d2l_fixup;
-
-  static address _float_sign_mask;
-  static address _float_sign_flip;
-  static address _double_sign_mask;
-  static address _double_sign_flip;
-
- public:
-
-  static address get_previous_fp_entry()
-  {
-    return _get_previous_fp_entry;
-  }
-
-  static address get_previous_sp_entry()
-  {
-    return _get_previous_sp_entry;
-  }
-
-  static address f2i_fixup()
-  {
-    return _f2i_fixup;
-  }
-
-  static address f2l_fixup()
-  {
-    return _f2l_fixup;
-  }
-
-  static address d2i_fixup()
-  {
-    return _d2i_fixup;
-  }
-
-  static address d2l_fixup()
-  {
-    return _d2l_fixup;
-  }
-
-  static address float_sign_mask()
-  {
-    return _float_sign_mask;
-  }
-
-  static address float_sign_flip()
-  {
-    return _float_sign_flip;
-  }
-
-  static address double_sign_mask()
-  {
-    return _double_sign_mask;
-  }
-
-  static address double_sign_flip()
-  {
-    return _double_sign_flip;
-  }
-
-# include "stubRoutines_x86.hpp"
-
-};
-
-#endif // CPU_X86_VM_STUBROUTINES_X86_64_HPP
diff --git a/hotspot/src/cpu/x86/vm/x86.ad b/hotspot/src/cpu/x86/vm/x86.ad
index 17abe70..b12c979 100644
--- a/hotspot/src/cpu/x86/vm/x86.ad
+++ b/hotspot/src/cpu/x86/vm/x86.ad
@@ -2131,7 +2131,7 @@
   return size+offset_size;
 }
 
-static inline jfloat replicate4_imm(int con, int width) {
+static inline jint replicate4_imm(int con, int width) {
   // Load a constant of "width" (in bytes) and replicate it to fill 32bit.
   assert(width == 1 || width == 2, "only byte or short types here");
   int bit_width = width * 8;
@@ -2141,11 +2141,10 @@
     val |= (val << bit_width);
     bit_width <<= 1;
   }
-  jfloat fval = *((jfloat*) &val);  // coerce to float type
-  return fval;
+  return val;
 }
 
-static inline jdouble replicate8_imm(int con, int width) {
+static inline jlong replicate8_imm(int con, int width) {
   // Load a constant of "width" (in bytes) and replicate it to fill 64bit.
   assert(width == 1 || width == 2 || width == 4, "only byte, short or int types here");
   int bit_width = width * 8;
@@ -2155,8 +2154,7 @@
     val |= (val << bit_width);
     bit_width <<= 1;
   }
-  jdouble dval = *((jdouble*) &val);  // coerce to double type
-  return dval;
+  return val;
 }
 
 #ifndef PRODUCT
diff --git a/hotspot/src/cpu/zero/vm/bytes_zero.hpp b/hotspot/src/cpu/zero/vm/bytes_zero.hpp
index be2e09a..186f09d 100644
--- a/hotspot/src/cpu/zero/vm/bytes_zero.hpp
+++ b/hotspot/src/cpu/zero/vm/bytes_zero.hpp
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1997, 2010, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1997, 2016, Oracle and/or its affiliates. All rights reserved.
  * Copyright 2007, 2008, 2009 Red Hat, Inc.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
@@ -165,12 +165,8 @@
 #ifdef VM_LITTLE_ENDIAN
 // The following header contains the implementations of swap_u2,
 // swap_u4, and swap_u8
-#ifdef TARGET_OS_ARCH_linux_zero
-# include "bytes_linux_zero.inline.hpp"
-#endif
-#ifdef TARGET_OS_ARCH_bsd_zero
-# include "bytes_bsd_zero.inline.hpp"
-#endif
+
+#include OS_CPU_HEADER_INLINE(bytes)
 
 #endif // VM_LITTLE_ENDIAN
 
diff --git a/hotspot/test/compiler/native/libTestDirtyInt.c b/hotspot/src/cpu/zero/vm/macroAssembler_zero.hpp
similarity index 83%
copy from hotspot/test/compiler/native/libTestDirtyInt.c
copy to hotspot/src/cpu/zero/vm/macroAssembler_zero.hpp
index b688a36..3477989 100644
--- a/hotspot/test/compiler/native/libTestDirtyInt.c
+++ b/hotspot/src/cpu/zero/vm/macroAssembler_zero.hpp
@@ -19,15 +19,12 @@
  * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
  * or visit www.oracle.com if you need additional information or have any
  * questions.
+ *
  */
 
-#include "jni.h"
-#include <stdio.h>
+#ifndef CPU_ZERO_VM_MACROASSEMBLER_ZERO_HPP
+#define CPU_ZERO_VM_MACROASSEMBLER_ZERO_HPP
 
-static int array = 0x42;
+// Needed for includes in shared files.
 
-JNIEXPORT jint JNICALL Java_TestDirtyInt_test(JNIEnv* env, jclass jclazz, jint v)
-{
-  int* ptr = &array + v + 4;
-  return *ptr;
-}
+#endif // CPU_ZERO_VM_MACROASSEMBLER_ZERO_HPP
diff --git a/hotspot/test/compiler/native/libTestDirtyInt.c b/hotspot/src/cpu/zero/vm/macroAssembler_zero.inline.hpp
similarity index 83%
copy from hotspot/test/compiler/native/libTestDirtyInt.c
copy to hotspot/src/cpu/zero/vm/macroAssembler_zero.inline.hpp
index b688a36..47ce5e5 100644
--- a/hotspot/test/compiler/native/libTestDirtyInt.c
+++ b/hotspot/src/cpu/zero/vm/macroAssembler_zero.inline.hpp
@@ -19,15 +19,12 @@
  * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
  * or visit www.oracle.com if you need additional information or have any
  * questions.
+ *
  */
 
-#include "jni.h"
-#include <stdio.h>
+#ifndef CPU_ZERO_VM_MACROASSEMBLER_ZERO_INLINE_HPP
+#define CPU_ZERO_VM_MACROASSEMBLER_ZERO_INLINE_HPP
 
-static int array = 0x42;
+// Needed for includes in shared files.
 
-JNIEXPORT jint JNICALL Java_TestDirtyInt_test(JNIEnv* env, jclass jclazz, jint v)
-{
-  int* ptr = &array + v + 4;
-  return *ptr;
-}
+#endif // CPU_ZERO_VM_MACROASSEMBLER_ZERO_INLINE_HPP
diff --git a/hotspot/src/jdk.hotspot.agent/doc/ReadMe-JavaScript.text b/hotspot/src/jdk.hotspot.agent/doc/ReadMe-JavaScript.text
deleted file mode 100644
index 432aaa4..0000000
--- a/hotspot/src/jdk.hotspot.agent/doc/ReadMe-JavaScript.text
+++ /dev/null
@@ -1,38 +0,0 @@
-The HotSpot Serviceability Agent (SA) is a debugger for hotspot core
-dumps and hung processes. There is a read-only JDI (Java Debugger
-Interface) implementation on top of SA. This is part of JDK product and
-the classes are in $JDK/tools/sa-jdi.jar.
-
-In addition, there are few serviceability tools in $JDK/bin, namely,
-jstack (java stack trace tool), jmap (heap tool), jinfo (Java config
-tool) and jsadebugd. The classes for these are also in sa-jdi.jar
-file. sa-jdi.jar file is built along with hotspot (libjvm.so) on Solaris
-and Linux platforms. On Windows platform, SA-JDI is not included and
-serviceability tools do not use SA.
-
-Apart from these, HotSpot SA consists of a number of tools that are
-*not* included in JDK product bits.
-
-The sources and makefile for all-of-SA (including non-productized stuff)
-are under $HOTSPOT_WS/agent directory. The makefile $HOTSPOT/agent/make
-directory and shell scripts (and batch files) are used to build and run
-SA non-product tools. There is also documentation of SA under
-$HOTSPOT/agent/doc directory.
-
-To build complete SA, you need to have Rhino Mozilla jar (js.jar)
-version 1.5R5 under $HOTSPOT/agent/src/share/lib directory. Rhino is
-JavaScript interpreter written in Java. Rhino is used to implement SA
-features such as
-
-* SA command line debugger's JavaScript interface
- - refer to $HOTSPOT/agent/doc/clhsdb.html
- - refer to $HOTSPOT/agent/doc/jsdb.html
-* SA simple object query language (SOQL) 
- - language to query Java heap. 
-
-Rhino's "js.jar" is not included in hotspot source bundles. You need to
-download it from http://www.mozilla.org/rhino/download.html.
- 
-Without js.jar, $HOTSPOT/agent/make/Makefile will fail to build. But,
-note that sa-jdi.jar containing the productized portions of SA will
-still be built when you build hotspot JVM. 
diff --git a/hotspot/src/jdk.hotspot.agent/share/classes/module-info.java b/hotspot/src/jdk.hotspot.agent/share/classes/module-info.java
index 65b804d..dbf9587 100644
--- a/hotspot/src/jdk.hotspot.agent/share/classes/module-info.java
+++ b/hotspot/src/jdk.hotspot.agent/share/classes/module-info.java
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2014, 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2014, 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
@@ -28,12 +28,8 @@
     requires java.desktop;
     requires java.rmi;
     requires java.scripting;
-    requires jdk.jdi;
 
     // RMI needs to serialize types in this package
     exports sun.jvm.hotspot.debugger.remote to java.rmi;
-    provides com.sun.jdi.connect.Connector with sun.jvm.hotspot.jdi.SACoreAttachingConnector;
-    provides com.sun.jdi.connect.Connector with sun.jvm.hotspot.jdi.SADebugServerAttachingConnector;
-    provides com.sun.jdi.connect.Connector with sun.jvm.hotspot.jdi.SAPIDAttachingConnector;
 
 }
diff --git a/hotspot/src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/SALauncher.java b/hotspot/src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/SALauncher.java
index 83c8605..8513c10 100644
--- a/hotspot/src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/SALauncher.java
+++ b/hotspot/src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/SALauncher.java
@@ -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
@@ -36,6 +36,7 @@
 
     private static boolean launcherHelp() {
         System.out.println("    clhsdb       \tcommand line debugger");
+        System.out.println("    debugd       \tdebug server");
         System.out.println("    hsdb         \tui debugger");
         System.out.println("    jstack --help\tto get more information");
         System.out.println("    jmap   --help\tto get more information");
@@ -54,6 +55,21 @@
         return false;
     }
 
+    private static boolean debugdHelp() {
+        // [options] <pid> [server-id]
+        // [options] <executable> <core> [server-id]
+        java.io.PrintStream out = System.out;
+        out.print(" [option] <pid> [server-id]");
+        out.println("\t\t(to connect to a live java process)");
+        out.print("   or  [option] <executable> <core> [server-id]");
+        out.println("\t\t(to connect to a core file produced by <executable>)");
+        out.print("\t\tserver-id is an optional unique id for this debug server, needed ");
+        out.println("\t\tif multiple debug servers are run on the same machine");
+        out.println("where option includes:");
+        out.println("   -h | -help\tto print this help message");
+        return false;
+    }
+
     private static boolean jinfoHelp() {
         // --flags -> -flags
         // --sysprops -> -sysprops
@@ -106,6 +122,9 @@
         if (toolName.equals("jsnap")) {
             return jsnapHelp();
         }
+        if (toolName.equals("debugd")) {
+            return debugdHelp();
+        }
         if (toolName.equals("hsdb") || toolName.equals("clhsdb")) {
             return commonHelp();
         }
@@ -377,13 +396,28 @@
         JSnap.main(newArgs.toArray(new String[newArgs.size()]));
     }
 
+    private static void runDEBUGD(String[] oldArgs) {
+        if ((oldArgs.length < 1) || (oldArgs.length > 3)) {
+            debugdHelp();
+        }
+
+        // By default SA agent classes prefer Windows process debugger
+        // to windbg debugger. SA expects special properties to be set
+        // to choose other debuggers. We will set those here before
+        // attaching to SA agent.
+        System.setProperty("sun.jvm.hotspot.debugger.useWindbgDebugger", "true");
+
+        // delegate to the actual SA debug server.
+        sun.jvm.hotspot.DebugServer.main(oldArgs);
+    }
+
     public static void main(String[] args) {
         // Provide a help
         if (args.length == 0) {
             launcherHelp();
             return;
         }
-        // No arguments imply help for jstack, jmap, jinfo but launch clhsdb and hsdb
+        // No arguments imply help for debugd, jstack, jmap, jinfo but launch clhsdb and hsdb
         if (args.length == 1 && !args[0].equals("clhsdb") && !args[0].equals("hsdb")) {
             toolHelp(args[0]);
             return;
@@ -431,6 +465,11 @@
                 return;
             }
 
+            if (args[0].equals("debugd")) {
+                runDEBUGD(oldArgs);
+                return;
+            }
+
             throw new SAGetoptException("Unknown tool: " + args[0]);
         } catch (SAGetoptException e) {
             System.err.println(e.getMessage());
diff --git a/hotspot/src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/jdi/ArrayReferenceImpl.java b/hotspot/src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/jdi/ArrayReferenceImpl.java
deleted file mode 100644
index a3a46e9..0000000
--- a/hotspot/src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/jdi/ArrayReferenceImpl.java
+++ /dev/null
@@ -1,171 +0,0 @@
-/*
- * Copyright (c) 2002, 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.
- *
- * 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.jvm.hotspot.jdi;
-
-import com.sun.jdi.*;
-
-import java.util.List;
-import java.util.ArrayList;
-import java.util.Iterator;
-
-import sun.jvm.hotspot.oops.Instance;
-import sun.jvm.hotspot.oops.Array;
-import sun.jvm.hotspot.runtime.BasicType;
-import sun.jvm.hotspot.utilities.Assert;
-
-public class ArrayReferenceImpl extends ObjectReferenceImpl
-    implements ArrayReference
-{
-    private int length;
-    ArrayReferenceImpl(VirtualMachine aVm, sun.jvm.hotspot.oops.Array aRef) {
-        super(aVm, aRef);
-        length = (int) aRef.getLength();
-    }
-
-    ArrayTypeImpl arrayType() {
-        return (ArrayTypeImpl)type();
-    }
-
-    /**
-     * Return array length.
-     */
-    public int length() {
-        return length;
-    }
-
-    public Value getValue(int index) {
-        List list = getValues(index, 1);
-        return (Value)list.get(0);
-    }
-
-    public List getValues() {
-        return getValues(0, -1);
-    }
-
-    /**
-     * Validate that the range to set/get is valid.
-     * length of -1 (meaning rest of array) has been converted
-     * before entry.
-     */
-    private void validateArrayAccess(int index, int len) {
-        // because length can be computed from index,
-        // index must be tested first for correct error message
-        if ((index < 0) || (index > length())) {
-            throw new IndexOutOfBoundsException(
-                        "Invalid array index: " + index);
-        }
-        if (len < 0) {
-            throw new IndexOutOfBoundsException(
-                        "Invalid array range length: " + len);
-        }
-        if (index + len > length()) {
-            throw new IndexOutOfBoundsException(
-                        "Invalid array range: " +
-                        index + " to " + (index + len - 1));
-        }
-    }
-
-    public List getValues(int index, int len) {
-        if (len == -1) { // -1 means the rest of the array
-           len = length() - index;
-        }
-        validateArrayAccess(index, len);
-        List vals = new ArrayList();
-        if (len == 0) {
-            return vals;
-        }
-
-        sun.jvm.hotspot.oops.TypeArray typeArray = null;
-        sun.jvm.hotspot.oops.ObjArray objArray = null;
-        if (ref() instanceof sun.jvm.hotspot.oops.TypeArray) {
-            typeArray = (sun.jvm.hotspot.oops.TypeArray)ref();
-        } else if (ref() instanceof sun.jvm.hotspot.oops.ObjArray) {
-            objArray = (sun.jvm.hotspot.oops.ObjArray)ref();
-        } else {
-            throw new RuntimeException("should not reach here");
-        }
-
-        char c = arrayType().componentSignature().charAt(0);
-        BasicType variableType = BasicType.charToBasicType(c);
-
-        final int limit = index + len;
-        for (int ii = index; ii < limit; ii++) {
-            ValueImpl valueImpl;
-            if (variableType == BasicType.T_BOOLEAN) {
-                valueImpl = (BooleanValueImpl) vm.mirrorOf(typeArray.getBooleanAt(ii));
-            } else if (variableType == BasicType.T_CHAR) {
-                valueImpl = (CharValueImpl) vm.mirrorOf(typeArray.getCharAt(ii));
-            } else if (variableType == BasicType.T_FLOAT) {
-                valueImpl = (FloatValueImpl) vm.mirrorOf(typeArray.getFloatAt(ii));
-            } else if (variableType == BasicType.T_DOUBLE) {
-                valueImpl =  (DoubleValueImpl) vm.mirrorOf(typeArray.getDoubleAt(ii));
-            } else if (variableType == BasicType.T_BYTE) {
-                valueImpl =  (ByteValueImpl) vm.mirrorOf(typeArray.getByteAt(ii));
-            } else if (variableType == BasicType.T_SHORT) {
-                valueImpl =  (ShortValueImpl) vm.mirrorOf(typeArray.getShortAt(ii));
-            } else if (variableType == BasicType.T_INT) {
-                valueImpl =  (IntegerValueImpl) vm.mirrorOf(typeArray.getIntAt(ii));
-            } else if (variableType == BasicType.T_LONG) {
-                valueImpl =  (LongValueImpl) vm.mirrorOf(typeArray.getLongAt(ii));
-            } else if (variableType == BasicType.T_OBJECT) {
-                // we may have an [Ljava/lang/Object; - i.e., Object[] with the
-                // elements themselves may be arrays because every array is an Object.
-                valueImpl = (ObjectReferenceImpl) vm.objectMirror(objArray.getObjAt(ii));
-            } else if (variableType == BasicType.T_ARRAY) {
-                valueImpl = (ArrayReferenceImpl) vm.arrayMirror((Array) objArray.getObjAt(ii));
-            } else {
-                throw new RuntimeException("should not reach here");
-            }
-            vals.add (valueImpl);
-        }
-        return vals;
-    }
-
-    public void setValue(int index, Value value)
-            throws InvalidTypeException,
-                   ClassNotLoadedException {
-        vm.throwNotReadOnlyException("ArrayReference.setValue(...)");
-    }
-
-    public void setValues(List values)
-            throws InvalidTypeException,
-                   ClassNotLoadedException {
-        setValues(0, values, 0, -1);
-    }
-
-    public void setValues(int index, List values,
-                          int srcIndex, int length)
-            throws InvalidTypeException,
-                   ClassNotLoadedException {
-
-        vm.throwNotReadOnlyException("ArrayReference.setValue(...)");
-
-    }
-
-    public String toString() {
-        return "instance of " + arrayType().componentTypeName() +
-               "[" + length() + "] (id=" + uniqueID() + ")";
-    }
-}
diff --git a/hotspot/src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/jdi/ArrayTypeImpl.java b/hotspot/src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/jdi/ArrayTypeImpl.java
deleted file mode 100644
index 102cc79..0000000
--- a/hotspot/src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/jdi/ArrayTypeImpl.java
+++ /dev/null
@@ -1,222 +0,0 @@
-/*
- * Copyright (c) 2002, 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.
- *
- * 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.jvm.hotspot.jdi;
-
-import java.util.ArrayList;
-import java.util.List;
-import java.util.Map;
-import java.util.Set;
-
-import sun.jvm.hotspot.oops.ArrayKlass;
-import sun.jvm.hotspot.oops.Instance;
-import sun.jvm.hotspot.oops.InstanceKlass;
-import sun.jvm.hotspot.oops.Klass;
-import sun.jvm.hotspot.oops.ObjArrayKlass;
-import sun.jvm.hotspot.oops.Symbol;
-import sun.jvm.hotspot.oops.TypeArrayKlass;
-
-import com.sun.jdi.ArrayReference;
-import com.sun.jdi.ArrayType;
-import com.sun.jdi.ClassLoaderReference;
-import com.sun.jdi.ClassNotLoadedException;
-import com.sun.jdi.InterfaceType;
-import com.sun.jdi.Method;
-import com.sun.jdi.PrimitiveType;
-import com.sun.jdi.ReferenceType;
-import com.sun.jdi.Type;
-import com.sun.jdi.VirtualMachine;
-
-public class ArrayTypeImpl extends ReferenceTypeImpl implements ArrayType {
-  protected ArrayTypeImpl(VirtualMachine aVm, ArrayKlass aRef) {
-        super(aVm, aRef);
-    }
-
-    public ArrayReference newInstance(int length) {
-        vm.throwNotReadOnlyException("ArrayType.newInstance(int)");
-        return null;
-    }
-
-    public String componentSignature() {
-        return signature().substring(1); // Just skip the leading '['
-    }
-
-    public String componentTypeName() {
-        JNITypeParser parser = new JNITypeParser(componentSignature());
-        return parser.typeName();
-    }
-
-    public ClassLoaderReference classLoader() {
-        if (ref() instanceof TypeArrayKlass) {
-            // primitive array klasses are loaded by bootstrap loader
-            return null;
-        } else {
-            Klass bottomKlass = ((ObjArrayKlass)ref()).getBottomKlass();
-            if (bottomKlass instanceof TypeArrayKlass) {
-                // multidimensional primitive array klasses are loaded by bootstrap loader
-                return null;
-            } else {
-                // class loader of any other obj array klass is same as the loader
-                // that loaded the bottom InstanceKlass
-                Instance xx = (Instance)(((InstanceKlass) bottomKlass).getClassLoader());
-                return vm.classLoaderMirror(xx);
-            }
-        }
-    }
-
-    @Override
-    void addVisibleMethods(Map<String, Method> methodMap, Set<InterfaceType> handledInterfaces) {
-        // arrays don't have methods
-    }
-
-    List getAllMethods() {
-        // arrays don't have methods
-        // JLS says arrays have methods of java.lang.Object. But
-        // JVMDI-JDI returns zero size list. We do the same here
-        // for consistency.
-        return new ArrayList(0);
-    }
-
-    /*
-     * Find the type object, if any, of a component type of this array.
-     * The component type does not have to be immediate; e.g. this method
-     * can be used to find the component Foo of Foo[][].
-     */
-    public Type componentType() throws ClassNotLoadedException {
-        ArrayKlass k = (ArrayKlass) ref();
-        if (k instanceof ObjArrayKlass) {
-            Klass elementKlass = ((ObjArrayKlass)k).getElementKlass();
-            if (elementKlass == null) {
-                throw new ClassNotLoadedException(componentSignature());
-            } else {
-                return vm.referenceType(elementKlass);
-            }
-        } else {
-            // It's a primitive type
-            return vm.primitiveTypeMirror(signature().charAt(1));
-        }
-    }
-
-    static boolean isComponentAssignable(Type destination, Type source) {
-        if (source instanceof PrimitiveType) {
-            // Assignment of primitive arrays requires identical
-            // component types.
-            return source.equals(destination);
-        } else {
-           if (destination instanceof PrimitiveType) {
-                return false;
-            }
-
-            ReferenceTypeImpl refSource = (ReferenceTypeImpl)source;
-            ReferenceTypeImpl refDestination = (ReferenceTypeImpl)destination;
-            // Assignment of object arrays requires availability
-            // of widening conversion of component types
-            return refSource.isAssignableTo(refDestination);
-        }
-    }
-
-
-    /*
-    * Return true if an instance of the  given reference type
-    * can be assigned to a variable of this type
-    */
-    boolean isAssignableTo(ReferenceType destType) {
-        if (destType instanceof ArrayType) {
-            try {
-                Type destComponentType = ((ArrayType)destType).componentType();
-                return isComponentAssignable(destComponentType, componentType());
-            } catch (ClassNotLoadedException e) {
-                // One or both component types has not yet been
-                // loaded => can't assign
-                return false;
-            }
-        } else {
-            Symbol typeName = ((ReferenceTypeImpl)destType).typeNameAsSymbol();
-            if (destType instanceof InterfaceType) {
-                // Every array type implements java.io.Serializable and
-                // java.lang.Cloneable. fixme in JVMDI-JDI, includes only
-                // Cloneable but not Serializable.
-                return typeName.equals(vm.javaLangCloneable()) ||
-                       typeName.equals(vm.javaIoSerializable());
-            } else {
-                // Only valid ClassType assignee is Object
-                return typeName.equals(vm.javaLangObject());
-            }
-        }
-    }
-
-    List inheritedTypes() {
-        // arrays are derived from java.lang.Object and
-        // B[] is derived from A[] if B is derived from A.
-        // But JVMDI-JDI returns zero sized list and we do the
-        // same for consistency.
-        return new ArrayList(0);
-    }
-
-    int getModifiers() {
-        /*
-         * For object arrays, the return values for Interface
-         * Accessible.isPrivate(), Accessible.isProtected(),
-         * etc... are the same as would be returned for the
-         * component type.  Fetch the modifier bits from the
-         * component type and use those.
-         *
-         * For primitive arrays, the modifiers are always
-         *   VMModifiers.FINAL | VMModifiers.PUBLIC
-         *
-         * Reference com.sun.jdi.Accessible.java.
-         */
-        try {
-            Type t = componentType();
-            if (t instanceof PrimitiveType) {
-                return VMModifiers.FINAL | VMModifiers.PUBLIC;
-            } else {
-                ReferenceType rt = (ReferenceType)t;
-                return rt.modifiers();
-            }
-        } catch (ClassNotLoadedException cnle) {
-            cnle.printStackTrace();
-        }
-        return -1;
-    }
-
-    public String toString() {
-       return "array class " + name() + " (" + loaderString() + ")";
-    }
-
-    /*
-     * Save a pointless trip over the wire for these methods
-     * which have undefined results for arrays.
-     */
-    public boolean isPrepared() { return true; }
-    public boolean isVerified() { return true; }
-    public boolean isInitialized() { return true; }
-    public boolean failedToInitialize() { return false; }
-    public boolean isAbstract() { return false; }
-
-    /*
-     * Defined always to be true for arrays
-     */
-    public boolean isFinal() { return true; }
-}
diff --git a/hotspot/src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/jdi/BaseLineInfo.java b/hotspot/src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/jdi/BaseLineInfo.java
deleted file mode 100644
index a7834a9e..0000000
--- a/hotspot/src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/jdi/BaseLineInfo.java
+++ /dev/null
@@ -1,56 +0,0 @@
-/*
- * Copyright (c) 2002, 2003, 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 sun.jvm.hotspot.jdi;
-
-import com.sun.jdi.*;
-
-class BaseLineInfo implements LineInfo {
-    private final int lineNumber;
-    private final ReferenceTypeImpl declaringType;
-
-    BaseLineInfo(int lineNumber,
-                 ReferenceTypeImpl declaringType) {
-        this.lineNumber = lineNumber;
-        this.declaringType = declaringType;
-    }
-
-    public String liStratum() {
-        return SDE.BASE_STRATUM_NAME;
-    }
-
-    public int liLineNumber() {
-        return lineNumber;
-    }
-
-    public String liSourceName()
-                            throws AbsentInformationException {
-        return declaringType.baseSourceName();
-    }
-
-    public String liSourcePath()
-                            throws AbsentInformationException {
-        return declaringType.baseSourcePath();
-    }
-}
diff --git a/hotspot/src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/jdi/BooleanTypeImpl.java b/hotspot/src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/jdi/BooleanTypeImpl.java
deleted file mode 100644
index 1ea8bda..0000000
--- a/hotspot/src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/jdi/BooleanTypeImpl.java
+++ /dev/null
@@ -1,41 +0,0 @@
-/*
- * Copyright (c) 2002, 2003, 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 sun.jvm.hotspot.jdi;
-
-import com.sun.jdi.*;
-
-public class BooleanTypeImpl extends PrimitiveTypeImpl implements BooleanType {
-    BooleanTypeImpl(VirtualMachine vm) {
-        super(vm);
-    }
-
-    public String signature() {
-        return "Z";
-    }
-
-    PrimitiveValue convert(PrimitiveValue value) throws InvalidTypeException {
-        return vm.mirrorOf(((PrimitiveValueImpl)value).checkedBooleanValue());
-    }
-}
diff --git a/hotspot/src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/jdi/BooleanValueImpl.java b/hotspot/src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/jdi/BooleanValueImpl.java
deleted file mode 100644
index d61b5e7..0000000
--- a/hotspot/src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/jdi/BooleanValueImpl.java
+++ /dev/null
@@ -1,98 +0,0 @@
-/*
- * Copyright (c) 2002, 2003, 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 sun.jvm.hotspot.jdi;
-
-import com.sun.jdi.*;
-
-public class BooleanValueImpl extends PrimitiveValueImpl
-                              implements BooleanValue {
-    private boolean value;
-
-    BooleanValueImpl(VirtualMachine aVm,boolean aValue) {
-        super(aVm);
-
-        value = aValue;
-    }
-
-    public boolean equals(Object obj) {
-        if ((obj != null) && (obj instanceof BooleanValue)) {
-            return (value == ((BooleanValue)obj).value())
-                   && super.equals(obj);
-        } else {
-            return false;
-        }
-    }
-
-    public int hashCode() {
-        /*
-         * TO DO: Better hash code
-         */
-        return intValue();
-    }
-
-    public Type type() {
-        return vm.theBooleanType();
-    }
-
-    public boolean value() {
-        return value;
-    }
-
-    public boolean booleanValue() {
-        return value;
-    }
-
-    public byte byteValue() {
-        return(byte)((value)?1:0);
-    }
-
-    public char charValue() {
-        return(char)((value)?1:0);
-    }
-
-    public short shortValue() {
-        return(short)((value)?1:0);
-    }
-
-    public int intValue() {
-        return(int)((value)?1:0);
-    }
-
-    public long longValue() {
-        return(long)((value)?1:0);
-    }
-
-    public float floatValue() {
-        return(float)((value)?1.0:0.0);
-    }
-
-    public double doubleValue() {
-        return(double)((value)?1.0:0.0);
-    }
-
-    public String toString() {
-        return "" + value;
-    }
-}
diff --git a/hotspot/src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/jdi/ByteTypeImpl.java b/hotspot/src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/jdi/ByteTypeImpl.java
deleted file mode 100644
index 6ac45f3..0000000
--- a/hotspot/src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/jdi/ByteTypeImpl.java
+++ /dev/null
@@ -1,42 +0,0 @@
-/*
- * Copyright (c) 2002, 2003, 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 sun.jvm.hotspot.jdi;
-
-import com.sun.jdi.*;
-
-public class ByteTypeImpl extends PrimitiveTypeImpl implements ByteType {
-    ByteTypeImpl(VirtualMachine vm) {
-        super(vm);
-    }
-
-
-    public String signature() {
-        return "B";
-    }
-
-    PrimitiveValue convert(PrimitiveValue value) throws InvalidTypeException {
-        return vm.mirrorOf(((PrimitiveValueImpl)value).checkedByteValue());
-    }
-}
diff --git a/hotspot/src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/jdi/ByteValueImpl.java b/hotspot/src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/jdi/ByteValueImpl.java
deleted file mode 100644
index e34933e..0000000
--- a/hotspot/src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/jdi/ByteValueImpl.java
+++ /dev/null
@@ -1,110 +0,0 @@
-/*
- * Copyright (c) 2002, 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.
- *
- * 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.jvm.hotspot.jdi;
-
-import com.sun.jdi.*;
-
-public class ByteValueImpl extends PrimitiveValueImpl
-                           implements ByteValue {
-    private byte value;
-
-    ByteValueImpl(VirtualMachine aVm,byte aValue) {
-        super(aVm);
-
-        value = aValue;
-    }
-
-    public boolean equals(Object obj) {
-        if ((obj != null) && (obj instanceof ByteValue)) {
-            return (value == ((ByteValue)obj).value())
-                   && super.equals(obj);
-        } else {
-            return false;
-        }
-    }
-
-    public int hashCode() {
-        /*
-         * TO DO: Better hash code
-         */
-        return intValue();
-    }
-
-    public int compareTo(ByteValue byteVal) {
-        return value() - byteVal.value();
-    }
-
-    public Type type() {
-        return vm.theByteType();
-    }
-
-    public byte value() {
-        return value;
-    }
-
-    public boolean booleanValue() {
-        return(value == 0)?false:true;
-    }
-
-    public byte byteValue() {
-        return value;
-    }
-
-    public char charValue() {
-        return(char)value;
-    }
-
-    public short shortValue() {
-        return(short)value;
-    }
-
-    public int intValue() {
-        return(int)value;
-    }
-
-    public long longValue() {
-        return(long)value;
-    }
-
-    public float floatValue() {
-        return(float)value;
-    }
-
-    public double doubleValue() {
-        return(double)value;
-    }
-
-    char checkedCharValue() throws InvalidTypeException {
-        if ((value > Character.MAX_VALUE) || (value < Character.MIN_VALUE)) {
-            throw new InvalidTypeException("Can't convert " + value + " to char");
-        } else {
-            return super.checkedCharValue();
-        }
-    }
-
-    public String toString() {
-        return "" + value;
-    }
-}
diff --git a/hotspot/src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/jdi/CharTypeImpl.java b/hotspot/src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/jdi/CharTypeImpl.java
deleted file mode 100644
index aa86a06..0000000
--- a/hotspot/src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/jdi/CharTypeImpl.java
+++ /dev/null
@@ -1,43 +0,0 @@
-/*
- * Copyright (c) 2002, 2003, 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 sun.jvm.hotspot.jdi;
-
-import com.sun.jdi.*;
-
-public class CharTypeImpl extends PrimitiveTypeImpl implements CharType {
-    CharTypeImpl(VirtualMachine vm) {
-        super(vm);
-    }
-
-
-    public String signature() {
-        return "C";
-    }
-
-    PrimitiveValue convert(PrimitiveValue value) throws InvalidTypeException {
-        return vm.mirrorOf(((PrimitiveValueImpl)value).checkedCharValue());
-    }
-
-}
diff --git a/hotspot/src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/jdi/CharValueImpl.java b/hotspot/src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/jdi/CharValueImpl.java
deleted file mode 100644
index 588b63f..0000000
--- a/hotspot/src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/jdi/CharValueImpl.java
+++ /dev/null
@@ -1,120 +0,0 @@
-/*
- * Copyright (c) 2002, 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.
- *
- * 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.jvm.hotspot.jdi;
-
-import com.sun.jdi.*;
-
-public class CharValueImpl extends PrimitiveValueImpl
-                           implements CharValue {
-    private char value;
-
-    CharValueImpl(VirtualMachine aVm,char aValue) {
-        super(aVm);
-
-        value = aValue;
-    }
-
-    public boolean equals(Object obj) {
-        if ((obj != null) && (obj instanceof CharValue)) {
-            return (value == ((CharValue)obj).value()) &&
-                   super.equals(obj);
-        } else {
-            return false;
-        }
-    }
-
-    public int hashCode() {
-        /*
-         * TO DO: Better hash code
-         */
-        return intValue();
-    }
-
-    public int compareTo(CharValue charVal) {
-        return value() - charVal.value();
-    }
-
-    public Type type() {
-        return vm.theCharType();
-    }
-
-    public char value() {
-        return value;
-    }
-
-    public boolean booleanValue() {
-        return(value == 0)?false:true;
-    }
-
-    public byte byteValue() {
-        return(byte)value;
-    }
-
-    public char charValue() {
-        return(char)value;
-    }
-
-    public short shortValue() {
-        return(short)value;
-    }
-
-    public int intValue() {
-        return(int)value;
-    }
-
-    public long longValue() {
-        return(long)value;
-    }
-
-    public float floatValue() {
-        return(float)value;
-    }
-
-    public double doubleValue() {
-        return(double)value;
-    }
-
-    public String toString() {
-        return "" + value;
-    }
-
-    byte checkedByteValue() throws InvalidTypeException {
-        // Note: since char is unsigned, don't check against MIN_VALUE
-        if (value > Byte.MAX_VALUE) {
-            throw new InvalidTypeException("Can't convert " + value + " to byte");
-        } else {
-            return super.checkedByteValue();
-        }
-    }
-
-    short checkedShortValue() throws InvalidTypeException {
-        // Note: since char is unsigned, don't check against MIN_VALUE
-        if (value > Short.MAX_VALUE) {
-            throw new InvalidTypeException("Can't convert " + value + " to short");
-        } else {
-            return super.checkedShortValue();
-        }
-    }
-}
diff --git a/hotspot/src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/jdi/ClassLoaderReferenceImpl.java b/hotspot/src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/jdi/ClassLoaderReferenceImpl.java
deleted file mode 100644
index ff9627a..0000000
--- a/hotspot/src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/jdi/ClassLoaderReferenceImpl.java
+++ /dev/null
@@ -1,134 +0,0 @@
-/*
- * Copyright (c) 2002, 2003, 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 sun.jvm.hotspot.jdi;
-
-import sun.jvm.hotspot.oops.Oop;
-import sun.jvm.hotspot.oops.Instance;
-import sun.jvm.hotspot.oops.Klass;
-import sun.jvm.hotspot.memory.SystemDictionary;
-import sun.jvm.hotspot.memory.Universe;
-import sun.jvm.hotspot.runtime.VM;
-
-import com.sun.jdi.*;
-import java.util.*;
-
-public class ClassLoaderReferenceImpl
-    extends ObjectReferenceImpl
-    implements ClassLoaderReference
-{
-     // because we work on process snapshot or core we can
-     // cache visibleClasses & definedClasses always (i.e., no suspension)
-     private List visibleClassesCache;
-     private List definedClassesCache;
-
-     ClassLoaderReferenceImpl(VirtualMachine aVm, Instance oRef) {
-         super(aVm, oRef);
-     }
-
-     protected String description() {
-         return "ClassLoaderReference " + uniqueID();
-     }
-
-     public List definedClasses() {
-         if (definedClassesCache == null) {
-             definedClassesCache = new ArrayList();
-             Iterator iter = vm.allClasses().iterator();
-             while (iter.hasNext()) {
-                 ReferenceType type = (ReferenceType)iter.next();
-                 if (equals(type.classLoader())) {  /* thanks OTI */
-                     definedClassesCache.add(type);
-                 }
-             }
-         }
-         return definedClassesCache;
-     }
-
-     private SystemDictionary getSystemDictionary() {
-         return vm.saSystemDictionary();
-     }
-
-     private Universe getUniverse() {
-         return vm.saUniverse();
-     }
-
-     public List visibleClasses() {
-         if (visibleClassesCache != null)
-            return visibleClassesCache;
-
-         visibleClassesCache = new ArrayList();
-
-         // refer to getClassLoaderClasses in jvmtiGetLoadedClasses.cpp
-         //  a. SystemDictionary::classes_do doesn't include arrays of primitive types (any dimensions)
-         SystemDictionary sysDict = getSystemDictionary();
-         sysDict.classesDo(
-                           new SystemDictionary.ClassAndLoaderVisitor() {
-                                public void visit(Klass k, Oop loader) {
-                                    if (ref().equals(loader)) {
-                                        for (Klass l = k; l != null; l = l.arrayKlassOrNull()) {
-                                            visibleClassesCache.add(vm.referenceType(l));
-                                        }
-                                    }
-                                }
-                           }
-                           );
-
-         // b. multi dimensional arrays of primitive types
-         sysDict.primArrayClassesDo(
-                                    new SystemDictionary.ClassAndLoaderVisitor() {
-                                         public void visit(Klass k, Oop loader) {
-                                             if (ref().equals(loader)) {
-                                                 visibleClassesCache.add(vm.referenceType(k));
-                                             }
-                                         }
-                                     }
-                                     );
-
-         // c. single dimensional primitive array klasses from Universe
-         // these are not added to SystemDictionary
-         getUniverse().basicTypeClassesDo(
-                            new SystemDictionary.ClassVisitor() {
-                                public void visit(Klass k) {
-                                    visibleClassesCache.add(vm.referenceType(k));
-                                }
-                            }
-                            );
-
-         return visibleClassesCache;
-     }
-
-     Type findType(String signature) throws ClassNotLoadedException {
-         List types = visibleClasses();
-         Iterator iter = types.iterator();
-         while (iter.hasNext()) {
-             ReferenceType type = (ReferenceType)iter.next();
-             if (type.signature().equals(signature)) {
-                 return type;
-             }
-         }
-         JNITypeParser parser = new JNITypeParser(signature);
-         throw new ClassNotLoadedException(parser.typeName(),
-                                          "Class " + parser.typeName() + " not loaded");
-     }
-}
diff --git a/hotspot/src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/jdi/ClassObjectReferenceImpl.java b/hotspot/src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/jdi/ClassObjectReferenceImpl.java
deleted file mode 100644
index 41d926a..0000000
--- a/hotspot/src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/jdi/ClassObjectReferenceImpl.java
+++ /dev/null
@@ -1,53 +0,0 @@
-/*
- * Copyright (c) 2002, 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.
- *
- * 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.jvm.hotspot.jdi;
-
-import com.sun.jdi.*;
-import sun.jvm.hotspot.oops.Instance;
-import sun.jvm.hotspot.oops.Klass;
-import sun.jvm.hotspot.oops.java_lang_Class;
-
-public class ClassObjectReferenceImpl extends ObjectReferenceImpl
-                                      implements ClassObjectReference {
-    private ReferenceType reflectedType;
-
-    ClassObjectReferenceImpl(VirtualMachine vm, Instance oRef) {
-        super(vm, oRef);
-    }
-
-    public ReferenceType reflectedType() {
-        if (reflectedType == null) {
-            Klass k = java_lang_Class.asKlass(ref());
-            reflectedType = vm.referenceType(k);
-        }
-        return reflectedType;
-    }
-
-    public String toString() {
-        return "instance of " + referenceType().name() +
-               "(reflected class=" + reflectedType().name() + ", " + "id=" +
-               uniqueID() + ")";
-    }
-}
diff --git a/hotspot/src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/jdi/ClassTypeImpl.java b/hotspot/src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/jdi/ClassTypeImpl.java
deleted file mode 100644
index 50a710e..0000000
--- a/hotspot/src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/jdi/ClassTypeImpl.java
+++ /dev/null
@@ -1,263 +0,0 @@
-/*
- * Copyright (c) 2002, 2007, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- *
- */
-
-package sun.jvm.hotspot.jdi;
-
-import java.lang.ref.SoftReference;
-import java.util.ArrayList;
-import java.util.Collections;
-import java.util.HashSet;
-import java.util.Iterator;
-import java.util.List;
-import java.util.Map;
-import java.util.Set;
-
-import sun.jvm.hotspot.oops.InstanceKlass;
-
-import com.sun.jdi.ClassNotLoadedException;
-import com.sun.jdi.ClassType;
-import com.sun.jdi.Field;
-import com.sun.jdi.IncompatibleThreadStateException;
-import com.sun.jdi.InterfaceType;
-import com.sun.jdi.InvalidTypeException;
-import com.sun.jdi.InvocationException;
-import com.sun.jdi.Method;
-import com.sun.jdi.ObjectReference;
-import com.sun.jdi.ReferenceType;
-import com.sun.jdi.ThreadReference;
-import com.sun.jdi.Value;
-import com.sun.jdi.VirtualMachine;
-
-public class ClassTypeImpl extends ReferenceTypeImpl
-    implements ClassType
-{
-    private SoftReference interfacesCache    = null;
-    private SoftReference allInterfacesCache = null;
-    private SoftReference subclassesCache    = null;
-
-    protected ClassTypeImpl(VirtualMachine aVm, InstanceKlass aRef) {
-        super(aVm, aRef);
-    }
-
-    public ClassType superclass() {
-        InstanceKlass kk = (InstanceKlass)ref().getSuper();
-        if (kk == null) {
-            return null;
-        }
-        return (ClassType) vm.referenceType(kk);
-    }
-
-    public List interfaces()  {
-        List interfaces = (interfacesCache != null)? (List) interfacesCache.get() : null;
-        if (interfaces == null) {
-            checkPrepared();
-            interfaces = Collections.unmodifiableList(getInterfaces());
-            interfacesCache = new SoftReference(interfaces);
-        }
-        return interfaces;
-    }
-
-    void addInterfaces(List list) {
-        List immediate = interfaces();
-
-        HashSet hashList = new HashSet(list);
-        hashList.addAll(immediate);
-        list.clear();
-        list.addAll(hashList);
-
-        Iterator iter = immediate.iterator();
-        while (iter.hasNext()) {
-            InterfaceTypeImpl interfaze = (InterfaceTypeImpl)iter.next();
-            interfaze.addSuperinterfaces(list);
-        }
-
-        ClassTypeImpl superclass = (ClassTypeImpl)superclass();
-        if (superclass != null) {
-            superclass.addInterfaces(list);
-        }
-    }
-
-    public List allInterfaces()  {
-        List allinterfaces = (allInterfacesCache != null)? (List) allInterfacesCache.get() : null;
-        if (allinterfaces == null) {
-            checkPrepared();
-            allinterfaces = new ArrayList();
-            addInterfaces(allinterfaces);
-            allinterfaces = Collections.unmodifiableList(allinterfaces);
-            allInterfacesCache = new SoftReference(allinterfaces);
-        }
-        return allinterfaces;
-    }
-
-    public List subclasses() {
-        List subclasses = (subclassesCache != null)? (List) subclassesCache.get() : null;
-        if (subclasses == null) {
-            List all = vm.allClasses();
-            subclasses = new ArrayList(0);
-            Iterator iter = all.iterator();
-            while (iter.hasNext()) {
-                ReferenceType refType = (ReferenceType)iter.next();
-                if (refType instanceof ClassType) {
-                    ClassType clazz = (ClassType)refType;
-                    ClassType superclass = clazz.superclass();
-                    if ((superclass != null) && superclass.equals(this)) {
-                        subclasses.add(refType);
-                    }
-                }
-            }
-            subclasses = Collections.unmodifiableList(subclasses);
-            subclassesCache = new SoftReference(subclasses);
-        }
-        return subclasses;
-    }
-
-    public Method concreteMethodByName(String name, String signature)  {
-       checkPrepared();
-       List methods = visibleMethods();
-       Method method = null;
-       Iterator iter = methods.iterator();
-       while (iter.hasNext()) {
-           Method candidate = (Method)iter.next();
-           if (candidate.name().equals(name) &&
-               candidate.signature().equals(signature) &&
-               !candidate.isAbstract()) {
-
-               method = candidate;
-               break;
-           }
-       }
-       return method;
-   }
-
-   List getAllMethods() {
-        ArrayList list = new ArrayList(methods());
-        ClassType clazz = superclass();
-        while (clazz != null) {
-            list.addAll(clazz.methods());
-            clazz = clazz.superclass();
-        }
-        /*
-         * Avoid duplicate checking on each method by iterating through
-         * duplicate-free allInterfaces() rather than recursing
-         */
-        Iterator iter = allInterfaces().iterator();
-        while (iter.hasNext()) {
-            InterfaceType interfaze = (InterfaceType)iter.next();
-            list.addAll(interfaze.methods());
-        }
-        return list;
-    }
-
-    List inheritedTypes() {
-        List inherited = new ArrayList(interfaces());
-        if (superclass() != null) {
-            inherited.add(0, superclass()); /* insert at front */
-        }
-        return inherited;
-    }
-
-    public boolean isEnum() {
-        ClassTypeImpl superclass = (ClassTypeImpl) superclass();
-        if (superclass != null) {
-            return superclass.typeNameAsSymbol().equals(vm.javaLangEnum());
-        } else {
-            return false;
-        }
-    }
-
-    public void setValue(Field field, Value value)
-        throws InvalidTypeException, ClassNotLoadedException {
-        vm.throwNotReadOnlyException("ClassType.setValue(...)");
-    }
-
-
-    public Value invokeMethod(ThreadReference threadIntf, Method methodIntf,
-                              List arguments, int options)
-                                   throws InvalidTypeException,
-                                          ClassNotLoadedException,
-                                          IncompatibleThreadStateException,
-                                          InvocationException {
-        vm.throwNotReadOnlyException("ClassType.invokeMethod(...)");
-        return null;
-    }
-
-    public ObjectReference newInstance(ThreadReference threadIntf,
-                                       Method methodIntf,
-                                       List arguments, int options)
-                                   throws InvalidTypeException,
-                                          ClassNotLoadedException,
-                                          IncompatibleThreadStateException,
-                                          InvocationException {
-        vm.throwNotReadOnlyException("ClassType.newInstance(...)");
-        return null;
-    }
-
-    @Override
-    void addVisibleMethods(Map<String, Method> methodMap, Set<InterfaceType> seenInterfaces) {
-        /*
-         * Add methods from
-         * parent types first, so that the methods in this class will
-         * overwrite them in the hash table
-         */
-
-        Iterator<InterfaceType> iter = interfaces().iterator();
-        while (iter.hasNext()) {
-            InterfaceTypeImpl interfaze = (InterfaceTypeImpl)iter.next();
-            if (!seenInterfaces.contains(interfaze)) {
-                interfaze.addVisibleMethods(methodMap, seenInterfaces);
-                seenInterfaces.add(interfaze);
-            }
-        }
-
-        ClassTypeImpl clazz = (ClassTypeImpl)superclass();
-        if (clazz != null) {
-            clazz.addVisibleMethods(methodMap, seenInterfaces);
-        }
-
-        addToMethodMap(methodMap, methods());
-    }
-
-    boolean isAssignableTo(ReferenceType type) {
-        ClassTypeImpl superclazz = (ClassTypeImpl)superclass();
-        if (this.equals(type)) {
-            return true;
-        } else if ((superclazz != null) && superclazz.isAssignableTo(type)) {
-            return true;
-        } else {
-            List interfaces = interfaces();
-            Iterator iter = interfaces.iterator();
-            while (iter.hasNext()) {
-                InterfaceTypeImpl interfaze = (InterfaceTypeImpl)iter.next();
-                if (interfaze.isAssignableTo(type)) {
-                    return true;
-                }
-            }
-            return false;
-        }
-    }
-
-    public String toString() {
-       return "class " + name() + "(" + loaderString() + ")";
-    }
-}
diff --git a/hotspot/src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/jdi/ConcreteMethodImpl.java b/hotspot/src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/jdi/ConcreteMethodImpl.java
deleted file mode 100644
index d4288f4..0000000
--- a/hotspot/src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/jdi/ConcreteMethodImpl.java
+++ /dev/null
@@ -1,467 +0,0 @@
-/*
- * Copyright (c) 2003, 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.
- *
- * 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.jvm.hotspot.jdi;
-
-import com.sun.jdi.*;
-import sun.jvm.hotspot.oops.Symbol;
-import sun.jvm.hotspot.oops.LocalVariableTableElement;
-import sun.jvm.hotspot.oops.LineNumberTableElement;
-import java.util.List;
-import java.util.Iterator;
-import java.util.Map;
-import java.util.HashMap;
-import java.util.ArrayList;
-import java.util.Comparator;
-import java.lang.ref.SoftReference;
-import java.util.Collections;
-
-public class ConcreteMethodImpl extends MethodImpl {
-
-    /*
-     * A subset of the line number info that is softly cached
-     */
-    static private class SoftLocationXRefs {
-        final String stratumID;   // The stratum of this information
-        final Map lineMapper;     // Maps line number to location(s)
-        final List lineLocations; // List of locations ordered by code index
-
-        /*
-         * Note: these do not necessarily correspond to
-         * the line numbers of the first and last elements
-         * in the lineLocations list. Use these only for bounds
-         * checking and with lineMapper.
-         */
-        final int lowestLine;
-        final int highestLine;
-
-        SoftLocationXRefs(String stratumID, Map lineMapper, List lineLocations,
-                     int lowestLine, int highestLine) {
-            this.stratumID = stratumID;
-            this.lineMapper = Collections.unmodifiableMap(lineMapper);
-            this.lineLocations =
-                Collections.unmodifiableList(lineLocations);
-            this.lowestLine = lowestLine;
-            this.highestLine = highestLine;
-        }
-    }
-
-    private SoftReference softBaseLocationXRefsRef;
-    private SoftReference softOtherLocationXRefsRef;
-    private SoftReference variablesRef = null;
-    private int firstIndex = -1;
-    private int lastIndex = -1;
-    private Location location;
-    private SoftReference bytecodesRef = null;
-
-    ConcreteMethodImpl(VirtualMachine vm, ReferenceTypeImpl declaringType,
-               sun.jvm.hotspot.oops.Method saMethod ) {
-        super(vm, declaringType, saMethod);
-    }
-
-    int argSlotCount() throws AbsentInformationException {
-        return (int) saMethod.getSizeOfParameters();
-    }
-
-    private SoftLocationXRefs getLocations(SDE.Stratum stratum) {
-        if (stratum.isJava()) {
-            return getBaseLocations();
-        }
-        String stratumID = stratum.id();
-        SoftLocationXRefs info =
-            (softOtherLocationXRefsRef == null) ? null :
-               (SoftLocationXRefs)softOtherLocationXRefsRef.get();
-        if (info != null && info.stratumID.equals(stratumID)) {
-            return info;
-        }
-
-        List lineLocations = new ArrayList();
-        Map lineMapper = new HashMap();
-        int lowestLine = -1;
-        int highestLine = -1;
-        SDE.LineStratum lastLineStratum = null;
-        SDE.Stratum baseStratum =
-            declaringType.stratum(SDE.BASE_STRATUM_NAME);
-        Iterator it = getBaseLocations().lineLocations.iterator();
-        while(it.hasNext()) {
-            LocationImpl loc = (LocationImpl)it.next();
-            int baseLineNumber = loc.lineNumber(baseStratum);
-            SDE.LineStratum lineStratum =
-                  stratum.lineStratum(declaringType,
-                                      baseLineNumber);
-
-            if (lineStratum == null) {
-                // location not mapped in this stratum
-                continue;
-            }
-
-            int lineNumber = lineStratum.lineNumber();
-
-            // remove unmapped and dup lines
-            if ((lineNumber != -1) &&
-                          (!lineStratum.equals(lastLineStratum))) {
-                lastLineStratum = lineStratum;
-                // Remember the largest/smallest line number
-                if (lineNumber > highestLine) {
-                    highestLine = lineNumber;
-                }
-                if ((lineNumber < lowestLine) || (lowestLine == -1)) {
-                    lowestLine = lineNumber;
-                }
-
-                loc.addStratumLineInfo(
-                new StratumLineInfo(stratumID,
-                                      lineNumber,
-                                      lineStratum.sourceName(),
-                                      lineStratum.sourcePath()));
-
-                // Add to the location list
-                lineLocations.add(loc);
-
-                // Add to the line -> locations map
-                Integer key = new Integer(lineNumber);
-                List mappedLocs = (List)lineMapper.get(key);
-                if (mappedLocs == null) {
-                    mappedLocs = new ArrayList(1);
-                    lineMapper.put(key, mappedLocs);
-                }
-                mappedLocs.add(loc);
-            }
-        }
-
-        info = new SoftLocationXRefs(stratumID,
-                                lineMapper, lineLocations,
-                                lowestLine, highestLine);
-        softOtherLocationXRefsRef = new SoftReference(info);
-        return info;
-    }
-
-    private SoftLocationXRefs getBaseLocations() {
-        SoftLocationXRefs info = (softBaseLocationXRefsRef == null) ? null :
-                                     (SoftLocationXRefs)softBaseLocationXRefsRef.get();
-        if (info != null) {
-            return info;
-        }
-
-        byte[] codeBuf = bytecodes();
-        firstIndex = 0;
-        lastIndex = codeBuf.length - 1;
-        // This is odd; what is the Location of a Method?
-        // A StackFrame can have a location, but a Method?
-        // I guess it must be the Location for bci 0.
-        location = new LocationImpl(virtualMachine(), this, 0);
-
-        boolean hasLineInfo = saMethod.hasLineNumberTable();
-        LineNumberTableElement[] lntab = null;
-        int count;
-
-        if (hasLineInfo) {
-            lntab = saMethod.getLineNumberTable();
-            count = lntab.length;
-        } else {
-            count = 0;
-        }
-
-        List lineLocations = new ArrayList(count);
-        Map lineMapper = new HashMap();
-        int lowestLine = -1;
-        int highestLine = -1;
-        for (int i = 0; i < count; i++) {
-            long bci = lntab[i].getStartBCI();
-            int lineNumber = lntab[i].getLineNumber();
-
-            /*
-             * Some compilers will point multiple consecutive
-             * lines at the same location. We need to choose
-             * one of them so that we can consistently map back
-             * and forth between line and location. So we choose
-             * to record only the last line entry at a particular
-             * location.
-             */
-            if ((i + 1 == count) || (bci != lntab[i+1].getStartBCI())) {
-                // Remember the largest/smallest line number
-                if (lineNumber > highestLine) {
-                    highestLine = lineNumber;
-                }
-                if ((lineNumber < lowestLine) || (lowestLine == -1)) {
-                    lowestLine = lineNumber;
-                }
-                LocationImpl loc =
-                    new LocationImpl(virtualMachine(), this, bci);
-                loc.addBaseLineInfo(
-                    new BaseLineInfo(lineNumber, declaringType));
-
-                // Add to the location list
-                lineLocations.add(loc);
-
-                // Add to the line -> locations map
-                Integer key = new Integer(lineNumber);
-                List mappedLocs = (List)lineMapper.get(key);
-                if (mappedLocs == null) {
-                    mappedLocs = new ArrayList(1);
-                    lineMapper.put(key, mappedLocs);
-                }
-                mappedLocs.add(loc);
-            }
-        }
-
-        info = new SoftLocationXRefs(SDE.BASE_STRATUM_NAME,
-                                lineMapper, lineLocations,
-                                lowestLine, highestLine);
-        softBaseLocationXRefsRef = new SoftReference(info);
-        return info;
-    }
-
-    List sourceNameFilter(List list,
-                          SDE.Stratum stratum,
-                          String sourceName)
-                            throws AbsentInformationException {
-        if (sourceName == null) {
-            return list;
-        } else {
-            /* needs sourceName filteration */
-            List locs = new ArrayList();
-            Iterator it = list.iterator();
-            while (it.hasNext()) {
-                LocationImpl loc = (LocationImpl)it.next();
-                if (loc.sourceName(stratum).equals(sourceName)) {
-                    locs.add(loc);
-                }
-            }
-            return locs;
-        }
-    }
-
-    public List allLineLocations(SDE.Stratum stratum, String sourceName)
-        throws AbsentInformationException {
-        List lineLocations = getLocations(stratum).lineLocations;
-
-        if (lineLocations.size() == 0) {
-            throw new AbsentInformationException();
-        }
-
-        return Collections.unmodifiableList(
-          sourceNameFilter(lineLocations, stratum, sourceName));
-    }
-
-    public List locationsOfLine(SDE.Stratum stratum, String sourceName,
-                         int lineNumber) throws AbsentInformationException {
-        SoftLocationXRefs info = getLocations(stratum);
-
-        if (info.lineLocations.size() == 0) {
-            throw new AbsentInformationException();
-        }
-
-        /*
-         * Find the locations which match the line number
-         * passed in.
-         */
-        List list = (List)info.lineMapper.get(
-                                  new Integer(lineNumber));
-
-        if (list == null) {
-            list = new ArrayList(0);
-        }
-        return Collections.unmodifiableList(
-          sourceNameFilter(list, stratum, sourceName));
-    }
-
-    LineInfo codeIndexToLineInfo(SDE.Stratum stratum,
-                                 long codeIndex) {
-        if (firstIndex == -1) {
-            getBaseLocations();
-        }
-
-        /*
-         * Check for invalid code index.
-         */
-        if (codeIndex < firstIndex || codeIndex > lastIndex) {
-            throw new InternalError(
-                    "Location with invalid code index");
-        }
-
-        List lineLocations = getLocations(stratum).lineLocations;
-
-        /*
-         * Check for absent line numbers.
-         */
-        if (lineLocations.size() == 0) {
-            return super.codeIndexToLineInfo(stratum, codeIndex);
-        }
-
-        Iterator iter = lineLocations.iterator();
-        /*
-         * Treat code before the beginning of the first line table
-         * entry as part of the first line.  javac will generate
-         * code like this for some local classes. This "prolog"
-         * code contains assignments from locals in the enclosing
-         * scope to synthetic fields in the local class.  Same for
-         * other language prolog code.
-         */
-        LocationImpl bestMatch = (LocationImpl)iter.next();
-        while (iter.hasNext()) {
-            LocationImpl current = (LocationImpl)iter.next();
-            if (current.codeIndex() > codeIndex) {
-                break;
-            }
-            bestMatch = current;
-        }
-        return bestMatch.getLineInfo(stratum);
-    }
-
-    public Location locationOfCodeIndex(long codeIndex) {
-        if (firstIndex == -1) {
-            getBaseLocations();
-        }
-
-        /*
-         * Check for invalid code index.
-         */
-        if (codeIndex < firstIndex || codeIndex > lastIndex) {
-            return null;
-        }
-
-        return new LocationImpl(virtualMachine(), this, codeIndex);
-    }
-
-    public List variables() throws AbsentInformationException {
-        return getVariables();
-    }
-
-    public List variablesByName(String name) throws AbsentInformationException {
-        List variables = getVariables();
-
-        List retList = new ArrayList(2);
-        Iterator iter = variables.iterator();
-        while(iter.hasNext()) {
-            LocalVariable variable = (LocalVariable)iter.next();
-            if (variable.name().equals(name)) {
-                retList.add(variable);
-            }
-        }
-        return retList;
-    }
-
-    public List arguments() throws AbsentInformationException {
-        if (argumentTypeNames().size() == 0) {
-            return new ArrayList(0);
-        }
-        List variables = getVariables();
-        List retList = new ArrayList(variables.size());
-        Iterator iter = variables.iterator();
-        while(iter.hasNext()) {
-            LocalVariable variable = (LocalVariable)iter.next();
-            if (variable.isArgument()) {
-                retList.add(variable);
-            }
-        }
-        return retList;
-    }
-
-    public byte[] bytecodes() {
-        byte[] bytecodes = (bytecodesRef == null) ? null :
-                                     (byte[])bytecodesRef.get();
-        if (bytecodes == null) {
-            bytecodes = saMethod.getByteCode();
-            bytecodesRef = new SoftReference(bytecodes);
-        }
-        /*
-         * Arrays are always modifiable, so it is a little unsafe
-         * to return the cached bytecodes directly; instead, we
-         * make a clone at the cost of using more memory.
-         */
-        return (byte[])bytecodes.clone();
-    }
-
-    public Location location() {
-        if (location == null) {
-            getBaseLocations();
-        }
-        return location;
-    }
-
-    private List getVariables() throws AbsentInformationException {
-        List variables = (variablesRef == null) ? null :
-                                     (List)variablesRef.get();
-        if (variables != null) {
-            return variables;
-        }
-
-        // if there are no locals, there won't be a LVT
-        if (saMethod.getMaxLocals() == 0) {
-           variables = Collections.unmodifiableList(new ArrayList(0));
-           variablesRef = new SoftReference(variables);
-           return variables;
-        }
-
-        if (! saMethod.hasLocalVariableTable()) {
-            throw new AbsentInformationException();
-        }
-        //Build up the JDI view of local variable table.
-        LocalVariableTableElement[] locals = saMethod.getLocalVariableTable();
-        int localCount = locals.length;
-        variables = new ArrayList(localCount);
-        for (int ii = 0; ii < localCount; ii++) {
-            String name =
-                saMethod.getConstants().getSymbolAt(locals[ii].getNameCPIndex()).asString();
-            /*
-             * Skip "this$*", "this+*", "this" entries because they are never real
-             * variables from the JLS perspective. "this+*" is new with 1.5.
-             * Instead of using '+', we check for java letter or digit to avoid
-             * depending on javac's current choice of '+'.
-             */
-            boolean isInternalName = name.startsWith("this") &&
-                  (name.length() == 4 || name.charAt(4)=='$' || !Character.isJavaIdentifierPart(name.charAt(4)));
-            if (! isInternalName) {
-                int slot = locals[ii].getSlot();
-                long codeIndex = locals[ii].getStartBCI();
-                int length = locals[ii].getLength();
-                Location scopeStart = new LocationImpl(virtualMachine(),
-                                                       this, codeIndex);
-                Location scopeEnd =
-                    new LocationImpl(virtualMachine(), this,
-                                     codeIndex + length - 1);
-                String signature =
-                    saMethod.getConstants().getSymbolAt(locals[ii].getDescriptorCPIndex()).asString();
-
-                int genericSigIndex = locals[ii].getSignatureCPIndex();
-                String genericSignature = null;
-                if (genericSigIndex != 0) {
-                    genericSignature = saMethod.getConstants().getSymbolAt(genericSigIndex).asString();
-                }
-
-                LocalVariable variable =
-                    new LocalVariableImpl(virtualMachine(), this,
-                                          slot, scopeStart, scopeEnd,
-                                          name, signature, genericSignature);
-                // Add to the variable list
-                variables.add(variable);
-            }
-        }
-
-        variables = Collections.unmodifiableList(variables);
-        variablesRef = new SoftReference(variables);
-        return variables;
-    }
-}
diff --git a/hotspot/src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/jdi/ConnectorImpl.java b/hotspot/src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/jdi/ConnectorImpl.java
deleted file mode 100644
index 0cffde9..0000000
--- a/hotspot/src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/jdi/ConnectorImpl.java
+++ /dev/null
@@ -1,631 +0,0 @@
-/*
- * Copyright (c) 2002, 2012, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation.
- *
- * 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.jvm.hotspot.jdi;
-
-import com.sun.jdi.connect.*;
-import com.sun.jdi.InternalException;
-
-import java.io.*;
-import java.lang.ref.*;
-import java.lang.reflect.*;
-import java.util.*;
-
-abstract class ConnectorImpl implements Connector {
-    Map defaultArguments = new LinkedHashMap();
-
-    // Used by BooleanArgument
-    static String trueString = null;
-    static String falseString;
-
-
-    /**  This is not public in VirtualMachineManagerImpl
-    ThreadGroup mainGroupForJDI() {
-        return ((VirtualMachineManagerImpl)manager).mainGroupForJDI();
-    }
-    ***/
-
-    // multiple debuggee support for SA/JDI
-    private static List freeVMClasses; // List<SoftReference<Class>>
-    private static ClassLoader myLoader;
-    // debug mode for SA/JDI connectors
-    static final protected boolean DEBUG;
-    static {
-        myLoader = ConnectorImpl.class.getClassLoader();
-        freeVMClasses = new ArrayList(0);
-        DEBUG = System.getProperty("sun.jvm.hotspot.jdi.ConnectorImpl.DEBUG") != null;
-    }
-
-    // add a new free VirtualMachineImpl class
-    private static synchronized void addFreeVMImplClass(Class clazz) {
-        if (DEBUG) {
-            System.out.println("adding free VirtualMachineImpl class");
-        }
-        freeVMClasses.add(new SoftReference(clazz));
-    }
-
-    // returns null if we don't have anything free
-    private static synchronized Class getFreeVMImplClass() {
-        while (!freeVMClasses.isEmpty()) {
-              SoftReference ref = (SoftReference) freeVMClasses.remove(0);
-              Object o = ref.get();
-              if (o != null) {
-                  if (DEBUG) {
-                      System.out.println("re-using loaded VirtualMachineImpl");
-                  }
-                  return (Class) o;
-              }
-        }
-        return null;
-    }
-
-    private static Class getVMImplClassFrom(ClassLoader cl)
-                               throws ClassNotFoundException {
-        return Class.forName("sun.jvm.hotspot.jdi.VirtualMachineImpl", true, cl);
-    }
-
-    /* SA has not been designed to support multiple debuggee VMs
-     * at-a-time.  But, JDI supports multiple debuggee VMs.  We
-     * support multiple debuggee VMs in SA/JDI, by creating a new
-     * class loader instance (refer to comment in SAJDIClassLoader
-     * for details). But, to avoid excessive class loading (and
-     * thereby resulting in larger footprint), we re-use 'dispose'd
-     * VirtualMachineImpl classes.
-     */
-    protected static Class loadVirtualMachineImplClass()
-                               throws ClassNotFoundException {
-        Class vmImplClass = getFreeVMImplClass();
-        if (vmImplClass == null) {
-            ClassLoader cl = new SAJDIClassLoader(myLoader);
-            vmImplClass = getVMImplClassFrom(cl);
-        }
-        return vmImplClass;
-    }
-
-    /* We look for System property sun.jvm.hotspot.jdi.<vm version>.
-     * This property should have the value of JDK HOME directory for
-     * the given <vm version>.
-     */
-    private static String getSAClassPathForVM(String vmVersion) {
-        final String prefix = "sun.jvm.hotspot.jdi.";
-        // look for exact match of VM version
-        String jvmHome = System.getProperty(prefix + vmVersion);
-        if (DEBUG) {
-            System.out.println("looking for System property " + prefix + vmVersion);
-        }
-
-        if (jvmHome == null) {
-            // omit chars after first '-' in VM version and try
-            // for example, in '1.5.0-b55' we take '1.5.0'
-            int index = vmVersion.indexOf('-');
-            if (index != -1) {
-                vmVersion = vmVersion.substring(0, index);
-                if (DEBUG) {
-                    System.out.println("looking for System property " + prefix + vmVersion);
-                }
-                jvmHome = System.getProperty(prefix + vmVersion);
-            }
-
-            if (jvmHome == null) {
-                // System property is not set
-                if (DEBUG) {
-                    System.out.println("can't locate JDK home for " + vmVersion);
-                }
-                return null;
-            }
-        }
-
-        if (DEBUG) {
-            System.out.println("JDK home for " + vmVersion + " is " + jvmHome);
-        }
-
-        // sa-jdi is in $JDK_HOME/lib directory
-        StringBuffer buf = new StringBuffer();
-        buf.append(jvmHome);
-        buf.append(File.separatorChar);
-        buf.append("lib");
-        buf.append(File.separatorChar);
-        buf.append("sa-jdi.jar");
-        return buf.toString();
-    }
-
-    /* This method loads VirtualMachineImpl class by a ClassLoader
-     * configured with sa-jdi.jar path of given 'vmVersion'. This is
-     * used for cross VM version debugging. Refer to comments in
-     * SAJDIClassLoader as well.
-     */
-    protected static Class loadVirtualMachineImplClass(String vmVersion)
-            throws ClassNotFoundException {
-        if (DEBUG) {
-            System.out.println("attemping to load sa-jdi.jar for version " + vmVersion);
-        }
-        String classPath = getSAClassPathForVM(vmVersion);
-        if (classPath != null) {
-            ClassLoader cl = new SAJDIClassLoader(myLoader, classPath);
-            return getVMImplClassFrom(cl);
-        } else {
-            return null;
-        }
-    }
-
-    /* Is the given throwable an instanceof VMVersionMismatchException?
-     * Note that we can't do instanceof check because the exception
-     * class might have been loaded by a different class loader.
-     */
-    private static boolean isVMVersionMismatch(Throwable throwable) {
-        String className = throwable.getClass().getName();
-        return className.equals("sun.jvm.hotspot.runtime.VMVersionMismatchException");
-    }
-
-    /* gets target VM version from the given VMVersionMismatchException.
-     * Note that we need to reflectively call the method because of we may
-     * have got this from different classloader's namespace */
-    private static String getVMVersion(Throwable throwable)
-        throws NoSuchMethodException, InvocationTargetException, IllegalAccessException {
-        // assert isVMVersionMismatch(throwable), "not a VMVersionMismatch"
-        Class expClass = throwable.getClass();
-        Method targetVersionMethod = expClass.getMethod("getTargetVersion", new Class[0]);
-        return (String) targetVersionMethod.invoke(throwable);
-    }
-
-    /** If the causal chain has a sun.jvm.hotspot.runtime.VMVersionMismatchException,
-        attempt to load VirtualMachineImpl class for target VM version. */
-    protected static Class handleVMVersionMismatch(InvocationTargetException ite) {
-        Throwable cause = ite.getCause();
-        if (DEBUG) {
-            System.out.println("checking for version mismatch...");
-        }
-        while (cause != null) {
-            try {
-                if (isVMVersionMismatch(cause)) {
-                    if (DEBUG) {
-                        System.out.println("Triggering cross VM version support...");
-                    }
-                    return loadVirtualMachineImplClass(getVMVersion(cause));
-                }
-            } catch (Exception exp) {
-                if (DEBUG) {
-                    System.out.println("failed to load VirtualMachineImpl class");
-                    exp.printStackTrace();
-                }
-                return null;
-            }
-            cause = cause.getCause();
-        }
-        return null;
-    }
-
-    protected void checkNativeLink(SecurityManager sm, String os) {
-        if (os.equals("SunOS") || os.equals("Linux") || os.contains("OS X")) {
-            // link "saproc" - SA native library on SunOS, Linux, and Mac OS X
-            sm.checkLink("saproc");
-        } else if (os.startsWith("Windows")) {
-            // link "sawindbg" - SA native library on Windows.
-            sm.checkLink("sawindbg");
-        } else {
-           throw new RuntimeException(os + " is not yet supported");
-        }
-    }
-
-    // we set an observer to detect VirtualMachineImpl.dispose call
-    // and on dispose we add corresponding VirtualMachineImpl.class to
-    // free VirtualMachimeImpl Class list.
-    protected static void setVMDisposeObserver(final Object vm) {
-        try {
-            Method setDisposeObserverMethod = vm.getClass().getDeclaredMethod("setDisposeObserver",
-                                                         new Class[] { java.util.Observer.class });
-            setDisposeObserverMethod.setAccessible(true);
-            setDisposeObserverMethod.invoke(vm,
-                                         new Object[] {
-                                             new Observer() {
-                                                 public void update(Observable o, Object data) {
-                                                     if (DEBUG) {
-                                                         System.out.println("got VM.dispose notification");
-                                                     }
-                                                     addFreeVMImplClass(vm.getClass());
-                                                 }
-                                             }
-                                         });
-        } catch (Exception exp) {
-            if (DEBUG) {
-               System.out.println("setVMDisposeObserver() got an exception:");
-               exp.printStackTrace();
-            }
-        }
-    }
-
-    public Map defaultArguments() {
-        Map defaults = new LinkedHashMap();
-        Collection values = defaultArguments.values();
-
-        Iterator iter = values.iterator();
-        while (iter.hasNext()) {
-            ArgumentImpl argument = (ArgumentImpl)iter.next();
-            defaults.put(argument.name(), argument.clone());
-        }
-        return defaults;
-    }
-
-    void addStringArgument(String name, String label, String description,
-                           String defaultValue, boolean mustSpecify) {
-        defaultArguments.put(name,
-                             new StringArgumentImpl(name, label,
-                                                    description,
-                                                    defaultValue,
-                                                    mustSpecify));
-    }
-
-    void addBooleanArgument(String name, String label, String description,
-                            boolean defaultValue, boolean mustSpecify) {
-        defaultArguments.put(name,
-                             new BooleanArgumentImpl(name, label,
-                                                     description,
-                                                     defaultValue,
-                                                     mustSpecify));
-    }
-
-    void addIntegerArgument(String name, String label, String description,
-                            String defaultValue, boolean mustSpecify,
-                            int min, int max) {
-        defaultArguments.put(name,
-                             new IntegerArgumentImpl(name, label,
-                                                     description,
-                                                     defaultValue,
-                                                     mustSpecify,
-                                                     min, max));
-    }
-
-    void addSelectedArgument(String name, String label, String description,
-                             String defaultValue, boolean mustSpecify,
-                             List list) {
-        defaultArguments.put(name,
-                             new SelectedArgumentImpl(name, label,
-                                                      description,
-                                                      defaultValue,
-                                                      mustSpecify, list));
-    }
-
-    ArgumentImpl argument(String name, Map arguments)
-                throws IllegalConnectorArgumentsException {
-
-        ArgumentImpl argument = (ArgumentImpl)arguments.get(name);
-        if (argument == null) {
-            throw new IllegalConnectorArgumentsException(
-                         "Argument missing", name);
-        }
-        String value = argument.value();
-        if (value == null || value.length() == 0) {
-            if (argument.mustSpecify()) {
-            throw new IllegalConnectorArgumentsException(
-                         "Argument unspecified", name);
-            }
-        } else if(!argument.isValid(value)) {
-            throw new IllegalConnectorArgumentsException(
-                         "Argument invalid", name);
-        }
-
-        return argument;
-    }
-
-    String getString(String key) {
-        //fixme jjh; needs i18n
-        // this is not public return ((VirtualMachineManagerImpl)manager).getString(key);
-        return key;
-    }
-
-    public String toString() {
-        String string = name() + " (defaults: ";
-        Iterator iter = defaultArguments().values().iterator();
-        boolean first = true;
-        while (iter.hasNext()) {
-            ArgumentImpl argument = (ArgumentImpl)iter.next();
-            if (!first) {
-                string += ", ";
-            }
-            string += argument.toString();
-            first = false;
-        }
-        return string  + ")";
-    }
-
-    abstract class ArgumentImpl implements Connector.Argument, Cloneable, Serializable {
-        private String name;
-        private String label;
-        private String description;
-        private String value;
-        private boolean mustSpecify;
-
-        ArgumentImpl(String name, String label, String description,
-                     String value,
-                     boolean mustSpecify) {
-            this.name = name;
-            this.label = label;
-            this.description = description;
-            this.value = value;
-            this.mustSpecify = mustSpecify;
-        }
-
-        public abstract boolean isValid(String value);
-
-        public String name() {
-            return name;
-        }
-
-        public String label() {
-            return label;
-        }
-
-        public String description() {
-            return description;
-        }
-
-        public String value() {
-            return value;
-        }
-
-        public void setValue(String value) {
-            if (value == null) {
-                throw new NullPointerException("Can't set null value");
-            }
-            this.value = value;
-        }
-
-        public boolean mustSpecify() {
-            return mustSpecify;
-        }
-
-        public boolean equals(Object obj) {
-            if ((obj != null) && (obj instanceof Connector.Argument)) {
-                Connector.Argument other = (Connector.Argument)obj;
-                return (name().equals(other.name())) &&
-                       (description().equals(other.description())) &&
-                       (mustSpecify() == other.mustSpecify()) &&
-                       (value().equals(other.value()));
-            } else {
-                return false;
-            }
-        }
-
-        public int hashCode() {
-            return description().hashCode();
-        }
-
-        public Object clone() {
-            try {
-                return super.clone();
-            } catch (CloneNotSupportedException e) {
-                // Object should always support clone
-                throw (InternalException) new InternalException().initCause(e);
-            }
-        }
-
-        public String toString() {
-            return name() + "=" + value();
-        }
-    }
-
-    class BooleanArgumentImpl extends ConnectorImpl.ArgumentImpl
-                              implements Connector.BooleanArgument {
-
-        BooleanArgumentImpl(String name, String label, String description,
-                            boolean value,
-                            boolean mustSpecify) {
-            super(name, label, description, null, mustSpecify);
-            if(trueString == null) {
-                trueString = getString("true");
-                falseString = getString("false");
-            }
-            setValue(value);
-        }
-
-        /**
-         * Sets the value of the argument.
-         */
-        public void setValue(boolean value) {
-            setValue(stringValueOf(value));
-        }
-
-        /**
-         * Performs basic sanity check of argument.
-         * @return <code>true</code> if value is a string
-         * representation of a boolean value.
-         * @see #stringValueOf(boolean)
-         */
-        public boolean isValid(String value) {
-            return value.equals(trueString) || value.equals(falseString);
-        }
-
-        /**
-         * Return the string representation of the <code>value</code>
-         * parameter.
-         * Does not set or examine the value or the argument.
-         * @return the localized String representation of the
-         * boolean value.
-         */
-        public String stringValueOf(boolean value) {
-            return value? trueString : falseString;
-        }
-
-        /**
-         * Return the value of the argument as a boolean.  Since
-         * the argument may not have been set or may have an invalid
-         * value {@link #isValid(String)} should be called on
-         * {@link #value()} to check its validity.  If it is invalid
-         * the boolean returned by this method is undefined.
-         * @return the value of the argument as a boolean.
-         */
-        public boolean booleanValue() {
-            return value().equals(trueString);
-        }
-    }
-
-    class IntegerArgumentImpl extends ConnectorImpl.ArgumentImpl
-                              implements Connector.IntegerArgument {
-
-        private final int min;
-        private final int max;
-
-        IntegerArgumentImpl(String name, String label, String description,
-                            String value,
-                            boolean mustSpecify, int min, int max) {
-            super(name, label, description, value, mustSpecify);
-            this.min = min;
-            this.max = max;
-        }
-
-        /**
-         * Sets the value of the argument.
-         * The value should be checked with {@link #isValid(int)}
-         * before setting it; invalid values will throw an exception
-         * when the connection is established - for example,
-         * on {@link LaunchingConnector#launch}
-         */
-        public void setValue(int value) {
-            setValue(stringValueOf(value));
-        }
-
-        /**
-         * Performs basic sanity check of argument.
-         * @return <code>true</code> if value represents an int that is
-         * <code>{@link #min()} &lt;= value &lt;= {@link #max()}</code>
-         */
-        public boolean isValid(String value) {
-            if (value == null) {
-                return false;
-            }
-            try {
-                return isValid(Integer.decode(value).intValue());
-            } catch(NumberFormatException exc) {
-                return false;
-            }
-        }
-
-        /**
-         * Performs basic sanity check of argument.
-         * @return <code>true</code> if
-         * <code>{@link #min()} &lt;= value  &lt;= {@link #max()}</code>
-         */
-        public boolean isValid(int value) {
-            return min <= value && value <= max;
-        }
-
-        /**
-         * Return the string representation of the <code>value</code>
-         * parameter.
-         * Does not set or examine the value or the argument.
-         * @return the String representation of the
-         * int value.
-         */
-        public String stringValueOf(int value) {
-            // *** Should this be internationalized????
-            // *** Even Brian Beck was unsure if an Arabic programmer
-            // *** would expect port numbers in Arabic numerals,
-            // *** so punt for now.
-            return ""+value;
-        }
-
-        /**
-         * Return the value of the argument as a int.  Since
-         * the argument may not have been set or may have an invalid
-         * value {@link #isValid(String)} should be called on
-         * {@link #value()} to check its validity.  If it is invalid
-         * the int returned by this method is undefined.
-         * @return the value of the argument as a int.
-         */
-        public int intValue() {
-            if (value() == null) {
-                return 0;
-            }
-            try {
-                return Integer.decode(value()).intValue();
-            } catch(NumberFormatException exc) {
-                return 0;
-            }
-        }
-
-        /**
-         * The upper bound for the value.
-         * @return the maximum allowed value for this argument.
-         */
-        public int max() {
-            return max;
-        }
-
-        /**
-         * The lower bound for the value.
-         * @return the minimum allowed value for this argument.
-         */
-        public int min() {
-            return min;
-        }
-    }
-
-    class StringArgumentImpl extends ConnectorImpl.ArgumentImpl
-                              implements Connector.StringArgument {
-
-        StringArgumentImpl(String name, String label, String description,
-                           String value,
-                           boolean mustSpecify) {
-            super(name, label, description, value, mustSpecify);
-        }
-
-        /**
-         * Performs basic sanity check of argument.
-         * @return <code>true</code> always
-         */
-        public boolean isValid(String value) {
-            return true;
-        }
-    }
-
-    class SelectedArgumentImpl extends ConnectorImpl.ArgumentImpl
-                              implements Connector.SelectedArgument {
-
-        private final List choices;
-
-        SelectedArgumentImpl(String name, String label, String description,
-                             String value,
-                             boolean mustSpecify, List choices) {
-            super(name, label, description, value, mustSpecify);
-            this.choices = Collections.unmodifiableList(
-                                           new ArrayList(choices));
-        }
-
-        /**
-         * Return the possible values for the argument
-         * @return {@link List} of {@link String}
-         */
-        public List choices() {
-            return choices;
-        }
-
-        /**
-         * Performs basic sanity check of argument.
-         * @return <code>true</code> if value is one of {@link #choices()}.
-         */
-        public boolean isValid(String value) {
-            return choices.contains(value);
-        }
-    }
-}
diff --git a/hotspot/src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/jdi/DoubleTypeImpl.java b/hotspot/src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/jdi/DoubleTypeImpl.java
deleted file mode 100644
index dfe72a4..0000000
--- a/hotspot/src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/jdi/DoubleTypeImpl.java
+++ /dev/null
@@ -1,43 +0,0 @@
-/*
- * Copyright (c) 2002, 2003, 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 sun.jvm.hotspot.jdi;
-
-import com.sun.jdi.*;
-
-public class DoubleTypeImpl extends PrimitiveTypeImpl implements DoubleType {
-    DoubleTypeImpl(VirtualMachine vm) {
-        super(vm);
-    }
-
-
-    public String signature() {
-        return "D";
-    }
-
-    PrimitiveValue convert(PrimitiveValue value) throws InvalidTypeException {
-        return vm.mirrorOf(((PrimitiveValueImpl)value).checkedDoubleValue());
-    }
-
-}
diff --git a/hotspot/src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/jdi/DoubleValueImpl.java b/hotspot/src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/jdi/DoubleValueImpl.java
deleted file mode 100644
index d9f914b..0000000
--- a/hotspot/src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/jdi/DoubleValueImpl.java
+++ /dev/null
@@ -1,159 +0,0 @@
-/*
- * Copyright (c) 2002, 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.
- *
- * 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.jvm.hotspot.jdi;
-
-import com.sun.jdi.*;
-
-public class DoubleValueImpl extends PrimitiveValueImpl
-                             implements DoubleValue {
-    private double value;
-
-    DoubleValueImpl(VirtualMachine aVm,double aValue) {
-        super(aVm);
-
-        value = aValue;
-    }
-
-    public boolean equals(Object obj) {
-        if ((obj != null) && (obj instanceof DoubleValue)) {
-            return (value == ((DoubleValue)obj).value()) &&
-                   super.equals(obj);
-        } else {
-            return false;
-        }
-    }
-
-    public int compareTo(DoubleValue doubleVal) {
-        double other = doubleVal.value();
-        if (value() < other) {
-            return -1;
-        } else if (value() == other) {
-            return 0;
-        } else {
-            return 1;
-        }
-    }
-
-    public int hashCode() {
-        /*
-         * TO DO: Better hash code
-         */
-        return intValue();
-    }
-
-    public Type type() {
-        return vm.theDoubleType();
-    }
-
-    public double value() {
-        return value;
-    }
-
-    public boolean booleanValue() {
-        return(value == 0.0)?false:true;
-    }
-
-    public byte byteValue() {
-        return(byte)value;
-    }
-
-    public char charValue() {
-        return(char)value;
-    }
-
-    public short shortValue() {
-        return(short)value;
-    }
-
-    public int intValue() {
-        return(int)value;
-    }
-
-    public long longValue() {
-        return(long)value;
-    }
-
-    public float floatValue() {
-        return(float)value;
-    }
-
-    public double doubleValue() {
-        return(double)value;
-    }
-
-    byte checkedByteValue() throws InvalidTypeException {
-        if ((value > Byte.MAX_VALUE) || (value < Byte.MIN_VALUE)) {
-            throw new InvalidTypeException("Can't convert " + value + " to byte");
-        } else {
-            return super.checkedByteValue();
-        }
-    }
-
-    char checkedCharValue() throws InvalidTypeException {
-        if ((value > Character.MAX_VALUE) || (value < Character.MIN_VALUE)) {
-            throw new InvalidTypeException("Can't convert " + value + " to char");
-        } else {
-            return super.checkedCharValue();
-        }
-    }
-
-    short checkedShortValue() throws InvalidTypeException {
-        if ((value > Short.MAX_VALUE) || (value < Short.MIN_VALUE)) {
-            throw new InvalidTypeException("Can't convert " + value + " to short");
-        } else {
-            return super.checkedShortValue();
-        }
-    }
-
-    int checkedIntValue() throws InvalidTypeException {
-        if ((value > Integer.MAX_VALUE) || (value < Integer.MIN_VALUE)) {
-            throw new InvalidTypeException("Can't convert " + value + " to int");
-        } else {
-            return super.checkedIntValue();
-        }
-    }
-
-    long checkedLongValue() throws InvalidTypeException {
-        long longValue = (long)value;
-        if (longValue != value) {
-            throw new InvalidTypeException("Can't convert " + value + " to long");
-        } else {
-            return super.checkedLongValue();
-        }
-    }
-
-    float checkedFloatValue() throws InvalidTypeException {
-        float floatValue = (float)value;
-        if (floatValue != value) {
-            throw new InvalidTypeException("Can't convert " + value + " to float");
-        } else {
-            return super.checkedFloatValue();
-        }
-    }
-
-    public String toString() {
-        return "" + value;
-    }
-}
diff --git a/hotspot/src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/jdi/FieldImpl.java b/hotspot/src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/jdi/FieldImpl.java
deleted file mode 100644
index 2721f60..0000000
--- a/hotspot/src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/jdi/FieldImpl.java
+++ /dev/null
@@ -1,216 +0,0 @@
-/*
- * Copyright (c) 2002, 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.
- *
- * 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.jvm.hotspot.jdi;
-
-import com.sun.jdi.*;
-import sun.jvm.hotspot.oops.Oop;
-import sun.jvm.hotspot.oops.Instance;
-import sun.jvm.hotspot.oops.Array;
-import sun.jvm.hotspot.oops.InstanceKlass;
-import sun.jvm.hotspot.oops.Symbol;
-import sun.jvm.hotspot.oops.FieldIdentifier;
-
-import java.util.List;
-import java.util.Iterator;
-import java.util.ArrayList;
-import java.util.Comparator;
-
-public class FieldImpl extends TypeComponentImpl implements Field {
-    private JNITypeParser signatureParser;
-    private sun.jvm.hotspot.oops.Field saField;
-
-    FieldImpl( VirtualMachine vm, ReferenceTypeImpl declaringType,
-               sun.jvm.hotspot.oops.Field saField) {
-        super(vm, declaringType);
-        this.saField = saField;
-        getParser();
-    }
-
-    private void getParser() {
-        if (signatureParser == null) {
-            Symbol sig1 = saField.getSignature();
-            signature = sig1.asString();
-            signatureParser = new JNITypeParser(signature);
-        }
-    }
-
-    sun.jvm.hotspot.oops.Field ref() {
-        return saField;
-    }
-
-    // get the value of static field
-    ValueImpl getValue() {
-        return getValue(saField.getFieldHolder().getJavaMirror());
-    }
-
-    // get the value of this Field from a specific Oop
-    ValueImpl getValue(Oop target) {
-        ValueImpl valueImpl;
-        sun.jvm.hotspot.oops.Field saField = (sun.jvm.hotspot.oops.Field) ref();
-        sun.jvm.hotspot.oops.FieldType ft = saField.getFieldType();
-        if (ft.isArray()) {
-            sun.jvm.hotspot.oops.OopField of = (sun.jvm.hotspot.oops.OopField)saField;
-            valueImpl = (ArrayReferenceImpl) vm.arrayMirror((Array)of.getValue(target));
-        } else if (ft.isObject()) {
-            sun.jvm.hotspot.oops.OopField of = (sun.jvm.hotspot.oops.OopField)saField;
-            valueImpl = (ObjectReferenceImpl) vm.objectMirror(of.getValue(target));
-        } else if (ft.isByte()) {
-            sun.jvm.hotspot.oops.ByteField bf = (sun.jvm.hotspot.oops.ByteField)saField;
-            valueImpl = (ByteValueImpl) vm.mirrorOf(bf.getValue(target));
-        } else if (ft.isChar()) {
-            sun.jvm.hotspot.oops.CharField cf = (sun.jvm.hotspot.oops.CharField)saField;
-            valueImpl = (CharValueImpl) vm.mirrorOf(cf.getValue(target));
-        } else if (ft.isDouble()) {
-            sun.jvm.hotspot.oops.DoubleField df = (sun.jvm.hotspot.oops.DoubleField)saField;
-            valueImpl = (DoubleValueImpl) vm.mirrorOf(df.getValue(target));
-        } else if (ft.isFloat()) {
-            sun.jvm.hotspot.oops.FloatField ff = (sun.jvm.hotspot.oops.FloatField)saField;
-            valueImpl = (FloatValueImpl) vm.mirrorOf(ff.getValue(target));
-        } else if (ft.isInt()) {
-            sun.jvm.hotspot.oops.IntField iif = (sun.jvm.hotspot.oops.IntField)saField;
-            valueImpl = (IntegerValueImpl) vm.mirrorOf(iif.getValue(target));
-        } else if (ft.isLong()) {
-            sun.jvm.hotspot.oops.LongField lf = (sun.jvm.hotspot.oops.LongField)saField;
-            valueImpl = (LongValueImpl) vm.mirrorOf(lf.getValue(target));
-        } else if (ft.isShort()) {
-            sun.jvm.hotspot.oops.ShortField sf = (sun.jvm.hotspot.oops.ShortField)saField;
-            valueImpl = (ShortValueImpl) vm.mirrorOf(sf.getValue(target));
-        } else if (ft.isBoolean()) {
-            sun.jvm.hotspot.oops.BooleanField bf = (sun.jvm.hotspot.oops.BooleanField)saField;
-            valueImpl = (BooleanValueImpl) vm.mirrorOf(bf.getValue(target));
-        } else {
-            throw new RuntimeException("Should not reach here");
-        }
-        return valueImpl;
-    }
-
-    public boolean equals(Object obj) {
-        if ((obj != null) && (obj instanceof FieldImpl)) {
-            FieldImpl other = (FieldImpl)obj;
-            return (declaringType().equals(other.declaringType())) &&
-                (ref().equals(other.ref())) &&
-                super.equals(obj);
-        } else {
-            return false;
-        }
-    }
-
-    public boolean isTransient() {
-        return saField.isTransient();
-    }
-
-    public boolean isVolatile() {
-        return saField.isVolatile();
-    }
-
-    public boolean isEnumConstant() {
-        return saField.isEnumConstant();
-    }
-
-    public Type type() throws ClassNotLoadedException {
-        // So, we do it just like JDI does by searching the enclosing type.
-        return findType(signature());
-    }
-
-    public String typeName() { //fixme jjh: jpda version creates redundant JNITypeParsers
-        getParser();
-        return signatureParser.typeName();
-    }
-
-    public String genericSignature() {
-        Symbol genSig = saField.getGenericSignature();
-        return (genSig != null)? genSig.asString() : null;
-    }
-
-    // From interface Comparable
-    public int compareTo(Field field) {
-        ReferenceTypeImpl declaringType = (ReferenceTypeImpl)declaringType();
-        int rc = declaringType.compareTo(field.declaringType());
-        if (rc == 0) {
-            rc = declaringType.indexOf(this) -
-                declaringType.indexOf(field);
-        }
-        return rc;
-    }
-
-    // from interface Mirror
-    public String toString() {
-        StringBuffer buf = new StringBuffer();
-
-        buf.append(declaringType().name());
-        buf.append('.');
-        buf.append(name());
-        return buf.toString();
-    }
-
-    public String name() {
-        FieldIdentifier myName =  saField.getID();
-        return myName.getName();
-    }
-
-    // From interface Accessible
-    public int modifiers() {
-        return saField.getAccessFlagsObj().getStandardFlags();
-    }
-
-    public boolean isPackagePrivate() {
-        return saField.isPackagePrivate();
-    }
-
-    public boolean isPrivate() {
-        return saField.isPrivate();
-    }
-
-    public boolean isProtected() {
-        return saField.isProtected();
-    }
-
-    public boolean isPublic() {
-        return saField.isPublic();
-    }
-
-    public boolean isStatic() {
-        return saField.isStatic();
-    }
-
-    public boolean isFinal() {
-        return saField.isFinal();
-    }
-
-    public boolean isSynthetic() {
-        return saField.isSynthetic();
-    }
-
-    public int hashCode() {
-        return saField.hashCode();
-    }
-
-
-    private Type findType(String signature) throws ClassNotLoadedException {
-        ReferenceTypeImpl enclosing = (ReferenceTypeImpl)declaringType();
-        return enclosing.findType(signature);
-    }
-
-}
diff --git a/hotspot/src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/jdi/FloatTypeImpl.java b/hotspot/src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/jdi/FloatTypeImpl.java
deleted file mode 100644
index bf1b33e..0000000
--- a/hotspot/src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/jdi/FloatTypeImpl.java
+++ /dev/null
@@ -1,43 +0,0 @@
-/*
- * Copyright (c) 2002, 2003, 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 sun.jvm.hotspot.jdi;
-
-import com.sun.jdi.*;
-
-public class FloatTypeImpl extends PrimitiveTypeImpl implements FloatType {
-    FloatTypeImpl(VirtualMachine vm) {
-        super(vm);
-    }
-
-
-    public String signature() {
-        return "F";
-    }
-
-    PrimitiveValue convert(PrimitiveValue value) throws InvalidTypeException {
-        return vm.mirrorOf(((PrimitiveValueImpl)value).checkedFloatValue());
-    }
-
-}
diff --git a/hotspot/src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/jdi/FloatValueImpl.java b/hotspot/src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/jdi/FloatValueImpl.java
deleted file mode 100644
index e7bec5b..0000000
--- a/hotspot/src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/jdi/FloatValueImpl.java
+++ /dev/null
@@ -1,151 +0,0 @@
-/*
- * Copyright (c) 2002, 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.
- *
- * 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.jvm.hotspot.jdi;
-
-import com.sun.jdi.*;
-
-public class FloatValueImpl extends PrimitiveValueImpl
-                            implements FloatValue {
-    private float value;
-
-    FloatValueImpl(VirtualMachine aVm,float aValue) {
-        super(aVm);
-
-        value = aValue;
-    }
-
-    public boolean equals(Object obj) {
-        if ((obj != null) && (obj instanceof FloatValue)) {
-            return (value == ((FloatValue)obj).value()) &&
-                   super.equals(obj);
-        } else {
-            return false;
-        }
-    }
-
-    public int hashCode() {
-        /*
-         * TO DO: Better hash code
-         */
-        return intValue();
-    }
-
-    public int compareTo(FloatValue floatVal) {
-        float other = floatVal.value();
-        if (value() < other) {
-            return -1;
-        } else if (value() == other) {
-            return 0;
-        } else {
-            return 1;
-        }
-    }
-
-    public Type type() {
-        return vm.theFloatType();
-    }
-
-    public float value() {
-        return value;
-    }
-
-    public boolean booleanValue() {
-        return(value == 0.0)?false:true;
-    }
-
-    public byte byteValue() {
-        return(byte)value;
-    }
-
-    public char charValue() {
-        return(char)value;
-    }
-
-    public short shortValue() {
-        return(short)value;
-    }
-
-    public int intValue() {
-        return(int)value;
-    }
-
-    public long longValue() {
-        return(long)value;
-    }
-
-    public float floatValue() {
-        return(float)value;
-    }
-
-    public double doubleValue() {
-        return(double)value;
-    }
-
-    byte checkedByteValue() throws InvalidTypeException {
-        if ((value > Byte.MAX_VALUE) || (value < Byte.MIN_VALUE)) {
-            throw new InvalidTypeException("Can't convert " + value + " to byte");
-        } else {
-            return super.checkedByteValue();
-        }
-    }
-
-    char checkedCharValue() throws InvalidTypeException {
-        if ((value > Character.MAX_VALUE) || (value < Character.MIN_VALUE)) {
-            throw new InvalidTypeException("Can't convert " + value + " to char");
-        } else {
-            return super.checkedCharValue();
-        }
-    }
-
-    short checkedShortValue() throws InvalidTypeException {
-        if ((value > Short.MAX_VALUE) || (value < Short.MIN_VALUE)) {
-            throw new InvalidTypeException("Can't convert " + value + " to short");
-        } else {
-            return super.checkedShortValue();
-        }
-    }
-
-    int checkedIntValue() throws InvalidTypeException {
-        int intValue = (int)value;
-        if (intValue != value) {
-            throw new InvalidTypeException("Can't convert " + value + " to int");
-        } else {
-            return super.checkedIntValue();
-        }
-    }
-
-    long checkedLongValue() throws InvalidTypeException {
-        long longValue = (long)value;
-        if (longValue != value) {
-            throw new InvalidTypeException("Can't convert " + value + " to long");
-        } else {
-            return super.checkedLongValue();
-        }
-    }
-
-    public String toString() {
-        return "" + value;
-    }
-}
diff --git a/hotspot/src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/jdi/IntegerTypeImpl.java b/hotspot/src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/jdi/IntegerTypeImpl.java
deleted file mode 100644
index 60344b7..0000000
--- a/hotspot/src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/jdi/IntegerTypeImpl.java
+++ /dev/null
@@ -1,42 +0,0 @@
-/*
- * Copyright (c) 2002, 2003, 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 sun.jvm.hotspot.jdi;
-
-import com.sun.jdi.*;
-
-public class IntegerTypeImpl extends PrimitiveTypeImpl implements IntegerType {
-    IntegerTypeImpl(VirtualMachine vm) {
-        super(vm);
-    }
-
-    public String signature() {
-        return "I";
-    }
-
-    PrimitiveValue convert(PrimitiveValue value) throws InvalidTypeException {
-        return vm.mirrorOf(((PrimitiveValueImpl)value).checkedIntValue());
-    }
-
-}
diff --git a/hotspot/src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/jdi/IntegerValueImpl.java b/hotspot/src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/jdi/IntegerValueImpl.java
deleted file mode 100644
index 461686e..0000000
--- a/hotspot/src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/jdi/IntegerValueImpl.java
+++ /dev/null
@@ -1,126 +0,0 @@
-/*
- * Copyright (c) 2002, 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.
- *
- * 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.jvm.hotspot.jdi;
-
-import com.sun.jdi.*;
-
-public class IntegerValueImpl extends PrimitiveValueImpl
-                              implements IntegerValue {
-    private int value;
-
-    IntegerValueImpl(VirtualMachine aVm,int aValue) {
-        super(aVm);
-
-        value = aValue;
-    }
-
-    public boolean equals(Object obj) {
-        if ((obj != null) && (obj instanceof IntegerValue)) {
-            return (value == ((IntegerValue)obj).value()) &&
-                   super.equals(obj);
-        } else {
-            return false;
-        }
-    }
-
-    public int hashCode() {
-        /*
-         * TO DO: Better hash code
-         */
-        return intValue();
-    }
-
-    public int compareTo(IntegerValue integerVal) {
-        return value() - integerVal.value();
-    }
-
-    public Type type() {
-        return vm.theIntegerType();
-    }
-
-    public int value() {
-        return value;
-    }
-
-    public boolean booleanValue() {
-        return(value == 0)?false:true;
-    }
-
-    public byte byteValue() {
-        return(byte)value;
-    }
-
-    public char charValue() {
-        return(char)value;
-    }
-
-    public short shortValue() {
-        return(short)value;
-    }
-
-    public int intValue() {
-        return(int)value;
-    }
-
-    public long longValue() {
-        return(long)value;
-    }
-
-    public float floatValue() {
-        return(float)value;
-    }
-
-    public double doubleValue() {
-        return(double)value;
-    }
-
-    byte checkedByteValue() throws InvalidTypeException {
-        if ((value > Byte.MAX_VALUE) || (value < Byte.MIN_VALUE)) {
-            throw new InvalidTypeException("Can't convert " + value + " to byte");
-        } else {
-            return super.checkedByteValue();
-        }
-    }
-
-    char checkedCharValue() throws InvalidTypeException {
-        if ((value > Character.MAX_VALUE) || (value < Character.MIN_VALUE)) {
-            throw new InvalidTypeException("Can't convert " + value + " to char");
-        } else {
-            return super.checkedCharValue();
-        }
-    }
-
-    short checkedShortValue() throws InvalidTypeException {
-        if ((value > Short.MAX_VALUE) || (value < Short.MIN_VALUE)) {
-            throw new InvalidTypeException("Can't convert " + value + " to short");
-        } else {
-            return super.checkedShortValue();
-        }
-    }
-
-    public String toString() {
-        return "" + value;
-    }
-}
diff --git a/hotspot/src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/jdi/InterfaceTypeImpl.java b/hotspot/src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/jdi/InterfaceTypeImpl.java
deleted file mode 100644
index 4bc4201..0000000
--- a/hotspot/src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/jdi/InterfaceTypeImpl.java
+++ /dev/null
@@ -1,215 +0,0 @@
-/*
- * Copyright (c) 2002, 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.
- *
- * 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.jvm.hotspot.jdi;
-
-import java.lang.ref.SoftReference;
-import java.util.ArrayList;
-import java.util.Collections;
-import java.util.Iterator;
-import java.util.List;
-import java.util.Map;
-import java.util.Set;
-
-import sun.jvm.hotspot.oops.InstanceKlass;
-
-import com.sun.jdi.ClassNotPreparedException;
-import com.sun.jdi.ClassType;
-import com.sun.jdi.InterfaceType;
-import com.sun.jdi.Method;
-import com.sun.jdi.ReferenceType;
-import com.sun.jdi.VirtualMachine;
-
-public class InterfaceTypeImpl extends ReferenceTypeImpl
-                               implements InterfaceType {
-    private SoftReference superInterfacesCache = null;
-    private SoftReference subInterfacesCache = null;
-    private SoftReference implementorsCache = null;
-
-    protected InterfaceTypeImpl(VirtualMachine aVm, InstanceKlass aRef) {
-        super(aVm, aRef);
-    }
-
-    public List superinterfaces() throws ClassNotPreparedException {
-        List superinterfaces = (superInterfacesCache != null)? (List) superInterfacesCache.get() : null;
-        if (superinterfaces == null) {
-            checkPrepared();
-            superinterfaces = Collections.unmodifiableList(getInterfaces());
-            superInterfacesCache = new SoftReference(superinterfaces);
-        }
-        return superinterfaces;
-    }
-
-    public List subinterfaces() {
-        List subinterfaces = (subInterfacesCache != null)? (List) subInterfacesCache.get() : null;
-        if (subinterfaces == null) {
-            List all = vm.allClasses();
-            subinterfaces = new ArrayList();
-            Iterator iter = all.iterator();
-            while (iter.hasNext()) {
-                ReferenceType refType = (ReferenceType)iter.next();
-                if (refType instanceof InterfaceType) {
-                    InterfaceType interfaze = (InterfaceType)refType;
-                    if (interfaze.isPrepared() && interfaze.superinterfaces().contains(this)) {
-                        subinterfaces.add(interfaze);
-                    }
-               }
-            }
-            subinterfaces = Collections.unmodifiableList(subinterfaces);
-            subInterfacesCache = new SoftReference(subinterfaces);
-        }
-        return subinterfaces;
-    }
-
-    public List implementors() {
-        List implementors = (implementorsCache != null)? (List) implementorsCache.get() : null;
-        if (implementors == null) {
-            List all = vm.allClasses();
-            implementors = new ArrayList();
-            Iterator iter = all.iterator();
-            while (iter.hasNext()) {
-                ReferenceType refType = (ReferenceType)iter.next();
-                if (refType instanceof ClassType) {
-                    ClassType clazz = (ClassType)refType;
-                    if (clazz.isPrepared() && clazz.interfaces().contains(this)) {
-                        implementors.add(clazz);
-                    }
-                }
-            }
-            implementors = Collections.unmodifiableList(implementors);
-            implementorsCache = new SoftReference(implementors);
-        }
-        return implementors;
-    }
-
-    @Override
-    void addVisibleMethods(Map<String, Method> methodMap, Set<InterfaceType> seenInterfaces) {
-        /*
-         * Add methods from
-         * parent types first, so that the methods in this class will
-         * overwrite them in the hash table
-         */
-        Iterator<InterfaceType> iter = superinterfaces().iterator();
-        while (iter.hasNext()) {
-            InterfaceTypeImpl interfaze = (InterfaceTypeImpl)iter.next();
-            if (!seenInterfaces.contains(interfaze)) {
-                interfaze.addVisibleMethods(methodMap, seenInterfaces);
-                seenInterfaces.add(interfaze);
-            }
-        }
-
-        addToMethodMap(methodMap, methods());
-    }
-
-    List getAllMethods() {
-        ArrayList list = new ArrayList(methods());
-        /*
-         * It's more efficient if don't do this
-         * recursively.
-         */
-        List interfaces = allSuperinterfaces();
-        Iterator iter = interfaces.iterator();
-        while (iter.hasNext()) {
-            InterfaceType interfaze = (InterfaceType)iter.next();
-            list.addAll(interfaze.methods());
-        }
-
-        return list;
-    }
-
-    List allSuperinterfaces() {
-        ArrayList list = new ArrayList();
-        addSuperinterfaces(list);
-        return list;
-    }
-
-    void addSuperinterfaces(List list) {
-        /*
-         * This code is a little strange because it
-         * builds the list with a more suitable order than the
-         * depth-first approach a normal recursive solution would
-         * take. Instead, all direct superinterfaces precede all
-         * indirect ones.
-         */
-
-        /*
-         * Get a list of direct superinterfaces that's not already in the
-         * list being built.
-         */
-        List immediate = new ArrayList(superinterfaces());
-        Iterator iter = immediate.iterator();
-        while (iter.hasNext()) {
-            InterfaceType interfaze = (InterfaceType)iter.next();
-            if (list.contains(interfaze)) {
-                iter.remove();
-            }
-        }
-
-        /*
-         * Add all new direct superinterfaces
-         */
-        list.addAll(immediate);
-
-        /*
-         * Recurse for all new direct superinterfaces.
-         */
-        iter = immediate.iterator();
-        while (iter.hasNext()) {
-            InterfaceTypeImpl interfaze = (InterfaceTypeImpl)iter.next();
-            interfaze.addSuperinterfaces(list);
-        }
-    }
-
-    boolean isAssignableTo(ReferenceType type) {
-
-        // Exact match?
-        if (this.equals(type)) {
-            return true;
-        } else {
-            // Try superinterfaces.
-            List supers = superinterfaces();
-            Iterator iter = supers.iterator();
-            while (iter.hasNext()) {
-                InterfaceTypeImpl interfaze = (InterfaceTypeImpl)iter.next();
-                if (interfaze.isAssignableTo(type)) {
-                    return true;
-                }
-            }
-
-            return false;
-        }
-    }
-
-    List inheritedTypes() {
-        return superinterfaces();
-    }
-
-    public boolean isInitialized() {
-        return isPrepared();
-    }
-
-    public String toString() {
-       return "interface " + name() + " (" + loaderString() + ")";
-    }
-}
diff --git a/hotspot/src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/jdi/JNITypeParser.java b/hotspot/src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/jdi/JNITypeParser.java
deleted file mode 100644
index 031734c..0000000
--- a/hotspot/src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/jdi/JNITypeParser.java
+++ /dev/null
@@ -1,240 +0,0 @@
-/*
- * Copyright (c) 2002, 2003, 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 sun.jvm.hotspot.jdi;
-
-import java.util.List;
-import java.util.ArrayList;
-
-public class JNITypeParser {
-
-    static final char SIGNATURE_ENDCLASS = ';';
-    static final char SIGNATURE_FUNC = '(';
-    static final char SIGNATURE_ENDFUNC = ')';
-
-    private String signature;
-    private List typeNameList;
-    private List signatureList;
-    private int currentIndex;
-
-    JNITypeParser(String signature) {
-        this.signature = signature;
-    }
-
-    static String typeNameToSignature(String signature) {
-        StringBuffer buffer = new StringBuffer();
-        int firstIndex = signature.indexOf('[');
-        int index = firstIndex;
-        while (index != -1) {
-            buffer.append('[');
-            index = signature.indexOf('[', index + 1);
-        }
-
-        if (firstIndex != -1) {
-            signature = signature.substring(0, firstIndex);
-        }
-
-        if (signature.equals("boolean")) {
-            buffer.append('Z');
-        } else if (signature.equals("byte")) {
-            buffer.append('B');
-        } else if (signature.equals("char")) {
-            buffer.append('C');
-        } else if (signature.equals("short")) {
-            buffer.append('S');
-        } else if (signature.equals("int")) {
-            buffer.append('I');
-        } else if (signature.equals("long")) {
-            buffer.append('J');
-        } else if (signature.equals("float")) {
-            buffer.append('F');
-        } else if (signature.equals("double")) {
-            buffer.append('D');
-        } else {
-            buffer.append('L');
-            buffer.append(signature.replace('.', '/'));
-            buffer.append(';');
-        }
-
-        return buffer.toString();
-    }
-
-    String typeName() {
-        return (String)typeNameList().get(typeNameList().size()-1);
-    }
-
-    List argumentTypeNames() {
-        return typeNameList().subList(0, typeNameList().size() - 1);
-    }
-
-    String signature() {
-        return (String)signatureList().get(signatureList().size()-1);
-    }
-
-    List argumentSignatures() {
-        return signatureList().subList(0, signatureList().size() - 1);
-    }
-
-    int dimensionCount() {
-        int count = 0;
-        String signature = signature();
-        while (signature.charAt(count) == '[') {
-            count++;
-        }
-        return count;
-    }
-
-    String componentSignature(int level) {
-        return signature().substring(level);
-    }
-
-    private synchronized List signatureList() {
-        if (signatureList == null) {
-            signatureList = new ArrayList(10);
-            String elem;
-
-            currentIndex = 0;
-
-            while(currentIndex < signature.length()) {
-                elem = nextSignature();
-                signatureList.add(elem);
-            }
-            if (signatureList.size() == 0) {
-                throw new IllegalArgumentException("Invalid JNI signature '" +
-                                                   signature + "'");
-            }
-        }
-        return signatureList;
-    }
-
-    private synchronized List typeNameList() {
-        if (typeNameList == null) {
-            typeNameList = new ArrayList(10);
-            String elem;
-
-            currentIndex = 0;
-
-            while(currentIndex < signature.length()) {
-                elem = nextTypeName();
-                typeNameList.add(elem);
-            }
-            if (typeNameList.size() == 0) {
-                throw new IllegalArgumentException("Invalid JNI signature '" +
-                                                   signature + "'");
-            }
-        }
-        return typeNameList;
-    }
-
-    private String nextSignature() {
-        char key = signature.charAt(currentIndex++);
-
-        switch(key) {
-            case '[':
-                return  key + nextSignature();
-
-            case 'L':
-                int endClass = signature.indexOf(SIGNATURE_ENDCLASS,
-                                                 currentIndex);
-                String retVal = signature.substring(currentIndex - 1,
-                                                    endClass + 1);
-                currentIndex = endClass + 1;
-                return retVal;
-
-            case 'V':
-            case 'Z':
-            case 'B':
-            case 'C':
-            case 'S':
-            case 'I':
-            case 'J':
-            case 'F':
-            case 'D':
-                return String.valueOf(key);
-
-            case SIGNATURE_FUNC:
-            case SIGNATURE_ENDFUNC:
-                return nextSignature();
-
-            default:
-                throw new IllegalArgumentException(
-                    "Invalid JNI signature character '" + key + "'");
-
-        }
-    }
-
-    private String nextTypeName() {
-        char key = signature.charAt(currentIndex++);
-
-        switch(key) {
-            case '[':
-                return  nextTypeName() + "[]";
-
-            case 'B':
-                return "byte";
-
-            case 'C':
-                return "char";
-
-            case 'L':
-                int endClass = signature.indexOf(SIGNATURE_ENDCLASS,
-                                                 currentIndex);
-                String retVal = signature.substring(currentIndex,
-                                                    endClass);
-                retVal = retVal.replace('/','.');
-                currentIndex = endClass + 1;
-                return retVal;
-
-            case 'F':
-                return "float";
-
-            case 'D':
-                return "double";
-
-            case 'I':
-                return "int";
-
-            case 'J':
-                return "long";
-
-            case 'S':
-                return "short";
-
-            case 'V':
-                return "void";
-
-            case 'Z':
-                return "boolean";
-
-            case SIGNATURE_ENDFUNC:
-            case SIGNATURE_FUNC:
-                return nextTypeName();
-
-            default:
-                throw new IllegalArgumentException(
-                    "Invalid JNI signature character '" + key + "'");
-
-        }
-    }
-}
diff --git a/hotspot/src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/jdi/JVMTIThreadState.java b/hotspot/src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/jdi/JVMTIThreadState.java
deleted file mode 100644
index 0dcb772..0000000
--- a/hotspot/src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/jdi/JVMTIThreadState.java
+++ /dev/null
@@ -1,42 +0,0 @@
-/*
- * Copyright (c) 2004, 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.
- *
- * 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.jvm.hotspot.jdi;
-
-// from JVMTI specification - refer to jvmti.xml
-public interface JVMTIThreadState {
-    public static final int JVMTI_THREAD_STATE_ALIVE = 0x0001;
-    public static final int JVMTI_THREAD_STATE_TERMINATED = 0x0002;
-    public static final int JVMTI_THREAD_STATE_RUNNABLE = 0x0004;
-    public static final int JVMTI_THREAD_STATE_WAITING = 0x0080;
-    public static final int JVMTI_THREAD_STATE_WAITING_INDEFINITELY = 0x0010;
-    public static final int JVMTI_THREAD_STATE_WAITING_WITH_TIMEOUT = 0x0020;
-    public static final int JVMTI_THREAD_STATE_SLEEPING = 0x0040;
-    public static final int JVMTI_THREAD_STATE_IN_OBJECT_WAIT = 0x0100;
-    public static final int JVMTI_THREAD_STATE_PARKED = 0x0200;
-    public static final int JVMTI_THREAD_STATE_BLOCKED_ON_MONITOR_ENTER = 0x0400;
-    public static final int JVMTI_THREAD_STATE_SUSPENDED = 0x100000;
-    public static final int JVMTI_THREAD_STATE_INTERRUPTED = 0x200000;
-    public static final int JVMTI_THREAD_STATE_IN_NATIVE = 0x400000;
-}
diff --git a/hotspot/src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/jdi/LineInfo.java b/hotspot/src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/jdi/LineInfo.java
deleted file mode 100644
index 840c077..0000000
--- a/hotspot/src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/jdi/LineInfo.java
+++ /dev/null
@@ -1,38 +0,0 @@
-/*
- * Copyright (c) 2002, 2003, 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 sun.jvm.hotspot.jdi;
-
-import com.sun.jdi.*;
-
-interface LineInfo {
-
-    String liStratum();
-
-    int liLineNumber();
-
-    String liSourceName() throws AbsentInformationException;
-
-    String liSourcePath() throws AbsentInformationException;
-}
diff --git a/hotspot/src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/jdi/LocalVariableImpl.java b/hotspot/src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/jdi/LocalVariableImpl.java
deleted file mode 100644
index da3ed8c..0000000
--- a/hotspot/src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/jdi/LocalVariableImpl.java
+++ /dev/null
@@ -1,169 +0,0 @@
-/*
- * Copyright (c) 2002, 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.
- *
- * 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.jvm.hotspot.jdi;
-import com.sun.jdi.*;
-
-public class LocalVariableImpl extends MirrorImpl
-                               implements LocalVariable, ValueContainer
-{
-    private final Method method;
-    private final int slot;
-    private final Location scopeStart;
-    private final Location scopeEnd;
-    private final String name;
-    private final String signature;
-    private final String genericSignature;
-
-    LocalVariableImpl(VirtualMachine vm, Method method,
-                      int slot, Location scopeStart, Location scopeEnd,
-                      String name, String signature, String genericSignature) {
-        super(vm);
-        this.method = method;
-        this.slot = slot;
-        this.scopeStart = scopeStart;
-        this.scopeEnd = scopeEnd;
-        this.name = name;
-        this.signature = signature;
-        this.genericSignature = genericSignature;
-    }
-
-    public boolean equals(Object obj) {
-        if ((obj != null) && (obj instanceof LocalVariableImpl)) {
-            LocalVariableImpl other = (LocalVariableImpl)obj;
-            return (method.equals(other.method) &&
-                    slot() == other.slot() &&
-                    super.equals(obj));
-        } else {
-            return false;
-        }
-    }
-
-    public int hashCode() {
-        /*
-         * TO DO: Better hash code
-         */
-        return (int)method.hashCode() + slot();
-    }
-
-    public int compareTo(LocalVariable localVar) {
-        LocalVariableImpl other = (LocalVariableImpl) localVar;
-        int rc = method.compareTo(other.method);
-        if (rc == 0) {
-            rc = slot() - other.slot();
-        }
-        return rc;
-    }
-
-    public String name() {
-        return name;
-    }
-
-    /**
-     * @return a text representation of the declared type
-     * of this variable.
-     */
-    public String typeName() {
-        JNITypeParser parser = new JNITypeParser(signature);
-        return parser.typeName();
-    }
-
-    public Type type() throws ClassNotLoadedException {
-        return findType(signature());
-    }
-
-    public Type findType(String signature) throws ClassNotLoadedException {
-        ReferenceTypeImpl enclosing = (ReferenceTypeImpl)method.declaringType();
-        return enclosing.findType(signature);
-    }
-
-    public String signature() {
-        return signature;
-    }
-
-    public String genericSignature() {
-        return genericSignature;
-    }
-
-    public boolean isVisible(StackFrame frame) {
-        //validateMirror(frame);
-        Method frameMethod = frame.location().method();
-
-        if (!frameMethod.equals(method)) {
-            throw new IllegalArgumentException(
-                       "frame method different than variable's method");
-        }
-
-        // this is here to cover the possibility that we will
-        // allow LocalVariables for native methods.  If we do
-        // so we will have to re-examinine this.
-        if (frameMethod.isNative()) {
-            return false;
-        }
-
-        return ((scopeStart.compareTo(frame.location()) <= 0)
-             && (scopeEnd.compareTo(frame.location()) >= 0));
-    }
-
-    public boolean isArgument() {
-        try {
-            MethodImpl method = (MethodImpl)scopeStart.method();
-            return (slot < method.argSlotCount());
-        } catch (AbsentInformationException e) {
-            // If this variable object exists, there shouldn't be absent info
-            throw (InternalException) new InternalException().initCause(e);
-        }
-    }
-
-    int slot() {
-        return slot;
-    }
-
-    /*
-     * Compilers/VMs can have byte code ranges for variables of the
-     * same names that overlap. This is because the byte code ranges
-     * aren't necessarily scopes; they may have more to do with the
-     * lifetime of the variable's slot, depending on implementation.
-     *
-     * This method determines whether this variable hides an
-     * identically named variable; ie, their byte code ranges overlap
-     * this one starts after the given one. If it returns true this
-     * variable should be preferred when looking for a single variable
-     * with its name when both variables are visible.
-     */
-    boolean hides(LocalVariable other) {
-        LocalVariableImpl otherImpl = (LocalVariableImpl)other;
-        if (!method.equals(otherImpl.method) ||
-            !name.equals(otherImpl.name)) {
-            return false;
-        } else {
-            return (scopeStart.compareTo(otherImpl.scopeStart) > 0);
-        }
-    }
-
-    public String toString() {
-       return name() + " in " + method.toString() +
-              "@" + scopeStart.toString();
-    }
-}
diff --git a/hotspot/src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/jdi/LocationImpl.java b/hotspot/src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/jdi/LocationImpl.java
deleted file mode 100644
index ab686ac..0000000
--- a/hotspot/src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/jdi/LocationImpl.java
+++ /dev/null
@@ -1,224 +0,0 @@
-/*
- * Copyright (c) 2002, 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.
- *
- * 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.jvm.hotspot.jdi;
-
-import com.sun.jdi.*;
-
-import java.util.*;
-
-public class LocationImpl extends MirrorImpl implements Location {
-    private final ReferenceTypeImpl declaringType;
-    private Method method;
-    private sun.jvm.hotspot.oops.Method methodRef;
-    private long codeIndex;
-    private LineInfo baseLineInfo = null;
-    private LineInfo otherLineInfo = null;
-
-    LocationImpl(VirtualMachine vm,
-                 Method method, long codeIndex) {
-        super(vm);
-
-        this.method = method;
-        this.codeIndex = method.isNative()? -1 : codeIndex;
-        this.declaringType = (ReferenceTypeImpl)method.declaringType();
-    }
-
-    /*
-     * This constructor allows lazy creation of the method mirror. This
-     * can be a performance savings if the method mirror does not yet
-     * exist.
-     */
-    LocationImpl(VirtualMachine vm, ReferenceType declaringType,
-                 sun.jvm.hotspot.oops.Method methodRef, long codeIndex) {
-        super(vm);
-
-        this.method = null;
-        this.codeIndex = codeIndex;
-        this.declaringType = (ReferenceTypeImpl)declaringType;
-        this.methodRef = methodRef;
-    }
-
-    public boolean equals(Object obj) {
-        if ((obj != null) && (obj instanceof Location)) {
-            Location other = (Location)obj;
-            return (method().equals(other.method())) &&
-                   (codeIndex() == other.codeIndex()) &&
-                   super.equals(obj);
-        } else {
-            return false;
-        }
-    }
-
-    public int hashCode() {
-        /*
-         * TO DO: better hash code?
-         */
-        return method().hashCode() + (int)codeIndex();
-    }
-
-    public int compareTo(Location other) {
-        int rc = method().compareTo(other.method());
-        if (rc == 0) {
-            long diff = codeIndex() - other.codeIndex();
-            if (diff < 0)
-                return -1;
-            else if (diff > 0)
-                return 1;
-            else
-                return 0;
-        }
-        return rc;
-    }
-
-    public ReferenceType declaringType() {
-        return declaringType;
-    }
-
-    public Method method() {
-        if (method == null) {
-            method = declaringType.getMethodMirror(methodRef);
-            if (method.isNative()) {
-                codeIndex = -1;
-            }
-        }
-        return method;
-    }
-
-    public long codeIndex() {
-        method();  // be sure information is up-to-date
-        return codeIndex;
-    }
-
-    LineInfo getBaseLineInfo(SDE.Stratum stratum) {
-        LineInfo lineInfo;
-
-        /* check if there is cached info to use */
-        if (baseLineInfo != null) {
-            return baseLineInfo;
-        }
-
-        /* compute the line info */
-        MethodImpl methodImpl = (MethodImpl)method();
-         lineInfo = methodImpl.codeIndexToLineInfo(stratum,
-                                                   codeIndex());
-
-        /* cache it */
-        addBaseLineInfo(lineInfo);
-
-        return lineInfo;
-    }
-
-    LineInfo getLineInfo(SDE.Stratum stratum) {
-        LineInfo lineInfo;
-
-        /* base stratum is done slighly differently */
-        if (stratum.isJava()) {
-            return getBaseLineInfo(stratum);
-        }
-
-        /* check if there is cached info to use */
-        lineInfo = otherLineInfo; // copy because of concurrency
-        if (lineInfo != null &&
-                           stratum.id().equals(lineInfo.liStratum())) {
-            return lineInfo;
-        }
-        int baseLineNumber = lineNumber(SDE.BASE_STRATUM_NAME);
-        SDE.LineStratum lineStratum =
-                  stratum.lineStratum(declaringType, baseLineNumber);
-
-        if (lineStratum != null && lineStratum.lineNumber() != -1) {
-            lineInfo = new StratumLineInfo(stratum.id(),
-                                           lineStratum.lineNumber(),
-                                           lineStratum.sourceName(),
-                                           lineStratum.sourcePath());
-        } else {
-            /* find best match */
-            MethodImpl methodImpl = (MethodImpl)method();
-            lineInfo = methodImpl.codeIndexToLineInfo(stratum,
-                                                      codeIndex());
-        }
-
-        /* cache it */
-        addStratumLineInfo(lineInfo);
-
-        return lineInfo;
-    }
-
-    void addStratumLineInfo(LineInfo lineInfo) {
-        otherLineInfo = lineInfo;
-    }
-
-    void addBaseLineInfo(LineInfo lineInfo) {
-        baseLineInfo = lineInfo;
-    }
-
-    public String sourceName() throws AbsentInformationException {
-        return sourceName(vm.getDefaultStratum());
-    }
-
-    public String sourceName(String stratumID)
-                               throws AbsentInformationException {
-        return sourceName(declaringType.stratum(stratumID));
-    }
-
-    String sourceName(SDE.Stratum stratum)
-                               throws AbsentInformationException {
-        return getLineInfo(stratum).liSourceName();
-    }
-
-    public String sourcePath() throws AbsentInformationException {
-        return sourcePath(vm.getDefaultStratum());
-    }
-
-    public String sourcePath(String stratumID)
-                               throws AbsentInformationException {
-        return sourcePath(declaringType.stratum(stratumID));
-    }
-
-    String sourcePath(SDE.Stratum stratum)
-                               throws AbsentInformationException {
-        return getLineInfo(stratum).liSourcePath();
-    }
-
-    public int lineNumber() {
-        return lineNumber(vm.getDefaultStratum());
-    }
-
-    public int lineNumber(String stratumID) {
-        return lineNumber(declaringType.stratum(stratumID));
-    }
-
-    int lineNumber(SDE.Stratum stratum) {
-        return getLineInfo(stratum).liLineNumber();
-    }
-
-    public String toString() {
-        if (lineNumber() == -1) {
-            return method().toString() + "+" + codeIndex();
-        } else {
-            return declaringType().name() + ":" + lineNumber();
-        }
-    }
-}
diff --git a/hotspot/src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/jdi/LongTypeImpl.java b/hotspot/src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/jdi/LongTypeImpl.java
deleted file mode 100644
index e941cd6..0000000
--- a/hotspot/src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/jdi/LongTypeImpl.java
+++ /dev/null
@@ -1,43 +0,0 @@
-/*
- * Copyright (c) 2002, 2003, 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 sun.jvm.hotspot.jdi;
-
-import com.sun.jdi.*;
-
-public class LongTypeImpl extends PrimitiveTypeImpl implements LongType {
-    LongTypeImpl(VirtualMachine vm) {
-        super(vm);
-    }
-
-
-    public String signature() {
-        return "J";
-    }
-
-    PrimitiveValue convert(PrimitiveValue value) throws InvalidTypeException {
-        return vm.mirrorOf(((PrimitiveValueImpl)value).checkedLongValue());
-    }
-
-}
diff --git a/hotspot/src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/jdi/LongValueImpl.java b/hotspot/src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/jdi/LongValueImpl.java
deleted file mode 100644
index da41844..0000000
--- a/hotspot/src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/jdi/LongValueImpl.java
+++ /dev/null
@@ -1,141 +0,0 @@
-/*
- * Copyright (c) 2002, 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.
- *
- * 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.jvm.hotspot.jdi;
-
-import com.sun.jdi.*;
-
-public class LongValueImpl extends PrimitiveValueImpl
-                           implements LongValue {
-    private long value;
-
-    LongValueImpl(VirtualMachine aVm,long aValue) {
-        super(aVm);
-
-        value = aValue;
-    }
-
-    public boolean equals(Object obj) {
-        if ((obj != null) && (obj instanceof LongValue)) {
-            return (value == ((LongValue)obj).value()) &&
-                   super.equals(obj);
-        } else {
-            return false;
-        }
-    }
-
-    public int hashCode() {
-        /*
-         * TO DO: Better hash code
-         */
-        return intValue();
-    }
-
-    public int compareTo(LongValue longVal) {
-        long other = longVal.value();
-        if (value() < other) {
-            return -1;
-        } else if (value() == other) {
-            return 0;
-        } else {
-            return 1;
-        }
-    }
-
-    public Type type() {
-        return vm.theLongType();
-    }
-
-    public long value() {
-        return value;
-    }
-
-    public boolean booleanValue() {
-        return(value == 0)?false:true;
-    }
-
-    public byte byteValue() {
-        return(byte)value;
-    }
-
-    public char charValue() {
-        return(char)value;
-    }
-
-    public short shortValue() {
-        return(short)value;
-    }
-
-    public int intValue() {
-        return(int)value;
-    }
-
-    public long longValue() {
-        return(long)value;
-    }
-
-    public float floatValue() {
-        return(float)value;
-    }
-
-    public double doubleValue() {
-        return(double)value;
-    }
-
-    byte checkedByteValue() throws InvalidTypeException {
-        if ((value > Byte.MAX_VALUE) || (value < Byte.MIN_VALUE)) {
-            throw new InvalidTypeException("Can't convert " + value + " to byte");
-        } else {
-            return super.checkedByteValue();
-        }
-    }
-
-    char checkedCharValue() throws InvalidTypeException {
-        if ((value > Character.MAX_VALUE) || (value < Character.MIN_VALUE)) {
-            throw new InvalidTypeException("Can't convert " + value + " to char");
-        } else {
-            return super.checkedCharValue();
-        }
-    }
-
-    short checkedShortValue() throws InvalidTypeException {
-        if ((value > Short.MAX_VALUE) || (value < Short.MIN_VALUE)) {
-            throw new InvalidTypeException("Can't convert " + value + " to short");
-        } else {
-            return super.checkedShortValue();
-        }
-    }
-
-    int checkedIntValue() throws InvalidTypeException {
-        if ((value > Integer.MAX_VALUE) || (value < Integer.MIN_VALUE)) {
-            throw new InvalidTypeException("Can't convert " + value + " to int");
-        } else {
-            return super.checkedIntValue();
-        }
-    }
-
-    public String toString() {
-        return "" + value;
-    }
-}
diff --git a/hotspot/src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/jdi/MethodImpl.java b/hotspot/src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/jdi/MethodImpl.java
deleted file mode 100644
index 5853a91..0000000
--- a/hotspot/src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/jdi/MethodImpl.java
+++ /dev/null
@@ -1,272 +0,0 @@
-/*
- * Copyright (c) 2002, 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.
- *
- * 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.jvm.hotspot.jdi;
-
-import com.sun.jdi.*;
-import sun.jvm.hotspot.oops.Symbol;
-import sun.jvm.hotspot.oops.LocalVariableTableElement;
-import java.util.List;
-import java.util.Iterator;
-import java.util.ArrayList;
-import java.util.Comparator;
-import java.lang.ref.SoftReference;
-import java.util.Collections;
-
-public abstract class MethodImpl extends TypeComponentImpl implements Method {
-    private JNITypeParser signatureParser;
-    protected sun.jvm.hotspot.oops.Method saMethod;
-
-    abstract int argSlotCount() throws AbsentInformationException;
-    abstract List allLineLocations(SDE.Stratum stratum,
-                                   String sourceName)
-                           throws AbsentInformationException;
-    abstract List locationsOfLine(SDE.Stratum stratum,
-                                  String sourceName,
-                                  int lineNumber)
-                           throws AbsentInformationException;
-
-    static MethodImpl createMethodImpl(VirtualMachine vm, ReferenceTypeImpl declaringType,
-                                       sun.jvm.hotspot.oops.Method saMethod) {
-        // Someday might have to add concrete and non-concrete subclasses.
-        if (saMethod.isNative() || saMethod.isAbstract()) {
-            return new NonConcreteMethodImpl(vm, declaringType, saMethod);
-        } else {
-            return new ConcreteMethodImpl(vm, declaringType, saMethod);
-        }
-    }
-
-    MethodImpl(VirtualMachine vm, ReferenceTypeImpl declaringType,
-               sun.jvm.hotspot.oops.Method saMethod ) {
-        super(vm, declaringType);
-        this.saMethod = saMethod;
-        getParser();
-    }
-
-    private JNITypeParser getParser() {
-        if (signatureParser == null) {
-            Symbol sig1 = saMethod.getSignature();
-            signature = sig1.asString();
-            signatureParser = new JNITypeParser(signature);
-        }
-        return signatureParser;
-    }
-
-    // Object ref() {
-    sun.jvm.hotspot.oops.Method ref() {
-        return saMethod;
-    }
-
-    public String genericSignature() {
-        Symbol genSig = saMethod.getGenericSignature();
-        return (genSig != null)? genSig.asString() : null;
-    }
-
-    public String returnTypeName() {
-        return getParser().typeName();
-    }
-
-    public Type returnType() throws ClassNotLoadedException {
-        return findType(getParser().signature());
-    }
-
-    private Type findType(String signature) throws ClassNotLoadedException {
-        ReferenceTypeImpl enclosing = (ReferenceTypeImpl)declaringType();
-        return enclosing.findType(signature);
-    }
-
-    public List argumentTypeNames() {
-        return getParser().argumentTypeNames();
-    }
-
-    List argumentSignatures() {
-        return getParser().argumentSignatures();
-    }
-
-    Type argumentType(int index) throws ClassNotLoadedException {
-        ReferenceTypeImpl enclosing = (ReferenceTypeImpl)declaringType();
-        String signature = (String)argumentSignatures().get(index);
-        return enclosing.findType(signature);
-    }
-
-    public List argumentTypes() throws ClassNotLoadedException {
-        int size = argumentSignatures().size();
-        ArrayList types = new ArrayList(size);
-        for (int i = 0; i < size; i++) {
-            Type type = argumentType(i);
-            types.add(type);
-        }
-        return types;
-    }
-
-    public boolean isAbstract() {
-        return saMethod.isAbstract();
-    }
-
-    public boolean isBridge() {
-        return saMethod.isBridge();
-    }
-
-    public boolean isSynchronized() {
-        return saMethod.isSynchronized();
-    }
-
-    public boolean isNative() {
-        return saMethod.isNative();
-    }
-
-    public boolean isVarArgs() {
-        return saMethod.isVarArgs();
-    }
-
-    public boolean isConstructor() {
-        return saMethod.isConstructor();
-    }
-
-    public boolean isStaticInitializer() {
-        return saMethod.isStaticInitializer();
-    }
-
-    public boolean isObsolete() {
-        return saMethod.isObsolete();
-    }
-
-    public final List allLineLocations()
-                           throws AbsentInformationException {
-        return allLineLocations(vm.getDefaultStratum(), null);
-    }
-
-    public List allLineLocations(String stratumID,
-                                 String sourceName)
-                           throws AbsentInformationException {
-        return allLineLocations(declaringType.stratum(stratumID),
-                                sourceName);
-    }
-
-    public final List locationsOfLine(int lineNumber)
-                           throws AbsentInformationException {
-        return locationsOfLine(vm.getDefaultStratum(),
-                               null, lineNumber);
-    }
-
-    public List locationsOfLine(String stratumID,
-                                String sourceName,
-                                int lineNumber)
-                           throws AbsentInformationException {
-        return locationsOfLine(declaringType.stratum(stratumID),
-                               sourceName, lineNumber);
-    }
-
-    LineInfo codeIndexToLineInfo(SDE.Stratum stratum,
-                                 long codeIndex) {
-        if (stratum.isJava()) {
-            return new BaseLineInfo(-1, declaringType);
-        } else {
-            return new StratumLineInfo(stratum.id(), -1,
-                                       null, null);
-        }
-    }
-
-    public boolean equals(Object obj) {
-        if ((obj != null) && (obj instanceof MethodImpl)) {
-            MethodImpl other = (MethodImpl)obj;
-            return (declaringType().equals(other.declaringType())) &&
-                (ref().equals(other.ref())) &&
-                super.equals(obj);
-        } else {
-            return false;
-        }
-    }
-
-    // From interface Comparable
-    public int compareTo(Method method) {
-        ReferenceTypeImpl declaringType = (ReferenceTypeImpl)declaringType();
-         int rc = declaringType.compareTo(method.declaringType());
-         if (rc == 0) {
-           rc = declaringType.indexOf(this) -
-               declaringType.indexOf(method);
-         }
-         return rc;
-    }
-
-    // from interface Mirror
-    public String toString() {
-        StringBuffer sb = new StringBuffer();
-        sb.append(declaringType().name());
-        sb.append(".");
-        sb.append(name());
-        sb.append("(");
-        boolean first = true;
-        for (Iterator it = argumentTypeNames().iterator(); it.hasNext();) {
-            if (!first) {
-                sb.append(", ");
-            }
-            sb.append((String)it.next());
-            first = false;
-        }
-        sb.append(")");
-        return sb.toString();
-    }
-
-    public String name() {
-        Symbol myName = saMethod.getName();
-        return myName.asString();
-    }
-
-    public int modifiers() {
-        return saMethod.getAccessFlagsObj().getStandardFlags();
-    }
-
-    public boolean isPackagePrivate() {
-        return saMethod.isPackagePrivate();
-    }
-
-    public boolean isPrivate() {
-        return saMethod.isPrivate();
-    }
-
-    public boolean isProtected() {
-        return saMethod.isProtected();
-    }
-
-    public boolean isPublic() {
-        return saMethod.isPublic();
-    }
-
-    public boolean isStatic() {
-        return saMethod.isStatic();
-    }
-
-    public boolean isSynthetic() {
-        return saMethod.isSynthetic();
-    }
-
-    public boolean isFinal() {
-        return saMethod.isFinal();
-    }
-
-    public int hashCode() {
-        return saMethod.hashCode();
-    }
-}
diff --git a/hotspot/src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/jdi/MirrorImpl.java b/hotspot/src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/jdi/MirrorImpl.java
deleted file mode 100644
index cf61c1f..0000000
--- a/hotspot/src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/jdi/MirrorImpl.java
+++ /dev/null
@@ -1,57 +0,0 @@
-/*
- * Copyright (c) 2002, 2003, 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 sun.jvm.hotspot.jdi;
-
-import com.sun.jdi.*;
-
-abstract class MirrorImpl extends Object implements Mirror {
-    protected VirtualMachineImpl vm;
-
-    MirrorImpl(VirtualMachine aVm) {
-        super();
-
-        // Yes, its a bit of a hack. But by doing it this
-        // way, this is the only place we have to change
-        // typing to substitute a new impl.
-        vm = (VirtualMachineImpl)aVm;
-    }
-
-    public VirtualMachine virtualMachine() {
-        return vm;
-    }
-
-    public boolean equals(Object obj) {
-        if ((obj != null) && (obj instanceof Mirror)) {
-            Mirror other = (Mirror)obj;
-            return vm.equals(other.virtualMachine());
-        } else {
-            return false;
-        }
-    }
-
-    public int hashCode() {
-        return vm.hashCode();
-    }
-}
diff --git a/hotspot/src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/jdi/MonitorInfoImpl.java b/hotspot/src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/jdi/MonitorInfoImpl.java
deleted file mode 100644
index 3df6ef5..0000000
--- a/hotspot/src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/jdi/MonitorInfoImpl.java
+++ /dev/null
@@ -1,71 +0,0 @@
-/*
- * Copyright (c) 2005, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation.
- *
- * 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.jvm.hotspot.jdi;
-
-import com.sun.jdi.*;
-
-// FIXME: This class should implement com.sun.jdi.MonitorInfo.
-//        So fix this when hotspot is started to build with
-//        jdk1.6.
-public class MonitorInfoImpl extends MirrorImpl {
-
-    /* Once false, monitorInfo should not be used.
-     * access synchronized on (vm.state())
-     */
-    private boolean isValid = true;
-
-    ObjectReference monitor;
-    ThreadReference thread;
-    int  stack_depth;
-
-    MonitorInfoImpl(VirtualMachine vm, ObjectReference mon,
-                    ThreadReference thread, int dpth) {
-        super(vm);
-        this.monitor = mon;
-        this.thread = thread;
-        this.stack_depth = dpth;
-    }
-
-    private void validateMonitorInfo() {
-        if (!isValid) {
-            throw new InvalidStackFrameException("Thread has been resumed");
-        }
-    }
-
-    public ObjectReference monitor() {
-        validateMonitorInfo();
-        return monitor;
-    }
-
-    public int stackDepth() {
-        validateMonitorInfo();
-        return stack_depth;
-    }
-
-    public ThreadReference thread() {
-        validateMonitorInfo();
-        return thread;
-    }
-}
diff --git a/hotspot/src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/jdi/NonConcreteMethodImpl.java b/hotspot/src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/jdi/NonConcreteMethodImpl.java
deleted file mode 100644
index 45c4ba2..0000000
--- a/hotspot/src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/jdi/NonConcreteMethodImpl.java
+++ /dev/null
@@ -1,117 +0,0 @@
-/*
- * Copyright (c) 2002, 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 sun.jvm.hotspot.jdi;
-
-import com.sun.jdi.*;
-
-import java.util.List;
-import java.util.Map;
-import java.util.Iterator;
-import java.util.ListIterator;
-import java.util.HashMap;
-import java.util.ArrayList;
-import java.util.Collections;
-
-/**
- * Represents non-concrete (that is, native or abstract) methods.
- * Private to MethodImpl.
- */
-public class NonConcreteMethodImpl extends MethodImpl {
-
-    private Location location = null;
-
-    NonConcreteMethodImpl(VirtualMachine vm,
-                          ReferenceTypeImpl declaringType,
-                          sun.jvm.hotspot.oops.Method saMethod) {
-        super(vm, declaringType, saMethod);
-    }
-
-    public Location location() {
-        if (isAbstract()) {
-            return null;
-        }
-        if (location == null) {
-            location = new LocationImpl(vm, this, -1);
-        }
-        return location;
-    }
-
-    public List allLineLocations(String stratumID,
-                                 String sourceName) {
-        return new ArrayList(0);
-    }
-
-    public List allLineLocations(SDE.Stratum stratum,
-                                 String sourceName) {
-        return new ArrayList(0);
-    }
-
-    public List locationsOfLine(String stratumID,
-                                String sourceName,
-                                int lineNumber) {
-        return new ArrayList(0);
-    }
-
-    public List locationsOfLine(SDE.Stratum stratum,
-                                String sourceName,
-                                int lineNumber) {
-        return new ArrayList(0);
-    }
-
-    public Location locationOfCodeIndex(long codeIndex) {
-        return null;
-    }
-
-    LineInfo codeIndexToLineInfo(SDE.Stratum stratum,
-                                 long codeIndex) {
-
-        if (stratum.isJava()) {
-            return new BaseLineInfo(-1, declaringType);
-        } else {
-            return new StratumLineInfo(stratum.id(), -1,
-                                       null, null);
-        }
-    }
-
-    public List variables() throws AbsentInformationException {
-        throw new AbsentInformationException();
-    }
-
-    public List variablesByName(String name) throws AbsentInformationException {
-        throw new AbsentInformationException();
-    }
-
-    public List arguments() throws AbsentInformationException {
-        throw new AbsentInformationException();
-    }
-
-    public byte[] bytecodes() {
-        return new byte[0];
-    }
-
-    int argSlotCount() throws AbsentInformationException {
-        throw new InternalException("should not get here");
-    }
-}
diff --git a/hotspot/src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/jdi/ObjectReferenceImpl.java b/hotspot/src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/jdi/ObjectReferenceImpl.java
deleted file mode 100644
index c2b13f1..0000000
--- a/hotspot/src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/jdi/ObjectReferenceImpl.java
+++ /dev/null
@@ -1,367 +0,0 @@
-/*
- * Copyright (c) 2002, 2009, 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 sun.jvm.hotspot.jdi;
-
-import java.io.*;
-import com.sun.jdi.*;
-
-import sun.jvm.hotspot.debugger.Address;
-import sun.jvm.hotspot.debugger.OopHandle;
-import sun.jvm.hotspot.oops.Oop;
-import sun.jvm.hotspot.oops.Mark;
-import sun.jvm.hotspot.oops.Instance;
-import sun.jvm.hotspot.oops.Array;
-import sun.jvm.hotspot.oops.OopUtilities;
-import sun.jvm.hotspot.oops.Klass;
-import sun.jvm.hotspot.oops.DefaultHeapVisitor;
-import sun.jvm.hotspot.runtime.JavaThread;
-import sun.jvm.hotspot.runtime.JavaVFrame;
-import sun.jvm.hotspot.runtime.MonitorInfo;
-import sun.jvm.hotspot.runtime.ObjectMonitor;
-import sun.jvm.hotspot.runtime.Threads;
-import sun.jvm.hotspot.utilities.Assert;
-
-import java.util.*;
-
-public class ObjectReferenceImpl extends ValueImpl implements ObjectReference {
-    private Oop  saObject;
-    private long myID;
-    private boolean monitorInfoCached = false;
-    private ThreadReferenceImpl owningThread = null;
-    private List waitingThreads = null; // List<ThreadReferenceImpl>
-    private int entryCount = 0;
-
-    private static long nextID = 0L;
-    private static synchronized long nextID() {
-        return nextID++;
-    }
-
-    ObjectReferenceImpl(VirtualMachine aVm, sun.jvm.hotspot.oops.Oop oRef) {
-        super(aVm);
-        saObject = oRef;
-        myID = nextID();
-    }
-
-    protected Oop ref() {
-        return saObject;
-    }
-
-    public Type type() {
-        return referenceType();
-    }
-
-    public ReferenceType referenceType() {
-        Klass myKlass = ref().getKlass();
-        return vm.referenceType(myKlass);
-    }
-
-    public Value getValue(Field sig) {
-        List list = new ArrayList(1);
-        list.add(sig);
-        Map map = getValues(list);
-        return(Value)map.get(sig);
-    }
-
-    public Map getValues(List theFields) {
-        //validateMirrors(theFields);
-
-        List staticFields = new ArrayList(0);
-        int size = theFields.size();
-        List instanceFields = new ArrayList(size);
-
-        for (int i=0; i<size; i++) {
-            sun.jvm.hotspot.jdi.FieldImpl field =
-                (sun.jvm.hotspot.jdi.FieldImpl)theFields.get(i);
-
-            // Make sure the field is valid
-            ((ReferenceTypeImpl)referenceType()).validateFieldAccess(field);
-
-            // FIX ME! We need to do some sanity checking
-            // here; make sure the field belongs to this
-            // object.
-            if (field.isStatic()) {
-                staticFields.add(field);
-            } else {
-                instanceFields.add(field);
-            }
-        }
-
-        // Look up static field(s) first to mimic the JDI implementation
-        Map map;
-        if (staticFields.size() > 0) {
-            map = referenceType().getValues(staticFields);
-        } else {
-            map = new HashMap(size);
-        }
-
-        // Then get instance field(s)
-        size = instanceFields.size();
-        for (int ii=0; ii<size; ii++){
-            FieldImpl fieldImpl = (FieldImpl)instanceFields.get(ii);
-            map.put(fieldImpl, fieldImpl.getValue(saObject));
-        }
-
-        return map;
-    }
-
-    public void setValue(Field field, Value value)
-                   throws InvalidTypeException, ClassNotLoadedException {
-        vm.throwNotReadOnlyException("ObjectReference.setValue(...)");
-    }
-
-    public Value invokeMethod(ThreadReference threadIntf, Method methodIntf,
-                              List arguments, int options)
-                              throws InvalidTypeException,
-                                     IncompatibleThreadStateException,
-                                     InvocationException,
-                                     ClassNotLoadedException {
-        vm.throwNotReadOnlyException("ObjectReference.invokeMethod(...)");
-        return null;
-    }
-
-    public void disableCollection() {
-        vm.throwNotReadOnlyException("ObjectReference.disableCollection()");
-    }
-
-    public void enableCollection() {
-        vm.throwNotReadOnlyException("ObjectReference.enableCollection()");
-    }
-
-    public boolean isCollected() {
-        vm.throwNotReadOnlyException("ObjectReference.isCollected()");
-        return false;
-    }
-
-    public long uniqueID() {
-        return myID;
-    }
-
-    public List waitingThreads() throws IncompatibleThreadStateException {
-        if (vm.canGetMonitorInfo() == false) {
-            throw new UnsupportedOperationException();
-        }
-
-        if (! monitorInfoCached) {
-            computeMonitorInfo();
-        }
-        return waitingThreads;
-    }
-
-
-    public ThreadReference owningThread() throws IncompatibleThreadStateException {
-        if (vm.canGetMonitorInfo() == false) {
-            throw new UnsupportedOperationException();
-        }
-
-        if (! monitorInfoCached) {
-            computeMonitorInfo();
-        }
-        return owningThread;
-    }
-
-
-    public int entryCount() throws IncompatibleThreadStateException {
-        if (vm.canGetMonitorInfo() == false) {
-            throw new UnsupportedOperationException();
-        }
-
-        if (! monitorInfoCached) {
-            computeMonitorInfo();
-        }
-        return entryCount;
-    }
-
-    // new method since 1.6.
-    // Real body will be supplied later.
-    public List referringObjects(long maxReferrers) {
-        if (!vm.canGetInstanceInfo()) {
-            throw new UnsupportedOperationException(
-                      "target does not support getting instances");
-        }
-        if (maxReferrers < 0) {
-            throw new IllegalArgumentException("maxReferrers is less than zero: "
-                                              + maxReferrers);
-        }
-        final ObjectReference obj = this;
-        final List objects = new ArrayList(0);
-        final long max = maxReferrers;
-                vm.saObjectHeap().iterate(new DefaultHeapVisitor() {
-                private long refCount = 0;
-                public boolean doObj(Oop oop) {
-                                        try {
-                                                ObjectReference objref = vm.objectMirror(oop);
-                                                List fields = objref.referenceType().allFields();
-                                                for (int i=0; i < fields.size(); i++) {
-                                                        Field fld = (Field)fields.get(i);
-                                                        if (objref.getValue(fld).equals(obj) && !objects.contains(objref)) {
-                                                                objects.add(objref);
-                                                                refCount++;
-                                                        }
-                                                }
-                                                if (max > 0 && refCount >= max) {
-                                                        return true;
-                                                }
-                                        } catch  (RuntimeException x) {
-                                          // Ignore RuntimeException thrown from vm.objectMirror(oop)
-                                          // for bad oop. It is possible to see some bad oop
-                                          // because heap might be iterating at no safepoint.
-                                        }
-                                        return false;
-
-                }
-            });
-        return objects;
-    }
-
-    // refer to JvmtiEnvBase::count_locked_objects.
-    // Count the number of objects for a lightweight monitor. The obj
-    // parameter is object that owns the monitor so this routine will
-    // count the number of times the same object was locked by frames
-    // in JavaThread. i.e., we count total number of times the same
-    // object is (lightweight) locked by given thread.
-    private int countLockedObjects(JavaThread jt, Oop obj) {
-        int res = 0;
-        JavaVFrame frame = jt.getLastJavaVFrameDbg();
-        while (frame != null) {
-            List monitors = frame.getMonitors();
-            OopHandle givenHandle = obj.getHandle();
-            for (Iterator itr = monitors.iterator(); itr.hasNext();) {
-                MonitorInfo mi = (MonitorInfo) itr.next();
-                if (mi.eliminated() && frame.isCompiledFrame()) continue; // skip eliminated monitor
-                if (givenHandle.equals(mi.owner())) {
-                    res++;
-                }
-            }
-            frame = (JavaVFrame) frame.javaSender();
-        }
-        return res;
-    }
-
-    // wrappers on same named method of Threads class
-    // returns List<JavaThread>
-    private List getPendingThreads(ObjectMonitor mon) {
-        return vm.saVM().getThreads().getPendingThreads(mon);
-    }
-
-    // returns List<JavaThread>
-    private List getWaitingThreads(ObjectMonitor mon) {
-        return vm.saVM().getThreads().getWaitingThreads(mon);
-    }
-
-    private JavaThread owningThreadFromMonitor(Address addr) {
-        return vm.saVM().getThreads().owningThreadFromMonitor(addr);
-    }
-
-    // refer to JvmtiEnv::GetObjectMonitorUsage
-    private void computeMonitorInfo() {
-        monitorInfoCached = true;
-        Mark mark = saObject.getMark();
-        ObjectMonitor mon = null;
-        Address owner = null;
-        // check for heavyweight monitor
-        if (! mark.hasMonitor()) {
-            // check for lightweight monitor
-            if (mark.hasLocker()) {
-                owner = mark.locker().getAddress(); // save the address of the Lock word
-            }
-            // implied else: no owner
-        } else {
-            // this object has a heavyweight monitor
-            mon = mark.monitor();
-
-            // The owner field of a heavyweight monitor may be NULL for no
-            // owner, a JavaThread * or it may still be the address of the
-            // Lock word in a JavaThread's stack. A monitor can be inflated
-            // by a non-owning JavaThread, but only the owning JavaThread
-            // can change the owner field from the Lock word to the
-            // JavaThread * and it may not have done that yet.
-            owner = mon.owner();
-        }
-
-        // find the owning thread
-        if (owner != null) {
-            owningThread = vm.threadMirror(owningThreadFromMonitor(owner));
-        }
-
-        // compute entryCount
-        if (owningThread != null) {
-            if (owningThread.getJavaThread().getAddress().equals(owner)) {
-                // the owner field is the JavaThread *
-                if (Assert.ASSERTS_ENABLED) {
-                    Assert.that(false, "must have heavyweight monitor with JavaThread * owner");
-                }
-                entryCount = (int) mark.monitor().recursions() + 1;
-            } else {
-                // The owner field is the Lock word on the JavaThread's stack
-                // so the recursions field is not valid. We have to count the
-                // number of recursive monitor entries the hard way.
-                entryCount = countLockedObjects(owningThread.getJavaThread(), saObject);
-            }
-        }
-
-        // find the contenders & waiters
-        waitingThreads = new ArrayList();
-        if (mon != null) {
-            // this object has a heavyweight monitor. threads could
-            // be contenders or waiters
-            // add all contenders
-            List pendingThreads = getPendingThreads(mon);
-            // convert the JavaThreads to ThreadReferenceImpls
-            for (Iterator itrPend = pendingThreads.iterator(); itrPend.hasNext();) {
-                waitingThreads.add(vm.threadMirror((JavaThread) itrPend.next()));
-            }
-
-            // add all waiters (threads in Object.wait())
-            // note that we don't do this JVMTI way. To do it JVMTI way,
-            // we would need to access ObjectWaiter list maintained in
-            // ObjectMonitor::_queue. But we don't have this struct exposed
-            // in vmStructs. We do waiters list in a way similar to getting
-            // pending threads list
-            List objWaitingThreads = getWaitingThreads(mon);
-            // convert the JavaThreads to ThreadReferenceImpls
-            for (Iterator itrWait = objWaitingThreads.iterator(); itrWait.hasNext();) {
-                waitingThreads.add(vm.threadMirror((JavaThread) itrWait.next()));
-            }
-        }
-    }
-
-    public boolean equals(Object obj) {
-        if ((obj != null) && (obj instanceof ObjectReferenceImpl)) {
-            ObjectReferenceImpl other = (ObjectReferenceImpl)obj;
-            return (ref().equals(other.ref())) &&
-                   super.equals(obj);
-        } else {
-            return false;
-        }
-    }
-
-    public int hashCode() {
-        return saObject.hashCode();
-    }
-
-    public String toString() {
-        return  "instance of " + referenceType().name() + "(id=" + uniqueID() + ")";
-    }
-}
diff --git a/hotspot/src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/jdi/PrimitiveTypeImpl.java b/hotspot/src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/jdi/PrimitiveTypeImpl.java
deleted file mode 100644
index 7ee3303..0000000
--- a/hotspot/src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/jdi/PrimitiveTypeImpl.java
+++ /dev/null
@@ -1,43 +0,0 @@
-/*
- * Copyright (c) 2002, 2003, 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 sun.jvm.hotspot.jdi;
-
-import com.sun.jdi.*;
-
-abstract class PrimitiveTypeImpl extends TypeImpl implements PrimitiveType {
-
-    PrimitiveTypeImpl(VirtualMachine vm) {
-        super(vm);
-    }
-
-    /*
-     * Converts the given primitive value to a value of this type.
-     */
-    abstract PrimitiveValue convert(PrimitiveValue value) throws InvalidTypeException;
-
-    public String toString() {
-        return name();
-    }
-}
diff --git a/hotspot/src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/jdi/PrimitiveValueImpl.java b/hotspot/src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/jdi/PrimitiveValueImpl.java
deleted file mode 100644
index 464fb1d..0000000
--- a/hotspot/src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/jdi/PrimitiveValueImpl.java
+++ /dev/null
@@ -1,93 +0,0 @@
-/*
- * Copyright (c) 2002, 2003, 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 sun.jvm.hotspot.jdi;
-
-import com.sun.jdi.*;
-
-public abstract class PrimitiveValueImpl extends ValueImpl
-                                         implements PrimitiveValue {
-
-    PrimitiveValueImpl(VirtualMachine aVm) {
-        super(aVm);
-    }
-
-    abstract public boolean booleanValue();
-    abstract public byte byteValue();
-    abstract public char charValue();
-    abstract public short shortValue();
-    abstract public int intValue();
-    abstract public long longValue();
-    abstract public float floatValue();
-    abstract public double doubleValue();
-
-    /*
-     * The checked versions of the value accessors throw
-     * InvalidTypeException if the required conversion is
-     * narrowing and would result in the loss of information
-     * (either magnitude or precision).
-     *
-     * Default implementations here do no checking; subclasses
-     * override as necessary to do the proper checking.
-     */
-    byte checkedByteValue() throws InvalidTypeException {
-        return byteValue();
-    }
-    char checkedCharValue() throws InvalidTypeException {
-        return charValue();
-    }
-    short checkedShortValue() throws InvalidTypeException {
-        return shortValue();
-    }
-    int checkedIntValue() throws InvalidTypeException {
-        return intValue();
-    }
-    long checkedLongValue() throws InvalidTypeException {
-        return longValue();
-    }
-    float checkedFloatValue() throws InvalidTypeException {
-        return floatValue();
-    }
-
-    final boolean checkedBooleanValue() throws InvalidTypeException {
-        /*
-         * Always disallow a conversion to boolean from any other
-         * primitive
-         */
-        if (this instanceof BooleanValue) {
-            return booleanValue();
-        } else {
-            throw new InvalidTypeException("Can't convert non-boolean value to boolean");
-        }
-    }
-
-    final double checkedDoubleValue() throws InvalidTypeException {
-        /*
-         * Can't overflow by converting to double, so this method
-         * is never overridden
-         */
-        return doubleValue();
-    }
-
-}
diff --git a/hotspot/src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/jdi/ReferenceTypeImpl.java b/hotspot/src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/jdi/ReferenceTypeImpl.java
deleted file mode 100644
index dd235f9..0000000
--- a/hotspot/src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/jdi/ReferenceTypeImpl.java
+++ /dev/null
@@ -1,1008 +0,0 @@
-/*
- * Copyright (c) 2002, 2012, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation.
- *
- * 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.jvm.hotspot.jdi;
-
-import java.io.ByteArrayOutputStream;
-import java.io.IOException;
-import java.lang.ref.SoftReference;
-import java.util.ArrayList;
-import java.util.Collection;
-import java.util.Collections;
-import java.util.HashMap;
-import java.util.HashSet;
-import java.util.Iterator;
-import java.util.List;
-import java.util.Map;
-import java.util.Set;
-
-import sun.jvm.hotspot.memory.SystemDictionary;
-import sun.jvm.hotspot.oops.ArrayKlass;
-import sun.jvm.hotspot.oops.DefaultHeapVisitor;
-import sun.jvm.hotspot.oops.Instance;
-import sun.jvm.hotspot.oops.InstanceKlass;
-import sun.jvm.hotspot.oops.JVMDIClassStatus;
-import sun.jvm.hotspot.oops.Klass;
-import sun.jvm.hotspot.oops.Oop;
-import sun.jvm.hotspot.oops.Symbol;
-import sun.jvm.hotspot.utilities.Assert;
-
-import com.sun.jdi.AbsentInformationException;
-import com.sun.jdi.ArrayType;
-import com.sun.jdi.ClassLoaderReference;
-import com.sun.jdi.ClassNotLoadedException;
-import com.sun.jdi.ClassNotPreparedException;
-import com.sun.jdi.ClassObjectReference;
-import com.sun.jdi.Field;
-import com.sun.jdi.InterfaceType;
-import com.sun.jdi.Method;
-import com.sun.jdi.ObjectReference;
-import com.sun.jdi.PrimitiveType;
-import com.sun.jdi.ReferenceType;
-import com.sun.jdi.Type;
-import com.sun.jdi.Value;
-import com.sun.jdi.VirtualMachine;
-
-public abstract class ReferenceTypeImpl extends TypeImpl
-implements ReferenceType {
-    protected Klass       saKlass;          // This can be an InstanceKlass or an ArrayKlass
-    protected Symbol      typeNameSymbol;   // This is used in vm.classesByName to speedup search
-    private int           modifiers = -1;
-    private String        signature = null;
-    private SoftReference sdeRef = null;
-    private SoftReference fieldsCache;
-    private SoftReference allFieldsCache;
-    private SoftReference methodsCache;
-    private SoftReference allMethodsCache;
-    private SoftReference nestedTypesCache;
-    private SoftReference methodInvokesCache;
-
-    /* to mark when no info available */
-    static final SDE NO_SDE_INFO_MARK = new SDE();
-
-    protected ReferenceTypeImpl(VirtualMachine aVm, sun.jvm.hotspot.oops.Klass klass) {
-        super(aVm);
-        saKlass = klass;
-        typeNameSymbol = saKlass.getName();
-        if (Assert.ASSERTS_ENABLED) {
-            Assert.that(typeNameSymbol != null, "null type name for a Klass");
-        }
-    }
-
-    Symbol typeNameAsSymbol() {
-        return typeNameSymbol;
-    }
-
-    Method getMethodMirror(sun.jvm.hotspot.oops.Method ref) {
-        // SA creates new Method objects when they are referenced which means
-        // that the incoming object might not be the same object as on our
-        // even though it is the same method. So do an address compare by
-        // calling equals rather than just reference compare.
-        Iterator it = methods().iterator();
-        while (it.hasNext()) {
-            MethodImpl method = (MethodImpl)it.next();
-            if (ref.equals(method.ref())) {
-                return method;
-            }
-        }
-        if (ref.getMethodHolder().equals(SystemDictionary.getMethodHandleKlass())) {
-          // invoke methods are generated as needed, so make mirrors as needed
-          List mis = null;
-          if (methodInvokesCache == null) {
-            mis = new ArrayList();
-            methodInvokesCache = new SoftReference(mis);
-          } else {
-            mis = (List)methodInvokesCache.get();
-          }
-          it = mis.iterator();
-          while (it.hasNext()) {
-            MethodImpl method = (MethodImpl)it.next();
-            if (ref.equals(method.ref())) {
-              return method;
-            }
-          }
-
-          MethodImpl method = MethodImpl.createMethodImpl(vm, this, ref);
-          mis.add(method);
-          return method;
-        }
-        throw new IllegalArgumentException("Invalid method id: " + ref);
-    }
-
-    public boolean equals(Object obj) {
-        if ((obj != null) && (obj instanceof ReferenceTypeImpl)) {
-            ReferenceTypeImpl other = (ReferenceTypeImpl)obj;
-            return (ref().equals(other.ref())) &&
-                (vm.equals(other.virtualMachine()));
-        } else {
-            return false;
-        }
-    }
-
-    public int hashCode() {
-        return saKlass.hashCode();
-    }
-
-    public int compareTo(ReferenceType refType) {
-        /*
-         * Note that it is critical that compareTo() == 0
-         * implies that equals() == true. Otherwise, TreeSet
-         * will collapse classes.
-         *
-         * (Classes of the same name loaded by different class loaders
-         * or in different VMs must not return 0).
-         */
-        ReferenceTypeImpl other = (ReferenceTypeImpl)refType;
-        int comp = name().compareTo(other.name());
-        if (comp == 0) {
-            Klass rf1 = ref();
-            Klass rf2 = other.ref();
-            // optimize for typical case: refs equal and VMs equal
-            if (rf1.equals(rf2)) {
-                // sequenceNumbers are always positive
-                comp = vm.sequenceNumber -
-                 ((VirtualMachineImpl)(other.virtualMachine())).sequenceNumber;
-            } else {
-                comp = rf1.getAddress().minus(rf2.getAddress()) < 0? -1 : 1;
-            }
-        }
-        return comp;
-    }
-
-    public String signature() {
-        if (signature == null) {
-            signature = saKlass.signature();
-        }
-        return signature;
-    }
-
-    // refer to JvmtiEnv::GetClassSignature.
-    // null is returned for array klasses.
-    public String genericSignature() {
-        if (saKlass instanceof ArrayKlass) {
-            return null;
-        } else {
-            Symbol genSig = ((InstanceKlass)saKlass).getGenericSignature();
-            return (genSig != null)? genSig.asString() : null;
-        }
-    }
-
-    public ClassLoaderReference classLoader() {
-      Instance xx = (Instance)(((InstanceKlass)saKlass).getClassLoader());
-      return (ClassLoaderReferenceImpl)vm.classLoaderMirror(xx);
-    }
-
-    public boolean isPublic() {
-        return((modifiers() & VMModifiers.PUBLIC) != 0);
-    }
-
-    public boolean isProtected() {
-        return((modifiers() & VMModifiers.PROTECTED) != 0);
-    }
-
-    public boolean isPrivate() {
-        return((modifiers() & VMModifiers.PRIVATE) != 0);
-    }
-
-    public boolean isPackagePrivate() {
-        return !isPublic() && !isPrivate() && !isProtected();
-    }
-
-    public boolean isAbstract() {
-        return((modifiers() & VMModifiers.ABSTRACT) != 0);
-    }
-
-    public boolean isFinal() {
-        return((modifiers() & VMModifiers.FINAL) != 0);
-    }
-
-    public boolean isStatic() {
-        return((modifiers() & VMModifiers.STATIC) != 0);
-    }
-
-    public boolean isPrepared() {
-        return (saKlass.getClassStatus() & JVMDIClassStatus.PREPARED) != 0;
-    }
-
-    final void checkPrepared() throws ClassNotPreparedException {
-        if (! isPrepared()) {
-            throw new ClassNotPreparedException();
-        }
-    }
-
-    public boolean isVerified() {
-        return (saKlass.getClassStatus() & JVMDIClassStatus.VERIFIED) != 0;
-    }
-
-    public boolean isInitialized() {
-        return (saKlass.getClassStatus() & JVMDIClassStatus.INITIALIZED) != 0;
-    }
-
-    public boolean failedToInitialize() {
-        return (saKlass.getClassStatus() & JVMDIClassStatus.ERROR) != 0;
-    }
-
-    private boolean isThrowableBacktraceField(sun.jvm.hotspot.oops.Field fld) {
-        // refer to JvmtiEnv::GetClassFields in jvmtiEnv.cpp.
-        // We want to filter out java.lang.Throwable.backtrace (see 4446677).
-        // It contains some Method*s that aren't quite real Objects.
-        if (fld.getFieldHolder().getName().equals(vm.javaLangThrowable()) &&
-            fld.getID().getName().equals("backtrace")) {
-            return true;
-        } else {
-            return false;
-        }
-    }
-
-    public final List fields() throws ClassNotPreparedException {
-        List fields = (fieldsCache != null)? (List) fieldsCache.get() : null;
-        if (fields == null) {
-            checkPrepared();
-            if (saKlass instanceof ArrayKlass) {
-                fields = new ArrayList(0);
-            } else {
-                // Get a list of the sa Field types
-                List saFields = ((InstanceKlass)saKlass).getImmediateFields();
-
-                // Create a list of our Field types
-                int len = saFields.size();
-                fields = new ArrayList(len);
-                for (int ii = 0; ii < len; ii++) {
-                    sun.jvm.hotspot.oops.Field curField = (sun.jvm.hotspot.oops.Field)saFields.get(ii);
-                    if (! isThrowableBacktraceField(curField)) {
-                        fields.add(new FieldImpl(vm, this, curField));
-                    }
-                }
-            }
-            fields = Collections.unmodifiableList(fields);
-            fieldsCache = new SoftReference(fields);
-        }
-        return fields;
-    }
-
-    public final List allFields() throws ClassNotPreparedException {
-        List allFields = (allFieldsCache != null)? (List) allFieldsCache.get() : null;
-        if (allFields == null) {
-            checkPrepared();
-            if (saKlass instanceof ArrayKlass) {
-                // is 'length' a field of array klasses? To maintain
-                // consistency with JVMDI-JDI we return 0 size.
-                allFields = new ArrayList(0);
-            } else {
-                List saFields;
-
-                // Get a list of the sa Field types
-                saFields = ((InstanceKlass)saKlass).getAllFields();
-
-                // Create a list of our Field types
-                int len = saFields.size();
-                allFields = new ArrayList(len);
-                for (int ii = 0; ii < len; ii++) {
-                    sun.jvm.hotspot.oops.Field curField = (sun.jvm.hotspot.oops.Field)saFields.get(ii);
-                    if (! isThrowableBacktraceField(curField)) {
-                        allFields.add(new FieldImpl(vm, vm.referenceType(curField.getFieldHolder()), curField));
-                    }
-                }
-            }
-            allFields = Collections.unmodifiableList(allFields);
-            allFieldsCache = new SoftReference(allFields);
-        }
-        return allFields;
-    }
-
-    abstract List inheritedTypes();
-
-    void addVisibleFields(List visibleList, Map visibleTable, List ambiguousNames) {
-        List list = visibleFields();
-        Iterator iter = list.iterator();
-        while (iter.hasNext()) {
-            Field field = (Field)iter.next();
-            String name = field.name();
-            if (!ambiguousNames.contains(name)) {
-                Field duplicate = (Field)visibleTable.get(name);
-                if (duplicate == null) {
-                    visibleList.add(field);
-                    visibleTable.put(name, field);
-                } else if (!field.equals(duplicate)) {
-                    ambiguousNames.add(name);
-                    visibleTable.remove(name);
-                    visibleList.remove(duplicate);
-                } else {
-                    // identical field from two branches; do nothing
-                }
-            }
-        }
-    }
-
-    public final List visibleFields() throws ClassNotPreparedException {
-        checkPrepared();
-        /*
-         * Maintain two different collections of visible fields. The
-         * list maintains a reasonable order for return. The
-         * hash map provides an efficient way to lookup visible fields
-         * by name, important for finding hidden or ambiguous fields.
-         */
-        List visibleList = new ArrayList();
-        Map  visibleTable = new HashMap();
-
-        /* Track fields removed from above collection due to ambiguity */
-        List ambiguousNames = new ArrayList();
-
-        /* Add inherited, visible fields */
-        List types = inheritedTypes();
-        Iterator iter = types.iterator();
-        while (iter.hasNext()) {
-            /*
-             * TO DO: Be defensive and check for cyclic interface inheritance
-             */
-            ReferenceTypeImpl type = (ReferenceTypeImpl)iter.next();
-            type.addVisibleFields(visibleList, visibleTable, ambiguousNames);
-        }
-
-        /*
-         * Insert fields from this type, removing any inherited fields they
-         * hide.
-         */
-        List retList = new ArrayList(fields());
-        iter = retList.iterator();
-        while (iter.hasNext()) {
-            Field field = (Field)iter.next();
-            Field hidden = (Field)visibleTable.get(field.name());
-            if (hidden != null) {
-                visibleList.remove(hidden);
-            }
-        }
-        retList.addAll(visibleList);
-        return retList;
-    }
-
-   public final Field fieldByName(String fieldName) throws ClassNotPreparedException {
-        java.util.List searchList;
-        Field f;
-
-        // visibleFields calls checkPrepared
-        searchList = visibleFields();
-
-        for (int i=0; i<searchList.size(); i++) {
-            f = (Field)searchList.get(i);
-
-            if (f.name().equals(fieldName)) {
-                return f;
-            }
-        }
-        //throw new NoSuchFieldException("Field '" + fieldName + "' not found in " + name());
-        return null;
-    }
-
-    public final List methods() throws ClassNotPreparedException {
-        List methods = (methodsCache != null)? (List) methodsCache.get() : null;
-        if (methods == null) {
-            checkPrepared();
-            if (saKlass instanceof ArrayKlass) {
-                methods = new ArrayList(0);
-            } else {
-                List saMethods;
-                // Get a list of the SA Method types
-                saMethods = ((InstanceKlass)saKlass).getImmediateMethods();
-
-                // Create a list of our MethodImpl types
-                int len = saMethods.size();
-                methods = new ArrayList(len);
-                for (int ii = 0; ii < len; ii++) {
-                    methods.add(MethodImpl.createMethodImpl(vm, this, (sun.jvm.hotspot.oops.Method)saMethods.get(ii)));
-                }
-            }
-            methods = Collections.unmodifiableList(methods);
-            methodsCache = new SoftReference(methods);
-        }
-        return methods;
-    }
-
-    abstract List getAllMethods();
-    public final List allMethods() throws ClassNotPreparedException {
-        List allMethods = (allMethodsCache != null)? (List) allMethodsCache.get() : null;
-        if (allMethods == null) {
-            checkPrepared();
-            allMethods = Collections.unmodifiableList(getAllMethods());
-            allMethodsCache = new SoftReference(allMethods);
-        }
-        return allMethods;
-    }
-
-    /*
-     * Utility method used by subclasses to build lists of visible
-     * methods.
-     */
-    void addToMethodMap(Map methodMap, List methodList) {
-        Iterator iter = methodList.iterator();
-        while (iter.hasNext()) {
-            Method method = (Method)iter.next();
-            methodMap.put(method.name().concat(method.signature()), method);
-        }
-    }
-
-    abstract void addVisibleMethods(Map<String, Method> methodMap, Set<InterfaceType> seenInterfaces);
-
-    public final List visibleMethods() throws ClassNotPreparedException {
-        checkPrepared();
-        /*
-         * Build a collection of all visible methods. The hash
-         * map allows us to do this efficiently by keying on the
-         * concatenation of name and signature.
-         */
-        //System.out.println("jj: RTI: Calling addVisibleMethods for:" + this);
-        Map<String, Method> map = new HashMap<String, Method>();
-        addVisibleMethods(map, new HashSet<InterfaceType>());
-
-        /*
-         * ... but the hash map destroys order. Methods should be
-         * returned in a sensible order, as they are in allMethods().
-         * So, start over with allMethods() and use the hash map
-         * to filter that ordered collection.
-         */
-        //System.out.println("jj: RTI: Calling allMethods for:" + this);
-
-        List<Method> list = new ArrayList<Method>(allMethods());
-        //System.out.println("jj: allMethods = " + jjstr(list));
-        //System.out.println("jj: map = " + map.toString());
-        //System.out.println("jj: map = " + jjstr(map.values()));
-        list.retainAll(map.values());
-        //System.out.println("jj: map = " + jjstr(list));
-        //System.exit(0);
-        return list;
-    }
-
-    static Object prev;
-
-    static public String jjstr(Collection cc) {
-        StringBuffer buf = new StringBuffer();
-        buf.append("[");
-        Iterator i = cc.iterator();
-        boolean hasNext = i.hasNext();
-        while (hasNext) {
-            Object o = i.next();
-            if (prev == null) {
-                prev = o;
-            } else {
-                System.out.println("prev == curr?" + prev.equals(o));
-                System.out.println("prev == curr?" + (prev == o));
-            }
-            buf.append( o + "@" + o.hashCode());
-            //buf.append( ((Object)o).toString());
-            hasNext = i.hasNext();
-            if (hasNext)
-                buf.append(", ");
-        }
-
-        buf.append("]");
-        return buf.toString();
-    }
-
-    public final List methodsByName(String name) throws ClassNotPreparedException {
-        // visibleMethods calls checkPrepared
-        List methods = visibleMethods();
-        ArrayList retList = new ArrayList(methods.size());
-        Iterator iter = methods.iterator();
-        while (iter.hasNext()) {
-            Method candidate = (Method)iter.next();
-            if (candidate.name().equals(name)) {
-                retList.add(candidate);
-            }
-        }
-        retList.trimToSize();
-        return retList;
-    }
-
-    public final List methodsByName(String name, String signature) throws ClassNotPreparedException {
-        // visibleMethods calls checkPrepared
-        List methods = visibleMethods();
-        ArrayList retList = new ArrayList(methods.size());
-        Iterator iter = methods.iterator();
-        while (iter.hasNext()) {
-            Method candidate = (Method)iter.next();
-            if (candidate.name().equals(name) &&
-                candidate.signature().equals(signature)) {
-                retList.add(candidate);
-            }
-        }
-        retList.trimToSize();
-        return retList;
-    }
-
-
-    List getInterfaces() {
-        List myInterfaces;
-        if (saKlass instanceof ArrayKlass) {
-            // Actually, JLS says arrays implement Cloneable and Serializable
-            // But, JVMDI-JDI just returns 0 interfaces for arrays. We follow
-            // the same for consistency.
-            myInterfaces = new ArrayList(0);
-        } else {
-            // Get a list of the sa InstanceKlass types
-            List saInterfaces = ((InstanceKlass)saKlass).getDirectImplementedInterfaces();
-
-            // Create a list of our InterfaceTypes
-            int len = saInterfaces.size();
-            myInterfaces = new ArrayList(len);
-            for (int ii = 0; ii < len; ii++) {
-                myInterfaces.add(new InterfaceTypeImpl(vm, (InstanceKlass)saInterfaces.get(ii)));
-            }
-        }
-        return myInterfaces;
-    }
-
-    public final List nestedTypes() {
-        List nestedTypes = (nestedTypesCache != null)? (List) nestedTypesCache.get() : null;
-        if (nestedTypes == null) {
-            if (saKlass instanceof ArrayKlass) {
-                nestedTypes = new ArrayList(0);
-            } else {
-                ClassLoaderReference cl = classLoader();
-                List classes = null;
-                if (cl != null) {
-                   classes = cl.visibleClasses();
-                } else {
-                   classes = vm.bootstrapClasses();
-                }
-                nestedTypes = new ArrayList();
-                Iterator iter = classes.iterator();
-                while (iter.hasNext()) {
-                    ReferenceTypeImpl refType = (ReferenceTypeImpl)iter.next();
-                    Symbol candidateName = refType.ref().getName();
-                    if (((InstanceKlass)saKlass).isInnerOrLocalClassName(candidateName)) {
-                        nestedTypes.add(refType);
-                    }
-                }
-            }
-            nestedTypes = Collections.unmodifiableList(nestedTypes);
-            nestedTypesCache = new SoftReference(nestedTypes);
-        }
-        return nestedTypes;
-    }
-
-    public Value getValue(Field sig) {
-        List list = new ArrayList(1);
-        list.add(sig);
-        Map map = getValues(list);
-        return(Value)map.get(sig);
-    }
-
-    /**
-     * Returns a map of field values
-     */
-    public Map getValues(List theFields) {
-        //validateMirrors();
-        int size = theFields.size();
-        Map map = new HashMap(size);
-        for (int ii=0; ii<size; ii++) {
-            FieldImpl fieldImpl = (FieldImpl)theFields.get(ii);
-
-            validateFieldAccess(fieldImpl);
-            // Do more validation specific to ReferenceType field getting
-            if (!fieldImpl.isStatic()) {
-                throw new IllegalArgumentException(
-                     "Attempt to use non-static field with ReferenceType: " +
-                     fieldImpl.name());
-            }
-            map.put(fieldImpl, fieldImpl.getValue());
-        }
-        return map;
-    }
-
-    void validateFieldAccess(Field field) {
-       /*
-        * Field must be in this object's class, a superclass, or
-        * implemented interface
-        */
-        ReferenceTypeImpl declType = (ReferenceTypeImpl)field.declaringType();
-        if (!declType.isAssignableFrom(this)) {
-            throw new IllegalArgumentException("Invalid field");
-        }
-    }
-
-    public ClassObjectReference classObject() {
-        return vm.classObjectMirror(ref().getJavaMirror());
-    }
-
-    SDE.Stratum stratum(String stratumID) {
-        SDE sde = sourceDebugExtensionInfo();
-        if (!sde.isValid()) {
-            sde = NO_SDE_INFO_MARK;
-        }
-        return sde.stratum(stratumID);
-    }
-
-    public String sourceName() throws AbsentInformationException {
-        return (String)(sourceNames(vm.getDefaultStratum()).get(0));
-    }
-
-    public List sourceNames(String stratumID)
-                                throws AbsentInformationException {
-        SDE.Stratum stratum = stratum(stratumID);
-        if (stratum.isJava()) {
-            List result = new ArrayList(1);
-            result.add(baseSourceName());
-            return result;
-        }
-        return stratum.sourceNames(this);
-    }
-
-    public List sourcePaths(String stratumID)
-                                throws AbsentInformationException {
-        SDE.Stratum stratum = stratum(stratumID);
-        if (stratum.isJava()) {
-            List result = new ArrayList(1);
-            result.add(baseSourceDir() + baseSourceName());
-            return result;
-        }
-        return stratum.sourcePaths(this);
-    }
-
-    String baseSourceName() throws AbsentInformationException {
-      if (saKlass instanceof ArrayKlass) {
-            throw new AbsentInformationException();
-      }
-      Symbol sym = ((InstanceKlass)saKlass).getSourceFileName();
-      if (sym != null) {
-          return sym.asString();
-      } else {
-          throw new AbsentInformationException();
-      }
-    }
-
-    String baseSourcePath() throws AbsentInformationException {
-        return baseSourceDir() + baseSourceName();
-    }
-
-    String baseSourceDir() {
-        String typeName = name();
-        StringBuffer sb = new StringBuffer(typeName.length() + 10);
-        int index = 0;
-        int nextIndex;
-
-        while ((nextIndex = typeName.indexOf('.', index)) > 0) {
-            sb.append(typeName.substring(index, nextIndex));
-            sb.append(java.io.File.separatorChar);
-            index = nextIndex + 1;
-        }
-        return sb.toString();
-    }
-
-    public String sourceDebugExtension()
-                           throws AbsentInformationException {
-        if (!vm.canGetSourceDebugExtension()) {
-            throw new UnsupportedOperationException();
-        }
-        SDE sde = sourceDebugExtensionInfo();
-        if (sde == NO_SDE_INFO_MARK) {
-            throw new AbsentInformationException();
-        }
-        return sde.sourceDebugExtension;
-    }
-
-    private SDE sourceDebugExtensionInfo() {
-        if (!vm.canGetSourceDebugExtension()) {
-            return NO_SDE_INFO_MARK;
-        }
-        SDE sde = null;
-        sde = (sdeRef == null) ?  null : (SDE)sdeRef.get();
-        if (sde == null) {
-           String extension = null;
-           if (saKlass instanceof InstanceKlass) {
-              extension = ((InstanceKlass)saKlass).getSourceDebugExtension();
-           }
-           if (extension == null) {
-              sde = NO_SDE_INFO_MARK;
-           } else {
-              sde = new SDE(extension);
-           }
-           sdeRef = new SoftReference(sde);
-        }
-        return sde;
-    }
-
-    public List availableStrata() {
-        SDE sde = sourceDebugExtensionInfo();
-        if (sde.isValid()) {
-            return sde.availableStrata();
-        } else {
-            List strata = new ArrayList();
-            strata.add(SDE.BASE_STRATUM_NAME);
-            return strata;
-        }
-    }
-
-    /**
-     * Always returns non-null stratumID
-     */
-    public String defaultStratum() {
-        SDE sdei = sourceDebugExtensionInfo();
-        if (sdei.isValid()) {
-            return sdei.defaultStratumId;
-        } else {
-            return SDE.BASE_STRATUM_NAME;
-        }
-    }
-
-    public final int modifiers() {
-        if (modifiers == -1) {
-            modifiers = getModifiers();
-        }
-        return modifiers;
-    }
-
-    // new method since 1.6.
-    // Real body will be supplied later.
-    public List instances(long maxInstances) {
-        if (!vm.canGetInstanceInfo()) {
-            throw new UnsupportedOperationException(
-                      "target does not support getting instances");
-        }
-
-        if (maxInstances < 0) {
-            throw new IllegalArgumentException("maxInstances is less than zero: "
-                                              + maxInstances);
-        }
-
-        final List objects = new ArrayList(0);
-        if (isAbstract() || (this instanceof InterfaceType)) {
-            return objects;
-        }
-
-        final Klass givenKls = this.ref();
-        final long max = maxInstances;
-        vm.saObjectHeap().iterate(new DefaultHeapVisitor() {
-                private long instCount=0;
-                public boolean doObj(Oop oop) {
-                    if (givenKls.equals(oop.getKlass())) {
-                        objects.add(vm.objectMirror(oop));
-                                                instCount++;
-                    }
-                    if (max > 0 && instCount >= max) {
-                        return true;
-                                        }
-                                        return false;
-                }
-            });
-        return objects;
-    }
-
-    int getModifiers() {
-        return (int) saKlass.getClassModifiers();
-    }
-
-    public List allLineLocations()
-                            throws AbsentInformationException {
-        return allLineLocations(vm.getDefaultStratum(), null);
-    }
-
-    public List allLineLocations(String stratumID, String sourceName)
-                            throws AbsentInformationException {
-        checkPrepared();
-        boolean someAbsent = false; // A method that should have info, didn't
-        SDE.Stratum stratum = stratum(stratumID);
-        List list = new ArrayList();  // location list
-
-        for (Iterator iter = methods().iterator(); iter.hasNext(); ) {
-            MethodImpl method = (MethodImpl)iter.next();
-            try {
-                list.addAll(
-                   method.allLineLocations(stratum.id(), sourceName));
-            } catch(AbsentInformationException exc) {
-                someAbsent = true;
-            }
-        }
-
-        // If we retrieved no line info, and at least one of the methods
-        // should have had some (as determined by an
-        // AbsentInformationException being thrown) then we rethrow
-        // the AbsentInformationException.
-        if (someAbsent && list.size() == 0) {
-            throw new AbsentInformationException();
-        }
-        return list;
-    }
-
-    public List locationsOfLine(int lineNumber)
-                           throws AbsentInformationException {
-        return locationsOfLine(vm.getDefaultStratum(),
-                               null,
-                               lineNumber);
-    }
-
-    public List locationsOfLine(String stratumID,
-                                String sourceName,
-                                int lineNumber)
-                           throws AbsentInformationException {
-        checkPrepared();
-        // A method that should have info, didn't
-        boolean someAbsent = false;
-        // A method that should have info, did
-        boolean somePresent = false;
-        List methods = methods();
-        SDE.Stratum stratum = stratum(stratumID);
-
-        List list = new ArrayList();
-
-        Iterator iter = methods.iterator();
-        while(iter.hasNext()) {
-            MethodImpl method = (MethodImpl)iter.next();
-            // eliminate native and abstract to eliminate
-            // false positives
-            if (!method.isAbstract() &&
-                !method.isNative()) {
-                try {
-                    list.addAll(
-                       method.locationsOfLine(stratum.id(),
-                                              sourceName,
-                                              lineNumber));
-                    somePresent = true;
-                } catch(AbsentInformationException exc) {
-                    someAbsent = true;
-                }
-            }
-        }
-        if (someAbsent && !somePresent) {
-            throw new AbsentInformationException();
-        }
-        return list;
-    }
-
-    Klass ref() {
-        return saKlass;
-    }
-
-
-    /*
-     * Return true if an instance of this type
-     * can be assigned to a variable of the given type
-     */
-    abstract boolean isAssignableTo(ReferenceType type);
-
-    boolean isAssignableFrom(ReferenceType type) {
-        return ((ReferenceTypeImpl)type).isAssignableTo(this);
-    }
-
-    boolean isAssignableFrom(ObjectReference object) {
-        return object == null ||
-            isAssignableFrom(object.referenceType());
-    }
-
-    int indexOf(Method method) {
-        // Make sure they're all here - the obsolete method
-        // won't be found and so will have index -1
-        return methods().indexOf(method);
-    }
-
-    int indexOf(Field field) {
-        // Make sure they're all here
-        return fields().indexOf(field);
-    }
-
-    private static boolean isPrimitiveArray(String signature) {
-        int i = signature.lastIndexOf('[');
-        /*
-         * TO DO: Centralize JNI signature knowledge.
-         *
-         * Ref:
-         *  jdk1.4/doc/guide/jpda/jdi/com/sun/jdi/doc-files/signature.html
-         */
-        boolean isPA;
-        if (i < 0) {
-            isPA = false;
-        } else {
-            char c = signature.charAt(i + 1);
-            isPA = (c != 'L');
-        }
-        return isPA;
-    }
-
-    Type findType(String signature) throws ClassNotLoadedException {
-        Type type;
-        if (signature.length() == 1) {
-            /* OTI FIX: Must be a primitive type or the void type */
-            char sig = signature.charAt(0);
-            if (sig == 'V') {
-                type = vm.theVoidType();
-            } else {
-                type = vm.primitiveTypeMirror(sig);
-            }
-        } else {
-            // Must be a reference type.
-            ClassLoaderReferenceImpl loader =
-                       (ClassLoaderReferenceImpl)classLoader();
-            if ((loader == null) ||
-                (isPrimitiveArray(signature)) //Work around 4450091
-                ) {
-                // Caller wants type of boot class field
-                type = vm.findBootType(signature);
-            } else {
-                // Caller wants type of non-boot class field
-                type = loader.findType(signature);
-            }
-        }
-        return type;
-    }
-
-    String loaderString() {
-        if (classLoader() != null) {
-            return "loaded by " + classLoader().toString();
-        } else {
-            return "loaded by bootstrap loader";
-        }
-    }
-
-    long uniqueID() {
-        return vm.getAddressValue(ref().getJavaMirror());
-    }
-
-    // new method since 1.6
-    public int majorVersion() {
-        if (!vm.canGetClassFileVersion()) {
-            throw new UnsupportedOperationException("Cannot get class file version");
-        }
-        return (int)((InstanceKlass)saKlass).majorVersion();
-    }
-
-    // new method since 1.6
-    public int minorVersion() {
-        if (!vm.canGetClassFileVersion()) {
-            throw new UnsupportedOperationException("Cannot get class file version");
-        }
-        return (int)((InstanceKlass)saKlass).minorVersion();
-    }
-
-    // new method since 1.6
-    public int constantPoolCount() {
-        if (!vm.canGetConstantPool()) {
-            throw new UnsupportedOperationException("Cannot get constant pool");
-        }
-        if (saKlass instanceof ArrayKlass) {
-            return 0;
-        } else {
-            return (int)((InstanceKlass)saKlass).getConstants().getLength();
-        }
-    }
-
-    // new method since 1.6
-    public byte[] constantPool() {
-        if (!vm.canGetConstantPool()) {
-            throw new UnsupportedOperationException("Cannot get constant pool");
-        }
-        if (this instanceof ArrayType || this instanceof PrimitiveType) {
-                        byte bytes[] = new byte[0];
-            return bytes;
-        } else {
-            ByteArrayOutputStream bs = new ByteArrayOutputStream();
-            try {
-                ((InstanceKlass)saKlass).getConstants().writeBytes(bs);
-            } catch (IOException ex) {
-                                ex.printStackTrace();
-                                byte bytes[] = new byte[0];
-                                return bytes;
-            }
-            return bs.toByteArray();
-        }
-    }
-}
diff --git a/hotspot/src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/jdi/SACoreAttachingConnector.java b/hotspot/src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/jdi/SACoreAttachingConnector.java
deleted file mode 100644
index 3db35d4..0000000
--- a/hotspot/src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/jdi/SACoreAttachingConnector.java
+++ /dev/null
@@ -1,156 +0,0 @@
-/*
- * Copyright (c) 2002, 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.
- *
- * 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.jvm.hotspot.jdi;
-
-import com.sun.jdi.connect.*;
-import com.sun.jdi.Bootstrap;
-import com.sun.jdi.VirtualMachine;
-import com.sun.jdi.VirtualMachineManager;
-
-import java.io.*;
-import java.lang.reflect.*;
-import java.net.*;
-import java.util.*;
-
-public class SACoreAttachingConnector extends ConnectorImpl implements AttachingConnector {
-
-    static final String ARG_COREFILE = "core";
-    static final String ARG_JAVA_EXECUTABLE = "javaExecutable";
-    private Transport transport;
-
-    public SACoreAttachingConnector(com.sun.tools.jdi.VirtualMachineManagerService ignored) {
-        this();
-    }
-
-    public SACoreAttachingConnector() {
-        super();
-        //fixme jjh  Must create resources for these strings
-        addStringArgument(
-                ARG_JAVA_EXECUTABLE,
-                "Java Executable",              //getString("sa.javaExecutable.label"),
-                "Pathname of Java Executable",  //getString("sa.javaExecutable.description");
-                "",
-                true);
-
-        addStringArgument(
-                ARG_COREFILE,
-                "Corefile",                                    // getString("sa.CoreFile.label"),
-                "Pathname of a corefile from a Java Process",  //getString("sa.CoreFile.description"),
-                "core",
-                false);
-
-        transport = new Transport() {
-                   public String name() {
-                       return "filesystem";
-                   }
-               };
-    }
-
-    // security check to see whether the caller can perform attach
-    private void checkCoreAttach(String corefile) {
-        SecurityManager sm = System.getSecurityManager();
-        if (sm != null) {
-            try {
-                // whether the caller can link against SA native library?
-                checkNativeLink(sm, System.getProperty("os.name"));
-                // check whether the caller can read the core file?
-                sm.checkRead(corefile);
-            } catch (SecurityException se) {
-                throw new SecurityException("permission denied to attach to " + corefile);
-            }
-        }
-    }
-
-    private VirtualMachine createVirtualMachine(Class vmImplClass,
-                                                String javaExec, String corefile)
-        throws NoSuchMethodException, InvocationTargetException, IllegalAccessException {
-        java.lang.reflect.Method connectByCoreMethod = vmImplClass.getMethod(
-                                 "createVirtualMachineForCorefile",
-                                  new Class[] {
-                                      VirtualMachineManager.class,
-                                      String.class, String.class,
-                                      Integer.TYPE
-                                  });
-        return (VirtualMachine) connectByCoreMethod.invoke(null,
-                                  new Object[] {
-                                      Bootstrap.virtualMachineManager(),
-                                      javaExec,
-                                      corefile,
-                                      new Integer(0)
-                                  });
-    }
-
-    public VirtualMachine attach(Map arguments) throws IOException,
-                                      IllegalConnectorArgumentsException {
-        String javaExec = argument(ARG_JAVA_EXECUTABLE, arguments).value();
-        if (javaExec == null || javaExec.equals("")) {
-            throw new IllegalConnectorArgumentsException("javaExec should be non-null and non-empty",
-                                                         ARG_JAVA_EXECUTABLE);
-        }
-        String corefile = argument(ARG_COREFILE, arguments).value();
-        if (corefile == null || corefile.equals("")) {
-            throw new IllegalConnectorArgumentsException("corefile should be non-null and non-empty",
-                                                         ARG_COREFILE);
-        }
-
-        checkCoreAttach(corefile);
-
-        VirtualMachine myVM = null;
-        try {
-            try {
-                Class vmImplClass = loadVirtualMachineImplClass();
-                myVM = createVirtualMachine(vmImplClass, javaExec, corefile);
-            } catch (InvocationTargetException ite) {
-                Class vmImplClass = handleVMVersionMismatch(ite);
-                if (vmImplClass != null) {
-                    return createVirtualMachine(vmImplClass, javaExec, corefile);
-                } else {
-                    throw ite;
-                }
-            }
-        } catch (Exception ee) {
-            if (DEBUG) {
-                System.out.println("VirtualMachineImpl() got an exception:");
-                ee.printStackTrace();
-                System.out.println("coreFile = " + corefile + ", javaExec = " + javaExec);
-            }
-            throw (IOException) new IOException().initCause(ee);
-        }
-        setVMDisposeObserver(myVM);
-        return myVM;
-    }
-
-    public String name() {
-        return "sun.jvm.hotspot.jdi.SACoreAttachingConnector";
-    }
-
-    public String description() {
-        return getString("This connector allows you to attach to a core file using the Serviceability Agent");
-    }
-
-    public Transport transport() {
-        return transport;
-    }
-}
diff --git a/hotspot/src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/jdi/SADebugServer.java b/hotspot/src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/jdi/SADebugServer.java
deleted file mode 100644
index 19c41df..0000000
--- a/hotspot/src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/jdi/SADebugServer.java
+++ /dev/null
@@ -1,64 +0,0 @@
-/*
- * Copyright (c) 2003, 2012, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation.
- *
- * 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.jvm.hotspot.jdi;
-
-public final class SADebugServer {
-   // do not allow instance creation
-   private SADebugServer() {}
-
-   private static void usage() {
-      java.io.PrintStream out = System.out;
-      out.println("Usage: jsadebugd [options] <pid> [server-id]");
-      out.println("\t\t(to connect to a live java process)");
-      out.println("   or  jsadebugd [options] <executable> <core> [server-id]");
-      out.println("\t\t(to connect to a core file produced by <executable>)");
-      out.println("\t\tserver-id is an optional unique id for this debug server, needed ");
-      out.println("\t\tif multiple debug servers are run on the same machine");
-      out.println("where options include:");
-      out.println("   -h | -help\tto print this help message");
-      System.exit(1);
-  }
-
-   public static void main(String[] args) {
-      if ((args.length < 1) || (args.length > 3)) {
-         usage();
-      }
-
-      // Attempt to handle "-h" or "-help"
-      if (args[0].startsWith("-")) {
-         usage();
-      }
-
-      // By default SA agent classes prefer Windows process debugger
-      // to windbg debugger. SA expects special properties to be set
-      // to choose other debuggers. We will set those here before
-      // attaching to SA agent.
-
-       System.setProperty("sun.jvm.hotspot.debugger.useWindbgDebugger", "true");
-
-      // delegate to the actual SA debug server.
-      sun.jvm.hotspot.DebugServer.main(args);
-   }
-}
diff --git a/hotspot/src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/jdi/SADebugServerAttachingConnector.java b/hotspot/src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/jdi/SADebugServerAttachingConnector.java
deleted file mode 100644
index d34f116..0000000
--- a/hotspot/src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/jdi/SADebugServerAttachingConnector.java
+++ /dev/null
@@ -1,123 +0,0 @@
-/*
- * Copyright (c) 2002, 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.
- *
- * 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.jvm.hotspot.jdi;
-
-import com.sun.jdi.connect.*;
-import com.sun.jdi.Bootstrap;
-import com.sun.jdi.VirtualMachine;
-import com.sun.jdi.VirtualMachineManager;
-
-import java.io.*;
-import java.lang.reflect.*;
-import java.net.*;
-import java.util.*;
-
-public class SADebugServerAttachingConnector extends ConnectorImpl implements AttachingConnector {
-
-    static final String ARG_DEBUG_SERVER_NAME = "debugServerName";
-    private Transport transport;
-
-    public SADebugServerAttachingConnector(com.sun.tools.jdi.VirtualMachineManagerService ignored) {
-        this();
-    }
-
-    public SADebugServerAttachingConnector() {
-         // fixme jjh  create resources for the these strings,
-        addStringArgument(
-                ARG_DEBUG_SERVER_NAME,
-                "Debug Server",                      //getString("sa.debugServer.label"),
-                "Name of a remote SA Debug Server",  //getString("sa.debugServer.description");
-                "",
-                true);
-        transport = new Transport() {
-                   public String name() {
-                       return "RMI";
-                   }
-                 };
-    }
-
-    private VirtualMachine createVirtualMachine(Class vmImplClass,
-                                                String debugServerName)
-        throws NoSuchMethodException, InvocationTargetException, IllegalAccessException {
-        java.lang.reflect.Method connectByServerMethod =
-                            vmImplClass.getMethod(
-                                   "createVirtualMachineForServer",
-                                   new Class[] {
-                                       VirtualMachineManager.class,
-                                       String.class,
-                                       Integer.TYPE
-                                   });
-        return (VirtualMachine) connectByServerMethod.invoke(null,
-                                   new Object[] {
-                                       Bootstrap.virtualMachineManager(),
-                                       debugServerName,
-                                       new Integer(0)
-                                   });
-    }
-
-    public VirtualMachine attach(Map arguments) throws IOException,
-                                      IllegalConnectorArgumentsException {
-        String debugServerName = argument(ARG_DEBUG_SERVER_NAME, arguments).value();
-        if (debugServerName == null || debugServerName.equals("")) {
-            throw new IllegalConnectorArgumentsException("debugServerName should be non-null and non-empty",
-                                                         ARG_DEBUG_SERVER_NAME);
-        }
-        VirtualMachine myVM;
-        try {
-            try {
-                Class vmImplClass = loadVirtualMachineImplClass();
-                myVM = createVirtualMachine(vmImplClass, debugServerName);
-            } catch (InvocationTargetException ite) {
-                Class vmImplClass = handleVMVersionMismatch(ite);
-                if (vmImplClass != null) {
-                    return createVirtualMachine(vmImplClass, debugServerName);
-                } else {
-                    throw ite;
-                }
-            }
-        } catch (Exception ee) {
-            if (DEBUG) {
-                System.out.println("VirtualMachineImpl() got an exception:");
-                ee.printStackTrace();
-                System.out.println("debug server name = " + debugServerName);
-            }
-            throw (IOException) new IOException().initCause(ee);
-        }
-        setVMDisposeObserver(myVM);
-        return myVM;
-    }
-
-    public String name() {
-        return "sun.jvm.hotspot.jdi.SADebugServerAttachingConnector";
-    }
-
-    public String description() {
-        return getString("This connector allows you to attach to a Java Process via a debug server with the Serviceability Agent");
-    }
-
-    public Transport transport() {
-        return transport;
-    }
-}
diff --git a/hotspot/src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/jdi/SAJDIClassLoader.java b/hotspot/src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/jdi/SAJDIClassLoader.java
deleted file mode 100644
index b2e5dae..0000000
--- a/hotspot/src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/jdi/SAJDIClassLoader.java
+++ /dev/null
@@ -1,154 +0,0 @@
-/*
- * Copyright (c) 2003, 2008, 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 sun.jvm.hotspot.jdi;
-
-import java.io.*;
-import java.net.*;
-
-/*
- * This class loader is used for two different reasons:
- *
- * 1) To support multiple simultaneous debuggees.
- *
- * SA's architecture does not allow us to use multiple simultaneous
- * debuggees. This is because of lots of static fields caching
- * vmStruct fields and singleton assumption in classes such as
- * 'sun.jvm.hotspot.runtime.VM'. Hence, we use instances of this
- * class loader to create a separate namespace for each debuggee VM.
- *
- * 2) To support cross VM version debugging.
- *
- * SA has very close dependency on VM data structures. Due to this, a
- * version of SA can only support debuggees running a same dot-dot release and
- * update releases only. For eg. this version of SA supports only 1.4.2 and
- * 1.4.2_xx releases only. But, users may want to debug debuggees running
- * a different version of VM. To support this, we use an instance of this
- * class loader to load classes from corresponding sa-jdi.jar.
- *
- * Note that JDI classes would still be loaded from the debugger's tools.jar
- * and not from debuggee's tools.jar. This means that if JDI interface evolved
- * b/w debuggee and debugger VM versions, user may still get problems. This is
- * the case when debugger runs on 1.5.0 and debuggee runs on 1.4.2. Because JDI
- * evolved b/w these versions (generics, enum, varargs etc.), 1.4.2 sa-jdi.jar
- * won't implement 1.5.0 JDI properly and user would get verifier errors. This
- * class loader solution is suited for different dot-dot release where JDI will
- * not evolve but VM data structures might change and SA implementation might
- * have to change. For example, a debuggee running 1.5.1 VM can be debugged
- * with debugger running on 1.5.0 VM. Here, JDI is same but VM data structures
- * could still change.
- */
-
-class SAJDIClassLoader extends URLClassLoader {
-    private static final boolean DEBUG;
-    static {
-        DEBUG = System.getProperty("sun.jvm.hotspot.jdi.SAJDIClassLoader.DEBUG") != null;
-    }
-
-    private ClassLoader parent;
-    private boolean classPathSet;
-
-    SAJDIClassLoader(ClassLoader parent) {
-        super(new URL[0], parent);
-        this.parent = parent;
-    }
-
-    SAJDIClassLoader(ClassLoader parent, String classPath) {
-        this(parent);
-        this.classPathSet = true;
-        try {
-            addURL(new File(classPath).toURI().toURL());
-        } catch(MalformedURLException mue) {
-            throw new RuntimeException(mue);
-        }
-    }
-
-    public synchronized Class loadClass(String name)
-        throws ClassNotFoundException {
-        // First, check if the class has already been loaded
-        Class c = findLoadedClass(name);
-        if (c == null) {
-            /* If we are loading any class in 'sun.jvm.hotspot.'  or any of the
-             * sub-packages (except for 'debugger' sub-pkg. please refer below),
-             * we load it by 'this' loader. Or else, we forward the request to
-             * 'parent' loader, system loader etc. (rest of the code follows
-             * the patten in java.lang.ClassLoader.loadClass).
-             *
-             * 'sun.jvm.hotspot.debugger.' and sub-package classes are
-             * also loaded by parent loader. This is done for two reasons:
-             *
-             * 1. to avoid code bloat by too many classes.
-             * 2. to avoid loading same native library multiple times
-             *    from multiple class loaders (which results in getting a
-             *    UnsatisifiedLinkageError from System.loadLibrary).
-             */
-
-            if (name.startsWith("sun.jvm.hotspot.") &&
-                !name.startsWith("sun.jvm.hotspot.debugger.")) {
-                return findClass(name);
-            }
-            if (parent != null) {
-                c = parent.loadClass(name);
-            } else {
-                c = findSystemClass(name);
-            }
-        }
-        return c;
-    }
-
-    protected Class findClass(String name) throws ClassNotFoundException {
-        if (DEBUG) {
-            System.out.println("SA/JDI loader: about to load " + name);
-        }
-        if (classPathSet) {
-            return super.findClass(name);
-        } else {
-            byte[] b = null;
-            try {
-                InputStream in = getResourceAsStream(name.replace('.', '/') + ".class");
-                // Read until end of stream is reached
-                b = new byte[1024];
-                int total = 0;
-                int len = 0;
-                while ((len = in.read(b, total, b.length - total)) != -1) {
-                    total += len;
-                    if (total >= b.length) {
-                        byte[] tmp = new byte[total * 2];
-                        System.arraycopy(b, 0, tmp, 0, total);
-                        b = tmp;
-                    }
-                }
-                // Trim array to correct size, if necessary
-                if (total != b.length) {
-                    byte[] tmp = new byte[total];
-                    System.arraycopy(b, 0, tmp, 0, total);
-                    b = tmp;
-                }
-            } catch (Exception exp) {
-                throw (ClassNotFoundException) new ClassNotFoundException().initCause(exp);
-            }
-            return defineClass(name, b, 0, b.length);
-        }
-    }
-}
diff --git a/hotspot/src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/jdi/SAPIDAttachingConnector.java b/hotspot/src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/jdi/SAPIDAttachingConnector.java
deleted file mode 100644
index fbba6b0..0000000
--- a/hotspot/src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/jdi/SAPIDAttachingConnector.java
+++ /dev/null
@@ -1,143 +0,0 @@
-/*
- * Copyright (c) 2002, 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.
- *
- * 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.jvm.hotspot.jdi;
-
-import com.sun.jdi.connect.*;
-import com.sun.jdi.Bootstrap;
-import com.sun.jdi.VirtualMachine;
-import com.sun.jdi.VirtualMachineManager;
-
-import java.io.*;
-import java.lang.reflect.*;
-import java.net.*;
-import java.util.*;
-
-public class SAPIDAttachingConnector extends ConnectorImpl implements AttachingConnector {
-    static final String ARG_PID = "pid";
-    private Transport transport;
-
-    public SAPIDAttachingConnector(com.sun.tools.jdi.VirtualMachineManagerService ignored) {
-         this();
-    }
-
-    public SAPIDAttachingConnector() {
-         super();
-         // fixme jjh:  create resources for the these strings,
-        addStringArgument(
-                ARG_PID,
-                "PID",                     //getString("sa.pid.label"),
-                "PID of a Java process",   //getString("sa.pid.description");
-                "",
-                true);
-        transport = new Transport() {
-                   public String name() {
-                       return "local process";
-                       }
-                };
-    }
-
-    // security check to see whether the caller can perform attach
-    private void checkProcessAttach(int pid) {
-        SecurityManager sm = System.getSecurityManager();
-        if (sm != null) {
-            String os = System.getProperty("os.name");
-            try {
-                // Whether the caller can perform link against SA native library?
-                checkNativeLink(sm, os);
-                if (os.equals("SunOS") || os.equals("Linux")) {
-                    // Whether the caller can read /proc/<pid> file?
-                    sm.checkRead("/proc/" + pid);
-                }
-            } catch (SecurityException se) {
-                throw new SecurityException("permission denied to attach to " + pid);
-            }
-        }
-    }
-
-    private VirtualMachine createVirtualMachine(Class virtualMachineImplClass, int pid)
-        throws NoSuchMethodException, InvocationTargetException, IllegalAccessException {
-        java.lang.reflect.Method createByPIDMethod
-                  = virtualMachineImplClass.getMethod("createVirtualMachineForPID",
-                     new Class[] {
-                         VirtualMachineManager.class,
-                         Integer.TYPE, Integer.TYPE
-                     });
-        return (VirtualMachine) createByPIDMethod.invoke(null,
-                     new Object[] {
-                         Bootstrap.virtualMachineManager(),
-                         new Integer(pid),
-                         new Integer(0)
-                     });
-    }
-
-    public VirtualMachine attach(Map arguments) throws IOException,
-                                      IllegalConnectorArgumentsException {
-        int pid = 0;
-        try {
-            pid = Integer.parseInt(argument(ARG_PID, arguments).value());
-        } catch (NumberFormatException nfe) {
-            throw (IllegalConnectorArgumentsException) new IllegalConnectorArgumentsException
-                                                  (nfe.getMessage(), ARG_PID).initCause(nfe);
-        }
-
-        checkProcessAttach(pid);
-
-        VirtualMachine myVM = null;
-        try {
-            try {
-                Class vmImplClass = loadVirtualMachineImplClass();
-                myVM = createVirtualMachine(vmImplClass, pid);
-            } catch (InvocationTargetException ite) {
-                Class vmImplClass = handleVMVersionMismatch(ite);
-                if (vmImplClass != null) {
-                    return createVirtualMachine(vmImplClass, pid);
-                } else {
-                    throw ite;
-                }
-            }
-        } catch (Exception ee) {
-            if (DEBUG) {
-                System.out.println("VirtualMachineImpl() got an exception:");
-                ee.printStackTrace();
-                System.out.println("pid = " + pid);
-            }
-            throw (IOException) new IOException().initCause(ee);
-        }
-        setVMDisposeObserver(myVM);
-        return myVM;
-    }
-
-    public String name() {
-        return "sun.jvm.hotspot.jdi.SAPIDAttachingConnector";
-    }
-
-    public String description() {
-        return getString("This connector allows you to attach to a Java process using the Serviceability Agent");
-    }
-
-    public Transport transport() {
-        return transport;
-    }
-}
diff --git a/hotspot/src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/jdi/SDE.java b/hotspot/src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/jdi/SDE.java
deleted file mode 100644
index 0e90f2b..0000000
--- a/hotspot/src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/jdi/SDE.java
+++ /dev/null
@@ -1,685 +0,0 @@
-/*
- * Copyright (c) 2002, 2003, 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 sun.jvm.hotspot.jdi;
-
-import com.sun.jdi.*;
-
-import java.util.*;
-import java.io.File;
-
-class SDE {
-    private static final int INIT_SIZE_FILE = 3;
-    private static final int INIT_SIZE_LINE = 100;
-    private static final int INIT_SIZE_STRATUM = 3;
-
-    static final String BASE_STRATUM_NAME = "Java";
-
-    /* for C capatibility */
-    static final String NullString = null;
-
-    private class FileTableRecord {
-        int fileId;
-        String sourceName;
-        String sourcePath; // do not read - use accessor
-        boolean isConverted = false;
-
-        /**
-         * Return the sourcePath, computing it if not set.
-         * If set, convert '/' in the sourcePath to the
-         * local file separator.
-         */
-        String getSourcePath(ReferenceTypeImpl refType) {
-            if (!isConverted) {
-                if (sourcePath == null) {
-                    sourcePath = refType.baseSourceDir() + sourceName;
-                } else {
-                    StringBuffer buf = new StringBuffer();
-                    for (int i = 0; i < sourcePath.length(); ++i) {
-                        char ch = sourcePath.charAt(i);
-                        if (ch == '/') {
-                            buf.append(File.separatorChar);
-                        } else {
-                            buf.append(ch);
-                        }
-                    }
-                    sourcePath = buf.toString();
-                }
-                isConverted = true;
-            }
-            return sourcePath;
-        }
-    }
-
-    private class LineTableRecord {
-        int jplsStart;
-        int jplsEnd;
-        int jplsLineInc;
-        int njplsStart;
-        int njplsEnd;
-        int fileId;
-    }
-
-    private class StratumTableRecord {
-        String id;
-        int fileIndex;
-        int lineIndex;
-    }
-
-    class Stratum {
-        private final int sti; /* stratum index */
-
-        private Stratum(int sti) {
-            this.sti = sti;
-        }
-
-        String id() {
-            return stratumTable[sti].id;
-        }
-
-        boolean isJava() {
-            return sti == baseStratumIndex;
-        }
-
-        /**
-         * Return all the sourceNames for this stratum.
-         * Look from our starting fileIndex upto the starting
-         * fileIndex of next stratum - can do this since there
-         * is always a terminator stratum.
-         * Default sourceName (the first one) must be first.
-         */
-        List sourceNames(ReferenceTypeImpl refType) {
-            int i;
-            int fileIndexStart = stratumTable[sti].fileIndex;
-            /* one past end */
-            int fileIndexEnd = stratumTable[sti+1].fileIndex;
-            List result = new ArrayList(fileIndexEnd - fileIndexStart);
-            for (i = fileIndexStart; i < fileIndexEnd; ++i) {
-                result.add(fileTable[i].sourceName);
-            }
-            return result;
-        }
-
-        /**
-         * Return all the sourcePaths for this stratum.
-         * Look from our starting fileIndex upto the starting
-         * fileIndex of next stratum - can do this since there
-         * is always a terminator stratum.
-         * Default sourcePath (the first one) must be first.
-         */
-        List sourcePaths(ReferenceTypeImpl refType) {
-            int i;
-            int fileIndexStart = stratumTable[sti].fileIndex;
-            /* one past end */
-            int fileIndexEnd = stratumTable[sti+1].fileIndex;
-            List result = new ArrayList(fileIndexEnd - fileIndexStart);
-            for (i = fileIndexStart; i < fileIndexEnd; ++i) {
-                result.add(fileTable[i].getSourcePath(refType));
-            }
-            return result;
-        }
-
-        LineStratum lineStratum(ReferenceTypeImpl refType,
-                                int jplsLine) {
-            int lti = stiLineTableIndex(sti, jplsLine);
-            if (lti < 0) {
-                return null;
-            } else {
-                return new LineStratum(sti, lti, refType,
-                                       jplsLine);
-            }
-        }
-    }
-
-    class LineStratum {
-        private final int sti; /* stratum index */
-        private final int lti; /* line table index */
-        private final ReferenceTypeImpl refType;
-        private final int jplsLine;
-        private String sourceName = null;
-        private String sourcePath = null;
-
-        private LineStratum(int sti, int lti,
-                            ReferenceTypeImpl refType,
-                            int jplsLine) {
-            this.sti = sti;
-            this.lti = lti;
-            this.refType = refType;
-            this.jplsLine = jplsLine;
-        }
-
-        public boolean equals(Object obj) {
-            if ((obj != null) && (obj instanceof LineStratum)) {
-                LineStratum other = (LineStratum)obj;
-                return (lti == other.lti) &&
-                       (sti == other.sti) &&
-                       (lineNumber() == other.lineNumber()) &&
-                       (refType.equals(other.refType));
-            } else {
-                return false;
-            }
-        }
-
-        int lineNumber() {
-            return stiLineNumber(sti, lti, jplsLine);
-        }
-
-        /**
-         * Fetch the source name and source path for
-         * this line, converting or constructing
-         * the source path if needed.
-         */
-        void getSourceInfo() {
-            if (sourceName != null) {
-                // already done
-                return;
-            }
-            int fti = stiFileTableIndex(sti, lti);
-            if (fti == -1) {
-                throw new InternalError(
-              "Bad SourceDebugExtension, no matching source id " +
-              lineTable[lti].fileId + " jplsLine: " + jplsLine);
-            }
-            FileTableRecord ftr = fileTable[fti];
-            sourceName = ftr.sourceName;
-            sourcePath = ftr.getSourcePath(refType);
-        }
-
-        String sourceName() {
-            getSourceInfo();
-            return sourceName;
-        }
-
-        String sourcePath() {
-            getSourceInfo();
-            return sourcePath;
-        }
-    }
-
-    private FileTableRecord[] fileTable = null;
-    private LineTableRecord[] lineTable = null;
-    private StratumTableRecord[] stratumTable = null;
-
-    private int fileIndex = 0;
-    private int lineIndex = 0;
-    private int stratumIndex = 0;
-    private int currentFileId = 0;
-
-    private int defaultStratumIndex = -1;
-    private int baseStratumIndex = -2; /* so as not to match -1 above */
-    private int sdePos = 0;
-
-    final String sourceDebugExtension;
-    String jplsFilename = null;
-    String defaultStratumId = null;
-    boolean isValid = false;
-
-    SDE(String sourceDebugExtension) {
-        this.sourceDebugExtension = sourceDebugExtension;
-        decode();
-    }
-
-    SDE() {
-        this.sourceDebugExtension = null;
-        createProxyForAbsentSDE();
-    }
-
-    char sdePeek() {
-        if (sdePos >= sourceDebugExtension.length()) {
-            syntax();
-        }
-        return sourceDebugExtension.charAt(sdePos);
-    }
-
-    char sdeRead() {
-        if (sdePos >= sourceDebugExtension.length()) {
-            syntax();
-        }
-        return sourceDebugExtension.charAt(sdePos++);
-    }
-
-    void sdeAdvance() {
-        sdePos++;
-    }
-
-    void syntax() {
-        throw new InternalError("bad SourceDebugExtension syntax - position " +
-                                sdePos);
-    }
-
-    void syntax(String msg) {
-        throw new InternalError("bad SourceDebugExtension syntax: " + msg);
-    }
-
-    void assureLineTableSize() {
-        int len = lineTable == null? 0 : lineTable.length;
-        if (lineIndex >= len) {
-            int i;
-            int newLen = len == 0? INIT_SIZE_LINE : len * 2;
-            LineTableRecord[] newTable = new LineTableRecord[newLen];
-            for (i = 0; i < len; ++i) {
-                newTable[i] = lineTable[i];
-            }
-            for (; i < newLen; ++i) {
-                newTable[i] = new LineTableRecord();
-            }
-            lineTable = newTable;
-        }
-    }
-
-    void assureFileTableSize() {
-        int len = fileTable == null? 0 : fileTable.length;
-        if (fileIndex >= len) {
-            int i;
-            int newLen = len == 0? INIT_SIZE_FILE : len * 2;
-            FileTableRecord[] newTable = new FileTableRecord[newLen];
-            for (i = 0; i < len; ++i) {
-                newTable[i] = fileTable[i];
-            }
-            for (; i < newLen; ++i) {
-                newTable[i] = new FileTableRecord();
-            }
-            fileTable = newTable;
-        }
-    }
-
-    void assureStratumTableSize() {
-        int len = stratumTable == null? 0 : stratumTable.length;
-        if (stratumIndex >= len) {
-            int i;
-            int newLen = len == 0? INIT_SIZE_STRATUM : len * 2;
-            StratumTableRecord[] newTable = new StratumTableRecord[newLen];
-            for (i = 0; i < len; ++i) {
-                newTable[i] = stratumTable[i];
-            }
-            for (; i < newLen; ++i) {
-                newTable[i] = new StratumTableRecord();
-            }
-            stratumTable = newTable;
-        }
-    }
-
-    String readLine() {
-        StringBuffer sb = new StringBuffer();
-        char ch;
-
-        ignoreWhite();
-        while (((ch = sdeRead()) != '\n') && (ch != '\r')) {
-            sb.append((char)ch);
-        }
-        // check for CR LF
-        if ((ch == '\r') && (sdePeek() == '\n')) {
-            sdeRead();
-        }
-        ignoreWhite(); // leading white
-        return sb.toString();
-    }
-
-    private int defaultStratumTableIndex() {
-        if ((defaultStratumIndex == -1) && (defaultStratumId != null)) {
-            defaultStratumIndex =
-                stratumTableIndex(defaultStratumId);
-        }
-        return defaultStratumIndex;
-    }
-
-    int stratumTableIndex(String stratumId) {
-        int i;
-
-        if (stratumId == null) {
-            return defaultStratumTableIndex();
-        }
-        for (i = 0; i < (stratumIndex-1); ++i) {
-            if (stratumTable[i].id.equals(stratumId)) {
-                return i;
-            }
-        }
-        return defaultStratumTableIndex();
-    }
-
-    Stratum stratum(String stratumID) {
-        int sti = stratumTableIndex(stratumID);
-        return new Stratum(sti);
-    }
-
-    List availableStrata() {
-        List strata = new ArrayList();
-
-        for (int i = 0; i < (stratumIndex-1); ++i) {
-            StratumTableRecord rec = stratumTable[i];
-            strata.add(rec.id);
-        }
-        return strata;
-    }
-
-/*****************************
- * below functions/methods are written to compile under either Java or C
- *
- * Needed support functions:
- *   sdePeek()
- *   sdeRead()
- *   sdeAdvance()
- *   readLine()
- *   assureLineTableSize()
- *   assureFileTableSize()
- *   assureStratumTableSize()
- *   syntax()
- *
- *   stratumTableIndex(String)
- *
- * Needed support variables:
- *   lineTable
- *   lineIndex
- *   fileTable
- *   fileIndex
- *   currentFileId
- *
- * Needed types:
- *   String
- *
- * Needed constants:
- *   NullString
- */
-
-    void ignoreWhite() {
-        char ch;
-
-        while (((ch = sdePeek()) == ' ') || (ch == '\t')) {
-            sdeAdvance();
-        }
-    }
-
-    void ignoreLine() {
-        char ch;
-
-        while (((ch = sdeRead()) != '\n') && (ch != '\r')) {
-        }
-        /* check for CR LF */
-        if ((ch == '\r') && (sdePeek() == '\n')) {
-            sdeAdvance();
-        }
-        ignoreWhite(); /* leading white */
-    }
-
-    int readNumber() {
-        int value = 0;
-        char ch;
-
-        ignoreWhite();
-        while (((ch = sdePeek()) >= '0') && (ch <= '9')) {
-            sdeAdvance();
-            value = (value * 10) + ch - '0';
-        }
-        ignoreWhite();
-        return value;
-    }
-
-    void storeFile(int fileId, String sourceName, String sourcePath) {
-        assureFileTableSize();
-        fileTable[fileIndex].fileId = fileId;
-        fileTable[fileIndex].sourceName = sourceName;
-        fileTable[fileIndex].sourcePath = sourcePath;
-        ++fileIndex;
-    }
-
-    void fileLine() {
-        int hasAbsolute = 0; /* acts as boolean */
-        int fileId;
-        String sourceName;
-        String sourcePath = null;
-
-        /* is there an absolute filename? */
-        if (sdePeek() == '+') {
-            sdeAdvance();
-            hasAbsolute = 1;
-        }
-        fileId = readNumber();
-        sourceName = readLine();
-        if (hasAbsolute == 1) {
-            sourcePath = readLine();
-        }
-
-        storeFile(fileId, sourceName, sourcePath);
-    }
-
-    void storeLine(int jplsStart, int jplsEnd, int jplsLineInc,
-                  int njplsStart, int njplsEnd, int fileId) {
-        assureLineTableSize();
-        lineTable[lineIndex].jplsStart = jplsStart;
-        lineTable[lineIndex].jplsEnd = jplsEnd;
-        lineTable[lineIndex].jplsLineInc = jplsLineInc;
-        lineTable[lineIndex].njplsStart = njplsStart;
-        lineTable[lineIndex].njplsEnd = njplsEnd;
-        lineTable[lineIndex].fileId = fileId;
-        ++lineIndex;
-    }
-
-    /**
-     * Parse line translation info.  Syntax is
-     *     <NJ-start-line> [ # <file-id> ] [ , <line-count> ] :
-     *                 <J-start-line> [ , <line-increment> ] CR
-     */
-    void lineLine() {
-        int lineCount = 1;
-        int lineIncrement = 1;
-        int njplsStart;
-        int jplsStart;
-
-        njplsStart = readNumber();
-
-        /* is there a fileID? */
-        if (sdePeek() == '#') {
-            sdeAdvance();
-            currentFileId = readNumber();
-        }
-
-        /* is there a line count? */
-        if (sdePeek() == ',') {
-            sdeAdvance();
-            lineCount = readNumber();
-        }
-
-        if (sdeRead() != ':') {
-            syntax();
-        }
-        jplsStart = readNumber();
-        if (sdePeek() == ',') {
-            sdeAdvance();
-            lineIncrement = readNumber();
-        }
-        ignoreLine(); /* flush the rest */
-
-        storeLine(jplsStart,
-                  jplsStart + (lineCount * lineIncrement) -1,
-                  lineIncrement,
-                  njplsStart,
-                  njplsStart + lineCount -1,
-                  currentFileId);
-    }
-
-    /**
-     * Until the next stratum section, everything after this
-     * is in stratumId - so, store the current indicies.
-     */
-    void storeStratum(String stratumId) {
-        /* remove redundant strata */
-        if (stratumIndex > 0) {
-            if ((stratumTable[stratumIndex-1].fileIndex
-                                            == fileIndex) &&
-                (stratumTable[stratumIndex-1].lineIndex
-                                            == lineIndex)) {
-                /* nothing changed overwrite it */
-                --stratumIndex;
-            }
-        }
-        /* store the results */
-        assureStratumTableSize();
-        stratumTable[stratumIndex].id = stratumId;
-        stratumTable[stratumIndex].fileIndex = fileIndex;
-        stratumTable[stratumIndex].lineIndex = lineIndex;
-        ++stratumIndex;
-        currentFileId = 0;
-    }
-
-    /**
-     * The beginning of a stratum's info
-     */
-    void stratumSection() {
-        storeStratum(readLine());
-    }
-
-    void fileSection() {
-        ignoreLine();
-        while (sdePeek() != '*') {
-            fileLine();
-        }
-    }
-
-    void lineSection() {
-        ignoreLine();
-        while (sdePeek() != '*') {
-            lineLine();
-        }
-    }
-
-    /**
-     * Ignore a section we don't know about.
-     */
-    void ignoreSection() {
-        ignoreLine();
-        while (sdePeek() != '*') {
-            ignoreLine();
-        }
-    }
-
-    /**
-     * A base "Java" stratum is always available, though
-     * it is not in the SourceDebugExtension.
-     * Create the base stratum.
-     */
-    void createJavaStratum() {
-        baseStratumIndex = stratumIndex;
-        storeStratum(BASE_STRATUM_NAME);
-        storeFile(1, jplsFilename, NullString);
-        /* JPL line numbers cannot exceed 65535 */
-        storeLine(1, 65536, 1, 1, 65536, 1);
-        storeStratum("Aux"); /* in case they don't declare */
-    }
-
-    /**
-     * Decode a SourceDebugExtension which is in SourceMap format.
-     * This is the entry point into the recursive descent parser.
-     */
-    void decode() {
-        /* check for "SMAP" - allow EOF if not ours */
-        if ((sourceDebugExtension.length() < 4) ||
-            (sdeRead() != 'S') ||
-            (sdeRead() != 'M') ||
-            (sdeRead() != 'A') ||
-            (sdeRead() != 'P')) {
-            return; /* not our info */
-        }
-        ignoreLine(); /* flush the rest */
-        jplsFilename = readLine();
-        defaultStratumId = readLine();
-        createJavaStratum();
-        while (true) {
-            if (sdeRead() != '*') {
-                syntax();
-            }
-            switch (sdeRead()) {
-                case 'S':
-                    stratumSection();
-                    break;
-                case 'F':
-                    fileSection();
-                    break;
-                case 'L':
-                    lineSection();
-                    break;
-                case 'E':
-                    /* set end points */
-                    storeStratum("*terminator*");
-                    isValid = true;
-                    return;
-                default:
-                    ignoreSection();
-            }
-        }
-    }
-
-    void createProxyForAbsentSDE() {
-        jplsFilename = null;
-        defaultStratumId = BASE_STRATUM_NAME;
-        defaultStratumIndex = stratumIndex;
-        createJavaStratum();
-        storeStratum("*terminator*");
-    }
-
-    /***************** query functions ***********************/
-
-    private int stiLineTableIndex(int sti, int jplsLine) {
-        int i;
-        int lineIndexStart;
-        int lineIndexEnd;
-
-        lineIndexStart = stratumTable[sti].lineIndex;
-        /* one past end */
-        lineIndexEnd = stratumTable[sti+1].lineIndex;
-        for (i = lineIndexStart; i < lineIndexEnd; ++i) {
-            if ((jplsLine >= lineTable[i].jplsStart) &&
-                            (jplsLine <= lineTable[i].jplsEnd)) {
-                return i;
-            }
-        }
-        return -1;
-    }
-
-    private int stiLineNumber(int sti, int lti, int jplsLine) {
-        return lineTable[lti].njplsStart +
-                (((jplsLine - lineTable[lti].jplsStart) /
-                                   lineTable[lti].jplsLineInc));
-    }
-
-    private int fileTableIndex(int sti, int fileId) {
-        int i;
-        int fileIndexStart = stratumTable[sti].fileIndex;
-        /* one past end */
-        int fileIndexEnd = stratumTable[sti+1].fileIndex;
-        for (i = fileIndexStart; i < fileIndexEnd; ++i) {
-            if (fileTable[i].fileId == fileId) {
-                return i;
-            }
-        }
-        return -1;
-    }
-
-    private int stiFileTableIndex(int sti, int lti) {
-        return fileTableIndex(sti, lineTable[lti].fileId);
-    }
-
-    boolean isValid() {
-        return isValid;
-    }
-}
diff --git a/hotspot/src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/jdi/ShortTypeImpl.java b/hotspot/src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/jdi/ShortTypeImpl.java
deleted file mode 100644
index 03c1959..0000000
--- a/hotspot/src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/jdi/ShortTypeImpl.java
+++ /dev/null
@@ -1,43 +0,0 @@
-/*
- * Copyright (c) 2002, 2003, 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 sun.jvm.hotspot.jdi;
-
-import com.sun.jdi.*;
-
-public class ShortTypeImpl extends PrimitiveTypeImpl implements ShortType {
-    ShortTypeImpl(VirtualMachine vm) {
-        super(vm);
-    }
-
-
-    public String signature() {
-        return "S";
-    }
-
-    PrimitiveValue convert(PrimitiveValue value) throws InvalidTypeException {
-        return vm.mirrorOf(((PrimitiveValueImpl)value).checkedShortValue());
-    }
-
-}
diff --git a/hotspot/src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/jdi/ShortValueImpl.java b/hotspot/src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/jdi/ShortValueImpl.java
deleted file mode 100644
index afbbcda..0000000
--- a/hotspot/src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/jdi/ShortValueImpl.java
+++ /dev/null
@@ -1,118 +0,0 @@
-/*
- * Copyright (c) 2002, 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.
- *
- * 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.jvm.hotspot.jdi;
-
-import com.sun.jdi.*;
-
-public class ShortValueImpl extends PrimitiveValueImpl
-                            implements ShortValue {
-    private short value;
-
-    ShortValueImpl(VirtualMachine aVm,short aValue) {
-        super(aVm);
-
-        value = aValue;
-    }
-
-    public boolean equals(Object obj) {
-        if ((obj != null) && (obj instanceof ShortValue)) {
-            return (value == ((ShortValue)obj).value()) &&
-                   super.equals(obj);
-        } else {
-            return false;
-        }
-    }
-
-    public int hashCode() {
-        /*
-         * TO DO: Better hash code
-         */
-        return intValue();
-    }
-
-    public int compareTo(ShortValue shortVal) {
-        return value() - shortVal.value();
-    }
-
-    public Type type() {
-        return vm.theShortType();
-    }
-
-    public short value() {
-        return value;
-    }
-
-    public boolean booleanValue() {
-        return(value == 0)?false:true;
-    }
-
-    public byte byteValue() {
-        return(byte)value;
-    }
-
-    public char charValue() {
-        return(char)value;
-    }
-
-    public short shortValue() {
-        return(short)value;
-    }
-
-    public int intValue() {
-        return(int)value;
-    }
-
-    public long longValue() {
-        return(long)value;
-    }
-
-    public float floatValue() {
-        return(float)value;
-    }
-
-    public double doubleValue() {
-        return(double)value;
-    }
-
-    byte checkedByteValue() throws InvalidTypeException {
-        if ((value > Byte.MAX_VALUE) || (value < Byte.MIN_VALUE)) {
-            throw new InvalidTypeException("Can't convert " + value + " to byte");
-        } else {
-            return super.checkedByteValue();
-        }
-    }
-
-    char checkedCharValue() throws InvalidTypeException {
-        if ((value > Character.MAX_VALUE) || (value < Character.MIN_VALUE)) {
-            throw new InvalidTypeException("Can't convert " + value + " to char");
-        } else {
-            return super.checkedCharValue();
-        }
-    }
-
-    public String toString() {
-        return "" + value;
-    }
-}
diff --git a/hotspot/src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/jdi/StackFrameImpl.java b/hotspot/src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/jdi/StackFrameImpl.java
deleted file mode 100644
index 69461d3..0000000
--- a/hotspot/src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/jdi/StackFrameImpl.java
+++ /dev/null
@@ -1,314 +0,0 @@
-/*
- * Copyright (c) 2002, 2005, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation.
- *
- * 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.jvm.hotspot.jdi;
-
-import com.sun.jdi.*;
-import sun.jvm.hotspot.oops.ObjectHeap;
-import sun.jvm.hotspot.debugger.OopHandle;
-import sun.jvm.hotspot.oops.Array;
-import sun.jvm.hotspot.oops.ObjArray;
-import sun.jvm.hotspot.oops.TypeArray;
-import sun.jvm.hotspot.oops.Instance;
-import sun.jvm.hotspot.runtime.BasicType;
-import sun.jvm.hotspot.runtime.JavaVFrame;
-import sun.jvm.hotspot.runtime.StackValue;
-import sun.jvm.hotspot.runtime.StackValueCollection;
-import sun.jvm.hotspot.utilities.Assert;
-import java.util.List;
-import java.util.Map;
-import java.util.ArrayList;
-import java.util.HashMap;
-import java.util.Iterator;
-import java.util.Collections;
-
-public class StackFrameImpl extends MirrorImpl
-                            implements StackFrame
-{
-    /* Once false, frame should not be used.
-     * access synchronized on (vm.state())
-     */
-    private boolean isValid = true;
-
-    private final ThreadReferenceImpl thread;
-    private final JavaVFrame saFrame;
-    private final Location location;
-    private Map visibleVariables =  null;
-    private ObjectReference thisObject = null;
-
-    StackFrameImpl(VirtualMachine vm, ThreadReferenceImpl thread,
-                   JavaVFrame jvf) {
-        super(vm);
-        this.thread = thread;
-        this.saFrame = jvf;
-
-        sun.jvm.hotspot.oops.Method SAMethod = jvf.getMethod();
-
-        ReferenceType rt = ((VirtualMachineImpl)vm).referenceType(SAMethod.getMethodHolder());
-
-        this.location = new LocationImpl(vm, rt, SAMethod, (long)jvf.getBCI());
-    }
-
-    private void validateStackFrame() {
-        if (!isValid) {
-            throw new InvalidStackFrameException("Thread has been resumed");
-        }
-    }
-
-    JavaVFrame getJavaVFrame() {
-        return saFrame;
-    }
-
-    /**
-     * Return the frame location.
-     * Need not be synchronized since it cannot be provably stale.
-     */
-    public Location location() {
-        validateStackFrame();
-        return location;
-    }
-
-    /**
-     * Return the thread holding the frame.
-     * Need not be synchronized since it cannot be provably stale.
-     */
-    public ThreadReference thread() {
-        validateStackFrame();
-        return thread;
-    }
-
-    public boolean equals(Object obj) {
-        if ((obj != null) && (obj instanceof StackFrameImpl)) {
-            StackFrameImpl other = (StackFrameImpl)obj;
-            return (saFrame.equals(other.saFrame));
-        } else {
-            return false;
-        }
-    }
-
-    public int hashCode() {
-        return saFrame.hashCode();
-    }
-
-    public ObjectReference thisObject() {
-        validateStackFrame();
-        MethodImpl currentMethod = (MethodImpl)location.method();
-        if (currentMethod.isStatic() || currentMethod.isNative()) {
-            return null;
-        }
-        if (thisObject == null) {
-            StackValueCollection values = saFrame.getLocals();
-            if (Assert.ASSERTS_ENABLED) {
-                Assert.that(values.size() > 0, "this is missing");
-            }
-            // 'this' at index 0.
-            if (values.get(0).getType() == BasicType.getTConflict()) {
-              return null;
-            }
-            OopHandle handle = values.oopHandleAt(0);
-            ObjectHeap heap = vm.saObjectHeap();
-            thisObject = vm.objectMirror(heap.newOop(handle));
-        }
-        return thisObject;
-    }
-
-    /**
-     * Build the visible variable map.
-     * Need not be synchronized since it cannot be provably stale.
-     */
-    private void createVisibleVariables() throws AbsentInformationException {
-        if (visibleVariables == null) {
-            List allVariables = location.method().variables();
-            Map map = new HashMap(allVariables.size());
-
-            Iterator iter = allVariables.iterator();
-            while (iter.hasNext()) {
-                LocalVariableImpl variable = (LocalVariableImpl)iter.next();
-                String name = variable.name();
-                if (variable.isVisible(this)) {
-                    LocalVariable existing = (LocalVariable)map.get(name);
-                    if ((existing == null) ||
-                        variable.hides(existing)) {
-                        map.put(name, variable);
-                    }
-                }
-            }
-            visibleVariables = map;
-        }
-    }
-
-    /**
-     * Return the list of visible variable in the frame.
-     * Need not be synchronized since it cannot be provably stale.
-     */
-    public List visibleVariables() throws AbsentInformationException {
-        validateStackFrame();
-        createVisibleVariables();
-        List mapAsList = new ArrayList(visibleVariables.values());
-        Collections.sort(mapAsList);
-        return mapAsList;
-    }
-
-    /**
-     * Return a particular variable in the frame.
-     * Need not be synchronized since it cannot be provably stale.
-     */
-    public LocalVariable visibleVariableByName(String name) throws AbsentInformationException  {
-        validateStackFrame();
-        createVisibleVariables();
-        return (LocalVariable)visibleVariables.get(name);
-    }
-
-    public Value getValue(LocalVariable variable) {
-        List list = new ArrayList(1);
-        list.add(variable);
-        Map map = getValues(list);
-        return (Value)map.get(variable);
-    }
-
-    public Map getValues(List variables) {
-        validateStackFrame();
-        StackValueCollection values = saFrame.getLocals();
-
-        int count = variables.size();
-        Map map = new HashMap(count);
-        for (int ii=0; ii<count; ++ii) {
-            LocalVariableImpl variable = (LocalVariableImpl)variables.get(ii);
-            if (!variable.isVisible(this)) {
-                throw new IllegalArgumentException(variable.name() +
-                                 " is not valid at this frame location");
-            }
-            ValueImpl valueImpl;
-            int ss = variable.slot();
-            char c = variable.signature().charAt(0);
-            BasicType variableType = BasicType.charToBasicType(c);
-            valueImpl = getSlotValue(values, variableType, ss);
-            map.put(variable, valueImpl);
-        }
-        return map;
-    }
-
-    public List getArgumentValues() {
-        validateStackFrame();
-        StackValueCollection values = saFrame.getLocals();
-        MethodImpl mmm = (MethodImpl)location.method();
-        if (mmm.isNative())
-            return null;
-        List argSigs = mmm.argumentSignatures();
-        int count = argSigs.size();
-        List res = new ArrayList(0);
-
-        int slot = mmm.isStatic()? 0 : 1;
-        for (int ii = 0; ii < count; ++slot, ++ii) {
-            char sigChar = ((String)argSigs.get(ii)).charAt(0);
-            BasicType variableType = BasicType.charToBasicType(sigChar);
-            res.add(getSlotValue(values, variableType, slot));
-            if (sigChar == 'J' || sigChar == 'D') {
-                slot++;
-            }
-        }
-        return res;
-    }
-
-    private ValueImpl getSlotValue(StackValueCollection values,
-                       BasicType variableType, int ss) {
-        ValueImpl valueImpl = null;
-        OopHandle handle = null;
-        ObjectHeap heap = vm.saObjectHeap();
-        if (values.get(ss).getType() == BasicType.getTConflict()) {
-          // Dead locals, so just represent them as a zero of the appropriate type
-          if (variableType == BasicType.T_BOOLEAN) {
-            valueImpl = (BooleanValueImpl) vm.mirrorOf(false);
-          } else if (variableType == BasicType.T_CHAR) {
-            valueImpl = (CharValueImpl) vm.mirrorOf((char)0);
-          } else if (variableType == BasicType.T_FLOAT) {
-            valueImpl = (FloatValueImpl) vm.mirrorOf((float)0);
-          } else if (variableType == BasicType.T_DOUBLE) {
-            valueImpl = (DoubleValueImpl) vm.mirrorOf((double)0);
-          } else if (variableType == BasicType.T_BYTE) {
-            valueImpl = (ByteValueImpl) vm.mirrorOf((byte)0);
-          } else if (variableType == BasicType.T_SHORT) {
-            valueImpl = (ShortValueImpl) vm.mirrorOf((short)0);
-          } else if (variableType == BasicType.T_INT) {
-            valueImpl = (IntegerValueImpl) vm.mirrorOf((int)0);
-          } else if (variableType == BasicType.T_LONG) {
-            valueImpl = (LongValueImpl) vm.mirrorOf((long)0);
-          } else if (variableType == BasicType.T_OBJECT) {
-            // we may have an [Ljava/lang/Object; - i.e., Object[] with the
-            // elements themselves may be arrays because every array is an Object.
-            handle = null;
-            valueImpl = (ObjectReferenceImpl) vm.objectMirror(heap.newOop(handle));
-          } else if (variableType == BasicType.T_ARRAY) {
-            handle = null;
-            valueImpl = vm.arrayMirror((Array)heap.newOop(handle));
-          } else if (variableType == BasicType.T_VOID) {
-            valueImpl = new VoidValueImpl(vm);
-          } else {
-            throw new RuntimeException("Should not read here");
-          }
-        } else {
-          if (variableType == BasicType.T_BOOLEAN) {
-            valueImpl = (BooleanValueImpl) vm.mirrorOf(values.booleanAt(ss));
-          } else if (variableType == BasicType.T_CHAR) {
-            valueImpl = (CharValueImpl) vm.mirrorOf(values.charAt(ss));
-          } else if (variableType == BasicType.T_FLOAT) {
-            valueImpl = (FloatValueImpl) vm.mirrorOf(values.floatAt(ss));
-          } else if (variableType == BasicType.T_DOUBLE) {
-            valueImpl = (DoubleValueImpl) vm.mirrorOf(values.doubleAt(ss));
-          } else if (variableType == BasicType.T_BYTE) {
-            valueImpl = (ByteValueImpl) vm.mirrorOf(values.byteAt(ss));
-          } else if (variableType == BasicType.T_SHORT) {
-            valueImpl = (ShortValueImpl) vm.mirrorOf(values.shortAt(ss));
-          } else if (variableType == BasicType.T_INT) {
-            valueImpl = (IntegerValueImpl) vm.mirrorOf(values.intAt(ss));
-          } else if (variableType == BasicType.T_LONG) {
-            valueImpl = (LongValueImpl) vm.mirrorOf(values.longAt(ss));
-          } else if (variableType == BasicType.T_OBJECT) {
-            // we may have an [Ljava/lang/Object; - i.e., Object[] with the
-            // elements themselves may be arrays because every array is an Object.
-            handle = values.oopHandleAt(ss);
-            valueImpl = (ObjectReferenceImpl) vm.objectMirror(heap.newOop(handle));
-          } else if (variableType == BasicType.T_ARRAY) {
-            handle = values.oopHandleAt(ss);
-            valueImpl = vm.arrayMirror((Array)heap.newOop(handle));
-          } else if (variableType == BasicType.T_VOID) {
-            valueImpl = new VoidValueImpl(vm);
-          } else {
-            throw new RuntimeException("Should not read here");
-          }
-        }
-
-        return valueImpl;
-    }
-
-    public void setValue(LocalVariable variableIntf, Value valueIntf)
-        throws InvalidTypeException, ClassNotLoadedException {
-
-        vm.throwNotReadOnlyException("StackFrame.setValue()");
-    }
-
-    public String toString() {
-        return location.toString() + " in thread " + thread.toString();
-    }
-}
diff --git a/hotspot/src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/jdi/StratumLineInfo.java b/hotspot/src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/jdi/StratumLineInfo.java
deleted file mode 100644
index 3ab46b4..0000000
--- a/hotspot/src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/jdi/StratumLineInfo.java
+++ /dev/null
@@ -1,66 +0,0 @@
-/*
- * Copyright (c) 2002, 2003, 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 sun.jvm.hotspot.jdi;
-
-import com.sun.jdi.*;
-
-class StratumLineInfo implements LineInfo {
-    private final String stratumID;
-    private final int lineNumber;
-    private final String sourceName;
-    private final String sourcePath;
-
-    StratumLineInfo(String stratumID, int lineNumber,
-                    String sourceName, String sourcePath) {
-        this.stratumID = stratumID;
-        this.lineNumber = lineNumber;
-        this.sourceName = sourceName;
-        this.sourcePath = sourcePath;
-    }
-
-    public String liStratum() {
-        return stratumID;
-    }
-
-    public int liLineNumber() {
-        return lineNumber;
-    }
-
-    public String liSourceName()
-                            throws AbsentInformationException {
-        if (sourceName == null) {
-            throw new AbsentInformationException();
-        }
-        return sourceName;
-    }
-
-    public String liSourcePath()
-                            throws AbsentInformationException {
-        if (sourcePath == null) {
-            throw new AbsentInformationException();
-        }
-        return sourcePath;
-    }
-}
diff --git a/hotspot/src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/jdi/StringReferenceImpl.java b/hotspot/src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/jdi/StringReferenceImpl.java
deleted file mode 100644
index c73bf43..0000000
--- a/hotspot/src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/jdi/StringReferenceImpl.java
+++ /dev/null
@@ -1,48 +0,0 @@
-/*
- * Copyright (c) 2002, 2003, 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 sun.jvm.hotspot.jdi;
-
-import com.sun.jdi.*;
-import sun.jvm.hotspot.oops.Instance;
-import sun.jvm.hotspot.oops.OopUtilities;
-
-public class StringReferenceImpl extends ObjectReferenceImpl
-    implements StringReference
-{
-    private String value;
-
-    StringReferenceImpl(VirtualMachine aVm, sun.jvm.hotspot.oops.Instance oRef) {
-        super(aVm,oRef);
-        value = OopUtilities.stringOopToString(oRef);
-    }
-
-    public String value() {
-        return value;
-    }
-
-    public String toString() {
-        return "\"" + value() + "\"";
-    }
-}
diff --git a/hotspot/src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/jdi/ThreadGroupReferenceImpl.java b/hotspot/src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/jdi/ThreadGroupReferenceImpl.java
deleted file mode 100644
index 28159b1..0000000
--- a/hotspot/src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/jdi/ThreadGroupReferenceImpl.java
+++ /dev/null
@@ -1,95 +0,0 @@
-/*
- * Copyright (c) 2002, 2003, 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 sun.jvm.hotspot.jdi;
-
-import sun.jvm.hotspot.oops.Oop;
-import sun.jvm.hotspot.oops.Instance;
-import sun.jvm.hotspot.oops.OopUtilities;
-import sun.jvm.hotspot.runtime.JavaThread;
-import com.sun.jdi.*;
-import java.util.*;
-
-public class ThreadGroupReferenceImpl extends ObjectReferenceImpl
-    implements ThreadGroupReference
-{
-    ThreadGroupReferenceImpl(VirtualMachine aVm, sun.jvm.hotspot.oops.Oop oRef) {
-        super(aVm, oRef);
-    }
-
-    protected String description() {
-        return "ThreadGroupReference " + uniqueID();
-    }
-
-    public String name() {
-        return OopUtilities.threadGroupOopGetName(ref());
-    }
-
-    public ThreadGroupReference parent() {
-        return (ThreadGroupReferenceImpl)vm.threadGroupMirror(
-               (Instance)OopUtilities.threadGroupOopGetParent(ref()));
-    }
-
-    public void suspend() {
-        vm.throwNotReadOnlyException("ThreadGroupReference.suspend()");
-    }
-
-    public void resume() {
-        vm.throwNotReadOnlyException("ThreadGroupReference.resume()");
-    }
-
-    public List threads() {
-        // Each element of this array is the Oop for a thread;
-        // NOTE it is not the JavaThread that we need to create
-        // a ThreadReferenceImpl.
-        Oop[] myThreads = OopUtilities.threadGroupOopGetThreads(ref());
-
-        ArrayList myList = new ArrayList(myThreads.length);
-        for (int ii = 0; ii < myThreads.length; ii++) {
-            JavaThread jt = OopUtilities.threadOopGetJavaThread(myThreads[ii]);
-            if (jt != null) {
-                ThreadReferenceImpl xx = (ThreadReferenceImpl)vm.threadMirror(jt);
-                myList.add(xx);
-            }
-        }
-        return myList;
-    }
-
-    public List threadGroups() {
-        Oop[] myGroups = OopUtilities.threadGroupOopGetGroups(ref());
-        ArrayList myList = new ArrayList(myGroups.length);
-        for (int ii = 0; ii < myGroups.length; ii++) {
-            ThreadGroupReferenceImpl xx = (ThreadGroupReferenceImpl)vm.threadGroupMirror(
-                                          (Instance)myGroups[ii]);
-            myList.add(xx);
-
-        }
-        return myList;
-    }
-
-    public String toString() {
-        return "instance of " + referenceType().name() +
-               "(name='" + name() + "', " + "id=" + uniqueID() + ")";
-    }
-}
diff --git a/hotspot/src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/jdi/ThreadReferenceImpl.java b/hotspot/src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/jdi/ThreadReferenceImpl.java
deleted file mode 100644
index d6b1732..0000000
--- a/hotspot/src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/jdi/ThreadReferenceImpl.java
+++ /dev/null
@@ -1,400 +0,0 @@
-/*
- * Copyright (c) 2002, 2009, 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 sun.jvm.hotspot.jdi;
-
-import sun.jvm.hotspot.debugger.OopHandle;
-import sun.jvm.hotspot.runtime.VMObject;
-import sun.jvm.hotspot.runtime.JavaThread;
-import sun.jvm.hotspot.runtime.OSThread;
-//import sun.jvm.hotspot.runtime.StackFrameStream;
-import sun.jvm.hotspot.runtime.JavaVFrame;
-import sun.jvm.hotspot.runtime.JavaThreadState;
-import sun.jvm.hotspot.runtime.MonitorInfo;
-import sun.jvm.hotspot.runtime.ObjectMonitor;
-import sun.jvm.hotspot.oops.Oop;
-import sun.jvm.hotspot.oops.ObjectHeap;
-import sun.jvm.hotspot.oops.Instance;
-import sun.jvm.hotspot.oops.OopUtilities;
-import sun.jvm.hotspot.oops.Klass;
-import sun.jvm.hotspot.utilities.Assert;
-import com.sun.jdi.*;
-import java.util.*;
-
-public class ThreadReferenceImpl extends ObjectReferenceImpl
-             implements ThreadReference, /* imports */ JVMTIThreadState {
-
-    private JavaThread myJavaThread;
-    private ArrayList frames;    // StackFrames
-    private List ownedMonitors; // List<ObjectReferenceImpl>
-    private List ownedMonitorsInfo; // List<MonitorInfo>
-    private ObjectReferenceImpl currentContendingMonitor;
-
-    ThreadReferenceImpl(VirtualMachine aVm, sun.jvm.hotspot.runtime.JavaThread aRef) {
-        // We are given a JavaThread and save it in our myJavaThread field.
-        // But, our parent class is an ObjectReferenceImpl so we need an Oop
-        // for it.  JavaThread is a wrapper around a Thread Oop so we get
-        // that Oop and give it to our super.
-        // We can get it back again by calling ref().
-        super(aVm, (Instance)aRef.getThreadObj());
-        myJavaThread = aRef;
-    }
-
-    ThreadReferenceImpl(VirtualMachine vm, Instance oRef) {
-        // Instance must be of type java.lang.Thread
-        super(vm, oRef);
-
-        // JavaThread retrieved from java.lang.Thread instance may be null.
-        // This is the case for threads not-started and for zombies. Wherever
-        // appropriate, check for null instead of resulting in NullPointerException.
-        myJavaThread = OopUtilities.threadOopGetJavaThread(oRef);
-    }
-
-    // return value may be null. refer to the comment in constructor.
-    JavaThread getJavaThread() {
-        return myJavaThread;
-    }
-
-    protected String description() {
-        return "ThreadReference " + uniqueID();
-    }
-
-    /**
-     * Note that we only cache the name string while suspended because
-     * it can change via Thread.setName arbitrarily
-     */
-    public String name() {
-        return OopUtilities.threadOopGetName(ref());
-    }
-
-    public void suspend() {
-        vm.throwNotReadOnlyException("ThreadReference.suspend()");
-    }
-
-    public void resume() {
-        vm.throwNotReadOnlyException("ThreadReference.resume()");
-    }
-
-    public int suspendCount() {
-        // all threads are "suspended" when we attach to process or core.
-        // we interpret this as one suspend.
-        return 1;
-    }
-
-    public void stop(ObjectReference throwable) throws InvalidTypeException {
-        vm.throwNotReadOnlyException("ThreadReference.stop()");
-    }
-
-    public void interrupt() {
-        vm.throwNotReadOnlyException("ThreadReference.interrupt()");
-    }
-
-    // refer to jvmtiEnv::GetThreadState
-    private int jvmtiGetThreadState() {
-        // get most state bits
-        int state = OopUtilities.threadOopGetThreadStatus(ref());
-        // add more state bits
-        if (myJavaThread != null) {
-            JavaThreadState jts = myJavaThread.getThreadState();
-            if (myJavaThread.isBeingExtSuspended()) {
-                state |= JVMTI_THREAD_STATE_SUSPENDED;
-            }
-            if (jts == JavaThreadState.IN_NATIVE) {
-                state |= JVMTI_THREAD_STATE_IN_NATIVE;
-            }
-            OSThread osThread = myJavaThread.getOSThread();
-            if (osThread != null && osThread.interrupted()) {
-                state |= JVMTI_THREAD_STATE_INTERRUPTED;
-            }
-        }
-        return state;
-    }
-
-    public int status() {
-        int state = jvmtiGetThreadState();
-        int status = THREAD_STATUS_UNKNOWN;
-        // refer to map2jdwpThreadStatus in util.c (back-end)
-        if (! ((state & JVMTI_THREAD_STATE_ALIVE) != 0) ) {
-            if ((state & JVMTI_THREAD_STATE_TERMINATED) != 0) {
-                status = THREAD_STATUS_ZOMBIE;
-            } else {
-                status = THREAD_STATUS_NOT_STARTED;
-            }
-        } else {
-            if ((state & JVMTI_THREAD_STATE_SLEEPING) != 0) {
-                status = THREAD_STATUS_SLEEPING;
-            } else if ((state & JVMTI_THREAD_STATE_BLOCKED_ON_MONITOR_ENTER) != 0) {
-                status = THREAD_STATUS_MONITOR;
-            } else if ((state & JVMTI_THREAD_STATE_WAITING) != 0) {
-                status = THREAD_STATUS_WAIT;
-            } else if ((state & JVMTI_THREAD_STATE_RUNNABLE) != 0) {
-                status = THREAD_STATUS_RUNNING;
-            }
-        }
-        return status;
-    }
-
-    public boolean isSuspended() { //fixme jjh
-        // If we want to support doing this for a VM which was being
-        // debugged, then we need to fix this.
-        // In the meantime, we will say all threads are suspended,
-        // otherwise, some things won't work, like the jdb 'up' cmd.
-        return true;
-    }
-
-    public boolean isAtBreakpoint() { //fixme jjh
-        // If we want to support doing this for a VM which was being
-        // debugged, then we need to fix this.
-        return false;
-    }
-
-    public ThreadGroupReference threadGroup() {
-        return (ThreadGroupReferenceImpl)vm.threadGroupMirror(
-               (Instance)OopUtilities.threadOopGetThreadGroup(ref()));
-    }
-
-    public int frameCount() throws IncompatibleThreadStateException  { //fixme jjh
-        privateFrames(0, -1);
-        return frames.size();
-    }
-
-    public List frames() throws IncompatibleThreadStateException  {
-        return privateFrames(0, -1);
-    }
-
-    public StackFrame frame(int index) throws IncompatibleThreadStateException  {
-        List list = privateFrames(index, 1);
-        return (StackFrame)list.get(0);
-    }
-
-    public List frames(int start, int length)
-                              throws IncompatibleThreadStateException  {
-        if (length < 0) {
-            throw new IndexOutOfBoundsException(
-                "length must be greater than or equal to zero");
-        }
-        return privateFrames(start, length);
-    }
-
-    /**
-     * Private version of frames() allows "-1" to specify all
-     * remaining frames.
-     */
-
-    private List privateFrames(int start, int length)
-                              throws IncompatibleThreadStateException  {
-        if (myJavaThread == null) {
-            // for zombies and yet-to-be-started threads we need to throw exception
-            throw new IncompatibleThreadStateException();
-        }
-        if (frames == null) {
-            frames = new ArrayList(10);
-            JavaVFrame myvf = myJavaThread.getLastJavaVFrameDbg();
-            while (myvf != null) {
-                StackFrame myFrame = new StackFrameImpl(vm, this, myvf);
-                //fixme jjh null should be a Location
-                frames.add(myFrame);
-                myvf = (JavaVFrame)myvf.javaSender();
-            }
-        }
-
-        List retVal;
-        if (frames.size() == 0) {
-            retVal = new ArrayList(0);
-        } else {
-            int toIndex = start + length;
-            if (length == -1) {
-                toIndex = frames.size();
-            }
-            retVal = frames.subList(start, toIndex);
-        }
-        return Collections.unmodifiableList(retVal);
-    }
-
-    // refer to JvmtiEnvBase::get_owned_monitors
-    public List ownedMonitors()  throws IncompatibleThreadStateException {
-        if (vm.canGetOwnedMonitorInfo() == false) {
-            throw new UnsupportedOperationException();
-        }
-
-        if (myJavaThread == null) {
-           throw new IncompatibleThreadStateException();
-        }
-
-        if (ownedMonitors != null) {
-            return ownedMonitors;
-        }
-
-        ownedMonitorsWithStackDepth();
-
-        for (Iterator omi = ownedMonitorsInfo.iterator(); omi.hasNext(); ) {
-            //FIXME : Change the MonitorInfoImpl cast to com.sun.jdi.MonitorInfo
-            //        when hotspot start building with jdk1.6.
-            ownedMonitors.add(((MonitorInfoImpl)omi.next()).monitor());
-        }
-
-        return ownedMonitors;
-    }
-
-    // new method since 1.6.
-    // Real body will be supplied later.
-    public List ownedMonitorsAndFrames() throws IncompatibleThreadStateException {
-        if (!vm.canGetMonitorFrameInfo()) {
-            throw new UnsupportedOperationException(
-                "target does not support getting Monitor Frame Info");
-        }
-
-        if (myJavaThread == null) {
-           throw new IncompatibleThreadStateException();
-        }
-
-        if (ownedMonitorsInfo != null) {
-            return ownedMonitorsInfo;
-        }
-
-        ownedMonitorsWithStackDepth();
-        return ownedMonitorsInfo;
-    }
-
-    private void ownedMonitorsWithStackDepth() {
-
-        ownedMonitorsInfo = new ArrayList();
-        List lockedObjects = new ArrayList(); // List<OopHandle>
-        List stackDepth = new ArrayList(); // List<int>
-        ObjectMonitor waitingMonitor = myJavaThread.getCurrentWaitingMonitor();
-        ObjectMonitor pendingMonitor = myJavaThread.getCurrentPendingMonitor();
-        OopHandle waitingObj = null;
-        if (waitingMonitor != null) {
-            // save object of current wait() call (if any) for later comparison
-            waitingObj = waitingMonitor.object();
-        }
-        OopHandle pendingObj = null;
-        if (pendingMonitor != null) {
-            // save object of current enter() call (if any) for later comparison
-            pendingObj = pendingMonitor.object();
-        }
-
-        JavaVFrame frame = myJavaThread.getLastJavaVFrameDbg();
-        int depth=0;
-        while (frame != null) {
-            List frameMonitors = frame.getMonitors();  // List<MonitorInfo>
-            for (Iterator miItr = frameMonitors.iterator(); miItr.hasNext(); ) {
-                sun.jvm.hotspot.runtime.MonitorInfo mi = (sun.jvm.hotspot.runtime.MonitorInfo) miItr.next();
-                if (mi.eliminated() && frame.isCompiledFrame()) {
-                  continue; // skip eliminated monitor
-                }
-                OopHandle obj = mi.owner();
-                if (obj == null) {
-                    // this monitor doesn't have an owning object so skip it
-                    continue;
-                }
-
-                if (obj.equals(waitingObj)) {
-                    // the thread is waiting on this monitor so it isn't really owned
-                    continue;
-                }
-
-                if (obj.equals(pendingObj)) {
-                    // the thread is pending on this monitor so it isn't really owned
-                    continue;
-                }
-
-                boolean found = false;
-                for (Iterator loItr = lockedObjects.iterator(); loItr.hasNext(); ) {
-                    // check for recursive locks
-                    if (obj.equals(loItr.next())) {
-                        found = true;
-                        break;
-                    }
-                }
-                if (found) {
-                    // already have this object so don't include it
-                    continue;
-                }
-                // add the owning object to our list
-                lockedObjects.add(obj);
-                stackDepth.add(new Integer(depth));
-            }
-            frame = (JavaVFrame) frame.javaSender();
-            depth++;
-        }
-
-        // now convert List<OopHandle> to List<ObjectReference>
-        ObjectHeap heap = vm.saObjectHeap();
-        Iterator stk = stackDepth.iterator();
-        for (Iterator loItr = lockedObjects.iterator(); loItr.hasNext(); ) {
-            Oop obj = heap.newOop((OopHandle)loItr.next());
-            ownedMonitorsInfo.add(new MonitorInfoImpl(vm, vm.objectMirror(obj), this,
-                                                              ((Integer)stk.next()).intValue()));
-        }
-    }
-
-    // refer to JvmtiEnvBase::get_current_contended_monitor
-    public ObjectReference currentContendedMonitor()
-                              throws IncompatibleThreadStateException  {
-        if (vm.canGetCurrentContendedMonitor() == false) {
-            throw new UnsupportedOperationException();
-        }
-
-        if (myJavaThread == null) {
-           throw new IncompatibleThreadStateException();
-        }
-        ObjectMonitor mon = myJavaThread.getCurrentWaitingMonitor();
-        if (mon == null) {
-           // thread is not doing an Object.wait() call
-           mon = myJavaThread.getCurrentPendingMonitor();
-           if (mon != null) {
-               OopHandle handle = mon.object();
-               // If obj == NULL, then ObjectMonitor is raw which doesn't count
-               // as contended for this API
-               return vm.objectMirror(vm.saObjectHeap().newOop(handle));
-           } else {
-               // no contended ObjectMonitor
-               return null;
-           }
-        } else {
-           // thread is doing an Object.wait() call
-           OopHandle handle = mon.object();
-           if (Assert.ASSERTS_ENABLED) {
-               Assert.that(handle != null, "Object.wait() should have an object");
-           }
-           Oop obj = vm.saObjectHeap().newOop(handle);
-           return vm.objectMirror(obj);
-        }
-    }
-
-
-    public void popFrames(StackFrame frame) throws IncompatibleThreadStateException {
-        vm.throwNotReadOnlyException("ThreadReference.popFrames()");
-    }
-
-    public void forceEarlyReturn(Value returnValue) throws IncompatibleThreadStateException {
-        vm.throwNotReadOnlyException("ThreadReference.forceEarlyReturn()");
-    }
-
-    public String toString() {
-        return "instance of " + referenceType().name() +
-               "(name='" + name() + "', " + "id=" + uniqueID() + ")";
-    }
-}
diff --git a/hotspot/src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/jdi/TypeComponentImpl.java b/hotspot/src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/jdi/TypeComponentImpl.java
deleted file mode 100644
index 3a74843..0000000
--- a/hotspot/src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/jdi/TypeComponentImpl.java
+++ /dev/null
@@ -1,67 +0,0 @@
-/*
- * Copyright (c) 2002, 2003, 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 sun.jvm.hotspot.jdi;
-
-import com.sun.jdi.*;
-import sun.jvm.hotspot.oops.Symbol;
-import sun.jvm.hotspot.oops.Oop;
-import sun.jvm.hotspot.oops.InstanceKlass;
-
-import java.util.List;
-
-/**
- * There is no SA class that corresponds to this.  Therefore,
- * all the methods in this class which involve the SA mirror class
- * have to be implemented in the subclasses.
- */
-abstract public class TypeComponentImpl extends MirrorImpl
-    implements TypeComponent {
-
-    protected final ReferenceTypeImpl declaringType;
-    protected String signature;
-
-    TypeComponentImpl(VirtualMachine vm, ReferenceTypeImpl declaringType) {
-        super(vm);
-        this.declaringType = declaringType;
-    }
-
-    public ReferenceType declaringType() {
-        return declaringType;
-    }
-
-    public String signature() {
-        return signature;
-    }
-
-    abstract public String name();
-    abstract public int modifiers();
-    abstract public boolean isPackagePrivate();
-    abstract public boolean isPrivate();
-    abstract public boolean isProtected();
-    abstract public boolean isPublic();
-    abstract public boolean isStatic();
-    abstract public boolean isFinal();
-    abstract public int hashCode();
-}
diff --git a/hotspot/src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/jdi/TypeImpl.java b/hotspot/src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/jdi/TypeImpl.java
deleted file mode 100644
index c2e0091..0000000
--- a/hotspot/src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/jdi/TypeImpl.java
+++ /dev/null
@@ -1,60 +0,0 @@
-/*
- * Copyright (c) 2002, 2003, 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 sun.jvm.hotspot.jdi;
-
-import com.sun.jdi.*;
-
-public abstract class TypeImpl extends MirrorImpl implements Type
-{
-    private String typeName;
-
-    TypeImpl(VirtualMachine aVm) {
-        super(aVm);
-    }
-
-    public abstract String signature();
-
-    public String name() {
-        if (typeName == null) {
-            JNITypeParser parser = new JNITypeParser(signature());
-            typeName = parser.typeName();
-        }
-        return typeName;
-    }
-
-    public boolean equals(Object obj) {
-        if ((obj != null) && (obj instanceof Type)) {
-            Type other = (Type)obj;
-            return signature().equals(other.signature()) &&
-                   super.equals(obj);
-        } else {
-            return false;
-        }
-    }
-
-    public int hashCode() {
-        return signature().hashCode();
-    }
-}
diff --git a/hotspot/src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/jdi/VMModifiers.java b/hotspot/src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/jdi/VMModifiers.java
deleted file mode 100644
index a6adb73..0000000
--- a/hotspot/src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/jdi/VMModifiers.java
+++ /dev/null
@@ -1,46 +0,0 @@
-/*
- * Copyright (c) 2002, 2003, 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 sun.jvm.hotspot.jdi;
-
-import sun.jvm.hotspot.runtime.ClassConstants;
-import com.sun.jdi.*;
-
-public interface VMModifiers extends ClassConstants {
-    int PUBLIC       = (int) JVM_ACC_PUBLIC;       /* visible to everyone */
-    int PRIVATE      = (int) JVM_ACC_PRIVATE;      /* visible only to the defining class */
-    int PROTECTED    = (int) JVM_ACC_PROTECTED;    /* visible to subclasses */
-    int STATIC       = (int) JVM_ACC_STATIC;       /* instance variable is static */
-    int FINAL        = (int) JVM_ACC_FINAL;        /* no further subclassing, overriding */
-    int SYNCHRONIZED = (int) JVM_ACC_SYNCHRONIZED; /* wrap method call in monitor lock */
-    int VOLATILE     = (int) JVM_ACC_VOLATILE;     /* can cache in registers */
-    int BRIDGE       = (int) JVM_ACC_BRIDGE;       /* bridge method generated by compiler */
-    int TRANSIENT    = (int) JVM_ACC_TRANSIENT;    /* not persistant */
-    int VARARGS      = (int) JVM_ACC_VARARGS;      /* method declared with variable number of args */
-    int IS_ENUM_CONSTANT = (int) JVM_ACC_ENUM;     /* field is declared as element of enum */
-    int NATIVE       = (int) JVM_ACC_NATIVE;       /* implemented in C */
-    int INTERFACE    = (int) JVM_ACC_INTERFACE;    /* class is an interface */
-    int ABSTRACT     = (int) JVM_ACC_ABSTRACT;     /* no definition provided */
-    int SYNTHETIC    = (int) JVM_ACC_SYNTHETIC;    /* not in source code */
-}
diff --git a/hotspot/src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/jdi/ValueContainer.java b/hotspot/src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/jdi/ValueContainer.java
deleted file mode 100644
index 22ba42f..0000000
--- a/hotspot/src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/jdi/ValueContainer.java
+++ /dev/null
@@ -1,40 +0,0 @@
-/*
- * Copyright (c) 2002, 2003, 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 sun.jvm.hotspot.jdi;
-
-import com.sun.jdi.*;
-
-/*
- * This interface allows us to pass fields, variables, and
- * array components through the same interfaces. This currently allows
- * more common code for type checking. In the future we could use it for
- * more.
- */
-interface ValueContainer {
-    Type type() throws ClassNotLoadedException;
-    Type findType(String signature) throws ClassNotLoadedException;
-    String typeName();
-    String signature();
-}
diff --git a/hotspot/src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/jdi/VirtualMachineImpl.java b/hotspot/src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/jdi/VirtualMachineImpl.java
deleted file mode 100644
index be256c2..0000000
--- a/hotspot/src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/jdi/VirtualMachineImpl.java
+++ /dev/null
@@ -1,1224 +0,0 @@
-/*
- * Copyright (c) 2002, 2012, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation.
- *
- * 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.jvm.hotspot.jdi;
-
-import com.sun.jdi.*;
-import com.sun.jdi.event.EventQueue;
-import com.sun.jdi.request.EventRequestManager;
-
-import sun.jvm.hotspot.HotSpotAgent;
-import sun.jvm.hotspot.types.TypeDataBase;
-import sun.jvm.hotspot.oops.Klass;
-import sun.jvm.hotspot.oops.InstanceKlass;
-import sun.jvm.hotspot.oops.ArrayKlass;
-import sun.jvm.hotspot.oops.ObjArrayKlass;
-import sun.jvm.hotspot.oops.TypeArrayKlass;
-import sun.jvm.hotspot.oops.Oop;
-import sun.jvm.hotspot.oops.Instance;
-import sun.jvm.hotspot.oops.Array;
-import sun.jvm.hotspot.oops.ObjArray;
-import sun.jvm.hotspot.oops.TypeArray;
-import sun.jvm.hotspot.oops.Symbol;
-import sun.jvm.hotspot.oops.ObjectHeap;
-import sun.jvm.hotspot.oops.DefaultHeapVisitor;
-import sun.jvm.hotspot.oops.JVMDIClassStatus;
-import sun.jvm.hotspot.runtime.VM;
-import sun.jvm.hotspot.runtime.JavaThread;
-import sun.jvm.hotspot.memory.SystemDictionary;
-import sun.jvm.hotspot.memory.SymbolTable;
-import sun.jvm.hotspot.memory.Universe;
-import sun.jvm.hotspot.utilities.Assert;
-
-import java.util.List;
-import java.util.ArrayList;
-import java.util.Map;
-import java.util.Iterator;
-import java.util.Collections;
-import java.util.HashMap;
-import java.util.Observer;
-import java.util.StringTokenizer;
-import java.lang.ref.SoftReference;
-import java.lang.ref.ReferenceQueue;
-import java.lang.ref.Reference;
-
-public class VirtualMachineImpl extends MirrorImpl implements PathSearchingVirtualMachine {
-
-    private HotSpotAgent     saAgent = new HotSpotAgent();
-    private VM               saVM;
-    private Universe         saUniverse;
-    private SystemDictionary saSystemDictionary;
-    private SymbolTable      saSymbolTable;
-    private ObjectHeap       saObjectHeap;
-
-    VM saVM() {
-        return saVM;
-    }
-
-    SystemDictionary saSystemDictionary() {
-        return saSystemDictionary;
-    }
-
-    SymbolTable saSymbolTable() {
-        return saSymbolTable;
-    }
-
-    Universe saUniverse() {
-        return saUniverse;
-    }
-
-    ObjectHeap saObjectHeap() {
-        return saObjectHeap;
-    }
-
-    com.sun.jdi.VirtualMachineManager vmmgr;
-
-    private final ThreadGroup             threadGroupForJDI;
-
-    // Per-vm singletons for primitive types and for void.
-    // singleton-ness protected by "synchronized(this)".
-    private BooleanType theBooleanType;
-    private ByteType    theByteType;
-    private CharType    theCharType;
-    private ShortType   theShortType;
-    private IntegerType theIntegerType;
-    private LongType    theLongType;
-    private FloatType   theFloatType;
-    private DoubleType  theDoubleType;
-
-    private VoidType    theVoidType;
-
-    private VoidValue voidVal;
-    private Map       typesByID;             // Map<Klass, ReferenceTypeImpl>
-    private List      typesBySignature;      // List<ReferenceTypeImpl> - used in signature search
-    private boolean   retrievedAllTypes = false;
-    private List      bootstrapClasses;      // all bootstrap classes
-    private ArrayList allThreads;
-    private ArrayList topLevelGroups;
-    final   int       sequenceNumber;
-
-    // ObjectReference cache
-    // "objectsByID" protected by "synchronized(this)".
-    private final Map            objectsByID = new HashMap();
-    private final ReferenceQueue referenceQueue = new ReferenceQueue();
-
-    // names of some well-known classes to jdi
-    private Symbol javaLangString;
-    private Symbol javaLangThread;
-    private Symbol javaLangThreadGroup;
-    private Symbol javaLangClass;
-    private Symbol javaLangClassLoader;
-
-    // used in ReferenceTypeImpl.isThrowableBacktraceField
-    private Symbol javaLangThrowable;
-
-    // names of classes used in array assignment check
-    // refer to ArrayTypeImpl.isAssignableTo
-    private Symbol javaLangObject;
-    private Symbol javaLangCloneable;
-    private Symbol javaIoSerializable;
-
-    // symbol used in ClassTypeImpl.isEnum check
-    private Symbol javaLangEnum;
-
-    Symbol javaLangObject() {
-        return javaLangObject;
-    }
-
-    Symbol javaLangCloneable() {
-        return javaLangCloneable;
-    }
-
-    Symbol javaIoSerializable() {
-        return javaIoSerializable;
-    }
-
-    Symbol javaLangEnum() {
-        return javaLangEnum;
-    }
-
-    Symbol javaLangThrowable() {
-        return javaLangThrowable;
-    }
-
-    // name of the current default stratum
-    private String defaultStratum;
-
-    // initialize known class name symbols
-    private void initClassNameSymbols() {
-        SymbolTable st = saSymbolTable();
-        javaLangString = st.probe("java/lang/String");
-        javaLangThread = st.probe("java/lang/Thread");
-        javaLangThreadGroup = st.probe("java/lang/ThreadGroup");
-        javaLangClass = st.probe("java/lang/Class");
-        javaLangClassLoader = st.probe("java/lang/ClassLoader");
-        javaLangThrowable = st.probe("java/lang/Throwable");
-        javaLangObject = st.probe("java/lang/Object");
-        javaLangCloneable = st.probe("java/lang/Cloneable");
-        javaIoSerializable = st.probe("java/io/Serializable");
-        javaLangEnum = st.probe("java/lang/Enum");
-    }
-
-    private void init() {
-        saVM = VM.getVM();
-        saUniverse = saVM.getUniverse();
-        saSystemDictionary = saVM.getSystemDictionary();
-        saSymbolTable = saVM.getSymbolTable();
-        saObjectHeap = saVM.getObjectHeap();
-        initClassNameSymbols();
-    }
-
-    static public VirtualMachineImpl createVirtualMachineForCorefile(VirtualMachineManager mgr,
-                                                                     String javaExecutableName,
-                                                                     String coreFileName,
-                                                                     int sequenceNumber)
-        throws Exception {
-        if (Assert.ASSERTS_ENABLED) {
-            Assert.that(coreFileName != null, "SA VirtualMachineImpl: core filename = null is not yet implemented");
-        }
-        if (Assert.ASSERTS_ENABLED) {
-            Assert.that(javaExecutableName != null, "SA VirtualMachineImpl: java executable = null is not yet implemented");
-        }
-
-        VirtualMachineImpl myvm = new VirtualMachineImpl(mgr, sequenceNumber);
-        try {
-            myvm.saAgent.attach(javaExecutableName, coreFileName);
-            myvm.init();
-        } catch (Exception ee) {
-            myvm.saAgent.detach();
-            throw ee;
-        }
-        return myvm;
-    }
-
-    static public VirtualMachineImpl createVirtualMachineForPID(VirtualMachineManager mgr,
-                                                                int pid,
-                                                                int sequenceNumber)
-        throws Exception {
-
-        VirtualMachineImpl myvm = new VirtualMachineImpl(mgr, sequenceNumber);
-        try {
-            myvm.saAgent.attach(pid);
-            myvm.init();
-        } catch (Exception ee) {
-            myvm.saAgent.detach();
-            throw ee;
-        }
-        return myvm;
-    }
-
-    static public VirtualMachineImpl createVirtualMachineForServer(VirtualMachineManager mgr,
-                                                                String server,
-                                                                int sequenceNumber)
-        throws Exception {
-        if (Assert.ASSERTS_ENABLED) {
-            Assert.that(server != null, "SA VirtualMachineImpl: DebugServer = null is not yet implemented");
-        }
-
-        VirtualMachineImpl myvm = new VirtualMachineImpl(mgr, sequenceNumber);
-        try {
-            myvm.saAgent.attach(server);
-            myvm.init();
-        } catch (Exception ee) {
-            myvm.saAgent.detach();
-            throw ee;
-        }
-        return myvm;
-    }
-
-
-    VirtualMachineImpl(VirtualMachineManager mgr, int sequenceNumber)
-        throws Exception {
-        super(null);  // Can't use super(this)
-        vm = this;
-
-        this.sequenceNumber = sequenceNumber;
-        this.vmmgr = mgr;
-
-        /* Create ThreadGroup to be used by all threads servicing
-         * this VM.
-         */
-        threadGroupForJDI = new ThreadGroup("JDI [" +
-                                            this.hashCode() + "]");
-
-        ((com.sun.tools.jdi.VirtualMachineManagerImpl)mgr).addVirtualMachine(this);
-
-        // By default SA agent classes prefer Windows process debugger
-        // to windbg debugger. SA expects special properties to be set
-        // to choose other debuggers. We will set those here before
-        // attaching to SA agent.
-
-        System.setProperty("sun.jvm.hotspot.debugger.useWindbgDebugger", "true");
-    }
-
-    // we reflectively use newly spec'ed class because our ALT_BOOTDIR
-    // is 1.4.2 and not 1.5.
-    private static Class vmCannotBeModifiedExceptionClass = null;
-    void throwNotReadOnlyException(String operation) {
-        RuntimeException re = null;
-        if (vmCannotBeModifiedExceptionClass == null) {
-            try {
-                vmCannotBeModifiedExceptionClass = Class.forName("com.sun.jdi.VMCannotBeModifiedException");
-            } catch (ClassNotFoundException cnfe) {
-                vmCannotBeModifiedExceptionClass = UnsupportedOperationException.class;
-            }
-        }
-        try {
-            re = (RuntimeException) vmCannotBeModifiedExceptionClass.newInstance();
-        } catch (Exception exp) {
-            re = new RuntimeException(exp.getMessage());
-        }
-        throw re;
-    }
-
-    public boolean equals(Object obj) {
-        // Oh boy; big recursion troubles if we don't have this!
-        // See MirrorImpl.equals
-        return this == obj;
-    }
-
-    public int hashCode() {
-        // big recursion if we don't have this. See MirrorImpl.hashCode
-        return System.identityHashCode(this);
-    }
-
-    public List classesByName(String className) {
-        String signature = JNITypeParser.typeNameToSignature(className);
-        List list;
-        if (!retrievedAllTypes) {
-            retrieveAllClasses();
-        }
-        list = findReferenceTypes(signature);
-        return Collections.unmodifiableList(list);
-    }
-
-    public List allClasses() {
-        if (!retrievedAllTypes) {
-            retrieveAllClasses();
-        }
-        ArrayList a;
-        synchronized (this) {
-            a = new ArrayList(typesBySignature);
-        }
-        return Collections.unmodifiableList(a);
-    }
-
-    // classes loaded by bootstrap loader
-    List bootstrapClasses() {
-        if (bootstrapClasses == null) {
-            bootstrapClasses = new ArrayList();
-            List all = allClasses();
-            for (Iterator itr = all.iterator(); itr.hasNext();) {
-               ReferenceType type = (ReferenceType) itr.next();
-               if (type.classLoader() == null) {
-                   bootstrapClasses.add(type);
-               }
-            }
-        }
-        return bootstrapClasses;
-    }
-
-    private synchronized List findReferenceTypes(String signature) {
-        if (typesByID == null) {
-            return new ArrayList(0);
-        }
-
-        // we haven't sorted types by signatures. But we can take
-        // advantage of comparing symbols instead of name. In the worst
-        // case, we will be comparing N addresses rather than N strings
-        // where N being total no. of classes in allClasses() list.
-
-        // The signature could be Lx/y/z; or [....
-        // If it is Lx/y/z; the internal type name is x/y/x
-        // for array klasses internal type name is same as
-        // signature
-        String typeName = null;
-        if (signature.charAt(0) == 'L') {
-            typeName = signature.substring(1, signature.length() - 1);
-        } else {
-            typeName = signature;
-        }
-
-        Symbol typeNameSym = saSymbolTable().probe(typeName);
-        // if there is no symbol in VM, then we wouldn't have that type
-        if (typeNameSym == null) {
-            return new ArrayList(0);
-        }
-
-        Iterator iter = typesBySignature.iterator();
-        List list = new ArrayList();
-        while (iter.hasNext()) {
-            // We have cached type name as symbol in reference type
-            ReferenceTypeImpl type = (ReferenceTypeImpl)iter.next();
-            if (typeNameSym.equals(type.typeNameAsSymbol())) {
-                list.add(type);
-            }
-        }
-        return list;
-    }
-
-    private void retrieveAllClasses() {
-        final List saKlasses = new ArrayList();
-        SystemDictionary.ClassVisitor visitor = new SystemDictionary.ClassVisitor() {
-                public void visit(Klass k) {
-                    for (Klass l = k; l != null; l = l.arrayKlassOrNull()) {
-                        // for non-array classes filter out un-prepared classes
-                        // refer to 'allClasses' in share/back/VirtualMachineImpl.c
-                        if (l instanceof ArrayKlass) {
-                           saKlasses.add(l);
-                        } else {
-                           int status = l.getClassStatus();
-                           if ((status & JVMDIClassStatus.PREPARED) != 0) {
-                               saKlasses.add(l);
-                           }
-                        }
-                    }
-                }
-        };
-
-        // refer to jvmtiGetLoadedClasses.cpp - getLoadedClasses in VM code.
-
-        // classes from SystemDictionary
-        saSystemDictionary.classesDo(visitor);
-
-        // From SystemDictionary we do not get primitive single
-        // dimensional array classes. add primitive single dimensional array
-        // klasses from Universe.
-        saVM.getUniverse().basicTypeClassesDo(visitor);
-
-        // Hold lock during processing to improve performance
-        // and to have safe check/set of retrievedAllTypes
-        synchronized (this) {
-            if (!retrievedAllTypes) {
-                // Number of classes
-                int count = saKlasses.size();
-                for (int ii = 0; ii < count; ii++) {
-                    Klass kk = (Klass)saKlasses.get(ii);
-                    ReferenceTypeImpl type = referenceType(kk);
-                }
-                retrievedAllTypes = true;
-            }
-        }
-    }
-
-    ReferenceTypeImpl referenceType(Klass kk) {
-        ReferenceTypeImpl retType = null;
-        synchronized (this) {
-            if (typesByID != null) {
-                retType = (ReferenceTypeImpl)typesByID.get(kk);
-            }
-            if (retType == null) {
-                retType = addReferenceType(kk);
-            }
-        }
-        return retType;
-    }
-
-    private void initReferenceTypes() {
-        typesByID = new HashMap();
-        typesBySignature = new ArrayList();
-    }
-
-    private synchronized ReferenceTypeImpl addReferenceType(Klass kk) {
-        if (typesByID == null) {
-            initReferenceTypes();
-        }
-        ReferenceTypeImpl newRefType = null;
-        if (kk instanceof ObjArrayKlass || kk instanceof TypeArrayKlass) {
-            newRefType = new ArrayTypeImpl(this, (ArrayKlass)kk);
-        } else if (kk instanceof InstanceKlass) {
-            if (kk.isInterface()) {
-                newRefType = new InterfaceTypeImpl(this, (InstanceKlass)kk);
-            } else {
-                newRefType = new ClassTypeImpl(this, (InstanceKlass)kk);
-            }
-        } else {
-            throw new RuntimeException("should not reach here:" + kk);
-        }
-
-        typesByID.put(kk, newRefType);
-        typesBySignature.add(newRefType);
-        return newRefType;
-    }
-
-    ThreadGroup threadGroupForJDI() {
-        return threadGroupForJDI;
-    }
-
-    public void redefineClasses(Map classToBytes) {
-        throwNotReadOnlyException("VirtualMachineImpl.redefineClasses()");
-    }
-
-    private List getAllThreads() {
-        if (allThreads == null) {
-            allThreads = new ArrayList(10);  // Might be enough, might not be
-            for (sun.jvm.hotspot.runtime.JavaThread thread =
-                     saVM.getThreads().first(); thread != null;
-                     thread = thread.next()) {
-                // refer to JvmtiEnv::GetAllThreads in jvmtiEnv.cpp.
-                // filter out the hidden-from-external-view threads.
-                if (thread.isHiddenFromExternalView() == false) {
-                    ThreadReferenceImpl myThread = threadMirror(thread);
-                    allThreads.add(myThread);
-                }
-            }
-        }
-        return allThreads;
-    }
-
-    public List allThreads() { //fixme jjh
-        return Collections.unmodifiableList(getAllThreads());
-    }
-
-    public void suspend() {
-        throwNotReadOnlyException("VirtualMachineImpl.suspend()");
-    }
-
-    public void resume() {
-        throwNotReadOnlyException("VirtualMachineImpl.resume()");
-    }
-
-    public List topLevelThreadGroups() { //fixme jjh
-        // The doc for ThreadGroup says that The top-level thread group
-        // is the only thread group whose parent is null.  This means there is
-        // only one top level thread group.  There will be a thread in this
-        // group so we will just find a thread whose threadgroup has no parent
-        // and that will be it.
-
-        if (topLevelGroups == null) {
-            topLevelGroups = new ArrayList(1);
-            Iterator myIt = getAllThreads().iterator();
-            while (myIt.hasNext()) {
-                ThreadReferenceImpl myThread = (ThreadReferenceImpl)myIt.next();
-                ThreadGroupReference myGroup = myThread.threadGroup();
-                ThreadGroupReference myParent = myGroup.parent();
-                if (myGroup.parent() == null) {
-                    topLevelGroups.add(myGroup);
-                    break;
-                }
-            }
-        }
-        return  Collections.unmodifiableList(topLevelGroups);
-    }
-
-    public EventQueue eventQueue() {
-        throwNotReadOnlyException("VirtualMachine.eventQueue()");
-        return null;
-    }
-
-    public EventRequestManager eventRequestManager() {
-        throwNotReadOnlyException("VirtualMachineImpl.eventRequestManager()");
-        return null;
-    }
-
-    public BooleanValue mirrorOf(boolean value) {
-        return new BooleanValueImpl(this,value);
-    }
-
-    public ByteValue mirrorOf(byte value) {
-        return new ByteValueImpl(this,value);
-    }
-
-    public CharValue mirrorOf(char value) {
-        return new CharValueImpl(this,value);
-    }
-
-    public ShortValue mirrorOf(short value) {
-        return new ShortValueImpl(this,value);
-    }
-
-    public IntegerValue mirrorOf(int value) {
-        return new IntegerValueImpl(this,value);
-    }
-
-    public LongValue mirrorOf(long value) {
-        return new LongValueImpl(this,value);
-    }
-
-    public FloatValue mirrorOf(float value) {
-        return new FloatValueImpl(this,value);
-    }
-
-    public DoubleValue mirrorOf(double value) {
-        return new DoubleValueImpl(this,value);
-    }
-
-    public StringReference mirrorOf(String value) {
-        throwNotReadOnlyException("VirtualMachinestop.mirrorOf(String)");
-        return null;
-    }
-
-    public VoidValue mirrorOfVoid() {
-        if (voidVal == null) {
-            voidVal = new VoidValueImpl(this);
-        }
-        return voidVal;
-    }
-
-
-    public Process process() {
-        throwNotReadOnlyException("VirtualMachine.process");
-        return null;
-    }
-
-    // dispose observer for Class re-use. refer to ConnectorImpl.
-    private Observer disposeObserver;
-
-    // ConnectorImpl loaded by a different class loader can not access it.
-    // i.e., runtime package of <ConnectorImpl, L1> is not the same that of
-    // <VirtualMachineImpl, L2> when L1 != L2. So, package private method
-    // can be called reflectively after using setAccessible(true).
-
-    void setDisposeObserver(Observer observer) {
-       disposeObserver = observer;
-    }
-
-    private void notifyDispose() {
-        if (Assert.ASSERTS_ENABLED) {
-            Assert.that(disposeObserver != null, "null VM.dispose observer");
-        }
-        disposeObserver.update(null, null);
-    }
-
-    public void dispose() {
-        saAgent.detach();
-        notifyDispose();
-    }
-
-    public void exit(int exitCode) {
-        throwNotReadOnlyException("VirtualMachine.exit(int)");
-    }
-
-    public boolean canBeModified() {
-        return false;
-    }
-
-    public boolean canWatchFieldModification() {
-        return false;
-    }
-
-    public boolean canWatchFieldAccess() {
-        return false;
-    }
-
-    public boolean canGetBytecodes() {
-        return true;
-    }
-
-    public boolean canGetSyntheticAttribute() {
-        return true;
-    }
-
-    // FIXME: For now, all monitor capabilities are disabled
-    public boolean canGetOwnedMonitorInfo() {
-        return false;
-    }
-
-    public boolean canGetCurrentContendedMonitor() {
-        return false;
-    }
-
-    public boolean canGetMonitorInfo() {
-        return false;
-    }
-
-    // because this SA works only with 1.5 and update releases
-    // this should always succeed unlike JVMDI/JDI.
-    public boolean canGet1_5LanguageFeatures() {
-        return true;
-    }
-
-    public boolean canUseInstanceFilters() {
-        return false;
-    }
-
-    public boolean canRedefineClasses() {
-        return false;
-    }
-
-    public boolean canAddMethod() {
-        return false;
-    }
-
-    public boolean canUnrestrictedlyRedefineClasses() {
-        return false;
-    }
-
-    public boolean canPopFrames() {
-        return false;
-    }
-
-    public boolean canGetSourceDebugExtension() {
-        // We can use InstanceKlass.getSourceDebugExtension only if
-        // ClassFileParser parsed the info. But, ClassFileParser parses
-        // SourceDebugExtension attribute only if corresponding JVMDI/TI
-        // capability is set to true. Currently, vmStructs does not expose
-        // JVMDI/TI capabilities and hence we conservatively assume false.
-        return false;
-    }
-
-    public boolean canRequestVMDeathEvent() {
-        return false;
-    }
-
-    // new method since 1.6
-    public boolean canForceEarlyReturn() {
-        return false;
-    }
-
-    // new method since 1.6
-    public boolean canGetConstantPool() {
-        return true;
-    }
-
-    // new method since 1.6
-    public boolean canGetClassFileVersion() {
-        return true;
-    }
-
-    // new method since 1.6.
-    public boolean canGetMethodReturnValues() {
-        return false;
-    }
-
-    // new method since 1.6
-    // Real body will be supplied later.
-    public boolean canGetInstanceInfo() {
-        return true;
-    }
-
-    // new method since 1.6
-    public boolean canUseSourceNameFilters() {
-        return false;
-    }
-
-    // new method since 1.6.
-    public boolean canRequestMonitorEvents() {
-        return false;
-    }
-
-    // new method since 1.6.
-    public boolean canGetMonitorFrameInfo() {
-        return true;
-    }
-
-    // new method since 1.6
-    // Real body will be supplied later.
-    public long[] instanceCounts(List classes) {
-        if (!canGetInstanceInfo()) {
-            throw new UnsupportedOperationException(
-                      "target does not support getting instances");
-        }
-
-        final long[] retValue = new long[classes.size()] ;
-
-        final Klass [] klassArray = new Klass[classes.size()];
-
-        boolean allAbstractClasses = true;
-        for (int i=0; i < classes.size(); i++) {
-            ReferenceTypeImpl rti = (ReferenceTypeImpl)classes.get(i);
-            klassArray[i] = rti.ref();
-            retValue[i]=0;
-            if (!(rti.isAbstract() || ((ReferenceType)rti instanceof InterfaceType))) {
-                allAbstractClasses = false;
-            }
-        }
-
-        if (allAbstractClasses) {
-            return retValue;
-        }
-        final int size = classes.size();
-        saObjectHeap.iterate(new DefaultHeapVisitor() {
-                public boolean doObj(Oop oop) {
-                    for (int i=0; i < size; i++) {
-                        if (klassArray[i].equals(oop.getKlass())) {
-                            retValue[i]++;
-                            break;
-                        }
-                    }
-                                        return false;
-                }
-            });
-
-        return retValue;
-    }
-
-    private List getPath (String pathName) {
-        String cp = saVM.getSystemProperty(pathName);
-        String pathSep = saVM.getSystemProperty("path.separator");
-        ArrayList al = new ArrayList();
-        StringTokenizer st = new StringTokenizer(cp, pathSep);
-        while (st.hasMoreTokens()) {
-            al.add(st.nextToken());
-        }
-        al.trimToSize();
-        return al;
-    }
-
-    public List classPath() {
-        return getPath("java.class.path");
-    }
-
-    public List<String> bootClassPath() {
-        return Collections.emptyList();
-    }
-
-    public String baseDirectory() {
-        return saVM.getSystemProperty("user.dir");
-    }
-
-    public void setDefaultStratum(String stratum) {
-        defaultStratum = stratum;
-    }
-
-    public String getDefaultStratum() {
-        return defaultStratum;
-    }
-
-    public String description() {
-        return java.text.MessageFormat.format(java.util.ResourceBundle.
-                                              getBundle("com.sun.tools.jdi.resources.jdi").getString("version_format"),
-                                              "" + vmmgr.majorInterfaceVersion(),
-                                              "" + vmmgr.minorInterfaceVersion(),
-                                              name());
-    }
-
-    public String version() {
-        return saVM.getSystemProperty("java.version");
-    }
-
-    public String name() {
-        StringBuffer sb = new StringBuffer();
-        sb.append("JVM version ");
-        sb.append(version());
-        sb.append(" (");
-        sb.append(saVM.getSystemProperty("java.vm.name"));
-        sb.append(", ");
-        sb.append(saVM.getSystemProperty("java.vm.info"));
-        sb.append(")");
-        return sb.toString();
-    }
-
-    // from interface Mirror
-    public VirtualMachine virtualMachine() {
-        return this;
-    }
-
-    public String toString() {
-        return name();
-    }
-
-    public void setDebugTraceMode(int traceFlags) {
-        // spec. says output is implementation dependent
-        // and trace mode may be ignored. we ignore it :-)
-    }
-
-    // heap walking API
-
-    // capability check
-    public boolean canWalkHeap() {
-        return true;
-    }
-
-    // return a list of all objects in heap
-    public List/*<ObjectReference>*/ allObjects() {
-        final List objects = new ArrayList(0);
-        saObjectHeap.iterate(
-            new DefaultHeapVisitor() {
-                public boolean doObj(Oop oop) {
-                    objects.add(objectMirror(oop));
-                                        return false;
-                }
-            });
-        return objects;
-    }
-
-    // equivalent to objectsByType(type, true)
-    public List/*<ObjectReference>*/ objectsByType(ReferenceType type) {
-        return objectsByType(type, true);
-    }
-
-    // returns objects of type exactly equal to given type
-    private List/*<ObjectReference>*/ objectsByExactType(ReferenceType type) {
-        final List objects = new ArrayList(0);
-        final Klass givenKls = ((ReferenceTypeImpl)type).ref();
-        saObjectHeap.iterate(new DefaultHeapVisitor() {
-                public boolean doObj(Oop oop) {
-                    if (givenKls.equals(oop.getKlass())) {
-                        objects.add(objectMirror(oop));
-                    }
-                        return false;
-                }
-            });
-        return objects;
-    }
-
-    // returns objects of given type as well as it's subtypes
-    private List/*<ObjectReference>*/ objectsBySubType(ReferenceType type) {
-        final List objects = new ArrayList(0);
-        final ReferenceType givenType = type;
-        saObjectHeap.iterate(new DefaultHeapVisitor() {
-                public boolean doObj(Oop oop) {
-                    ReferenceTypeImpl curType = (ReferenceTypeImpl) referenceType(oop.getKlass());
-                    if (curType.isAssignableTo(givenType)) {
-                        objects.add(objectMirror(oop));
-                    }
-                        return false;
-                }
-            });
-        return objects;
-    }
-
-    // includeSubtypes - do you want to include subclass/subtype instances of given
-    // ReferenceType or do we want objects of exact type only?
-    public List/*<ObjectReference>*/ objectsByType(ReferenceType type, boolean includeSubtypes) {
-        Klass kls = ((ReferenceTypeImpl)type).ref();
-        if (kls instanceof InstanceKlass) {
-            InstanceKlass ik = (InstanceKlass) kls;
-            // if the Klass is final or if there are no subklasses loaded yet
-            if (ik.getAccessFlagsObj().isFinal() || ik.getSubklassKlass() == null) {
-                includeSubtypes = false;
-            }
-        } else {
-            // no subtypes for primitive array types
-            ArrayTypeImpl arrayType = (ArrayTypeImpl) type;
-            try {
-                Type componentType = arrayType.componentType();
-                if (componentType instanceof PrimitiveType) {
-                    includeSubtypes = false;
-                }
-            } catch (ClassNotLoadedException cnle) {
-                // ignore. component type not yet loaded
-            }
-        }
-
-        if (includeSubtypes) {
-            return objectsBySubType(type);
-        } else {
-            return objectsByExactType(type);
-        }
-    }
-
-    Type findBootType(String signature) throws ClassNotLoadedException {
-        List types = allClasses();
-        Iterator iter = types.iterator();
-        while (iter.hasNext()) {
-            ReferenceType type = (ReferenceType)iter.next();
-            if ((type.classLoader() == null) &&
-                (type.signature().equals(signature))) {
-                return type;
-            }
-        }
-        JNITypeParser parser = new JNITypeParser(signature);
-        throw new ClassNotLoadedException(parser.typeName(),
-                                         "Type " + parser.typeName() + " not loaded");
-    }
-
-    BooleanType theBooleanType() {
-        if (theBooleanType == null) {
-            synchronized(this) {
-                if (theBooleanType == null) {
-                    theBooleanType = new BooleanTypeImpl(this);
-                }
-            }
-        }
-        return theBooleanType;
-    }
-
-    ByteType theByteType() {
-        if (theByteType == null) {
-            synchronized(this) {
-                if (theByteType == null) {
-                    theByteType = new ByteTypeImpl(this);
-                }
-            }
-        }
-        return theByteType;
-    }
-
-    CharType theCharType() {
-        if (theCharType == null) {
-            synchronized(this) {
-                if (theCharType == null) {
-                    theCharType = new CharTypeImpl(this);
-                }
-            }
-        }
-        return theCharType;
-    }
-
-    ShortType theShortType() {
-        if (theShortType == null) {
-            synchronized(this) {
-                if (theShortType == null) {
-                    theShortType = new ShortTypeImpl(this);
-                }
-            }
-        }
-        return theShortType;
-    }
-
-    IntegerType theIntegerType() {
-        if (theIntegerType == null) {
-            synchronized(this) {
-                if (theIntegerType == null) {
-                    theIntegerType = new IntegerTypeImpl(this);
-                }
-            }
-        }
-        return theIntegerType;
-    }
-
-    LongType theLongType() {
-        if (theLongType == null) {
-            synchronized(this) {
-                if (theLongType == null) {
-                    theLongType = new LongTypeImpl(this);
-                }
-            }
-        }
-        return theLongType;
-    }
-
-    FloatType theFloatType() {
-        if (theFloatType == null) {
-            synchronized(this) {
-                if (theFloatType == null) {
-                    theFloatType = new FloatTypeImpl(this);
-                }
-            }
-        }
-        return theFloatType;
-    }
-
-    DoubleType theDoubleType() {
-        if (theDoubleType == null) {
-            synchronized(this) {
-                if (theDoubleType == null) {
-                    theDoubleType = new DoubleTypeImpl(this);
-                }
-            }
-        }
-        return theDoubleType;
-    }
-
-    VoidType theVoidType() {
-        if (theVoidType == null) {
-            synchronized(this) {
-                if (theVoidType == null) {
-                    theVoidType = new VoidTypeImpl(this);
-                }
-            }
-        }
-        return theVoidType;
-    }
-
-    PrimitiveType primitiveTypeMirror(char tag) {
-        switch (tag) {
-        case 'Z':
-                return theBooleanType();
-        case 'B':
-                return theByteType();
-        case 'C':
-                return theCharType();
-        case 'S':
-                return theShortType();
-        case 'I':
-                return theIntegerType();
-        case 'J':
-                return theLongType();
-        case 'F':
-                return theFloatType();
-        case 'D':
-                return theDoubleType();
-        default:
-                throw new IllegalArgumentException("Unrecognized primitive tag " + tag);
-        }
-    }
-
-    private void processQueue() {
-        Reference ref;
-        while ((ref = referenceQueue.poll()) != null) {
-            SoftObjectReference softRef = (SoftObjectReference)ref;
-            removeObjectMirror(softRef);
-        }
-    }
-
-    // Address value is used as uniqueID by ObjectReferenceImpl
-    long getAddressValue(Oop obj) {
-        return vm.saVM.getDebugger().getAddressValue(obj.getHandle());
-    }
-
-    synchronized ObjectReferenceImpl objectMirror(Oop key) {
-
-        // Handle any queue elements that are not strongly reachable
-        processQueue();
-
-        if (key == null) {
-            return null;
-        }
-        ObjectReferenceImpl object = null;
-
-        /*
-         * Attempt to retrieve an existing object object reference
-         */
-        SoftObjectReference ref = (SoftObjectReference)objectsByID.get(key);
-        if (ref != null) {
-            object = ref.object();
-        }
-
-        /*
-         * If the object wasn't in the table, or it's soft reference was
-         * cleared, create a new instance.
-         */
-        if (object == null) {
-            if (key instanceof Instance) {
-                // look for well-known classes
-                Symbol className = key.getKlass().getName();
-                if (Assert.ASSERTS_ENABLED) {
-                    Assert.that(className != null, "Null class name");
-                }
-                Instance inst = (Instance) key;
-                if (className.equals(javaLangString)) {
-                    object = new StringReferenceImpl(this, inst);
-                } else if (className.equals(javaLangThread)) {
-                    object = new ThreadReferenceImpl(this, inst);
-                } else if (className.equals(javaLangThreadGroup)) {
-                    object = new ThreadGroupReferenceImpl(this, inst);
-                } else if (className.equals(javaLangClass)) {
-                    object = new ClassObjectReferenceImpl(this, inst);
-                } else if (className.equals(javaLangClassLoader)) {
-                    object = new ClassLoaderReferenceImpl(this, inst);
-                } else {
-                    // not a well-known class. But the base class may be
-                    // one of the known classes.
-                    Klass kls = key.getKlass().getSuper();
-                    while (kls != null) {
-                       className = kls.getName();
-                       // java.lang.Class and java.lang.String are final classes
-                       if (className.equals(javaLangThread)) {
-                          object = new ThreadReferenceImpl(this, inst);
-                          break;
-                       } else if(className.equals(javaLangThreadGroup)) {
-                          object = new ThreadGroupReferenceImpl(this, inst);
-                          break;
-                       } else if (className.equals(javaLangClassLoader)) {
-                          object = new ClassLoaderReferenceImpl(this, inst);
-                          break;
-                       }
-                       kls = kls.getSuper();
-                    }
-
-                    if (object == null) {
-                       // create generic object reference
-                       object = new ObjectReferenceImpl(this, inst);
-                    }
-                }
-            } else if (key instanceof TypeArray) {
-                object = new ArrayReferenceImpl(this, (Array) key);
-            } else if (key instanceof ObjArray) {
-                object = new ArrayReferenceImpl(this, (Array) key);
-            } else {
-                throw new RuntimeException("unexpected object type " + key);
-            }
-            ref = new SoftObjectReference(key, object, referenceQueue);
-
-            /*
-             * If there was no previous entry in the table, we add one here
-             * If the previous entry was cleared, we replace it here.
-             */
-            objectsByID.put(key, ref);
-        } else {
-            ref.incrementCount();
-        }
-
-        return object;
-    }
-
-    synchronized void removeObjectMirror(SoftObjectReference ref) {
-        /*
-         * This will remove the soft reference if it has not been
-         * replaced in the cache.
-         */
-        objectsByID.remove(ref.key());
-    }
-
-    StringReferenceImpl stringMirror(Instance id) {
-        return (StringReferenceImpl) objectMirror(id);
-    }
-
-    ArrayReferenceImpl arrayMirror(Array id) {
-       return (ArrayReferenceImpl) objectMirror(id);
-    }
-
-    ThreadReferenceImpl threadMirror(Instance id) {
-        return (ThreadReferenceImpl) objectMirror(id);
-    }
-
-    ThreadReferenceImpl threadMirror(JavaThread jt) {
-        return (ThreadReferenceImpl) objectMirror(jt.getThreadObj());
-    }
-
-    ThreadGroupReferenceImpl threadGroupMirror(Instance id) {
-        return (ThreadGroupReferenceImpl) objectMirror(id);
-    }
-
-    ClassLoaderReferenceImpl classLoaderMirror(Instance id) {
-        return (ClassLoaderReferenceImpl) objectMirror(id);
-    }
-
-    ClassObjectReferenceImpl classObjectMirror(Instance id) {
-        return (ClassObjectReferenceImpl) objectMirror(id);
-    }
-
-    // Use of soft refs and caching stuff here has to be re-examined.
-    //  It might not make sense for JDI - SA.
-    static private class SoftObjectReference extends SoftReference {
-       int count;
-       Object key;
-
-       SoftObjectReference(Object key, ObjectReferenceImpl mirror,
-                           ReferenceQueue queue) {
-           super(mirror, queue);
-           this.count = 1;
-           this.key = key;
-       }
-
-       int count() {
-           return count;
-       }
-
-       void incrementCount() {
-           count++;
-       }
-
-       Object key() {
-           return key;
-       }
-
-       ObjectReferenceImpl object() {
-           return (ObjectReferenceImpl)get();
-       }
-   }
-}
diff --git a/hotspot/src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/jdi/VoidTypeImpl.java b/hotspot/src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/jdi/VoidTypeImpl.java
deleted file mode 100644
index b833304..0000000
--- a/hotspot/src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/jdi/VoidTypeImpl.java
+++ /dev/null
@@ -1,41 +0,0 @@
-/*
- * Copyright (c) 2002, 2003, 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 sun.jvm.hotspot.jdi;
-
-import com.sun.jdi.*;
-
-public class VoidTypeImpl extends TypeImpl implements VoidType {
-    VoidTypeImpl(VirtualMachine vm) {
-        super(vm);
-    }
-
-    public String signature() {
-        return "V";
-    }
-
-    public String toString() {
-        return name();
-    }
-}
diff --git a/hotspot/src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/jdi/VoidValueImpl.java b/hotspot/src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/jdi/VoidValueImpl.java
deleted file mode 100644
index 922c9ac..0000000
--- a/hotspot/src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/jdi/VoidValueImpl.java
+++ /dev/null
@@ -1,56 +0,0 @@
-/*
- * Copyright (c) 2002, 2003, 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 sun.jvm.hotspot.jdi;
-
-import com.sun.jdi.*;
-
-public class VoidValueImpl extends ValueImpl implements VoidValue {
-
-    VoidValueImpl(VirtualMachine aVm) {
-        super(aVm);
-    }
-
-    public boolean equals(Object obj) {
-        return (obj != null) && (obj instanceof VoidValue) && super.equals(obj);
-    }
-
-    public int hashCode() {
-        return type().hashCode();
-    }
-
-    public Type type() {
-        return vm.theVoidType();
-    }
-
-    ValueImpl prepareForAssignmentTo(ValueContainer destination)
-                    throws InvalidTypeException {
-
-        throw new InvalidTypeException();
-    }
-
-    public String toString() {
-        return "<void value>";
-    }
-}
diff --git a/hotspot/src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/oops/InstanceKlass.java b/hotspot/src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/oops/InstanceKlass.java
index de12216..79ae949 100644
--- a/hotspot/src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/oops/InstanceKlass.java
+++ b/hotspot/src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/oops/InstanceKlass.java
@@ -242,7 +242,15 @@
   }
 
   public long getSize() {
-    return alignSize(getHeaderSize() + getVtableLen() + getItableLen() + getNonstaticOopMapSize());
+    long wordLength = VM.getVM().getBytesPerWord();
+    long size = getHeaderSize() +
+                (getVtableLen() +
+                 getItableLen() +
+                 getNonstaticOopMapSize()) * wordLength;
+    if (isInterface()) {
+      size += wordLength;
+    }
+    return alignSize(size);
   }
 
   public static long getHeaderSize() { return headerSize; }
diff --git a/hotspot/src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/oops/OopUtilities.java b/hotspot/src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/oops/OopUtilities.java
index 3afdab8..8a52e4e 100644
--- a/hotspot/src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/oops/OopUtilities.java
+++ b/hotspot/src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/oops/OopUtilities.java
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2000, 2012, 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
@@ -31,11 +31,10 @@
 import sun.jvm.hotspot.runtime.*;
 import sun.jvm.hotspot.types.TypeDataBase;
 import sun.jvm.hotspot.utilities.*;
-import sun.jvm.hotspot.jdi.JVMTIThreadState;
 
 /** A utility class encapsulating useful oop operations */
 
-public class OopUtilities implements /* imports */ JVMTIThreadState {
+public class OopUtilities {
 
   // FIXME: access should be synchronized and cleared when VM is
   // resumed
@@ -78,6 +77,8 @@
   // java.util.concurrent.locks.AbstractOwnableSynchronizer fields
   private static OopField absOwnSyncOwnerThreadField;
 
+  private static final int JVMTI_THREAD_STATE_ALIVE = 0x0001;
+
   static {
     VM.registerVMInitializedObserver(new Observer() {
         public void update(Observable o, Object data) {
diff --git a/hotspot/src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/oops/java_lang_Class.java b/hotspot/src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/oops/java_lang_Class.java
index e82d807..4eab2fe 100644
--- a/hotspot/src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/oops/java_lang_Class.java
+++ b/hotspot/src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/oops/java_lang_Class.java
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2011, 2012, 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
@@ -33,7 +33,6 @@
 import sun.jvm.hotspot.types.Type;
 import sun.jvm.hotspot.types.TypeDataBase;
 import sun.jvm.hotspot.utilities.*;
-import sun.jvm.hotspot.jdi.JVMTIThreadState;
 
 /** A utility class encapsulating useful oop operations */
 
diff --git a/hotspot/src/jdk.hotspot.agent/test/jdi/README.jjh b/hotspot/src/jdk.hotspot.agent/test/jdi/README.jjh
deleted file mode 100644
index 33b284f..0000000
--- a/hotspot/src/jdk.hotspot.agent/test/jdi/README.jjh
+++ /dev/null
@@ -1,39 +0,0 @@
-
-This dir contains a test for the JDI-SA implementation.
-
-sagtest.java, sagtarg.java are a normal JDI regression test
-that uses TargetAdapter.java, TargetListener.java,  TestScaffold.java,
-and VMConnection.java.
-
-This test starts the debuggee, sagtarg.java, which just does a wait.
-The test then calls sagdoit.java which calls all the JDJI interface
-functions.  Well, it doesn't call them all yet, but that is the plan.
-At least all that are interesting to the JDI-SA client. The result of
-each call is sent to stdout
-
-The script runjpda.sh runs this test.  It then runs the targ part of
-the test and calls gcore on it to get a core dump into file sagcore.
-Do
-        runjpda.sh >& kk
-
-to run this.  
-
-        NOTE that this produces 1000s of lines of output
-        so be sure to redirect to a file.
-
-File sagclient.java is a test program that uses the JDI-SA
-client to connect to a core file or pid and then calls sagdoit
-which calls the JDI methods.
-
-The script runsa.sh can be used to run sagclient on sagcore:
-        runsa.sh sagcore >& kk1
-
-You can then look at the differences between the runjpda.sh 
-and the runsa.sh run to see if there are bugs.  Note that the
-order of things might be different.
-
-
------------------------------------------
-
-runjdb.sh contains a script that will run jdb on a core file
-using the JDI-sa binding.
diff --git a/hotspot/src/jdk.hotspot.agent/test/jdi/SASanityChecker.java b/hotspot/src/jdk.hotspot.agent/test/jdi/SASanityChecker.java
deleted file mode 100644
index 61dbff3..0000000
--- a/hotspot/src/jdk.hotspot.agent/test/jdi/SASanityChecker.java
+++ /dev/null
@@ -1,134 +0,0 @@
-/*
- * Copyright (c) 2003, 2005, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation.
- *
- * 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 sun.jvm.hotspot.tools.*;
-import sun.jvm.hotspot.runtime.*;
-import java.io.*;
-import java.util.*;
-import java.util.jar.*;
-
-/**
-This is a sanity checking tool for Serviceability Agent. To use this class,
-refer to sasanity.sh script in the current directory.
-*/
-
-public class SASanityChecker extends Tool {
-  private static final String saJarName;
-  private static final Map c2types;
-
-  static {
-     saJarName = System.getProperty("SASanityChecker.SAJarName", "sa-jdi.jar");
-     c2types = new HashMap();
-     Object value = new Object();
-     c2types.put("sun.jvm.hotspot.code.ExceptionBlob", value);
-     c2types.put("sun.jvm.hotspot.code.DeoptimizationBlob", value);
-     c2types.put("sun.jvm.hotspot.code.UncommonTrapBlob", value);
-
-  }
-
-  public void run() {
-     String classPath = System.getProperty("java.class.path");
-     StringTokenizer st = new StringTokenizer(classPath, File.pathSeparator);
-     String saJarPath = null;
-     while (st.hasMoreTokens()) {
-        saJarPath = st.nextToken();
-        if (saJarPath.endsWith(saJarName)) {
-           break;
-        }
-     }
-
-     if (saJarPath == null) {
-        throw new RuntimeException(saJarName + " is not the CLASSPATH");
-     }
-
-     String cpuDot = "." + VM.getVM().getCPU() + ".";
-     String platformDot = "." + VM.getVM().getOS() + "_" + VM.getVM().getCPU() + ".";
-     boolean isClient = VM.getVM().isClientCompiler();
-
-     try {
-        FileInputStream fis = new FileInputStream(saJarPath);
-        JarInputStream jis = new JarInputStream(fis);
-        JarEntry je = null;
-        while ( (je = jis.getNextJarEntry()) != null) {
-           String entryName = je.getName();
-           int dotClassIndex = entryName.indexOf(".class");
-           if (dotClassIndex == -1) {
-              // skip non-.class stuff
-              continue;
-           }
-
-           entryName = entryName.substring(0, dotClassIndex).replace('/', '.');
-
-           // skip debugger, asm classes, type classes and jdi binding classes
-           if (entryName.startsWith("sun.jvm.hotspot.debugger.") ||
-               entryName.startsWith("sun.jvm.hotspot.asm.") ||
-               entryName.startsWith("sun.jvm.hotspot.type.") ||
-               entryName.startsWith("sun.jvm.hotspot.jdi.") ) {
-              continue;
-           }
-
-           String runtimePkgPrefix = "sun.jvm.hotspot.runtime.";
-           int runtimeIndex = entryName.indexOf(runtimePkgPrefix);
-           if (runtimeIndex != -1) {
-              // look for further dot. if there, it has to be sub-package.
-              // in runtime sub-packages include only current platform classes.
-              if (entryName.substring(runtimePkgPrefix.length() + 1, entryName.length()).indexOf('.') != -1) {
-                 if (entryName.indexOf(cpuDot) == -1 &&
-                     entryName.indexOf(platformDot) == -1) {
-                    continue;
-                 }
-              }
-           }
-
-           if (isClient) {
-              if (c2types.get(entryName) != null) {
-                 continue;
-              }
-           } else {
-              if (entryName.equals("sun.jvm.hotspot.c1.Runtime1")) {
-                 continue;
-              }
-           }
-
-           System.out.println("checking " + entryName + " ..");
-           // force init of the class to uncover any vmStructs mismatch
-           Class.forName(entryName);
-        }
-     } catch (Exception exp) {
-        System.out.println();
-        System.out.println("FAILED");
-        System.out.println();
-        throw new RuntimeException(exp.getMessage());
-     }
-     System.out.println();
-     System.out.println("PASSED");
-     System.out.println();
-  }
-
-  public static void main(String[] args) {
-     SASanityChecker checker = new SASanityChecker();
-     checker.start(args);
-     checker.stop();
-  }
-}
diff --git a/hotspot/src/jdk.hotspot.agent/test/jdi/TEST.ROOT b/hotspot/src/jdk.hotspot.agent/test/jdi/TEST.ROOT
deleted file mode 100644
index 7d760f6..0000000
--- a/hotspot/src/jdk.hotspot.agent/test/jdi/TEST.ROOT
+++ /dev/null
@@ -1,30 +0,0 @@
-#
-# Copyright (c) 2002, Oracle and/or its affiliates. All rights reserved.
-# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
-#
-# This code is free software; you can redistribute it and/or modify it
-# under the terms of the GNU General Public License version 2 only, as
-# published by the Free Software Foundation.
-#
-# This code is distributed in the hope that it will be useful, but WITHOUT
-# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
-# FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
-# version 2 for more details (a copy is included in the LICENSE file that
-# accompanied this code).
-#
-# You should have received a copy of the GNU General Public License version
-# 2 along with this work; if not, write to the Free Software Foundation,
-# Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
-#
-# Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
-# or visit www.oracle.com if you need additional information or have any
-# questions.
-#  
-#
-
-# This file identifies the root of the test-suite hierarchy.
-# It also contains test-suite configuration information.
-# DO NOT EDIT without first contacting jdk-regtest@eng.
-
-# The list of keywords supported in this test suite
-keys=2d dnd i18n
diff --git a/hotspot/src/jdk.hotspot.agent/test/jdi/TargetAdapter.java b/hotspot/src/jdk.hotspot.agent/test/jdi/TargetAdapter.java
deleted file mode 100644
index 76bd16f..0000000
--- a/hotspot/src/jdk.hotspot.agent/test/jdi/TargetAdapter.java
+++ /dev/null
@@ -1,58 +0,0 @@
-/*
- * Copyright (c) 2002, 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.
- *
- */
-
-import com.sun.jdi.event.*;
-
-/**
- * Base TargetListener implementation
- */
-public class TargetAdapter implements TargetListener {
-    boolean shouldRemoveListener = false;
-
-    public void removeThisListener() {
-        shouldRemoveListener = true;
-    }
-
-    public boolean shouldRemoveListener() {
-        return shouldRemoveListener;
-    }
-
-    public void eventSetReceived(EventSet set) {}
-    public void eventSetComplete(EventSet set) {}
-    public void eventReceived(Event event) {}
-    public void breakpointReached(BreakpointEvent event) {}
-    public void exceptionThrown(ExceptionEvent event) {}
-    public void stepCompleted(StepEvent event) {}
-    public void classPrepared(ClassPrepareEvent event) {}
-    public void classUnloaded(ClassUnloadEvent event) {}
-    public void methodEntered(MethodEntryEvent event) {}
-    public void methodExited(MethodExitEvent event) {}
-    public void fieldAccessed(AccessWatchpointEvent event) {}
-    public void fieldModified(ModificationWatchpointEvent event) {}
-    public void threadStarted(ThreadStartEvent event) {}
-    public void threadDied(ThreadDeathEvent event) {}
-    public void vmStarted(VMStartEvent event) {}
-    public void vmDied(VMDeathEvent event) {}
-    public void vmDisconnected(VMDisconnectEvent event) {}
-}
diff --git a/hotspot/src/jdk.hotspot.agent/test/jdi/TargetListener.java b/hotspot/src/jdk.hotspot.agent/test/jdi/TargetListener.java
deleted file mode 100644
index ee7fe4f..0000000
--- a/hotspot/src/jdk.hotspot.agent/test/jdi/TargetListener.java
+++ /dev/null
@@ -1,50 +0,0 @@
-/*
- * Copyright (c) 2002, 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.
- *
- */
-
-import com.sun.jdi.event.*;
-
-/**
- * Event listener framework
- */
-public interface TargetListener {
-    boolean shouldRemoveListener();
-
-    void eventSetReceived(EventSet set);
-    void eventSetComplete(EventSet set);
-    void eventReceived(Event event);
-    void breakpointReached(BreakpointEvent event);
-    void exceptionThrown(ExceptionEvent event);
-    void stepCompleted(StepEvent event);
-    void classPrepared(ClassPrepareEvent event);
-    void classUnloaded(ClassUnloadEvent event);
-    void methodEntered(MethodEntryEvent event);
-    void methodExited(MethodExitEvent event);
-    void fieldAccessed(AccessWatchpointEvent event);
-    void fieldModified(ModificationWatchpointEvent event);
-    void threadStarted(ThreadStartEvent event);
-    void threadDied(ThreadDeathEvent event);
-    void vmStarted(VMStartEvent event);
-    void vmDied(VMDeathEvent event);
-    void vmDisconnected(VMDisconnectEvent event);
-}
diff --git a/hotspot/src/jdk.hotspot.agent/test/jdi/TestScaffold.java b/hotspot/src/jdk.hotspot.agent/test/jdi/TestScaffold.java
deleted file mode 100644
index ce96b3a..0000000
--- a/hotspot/src/jdk.hotspot.agent/test/jdi/TestScaffold.java
+++ /dev/null
@@ -1,758 +0,0 @@
-/*
- * Copyright (c) 2002, 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.
- *
- */
-
-import com.sun.jdi.*;
-import com.sun.jdi.request.*;
-import com.sun.jdi.event.*;
-import java.util.*;
-import java.io.*;
-
-/**
- * Framework used by all JDI regression tests
- */
-abstract public class TestScaffold extends TargetAdapter {
-    private boolean shouldTrace = false;
-    private VMConnection connection;
-    private VirtualMachine vm;
-    private EventRequestManager requestManager;
-    private List listeners = Collections.synchronizedList(new LinkedList());
-
-    /**
-     * We create a VMDeathRequest, SUSPEND_ALL, to sync the BE and FE.
-     */
-    //private VMDeathRequest ourVMDeathRequest = null;
-    Object ourVMDeathRequest = null;
-
-    /**
-     * We create an ExceptionRequest, SUSPEND_NONE so that we can
-     * catch it and output a msg if an exception occurs in the
-     * debuggee.
-     */
-    private ExceptionRequest ourExceptionRequest = null;
-
-    /**
-     * If we do catch an uncaught exception, we set this true
-     * so the testcase can find out if it wants to.
-     */
-    private boolean exceptionCaught = false;
-    ThreadReference vmStartThread = null;
-    boolean vmDied = false;
-    boolean vmDisconnected = false;
-    final String[] args;
-    protected boolean testFailed = false;
-
-    static private class ArgInfo {
-        String targetVMArgs = "";
-        String targetAppCommandLine = "";
-        String connectorSpec = "com.sun.jdi.CommandLineLaunch:";
-        int traceFlags = 0;
-    }
-
-    /**
-     * An easy way to sleep for awhile
-     */
-    public void mySleep(int millis) {
-        try {
-            Thread.sleep(millis);
-        } catch (InterruptedException ee) {
-        }
-    }
-
-    boolean getExceptionCaught() {
-        return exceptionCaught;
-    }
-
-    void setExceptionCaught(boolean value) {
-        exceptionCaught = value;
-    }
-
-    /**
-     * Return true if eventSet contains the VMDeathEvent for the request in
-     * the ourVMDeathRequest ivar.
-     */
-    private boolean containsOurVMDeathRequest(EventSet eventSet) {
-        if (ourVMDeathRequest != null) {
-            Iterator myIter = eventSet.iterator();
-            while (myIter.hasNext()) {
-                Event myEvent = (Event)myIter.next();
-                if (!(myEvent instanceof VMDeathEvent)) {
-                    // We assume that an EventSet contains only VMDeathEvents
-                    // or no VMDeathEvents.
-                    break;
-                }
-                if (ourVMDeathRequest.equals(myEvent.request())) {
-                    return true;
-                }
-            }
-        }
-        return false;
-    }
-
-    /************************************************************************
-     * The following methods override those in our base class, TargetAdapter.
-     *************************************************************************/
-
-    /**
-     * Events handled directly by scaffold always resume (well, almost always)
-     */
-    public void eventSetComplete(EventSet set) {
-        // The listener in connect(..) resumes after receiving our
-        // special VMDeathEvent.  We can't also do the resume
-        // here or we will probably get a VMDisconnectedException
-        if (!containsOurVMDeathRequest(set)) {
-            traceln("TS: set.resume() called");
-            set.resume();
-        }
-    }
-
-    /**
-     * This method sets up default requests.
-     * Testcases can override this to change default behavior.
-     */
-    protected void createDefaultEventRequests() {
-        createDefaultVMDeathRequest();
-        createDefaultExceptionRequest();
-    }
-
-    /**
-     * We want the BE to stop when it issues a VMDeathEvent in order to
-     * give the FE time to complete handling events that occured before
-     * the VMDeath.  When we get the VMDeathEvent for this request in
-     * the listener in connect(), we will do a resume.
-     * If a testcase wants to do something special with VMDeathEvent's,
-     * then it should override this method with an empty method or
-     * whatever in order to suppress the automatic resume.  The testcase
-     * will then be responsible for the handling of VMDeathEvents.  It
-     * has to be sure that it does a resume if it gets a VMDeathEvent
-     * with SUSPEND_ALL, and it has to be sure that it doesn't do a
-     * resume after getting a VMDeath with SUSPEND_NONE (the automatically
-     * generated VMDeathEvent.)
-     */
-    protected void createDefaultVMDeathRequest() {
-//         ourVMDeathRequest = requestManager.createVMDeathRequest();
-//         ourVMDeathRequest.setSuspendPolicy(EventRequest.SUSPEND_ALL);
-//         ourVMDeathRequest.enable();
-    }
-
-    /**
-     * This will allow us to print a warning if a debuggee gets an
-     * unexpected exception.  The unexpected exception will be handled in
-     * the exceptionThrown method in the listener created in the connect()
-     * method.
-     * If a testcase does not want an uncaught exception to cause a
-     * msg, it must override this method.
-     */
-    protected void createDefaultExceptionRequest() {
-        ourExceptionRequest = requestManager.createExceptionRequest(null,
-                                                                false, true);
-
-        // We can't afford to make this be other than SUSPEND_NONE.  Otherwise,
-        // it would have to be resumed.  If our connect() listener resumes it,
-        // what about the case where the EventSet contains other events with
-        // SUSPEND_ALL and there are other listeners who expect the BE to still
-        // be suspended when their handlers get called?
-        ourExceptionRequest.setSuspendPolicy(EventRequest.SUSPEND_NONE);
-        ourExceptionRequest.enable();
-    }
-
-    private class EventHandler implements Runnable {
-        EventHandler() {
-            Thread thread = new Thread(this);
-            thread.setDaemon(true);
-            thread.start();
-        }
-
-        private void notifyEvent(TargetListener listener, Event event) {
-            if (event instanceof BreakpointEvent) {
-                listener.breakpointReached((BreakpointEvent)event);
-            } else if (event instanceof ExceptionEvent) {
-                listener.exceptionThrown((ExceptionEvent)event);
-            } else if (event instanceof StepEvent) {
-                listener.stepCompleted((StepEvent)event);
-            } else if (event instanceof ClassPrepareEvent) {
-                listener.classPrepared((ClassPrepareEvent)event);
-            } else if (event instanceof ClassUnloadEvent) {
-                listener.classUnloaded((ClassUnloadEvent)event);
-            } else if (event instanceof MethodEntryEvent) {
-                listener.methodEntered((MethodEntryEvent)event);
-            } else if (event instanceof MethodExitEvent) {
-                listener.methodExited((MethodExitEvent)event);
-            } else if (event instanceof AccessWatchpointEvent) {
-                listener.fieldAccessed((AccessWatchpointEvent)event);
-            } else if (event instanceof ModificationWatchpointEvent) {
-                listener.fieldModified((ModificationWatchpointEvent)event);
-            } else if (event instanceof ThreadStartEvent) {
-                listener.threadStarted((ThreadStartEvent)event);
-            } else if (event instanceof ThreadDeathEvent) {
-                listener.threadDied((ThreadDeathEvent)event);
-            } else if (event instanceof VMStartEvent) {
-                listener.vmStarted((VMStartEvent)event);
-            } else if (event instanceof VMDeathEvent) {
-                listener.vmDied((VMDeathEvent)event);
-            } else if (event instanceof VMDisconnectEvent) {
-                listener.vmDisconnected((VMDisconnectEvent)event);
-            } else {
-                throw new InternalError("Unknown event type: " + event.getClass());
-            }
-        }
-
-        private void traceSuspendPolicy(int policy) {
-            if (shouldTrace) {
-                switch (policy) {
-                case EventRequest.SUSPEND_NONE:
-                    traceln("TS: eventHandler: suspend = SUSPEND_NONE");
-                    break;
-                case EventRequest.SUSPEND_ALL:
-                    traceln("TS: eventHandler: suspend = SUSPEND_ALL");
-                    break;
-                case EventRequest.SUSPEND_EVENT_THREAD:
-                    traceln("TS: eventHandler: suspend = SUSPEND_EVENT_THREAD");
-                    break;
-                }
-            }
-        }
-
-        public void run() {
-            boolean connected = true;
-            do {
-                try {
-                    EventSet set = vm.eventQueue().remove();
-                    traceSuspendPolicy(set.suspendPolicy());
-                    synchronized (listeners) {
-                        ListIterator iter = listeners.listIterator();
-                        while (iter.hasNext()) {
-                            TargetListener listener = (TargetListener)iter.next();
-                            traceln("TS: eventHandler: listener = " + listener);
-                            listener.eventSetReceived(set);
-                            if (listener.shouldRemoveListener()) {
-                                iter.remove();
-                            } else {
-                                Iterator jter = set.iterator();
-                                while (jter.hasNext()) {
-                                    Event event = (Event)jter.next();
-                                    traceln("TS: eventHandler:    event = " + event.getClass());
-
-                                    if (event instanceof VMDisconnectEvent) {
-                                        connected = false;
-                                    }
-                                    listener.eventReceived(event);
-                                    if (listener.shouldRemoveListener()) {
-                                        iter.remove();
-                                        break;
-                                    }
-                                    notifyEvent(listener, event);
-                                    if (listener.shouldRemoveListener()) {
-                                        iter.remove();
-                                        break;
-                                    }
-                                }
-                                traceln("TS: eventHandler:   end of events loop");
-                                if (!listener.shouldRemoveListener()) {
-                                    traceln("TS: eventHandler:   calling ESC");
-                                    listener.eventSetComplete(set);
-                                    if (listener.shouldRemoveListener()) {
-                                        iter.remove();
-                                    }
-                                }
-                            }
-                            traceln("TS: eventHandler: end of listeners loop");
-                        }
-                    }
-                } catch (InterruptedException e) {
-                    traceln("TS: eventHandler: InterruptedException");
-                } catch (Exception e) {
-                    failure("FAILED: Exception occured in eventHandler: " + e);
-                    e.printStackTrace();
-                    connected = false;
-                    synchronized(TestScaffold.this) {
-                        // This will make the waiters such as waitForVMDisconnect
-                        // exit their wait loops.
-                        vmDisconnected = true;
-                        TestScaffold.this.notifyAll();
-                    }
-                }
-                traceln("TS: eventHandler: End of outerloop");
-            } while (connected);
-            traceln("TS: eventHandler: finished");
-        }
-    }
-
-    /**
-     * Constructor
-     */
-    public TestScaffold(String[] args) {
-        this.args = args;
-    }
-
-    public void enableScaffoldTrace() {
-        this.shouldTrace = true;
-    }
-
-    public void disableScaffoldTrace() {
-        this.shouldTrace = false;
-    }
-
-
-    protected void startUp(String targetName) {
-        List argList = new ArrayList(Arrays.asList(args));
-        argList.add(targetName);
-        println("run args: " + argList);
-        connect((String[]) argList.toArray(args));
-        waitForVMStart();
-    }
-
-    protected BreakpointEvent startToMain(String targetName) {
-        startUp(targetName);
-        traceln("TS: back from startUp");
-        BreakpointEvent bpr = resumeTo(targetName, "main", "([Ljava/lang/String;)V");
-        waitForInput();
-        return bpr;
-    }
-
-    protected void waitForInput() {
-        if (System.getProperty("jpda.wait") != null) {
-            try {
-                System.err.println("Press <enter> to continue");
-                System.in.read();
-                System.err.println("running...");
-
-            } catch(Exception e) {
-            }
-        }
-    }
-
-    /*
-     * Test cases should implement tests in runTests and should
-     * initiate testing by calling run().
-     */
-    abstract protected void runTests() throws Exception;
-
-    final public void startTests() throws Exception {
-        try {
-            runTests();
-        } finally {
-            shutdown();
-        }
-    }
-
-    protected void println(String str) {
-        System.err.println(str);
-    }
-
-    protected void print(String str) {
-        System.err.print(str);
-    }
-
-    protected void traceln(String str) {
-        if (shouldTrace) {
-            println(str);
-        }
-    }
-
-    protected void failure(String str) {
-        println(str);
-        testFailed = true;
-    }
-
-    private ArgInfo parseArgs(String args[]) {
-        ArgInfo argInfo = new ArgInfo();
-        for (int i = 0; i < args.length; i++) {
-            if (args[i].equals("-connect")) {
-                i++;
-                argInfo.connectorSpec = args[i];
-            } else if (args[i].equals("-trace")) {
-                i++;
-                argInfo.traceFlags = Integer.decode(args[i]).intValue();
-            } else if (args[i].startsWith("-J")) {
-                argInfo.targetVMArgs += (args[i].substring(2) + ' ');
-
-                /*
-                 * classpath can span two arguments so we need to handle
-                 * it specially.
-                 */
-                if (args[i].equals("-J-classpath")) {
-                    i++;
-                    argInfo.targetVMArgs += (args[i] + ' ');
-                }
-            } else {
-                argInfo.targetAppCommandLine += (args[i] + ' ');
-            }
-        }
-        return argInfo;
-    }
-
-    /**
-     * This is called to connect to a debuggee VM.  It starts the VM and
-     * installs a listener to catch VMStartEvent, our default events, and
-     * VMDisconnectedEvent.  When these events appear, that is remembered
-     * and waiters are notified.
-     * This is normally called in the main thread of the test case.
-     * It starts up an EventHandler thread that gets events coming in
-     * from the debuggee and distributes them to listeners.  That thread
-     * keeps running until a VMDisconnectedEvent occurs or some exception
-     * occurs during its processing.
-     *
-     * The 'listenUntilVMDisconnect' method adds 'this' as a listener.
-     * This means that 'this's vmDied method will get called.  This has a
-     * default impl in TargetAdapter.java which can be overridden in the
-     * testcase.
-     *
-     * waitForRequestedEvent also adds an adaptor listener that listens
-     * for the particular event it is supposed to wait for (and it also
-     * catches VMDisconnectEvents.)  This listener is removed once
-     * its eventReceived method is called.
-     * waitForRequestedEvent is called by most of the methods to do bkpts,
-     * etc.
-     */
-    public void connect(String args[]) {
-        ArgInfo argInfo = parseArgs(args);
-
-        argInfo.targetVMArgs += VMConnection.getDebuggeeVMOptions();
-        connection = new VMConnection(argInfo.connectorSpec,
-                                      argInfo.traceFlags);
-
-        addListener(new TargetAdapter() {
-                public void eventSetComplete(EventSet set) {
-                    if (TestScaffold.this.containsOurVMDeathRequest(set)) {
-                        traceln("TS: connect: set.resume() called");
-                        set.resume();
-
-                        // Note that we want to do the above resume before
-                        // waking up any sleepers.
-                        synchronized(TestScaffold.this) {
-                            TestScaffold.this.notifyAll();
-                        }
-                    }
-                }
-
-                public void vmStarted(VMStartEvent event) {
-                    synchronized(TestScaffold.this) {
-                        vmStartThread = event.thread();
-                        TestScaffold.this.notifyAll();
-                    }
-                }
-                /**
-                 * By default, we catch uncaught exceptions and print a msg.
-                 * The testcase must override the createDefaultExceptionRequest
-                 * method if it doesn't want this behavior.
-                 */
-                public void exceptionThrown(ExceptionEvent event) {
-                    if (TestScaffold.this.ourExceptionRequest != null &&
-                        TestScaffold.this.ourExceptionRequest.equals(
-                                                        event.request())) {
-                        println("Note: Unexpected Debuggee Exception: " +
-                                event.exception().referenceType().name() +
-                                " at line " + event.location().lineNumber());
-                        TestScaffold.this.exceptionCaught = true;
-                    }
-                }
-
-                public void vmDied(VMDeathEvent event) {
-                    vmDied = true;
-                    traceln("TS: vmDied called");
-                }
-
-                public void vmDisconnected(VMDisconnectEvent event) {
-                    synchronized(TestScaffold.this) {
-                        vmDisconnected = true;
-                        TestScaffold.this.notifyAll();
-                    }
-                }
-            });
-        if (connection.connector().name().equals("com.sun.jdi.CommandLineLaunch")) {
-            if (argInfo.targetVMArgs.length() > 0) {
-                if (connection.connectorArg("options").length() > 0) {
-                    throw new IllegalArgumentException("VM options in two places");
-                }
-                connection.setConnectorArg("options", argInfo.targetVMArgs);
-            }
-            if (argInfo.targetAppCommandLine.length() > 0) {
-                if (connection.connectorArg("main").length() > 0) {
-                    throw new IllegalArgumentException("Command line in two places");
-                }
-                connection.setConnectorArg("main", argInfo.targetAppCommandLine);
-            }
-        }
-
-        vm = connection.open();
-        requestManager = vm.eventRequestManager();
-        createDefaultEventRequests();
-        new EventHandler();
-    }
-
-
-    public VirtualMachine vm() {
-        return vm;
-    }
-
-    public EventRequestManager eventRequestManager() {
-        return requestManager;
-    }
-
-    public void addListener(TargetListener listener) {
-        traceln("TS: Adding listener " + listener);
-        listeners.add(listener);
-    }
-
-    public void removeListener(TargetListener listener) {
-        traceln("TS: Removing listener " + listener);
-        listeners.remove(listener);
-    }
-
-
-    protected void listenUntilVMDisconnect() {
-        try {
-            addListener (this);
-        } catch (Exception ex){
-            ex.printStackTrace();
-            testFailed = true;
-        } finally {
-            // Allow application to complete and shut down
-            resumeToVMDisconnect();
-        }
-    }
-
-    public synchronized ThreadReference waitForVMStart() {
-        while ((vmStartThread == null) && !vmDisconnected) {
-            try {
-                wait();
-            } catch (InterruptedException e) {
-            }
-        }
-
-        if (vmStartThread == null) {
-            throw new VMDisconnectedException();
-        }
-
-        return vmStartThread;
-    }
-
-    public synchronized void waitForVMDisconnect() {
-        traceln("TS: waitForVMDisconnect");
-        while (!vmDisconnected) {
-            try {
-                wait();
-            } catch (InterruptedException e) {
-            }
-        }
-        traceln("TS: waitForVMDisconnect: done");
-    }
-
-    public Event waitForRequestedEvent(final EventRequest request) {
-        class EventNotification {
-            Event event;
-            boolean disconnected = false;
-        }
-        final EventNotification en = new EventNotification();
-
-        TargetAdapter adapter = new TargetAdapter() {
-            public void eventReceived(Event event) {
-                if (request.equals(event.request())) {
-                    traceln("TS:Listener2: got requested event");
-                    synchronized (en) {
-                        en.event = event;
-                        en.notifyAll();
-                    }
-                    removeThisListener();
-                } else if (event instanceof VMDisconnectEvent) {
-                    traceln("TS:Listener2: got VMDisconnectEvent");
-                    synchronized (en) {
-                        en.disconnected = true;
-                        en.notifyAll();
-                    }
-                    removeThisListener();
-                }
-            }
-        };
-
-        addListener(adapter);
-
-        try {
-            synchronized (en) {
-                traceln("TS: waitForRequestedEvent: vm.resume called");
-                vm.resume();
-
-                while (!en.disconnected && (en.event == null)) {
-                    en.wait();
-                }
-            }
-        } catch (InterruptedException e) {
-            return null;
-        }
-
-        if (en.disconnected) {
-            throw new RuntimeException("VM Disconnected before requested event occurred");
-        }
-        return en.event;
-    }
-
-    private StepEvent doStep(ThreadReference thread, int gran, int depth) {
-        final StepRequest sr =
-                  requestManager.createStepRequest(thread, gran, depth);
-
-        sr.addClassExclusionFilter("java.*");
-        sr.addClassExclusionFilter("sun.*");
-        sr.addClassExclusionFilter("com.sun.*");
-        sr.addCountFilter(1);
-        sr.enable();
-        StepEvent retEvent = (StepEvent)waitForRequestedEvent(sr);
-        requestManager.deleteEventRequest(sr);
-        return retEvent;
-    }
-
-    public StepEvent stepIntoInstruction(ThreadReference thread) {
-        return doStep(thread, StepRequest.STEP_MIN, StepRequest.STEP_INTO);
-    }
-
-    public StepEvent stepIntoLine(ThreadReference thread) {
-        return doStep(thread, StepRequest.STEP_LINE, StepRequest.STEP_INTO);
-    }
-
-    public StepEvent stepOverInstruction(ThreadReference thread) {
-        return doStep(thread, StepRequest.STEP_MIN, StepRequest.STEP_OVER);
-    }
-
-    public StepEvent stepOverLine(ThreadReference thread) {
-        return doStep(thread, StepRequest.STEP_LINE, StepRequest.STEP_OVER);
-    }
-
-    public StepEvent stepOut(ThreadReference thread) {
-        return doStep(thread, StepRequest.STEP_LINE, StepRequest.STEP_OUT);
-    }
-
-    public BreakpointEvent resumeTo(Location loc) {
-        final BreakpointRequest request =
-            requestManager.createBreakpointRequest(loc);
-        request.addCountFilter(1);
-        request.enable();
-        return (BreakpointEvent)waitForRequestedEvent(request);
-    }
-
-    public ReferenceType findReferenceType(String name) {
-        List rts = vm.classesByName(name);
-        Iterator iter = rts.iterator();
-        while (iter.hasNext()) {
-            ReferenceType rt = (ReferenceType)iter.next();
-            if (rt.name().equals(name)) {
-                return rt;
-            }
-        }
-        return null;
-    }
-
-    public Method findMethod(ReferenceType rt, String name, String signature) {
-        List methods = rt.methods();
-        Iterator iter = methods.iterator();
-        while (iter.hasNext()) {
-            Method method = (Method)iter.next();
-            if (method.name().equals(name) &&
-                method.signature().equals(signature)) {
-                return method;
-            }
-        }
-        return null;
-    }
-
-    public Location findLocation(ReferenceType rt, int lineNumber)
-                         throws AbsentInformationException {
-        List locs = rt.locationsOfLine(lineNumber);
-        if (locs.size() == 0) {
-            throw new IllegalArgumentException("Bad line number");
-        } else if (locs.size() > 1) {
-            throw new IllegalArgumentException("Line number has multiple locations");
-        }
-
-        return (Location)locs.get(0);
-    }
-
-    public BreakpointEvent resumeTo(String clsName, String methodName,
-                                         String methodSignature) {
-        ReferenceType rt = findReferenceType(clsName);
-        if (rt == null) {
-            rt = resumeToPrepareOf(clsName).referenceType();
-        }
-
-        Method method = findMethod(rt, methodName, methodSignature);
-        if (method == null) {
-            throw new IllegalArgumentException("Bad method name/signature");
-        }
-
-        return resumeTo(method.location());
-    }
-
-    public BreakpointEvent resumeTo(String clsName, int lineNumber) throws AbsentInformationException {
-        ReferenceType rt = findReferenceType(clsName);
-        if (rt == null) {
-            rt = resumeToPrepareOf(clsName).referenceType();
-        }
-
-        return resumeTo(findLocation(rt, lineNumber));
-    }
-
-    public ClassPrepareEvent resumeToPrepareOf(String className) {
-        final ClassPrepareRequest request =
-            requestManager.createClassPrepareRequest();
-        request.addClassFilter(className);
-        request.addCountFilter(1);
-        request.enable();
-        return (ClassPrepareEvent)waitForRequestedEvent(request);
-    }
-
-    public void resumeToVMDisconnect() {
-        try {
-            traceln("TS: resumeToVMDisconnect: vm.resume called");
-            vm.resume();
-        } catch (VMDisconnectedException e) {
-            // clean up below
-        }
-        waitForVMDisconnect();
-    }
-
-    public void shutdown() {
-        shutdown(null);
-    }
-
-    public void shutdown(String message) {
-        traceln("TS: shutdown: vmDied= " + vmDied +
-                 ", vmDisconnected= " + vmDisconnected +
-                 ", connection = " + connection);
-
-        if ((connection != null)) {
-            try {
-                connection.disposeVM();
-             } catch (VMDisconnectedException e) {
-                // Shutting down after the VM has gone away. This is
-                // not an error, and we just ignore it.
-            }
-        } else {
-            traceln("TS: shutdown: disposeVM not called");
-        }
-        if (message != null) {
-            println(message);
-        }
-
-        vmDied = true;
-        vmDisconnected = true;
-    }
-}
diff --git a/hotspot/src/jdk.hotspot.agent/test/jdi/VMConnection.java b/hotspot/src/jdk.hotspot.agent/test/jdi/VMConnection.java
deleted file mode 100644
index 8c42174..0000000
--- a/hotspot/src/jdk.hotspot.agent/test/jdi/VMConnection.java
+++ /dev/null
@@ -1,378 +0,0 @@
-/*
- * Copyright (c) 2002, 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.
- *
- */
-
-import com.sun.jdi.*;
-import com.sun.jdi.connect.*;
-import com.sun.jdi.request.EventRequestManager;
-
-import java.util.*;
-import java.io.*;
-
-
-/**
- * Manages a VM conection for the JDI test framework.
- */
-class VMConnection {
-    private VirtualMachine vm;
-    private Process process = null;
-    private int outputCompleteCount = 0;
-
-    private final Connector connector;
-    private final Map connectorArgs;
-    private final int traceFlags;
-
-    /**
-     * Return a String containing VM Options to pass to the debugee
-     * or an empty string if there are none.
-     * These are read from the first non-comment line
-     * in file test/com/sun/jdi/@debuggeeVMOptions.
-     */
-    static public String getDebuggeeVMOptions() {
-
-        // When we run under jtreg, test.src contains the pathname of
-        // the test/com/sun/jdi dir.
-        BufferedReader reader;
-        final String filename = "@debuggeeVMOptions";
-        String srcDir = System.getProperty("test.src");
-
-        if (srcDir == null) {
-          srcDir = System.getProperty("user.dir");
-        }
-        srcDir = srcDir + File.separator;
-
-        File myDir = new File(srcDir);
-
-        File myFile = new File(myDir, filename);
-        if (!myFile.canRead()) {
-            try {
-                // We have some subdirs of test/com/sun/jdi so in case we
-                // are in one of them, look in our parent dir for the file.
-                myFile = new File(myDir.getCanonicalFile().getParent(),
-                                  filename);
-                if (!myFile.canRead()) {
-                    return "";
-                }
-            } catch (IOException ee) {
-                System.out.println("-- Error 1 trying to access file " +
-                                   myFile.getPath() + ": " + ee);
-                return "";
-            }
-        }
-        String wholePath = myFile.getPath();
-        try {
-            reader = new BufferedReader(new FileReader(myFile));
-        } catch (FileNotFoundException ee) {
-            System.out.println("-- Error 2 trying to access file " +
-                               wholePath + ": " + ee);
-            return "";
-        }
-
-        String line;
-        String retVal = "";
-        while (true) {
-            try {
-                line = reader.readLine();
-            } catch (IOException ee) {
-                System.out.println("-- Error reading options from file " +
-                                   wholePath + ": " + ee);
-                break;
-            }
-            if (line == null) {
-                System.out.println("-- No debuggee VM options found in file " +
-                                   wholePath);
-                break;
-            }
-            line = line.trim();
-            if (line.length() != 0 && !line.startsWith("#")) {
-                System.out.println("-- Added debuggeeVM options from file " +
-                                   wholePath + ": " + line);
-                retVal = line;
-                break;
-            }
-            // Else, read he next line.
-        }
-        try {
-            reader.close();
-        } catch (IOException ee) {
-        }
-        return retVal;
-    }
-
-    private Connector findConnector(String name) {
-        List connectors = Bootstrap.virtualMachineManager().allConnectors();
-        Iterator iter = connectors.iterator();
-        while (iter.hasNext()) {
-            Connector connector = (Connector)iter.next();
-            if (connector.name().equals(name)) {
-                return connector;
-            }
-        }
-        return null;
-    }
-
-    private Map parseConnectorArgs(Connector connector, String argString) {
-        StringTokenizer tokenizer = new StringTokenizer(argString, ",");
-        Map arguments = connector.defaultArguments();
-
-        while (tokenizer.hasMoreTokens()) {
-            String token = tokenizer.nextToken();
-            int index = token.indexOf('=');
-            if (index == -1) {
-                throw new IllegalArgumentException("Illegal connector argument: " +
-                                                   token);
-            }
-            String name = token.substring(0, index);
-            String value = token.substring(index + 1);
-            Connector.Argument argument = (Connector.Argument)arguments.get(name);
-            if (argument == null) {
-                throw new IllegalArgumentException("Argument " + name +
-                                               "is not defined for connector: " +
-                                               connector.name());
-            }
-            argument.setValue(value);
-        }
-        return arguments;
-    }
-
-    VMConnection(String connectSpec, int traceFlags) {
-        String nameString;
-        String argString;
-        int index = connectSpec.indexOf(':');
-        if (index == -1) {
-            nameString = connectSpec;
-            argString = "";
-        } else {
-            nameString = connectSpec.substring(0, index);
-            argString = connectSpec.substring(index + 1);
-        }
-
-        connector = findConnector(nameString);
-        if (connector == null) {
-            throw new IllegalArgumentException("No connector named: " +
-                                               nameString);
-        }
-
-        connectorArgs = parseConnectorArgs(connector, argString);
-        this.traceFlags = traceFlags;
-    }
-
-    synchronized VirtualMachine open() {
-        if (connector instanceof LaunchingConnector) {
-            vm = launchTarget();
-        } else if (connector instanceof AttachingConnector) {
-            vm = attachTarget();
-        } else if (connector instanceof ListeningConnector) {
-            vm = listenTarget();
-        } else {
-            throw new InternalError("Invalid connect type");
-        }
-        vm.setDebugTraceMode(traceFlags);
-        System.out.println("JVM version:" + vm.version());
-        System.out.println("JDI version: " + Bootstrap.virtualMachineManager().majorInterfaceVersion() +
-                           "." + Bootstrap.virtualMachineManager().minorInterfaceVersion());
-        System.out.println("JVM description: " + vm.description());
-
-        return vm;
-    }
-
-    boolean setConnectorArg(String name, String value) {
-        /*
-         * Too late if the connection already made
-         */
-        if (vm != null) {
-            return false;
-        }
-
-        Connector.Argument argument = (Connector.Argument)connectorArgs.get(name);
-        if (argument == null) {
-            return false;
-        }
-        argument.setValue(value);
-        return true;
-    }
-
-    String connectorArg(String name) {
-        Connector.Argument argument = (Connector.Argument)connectorArgs.get(name);
-        if (argument == null) {
-            return "";
-        }
-        return argument.value();
-    }
-
-    public synchronized VirtualMachine vm() {
-        if (vm == null) {
-            throw new InternalError("VM not connected");
-        } else {
-            return vm;
-        }
-    }
-
-    boolean isOpen() {
-        return (vm != null);
-    }
-
-    boolean isLaunch() {
-        return (connector instanceof LaunchingConnector);
-    }
-
-    Connector connector() {
-        return connector;
-    }
-
-    boolean isListen() {
-        return (connector instanceof ListeningConnector);
-    }
-
-    boolean isAttach() {
-        return (connector instanceof AttachingConnector);
-    }
-
-    private synchronized void notifyOutputComplete() {
-        outputCompleteCount++;
-        notifyAll();
-    }
-
-    private synchronized void waitOutputComplete() {
-        // Wait for stderr and stdout
-        if (process != null) {
-            while (outputCompleteCount < 2) {
-                try {wait();} catch (InterruptedException e) {}
-            }
-        }
-    }
-
-    public void disposeVM() {
-        try {
-            if (vm != null) {
-                vm.dispose();
-                vm = null;
-            }
-        } finally {
-            if (process != null) {
-                process.destroy();
-                process = null;
-            }
-            waitOutputComplete();
-        }
-    }
-
-    private void dumpStream(InputStream stream) throws IOException {
-        PrintStream outStream = System.out;
-        BufferedReader in =
-            new BufferedReader(new InputStreamReader(stream));
-        String line;
-        while ((line = in.readLine()) != null) {
-            outStream.println(line);
-        }
-    }
-
-    /**
-     *  Create a Thread that will retrieve and display any output.
-     *  Needs to be high priority, else debugger may exit before
-     *  it can be displayed.
-     */
-    private void displayRemoteOutput(final InputStream stream) {
-        Thread thr = new Thread("output reader") {
-            public void run() {
-                try {
-                    dumpStream(stream);
-                } catch (IOException ex) {
-                    System.err.println("IOException reading output of child java interpreter:"
-                                       + ex.getMessage());
-                } finally {
-                    notifyOutputComplete();
-                }
-            }
-        };
-        thr.setPriority(Thread.MAX_PRIORITY-1);
-        thr.start();
-    }
-
-    private void dumpFailedLaunchInfo(Process process) {
-        try {
-            dumpStream(process.getErrorStream());
-            dumpStream(process.getInputStream());
-        } catch (IOException e) {
-            System.err.println("Unable to display process output: " +
-                               e.getMessage());
-        }
-    }
-
-    /* launch child target vm */
-    private VirtualMachine launchTarget() {
-        LaunchingConnector launcher = (LaunchingConnector)connector;
-        try {
-            VirtualMachine vm = launcher.launch(connectorArgs);
-            process = vm.process();
-            displayRemoteOutput(process.getErrorStream());
-            displayRemoteOutput(process.getInputStream());
-            return vm;
-        } catch (IOException ioe) {
-            ioe.printStackTrace();
-            System.err.println("\n Unable to launch target VM.");
-        } catch (IllegalConnectorArgumentsException icae) {
-            icae.printStackTrace();
-            System.err.println("\n Internal debugger error.");
-        } catch (VMStartException vmse) {
-            System.err.println(vmse.getMessage() + "\n");
-            dumpFailedLaunchInfo(vmse.process());
-            System.err.println("\n Target VM failed to initialize.");
-        }
-        return null; // Shuts up the compiler
-    }
-
-    /* attach to running target vm */
-    private VirtualMachine attachTarget() {
-        AttachingConnector attacher = (AttachingConnector)connector;
-        try {
-            return attacher.attach(connectorArgs);
-        } catch (IOException ioe) {
-            ioe.printStackTrace();
-            System.err.println("\n Unable to attach to target VM.");
-        } catch (IllegalConnectorArgumentsException icae) {
-            icae.printStackTrace();
-            System.err.println("\n Internal debugger error.");
-        }
-        return null; // Shuts up the compiler
-    }
-
-    /* listen for connection from target vm */
-    private VirtualMachine listenTarget() {
-        ListeningConnector listener = (ListeningConnector)connector;
-        try {
-            String retAddress = listener.startListening(connectorArgs);
-            System.out.println("Listening at address: " + retAddress);
-            vm = listener.accept(connectorArgs);
-            listener.stopListening(connectorArgs);
-            return vm;
-        } catch (IOException ioe) {
-            ioe.printStackTrace();
-            System.err.println("\n Unable to attach to target VM.");
-        } catch (IllegalConnectorArgumentsException icae) {
-            icae.printStackTrace();
-            System.err.println("\n Internal debugger error.");
-        }
-        return null; // Shuts up the compiler
-    }
-}
diff --git a/hotspot/src/jdk.hotspot.agent/test/jdi/jstack.sh b/hotspot/src/jdk.hotspot.agent/test/jdi/jstack.sh
deleted file mode 100644
index 67f7770..0000000
--- a/hotspot/src/jdk.hotspot.agent/test/jdi/jstack.sh
+++ /dev/null
@@ -1,26 +0,0 @@
-#!/bin/sh
-#
-# Copyright (c) 2003, 2012, Oracle and/or its affiliates. All rights reserved.
-# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
-#
-# This code is free software; you can redistribute it and/or modify it
-# under the terms of the GNU General Public License version 2 only, as
-# published by the Free Software Foundation.
-#
-# 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.
-#  
-#
-
-$JAVA_HOME/bin/java -showversion ${OPTIONS} -classpath $JAVA_HOME/lib/sa-jdi.jar sun.jvm.hotspot.tools.StackTrace $*
diff --git a/hotspot/src/jdk.hotspot.agent/test/jdi/jstack64.sh b/hotspot/src/jdk.hotspot.agent/test/jdi/jstack64.sh
deleted file mode 100644
index cd2a422..0000000
--- a/hotspot/src/jdk.hotspot.agent/test/jdi/jstack64.sh
+++ /dev/null
@@ -1,26 +0,0 @@
-#!/bin/sh
-#
-# Copyright (c) 2003, 2012, Oracle and/or its affiliates. All rights reserved.
-# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
-#
-# This code is free software; you can redistribute it and/or modify it
-# under the terms of the GNU General Public License version 2 only, as
-# published by the Free Software Foundation.
-#
-# 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.
-#  
-#
-
-$JAVA_HOME/bin/java -d64 -showversion ${OPTIONS} -classpath $JAVA_HOME/lib/sa-jdi.jar sun.jvm.hotspot.tools.StackTrace $*
diff --git a/hotspot/src/jdk.hotspot.agent/test/jdi/multivm.java b/hotspot/src/jdk.hotspot.agent/test/jdi/multivm.java
deleted file mode 100644
index 8ba06e7..0000000
--- a/hotspot/src/jdk.hotspot.agent/test/jdi/multivm.java
+++ /dev/null
@@ -1,133 +0,0 @@
-/*
- * Copyright (c) 2003, 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.
- *
- */
-
-import com.sun.jdi.*;
-import com.sun.jdi.connect.*;
-
-import java.util.Map;
-import java.util.List;
-import java.util.Iterator;
-import java.io.IOException;
-
-/* This class is used to test multi VM connectivity feature of
- * SA/JDI. Accepts two PIDs as arguments. Connects to first VM
- *, Connects to second VM and disposes them in that order.
- */
-
-public class multivm {
-    static AttachingConnector myPIDConn;
-    static VirtualMachine vm1;
-    static VirtualMachine vm2;
-    static VirtualMachineManager vmmgr;
-
-    public static void println(String msg) {
-        System.out.println(msg);
-    }
-
-    private static void usage() {
-        System.err.println("Usage: java multivm <pid1> <pid2>");
-        System.exit(1);
-    }
-
-    public static void main(String args[]) {
-        vmmgr = Bootstrap.virtualMachineManager();
-        List attachingConnectors = vmmgr.attachingConnectors();
-        if (attachingConnectors.isEmpty()) {
-            System.err.println( "ERROR: No attaching connectors");
-            return;
-        }
-        Iterator myIt = attachingConnectors.iterator();
-        while (myIt.hasNext()) {
-            AttachingConnector tmpCon = (AttachingConnector)myIt.next();
-            if (tmpCon.name().equals(
-                "sun.jvm.hotspot.jdi.SAPIDAttachingConnector")) {
-                myPIDConn = tmpCon;
-                break;
-            }
-        }
-
-        int pid1 = 0, pid2 = 0;
-        String pidText = null;
-        switch (args.length) {
-        case (2):
-            try {
-                pidText = args[0];
-                pid1 = Integer.parseInt(pidText);
-                System.out.println( "pid1: " + pid1);
-                vm1 = attachPID(pid1);
-                pidText = args[1];
-                pid2 = Integer.parseInt(pidText);
-                System.out.println( "pid2: " + pid2);
-                vm2 = attachPID(pid2);
-            } catch (NumberFormatException e) {
-                println(e.getMessage());
-                usage();
-            }
-            break;
-        default:
-            usage();
-        }
-
-        if (vm1 != null) {
-            System.out.println("vm1: attached ok!");
-            System.out.println(vm1.version());
-            sagdoit mine = new sagdoit(vm1);
-            mine.doAll();
-        }
-
-        if (vm2 != null) {
-            System.out.println("vm2: attached ok!");
-            System.out.println(vm2.version());
-            sagdoit mine = new sagdoit(vm2);
-            mine.doAll();
-        }
-
-        if (vm1 != null) {
-            vm1.dispose();
-        }
-
-        if (vm2 != null) {
-            vm2.dispose();
-        }
-    }
-
-   private static VirtualMachine attachPID(int pid) {
-        Map connArgs = myPIDConn.defaultArguments();
-        System.out.println("connArgs = " + connArgs);
-        VirtualMachine vm;
-        Connector.StringArgument connArg = (Connector.StringArgument)connArgs.get("pid");
-        connArg.setValue(Integer.toString(pid));
-
-        try {
-            vm = myPIDConn.attach(connArgs);
-        } catch (IOException ee) {
-            System.err.println("ERROR: myPIDConn.attach got IO Exception:" + ee);
-            vm = null;
-        } catch (IllegalConnectorArgumentsException ee) {
-            System.err.println("ERROR: myPIDConn.attach got illegal args exception:" + ee);
-            vm = null;
-        }
-        return vm;
-   }
-}
diff --git a/hotspot/src/jdk.hotspot.agent/test/jdi/multivm.sh b/hotspot/src/jdk.hotspot.agent/test/jdi/multivm.sh
deleted file mode 100644
index 5d114c0..0000000
--- a/hotspot/src/jdk.hotspot.agent/test/jdi/multivm.sh
+++ /dev/null
@@ -1,58 +0,0 @@
-#!/bin/ksh
-#
-# Copyright (c) 2003, 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.
-#  
-#
-
-doUsage()
-{
-    cat <<EOF
-    Run multivm.class using Serviceability Agent to talk to 2 pids
-    simultaneousely. i.e, before detaching one attach another.
-    Usage:  multivm.sh <jdk-pathname> <pid1> <pid2>
-
-EOF
-}
-
-if [ $# = 4 ] ; then
-    doUsage
-    exit 1
-fi
-
-jdk=$1
-javacp="$jdk/lib/sa-jdi.jar:$classesDir:$jdk/lib/tools.jar:$jdk/classes:./workdir"
-
-mkdir -p workdir
-if [ sagdoit.java -nt ./workdir/sagdoit.class ] ; then
-    $jdk/bin/javac -d ./workdir -classpath $javacp sagdoit.java
-    if [ $? != 0 ] ; then
-        exit 1
-    fi
-fi
-if [ multivm.java -nt ./workdir/multivm.class ] ; then
-    $jdk/bin/javac -d ./workdir -classpath $javacp multivm.java
-    if [ $? != 0 ] ; then
-        exit 1
-    fi
-fi
-
-$jdk/bin/java -Dsun.jvm.hotspot.jdi.ConnectorImpl.DEBUG -Dsun.jvm.hotspot.jdi.SAJDIClassLoader.DEBUG -Djava.class.path=$javacp multivm $2 $3
diff --git a/hotspot/src/jdk.hotspot.agent/test/jdi/runjdb.sh b/hotspot/src/jdk.hotspot.agent/test/jdi/runjdb.sh
deleted file mode 100644
index cd1b10f..0000000
--- a/hotspot/src/jdk.hotspot.agent/test/jdi/runjdb.sh
+++ /dev/null
@@ -1,108 +0,0 @@
-#!/bin/sh
-#
-# Copyright (c) 2002, 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.
-#  
-#
-
-#  jdb is a .c file that seems to discard the setting of CLASSPATH.
-# So, we have to run jdb by calling java directly :-(
-
-# License file for development version of dbx
-LM_LICENSE_FILE=7588@extend.eng:/usr/dist/local/config/sparcworks/license.dat:7588@setlicense
-export LM_LICENSE_FILE
-
-doUsage()
-{
-   cat <<EOF
-Usage:  runjdb.sh corefile -jdk jdk-pathname -sa sa-pathname
-    sa-pathname is the path of a JDI-SA build dir.
-EOF
-}
-
-jdk=
-javaArgs=
-args=
-sa=
-while [ $# != 0 ] ; do
-    case $1 in
-      -vv)
-        set -x
-        ;;
-     -jdk)
-        jdk=$2
-        shift
-        ;;
-     -sa)
-        sa=$2
-        shift
-        ;;
-     -help | help)
-        doUsage
-        exit
-        ;;
-     -*)
-        javaArgs="$javaArgs $1"
-        ;;
-     *)
-        if [ ! -z "$args" ] ; then
-            echo "Error: Only one core file or pid can be specified"
-            exit 1
-        fi
-        echo "$1" | grep -s '^[0-9]*$' > /dev/null
-        if [ $? = 0 ] ; then
-            # it is a pid
-            args="$args $1"
-            echo "Error: A pid is not yet allowed"
-            exit 1
-        else
-            # It is a core.        
-            # We have to pass the name of the program that produced the
-            # core, and the core file itself.
-            args="$1"
-        fi
-        ;;
-   esac
-   shift
-done
-
-if [ -z "$jdk" ] ; then
-    echo "Error:  -jdk jdk-pathname is required"
-    exit 1
-fi
-if [ -z "$sa" ] ; then
-    echo "Error:  -sa sa-pathname is required"
-    exit 1
-fi
-
-if [ -z "$args" ] ; then
-    echo "Error:  a core file or pid must be specified"
-    exit 1
-fi
-
-set -x
-$jdk/bin/jdb -J-Xbootclasspath/a:$sa  -connect \
-  sun.jvm.hotspot.jdi.SACoreAttachingConnector:core=$args,javaExecutable=$jdk/bin/java
-
-
-#$jdk/bin/java -Xbootclasspath/a:$mmm/ws/merlin-sa/build/agent \
-#  com.sun.tools.example.debug.tty.TTY -connect \
-#  sun.jvm.hotspot.jdi.SACoreAttachingConnector:core=sagcore,javaExecutable=$jdk/bin/java
diff --git a/hotspot/src/jdk.hotspot.agent/test/jdi/runjpda.sh b/hotspot/src/jdk.hotspot.agent/test/jdi/runjpda.sh
deleted file mode 100644
index a245946..0000000
--- a/hotspot/src/jdk.hotspot.agent/test/jdi/runjpda.sh
+++ /dev/null
@@ -1,133 +0,0 @@
-#!/bin/ksh
-#
-# Copyright (c) 2002, 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.
-#
-# This code is distributed in the hope that it will be useful, but WITHOUT
-# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
-# FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
-# version 2 for more details (a copy is included in the LICENSE file that
-# accompanied this code).
-#
-# You should have received a copy of the GNU General Public License version
-# 2 along with this work; if not, write to the Free Software Foundation,
-# Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
-#
-# Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
-# or visit www.oracle.com if you need additional information or have any
-# questions.
-#  
-#
-
-# This script runs the test program, sagtest.java, with the regular
-# JPDA jdi.
-# It then starts up the debuggee part of the test, sagtarg.java,
-# and calls gcore to create file sagcore for use in running
-# the SA JDI client.
-
-set -x
-# jdk is a jdk with the vm from the sa workspace
-while [ $# != 0 ] ; do
-    case $1 in
-      -vv)
-        set -x
-        ;;
-      -gui)
-        theClass=sun.jvm.hotspot.HSDB
-        ;;
-     -jdk)
-        jdk=$2
-        shift
-        ;;
-     -jdbx)
-        do=jdbx
-        ;;
-     -jdb)
-        do=jdb
-        ;;
-     -help | help)
-        doUsage
-        exit
-        ;;
-     -dontkill)
-        dontkill=true
-        ;;
-     -d64)
-        d64=-d64
-        ;;
-     -*)
-        javaArgs="$javaArgs $1"
-        ;;
-     *)
-        echo "$1" | grep -s '^[0-9]*$' > /dev/null
-        if [ $? = 0 ] ; then
-            # it is a pid
-            args="$args $1"
-        else
-            # It is a core.        
-            # We have to pass the name of the program that produced the
-            # core, and the core file itself.
-            args="$jdk/bin/java $1"
-        fi
-        ;;
-   esac
-   shift
-done
-
-# First, run the sagtest.java with the regular JPDA jdi
-workdir=./workdir
-mkdir -p $workdir
-CLASSPATH=$jdk/classes:$jdk/lib/tools.jar:$workdir
-export CLASSPATH
-
-$jdk/bin/javac -g  -source 1.5 -classpath $jdk/classes:$jdk/lib/tools.jar:$workdir -J-Xms40m -d $workdir \
-    TestScaffold.java \
-    VMConnection.java \
-    TargetListener.java \
-    TargetAdapter.java \
-    sagdoit.java \
-    sagtarg.java \
-    sagtest.java
-
-if [ $? != 0 ] ; then
-    exit 1
-fi
-
-$jdk/bin/java $javaArgs -Dtest.classes=$workdir sagtest
-
-# Now run create a core file for use in running sa-jdi
-
-if [ ! core.satest -nt sagtarg.class ] ; then
-    tmp=/tmp/sagsetup
-    rm -f $tmp
-    $jdk/bin/java $d64 sagtarg > $tmp &
-    pid=$!
-    while [ ! -s $tmp ] ; do
-        # Kludge alert!
-        sleep 2
-    done
-    #rm -f $tmp
-
-    # force core dump of the debuggee
-    OS=`uname`
-    if [ "$OS" = "Linux" ]; then
-        # Linux does not have gcore command. Instead, we use 'gdb's
-        # gcore command. Note that only some versions of gdb support
-        # gdb command.
-        echo "gcore" > gdbscript
-        gdb -batch -p $pid -x gdbscript
-        rm -f gdbscript
-    else
-        gcore  $* $pid
-    fi
-    mv core.$pid sagcore
-
-    if [ "$dontkill" != "true" ]; then
-       kill -9 $pid
-    fi
-fi
-
diff --git a/hotspot/src/jdk.hotspot.agent/test/jdi/runsa.sh b/hotspot/src/jdk.hotspot.agent/test/jdi/runsa.sh
deleted file mode 100644
index aa4d778..0000000
--- a/hotspot/src/jdk.hotspot.agent/test/jdi/runsa.sh
+++ /dev/null
@@ -1,183 +0,0 @@
-#!/bin/ksh
-#
-# Copyright (c) 2002, 2012, Oracle and/or its affiliates. All rights reserved.
-# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
-#
-# This code is free software; you can redistribute it and/or modify it
-# under the terms of the GNU General Public License version 2 only, as
-# published by the Free Software Foundation.
-#
-# This code is distributed in the hope that it will be useful, but WITHOUT
-# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
-# FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
-# version 2 for more details (a copy is included in the LICENSE file that
-# accompanied this code).
-#
-# You should have received a copy of the GNU General Public License version
-# 2 along with this work; if not, write to the Free Software Foundation,
-# Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
-#
-# Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
-# or visit www.oracle.com if you need additional information or have any
-# questions.
-#  
-#
-
-
-# This jdk must be hopper or better; it must have the 
-# SA connectors in VirtualMachineManagerImpl.
-jdk=/java/re/jdk/1.4.1/promoted/latest/binaries/solaris-sparc
-#jdk=/net/mmm/export/mmm/jdk1.4fcs.sa
-
-doUsage()
-{
-    cat <<EOF
-    Run sagclient.class using Serviceability Agent to talk to a corefile/pid/debugserver.
-    Usage:  runsa.sh [-jdk <jdk-pathname>] [-jdb] [ -jdbx ] [ -d64 ] [ -remote ] [ pid | corefile | debugserver ]
-
-    -jdk means to use that jdk.  Default is 1.4.1/latest.
-    -jdbx means to run it under jdbx
-    -jdb means to connect using jdb instead of the sagclient program.
-    -remote debugserver means you want to connect to a remote debug server
-
-    The corefile must have been produced by the same java as is running SA.
-
-EOF
-}
-
-if [ $# = 0 ] ; then
-    doUsage
-    exit 1
-fi
-
-# License file for development version of dbx
-#LM_LICENSE_FILE=7588@extend.eng:/usr/dist/local/config/sparcworks/license.dat:7588@setlicense
-#export LM_LICENSE_FILE
-
-do=
-args=
-theClass=sagclient
-javaArgs=
-
-while [ $# != 0 ] ; do
-    case $1 in
-      -vv)
-        set -x
-        ;;
-     -jdk)
-        jdk=$2
-        shift
-        ;;
-     -jdbx)
-        do=jdbx
-        ;;
-     -jdb)
-        do=jdb
-        ;;
-     -help | help)
-        doUsage
-        exit
-        ;;
-     -d64) 
-        d64=-d64
-        ;;
-     -remote)
-        shift 
-        args="$1"
-        do=remote
-        ;;
-     -*)
-        javaArgs="$javaArgs $1"
-        ;;
-     *)
-        echo "$1" | grep -s '^[0-9]*$' > /dev/null
-        if [ $? = 0 ] ; then
-            # it is a pid
-            args="$args $1"
-        else
-            # It is a core.        
-            # We have to pass the name of the program that produced the
-            # core, and the core file itself.
-            args="$jdk/bin/java $1"
-        fi
-        ;;
-   esac
-   shift
-done
-
-if [ -z "$jdk" ] ; then
-    error "--Error: runsa.sh:  Must specify -jdk <jdk-pathname>."
-    error "         Do runsa.sh -help for more info"
-    exit 1
-fi
-
-set -x
-
-# If jjh makes this, then the classes are in .../build/agent.
-# if someone else does, they are in  .
-classesDir=../../../../../../build/agent
-if [ ! -r $classesDir ] ; then
-    classesDir=.
-    if [ ! -r $classesDir ] ; then
-        echo "-- Error: runsa.sh can't find the SA classes"
-        exit 1
-    fi
-fi
-#javacp="/net/mmm/export/mmm/ws/sabaseline/build/solaris/solaris_sparc_compiler1/generated/sa-jdi.jar:$classesDir:$jdk/lib/tools.jar:$jdk/classes:./workdir"
-
-javacp="$jdk/lib/sa-jdi.jar:$classesDir:$jdk/lib/tools.jar:$jdk/classes:./workdir"
-
-
-extraArgs="-showversion $javaArgs"
-#extraArgs="-DdbxSvcAgentDSOPathName=/net/mmm/export/mmm/ws/m/b2/sa/src/os/solaris/agent/64bit/libsvc_agent_dbx.so $extraArgs"
-#extraArgs="-DdbxSvcAgentDSOPathName=/net/jano.eng/export/disk05/hotspot/sa/solaris/sparcv9/lib/libsvc_agent_dbx.so $extraArgs"
-
-mkdir -p workdir
-if [ sagclient.java -nt ./workdir/sagclient.class ] ; then
-    $jdk/bin/javac -d ./workdir -classpath $javacp sagclient.java
-    if [ $? != 0 ] ; then
-        exit 1
-    fi
-fi
-if [ sagdoit.java -nt ./workdir/sagdoit.class ] ; then
-    $jdk/bin/javac -d ./workdir -classpath $javacp sagdoit.java
-    if [ $? != 0 ] ; then
-        exit 1
-    fi
-fi
-
-if [ "$do" = jdbx ] ; then
-    set -x
-    dbx=/net/sparcworks.eng/export/set/sparcworks2/dbx_70_nightly/dev/buildbin/Derived-sparc-S2-opt/bin/dbx
-
-    # Have to do this export for jdbx to work.  -cp and -classpath don't work.
-    CLASSPATH=$javacp
-    export CLASSPATH
-    #extraArgs="-Djava.class.path=$mhs/../sa/build/agent sun.jvm.hotspot.HSDB $*"
-    jvm_invocation="$jdk/bin/java -Xdebug \
-               -Dsun.boot.class.path=$jdk/classes \
-               $extraArgs"
-    #export jvm_invocation
-    
-    JAVASRCPATH=$mhs/../sa/src/share/vm/agent
-    export JAVASRCPATH
-
-    #operand is pathname of .class file, eg ./jj.class.
-    echo run $args
-    clss=`echo $theClass | sed -e 's@\.@/@'`
-    if [ -r ./workdir/$clss.class ] ; then
-        # kludge for running sagclient
-        $dbx  ./workdir/$clss.class
-    else
-        # kludge for running HSDB
-        $dbx  $mhs/../sa/build/agent/$clss.class
-    fi
-elif [ "$do" = jdb ] ; then
-    # This hasn't been tested.
-    $jdk/bin/jdb -J-Xbootclasspath/a:$classesDir -connect sun.jvm.hotspot.jdi.SACoreAttachingConnector:core=sagcore
-elif [ "$do" = remote ] ; then
-    $jdk/bin/java $d64 -Djava.class.path=$javacp $extraArgs $theClass $args
-else
-    $jdk/bin/java $d64 -Djava.class.path=$javacp $extraArgs $theClass $args
-
-fi
diff --git a/hotspot/src/jdk.hotspot.agent/test/jdi/sagclient.java b/hotspot/src/jdk.hotspot.agent/test/jdi/sagclient.java
deleted file mode 100644
index 8160b76..0000000
--- a/hotspot/src/jdk.hotspot.agent/test/jdi/sagclient.java
+++ /dev/null
@@ -1,167 +0,0 @@
-/*
- * Copyright (c) 2002, 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.
- *
- * 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 com.sun.jdi.*;
-import com.sun.jdi.connect.*;
-
-import java.util.Map;
-import java.util.List;
-import java.util.Iterator;
-import java.io.IOException;
-
-public class sagclient {
-    static AttachingConnector myCoreConn;
-    static AttachingConnector myPIDConn;
-    static AttachingConnector myDbgSvrConn;
-    static VirtualMachine vm;
-    static VirtualMachineManager vmmgr;
-
-    public static void println(String msg) {
-        System.out.println("jj: " + msg);
-    }
-
-
-    public static void main(String args[]) {
-        vmmgr = Bootstrap.virtualMachineManager();
-        List attachingConnectors = vmmgr.attachingConnectors();
-        if (attachingConnectors.isEmpty()) {
-            System.err.println( "ERROR: No attaching connectors");
-            return;
-        }
-        Iterator myIt = attachingConnectors.iterator();
-        while (myIt.hasNext()) {
-            AttachingConnector tmpCon = (AttachingConnector)myIt.next();
-            if (tmpCon.name().equals(
-                "sun.jvm.hotspot.jdi.SACoreAttachingConnector")) {
-                myCoreConn = tmpCon;
-            } else if (tmpCon.name().equals(
-                "sun.jvm.hotspot.jdi.SAPIDAttachingConnector")) {
-                myPIDConn = tmpCon;
-            } else if (tmpCon.name().equals(
-                "sun.jvm.hotspot.jdi.SADebugServerAttachingConnector")) {
-                myDbgSvrConn = tmpCon;
-            }
-        }
-        String execPath = null;
-        String pidText = null;
-        String coreFilename = null;
-        String debugServer = null;
-        int pid = 0;
-        switch (args.length) {
-        case (0):
-            break;
-        case (1):
-            // If all numbers, it is a PID to attach to
-            // Else, it is a pathname to a .../bin/java for a core file.
-            try {
-                pidText = args[0];
-                pid = Integer.parseInt(pidText);
-                System.out.println( "pid: " + pid);
-                vm = attachPID(pid);
-            } catch (NumberFormatException e) {
-                System.out.println("trying remote server ..");
-                debugServer = args[0];
-                System.out.println( "remote server: " + debugServer);
-                vm = attachDebugServer(debugServer);
-            }
-            break;
-
-        case (2):
-            execPath = args[0];
-            coreFilename = args[1];
-            System.out.println( "jdk: " + execPath);
-            System.out.println( "core: " + coreFilename);
-            vm = attachCore(coreFilename, execPath);
-            break;
-        }
-
-
-        if (vm != null) {
-            System.out.println("sagclient: attached ok!");
-            sagdoit mine = new sagdoit(vm);
-            mine.doAll();
-            vm.dispose();
-        }
-    }
-
-    private static VirtualMachine attachCore(String coreFilename, String execPath) {
-        Map connArgs = myCoreConn.defaultArguments();
-        System.out.println("connArgs = " + connArgs);
-        VirtualMachine vm;
-        Connector.StringArgument connArg = (Connector.StringArgument)connArgs.get("core");
-        connArg.setValue(coreFilename);
-
-        connArg =  (Connector.StringArgument)connArgs.get("javaExecutable");
-        connArg.setValue(execPath);
-        try {
-            vm = myCoreConn.attach(connArgs);
-        } catch (IOException ee) {
-            System.err.println("ERROR: myCoreConn.attach got IO Exception:" + ee);
-            vm = null;
-        } catch (IllegalConnectorArgumentsException ee) {
-            System.err.println("ERROR: myCoreConn.attach got illegal args exception:" + ee);
-            vm = null;
-        }
-        return vm;
-   }
-
-   private static VirtualMachine attachPID(int pid) {
-        Map connArgs = myPIDConn.defaultArguments();
-        System.out.println("connArgs = " + connArgs);
-        VirtualMachine vm;
-        Connector.StringArgument connArg = (Connector.StringArgument)connArgs.get("pid");
-        connArg.setValue(Integer.toString(pid));
-
-        try {
-            vm = myPIDConn.attach(connArgs);
-        } catch (IOException ee) {
-            System.err.println("ERROR: myPIDConn.attach got IO Exception:" + ee);
-            vm = null;
-        } catch (IllegalConnectorArgumentsException ee) {
-            System.err.println("ERROR: myPIDConn.attach got illegal args exception:" + ee);
-            vm = null;
-        }
-        return vm;
-   }
-
-
-   private static VirtualMachine attachDebugServer(String debugServer) {
-        Map connArgs = myDbgSvrConn.defaultArguments();
-        System.out.println("connArgs = " + connArgs);
-        VirtualMachine vm;
-        Connector.StringArgument connArg = (Connector.StringArgument)connArgs.get("debugServerName");
-        connArg.setValue(debugServer);
-
-        try {
-            vm = myDbgSvrConn.attach(connArgs);
-        } catch (IOException ee) {
-            System.err.println("ERROR: myDbgSvrConn.attach got IO Exception:" + ee);
-            vm = null;
-        } catch (IllegalConnectorArgumentsException ee) {
-            System.err.println("ERROR: myDbgSvrConn.attach got illegal args exception:" + ee);
-            vm = null;
-        }
-        return vm;
-   }
-}
diff --git a/hotspot/src/jdk.hotspot.agent/test/jdi/sagdoit.java b/hotspot/src/jdk.hotspot.agent/test/jdi/sagdoit.java
deleted file mode 100644
index 27c6931..0000000
--- a/hotspot/src/jdk.hotspot.agent/test/jdi/sagdoit.java
+++ /dev/null
@@ -1,329 +0,0 @@
-/*
- * Copyright (c) 2002, 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.
- *
- * 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 com.sun.jdi.*;
-import java.util.*;
-
-
-// This just contains a bunch of methods that call various JDI methods.
-// It is called from the sagtest.java jtreg test to get this info for the standard
-// JDI and from the sagclient.java test to get this info for the SA JDI.
-
-class comparator implements Comparator {
-
-    public int compare(Object o1, Object o2) {
-        ReferenceType rt1 = (ReferenceType)o1;
-        ReferenceType rt2 = (ReferenceType)o2;
-        return rt1.signature().compareTo(rt2.signature());
-    }
-
-    public boolean equals(Object oo) {
-        return false;
-    }
-}
-
-public class sagdoit {
-
-    VirtualMachine myVm;
-    int margin = 0;
-    static String blanks = "                                                        ";
-    static int nblanks = blanks.length();
-
-    sagdoit(VirtualMachine vm) {
-        super();
-        myVm = vm;
-    }
-
-    void indent(int count) {
-        margin += count;
-    }
-
-    void pp(String msg) {
-        System.out.println(blanks.substring(nblanks - margin) + msg);
-    }
-
-    public void doAll() {
-        doThreadGroups();
-        //System.out.println("NOTE: dumping of class info is disabled in sagdoit.java");
-        //System.out.println("      just to keep the output small while working on objects");
-        doClasses();  //fixme jj: uncomment this to see all class info
-
-    }
-    public void doThreadGroups() {
-        doThreadGroupList(myVm.topLevelThreadGroups());
-    }
-
-    private void doThreadGroupList(List groups) {
-        // sort; need a comparator
-        if (groups == null) {
-            return;
-        }
-
-        Iterator myIter = groups.iterator();
-        while(myIter.hasNext()) {
-            ThreadGroupReference aGroup = (ThreadGroupReference)myIter.next();
-            doOneThreadGroup(aGroup);
-        }
-
-    }
-
-    public void doOneThreadGroup(ThreadGroupReference xx) {
-        pp("threadGroup:" + xx.name());
-        indent(4);
-        pp("parent()       = " + xx.parent());
-        pp("threads:");
-        indent(4);
-        doThreadList(xx.threads());
-        indent(-4);
-        pp("threadGroups:");
-        indent(4);
-        doThreadGroupList(xx.threadGroups());
-        indent(-4);
-        indent(-4);
-    }
-
-    public void doThreads() {
-        doThreadList(myVm.allThreads());
-    }
-
-    public void doThreadList(List threads) {
-        if (threads == null) {
-            return;
-        }
-        Iterator myIter = threads.iterator();
-        while(myIter.hasNext()) {
-            ThreadReference aThread = (ThreadReference)myIter.next();
-            doOneThread(aThread);
-        }
-    }
-
-    public void doOneThread(ThreadReference xx) {
-        pp("Thread: " + xx.name());
-        indent(4);
-        pp("suspendCount()      = " + xx.suspendCount());
-
-        //void stop(ObjectReference throwable) throws InvalidTypeException;
-        //void interrupt();
-        pp("status()            = " + xx.status());
-        pp("isSuspended()       = " + xx.isSuspended());
-        pp("isAtBreakpoint()    = " + xx.isAtBreakpoint());
-
-        pp("threadGroup()       = " + xx.threadGroup());
-        indent(-4);
-
-        indent(4);
-        try {
-            List allFrames = xx.frames();
-            for (int ii = 0; ii < xx.frameCount(); ii++) {
-                StackFrame oneFrame = xx.frame(ii);
-                pp("frame(" + ii + ") = " + oneFrame);
-                doOneFrame(oneFrame);
-            }
-            //List frames(int start, int length) throws IncompatibleThreadStateException;
-            // unsupported List allMonitors = xx.ownedMonitors();
-            // unsupported pp("currentContendedMonitor() = " + xx.currentContendedMonitor());
-        } catch (IncompatibleThreadStateException ee) {
-            pp("GOT IncompatibleThreadStateException: " + ee);
-        }
-        indent(-4);
-    }
-
-    public void doOneFrame(StackFrame frame) {
-
-        List localVars = null;
-        try {
-            localVars = frame.visibleVariables();
-        } catch (AbsentInformationException ee) {
-            // we compile with -g so this shouldn't happen
-            return;
-        }
-        indent(4);
-        for (Iterator it = localVars.iterator(); it.hasNext();) {
-            LocalVariable lv = (LocalVariable) it.next();
-            pp("lv name = " + lv.name() +
-               ", type =  " + lv.typeName() +
-               ", sig =   " + lv.signature() +
-               ", gsig =  " + lv.genericSignature() +
-               ", isVis = " + lv.isVisible(frame) +
-               ", isArg = " + lv.isArgument());
-        }
-        indent(-4);
-    }
-
-    public void doClasses() {
-        List myClasses = myVm.allClasses();
-        myClasses = new ArrayList(myClasses);
-        Collections.sort(myClasses, new comparator());
-        for (int ii = 0; ii < myClasses.size(); ii++) {
-            // Spec says each is a ReferenceType
-            //System.out.println("class " + (ii + 1) + " is " + myClasses.get(ii));
-            ReferenceType aClass = (ReferenceType)myClasses.get(ii);
-            System.out.println("class " + (ii + 1) + " is " + aClass.signature());
-            doOneClass(aClass);
-            // Uncomment this to just do a few classes.
-            //if ( ii > 4) break;
-        }
-    }
-
-    public void doOneClass(ReferenceType xx) {
-        indent(5);
-        // inherited from Mirror
-        pp("toString()       = " + xx.toString());
-        pp("virtualMachine() = " + xx.virtualMachine());
-
-        // inherited from Type
-        pp("name()           = " + xx.name());
-        pp("signature()      = " + xx.signature());
-
-        // ReferenceType fields
-        doReferenceTypeFields(xx);
-
-
-
-
-
-        String className = xx.getClass().getName();
-        pp("subclass           = " + className);
-
-         Class referenceType = null;
-         Class arrayType = null;
-         Class classType = null;
-         Class interfaceType = null;
-
-         try {
-             referenceType = Class.forName("com.sun.jdi.ReferenceType");
-             arrayType = Class.forName("com.sun.jdi.ArrayType");
-             interfaceType = Class.forName("com.sun.jdi.InterfaceType");
-             classType = Class.forName("com.sun.jdi.ClassType");
-         } catch (ClassNotFoundException ee) {
-         }
-
-
-         if (referenceType.isInstance(xx)) {
-             pp("ReferenceType fields");
-             ReferenceType rr = (ReferenceType)xx;
-
-             if (arrayType.isInstance(xx)) {
-                 pp("ArrayType fields");
-             }
-
-             if (classType.isInstance(xx)) {
-                 pp("ClassType fields");
-             }
-
-             if (interfaceType.isInstance(xx)) {
-                 pp("InterfaceType fields");
-             }
-         }
-        indent(-5);
-
-    }
-
-
-  public void doReferenceTypeFields(ReferenceType xx) {
-    Object zz;
-      pp("classLoader() = " + xx.classLoader());
-      try {zz =xx.sourceName();} catch(AbsentInformationException ee) { zz = ee;} pp("sourceName() = " + zz);
-      try {zz =xx.sourceNames("stratum");} catch(AbsentInformationException ee) { zz = ee;} pp("sourceNames() = " + zz);
-      try {zz =xx.sourcePaths("stratum");} catch(AbsentInformationException ee) { zz = ee;} pp("sourcePaths() = " + zz);
-      //try {zz =xx.sourceDebugExtension();} catch(AbsentInformationException ee) { zz = ee;} pp("sourceDebugExtension() = " + zz);
-      //fixme: jj; should sourceDebugExtension throw UnsupportedOperationException?
-      try {zz =xx.sourceDebugExtension();} catch(Exception ee) { zz = ee;} pp("sourceDebugExtension() = " + zz);
-      // If xx is an array, this can cause a ClassNotLoadedException on the
-      // component type.  Is that a JDI bug?
-      pp("isStatic() = " + xx.isStatic());
-      pp("isAbstract() = " + xx.isAbstract());
-      pp("isFinal() = " + xx.isFinal());
-      pp("isPrepared() = " + xx.isPrepared());
-      pp("isVerified() = " + xx.isVerified());
-      pp("isInitialized() = " + xx.isInitialized());
-      pp("failedToInitialize() = " + xx.failedToInitialize());
-      pp("fields() = " + xx.fields());
-      pp("visibleFields() = " + xx.visibleFields());
-      pp("allFields() = " + xx.allFields());
-      pp("fieldByName(String fieldName) = " + xx.fieldByName("fieldName"));
-      pp("methods() = " + xx.methods());
-
-
-       List meths = xx.methods();
-       Iterator iter = meths.iterator();
-       while (iter.hasNext()) {
-           Method mm = (Method)iter.next();
-           pp("  name/sig:" + mm.name() + "/" + mm.signature());
-       }
-
-      pp(" visibleMethods() = " + xx.visibleMethods());
-
-      //if (1 == 1) return;
-
-      pp("allMethods() = " + xx.allMethods());
-
-
-      pp("methodsByName(String name) = " + xx.methodsByName("name"));
-      pp("methodsByName(String name, String signature) = " + xx.methodsByName("name", "signature"));
-      pp("nestedTypes() = " + xx.nestedTypes());
-      //pp("getValue(Field field) = " + xx.getValue("field"));
-      pp("getValue(Field field) = " + "fixme: jjh");
-      //pp("getValues(List fields) = " + xx.getValues(new List[] = {"fields"}));
-      pp("getValues(List fields) = " + "fixme: jjh");
-      pp("classObject() = " + xx.classObject());
-      //x      pp("allLineLocations() = " + xx.allLineLocations());
-      //x      pp("allLineLocations(String stratum, String sourceName) = " + xx.allLineLocations("stratum", "sourceName"));
-      //x      pp("locationsOfLine(int lineNumber) = " + xx.locationsOfLine(89));
-      //x      pp("locationsOfLine(String stratum, String sourceName, int lineNumber) = " + xx.locationsOfLine("stratum", "sourceName", 89));
-      pp("availableStrata() = " + xx.availableStrata());
-      pp("defaultStratum() = " + xx.defaultStratum());
-      pp("equals(Object obj) = " + xx.equals(xx));
-      pp("hashCode() = " + xx.hashCode());
-  }
-
-}
-
-//         try {
-//             ReferenceType rr = (ReferenceType)xx;
-//             pp("ReferenceType fields");
-
-//             try {
-//                 ArrayType ff = (ArrayType)xx;
-//                 pp("ArrayType fields");
-
-//             } catch(ClassCastException ee) {
-//             }
-
-//             try {
-//                 ClassType ff = (ClassType)xx;
-//                 pp("ClassType fields");
-
-//             } catch(ClassCastException ee) {
-//             }
-
-//             try {
-//                 InterfaceType ff = (InterfaceType)xx;
-//                 pp("InterfaceType fields");
-
-//             } catch(ClassCastException ee) {
-//             }
-
-//         } catch(ClassCastException ee) {
-//         }
diff --git a/hotspot/src/jdk.hotspot.agent/test/jdi/sagtarg.java b/hotspot/src/jdk.hotspot.agent/test/jdi/sagtarg.java
deleted file mode 100644
index 6e7c2c0..0000000
--- a/hotspot/src/jdk.hotspot.agent/test/jdi/sagtarg.java
+++ /dev/null
@@ -1,57 +0,0 @@
-/*
- * Copyright (c) 2002, 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.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- *
- */
-
-// This is the target debuggee for sagtest.java.
-// It just waits which lets the test call all the JDI
-// methods on it.
-
-import java.util.List;
-
-interface MyInterface {
-    public void myMethod();
-}
-
-
-abstract class MySuper implements MyInterface {
-}
-
-class sagtarg extends MySuper {
-    public static void main(String[] args){
-        String stringVar = "localVar1";
-        int    intVar = 89;
-        List<String> genVar = null;
-        System.out.println("Howdy!");
-        String myStr = "";
-        synchronized(myStr) {
-            try {
-                myStr.wait();
-            } catch (InterruptedException ee) {
-            }
-        }
-        System.out.println("Goodbye from sagtarg!");
-    }
-
-    public void myMethod() {
-    }
-}
diff --git a/hotspot/src/jdk.hotspot.agent/test/jdi/sagtest.java b/hotspot/src/jdk.hotspot.agent/test/jdi/sagtest.java
deleted file mode 100644
index 09327a3..0000000
--- a/hotspot/src/jdk.hotspot.agent/test/jdi/sagtest.java
+++ /dev/null
@@ -1,89 +0,0 @@
-/*
- * Copyright (c) 2002, 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.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- *
- */
-
-/**
- *  @test *  @bug 0000000
- *  @summary This is just an exercise of various JDI elements for use in
- *           testing the SA/JDI client
- *
- *  @author jjh
- *
- *  @run build TestScaffold VMConnection TargetListener TargetAdapter sagdoit
- *  @run compile -g -source 1.5 sagtarg.java
- *  @run main sagtest
- */
-import com.sun.jdi.*;
-import com.sun.jdi.event.*;
-import com.sun.jdi.request.*;
-
-import java.util.*;
-
-    /********** target program **********/
-
-// The target program is sagtarg.java
-
-    /********** test program **********/
-
-public class sagtest extends TestScaffold {
-    ReferenceType targetClass;
-    ThreadReference mainThread;
-
-    sagtest (String args[]) {
-        super(args);
-    }
-
-    public static void main(String[] args)      throws Exception {
-        new sagtest(args).startTests();
-    }
-
-    /********** event handlers **********/
-
-
-    /********** test core **********/
-
-    protected void runTests() throws Exception {
-        /*
-         * Get to the top of main()
-         * to determine targetClass and mainThread
-         */
-        BreakpointEvent bpe = startToMain("sagtarg");
-        targetClass = bpe.location().declaringType();
-        mainThread = bpe.thread();
-        EventRequestManager erm = vm().eventRequestManager();
-        stepOverLine(mainThread);  //stop on 18
-        stepOverLine(mainThread);  //stop on 19
-        stepOverLine(mainThread);  //stop on 20
-        stepOverLine(mainThread);  //stop on 21
-        stepOverLine(mainThread);  //stop on 22
-
-        sagdoit mine = new sagdoit(vm());
-        mine.doAll();
-
-        if (!testFailed) {
-            println("sagtest: passed");
-        } else {
-            throw new Exception("sagtest: failed");
-        }
-    }
-}
diff --git a/hotspot/src/jdk.hotspot.agent/test/jdi/sasanity.sh b/hotspot/src/jdk.hotspot.agent/test/jdi/sasanity.sh
deleted file mode 100644
index 0e15552..0000000
--- a/hotspot/src/jdk.hotspot.agent/test/jdi/sasanity.sh
+++ /dev/null
@@ -1,76 +0,0 @@
-#!/bin/ksh
-#
-# Copyright (c) 2003, 2012, Oracle and/or its affiliates. All rights reserved.
-# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
-#
-# This code is free software; you can redistribute it and/or modify it
-# under the terms of the GNU General Public License version 2 only, as
-# published by the Free Software Foundation.
-#
-# This code is distributed in the hope that it will be useful, but WITHOUT
-# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
-# FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
-# version 2 for more details (a copy is included in the LICENSE file that
-# accompanied this code).
-#
-# You should have received a copy of the GNU General Public License version
-# 2 along with this work; if not, write to the Free Software Foundation,
-# Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
-#
-# Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
-# or visit www.oracle.com if you need additional information or have any
-# questions.
-#  
-#
-
-# This script is used to run sanity check on vmStructs.
-# Each SA class is checked against a given VM. "PASSED" is 
-# printed if vmStructs are consistent. Else, "FAILED" is
-# printed and an exception stack trace follows.
-
-usage() {
-    echo "usage: ./sasanity.sh <jdk>"
-    echo "<jdk> is the 1.5 j2se directory against which you want to run sanity check"
-    exit 1   
-}
-
-if [ "$1" == "" ]; then
-    usage
-fi
-
-if [ "$1" == "-help" ]; then
-    usage
-fi
-
-jdk=$1
-shift
-OS=`uname`
-
-javacp=$jdk/lib/sa-jdi.jar:./workdir
-
-mkdir -p workdir
-if [ SASanityChecker.java -nt ./workdir/SASanityChecker.class ] ; then
-    $jdk/bin/javac -d ./workdir -classpath $javacp SASanityChecker.java
-    if [ $? != 0 ] ; then
-        exit 1
-    fi
-fi
-
-if [ sagtarg.java -nt ./workdir/sagtarg.class ]; then
-    $jdk/bin/javac -g  -classpath -d $workdir sagtarg.java
-    if [ $? != 0 ] ; then
-        exit 1
-    fi
-fi
-
-tmp=/tmp/sagsetup
-rm -f $tmp
-$jdk/bin/java $* sagtarg > $tmp &
-pid=$!
-while [ ! -s $tmp ] ; do
-  # Kludge alert!
-  sleep 2
-done
-
-$jdk/bin/java -showversion ${OPTIONS} -classpath $javacp $* SASanityChecker $pid
-kill -9 $pid
diff --git a/hotspot/src/jdk.hotspot.agent/test/jdi/serialvm.java b/hotspot/src/jdk.hotspot.agent/test/jdi/serialvm.java
deleted file mode 100644
index 7cee578..0000000
--- a/hotspot/src/jdk.hotspot.agent/test/jdi/serialvm.java
+++ /dev/null
@@ -1,137 +0,0 @@
-/*
- * Copyright (c) 2003, 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.
- *
- */
-
-import com.sun.jdi.*;
-import com.sun.jdi.connect.*;
-
-import java.util.Map;
-import java.util.List;
-import java.util.Iterator;
-import java.io.IOException;
-
-
-/* This class is used to test multi VM connectivity feature of
- * SA/JDI. Accepts two PIDs as arguments. Connects to first VM
- *, disposes it, connects to second VM, disposes second VM.
- */
-
-
-public class serialvm {
-    static AttachingConnector myPIDConn;
-    static VirtualMachine vm1;
-    static VirtualMachine vm2;
-    static VirtualMachineManager vmmgr;
-
-    public static void println(String msg) {
-        System.out.println(msg);
-    }
-
-    private static void usage() {
-        System.err.println("Usage: java serialvm <pid1> <pid2>");
-        System.exit(1);
-    }
-
-    public static void main(String args[]) {
-        vmmgr = Bootstrap.virtualMachineManager();
-        List attachingConnectors = vmmgr.attachingConnectors();
-        if (attachingConnectors.isEmpty()) {
-            System.err.println( "ERROR: No attaching connectors");
-            return;
-        }
-        Iterator myIt = attachingConnectors.iterator();
-        while (myIt.hasNext()) {
-            AttachingConnector tmpCon = (AttachingConnector)myIt.next();
-            if (tmpCon.name().equals(
-                "sun.jvm.hotspot.jdi.SAPIDAttachingConnector")) {
-                myPIDConn = tmpCon;
-                break;
-            }
-        }
-
-        int pid1 = 0, pid2 = 0;
-        String pidText = null;
-        switch (args.length) {
-        case (2):
-            try {
-                pidText = args[0];
-                pid1 = Integer.parseInt(pidText);
-                System.out.println( "pid1: " + pid1);
-                pidText = args[1];
-                pid2 = Integer.parseInt(pidText);
-                System.out.println( "pid2: " + pid2);
-            } catch (NumberFormatException e) {
-                println(e.getMessage());
-                usage();
-            }
-            break;
-        default:
-            usage();
-        }
-
-        // attach, dispose, attach2, dispose2 pattern
-        // as opposed to attach1, attach2, dispose1, dispose2
-        vm1 = attachPID(pid1);
-        if (vm1 != null) {
-            System.out.println("vm1: attached ok!");
-            System.out.println(vm1.version());
-            sagdoit mine = new sagdoit(vm1);
-            mine.doAll();
-        }
-        if (vm1 != null) {
-            vm1.dispose();
-        }
-
-        vm2 = attachPID(pid2);
-        if (vm2 != null) {
-            System.out.println("vm2: attached ok!");
-            System.out.println(vm2.version());
-            sagdoit mine = new sagdoit(vm2);
-            mine.doAll();
-        }
-
-
-        if (vm2 != null) {
-            vm2.dispose();
-        }
-    }
-
-   private static VirtualMachine attachPID(int pid) {
-        Map connArgs = myPIDConn.defaultArguments();
-        System.out.println("connArgs = " + connArgs);
-        VirtualMachine vm;
-        Connector.StringArgument connArg = (Connector.StringArgument)connArgs.get("pid");
-        connArg.setValue(Integer.toString(pid));
-
-        try {
-            vm = myPIDConn.attach(connArgs);
-        } catch (IOException ee) {
-            System.err.println("ERROR: myPIDConn.attach got IO Exception:" + ee);
-            vm = null;
-        } catch (IllegalConnectorArgumentsException ee) {
-            System.err.println("ERROR: myPIDConn.attach got illegal args exception:" + ee);
-            vm = null;
-        }
-        return vm;
-   }
-}
diff --git a/hotspot/src/jdk.hotspot.agent/test/jdi/serialvm.sh b/hotspot/src/jdk.hotspot.agent/test/jdi/serialvm.sh
deleted file mode 100644
index e2839ae..0000000
--- a/hotspot/src/jdk.hotspot.agent/test/jdi/serialvm.sh
+++ /dev/null
@@ -1,58 +0,0 @@
-#!/bin/ksh
-#
-# Copyright (c) 2003, 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.
-#  
-#
-
-doUsage()
-{
-    cat <<EOF
-    Run serialvm.class using Serviceability Agent to talk to 2 pids one
-    after another in serial fashion.
-    Usage:  serialvm.sh <jdk-pathname> <pid1> <pid2>
-
-EOF
-}
-
-if [ $# = 4 ] ; then
-    doUsage
-    exit 1
-fi
-
-jdk=$1
-javacp="$jdk/lib/sa-jdi.jar:$classesDir:$jdk/lib/tools.jar:$jdk/classes:./workdir"
-
-mkdir -p workdir
-if [ sagdoit.java -nt ./workdir/sagdoit.class ] ; then
-    $jdk/bin/javac -d ./workdir -classpath $javacp sagdoit.java
-    if [ $? != 0 ] ; then
-        exit 1
-    fi
-fi
-if [ serialvm.java -nt ./workdir/serialvm.class ] ; then
-    $jdk/bin/javac -d ./workdir -classpath $javacp serialvm.java
-    if [ $? != 0 ] ; then
-        exit 1
-    fi
-fi
-
-$jdk/bin/java -Dsun.jvm.hotspot.jdi.ConnectorImpl.DEBUG -Dsun.jvm.hotspot.jdi.SAJDIClassLoader.DEBUG -Djava.class.path=$javacp serialvm $2 $3
diff --git a/hotspot/src/jdk.vm.ci/share/classes/jdk.vm.ci.hotspot.amd64/src/jdk/vm/ci/hotspot/amd64/AMD64HotSpotRegisterConfig.java b/hotspot/src/jdk.vm.ci/share/classes/jdk.vm.ci.hotspot.amd64/src/jdk/vm/ci/hotspot/amd64/AMD64HotSpotRegisterConfig.java
index 7f3eb35..705f0b9 100644
--- a/hotspot/src/jdk.vm.ci/share/classes/jdk.vm.ci.hotspot.amd64/src/jdk/vm/ci/hotspot/amd64/AMD64HotSpotRegisterConfig.java
+++ b/hotspot/src/jdk.vm.ci/share/classes/jdk.vm.ci.hotspot.amd64/src/jdk/vm/ci/hotspot/amd64/AMD64HotSpotRegisterConfig.java
@@ -105,7 +105,9 @@
 
     private final RegisterArray javaGeneralParameterRegisters;
     private final RegisterArray nativeGeneralParameterRegisters;
-    private final RegisterArray xmmParameterRegisters = new RegisterArray(xmm0, xmm1, xmm2, xmm3, xmm4, xmm5, xmm6, xmm7);
+    private final RegisterArray javaXMMParameterRegisters;
+    private final RegisterArray nativeXMMParameterRegisters;
+    private final boolean windowsOS;
 
     /*
      * Some ABIs (e.g. Windows) require a so-called "home space", that is a save area on the stack
@@ -143,23 +145,27 @@
         assert callerSaved.size() >= allocatable.size();
     }
 
-    public AMD64HotSpotRegisterConfig(TargetDescription target, RegisterArray allocatable, boolean windowsOs) {
+    public AMD64HotSpotRegisterConfig(TargetDescription target, RegisterArray allocatable, boolean windowsOS) {
         this.target = target;
+        this.windowsOS = windowsOS;
 
-        if (windowsOs) {
+        if (windowsOS) {
             javaGeneralParameterRegisters = new RegisterArray(rdx, r8, r9, rdi, rsi, rcx);
             nativeGeneralParameterRegisters = new RegisterArray(rcx, rdx, r8, r9);
+            nativeXMMParameterRegisters = new RegisterArray(xmm0, xmm1, xmm2, xmm3);
             this.needsNativeStackHomeSpace = true;
         } else {
             javaGeneralParameterRegisters = new RegisterArray(rsi, rdx, rcx, r8, r9, rdi);
             nativeGeneralParameterRegisters = new RegisterArray(rdi, rsi, rdx, rcx, r8, r9);
+            nativeXMMParameterRegisters = new RegisterArray(xmm0, xmm1, xmm2, xmm3, xmm4, xmm5, xmm6, xmm7);
             this.needsNativeStackHomeSpace = false;
         }
+        javaXMMParameterRegisters = new RegisterArray(xmm0, xmm1, xmm2, xmm3, xmm4, xmm5, xmm6, xmm7);
 
         this.allocatable = allocatable;
         Set<Register> callerSaveSet = new HashSet<>();
         allocatable.addTo(callerSaveSet);
-        xmmParameterRegisters.addTo(callerSaveSet);
+        javaXMMParameterRegisters.addTo(callerSaveSet);
         callerSaveSet.addAll(javaGeneralParameterRegisters.asList());
         nativeGeneralParameterRegisters.addTo(callerSaveSet);
         callerSaved = new RegisterArray(callerSaveSet);
@@ -187,11 +193,11 @@
     public CallingConvention getCallingConvention(Type type, JavaType returnType, JavaType[] parameterTypes, ValueKindFactory<?> valueKindFactory) {
         HotSpotCallingConventionType hotspotType = (HotSpotCallingConventionType) type;
         if (type == HotSpotCallingConventionType.NativeCall) {
-            return callingConvention(nativeGeneralParameterRegisters, returnType, parameterTypes, hotspotType, valueKindFactory);
+            return callingConvention(nativeGeneralParameterRegisters, nativeXMMParameterRegisters, windowsOS, returnType, parameterTypes, hotspotType, valueKindFactory);
         }
         // On x64, parameter locations are the same whether viewed
         // from the caller or callee perspective
-        return callingConvention(javaGeneralParameterRegisters, returnType, parameterTypes, hotspotType, valueKindFactory);
+        return callingConvention(javaGeneralParameterRegisters, javaXMMParameterRegisters, false, returnType, parameterTypes, hotspotType, valueKindFactory);
     }
 
     @Override
@@ -208,14 +214,33 @@
                 return hotspotType == HotSpotCallingConventionType.NativeCall ? nativeGeneralParameterRegisters : javaGeneralParameterRegisters;
             case Float:
             case Double:
-                return xmmParameterRegisters;
+                return hotspotType == HotSpotCallingConventionType.NativeCall ? nativeXMMParameterRegisters : javaXMMParameterRegisters;
             default:
                 throw JVMCIError.shouldNotReachHere();
         }
     }
 
-    private CallingConvention callingConvention(RegisterArray generalParameterRegisters, JavaType returnType, JavaType[] parameterTypes, HotSpotCallingConventionType type,
+    /**
+     * Hand out registers matching the calling convention from the {@code generalParameterRegisters}
+     * and {@code xmmParameterRegisters} sets. Normally registers are handed out from each set
+     * individually based on the type of the argument. If the {@code unified} flag is true then hand
+     * out registers in a single sequence, selecting between the sets based on the type. This is to
+     * support the Windows calling convention which only ever passes 4 arguments in registers, no
+     * matter their types.
+     *
+     * @param generalParameterRegisters
+     * @param xmmParameterRegisters
+     * @param unified
+     * @param returnType
+     * @param parameterTypes
+     * @param type
+     * @param valueKindFactory
+     * @return the resulting calling convention
+     */
+    private CallingConvention callingConvention(RegisterArray generalParameterRegisters, RegisterArray xmmParameterRegisters, boolean unified, JavaType returnType, JavaType[] parameterTypes,
+                    HotSpotCallingConventionType type,
                     ValueKindFactory<?> valueKindFactory) {
+        assert !unified || generalParameterRegisters.size() == xmmParameterRegisters.size() : "must be same size in unified mode";
         AllocatableValue[] locations = new AllocatableValue[parameterTypes.length];
 
         int currentGeneral = 0;
@@ -240,8 +265,8 @@
                     break;
                 case Float:
                 case Double:
-                    if (currentXMM < xmmParameterRegisters.size()) {
-                        Register register = xmmParameterRegisters.get(currentXMM++);
+                    if ((unified ? currentGeneral : currentXMM) < xmmParameterRegisters.size()) {
+                        Register register = xmmParameterRegisters.get(unified ? currentGeneral++ : currentXMM++);
                         locations[i] = register.asValue(valueKindFactory.getValueKind(kind));
                     }
                     break;
@@ -255,6 +280,7 @@
                 currentStackOffset += Math.max(valueKind.getPlatformKind().getSizeInBytes(), target.wordSize);
             }
         }
+        assert !unified || currentXMM == 0 : "shouldn't be used in unified mode";
 
         JavaKind returnKind = returnType == null ? JavaKind.Void : returnType.getJavaKind();
         AllocatableValue returnLocation = returnKind == JavaKind.Void ? Value.ILLEGAL : getReturnRegister(returnKind).asValue(valueKindFactory.getValueKind(returnKind.getStackKind()));
diff --git a/hotspot/src/jdk.vm.ci/share/classes/jdk.vm.ci.hotspot.sparc/src/jdk/vm/ci/hotspot/sparc/SPARCHotSpotRegisterConfig.java b/hotspot/src/jdk.vm.ci/share/classes/jdk.vm.ci.hotspot.sparc/src/jdk/vm/ci/hotspot/sparc/SPARCHotSpotRegisterConfig.java
index bb25c61..3b07a90 100644
--- a/hotspot/src/jdk.vm.ci/share/classes/jdk.vm.ci.hotspot.sparc/src/jdk/vm/ci/hotspot/sparc/SPARCHotSpotRegisterConfig.java
+++ b/hotspot/src/jdk.vm.ci/share/classes/jdk.vm.ci.hotspot.sparc/src/jdk/vm/ci/hotspot/sparc/SPARCHotSpotRegisterConfig.java
@@ -26,17 +26,41 @@
 import static jdk.vm.ci.meta.Value.ILLEGAL;
 import static jdk.vm.ci.sparc.SPARC.REGISTER_SAFE_AREA_SIZE;
 import static jdk.vm.ci.sparc.SPARC.d0;
+import static jdk.vm.ci.sparc.SPARC.d10;
+import static jdk.vm.ci.sparc.SPARC.d12;
+import static jdk.vm.ci.sparc.SPARC.d14;
+import static jdk.vm.ci.sparc.SPARC.d16;
+import static jdk.vm.ci.sparc.SPARC.d18;
 import static jdk.vm.ci.sparc.SPARC.d2;
+import static jdk.vm.ci.sparc.SPARC.d20;
+import static jdk.vm.ci.sparc.SPARC.d22;
+import static jdk.vm.ci.sparc.SPARC.d24;
+import static jdk.vm.ci.sparc.SPARC.d26;
+import static jdk.vm.ci.sparc.SPARC.d28;
+import static jdk.vm.ci.sparc.SPARC.d30;
 import static jdk.vm.ci.sparc.SPARC.d4;
 import static jdk.vm.ci.sparc.SPARC.d6;
+import static jdk.vm.ci.sparc.SPARC.d8;
 import static jdk.vm.ci.sparc.SPARC.f0;
 import static jdk.vm.ci.sparc.SPARC.f1;
+import static jdk.vm.ci.sparc.SPARC.f11;
+import static jdk.vm.ci.sparc.SPARC.f13;
+import static jdk.vm.ci.sparc.SPARC.f15;
+import static jdk.vm.ci.sparc.SPARC.f17;
+import static jdk.vm.ci.sparc.SPARC.f19;
 import static jdk.vm.ci.sparc.SPARC.f2;
+import static jdk.vm.ci.sparc.SPARC.f21;
+import static jdk.vm.ci.sparc.SPARC.f23;
+import static jdk.vm.ci.sparc.SPARC.f25;
+import static jdk.vm.ci.sparc.SPARC.f27;
+import static jdk.vm.ci.sparc.SPARC.f29;
 import static jdk.vm.ci.sparc.SPARC.f3;
+import static jdk.vm.ci.sparc.SPARC.f31;
 import static jdk.vm.ci.sparc.SPARC.f4;
 import static jdk.vm.ci.sparc.SPARC.f5;
 import static jdk.vm.ci.sparc.SPARC.f6;
 import static jdk.vm.ci.sparc.SPARC.f7;
+import static jdk.vm.ci.sparc.SPARC.f9;
 import static jdk.vm.ci.sparc.SPARC.g0;
 import static jdk.vm.ci.sparc.SPARC.g2;
 import static jdk.vm.ci.sparc.SPARC.g6;
@@ -95,11 +119,6 @@
 
     private final RegisterAttributes[] attributesMap;
 
-    /**
-     * Does native code (C++ code) spill arguments in registers to the parent frame?
-     */
-    private final boolean addNativeRegisterArgumentSlots;
-
     @Override
     public RegisterArray getAllocatableRegisters() {
         return allocatable;
@@ -124,10 +143,18 @@
     private final RegisterArray cpuCallerParameterRegisters = new RegisterArray(o0, o1, o2, o3, o4, o5);
     private final RegisterArray cpuCalleeParameterRegisters = new RegisterArray(i0, i1, i2, i3, i4, i5);
 
-    private final RegisterArray fpuFloatParameterRegisters = new RegisterArray(f0, f1, f2, f3, f4, f5, f6, f7);
-    private final RegisterArray fpuDoubleParameterRegisters = new RegisterArray(d0, null, d2, null, d4, null, d6, null);
+    private final RegisterArray fpuFloatJavaParameterRegisters = new RegisterArray(f0, f1, f2, f3, f4, f5, f6, f7);
+    private final RegisterArray fpuDoubleJavaParameterRegisters = new RegisterArray(d0, null, d2, null, d4, null, d6, null);
 
     // @formatter:off
+    private final RegisterArray fpuFloatNativeParameterRegisters = new RegisterArray(
+                    f1,   f3,  f5,  f7,  f9, f11, f13, f15,
+                    f17, f19, f21, f23, f25, f27, f29, f31);
+
+    private final RegisterArray fpuDoubleNativeParameterRegisters = new RegisterArray(
+                     d0,  d2,  d4,  d6,  d8, d10, d12, d14,
+                    d16, d18, d20, d22, d24, d26, d28, d30);
+
     private final RegisterArray callerSaveRegisters;
 
     /**
@@ -170,7 +197,6 @@
     public SPARCHotSpotRegisterConfig(TargetDescription target, RegisterArray allocatable) {
         this.target = target;
         this.allocatable = allocatable;
-        this.addNativeRegisterArgumentSlots = false;
         HashSet<Register> callerSaveSet = new HashSet<>(target.arch.getAvailableValueRegisters().asList());
         for (Register cs : windowSaveRegisters) {
             callerSaveSet.remove(cs);
@@ -220,7 +246,7 @@
                 return hotspotType == HotSpotCallingConventionType.JavaCallee ? cpuCalleeParameterRegisters : cpuCallerParameterRegisters;
             case Double:
             case Float:
-                return fpuFloatParameterRegisters;
+                return fpuFloatJavaParameterRegisters;
             default:
                 throw JVMCIError.shouldNotReachHere("Unknown JavaKind " + kind);
         }
@@ -233,48 +259,77 @@
         int currentGeneral = 0;
         int currentFloating = 0;
         int currentStackOffset = 0;
+        boolean isNative = type == HotSpotCallingConventionType.NativeCall;
 
         for (int i = 0; i < parameterTypes.length; i++) {
             final JavaKind kind = parameterTypes[i].getJavaKind().getStackKind();
-
-            switch (kind) {
-                case Byte:
-                case Boolean:
-                case Short:
-                case Char:
-                case Int:
-                case Long:
-                case Object:
-                    if (currentGeneral < generalParameterRegisters.size()) {
-                        Register register = generalParameterRegisters.get(currentGeneral++);
-                        locations[i] = register.asValue(valueKindFactory.getValueKind(kind));
-                    }
-                    break;
-                case Double:
-                    if (currentFloating < fpuFloatParameterRegisters.size()) {
-                        if (currentFloating % 2 != 0) {
-                            // Make register number even to be a double reg
-                            currentFloating++;
+            if (isNative) {
+                RegisterArray registerSet;
+                switch (kind) {
+                    case Byte:
+                    case Boolean:
+                    case Short:
+                    case Char:
+                    case Int:
+                    case Long:
+                    case Object:
+                        registerSet = generalParameterRegisters;
+                        break;
+                    case Double:
+                        registerSet = fpuDoubleNativeParameterRegisters;
+                        break;
+                    case Float:
+                        registerSet = fpuFloatNativeParameterRegisters;
+                        break;
+                    default:
+                        throw JVMCIError.shouldNotReachHere();
+                }
+                if (i < registerSet.size()) {
+                    locations[i] = registerSet.get(i).asValue(valueKindFactory.getValueKind(kind));
+                    currentStackOffset += target.arch.getWordSize();
+                }
+            } else {
+                switch (kind) {
+                    case Byte:
+                    case Boolean:
+                    case Short:
+                    case Char:
+                    case Int:
+                    case Long:
+                    case Object:
+                        if (currentGeneral < generalParameterRegisters.size()) {
+                            Register register = generalParameterRegisters.get(currentGeneral++);
+                            locations[i] = register.asValue(valueKindFactory.getValueKind(kind));
                         }
-                        Register register = fpuDoubleParameterRegisters.get(currentFloating);
-                        currentFloating += 2; // Only every second is a double register
-                        locations[i] = register.asValue(valueKindFactory.getValueKind(kind));
-                    }
-                    break;
-                case Float:
-                    if (currentFloating < fpuFloatParameterRegisters.size()) {
-                        Register register = fpuFloatParameterRegisters.get(currentFloating++);
-                        locations[i] = register.asValue(valueKindFactory.getValueKind(kind));
-                    }
-                    break;
-                default:
-                    throw JVMCIError.shouldNotReachHere();
+                        break;
+                    case Double:
+                        if (currentFloating < fpuFloatJavaParameterRegisters.size()) {
+                            if (currentFloating % 2 != 0) {
+                                // Make register number even to be a double reg
+                                currentFloating++;
+                            }
+                            Register register = fpuDoubleJavaParameterRegisters.get(currentFloating);
+                            currentFloating += 2; // Only every second is a double register
+                            locations[i] = register.asValue(valueKindFactory.getValueKind(kind));
+                        }
+                        break;
+                    case Float:
+                        if (currentFloating < fpuFloatJavaParameterRegisters.size()) {
+                            Register register = fpuFloatJavaParameterRegisters.get(currentFloating++);
+                            locations[i] = register.asValue(valueKindFactory.getValueKind(kind));
+                        }
+                        break;
+                    default:
+                        throw JVMCIError.shouldNotReachHere();
+                }
             }
 
             if (locations[i] == null) {
                 ValueKind<?> valueKind = valueKindFactory.getValueKind(kind);
-                // Stack slot is always aligned to its size in bytes but minimum wordsize
                 int typeSize = valueKind.getPlatformKind().getSizeInBytes();
+                if (isNative) {
+                    currentStackOffset += target.arch.getWordSize() - typeSize;
+                }
                 currentStackOffset = roundUp(currentStackOffset, typeSize);
                 int slotOffset = currentStackOffset + REGISTER_SAFE_AREA_SIZE;
                 locations[i] = StackSlot.get(valueKind, slotOffset, !type.out);
@@ -284,15 +339,7 @@
 
         JavaKind returnKind = returnType == null ? Void : returnType.getJavaKind();
         AllocatableValue returnLocation = returnKind == Void ? ILLEGAL : getReturnRegister(returnKind, type).asValue(valueKindFactory.getValueKind(returnKind.getStackKind()));
-
-        int outArgSpillArea;
-        if (type == HotSpotCallingConventionType.NativeCall && addNativeRegisterArgumentSlots) {
-            // Space for native callee which may spill our outgoing arguments
-            outArgSpillArea = Math.min(locations.length, generalParameterRegisters.size()) * target.wordSize;
-        } else {
-            outArgSpillArea = 0;
-        }
-        return new CallingConvention(currentStackOffset + outArgSpillArea, returnLocation, locations);
+        return new CallingConvention(currentStackOffset, returnLocation, locations);
     }
 
     private static int roundUp(int number, int mod) {
diff --git a/hotspot/src/jdk.vm.ci/share/classes/jdk.vm.ci.hotspot/src/jdk/vm/ci/hotspot/HotSpotJVMCICompilerConfig.java b/hotspot/src/jdk.vm.ci/share/classes/jdk.vm.ci.hotspot/src/jdk/vm/ci/hotspot/HotSpotJVMCICompilerConfig.java
index 672cf0b..89e2ae2 100644
--- a/hotspot/src/jdk.vm.ci/share/classes/jdk.vm.ci.hotspot/src/jdk/vm/ci/hotspot/HotSpotJVMCICompilerConfig.java
+++ b/hotspot/src/jdk.vm.ci/share/classes/jdk.vm.ci.hotspot/src/jdk/vm/ci/hotspot/HotSpotJVMCICompilerConfig.java
@@ -32,6 +32,11 @@
 
 final class HotSpotJVMCICompilerConfig {
 
+    /**
+     * This factory allows JVMCI initialization to succeed but raises an error if the VM asks JVMCI
+     * to perform a compilation. This allows the reflective parts of the JVMCI API to be used
+     * without requiring a compiler implementation to be available.
+     */
     private static class DummyCompilerFactory extends JVMCICompilerFactory implements JVMCICompiler {
 
         public HotSpotCompilationRequestResult compileMethod(CompilationRequest request) {
@@ -67,7 +72,6 @@
                 for (JVMCICompilerFactory f : Services.load(JVMCICompilerFactory.class)) {
                     if (f.getCompilerName().equals(compilerName)) {
                         Services.exportJVMCITo(f.getClass());
-                        f.onSelection();
                         factory = f;
                     }
                 }
@@ -75,8 +79,21 @@
                     throw new JVMCIError("JVMCI compiler '%s' not found", compilerName);
                 }
             } else {
-                factory = new DummyCompilerFactory();
+                // Auto select a single available compiler
+                for (JVMCICompilerFactory f : Services.load(JVMCICompilerFactory.class)) {
+                    if (factory == null) {
+                        factory = f;
+                    } else {
+                        // Multiple factories seen - cancel auto selection
+                        factory = null;
+                        break;
+                    }
+                }
+                if (factory == null) {
+                    factory = new DummyCompilerFactory();
+                }
             }
+            factory.onSelection();
             compilerFactory = factory;
         }
         return compilerFactory;
diff --git a/hotspot/src/jdk.vm.ci/share/classes/jdk.vm.ci.hotspot/src/jdk/vm/ci/hotspot/HotSpotMemoryAccessProviderImpl.java b/hotspot/src/jdk.vm.ci/share/classes/jdk.vm.ci.hotspot/src/jdk/vm/ci/hotspot/HotSpotMemoryAccessProviderImpl.java
index 6bdf2ee..be8e3a3 100644
--- a/hotspot/src/jdk.vm.ci/share/classes/jdk.vm.ci.hotspot/src/jdk/vm/ci/hotspot/HotSpotMemoryAccessProviderImpl.java
+++ b/hotspot/src/jdk.vm.ci/share/classes/jdk.vm.ci.hotspot/src/jdk/vm/ci/hotspot/HotSpotMemoryAccessProviderImpl.java
@@ -109,13 +109,7 @@
         }
     }
 
-    private boolean verifyReadRawObject(Object expected, Constant base, long displacement, boolean compressed) {
-        if (compressed == runtime.getConfig().useCompressedOops) {
-            Object obj = asObject(base);
-            if (obj != null) {
-                assert expected == UNSAFE.getObject(obj, displacement) : "readUnsafeOop doesn't agree with unsafe.getObject";
-            }
-        }
+    private boolean verifyReadRawObject(Object expected, Constant base, long displacement) {
         if (base instanceof HotSpotMetaspaceConstant) {
             MetaspaceWrapperObject metaspaceObject = HotSpotMetaspaceConstantImpl.getMetaspaceObject(base);
             if (metaspaceObject instanceof HotSpotResolvedObjectTypeImpl) {
@@ -136,11 +130,11 @@
             assert !compressed;
             displacement += asRawPointer(baseConstant);
             ret = UNSAFE.getUncompressedObject(displacement);
+            assert verifyReadRawObject(ret, baseConstant, initialDisplacement);
         } else {
             assert runtime.getConfig().useCompressedOops == compressed;
             ret = UNSAFE.getObject(base, displacement);
         }
-        assert verifyReadRawObject(ret, baseConstant, initialDisplacement, compressed);
         return ret;
     }
 
diff --git a/hotspot/src/jdk.vm.ci/share/classes/jdk.vm.ci.hotspot/src/jdk/vm/ci/hotspot/HotSpotMethodHandleAccessProvider.java b/hotspot/src/jdk.vm.ci/share/classes/jdk.vm.ci.hotspot/src/jdk/vm/ci/hotspot/HotSpotMethodHandleAccessProvider.java
index 821f3da..c4eab6c 100644
--- a/hotspot/src/jdk.vm.ci/share/classes/jdk.vm.ci.hotspot/src/jdk/vm/ci/hotspot/HotSpotMethodHandleAccessProvider.java
+++ b/hotspot/src/jdk.vm.ci/share/classes/jdk.vm.ci.hotspot/src/jdk/vm/ci/hotspot/HotSpotMethodHandleAccessProvider.java
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2014, 2014, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2014, 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
@@ -28,10 +28,12 @@
 import jdk.vm.ci.common.JVMCIError;
 import jdk.vm.ci.meta.ConstantReflectionProvider;
 import jdk.vm.ci.meta.JavaConstant;
+import jdk.vm.ci.meta.JavaKind;
 import jdk.vm.ci.meta.MethodHandleAccessProvider;
 import jdk.vm.ci.meta.ResolvedJavaField;
 import jdk.vm.ci.meta.ResolvedJavaMethod;
 import jdk.vm.ci.meta.ResolvedJavaType;
+import jdk.vm.ci.meta.Signature;
 
 public class HotSpotMethodHandleAccessProvider implements MethodHandleAccessProvider {
 
@@ -51,46 +53,80 @@
         static final ResolvedJavaMethod lambdaFormCompileToBytecodeMethod;
         static final HotSpotResolvedJavaField memberNameVmtargetField;
 
+        static final ResolvedJavaType CLASS = fromObjectClass(LazyInitialization.class);
+
         /**
          * Search for an instance field with the given name in a class.
          *
          * @param className name of the class to search in
          * @param fieldName name of the field to be searched
-         * @return resolved java field
+         * @param fieldType resolved Java type of the field
+         * @return resolved Java field
          * @throws ClassNotFoundException
+         * @throws NoSuchFieldError
          */
-        private static ResolvedJavaField findFieldInClass(String className, String fieldName) throws ClassNotFoundException {
+        private static ResolvedJavaField findFieldInClass(String className, String fieldName, ResolvedJavaType fieldType)
+                throws ClassNotFoundException {
             Class<?> clazz = Class.forName(className);
             ResolvedJavaType type = runtime().fromClass(clazz);
             ResolvedJavaField[] fields = type.getInstanceFields(false);
             for (ResolvedJavaField field : fields) {
-                if (field.getName().equals(fieldName)) {
+                if (field.getName().equals(fieldName) && field.getType().equals(fieldType)) {
                     return field;
                 }
             }
-            return null;
+            throw new NoSuchFieldError(fieldType.getName() + " " + className + "." + fieldName);
         }
 
-        private static ResolvedJavaMethod findMethodInClass(String className, String methodName) throws ClassNotFoundException {
+        private static ResolvedJavaMethod findMethodInClass(String className, String methodName,
+                ResolvedJavaType resultType, ResolvedJavaType[] parameterTypes) throws ClassNotFoundException {
             Class<?> clazz = Class.forName(className);
             HotSpotResolvedObjectTypeImpl type = fromObjectClass(clazz);
             ResolvedJavaMethod result = null;
             for (ResolvedJavaMethod method : type.getDeclaredMethods()) {
-                if (method.getName().equals(methodName)) {
-                    assert result == null : "more than one method found: " + className + "." + methodName;
+                if (method.getName().equals(methodName) && signatureMatches(method, resultType, parameterTypes)) {
                     result = method;
                 }
             }
-            assert result != null : "method not found: " + className + "." + methodName;
+            if (result == null) {
+                StringBuilder sig = new StringBuilder("(");
+                for (ResolvedJavaType t : parameterTypes) {
+                    sig.append(t.getName()).append(",");
+                }
+                if (sig.length() > 1) {
+                    sig.replace(sig.length() - 1, sig.length(), ")");
+                } else {
+                    sig.append(')');
+                }
+                throw new NoSuchMethodError(resultType.getName() + " " + className + "." + methodName + sig.toString());
+            }
             return result;
         }
 
+        private static boolean signatureMatches(ResolvedJavaMethod m, ResolvedJavaType resultType,
+                ResolvedJavaType[] parameterTypes) {
+            Signature s = m.getSignature();
+            if (!s.getReturnType(CLASS).equals(resultType)) {
+                return false;
+            }
+            for (int i = 0; i < s.getParameterCount(false); ++i) {
+                if (!s.getParameterType(i, CLASS).equals(parameterTypes[i])) {
+                    return false;
+                }
+            }
+            return true;
+        }
+
         static {
             try {
-                methodHandleFormField = findFieldInClass("java.lang.invoke.MethodHandle", "form");
-                lambdaFormVmentryField = findFieldInClass("java.lang.invoke.LambdaForm", "vmentry");
-                lambdaFormCompileToBytecodeMethod = findMethodInClass("java.lang.invoke.LambdaForm", "compileToBytecode");
-                memberNameVmtargetField = (HotSpotResolvedJavaField) findFieldInClass("java.lang.invoke.MemberName", "vmtarget");
+                methodHandleFormField = findFieldInClass("java.lang.invoke.MethodHandle", "form",
+                    fromObjectClass(Class.forName("java.lang.invoke.LambdaForm")));
+                lambdaFormVmentryField = findFieldInClass("java.lang.invoke.LambdaForm", "vmentry",
+                    fromObjectClass(Class.forName("java.lang.invoke.MemberName")));
+                lambdaFormCompileToBytecodeMethod = findMethodInClass("java.lang.invoke.LambdaForm", "compileToBytecode",
+                    new HotSpotResolvedPrimitiveType(JavaKind.Void), new ResolvedJavaType[]{});
+                memberNameVmtargetField = (HotSpotResolvedJavaField) findFieldInClass("java.lang.invoke.MemberName", "vmtarget",
+                    new HotSpotResolvedPrimitiveType(JavaKind.Long));
             } catch (Throwable ex) {
                 throw new JVMCIError(ex);
             }
@@ -134,14 +170,12 @@
             return null;
         }
 
-        JavaConstant memberName;
         if (forceBytecodeGeneration) {
             /* Invoke non-public method: MemberName LambdaForm.compileToBytecode() */
-            memberName = LazyInitialization.lambdaFormCompileToBytecodeMethod.invoke(lambdaForm, new JavaConstant[0]);
-        } else {
-            /* Load non-public field: MemberName LambdaForm.vmentry */
-            memberName = constantReflection.readFieldValue(LazyInitialization.lambdaFormVmentryField, lambdaForm);
+            LazyInitialization.lambdaFormCompileToBytecodeMethod.invoke(lambdaForm, new JavaConstant[0]);
         }
+        /* Load non-public field: MemberName LambdaForm.vmentry */
+        JavaConstant memberName = constantReflection.readFieldValue(LazyInitialization.lambdaFormVmentryField, lambdaForm);
         return getTargetMethod(memberName);
     }
 
@@ -163,3 +197,4 @@
         return compilerToVM().getResolvedJavaMethod(object, LazyInitialization.memberNameVmtargetField.offset());
     }
 }
+
diff --git a/hotspot/src/jdk.vm.ci/share/classes/jdk.vm.ci.hotspot/src/jdk/vm/ci/hotspot/HotSpotVMConfig.java b/hotspot/src/jdk.vm.ci/share/classes/jdk.vm.ci.hotspot/src/jdk/vm/ci/hotspot/HotSpotVMConfig.java
index c446eda..46f5d71 100644
--- a/hotspot/src/jdk.vm.ci/share/classes/jdk.vm.ci.hotspot/src/jdk/vm/ci/hotspot/HotSpotVMConfig.java
+++ b/hotspot/src/jdk.vm.ci/share/classes/jdk.vm.ci.hotspot/src/jdk/vm/ci/hotspot/HotSpotVMConfig.java
@@ -252,7 +252,7 @@
     final int universeBaseVtableSize = getFieldValue("CompilerToVM::Data::Universe_base_vtable_size", Integer.class, "int");
 
     final int baseVtableLength() {
-        return universeBaseVtableSize / vtableEntrySize;
+        return universeBaseVtableSize / (vtableEntrySize / heapWordSize);
     }
 
     final int klassOffset = getFieldValue("java_lang_Class::_klass_offset", Integer.class, "int");
diff --git a/hotspot/src/jdk.vm.ci/share/classes/jdk.vm.ci.meta/src/jdk/vm/ci/meta/ConstantReflectionProvider.java b/hotspot/src/jdk.vm.ci/share/classes/jdk.vm.ci.meta/src/jdk/vm/ci/meta/ConstantReflectionProvider.java
index adba998..75c2e5f 100644
--- a/hotspot/src/jdk.vm.ci/share/classes/jdk.vm.ci.meta/src/jdk/vm/ci/meta/ConstantReflectionProvider.java
+++ b/hotspot/src/jdk.vm.ci/share/classes/jdk.vm.ci.meta/src/jdk/vm/ci/meta/ConstantReflectionProvider.java
@@ -97,15 +97,6 @@
     ResolvedJavaType asJavaType(Constant constant);
 
     /**
-     * Check if the constant is embeddable in the code.
-     *
-     * @param constant the constant to test
-     */
-    default boolean isEmbeddable(Constant constant) {
-        return true;
-    }
-
-    /**
      * Gets access to the internals of {@link MethodHandle}.
      */
     MethodHandleAccessProvider getMethodHandleAccess();
diff --git a/hotspot/src/jdk.vm.ci/share/classes/jdk.vm.ci.meta/src/jdk/vm/ci/meta/LineNumberTable.java b/hotspot/src/jdk.vm.ci/share/classes/jdk.vm.ci.meta/src/jdk/vm/ci/meta/LineNumberTable.java
index 71109dc..c67cc6b 100644
--- a/hotspot/src/jdk.vm.ci/share/classes/jdk.vm.ci.meta/src/jdk/vm/ci/meta/LineNumberTable.java
+++ b/hotspot/src/jdk.vm.ci/share/classes/jdk.vm.ci.meta/src/jdk/vm/ci/meta/LineNumberTable.java
@@ -30,32 +30,46 @@
 public class LineNumberTable {
 
     private final int[] lineNumbers;
-    private final int[] bci;
+    private final int[] bcis;
 
     /**
      *
-     * @param lineNumbers an array or source line numbers. This array is now owned by this object
+     * @param lineNumbers an array of source line numbers. This array is now owned by this object
      *            and should not be mutated by the caller.
-     * @param bci an array of bytecode indexes the same length at {@code lineNumbers} whose entries
+     * @param bcis an array of bytecode indexes the same length at {@code lineNumbers} whose entries
      *            are sorted in ascending order. This array is now owned by this object and must not
      *            be mutated by the caller.
      */
     @SuppressFBWarnings(value = "EI_EXPOSE_REP2", justification = "caller transfers ownership of `lineNumbers` and `bcis`")
-    public LineNumberTable(int[] lineNumbers, int[] bci) {
-        assert bci.length == lineNumbers.length;
+    public LineNumberTable(int[] lineNumbers, int[] bcis) {
+        assert bcis.length == lineNumbers.length;
         this.lineNumbers = lineNumbers;
-        this.bci = bci;
+        this.bcis = bcis;
     }
 
     /**
-     * Gets a source line number for {@code atBci}.
+     * Gets a source line number for bytecode index {@code atBci}.
      */
     public int getLineNumber(int atBci) {
-        for (int i = 0; i < this.bci.length - 1; i++) {
-            if (this.bci[i] <= atBci && atBci < this.bci[i + 1]) {
+        for (int i = 0; i < this.bcis.length - 1; i++) {
+            if (this.bcis[i] <= atBci && atBci < this.bcis[i + 1]) {
                 return lineNumbers[i];
             }
         }
         return lineNumbers[lineNumbers.length - 1];
     }
+
+    /**
+     * Gets a copy of the array of line numbers that was passed to this object's constructor.
+     */
+    public int[] getLineNumbers() {
+        return lineNumbers.clone();
+    }
+
+    /**
+     * Gets a copy of the array of bytecode indexes that was passed to this object's constructor.
+     */
+    public int[] getBcis() {
+        return bcis.clone();
+    }
 }
diff --git a/hotspot/src/jdk.vm.ci/share/classes/jdk.vm.ci.meta/src/jdk/vm/ci/meta/LocalVariableTable.java b/hotspot/src/jdk.vm.ci/share/classes/jdk.vm.ci.meta/src/jdk/vm/ci/meta/LocalVariableTable.java
index b81ec8d..63f135e 100644
--- a/hotspot/src/jdk.vm.ci/share/classes/jdk.vm.ci.meta/src/jdk/vm/ci/meta/LocalVariableTable.java
+++ b/hotspot/src/jdk.vm.ci/share/classes/jdk.vm.ci.meta/src/jdk/vm/ci/meta/LocalVariableTable.java
@@ -26,6 +26,8 @@
 import java.util.List;
 
 /**
+ * Describes the {@link Local}s for a Java method.
+ *
  * @see "https://docs.oracle.com/javase/specs/jvms/se8/html/jvms-4.html#jvms-4.7.13"
  */
 public class LocalVariableTable {
@@ -33,6 +35,7 @@
     private final Local[] locals;
 
     /**
+     * Creates an object describing the {@link Local}s for a Java method.
      *
      * @param locals array of objects describing local variables. This array is now owned by this
      *            object and must not be mutated by the caller.
@@ -42,6 +45,13 @@
         this.locals = locals;
     }
 
+    /**
+     * Gets a description of a local variable that occupies the bytecode frame slot indexed by
+     * {@code slot} and is live at the bytecode index {@code bci}
+     *
+     * @return a description of the requested local variable or null if no such variable matches
+     *         {@code slot} and {@code bci}
+     */
     public Local getLocal(int slot, int bci) {
         Local result = null;
         for (Local local : locals) {
@@ -56,6 +66,16 @@
         return result;
     }
 
+    /**
+     * Gets a copy of the array of {@link Local}s that was passed to this object's constructor.
+     */
+    public Local[] getLocals() {
+        return locals.clone();
+    }
+
+    /**
+     * Gets a description of all the local variables live at the bytecode index {@code bci}
+     */
     public Local[] getLocalsAt(int bci) {
         List<Local> result = new ArrayList<>();
         for (Local l : locals) {
diff --git a/hotspot/src/os/aix/vm/attachListener_aix.cpp b/hotspot/src/os/aix/vm/attachListener_aix.cpp
index 4e69822..0622561 100644
--- a/hotspot/src/os/aix/vm/attachListener_aix.cpp
+++ b/hotspot/src/os/aix/vm/attachListener_aix.cpp
@@ -383,23 +383,20 @@
     struct peercred_struct cred_info;
     socklen_t optlen = sizeof(cred_info);
     if (::getsockopt(s, SOL_SOCKET, SO_PEERID, (void*)&cred_info, &optlen) == -1) {
-      int res;
-      RESTARTABLE(::close(s), res);
+      ::close(s);
       continue;
     }
     uid_t euid = geteuid();
     gid_t egid = getegid();
 
     if (cred_info.euid != euid || cred_info.egid != egid) {
-      int res;
-      RESTARTABLE(::close(s), res);
+      ::close(s);
       continue;
     }
 
     // peer credential look okay so we read the request
     AixAttachOperation* op = read_request(s);
     if (op == NULL) {
-      int res;
       ::close(s);
       continue;
     } else {
diff --git a/hotspot/src/os/aix/vm/mutex_aix.inline.hpp b/hotspot/src/os/aix/vm/mutex_aix.inline.hpp
deleted file mode 100644
index ee59295..0000000
--- a/hotspot/src/os/aix/vm/mutex_aix.inline.hpp
+++ /dev/null
@@ -1,33 +0,0 @@
-/*
- * Copyright (c) 1999, 2013, Oracle and/or its affiliates. All rights reserved.
- * Copyright (c) 2012, 2014 SAP SE. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- *
- */
-
-#ifndef OS_AIX_VM_MUTEX_AIX_INLINE_HPP
-#define OS_AIX_VM_MUTEX_AIX_INLINE_HPP
-
-#include "os_aix.inline.hpp"
-#include "runtime/interfaceSupport.hpp"
-#include "runtime/thread.inline.hpp"
-
-#endif // OS_AIX_VM_MUTEX_AIX_INLINE_HPP
diff --git a/hotspot/src/os/aix/vm/os_aix.cpp b/hotspot/src/os/aix/vm/os_aix.cpp
index 6b676df..42aa1a6 100644
--- a/hotspot/src/os/aix/vm/os_aix.cpp
+++ b/hotspot/src/os/aix/vm/os_aix.cpp
@@ -44,7 +44,6 @@
 #include "memory/allocation.inline.hpp"
 #include "memory/filemap.hpp"
 #include "misc_aix.hpp"
-#include "mutex_aix.inline.hpp"
 #include "oops/oop.inline.hpp"
 #include "os_aix.inline.hpp"
 #include "os_share_aix.hpp"
diff --git a/hotspot/src/os/aix/vm/perfMemory_aix.cpp b/hotspot/src/os/aix/vm/perfMemory_aix.cpp
index 62212be..71bf015 100644
--- a/hotspot/src/os/aix/vm/perfMemory_aix.cpp
+++ b/hotspot/src/os/aix/vm/perfMemory_aix.cpp
@@ -951,25 +951,24 @@
 
   // open the file
   int result;
-  // No O_NOFOLLOW defined at buildtime, and it is not documented for open;
-  // so provide a workaround in this case
+  // provide a workaround in case no O_NOFOLLOW is defined at buildtime
 #ifdef O_NOFOLLOW
   RESTARTABLE(::open(filename, oflags), result);
 #else
   result = open_o_nofollow(filename, oflags);
 #endif
-
   if (result == OS_ERR) {
     if (errno == ENOENT) {
-      THROW_MSG_0(vmSymbols::java_lang_IllegalArgumentException(),
-                  "Process not found");
+      THROW_MSG_(vmSymbols::java_lang_IllegalArgumentException(),
+                 "Process not found", OS_ERR);
     }
     else if (errno == EACCES) {
-      THROW_MSG_0(vmSymbols::java_lang_IllegalArgumentException(),
-                  "Permission denied");
+      THROW_MSG_(vmSymbols::java_lang_IllegalArgumentException(),
+                 "Permission denied", OS_ERR);
     }
     else {
-      THROW_MSG_0(vmSymbols::java_io_IOException(), os::strerror(errno));
+      THROW_MSG_(vmSymbols::java_io_IOException(),
+                 os::strerror(errno), OS_ERR);
     }
   }
   int fd = result;
@@ -987,7 +986,7 @@
 // memory region on success or NULL on failure. A return value of
 // NULL will ultimately disable the shared memory feature.
 //
-// On AIX, Solaris and Linux, the name space for shared memory objects
+// On AIX, the name space for shared memory objects
 // is the file system name space.
 //
 // A monitoring application attaching to a JVM does not need to know
@@ -1011,6 +1010,7 @@
 
   char* dirname = get_user_tmp_dir(user_name);
   char* filename = get_sharedmem_filename(dirname, vmid);
+
   // get the short filename.
   char* short_filename = strrchr(filename, '/');
   if (short_filename == NULL) {
diff --git a/hotspot/src/os/bsd/vm/mutex_bsd.cpp b/hotspot/src/os/bsd/vm/mutex_bsd.cpp
deleted file mode 100644
index 3a1b5eb..0000000
--- a/hotspot/src/os/bsd/vm/mutex_bsd.cpp
+++ /dev/null
@@ -1,33 +0,0 @@
-/*
- * Copyright (c) 2007, 2010, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- *
- */
-
-#include "precompiled.hpp"
-#include "mutex_bsd.inline.hpp"
-#include "runtime/interfaceSupport.hpp"
-#include "runtime/mutex.hpp"
-#include "runtime/thread.inline.hpp"
-#include "utilities/events.hpp"
-
-// put OS-includes here
-# include <signal.h>
diff --git a/hotspot/src/os/bsd/vm/mutex_bsd.inline.hpp b/hotspot/src/os/bsd/vm/mutex_bsd.inline.hpp
deleted file mode 100644
index 63c63f0..0000000
--- a/hotspot/src/os/bsd/vm/mutex_bsd.inline.hpp
+++ /dev/null
@@ -1,37 +0,0 @@
-/*
- * Copyright (c) 1999, 2010, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- *
- */
-
-#ifndef OS_BSD_VM_MUTEX_BSD_INLINE_HPP
-#define OS_BSD_VM_MUTEX_BSD_INLINE_HPP
-
-#include "os_bsd.inline.hpp"
-#include "runtime/interfaceSupport.hpp"
-#include "runtime/thread.inline.hpp"
-
-
-// Reconciliation History
-// mutex_solaris.inline.hpp     1.5 99/06/22 16:38:49
-// End
-
-#endif // OS_BSD_VM_MUTEX_BSD_INLINE_HPP
diff --git a/hotspot/src/os/bsd/vm/os_bsd.cpp b/hotspot/src/os/bsd/vm/os_bsd.cpp
index b8c40f6..738144b 100644
--- a/hotspot/src/os/bsd/vm/os_bsd.cpp
+++ b/hotspot/src/os/bsd/vm/os_bsd.cpp
@@ -35,7 +35,6 @@
 #include "logging/log.hpp"
 #include "memory/allocation.inline.hpp"
 #include "memory/filemap.hpp"
-#include "mutex_bsd.inline.hpp"
 #include "oops/oop.inline.hpp"
 #include "os_bsd.inline.hpp"
 #include "os_share_bsd.hpp"
diff --git a/hotspot/src/os/bsd/vm/perfMemory_bsd.cpp b/hotspot/src/os/bsd/vm/perfMemory_bsd.cpp
index f87f81d..2cb2d59 100644
--- a/hotspot/src/os/bsd/vm/perfMemory_bsd.cpp
+++ b/hotspot/src/os/bsd/vm/perfMemory_bsd.cpp
@@ -881,14 +881,15 @@
   if (result == OS_ERR) {
     if (errno == ENOENT) {
       THROW_MSG_(vmSymbols::java_lang_IllegalArgumentException(),
-                  "Process not found", OS_ERR);
+                 "Process not found", OS_ERR);
     }
     else if (errno == EACCES) {
       THROW_MSG_(vmSymbols::java_lang_IllegalArgumentException(),
-                  "Permission denied", OS_ERR);
+                 "Permission denied", OS_ERR);
     }
     else {
-      THROW_MSG_(vmSymbols::java_io_IOException(), os::strerror(errno), OS_ERR);
+      THROW_MSG_(vmSymbols::java_io_IOException(),
+                 os::strerror(errno), OS_ERR);
     }
   }
   int fd = result;
@@ -906,7 +907,7 @@
 // memory region on success or NULL on failure. A return value of
 // NULL will ultimately disable the shared memory feature.
 //
-// On Solaris and Bsd, the name space for shared memory objects
+// On BSD, the name space for shared memory objects
 // is the file system name space.
 //
 // A monitoring application attaching to a JVM does not need to know
diff --git a/hotspot/src/os/linux/vm/mutex_linux.cpp b/hotspot/src/os/linux/vm/mutex_linux.cpp
deleted file mode 100644
index a54ec99..0000000
--- a/hotspot/src/os/linux/vm/mutex_linux.cpp
+++ /dev/null
@@ -1,33 +0,0 @@
-/*
- * Copyright (c) 2007, 2010, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- *
- */
-
-#include "precompiled.hpp"
-#include "mutex_linux.inline.hpp"
-#include "runtime/interfaceSupport.hpp"
-#include "runtime/mutex.hpp"
-#include "runtime/thread.inline.hpp"
-#include "utilities/events.hpp"
-
-// put OS-includes here
-# include <signal.h>
diff --git a/hotspot/src/os/linux/vm/mutex_linux.inline.hpp b/hotspot/src/os/linux/vm/mutex_linux.inline.hpp
deleted file mode 100644
index ff3ac28..0000000
--- a/hotspot/src/os/linux/vm/mutex_linux.inline.hpp
+++ /dev/null
@@ -1,37 +0,0 @@
-/*
- * Copyright (c) 1999, 2010, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- *
- */
-
-#ifndef OS_LINUX_VM_MUTEX_LINUX_INLINE_HPP
-#define OS_LINUX_VM_MUTEX_LINUX_INLINE_HPP
-
-#include "os_linux.inline.hpp"
-#include "runtime/interfaceSupport.hpp"
-#include "runtime/thread.inline.hpp"
-
-
-// Reconciliation History
-// mutex_solaris.inline.hpp     1.5 99/06/22 16:38:49
-// End
-
-#endif // OS_LINUX_VM_MUTEX_LINUX_INLINE_HPP
diff --git a/hotspot/src/os/linux/vm/os_linux.cpp b/hotspot/src/os/linux/vm/os_linux.cpp
index 2407381..b8c1a72 100644
--- a/hotspot/src/os/linux/vm/os_linux.cpp
+++ b/hotspot/src/os/linux/vm/os_linux.cpp
@@ -35,7 +35,6 @@
 #include "logging/log.hpp"
 #include "memory/allocation.inline.hpp"
 #include "memory/filemap.hpp"
-#include "mutex_linux.inline.hpp"
 #include "oops/oop.inline.hpp"
 #include "os_linux.inline.hpp"
 #include "os_share_linux.hpp"
diff --git a/hotspot/src/os/linux/vm/perfMemory_linux.cpp b/hotspot/src/os/linux/vm/perfMemory_linux.cpp
index 610a1a0..da8c572 100644
--- a/hotspot/src/os/linux/vm/perfMemory_linux.cpp
+++ b/hotspot/src/os/linux/vm/perfMemory_linux.cpp
@@ -891,14 +891,15 @@
   if (result == OS_ERR) {
     if (errno == ENOENT) {
       THROW_MSG_(vmSymbols::java_lang_IllegalArgumentException(),
-                  "Process not found", OS_ERR);
+                 "Process not found", OS_ERR);
     }
     else if (errno == EACCES) {
       THROW_MSG_(vmSymbols::java_lang_IllegalArgumentException(),
-                  "Permission denied", OS_ERR);
+                 "Permission denied", OS_ERR);
     }
     else {
-      THROW_MSG_(vmSymbols::java_io_IOException(), os::strerror(errno), OS_ERR);
+      THROW_MSG_(vmSymbols::java_io_IOException(),
+                 os::strerror(errno), OS_ERR);
     }
   }
   int fd = result;
@@ -916,7 +917,7 @@
 // memory region on success or NULL on failure. A return value of
 // NULL will ultimately disable the shared memory feature.
 //
-// On Solaris and Linux, the name space for shared memory objects
+// On Linux, the name space for shared memory objects
 // is the file system name space.
 //
 // A monitoring application attaching to a JVM does not need to know
@@ -940,6 +941,7 @@
 
   char* dirname = get_user_tmp_dir(user_name);
   char* filename = get_sharedmem_filename(dirname, vmid);
+
   // get the short filename
   char* short_filename = strrchr(filename, '/');
   if (short_filename == NULL) {
diff --git a/hotspot/src/os/posix/vm/os_posix.cpp b/hotspot/src/os/posix/vm/os_posix.cpp
index ad10c82..6ed034c 100644
--- a/hotspot/src/os/posix/vm/os_posix.cpp
+++ b/hotspot/src/os/posix/vm/os_posix.cpp
@@ -28,6 +28,7 @@
 #include "runtime/frame.inline.hpp"
 #include "runtime/interfaceSupport.hpp"
 #include "runtime/os.hpp"
+#include "utilities/macros.hpp"
 #include "utilities/vmError.hpp"
 
 #include <signal.h>
@@ -214,7 +215,7 @@
   else st->print("%luk", rlim.rlim_cur >> 10);
 
   // Isn't there on solaris
-#if !defined(TARGET_OS_FAMILY_solaris) && !defined(TARGET_OS_FAMILY_aix)
+#if !defined(SOLARIS) && !defined(AIX)
   st->print(", NPROC ");
   getrlimit(RLIMIT_NPROC, &rlim);
   if (rlim.rlim_cur == RLIM_INFINITY) st->print("infinity");
@@ -1062,28 +1063,28 @@
 }
 
 address os::Posix::ucontext_get_pc(const ucontext_t* ctx) {
-#ifdef TARGET_OS_FAMILY_linux
-   return Linux::ucontext_get_pc(ctx);
-#elif defined(TARGET_OS_FAMILY_solaris)
-   return Solaris::ucontext_get_pc(ctx);
-#elif defined(TARGET_OS_FAMILY_aix)
+#if defined(AIX)
    return Aix::ucontext_get_pc(ctx);
-#elif defined(TARGET_OS_FAMILY_bsd)
+#elif defined(BSD)
    return Bsd::ucontext_get_pc(ctx);
+#elif defined(LINUX)
+   return Linux::ucontext_get_pc(ctx);
+#elif defined(SOLARIS)
+   return Solaris::ucontext_get_pc(ctx);
 #else
    VMError::report_and_die("unimplemented ucontext_get_pc");
 #endif
 }
 
 void os::Posix::ucontext_set_pc(ucontext_t* ctx, address pc) {
-#ifdef TARGET_OS_FAMILY_linux
-   Linux::ucontext_set_pc(ctx, pc);
-#elif defined(TARGET_OS_FAMILY_solaris)
-   Solaris::ucontext_set_pc(ctx, pc);
-#elif defined(TARGET_OS_FAMILY_aix)
+#if defined(AIX)
    Aix::ucontext_set_pc(ctx, pc);
-#elif defined(TARGET_OS_FAMILY_bsd)
+#elif defined(BSD)
    Bsd::ucontext_set_pc(ctx, pc);
+#elif defined(LINUX)
+   Linux::ucontext_set_pc(ctx, pc);
+#elif defined(SOLARIS)
+   Solaris::ucontext_set_pc(ctx, pc);
 #else
    VMError::report_and_die("unimplemented ucontext_get_pc");
 #endif
diff --git a/hotspot/src/os/posix/vm/vmError_posix.cpp b/hotspot/src/os/posix/vm/vmError_posix.cpp
index 23cafc4..3c61a8b 100644
--- a/hotspot/src/os/posix/vm/vmError_posix.cpp
+++ b/hotspot/src/os/posix/vm/vmError_posix.cpp
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2003, 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2003, 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
@@ -33,17 +33,17 @@
 #include <sys/wait.h>
 #include <signal.h>
 
-#ifdef TARGET_OS_FAMILY_linux
+#ifdef LINUX
 #include <sys/syscall.h>
 #include <unistd.h>
 #endif
-#ifdef TARGET_OS_FAMILY_solaris
+#ifdef SOLARIS
 #include <thread.h>
 #endif
-#ifdef TARGET_OS_FAMILY_aix
+#ifdef AIX
 #include <unistd.h>
 #endif
-#ifdef TARGET_OS_FAMILY_bsd
+#ifdef BSD
 #include <sys/syscall.h>
 #include <unistd.h>
 #endif
diff --git a/hotspot/src/os/solaris/vm/jvm_solaris.h b/hotspot/src/os/solaris/vm/jvm_solaris.h
index e961d36..7398e0b 100644
--- a/hotspot/src/os/solaris/vm/jvm_solaris.h
+++ b/hotspot/src/os/solaris/vm/jvm_solaris.h
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1998, 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1998, 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
@@ -41,9 +41,7 @@
  * JNI conversion, which should be sorted out later.
  */
 
-#define __USE_LEGACY_PROTOTYPES__
 #include <dirent.h>             /* For DIR */
-#undef __USE_LEGACY_PROTOTYPES__
 #include <sys/param.h>          /* For MAXPATHLEN */
 #include <sys/socket.h>         /* For socklen_t */
 #include <unistd.h>             /* For F_OK, R_OK, W_OK */
diff --git a/hotspot/src/os/solaris/vm/mutex_solaris.cpp b/hotspot/src/os/solaris/vm/mutex_solaris.cpp
deleted file mode 100644
index 4d8166f..0000000
--- a/hotspot/src/os/solaris/vm/mutex_solaris.cpp
+++ /dev/null
@@ -1,36 +0,0 @@
-/*
- * Copyright (c) 2007, 2010, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- *
- */
-
-#include "precompiled.hpp"
-#include "mutex_solaris.inline.hpp"
-#include "runtime/interfaceSupport.hpp"
-#include "runtime/mutex.hpp"
-#include "runtime/thread.inline.hpp"
-#include "utilities/events.hpp"
-
-// Solaris-specific include, therefore not in includeDB_*
-# include "os_share_solaris.hpp"
-
-// put OS-includes here
-# include <signal.h>
diff --git a/hotspot/src/os/solaris/vm/mutex_solaris.inline.hpp b/hotspot/src/os/solaris/vm/mutex_solaris.inline.hpp
deleted file mode 100644
index b683a3b..0000000
--- a/hotspot/src/os/solaris/vm/mutex_solaris.inline.hpp
+++ /dev/null
@@ -1,32 +0,0 @@
-/*
- * Copyright (c) 1998, 2010, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- *
- */
-
-#ifndef OS_SOLARIS_VM_MUTEX_SOLARIS_INLINE_HPP
-#define OS_SOLARIS_VM_MUTEX_SOLARIS_INLINE_HPP
-
-#include "os_solaris.inline.hpp"
-#include "runtime/interfaceSupport.hpp"
-#include "runtime/thread.inline.hpp"
-
-#endif // OS_SOLARIS_VM_MUTEX_SOLARIS_INLINE_HPP
diff --git a/hotspot/src/os/solaris/vm/os_solaris.cpp b/hotspot/src/os/solaris/vm/os_solaris.cpp
index 67ca5ee..3b9a379 100644
--- a/hotspot/src/os/solaris/vm/os_solaris.cpp
+++ b/hotspot/src/os/solaris/vm/os_solaris.cpp
@@ -35,7 +35,6 @@
 #include "logging/log.hpp"
 #include "memory/allocation.inline.hpp"
 #include "memory/filemap.hpp"
-#include "mutex_solaris.inline.hpp"
 #include "oops/oop.inline.hpp"
 #include "os_share_solaris.hpp"
 #include "os_solaris.inline.hpp"
@@ -79,7 +78,6 @@
 # include <link.h>
 # include <poll.h>
 # include <pthread.h>
-# include <pwd.h>
 # include <schedctl.h>
 # include <setjmp.h>
 # include <signal.h>
diff --git a/hotspot/src/os/solaris/vm/perfMemory_solaris.cpp b/hotspot/src/os/solaris/vm/perfMemory_solaris.cpp
index a5bfbb7..2b80a4f 100644
--- a/hotspot/src/os/solaris/vm/perfMemory_solaris.cpp
+++ b/hotspot/src/os/solaris/vm/perfMemory_solaris.cpp
@@ -34,16 +34,18 @@
 #include "utilities/exceptions.hpp"
 
 // put OS-includes here
-# include <sys/types.h>
-# include <sys/mman.h>
-# include <errno.h>
-# include <stdio.h>
-# include <unistd.h>
-# include <sys/stat.h>
-# include <signal.h>
-# include <pwd.h>
-# include <procfs.h>
+#include <sys/types.h>
+#include <sys/mman.h>
+#include <errno.h>
+#include <stdio.h>
+#include <unistd.h>
+#include <sys/stat.h>
+#include <signal.h>
+#include <procfs.h>
 
+/* For POSIX-compliant getpwuid_r on Solaris */
+#define _POSIX_PTHREAD_SEMANTICS
+#include <pwd.h>
 
 static char* backing_store_file_name = NULL;  // name of the backing store
                                               // file, if successfully created.
@@ -334,7 +336,7 @@
   }
 
   // Check to make sure fd and dirp are referencing the same file system object.
-  if (!is_same_fsobject(fd, dirp->dd_fd)) {
+  if (!is_same_fsobject(fd, dirp->d_fd)) {
     // The directory is not secure.
     os::close(fd);
     os::closedir(dirp);
@@ -366,7 +368,7 @@
     // Directory doesn't exist or is insecure, so there is nothing to cleanup.
     return dirp;
   }
-  int fd = dirp->dd_fd;
+  int fd = dirp->d_fd;
 
   // Open a fd to the cwd and save it off.
   int result;
@@ -453,12 +455,8 @@
 
   char* pwbuf = NEW_C_HEAP_ARRAY(char, bufsize, mtInternal);
 
-#ifdef _GNU_SOURCE
   struct passwd* p = NULL;
   int result = getpwuid_r(uid, &pwent, pwbuf, (size_t)bufsize, &p);
-#else  // _GNU_SOURCE
-  struct passwd* p = getpwuid_r(uid, &pwent, pwbuf, (int)bufsize);
-#endif // _GNU_SOURCE
 
   if (p == NULL || p->pw_name == NULL || *(p->pw_name) == '\0') {
     if (PrintMiscellaneous && Verbose) {
@@ -909,14 +907,15 @@
   if (result == OS_ERR) {
     if (errno == ENOENT) {
       THROW_MSG_(vmSymbols::java_lang_IllegalArgumentException(),
-                  "Process not found", OS_ERR);
+                 "Process not found", OS_ERR);
     }
     else if (errno == EACCES) {
       THROW_MSG_(vmSymbols::java_lang_IllegalArgumentException(),
-                  "Permission denied", OS_ERR);
+                 "Permission denied", OS_ERR);
     }
     else {
-      THROW_MSG_(vmSymbols::java_io_IOException(), os::strerror(errno), OS_ERR);
+      THROW_MSG_(vmSymbols::java_io_IOException(),
+                 os::strerror(errno), OS_ERR);
     }
   }
   int fd = result;
@@ -934,7 +933,7 @@
 // memory region on success or NULL on failure. A return value of
 // NULL will ultimately disable the shared memory feature.
 //
-// On Solaris and Linux, the name space for shared memory objects
+// On Solaris, the name space for shared memory objects
 // is the file system name space.
 //
 // A monitoring application attaching to a JVM does not need to know
diff --git a/hotspot/src/os/windows/vm/mutex_windows.cpp b/hotspot/src/os/windows/vm/mutex_windows.cpp
deleted file mode 100644
index f8e0633..0000000
--- a/hotspot/src/os/windows/vm/mutex_windows.cpp
+++ /dev/null
@@ -1,33 +0,0 @@
-/*
- * Copyright (c) 1998, 2010, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- *
- */
-
-#include "precompiled.hpp"
-#include "mutex_windows.inline.hpp"
-#include "runtime/interfaceSupport.hpp"
-#include "runtime/mutex.hpp"
-#include "runtime/thread.inline.hpp"
-#include "utilities/events.hpp"
-
-// put OS-includes here
-# include <windows.h>
diff --git a/hotspot/src/os/windows/vm/mutex_windows.inline.hpp b/hotspot/src/os/windows/vm/mutex_windows.inline.hpp
deleted file mode 100644
index fbfe7ac..0000000
--- a/hotspot/src/os/windows/vm/mutex_windows.inline.hpp
+++ /dev/null
@@ -1,32 +0,0 @@
-/*
- * Copyright (c) 1998, 2010, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- *
- */
-
-#ifndef OS_WINDOWS_VM_MUTEX_WINDOWS_INLINE_HPP
-#define OS_WINDOWS_VM_MUTEX_WINDOWS_INLINE_HPP
-
-#include "os_windows.inline.hpp"
-#include "runtime/interfaceSupport.hpp"
-#include "runtime/thread.inline.hpp"
-
-#endif // OS_WINDOWS_VM_MUTEX_WINDOWS_INLINE_HPP
diff --git a/hotspot/src/os/windows/vm/os_windows.cpp b/hotspot/src/os/windows/vm/os_windows.cpp
index 23a06c9..bd85cf0 100644
--- a/hotspot/src/os/windows/vm/os_windows.cpp
+++ b/hotspot/src/os/windows/vm/os_windows.cpp
@@ -38,7 +38,6 @@
 #include "logging/log.hpp"
 #include "memory/allocation.inline.hpp"
 #include "memory/filemap.hpp"
-#include "mutex_windows.inline.hpp"
 #include "oops/oop.inline.hpp"
 #include "os_share_windows.hpp"
 #include "os_windows.inline.hpp"
@@ -3898,6 +3897,13 @@
     DWORD res;
     HANDLE hproc, hthr;
 
+    // We only attempt to register threads until a process exiting
+    // thread manages to set the process_exiting flag. Any threads
+    // that come through here after the process_exiting flag is set
+    // are unregistered and will be caught in the SuspendThread()
+    // infinite loop below.
+    bool registered = false;
+
     // The first thread that reached this point, initializes the critical section.
     if (!InitOnceExecuteOnce(&init_once_crit_sect, init_crit_sect_call, &crit_sect, NULL)) {
       warning("crit_sect initialization failed in %s: %d\n", __FILE__, __LINE__);
@@ -3957,12 +3963,21 @@
                              0, FALSE, DUPLICATE_SAME_ACCESS)) {
           warning("DuplicateHandle failed (%u) in %s: %d\n",
                   GetLastError(), __FILE__, __LINE__);
+
+          // We can't register this thread (no more handles) so this thread
+          // may be racing with a thread that is calling exit(). If the thread
+          // that is calling exit() has managed to set the process_exiting
+          // flag, then this thread will be caught in the SuspendThread()
+          // infinite loop below which closes that race. A small timing
+          // window remains before the process_exiting flag is set, but it
+          // is only exposed when we are out of handles.
         } else {
           ++handle_count;
-        }
+          registered = true;
 
-        // The current exiting thread has stored its handle in the array, and now
-        // should leave the critical section before calling _endthreadex().
+          // The current exiting thread has stored its handle in the array, and now
+          // should leave the critical section before calling _endthreadex().
+        }
 
       } else if (what != EPT_THREAD && handle_count > 0) {
         jlong start_time, finish_time, timeout_left;
@@ -4012,10 +4027,11 @@
       LeaveCriticalSection(&crit_sect);
     }
 
-    if (OrderAccess::load_acquire(&process_exiting) != 0 &&
+    if (!registered &&
+        OrderAccess::load_acquire(&process_exiting) != 0 &&
         process_exiting != (jint)GetCurrentThreadId()) {
-      // Some other thread is about to call exit(), so we
-      // don't let the current thread proceed to exit() or _endthreadex()
+      // Some other thread is about to call exit(), so we don't let
+      // the current unregistered thread proceed to exit() or _endthreadex()
       while (true) {
         SuspendThread(GetCurrentThread());
         // Avoid busy-wait loop, if SuspendThread() failed.
@@ -4027,7 +4043,7 @@
   // We are here if either
   // - there's no 'race at exit' bug on this OS release;
   // - initialization of the critical section failed (unlikely);
-  // - the current thread has stored its handle and left the critical section;
+  // - the current thread has registered itself and left the critical section;
   // - the process-exiting thread has raised the flag and left the critical section.
   if (what == EPT_THREAD) {
     _endthreadex((unsigned)exit_code);
diff --git a/hotspot/test/compiler/native/libTestDirtyInt.c b/hotspot/src/os_cpu/aix_ppc/vm/bytes_aix_ppc.inline.hpp
similarity index 80%
copy from hotspot/test/compiler/native/libTestDirtyInt.c
copy to hotspot/src/os_cpu/aix_ppc/vm/bytes_aix_ppc.inline.hpp
index b688a36..2e6ec99 100644
--- a/hotspot/test/compiler/native/libTestDirtyInt.c
+++ b/hotspot/src/os_cpu/aix_ppc/vm/bytes_aix_ppc.inline.hpp
@@ -19,15 +19,14 @@
  * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
  * or visit www.oracle.com if you need additional information or have any
  * questions.
+ *
  */
 
-#include "jni.h"
-#include <stdio.h>
+#ifndef OS_CPU_AIX_PPC_VM_BYTES_AIX_PPC_INLINE_HPP
+#define OS_CPU_AIX_PPC_VM_BYTES_AIX_PPC_INLINE_HPP
 
-static int array = 0x42;
+#if defined(VM_LITTLE_ENDIAN)
+// Aix is not little endian.
+#endif // VM_LITTLE_ENDIAN
 
-JNIEXPORT jint JNICALL Java_TestDirtyInt_test(JNIEnv* env, jclass jclazz, jint v)
-{
-  int* ptr = &array + v + 4;
-  return *ptr;
-}
+#endif // OS_CPU_AIX_PPC_VM_BYTES_AIX_PPC_INLINE_HPP
diff --git a/hotspot/src/os_cpu/aix_ppc/vm/os_aix_ppc.cpp b/hotspot/src/os_cpu/aix_ppc/vm/os_aix_ppc.cpp
index 84ae1ab..e5c9867 100644
--- a/hotspot/src/os_cpu/aix_ppc/vm/os_aix_ppc.cpp
+++ b/hotspot/src/os_cpu/aix_ppc/vm/os_aix_ppc.cpp
@@ -34,7 +34,6 @@
 #include "interpreter/interpreter.hpp"
 #include "jvm_aix.h"
 #include "memory/allocation.inline.hpp"
-#include "mutex_aix.inline.hpp"
 #include "nativeInst_ppc.hpp"
 #include "os_share_aix.hpp"
 #include "prims/jniFastGetField.hpp"
diff --git a/hotspot/src/os_cpu/bsd_x86/vm/os_bsd_x86.cpp b/hotspot/src/os_cpu/bsd_x86/vm/os_bsd_x86.cpp
index 9fe34fc..5f7d479 100644
--- a/hotspot/src/os_cpu/bsd_x86/vm/os_bsd_x86.cpp
+++ b/hotspot/src/os_cpu/bsd_x86/vm/os_bsd_x86.cpp
@@ -33,7 +33,6 @@
 #include "interpreter/interpreter.hpp"
 #include "jvm_bsd.h"
 #include "memory/allocation.inline.hpp"
-#include "mutex_bsd.inline.hpp"
 #include "os_share_bsd.hpp"
 #include "prims/jniFastGetField.hpp"
 #include "prims/jvm.h"
diff --git a/hotspot/src/os_cpu/bsd_zero/vm/os_bsd_zero.cpp b/hotspot/src/os_cpu/bsd_zero/vm/os_bsd_zero.cpp
index 72d5785..f7ff3e5 100644
--- a/hotspot/src/os_cpu/bsd_zero/vm/os_bsd_zero.cpp
+++ b/hotspot/src/os_cpu/bsd_zero/vm/os_bsd_zero.cpp
@@ -38,7 +38,6 @@
 #include "interpreter/interpreter.hpp"
 #include "jvm_bsd.h"
 #include "memory/allocation.inline.hpp"
-#include "mutex_bsd.inline.hpp"
 #include "nativeInst_zero.hpp"
 #include "os_share_bsd.hpp"
 #include "prims/jniFastGetField.hpp"
diff --git a/hotspot/src/os_cpu/linux_aarch64/vm/os_linux_aarch64.cpp b/hotspot/src/os_cpu/linux_aarch64/vm/os_linux_aarch64.cpp
index 0417992..b4bc43a 100644
--- a/hotspot/src/os_cpu/linux_aarch64/vm/os_linux_aarch64.cpp
+++ b/hotspot/src/os_cpu/linux_aarch64/vm/os_linux_aarch64.cpp
@@ -35,7 +35,6 @@
 #include "interpreter/interpreter.hpp"
 #include "jvm_linux.h"
 #include "memory/allocation.inline.hpp"
-#include "mutex_linux.inline.hpp"
 #include "os_share_linux.hpp"
 #include "prims/jniFastGetField.hpp"
 #include "prims/jvm.h"
diff --git a/hotspot/src/os_cpu/linux_ppc/vm/os_linux_ppc.cpp b/hotspot/src/os_cpu/linux_ppc/vm/os_linux_ppc.cpp
index 18cd557..0003988 100644
--- a/hotspot/src/os_cpu/linux_ppc/vm/os_linux_ppc.cpp
+++ b/hotspot/src/os_cpu/linux_ppc/vm/os_linux_ppc.cpp
@@ -34,7 +34,6 @@
 #include "interpreter/interpreter.hpp"
 #include "jvm_linux.h"
 #include "memory/allocation.inline.hpp"
-#include "mutex_linux.inline.hpp"
 #include "nativeInst_ppc.hpp"
 #include "os_share_linux.hpp"
 #include "prims/jniFastGetField.hpp"
diff --git a/hotspot/src/os_cpu/linux_sparc/vm/os_linux_sparc.cpp b/hotspot/src/os_cpu/linux_sparc/vm/os_linux_sparc.cpp
index 4a0da12..7cf5edb 100644
--- a/hotspot/src/os_cpu/linux_sparc/vm/os_linux_sparc.cpp
+++ b/hotspot/src/os_cpu/linux_sparc/vm/os_linux_sparc.cpp
@@ -33,7 +33,6 @@
 #include "interpreter/interpreter.hpp"
 #include "jvm_linux.h"
 #include "memory/allocation.inline.hpp"
-#include "mutex_linux.inline.hpp"
 #include "nativeInst_sparc.hpp"
 #include "os_share_linux.hpp"
 #include "prims/jniFastGetField.hpp"
diff --git a/hotspot/src/os_cpu/linux_x86/vm/os_linux_x86.cpp b/hotspot/src/os_cpu/linux_x86/vm/os_linux_x86.cpp
index 8bc9e6a..06a8a6e 100644
--- a/hotspot/src/os_cpu/linux_x86/vm/os_linux_x86.cpp
+++ b/hotspot/src/os_cpu/linux_x86/vm/os_linux_x86.cpp
@@ -33,7 +33,6 @@
 #include "interpreter/interpreter.hpp"
 #include "jvm_linux.h"
 #include "memory/allocation.inline.hpp"
-#include "mutex_linux.inline.hpp"
 #include "os_share_linux.hpp"
 #include "prims/jniFastGetField.hpp"
 #include "prims/jvm.h"
diff --git a/hotspot/src/os_cpu/linux_zero/vm/os_linux_zero.cpp b/hotspot/src/os_cpu/linux_zero/vm/os_linux_zero.cpp
index abd5296..b43499e 100644
--- a/hotspot/src/os_cpu/linux_zero/vm/os_linux_zero.cpp
+++ b/hotspot/src/os_cpu/linux_zero/vm/os_linux_zero.cpp
@@ -33,7 +33,6 @@
 #include "interpreter/interpreter.hpp"
 #include "jvm_linux.h"
 #include "memory/allocation.inline.hpp"
-#include "mutex_linux.inline.hpp"
 #include "nativeInst_zero.hpp"
 #include "os_share_linux.hpp"
 #include "prims/jniFastGetField.hpp"
diff --git a/hotspot/src/os_cpu/solaris_sparc/vm/os_solaris_sparc.cpp b/hotspot/src/os_cpu/solaris_sparc/vm/os_solaris_sparc.cpp
index 39663ed..be5134d 100644
--- a/hotspot/src/os_cpu/solaris_sparc/vm/os_solaris_sparc.cpp
+++ b/hotspot/src/os_cpu/solaris_sparc/vm/os_solaris_sparc.cpp
@@ -34,7 +34,6 @@
 #include "interpreter/interpreter.hpp"
 #include "jvm_solaris.h"
 #include "memory/allocation.inline.hpp"
-#include "mutex_solaris.inline.hpp"
 #include "nativeInst_sparc.hpp"
 #include "os_share_solaris.hpp"
 #include "prims/jniFastGetField.hpp"
@@ -74,7 +73,6 @@
 # include <sys/systeminfo.h>
 # include <sys/socket.h>
 # include <sys/lwp.h>
-# include <pwd.h>
 # include <poll.h>
 # include <sys/lwp.h>
 
@@ -545,10 +543,6 @@
     // factor me: setPC
     os::Solaris::ucontext_set_pc(uc, stub);
 
-#ifndef PRODUCT
-    if (TraceJumps) thread->record_jump(stub, NULL, __FILE__, __LINE__);
-#endif /* PRODUCT */
-
     return true;
   }
 
diff --git a/hotspot/src/os_cpu/solaris_x86/vm/os_solaris_x86.cpp b/hotspot/src/os_cpu/solaris_x86/vm/os_solaris_x86.cpp
index 695fc12..328ac2e 100644
--- a/hotspot/src/os_cpu/solaris_x86/vm/os_solaris_x86.cpp
+++ b/hotspot/src/os_cpu/solaris_x86/vm/os_solaris_x86.cpp
@@ -33,7 +33,6 @@
 #include "interpreter/interpreter.hpp"
 #include "jvm_solaris.h"
 #include "memory/allocation.inline.hpp"
-#include "mutex_solaris.inline.hpp"
 #include "os_share_solaris.hpp"
 #include "prims/jniFastGetField.hpp"
 #include "prims/jvm.h"
@@ -74,7 +73,6 @@
 # include <sys/socket.h>
 # include <sys/trap.h>
 # include <sys/lwp.h>
-# include <pwd.h>
 # include <poll.h>
 # include <sys/lwp.h>
 # include <procfs.h>     //  see comment in <sys/procfs.h>
diff --git a/hotspot/src/os_cpu/windows_x86/vm/os_windows_x86.cpp b/hotspot/src/os_cpu/windows_x86/vm/os_windows_x86.cpp
index d71b9a7..efb1b3b 100644
--- a/hotspot/src/os_cpu/windows_x86/vm/os_windows_x86.cpp
+++ b/hotspot/src/os_cpu/windows_x86/vm/os_windows_x86.cpp
@@ -34,7 +34,6 @@
 #include "jvm_windows.h"
 #include "memory/allocation.inline.hpp"
 #include "memory/resourceArea.hpp"
-#include "mutex_windows.inline.hpp"
 #include "nativeInst_x86.hpp"
 #include "os_share_windows.hpp"
 #include "prims/jniFastGetField.hpp"
diff --git a/hotspot/src/share/vm/adlc/formssel.cpp b/hotspot/src/share/vm/adlc/formssel.cpp
index 42aefeb..7f720b1 100644
--- a/hotspot/src/share/vm/adlc/formssel.cpp
+++ b/hotspot/src/share/vm/adlc/formssel.cpp
@@ -3647,14 +3647,14 @@
     // Check left operands
     if( (_lChild == NULL) && (mRule2->_lChild == NULL) ) {
       left_spillable = Maybe_cisc_spillable;
-    } else {
+    } else  if (_lChild != NULL) {
       left_spillable = _lChild->cisc_spill_match(globals, registers, mRule2->_lChild, operand, reg_type);
     }
 
     // Check right operands
     if( (_rChild == NULL) && (mRule2->_rChild == NULL) ) {
       right_spillable =  Maybe_cisc_spillable;
-    } else {
+    } else if (_rChild != NULL) {
       right_spillable = _rChild->cisc_spill_match(globals, registers, mRule2->_rChild, operand, reg_type);
     }
 
diff --git a/hotspot/src/share/vm/asm/assembler.hpp b/hotspot/src/share/vm/asm/assembler.hpp
index 2ef9d99..a7b523d 100644
--- a/hotspot/src/share/vm/asm/assembler.hpp
+++ b/hotspot/src/share/vm/asm/assembler.hpp
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1997, 2014, 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
@@ -33,6 +33,7 @@
 #include "runtime/vm_version.hpp"
 #include "utilities/debug.hpp"
 #include "utilities/growableArray.hpp"
+#include "utilities/macros.hpp"
 
 // This file contains platform-independent assembler declarations.
 
@@ -337,6 +338,15 @@
   //
   // We must remember the code section (insts or stubs) in c1
   // so we can reset to the proper section in end_a_const().
+  address int_constant(jint c) {
+    CodeSection* c1 = _code_section;
+    address ptr = start_a_const(sizeof(c), sizeof(c));
+    if (ptr != NULL) {
+      emit_int32(c);
+      end_a_const(c1);
+    }
+    return ptr;
+  }
   address long_constant(jlong c) {
     CodeSection* c1 = _code_section;
     address ptr = start_a_const(sizeof(c), sizeof(c));
@@ -417,24 +427,6 @@
 
 };
 
-#ifdef TARGET_ARCH_x86
-# include "assembler_x86.hpp"
-#endif
-#ifdef TARGET_ARCH_sparc
-# include "assembler_sparc.hpp"
-#endif
-#ifdef TARGET_ARCH_zero
-# include "assembler_zero.hpp"
-#endif
-#ifdef TARGET_ARCH_arm
-# include "assembler_arm.hpp"
-#endif
-#ifdef TARGET_ARCH_ppc
-# include "assembler_ppc.hpp"
-#endif
-#ifdef TARGET_ARCH_aarch64
-# include "assembler_aarch64.hpp"
-#endif
-
+#include CPU_HEADER(assembler)
 
 #endif // SHARE_VM_ASM_ASSEMBLER_HPP
diff --git a/hotspot/src/share/vm/asm/assembler.inline.hpp b/hotspot/src/share/vm/asm/assembler.inline.hpp
index 1a48cb3..8b35e12 100644
--- a/hotspot/src/share/vm/asm/assembler.inline.hpp
+++ b/hotspot/src/share/vm/asm/assembler.inline.hpp
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1997, 2010, 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,23 +27,6 @@
 
 #include "asm/assembler.hpp"
 
-#ifdef TARGET_ARCH_x86
-# include "assembler_x86.inline.hpp"
-#endif
-#ifdef TARGET_ARCH_sparc
-# include "assembler_sparc.inline.hpp"
-#endif
-#ifdef TARGET_ARCH_zero
-# include "assembler_zero.inline.hpp"
-#endif
-#ifdef TARGET_ARCH_arm
-# include "assembler_arm.inline.hpp"
-#endif
-#ifdef TARGET_ARCH_ppc
-# include "assembler_ppc.inline.hpp"
-#endif
-#ifdef TARGET_ARCH_aarch64
-# include "assembler_aarch64.inline.hpp"
-#endif
+#include CPU_HEADER_INLINE(assembler)
 
 #endif // SHARE_VM_ASM_ASSEMBLER_INLINE_HPP
diff --git a/hotspot/src/share/vm/asm/codeBuffer.hpp b/hotspot/src/share/vm/asm/codeBuffer.hpp
index aefcbab..a6c0e84 100644
--- a/hotspot/src/share/vm/asm/codeBuffer.hpp
+++ b/hotspot/src/share/vm/asm/codeBuffer.hpp
@@ -28,6 +28,7 @@
 #include "code/oopRecorder.hpp"
 #include "code/relocInfo.hpp"
 #include "utilities/debug.hpp"
+#include "utilities/macros.hpp"
 
 class CodeStrings;
 class PhaseCFG;
@@ -633,24 +634,7 @@
 
 
   // The following header contains architecture-specific implementations
-#ifdef TARGET_ARCH_x86
-# include "codeBuffer_x86.hpp"
-#endif
-#ifdef TARGET_ARCH_sparc
-# include "codeBuffer_sparc.hpp"
-#endif
-#ifdef TARGET_ARCH_zero
-# include "codeBuffer_zero.hpp"
-#endif
-#ifdef TARGET_ARCH_arm
-# include "codeBuffer_arm.hpp"
-#endif
-#ifdef TARGET_ARCH_ppc
-# include "codeBuffer_ppc.hpp"
-#endif
-#ifdef TARGET_ARCH_aarch64
-# include "codeBuffer_aarch64.hpp"
-#endif
+#include CPU_HEADER(codeBuffer)
 
 };
 
diff --git a/hotspot/src/share/vm/asm/macroAssembler.hpp b/hotspot/src/share/vm/asm/macroAssembler.hpp
index 1482eb6..84289ff 100644
--- a/hotspot/src/share/vm/asm/macroAssembler.hpp
+++ b/hotspot/src/share/vm/asm/macroAssembler.hpp
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2012, 2013, 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
@@ -26,24 +26,8 @@
 #define SHARE_VM_ASM_MACROASSEMBLER_HPP
 
 #include "asm/assembler.hpp"
+#include "utilities/macros.hpp"
 
-#ifdef TARGET_ARCH_x86
-# include "macroAssembler_x86.hpp"
-#endif
-#ifdef TARGET_ARCH_sparc
-# include "macroAssembler_sparc.hpp"
-#endif
-#ifdef TARGET_ARCH_zero
-# include "assembler_zero.hpp"
-#endif
-#ifdef TARGET_ARCH_arm
-# include "macroAssembler_arm.hpp"
-#endif
-#ifdef TARGET_ARCH_ppc
-# include "macroAssembler_ppc.hpp"
-#endif
-#ifdef TARGET_ARCH_aarch64
-# include "macroAssembler_aarch64.hpp"
-#endif
+#include CPU_HEADER(macroAssembler)
 
 #endif // SHARE_VM_ASM_MACROASSEMBLER_HPP
diff --git a/hotspot/src/share/vm/asm/macroAssembler.inline.hpp b/hotspot/src/share/vm/asm/macroAssembler.inline.hpp
index db3daa5..51a1f72 100644
--- a/hotspot/src/share/vm/asm/macroAssembler.inline.hpp
+++ b/hotspot/src/share/vm/asm/macroAssembler.inline.hpp
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2012, 2013, 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
@@ -26,24 +26,6 @@
 #define SHARE_VM_ASM_MACROASSEMBLER_INLINE_HPP
 
 #include "asm/macroAssembler.hpp"
-
-#ifdef TARGET_ARCH_x86
-// no macroAssembler_x86.inline.hpp
-#endif
-#ifdef TARGET_ARCH_sparc
-# include "macroAssembler_sparc.inline.hpp"
-#endif
-#ifdef TARGET_ARCH_zero
-# include "assembler_zero.inline.hpp"
-#endif
-#ifdef TARGET_ARCH_arm
-# include "macroAssembler_arm.inline.hpp"
-#endif
-#ifdef TARGET_ARCH_ppc
-# include "macroAssembler_ppc.inline.hpp"
-#endif
-#ifdef TARGET_ARCH_aarch64
-# include "macroAssembler_aarch64.inline.hpp"
-#endif
+#include CPU_HEADER_INLINE(macroAssembler)
 
 #endif // SHARE_VM_ASM_MACROASSEMBLER_INLINE_HPP
diff --git a/hotspot/src/share/vm/asm/register.hpp b/hotspot/src/share/vm/asm/register.hpp
index e258e86..3c71d94 100644
--- a/hotspot/src/share/vm/asm/register.hpp
+++ b/hotspot/src/share/vm/asm/register.hpp
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2000, 2014, 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
@@ -27,6 +27,7 @@
 
 #include "utilities/debug.hpp"
 #include "utilities/globalDefinitions.hpp"
+#include "utilities/macros.hpp"
 
 // Use AbstractRegister as shortcut
 class AbstractRegisterImpl;
@@ -94,25 +95,7 @@
 #define REGISTER_DEFINITION(type, name) \
 const type name = ((type)name##_##type##EnumValue)
 
-#ifdef TARGET_ARCH_x86
-# include "register_x86.hpp"
-#endif
-#ifdef TARGET_ARCH_sparc
-# include "register_sparc.hpp"
-#endif
-#ifdef TARGET_ARCH_zero
-# include "register_zero.hpp"
-#endif
-#ifdef TARGET_ARCH_arm
-# include "register_arm.hpp"
-#endif
-#ifdef TARGET_ARCH_ppc
-# include "register_ppc.hpp"
-#endif
-#ifdef TARGET_ARCH_aarch64
-# include "register_aarch64.hpp"
-#endif
-
+#include CPU_HEADER(register)
 
 // Debugging support
 
diff --git a/hotspot/src/share/vm/c1/c1_Compilation.hpp b/hotspot/src/share/vm/c1/c1_Compilation.hpp
index a60d1fd..bca812f 100644
--- a/hotspot/src/share/vm/c1/c1_Compilation.hpp
+++ b/hotspot/src/share/vm/c1/c1_Compilation.hpp
@@ -194,12 +194,7 @@
   const char* bailout_msg() const                { return _bailout_msg; }
 
   static int desired_max_code_buffer_size() {
-#ifndef PPC32
-    return (int) NMethodSizeLimit;  // default 256K or 512K
-#else
-    // conditional branches on PPC are restricted to 16 bit signed
-    return MIN2((unsigned int)NMethodSizeLimit,32*K);
-#endif
+    return (int)NMethodSizeLimit;  // default 64K
   }
   static int desired_max_constant_size() {
     return desired_max_code_buffer_size() / 10;
diff --git a/hotspot/src/share/vm/c1/c1_Defs.hpp b/hotspot/src/share/vm/c1/c1_Defs.hpp
index 79320b8..9cd61c4 100644
--- a/hotspot/src/share/vm/c1/c1_Defs.hpp
+++ b/hotspot/src/share/vm/c1/c1_Defs.hpp
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2000, 2014, 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
@@ -25,8 +25,9 @@
 #ifndef SHARE_VM_C1_C1_DEFS_HPP
 #define SHARE_VM_C1_C1_DEFS_HPP
 
-#include "utilities/globalDefinitions.hpp"
 #include "asm/register.hpp"
+#include "utilities/globalDefinitions.hpp"
+#include "utilities/macros.hpp"
 
 // set frame size and return address offset to these values in blobs
 // (if the compiled frame uses ebp as link pointer on IA; otherwise,
@@ -35,23 +36,7 @@
   no_frame_size            = -1
 };
 
-
-#ifdef TARGET_ARCH_x86
-# include "c1_Defs_x86.hpp"
-#endif
-#ifdef TARGET_ARCH_sparc
-# include "c1_Defs_sparc.hpp"
-#endif
-#ifdef TARGET_ARCH_arm
-# include "c1_Defs_arm.hpp"
-#endif
-#ifdef TARGET_ARCH_ppc
-# include "c1_Defs_ppc.hpp"
-#endif
-#ifdef TARGET_ARCH_aarch64
-# include "c1_Defs_aarch64.hpp"
-#endif
-
+#include CPU_HEADER(c1_Defs)
 
 // native word offsets from memory address
 enum {
diff --git a/hotspot/src/share/vm/c1/c1_FpuStackSim.hpp b/hotspot/src/share/vm/c1/c1_FpuStackSim.hpp
index 491b064..3094bbe 100644
--- a/hotspot/src/share/vm/c1/c1_FpuStackSim.hpp
+++ b/hotspot/src/share/vm/c1/c1_FpuStackSim.hpp
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2005, 2011, 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
@@ -27,26 +27,12 @@
 
 #include "c1/c1_FrameMap.hpp"
 #include "memory/allocation.hpp"
+#include "utilities/macros.hpp"
 
 // Provides location for forward declaration of this class, which is
 // only implemented on Intel
 class FpuStackSim;
 
-#ifdef TARGET_ARCH_x86
-# include "c1_FpuStackSim_x86.hpp"
-#endif
-#ifdef TARGET_ARCH_sparc
-# include "c1_FpuStackSim_sparc.hpp"
-#endif
-#ifdef TARGET_ARCH_arm
-# include "c1_FpuStackSim_arm.hpp"
-#endif
-#ifdef TARGET_ARCH_ppc
-# include "c1_FpuStackSim_ppc.hpp"
-#endif
-#ifdef TARGET_ARCH_aarch64
-# include "c1_FpuStackSim_aarch64.hpp"
-#endif
-
+#include CPU_HEADER(c1_FpuStackSim)
 
 #endif // SHARE_VM_C1_C1_FPUSTACKSIM_HPP
diff --git a/hotspot/src/share/vm/c1/c1_FrameMap.hpp b/hotspot/src/share/vm/c1/c1_FrameMap.hpp
index 5e29ca3..33aa9a3 100644
--- a/hotspot/src/share/vm/c1/c1_FrameMap.hpp
+++ b/hotspot/src/share/vm/c1/c1_FrameMap.hpp
@@ -33,6 +33,7 @@
 #include "runtime/frame.hpp"
 #include "runtime/synchronizer.hpp"
 #include "utilities/globalDefinitions.hpp"
+#include "utilities/macros.hpp"
 
 class ciMethod;
 class CallingConvention;
@@ -80,22 +81,7 @@
     spill_slot_size_in_bytes = 4
   };
 
-#ifdef TARGET_ARCH_x86
-# include "c1_FrameMap_x86.hpp"
-#endif
-#ifdef TARGET_ARCH_sparc
-# include "c1_FrameMap_sparc.hpp"
-#endif
-#ifdef TARGET_ARCH_arm
-# include "c1_FrameMap_arm.hpp"
-#endif
-#ifdef TARGET_ARCH_ppc
-# include "c1_FrameMap_ppc.hpp"
-#endif
-#ifdef TARGET_ARCH_aarch64
-# include "c1_FrameMap_aarch64.hpp"
-#endif
-
+#include CPU_HEADER(c1_FrameMap)
 
   friend class LIR_OprDesc;
 
diff --git a/hotspot/src/share/vm/c1/c1_LIR.cpp b/hotspot/src/share/vm/c1/c1_LIR.cpp
index c650ec0..ced682b 100644
--- a/hotspot/src/share/vm/c1/c1_LIR.cpp
+++ b/hotspot/src/share/vm/c1/c1_LIR.cpp
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2000, 2015, 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
@@ -42,44 +42,6 @@
   return FrameMap::cpu_rnr2reg(cpu_regnrHi());
 }
 
-#if defined(X86)
-
-XMMRegister LIR_OprDesc::as_xmm_float_reg() const {
-  return FrameMap::nr2xmmreg(xmm_regnr());
-}
-
-XMMRegister LIR_OprDesc::as_xmm_double_reg() const {
-  assert(xmm_regnrLo() == xmm_regnrHi(), "assumed in calculation");
-  return FrameMap::nr2xmmreg(xmm_regnrLo());
-}
-
-#endif // X86
-
-#if defined(SPARC) || defined(PPC32)
-
-FloatRegister LIR_OprDesc::as_float_reg() const {
-  return FrameMap::nr2floatreg(fpu_regnr());
-}
-
-FloatRegister LIR_OprDesc::as_double_reg() const {
-  return FrameMap::nr2floatreg(fpu_regnrHi());
-}
-
-#endif
-
-#if defined(ARM) || defined(AARCH64) || defined(PPC64)
-
-FloatRegister LIR_OprDesc::as_float_reg() const {
-  return as_FloatRegister(fpu_regnr());
-}
-
-FloatRegister LIR_OprDesc::as_double_reg() const {
-  return as_FloatRegister(fpu_regnrLo());
-}
-
-#endif
-
-
 LIR_Opr LIR_OprFact::illegalOpr = LIR_OprFact::illegal();
 
 LIR_Opr LIR_OprFact::value_type(ValueType* type) {
@@ -140,32 +102,6 @@
   return LIR_Address::times_1;
 }
 
-
-#ifndef PRODUCT
-void LIR_Address::verify0() const {
-#if defined(SPARC) || defined(PPC)
-  assert(scale() == times_1, "Scaled addressing mode not available on SPARC/PPC and should not be used");
-  assert(disp() == 0 || index()->is_illegal(), "can't have both");
-#endif
-#ifdef _LP64
-  assert(base()->is_cpu_register(), "wrong base operand");
-#ifndef AARCH64
-  assert(index()->is_illegal() || index()->is_double_cpu(), "wrong index operand");
-#else
-  assert(index()->is_illegal() || index()->is_double_cpu() || index()->is_single_cpu(), "wrong index operand");
-#endif
-  assert(base()->type() == T_OBJECT || base()->type() == T_LONG || base()->type() == T_METADATA,
-         "wrong type for addresses");
-#else
-  assert(base()->is_single_cpu(), "wrong base operand");
-  assert(index()->is_illegal() || index()->is_single_cpu(), "wrong index operand");
-  assert(base()->type() == T_OBJECT || base()->type() == T_INT || base()->type() == T_METADATA,
-         "wrong type for addresses");
-#endif
-}
-#endif
-
-
 //---------------------------------------------------
 
 char LIR_OprDesc::type_char(BasicType t) {
diff --git a/hotspot/src/share/vm/c1/c1_LIR.hpp b/hotspot/src/share/vm/c1/c1_LIR.hpp
index 2943b38..7ca75ff 100644
--- a/hotspot/src/share/vm/c1/c1_LIR.hpp
+++ b/hotspot/src/share/vm/c1/c1_LIR.hpp
@@ -28,6 +28,7 @@
 #include "c1/c1_Defs.hpp"
 #include "c1/c1_ValueType.hpp"
 #include "oops/method.hpp"
+#include "utilities/globalDefinitions.hpp"
 
 class BlockBegin;
 class BlockList;
@@ -438,15 +439,13 @@
     return as_register();
   }
 
-#ifdef X86
-  XMMRegister as_xmm_float_reg() const;
-  XMMRegister as_xmm_double_reg() const;
-  // for compatibility with RInfo
-  int fpu () const                                  { return lo_reg_half(); }
-#endif
-#if defined(SPARC) || defined(ARM) || defined(PPC) || defined(AARCH64)
   FloatRegister as_float_reg   () const;
   FloatRegister as_double_reg  () const;
+#ifdef X86
+  XMMRegister as_xmm_float_reg () const;
+  XMMRegister as_xmm_double_reg() const;
+  // for compatibility with RInfo
+  int fpu() const { return lo_reg_half(); }
 #endif
 
   jint      as_jint()    const { return as_constant_ptr()->as_jint(); }
@@ -534,14 +533,19 @@
      , _type(type)
      , _disp(0) { verify(); }
 
-#if defined(X86) || defined(ARM) || defined(AARCH64)
+  LIR_Address(LIR_Opr base, LIR_Opr index, intx disp, BasicType type):
+       _base(base)
+     , _index(index)
+     , _scale(times_1)
+     , _type(type)
+     , _disp(disp) { verify(); }
+
   LIR_Address(LIR_Opr base, LIR_Opr index, Scale scale, intx disp, BasicType type):
        _base(base)
      , _index(index)
      , _scale(scale)
      , _type(type)
      , _disp(disp) { verify(); }
-#endif // X86 || ARM
 
   LIR_Opr base()  const                          { return _base;  }
   LIR_Opr index() const                          { return _index; }
@@ -554,13 +558,7 @@
   virtual BasicType type() const                 { return _type; }
   virtual void print_value_on(outputStream* out) const PRODUCT_RETURN;
 
-  void verify0() const PRODUCT_RETURN;
-#if defined(LIR_ADDRESS_PD_VERIFY) && !defined(PRODUCT)
-  void pd_verify() const;
-  void verify() const { pd_verify(); }
-#else
-  void verify() const { verify0(); }
-#endif
+  void verify() const PRODUCT_RETURN;
 
   static Scale scale(BasicType type);
 };
@@ -605,59 +603,49 @@
                                LIR_OprDesc::double_size);
   }
 
-  static LIR_Opr single_fpu(int reg)            { return (LIR_Opr)(intptr_t)((reg  << LIR_OprDesc::reg1_shift) |
-                                                                             LIR_OprDesc::float_type           |
-                                                                             LIR_OprDesc::fpu_register         |
-                                                                             LIR_OprDesc::single_size); }
-#if defined(ARM32)
-  static LIR_Opr double_fpu(int reg1, int reg2)    { return (LIR_Opr)((reg1 << LIR_OprDesc::reg1_shift) | (reg2 << LIR_OprDesc::reg2_shift) | LIR_OprDesc::double_type | LIR_OprDesc::fpu_register | LIR_OprDesc::double_size); }
-  static LIR_Opr single_softfp(int reg)            { return (LIR_Opr)((reg  << LIR_OprDesc::reg1_shift) |                                     LIR_OprDesc::float_type  | LIR_OprDesc::cpu_register | LIR_OprDesc::single_size); }
-  static LIR_Opr double_softfp(int reg1, int reg2) { return (LIR_Opr)((reg1 << LIR_OprDesc::reg1_shift) | (reg2 << LIR_OprDesc::reg2_shift) | LIR_OprDesc::double_type | LIR_OprDesc::cpu_register | LIR_OprDesc::double_size); }
-#endif
-#ifdef SPARC
-  static LIR_Opr double_fpu(int reg1, int reg2) { return (LIR_Opr)(intptr_t)((reg1 << LIR_OprDesc::reg1_shift) |
-                                                                             (reg2 << LIR_OprDesc::reg2_shift) |
-                                                                             LIR_OprDesc::double_type          |
-                                                                             LIR_OprDesc::fpu_register         |
-                                                                             LIR_OprDesc::double_size); }
-#endif
-#if defined(X86) || defined(AARCH64)
-  static LIR_Opr double_fpu(int reg)            { return (LIR_Opr)(intptr_t)((reg  << LIR_OprDesc::reg1_shift) |
-                                                                             (reg  << LIR_OprDesc::reg2_shift) |
-                                                                             LIR_OprDesc::double_type          |
-                                                                             LIR_OprDesc::fpu_register         |
-                                                                             LIR_OprDesc::double_size); }
+  static LIR_Opr single_fpu(int reg) {
+    return (LIR_Opr)(intptr_t)((reg  << LIR_OprDesc::reg1_shift) |
+                               LIR_OprDesc::float_type           |
+                               LIR_OprDesc::fpu_register         |
+                               LIR_OprDesc::single_size);
+  }
 
-  static LIR_Opr single_xmm(int reg)            { return (LIR_Opr)(intptr_t)((reg  << LIR_OprDesc::reg1_shift) |
-                                                                             LIR_OprDesc::float_type           |
-                                                                             LIR_OprDesc::fpu_register         |
-                                                                             LIR_OprDesc::single_size          |
-                                                                             LIR_OprDesc::is_xmm_mask); }
-  static LIR_Opr double_xmm(int reg)            { return (LIR_Opr)(intptr_t)((reg  << LIR_OprDesc::reg1_shift) |
-                                                                             (reg  << LIR_OprDesc::reg2_shift) |
-                                                                             LIR_OprDesc::double_type          |
-                                                                             LIR_OprDesc::fpu_register         |
-                                                                             LIR_OprDesc::double_size          |
-                                                                             LIR_OprDesc::is_xmm_mask); }
+  // Platform dependant.
+  static LIR_Opr double_fpu(int reg1, int reg2 = -1 /*fnoreg*/);
+
+#ifdef __SOFTFP__
+  static LIR_Opr single_softfp(int reg) {
+    return (LIR_Opr)(intptr_t)((reg  << LIR_OprDesc::reg1_shift) |
+                               LIR_OprDesc::float_type           |
+                               LIR_OprDesc::cpu_register         |
+                               LIR_OprDesc::single_size);
+  }
+  static LIR_Opr double_softfp(int reg1, int reg2) {
+    return (LIR_Opr)(intptr_t)((reg1 << LIR_OprDesc::reg1_shift) |
+                               (reg2 << LIR_OprDesc::reg2_shift) |
+                               LIR_OprDesc::double_type          |
+                               LIR_OprDesc::cpu_register         |
+                               LIR_OprDesc::double_size);
+  }
+#endif // __SOFTFP__
+
+#if defined(X86)
+  static LIR_Opr single_xmm(int reg) {
+    return (LIR_Opr)(intptr_t)((reg << LIR_OprDesc::reg1_shift) |
+                               LIR_OprDesc::float_type          |
+                               LIR_OprDesc::fpu_register        |
+                               LIR_OprDesc::single_size         |
+                               LIR_OprDesc::is_xmm_mask);
+  }
+  static LIR_Opr double_xmm(int reg) {
+    return (LIR_Opr)(intptr_t)((reg << LIR_OprDesc::reg1_shift) |
+                               (reg << LIR_OprDesc::reg2_shift) |
+                               LIR_OprDesc::double_type         |
+                               LIR_OprDesc::fpu_register        |
+                               LIR_OprDesc::double_size         |
+                               LIR_OprDesc::is_xmm_mask);
+  }
 #endif // X86
-#if defined(PPC)
-  static LIR_Opr double_fpu(int reg)            { return (LIR_Opr)(intptr_t)((reg  << LIR_OprDesc::reg1_shift) |
-                                                                             (reg  << LIR_OprDesc::reg2_shift) |
-                                                                             LIR_OprDesc::double_type          |
-                                                                             LIR_OprDesc::fpu_register         |
-                                                                             LIR_OprDesc::double_size); }
-#endif
-#ifdef PPC32
-  static LIR_Opr single_softfp(int reg)            { return (LIR_Opr)((reg  << LIR_OprDesc::reg1_shift)        |
-                                                                             LIR_OprDesc::float_type           |
-                                                                             LIR_OprDesc::cpu_register         |
-                                                                             LIR_OprDesc::single_size); }
-  static LIR_Opr double_softfp(int reg1, int reg2) { return (LIR_Opr)((reg2 << LIR_OprDesc::reg1_shift)        |
-                                                                             (reg1 << LIR_OprDesc::reg2_shift) |
-                                                                             LIR_OprDesc::double_type          |
-                                                                             LIR_OprDesc::cpu_register         |
-                                                                             LIR_OprDesc::double_size); }
-#endif // PPC32
 
   static LIR_Opr virtual_register(int index, BasicType type) {
     LIR_Opr res;
@@ -1467,37 +1455,15 @@
  private:
    Bytecodes::Code _bytecode;
    ConversionStub* _stub;
-#ifdef PPC32
-  LIR_Opr _tmp1;
-  LIR_Opr _tmp2;
-#endif
 
  public:
    LIR_OpConvert(Bytecodes::Code code, LIR_Opr opr, LIR_Opr result, ConversionStub* stub)
      : LIR_Op1(lir_convert, opr, result)
      , _stub(stub)
-#ifdef PPC32
-     , _tmp1(LIR_OprDesc::illegalOpr())
-     , _tmp2(LIR_OprDesc::illegalOpr())
-#endif
      , _bytecode(code)                           {}
 
-#ifdef PPC32
-   LIR_OpConvert(Bytecodes::Code code, LIR_Opr opr, LIR_Opr result, ConversionStub* stub
-                 ,LIR_Opr tmp1, LIR_Opr tmp2)
-     : LIR_Op1(lir_convert, opr, result)
-     , _stub(stub)
-     , _tmp1(tmp1)
-     , _tmp2(tmp2)
-     , _bytecode(code)                           {}
-#endif
-
   Bytecodes::Code bytecode() const               { return _bytecode; }
   ConversionStub* stub() const                   { return _stub; }
-#ifdef PPC32
-  LIR_Opr tmp1() const                           { return _tmp1; }
-  LIR_Opr tmp2() const                           { return _tmp2; }
-#endif
 
   virtual void emit_code(LIR_Assembler* masm);
   virtual LIR_OpConvert* as_OpConvert() { return this; }
@@ -2136,9 +2102,6 @@
 
   void safepoint(LIR_Opr tmp, CodeEmitInfo* info)  { append(new LIR_Op1(lir_safepoint, tmp, info)); }
 
-#ifdef PPC32
-  void convert(Bytecodes::Code code, LIR_Opr left, LIR_Opr dst, LIR_Opr tmp1, LIR_Opr tmp2) { append(new LIR_OpConvert(code, left, dst, NULL, tmp1, tmp2)); }
-#endif
   void convert(Bytecodes::Code code, LIR_Opr left, LIR_Opr dst, ConversionStub* stub = NULL/*, bool is_32bit = false*/) { append(new LIR_OpConvert(code, left, dst, stub)); }
 
   void logical_and (LIR_Opr left, LIR_Opr right, LIR_Opr dst) { append(new LIR_Op2(lir_logic_and,  left, right, dst)); }
diff --git a/hotspot/src/share/vm/c1/c1_LIRAssembler.hpp b/hotspot/src/share/vm/c1/c1_LIRAssembler.hpp
index c7d3170..c0d39d6 100644
--- a/hotspot/src/share/vm/c1/c1_LIRAssembler.hpp
+++ b/hotspot/src/share/vm/c1/c1_LIRAssembler.hpp
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2000, 2015, 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
@@ -28,6 +28,7 @@
 #include "c1/c1_CodeStubs.hpp"
 #include "ci/ciMethodData.hpp"
 #include "oops/methodData.hpp"
+#include "utilities/macros.hpp"
 
 class Compilation;
 class ScopeValue;
@@ -257,21 +258,7 @@
 
   void atomic_op(LIR_Code code, LIR_Opr src, LIR_Opr data, LIR_Opr dest, LIR_Opr tmp);
 
-#ifdef TARGET_ARCH_x86
-# include "c1_LIRAssembler_x86.hpp"
-#endif
-#ifdef TARGET_ARCH_sparc
-# include "c1_LIRAssembler_sparc.hpp"
-#endif
-#ifdef TARGET_ARCH_arm
-# include "c1_LIRAssembler_arm.hpp"
-#endif
-#ifdef TARGET_ARCH_ppc
-# include "c1_LIRAssembler_ppc.hpp"
-#endif
-#ifdef TARGET_ARCH_aarch64
-# include "c1_LIRAssembler_aarch64.hpp"
-#endif
+#include CPU_HEADER(c1_LIRAssembler)
 
 };
 
diff --git a/hotspot/src/share/vm/c1/c1_LIRGenerator.cpp b/hotspot/src/share/vm/c1/c1_LIRGenerator.cpp
index 53701de..a0f9454 100644
--- a/hotspot/src/share/vm/c1/c1_LIRGenerator.cpp
+++ b/hotspot/src/share/vm/c1/c1_LIRGenerator.cpp
@@ -3434,7 +3434,7 @@
   __ load(counter, result);
   __ add(result, LIR_OprFact::intConst(InvocationCounter::count_increment), result);
   __ store(result, counter);
-  if (notify) {
+  if (notify && (!backedge || UseOnStackReplacement)) {
     LIR_Opr meth = LIR_OprFact::metadataConst(method->constant_encoding());
     // The bci for info can point to cmp for if's we want the if bci
     CodeStub* overflow = new CounterOverflowStub(info, bci, meth);
diff --git a/hotspot/src/share/vm/c1/c1_LinearScan.hpp b/hotspot/src/share/vm/c1/c1_LinearScan.hpp
index 00ed78f..54ce364 100644
--- a/hotspot/src/share/vm/c1/c1_LinearScan.hpp
+++ b/hotspot/src/share/vm/c1/c1_LinearScan.hpp
@@ -31,6 +31,7 @@
 #include "c1/c1_Instruction.hpp"
 #include "c1/c1_LIR.hpp"
 #include "c1/c1_LIRGenerator.hpp"
+#include "utilities/macros.hpp"
 
 class DebugInfoCache;
 class FpuStackAllocator;
@@ -959,23 +960,7 @@
 
 #endif // ifndef PRODUCT
 
-
 // Pick up platform-dependent implementation details
-#ifdef TARGET_ARCH_x86
-# include "c1_LinearScan_x86.hpp"
-#endif
-#ifdef TARGET_ARCH_sparc
-# include "c1_LinearScan_sparc.hpp"
-#endif
-#ifdef TARGET_ARCH_arm
-# include "c1_LinearScan_arm.hpp"
-#endif
-#ifdef TARGET_ARCH_ppc
-# include "c1_LinearScan_ppc.hpp"
-#endif
-#ifdef TARGET_ARCH_aarch64
-# include "c1_LinearScan_aarch64.hpp"
-#endif
-
+#include CPU_HEADER(c1_LinearScan)
 
 #endif // SHARE_VM_C1_C1_LINEARSCAN_HPP
diff --git a/hotspot/src/share/vm/c1/c1_MacroAssembler.hpp b/hotspot/src/share/vm/c1/c1_MacroAssembler.hpp
index 7493766..7607a08 100644
--- a/hotspot/src/share/vm/c1/c1_MacroAssembler.hpp
+++ b/hotspot/src/share/vm/c1/c1_MacroAssembler.hpp
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2000, 2012, 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
@@ -27,6 +27,7 @@
 
 #include "asm/macroAssembler.hpp"
 #include "asm/macroAssembler.inline.hpp"
+#include "utilities/macros.hpp"
 
 class CodeEmitInfo;
 
@@ -47,21 +48,7 @@
   void verify_stack_oop(int offset) PRODUCT_RETURN;
   void verify_not_null_oop(Register r)  PRODUCT_RETURN;
 
-#ifdef TARGET_ARCH_x86
-# include "c1_MacroAssembler_x86.hpp"
-#endif
-#ifdef TARGET_ARCH_sparc
-# include "c1_MacroAssembler_sparc.hpp"
-#endif
-#ifdef TARGET_ARCH_arm
-# include "c1_MacroAssembler_arm.hpp"
-#endif
-#ifdef TARGET_ARCH_ppc
-# include "c1_MacroAssembler_ppc.hpp"
-#endif
-#ifdef TARGET_ARCH_aarch64
-# include "c1_MacroAssembler_aarch64.hpp"
-#endif
+#include CPU_HEADER(c1_MacroAssembler)
 
 };
 
diff --git a/hotspot/src/share/vm/c1/c1_globals.hpp b/hotspot/src/share/vm/c1/c1_globals.hpp
index a7a0f2e..a07f844 100644
--- a/hotspot/src/share/vm/c1/c1_globals.hpp
+++ b/hotspot/src/share/vm/c1/c1_globals.hpp
@@ -26,36 +26,10 @@
 #define SHARE_VM_C1_C1_GLOBALS_HPP
 
 #include "runtime/globals.hpp"
-#ifdef TARGET_ARCH_x86
-# include "c1_globals_x86.hpp"
-#endif
-#ifdef TARGET_ARCH_sparc
-# include "c1_globals_sparc.hpp"
-#endif
-#ifdef TARGET_ARCH_arm
-# include "c1_globals_arm.hpp"
-#endif
-#ifdef TARGET_ARCH_ppc
-# include "c1_globals_ppc.hpp"
-#endif
-#ifdef TARGET_ARCH_aarch64
-# include "c1_globals_aarch64.hpp"
-#endif
-#ifdef TARGET_OS_FAMILY_linux
-# include "c1_globals_linux.hpp"
-#endif
-#ifdef TARGET_OS_FAMILY_solaris
-# include "c1_globals_solaris.hpp"
-#endif
-#ifdef TARGET_OS_FAMILY_windows
-# include "c1_globals_windows.hpp"
-#endif
-#ifdef TARGET_OS_FAMILY_aix
-# include "c1_globals_aix.hpp"
-#endif
-#ifdef TARGET_OS_FAMILY_bsd
-# include "c1_globals_bsd.hpp"
-#endif
+#include "utilities/macros.hpp"
+
+#include CPU_HEADER(c1_globals)
+#include OS_HEADER(c1_globals)
 
 //
 // Defines all global flags used by the client compiler.
diff --git a/hotspot/src/share/vm/ci/ciEnv.cpp b/hotspot/src/share/vm/ci/ciEnv.cpp
index 7bb8f75..323b75a 100644
--- a/hotspot/src/share/vm/ci/ciEnv.cpp
+++ b/hotspot/src/share/vm/ci/ciEnv.cpp
@@ -204,11 +204,13 @@
 }
 
 ciEnv::~ciEnv() {
-  CompilerThread* current_thread = CompilerThread::current();
-  _factory->remove_symbols();
-  // Need safepoint to clear the env on the thread.  RedefineClasses might
-  // be reading it.
-  GUARDED_VM_ENTRY(current_thread->set_env(NULL);)
+  GUARDED_VM_ENTRY(
+      CompilerThread* current_thread = CompilerThread::current();
+      _factory->remove_symbols();
+      // Need safepoint to clear the env on the thread.  RedefineClasses might
+      // be reading it.
+      current_thread->set_env(NULL);
+  )
 }
 
 // ------------------------------------------------------------------
diff --git a/hotspot/src/share/vm/ci/ciReplay.cpp b/hotspot/src/share/vm/ci/ciReplay.cpp
index 27b0002..ec78891 100644
--- a/hotspot/src/share/vm/ci/ciReplay.cpp
+++ b/hotspot/src/share/vm/ci/ciReplay.cpp
@@ -490,7 +490,8 @@
     int comp_level = parse_int(comp_level_label);
     // old version w/o comp_level
     if (had_error() && (error_message() == comp_level_label)) {
-      comp_level = CompLevel_full_optimization;
+      // use highest available tier
+      comp_level = TieredCompilation ? TieredStopAtLevel : CompLevel_highest_tier;
     }
     if (!is_valid_comp_level(comp_level)) {
       return;
diff --git a/hotspot/src/share/vm/classfile/classFileParser.cpp b/hotspot/src/share/vm/classfile/classFileParser.cpp
index c6155dd..0028f1a 100644
--- a/hotspot/src/share/vm/classfile/classFileParser.cpp
+++ b/hotspot/src/share/vm/classfile/classFileParser.cpp
@@ -5406,7 +5406,6 @@
                                  Symbol* name,
                                  ClassLoaderData* loader_data,
                                  Handle protection_domain,
-                                 TempNewSymbol* parsed_name,
                                  const Klass* host_klass,
                                  GrowableArray<Handle>* cp_patches,
                                  Publicity pub_level,
@@ -5416,7 +5415,6 @@
   _loader_data(loader_data),
   _host_klass(host_klass),
   _cp_patches(cp_patches),
-  _parsed_name(parsed_name),
   _super_klass(),
   _cp(NULL),
   _fields(NULL),
@@ -5657,15 +5655,6 @@
   Symbol* const class_name_in_cp = cp->klass_name_at(_this_class_index);
   assert(class_name_in_cp != NULL, "class_name can't be null");
 
-  if (_parsed_name != NULL) {
-    // It's important to set parsed_name *before* resolving the super class.
-    // (it's used for cleanup by the caller if parsing fails)
-    *_parsed_name = class_name_in_cp;
-    // parsed_name is returned and can be used if there's an error, so add to
-    // its reference count.  Caller will decrement the refcount.
-    (*_parsed_name)->increment_refcount();
-  }
-
   // Update _class_name which could be null previously
   // to reflect the name in the constant pool
   _class_name = class_name_in_cp;
@@ -5692,6 +5681,10 @@
     return;
   }
 
+  // Verification prevents us from creating names with dots in them, this
+  // asserts that that's the case.
+  assert(is_internal_format(_class_name), "external class name format used internally");
+
   if (!is_internal()) {
     if (log_is_enabled(Debug, class, preorder)){
       ResourceMark rm(THREAD);
@@ -5900,3 +5893,20 @@
 
   return _stream->clone();
 }
+// ----------------------------------------------------------------------------
+// debugging
+
+#ifdef ASSERT
+
+// return true if class_name contains no '.' (internal format is '/')
+bool ClassFileParser::is_internal_format(Symbol* class_name) {
+  if (class_name != NULL) {
+    ResourceMark rm;
+    char* name = class_name->as_C_string();
+    return strchr(name, '.') == NULL;
+  } else {
+    return true;
+  }
+}
+
+#endif
diff --git a/hotspot/src/share/vm/classfile/classFileParser.hpp b/hotspot/src/share/vm/classfile/classFileParser.hpp
index 47ec539..4b62875 100644
--- a/hotspot/src/share/vm/classfile/classFileParser.hpp
+++ b/hotspot/src/share/vm/classfile/classFileParser.hpp
@@ -81,7 +81,6 @@
   mutable ClassLoaderData* _loader_data;
   const Klass* _host_klass;
   GrowableArray<Handle>* _cp_patches; // overrides for CP entries
-  TempNewSymbol* _parsed_name;
 
   // Metadata created before the instance klass is created.  Must be deallocated
   // if not transferred to the InstanceKlass upon successful class loading
@@ -475,7 +474,6 @@
                   Symbol* name,
                   ClassLoaderData* loader_data,
                   Handle protection_domain,
-                  TempNewSymbol* parsed_name,
                   const Klass* host_klass,
                   GrowableArray<Handle>* cp_patches,
                   Publicity pub_level,
@@ -514,6 +512,11 @@
   bool is_internal() const { return INTERNAL == _pub_level; }
 
   static bool verify_unqualified_name(const char* name, unsigned int length, int type);
+
+#ifdef ASSERT
+  static bool is_internal_format(Symbol* class_name);
+#endif
+
 };
 
 #endif // SHARE_VM_CLASSFILE_CLASSFILEPARSER_HPP
diff --git a/hotspot/src/share/vm/classfile/classLoader.cpp b/hotspot/src/share/vm/classfile/classLoader.cpp
index 1186067..92bf8fe 100644
--- a/hotspot/src/share/vm/classfile/classLoader.cpp
+++ b/hotspot/src/share/vm/classfile/classLoader.cpp
@@ -141,11 +141,11 @@
 PerfCounter*    ClassLoader::_load_instance_class_failCounter = NULL;
 
 GrowableArray<ModuleClassPathList*>* ClassLoader::_xpatch_entries = NULL;
-ClassPathEntry* ClassLoader::_first_entry        = NULL;
-ClassPathEntry* ClassLoader::_last_entry         = NULL;
-int             ClassLoader::_num_entries        = 0;
+GrowableArray<ModuleClassPathList*>* ClassLoader::_exploded_entries = NULL;
+ClassPathEntry* ClassLoader::_jrt_entry = NULL;
 ClassPathEntry* ClassLoader::_first_append_entry = NULL;
-bool            ClassLoader::_has_jimage = false;
+ClassPathEntry* ClassLoader::_last_append_entry  = NULL;
+int             ClassLoader::_num_entries        = 0;
 #if INCLUDE_CDS
 GrowableArray<char*>* ClassLoader::_boot_modules_array = NULL;
 GrowableArray<char*>* ClassLoader::_platform_modules_array = NULL;
@@ -508,7 +508,7 @@
 #endif
 
       } else {
-        PackageEntry* package_entry = get_package_entry(name, ClassLoaderData::the_null_class_loader_data(), THREAD);
+        PackageEntry* package_entry = get_package_entry(name, ClassLoaderData::the_null_class_loader_data(), CHECK_NULL);
         if (package_entry != NULL) {
           ResourceMark rm;
           // Get the module name
@@ -651,7 +651,6 @@
 #endif
 
 void ClassLoader::setup_bootstrap_search_path() {
-  assert(_first_entry == NULL, "should not setup bootstrap class search path twice");
   const char* sys_class_path = Arguments::get_sysclasspath();
   const char* java_class_path = Arguments::get_appclasspath();
   if (PrintSharedArchiveAndExit) {
@@ -694,7 +693,10 @@
   GrowableArray<ModuleXPatchPath*>* xpatch_args = Arguments::get_xpatchprefix();
   int num_of_entries = xpatch_args->length();
 
-  // Set up the boot loader's xpatch_entries list
+  assert(!DumpSharedSpaces, "DumpSharedSpaces not supported with -Xpatch");
+  assert(!UseSharedSpaces, "UseSharedSpaces not supported with -Xpatch");
+
+  // Set up the boot loader's _xpatch_entries list
   _xpatch_entries = new (ResourceObj::C_HEAP, mtModule) GrowableArray<ModuleClassPathList*>(num_of_entries, true);
 
   for (int i = 0; i < num_of_entries; i++) {
@@ -742,10 +744,9 @@
 }
 
 void ClassLoader::setup_search_path(const char *class_path, bool bootstrap_search) {
-  int offset = 0;
   int len = (int)strlen(class_path);
   int end = 0;
-  bool mark_append_entry = false;
+  bool set_base_piece = bootstrap_search;
 
   // Iterate over class path entries
   for (int start = 0; start < len; start = end) {
@@ -754,21 +755,45 @@
     }
     EXCEPTION_MARK;
     ResourceMark rm(THREAD);
-    mark_append_entry = (mark_append_entry ||
-      (bootstrap_search && (start == Arguments::bootclassloader_append_index())));
     char* path = NEW_RESOURCE_ARRAY(char, end - start + 1);
     strncpy(path, &class_path[start], end - start);
     path[end - start] = '\0';
-    update_class_path_entry_list(path, false, mark_append_entry, false, bootstrap_search);
 
-    // Check on the state of the boot loader's append path
-    if (mark_append_entry && (_first_append_entry == NULL)) {
-      // Failure to mark the first append entry, most likely
-      // due to a non-existent path. Record the next entry
-      // as the first boot loader append entry.
-      mark_append_entry = true;
+    // The first time through the bootstrap_search setup, it must be determined
+    // what the base or core piece of the boot loader search is.  Either a java runtime
+    // image is present or this is an exploded module build situation.
+    if (set_base_piece) {
+      assert(string_ends_with(path, MODULES_IMAGE_NAME) || string_ends_with(path, "java.base"),
+             "Incorrect boot loader search path, no java runtime image or java.base exploded build");
+      struct stat st;
+      if (os::stat(path, &st) == 0) {
+        // Directory found
+        Thread* THREAD = Thread::current();
+        ClassPathEntry* new_entry = create_class_path_entry(path, &st, false, false, CHECK);
+
+        // Check for a jimage
+        if (Arguments::has_jimage()) {
+          assert(_jrt_entry == NULL, "should not setup bootstrap class search path twice");
+          assert(new_entry != NULL && new_entry->is_jrt(), "No java runtime image present");
+          _jrt_entry = new_entry;
+          ++_num_entries;
+#if INCLUDE_CDS
+          if (DumpSharedSpaces) {
+            JImageFile *jimage = _jrt_entry->jimage();
+            assert(jimage != NULL, "No java runtime image file present");
+            ClassLoader::initialize_module_loader_map(jimage);
+          }
+#endif
+        }
+      } else {
+        // If path does not exist, exit
+        vm_exit_during_initialization("Unable to establish the boot loader search path", path);
+      }
+      set_base_piece = false;
     } else {
-      mark_append_entry = false;
+      // Every entry on the system boot class path after the initial base piece,
+      // which is set by os::set_boot_path(), is considered an appended entry.
+      update_class_path_entry_list(path, false, bootstrap_search);
     }
 
 #if INCLUDE_CDS
@@ -782,6 +807,45 @@
   }
 }
 
+// During an exploded modules build, each module defined to the boot loader
+// will be added to the ClassLoader::_exploded_entries array.
+void ClassLoader::add_to_exploded_build_list(Symbol* module_sym, TRAPS) {
+  assert(!ClassLoader::has_jrt_entry(), "Exploded build not applicable");
+
+  // Set up the boot loader's _exploded_entries list
+  if (_exploded_entries == NULL) {
+    _exploded_entries = new (ResourceObj::C_HEAP, mtModule) GrowableArray<ModuleClassPathList*>(EXPLODED_ENTRY_SIZE, true);
+  }
+
+  // Find the module's symbol
+  ResourceMark rm(THREAD);
+  const char *module_name = module_sym->as_C_string();
+  const char *home = Arguments::get_java_home();
+  const char file_sep = os::file_separator()[0];
+  // 10 represents the length of "modules" + 2 file separators + \0
+  size_t len = strlen(home) + strlen(module_name) + 10;
+  char *path = NEW_C_HEAP_ARRAY(char, len, mtModule);
+  jio_snprintf(path, len, "%s%cmodules%c%s", home, file_sep, file_sep, module_name);
+
+  struct stat st;
+  if (os::stat(path, &st) == 0) {
+    // Directory found
+    ClassPathEntry* new_entry = create_class_path_entry(path, &st, false, false, CHECK);
+
+    // If the path specification is valid, enter it into this module's list.
+    // There is no need to check for duplicate modules in the exploded entry list,
+    // since no two modules with the same name can be defined to the boot loader.
+    // This is checked at module definition time in Modules::define_module.
+    if (new_entry != NULL) {
+      ModuleClassPathList* module_cpl = new ModuleClassPathList(module_sym);
+      module_cpl->add_to_list(new_entry);
+      _exploded_entries->push(module_cpl);
+      log_info(class, load)("path: %s", path);
+    }
+  }
+  FREE_C_HEAP_ARRAY(char, path);
+}
+
 ClassPathEntry* ClassLoader::create_class_path_entry(const char *path, const struct stat* st,
                                                      bool throw_exception,
                                                      bool is_boot_append, TRAPS) {
@@ -872,21 +936,9 @@
   return NULL;
 }
 
-// The boot class loader must adhere to specfic visibility rules.
-// Prior to loading a class in a named package, the package is checked
-// to see if it is in a module defined to the boot loader. If the
-// package is not in a module defined to the boot loader, the class
-// must be loaded only in the boot loader's append path, which
-// consists of [-Xbootclasspath/a]; [jvmti appended entries]
-void ClassLoader::set_first_append_entry(ClassPathEntry *new_entry) {
-  if (_first_append_entry == NULL) {
-    _first_append_entry = new_entry;
-  }
-}
-
 // returns true if entry already on class path
 bool ClassLoader::contains_entry(ClassPathEntry *entry) {
-  ClassPathEntry* e = _first_entry;
+  ClassPathEntry* e = _first_append_entry;
   while (e != NULL) {
     // assume zip entries have been canonicalized
     if (strcmp(entry->name(), e->name()) == 0) {
@@ -899,41 +951,24 @@
 
 void ClassLoader::add_to_list(ClassPathEntry *new_entry) {
   if (new_entry != NULL) {
-    if (_last_entry == NULL) {
-      _first_entry = _last_entry = new_entry;
+    if (_last_append_entry == NULL) {
+      assert(_first_append_entry == NULL, "boot loader's append class path entry list not empty");
+      _first_append_entry = _last_append_entry = new_entry;
     } else {
-      _last_entry->set_next(new_entry);
-      _last_entry = new_entry;
+      _last_append_entry->set_next(new_entry);
+      _last_append_entry = new_entry;
     }
   }
-  _num_entries ++;
-}
-
-void ClassLoader::prepend_to_list(ClassPathEntry *new_entry) {
-  if (new_entry != NULL) {
-    if (_last_entry == NULL) {
-      _first_entry = _last_entry = new_entry;
-    } else {
-      new_entry->set_next(_first_entry);
-      _first_entry = new_entry;
-    }
-  }
-  _num_entries ++;
+  _num_entries++;
 }
 
 void ClassLoader::add_to_list(const char *apath) {
-  update_class_path_entry_list((char*)apath, false, false, false, false);
-}
-
-void ClassLoader::prepend_to_list(const char *apath) {
-  update_class_path_entry_list((char*)apath, false, false, true, false);
+  update_class_path_entry_list((char*)apath, false, false);
 }
 
 // Returns true IFF the file/dir exists and the entry was successfully created.
 bool ClassLoader::update_class_path_entry_list(const char *path,
                                                bool check_for_duplicates,
-                                               bool mark_append_entry,
-                                               bool prepend_entry,
                                                bool is_boot_append,
                                                bool throw_exception) {
   struct stat st;
@@ -946,19 +981,10 @@
       return false;
     }
 
-    // Ensure that the first boot loader append entry will always be set correctly.
-    assert((!mark_append_entry ||
-            (mark_append_entry && (!check_for_duplicates || !contains_entry(new_entry)))),
-           "failed to mark boot loader's first append boundary");
-
     // Do not reorder the bootclasspath which would break get_system_package().
     // Add new entry to linked list
-
     if (!check_for_duplicates || !contains_entry(new_entry)) {
-      ClassLoaderExt::add_class_path_entry(path, check_for_duplicates, new_entry, prepend_entry);
-      if (mark_append_entry) {
-        set_first_append_entry(new_entry);
-      }
+      ClassLoaderExt::add_class_path_entry(path, check_for_duplicates, new_entry);
     }
     return true;
   } else {
@@ -971,30 +997,47 @@
   }
 }
 
+static void print_module_entry_table(const GrowableArray<ModuleClassPathList*>* const module_list) {
+  ResourceMark rm;
+  int num_of_entries = module_list->length();
+  for (int i = 0; i < num_of_entries; i++) {
+    ClassPathEntry* e;
+    ModuleClassPathList* mpl = module_list->at(i);
+    tty->print("%s=", mpl->module_name()->as_C_string());
+    e = mpl->module_first_entry();
+    while (e != NULL) {
+      tty->print("%s", e->name());
+      e = e->next();
+      if (e != NULL) {
+        tty->print("%s", os::path_separator());
+      }
+    }
+    tty->print(" ;");
+  }
+}
+
 void ClassLoader::print_bootclasspath() {
   ClassPathEntry* e;
   tty->print("[bootclasspath= ");
 
   // Print -Xpatch module/path specifications first
   if (_xpatch_entries != NULL) {
-    ResourceMark rm;
-    int num_of_entries = _xpatch_entries->length();
-    for (int i = 0; i < num_of_entries; i++) {
-      ModuleClassPathList* mpl = _xpatch_entries->at(i);
-      tty->print("%s=", mpl->module_name()->as_C_string());
-      e = mpl->module_first_entry();
-      while (e != NULL) {
-        tty->print("%s", e->name());
-        e = e->next();
-        if (e != NULL) {
-          tty->print("%s", os::path_separator());
-        }
-      }
-      tty->print(" ;");
+    print_module_entry_table(_xpatch_entries);
+  }
+
+  // [jimage | exploded modules build]
+  if (has_jrt_entry()) {
+    // Print the location of the java runtime image
+    tty->print("%s ;", _jrt_entry->name());
+  } else {
+    // Print exploded module build path specifications
+    if (_exploded_entries != NULL) {
+      print_module_entry_table(_exploded_entries);
     }
   }
 
-  e = _first_entry;
+  // appended entries
+  e = _first_append_entry;
   while (e != NULL) {
     tty->print("%s ;", e->name());
     e = e->next();
@@ -1298,6 +1341,60 @@
   return file_name;
 }
 
+// Search either the xpatch or exploded build entries for class
+ClassFileStream* ClassLoader::search_module_entries(const GrowableArray<ModuleClassPathList*>* const module_list,
+                                                    const char* const class_name, const char* const file_name, TRAPS) {
+  ClassFileStream* stream = NULL;
+
+  // Find the class' defining module in the boot loader's module entry table
+  PackageEntry* pkg_entry = get_package_entry(class_name, ClassLoaderData::the_null_class_loader_data(), CHECK_NULL);
+  ModuleEntry* mod_entry = (pkg_entry != NULL) ? pkg_entry->module() : NULL;
+
+  // If the module system has not defined java.base yet, then
+  // classes loaded are assumed to be defined to java.base.
+  // When java.base is eventually defined by the module system,
+  // all packages of classes that have been previously loaded
+  // are verified in ModuleEntryTable::verify_javabase_packages().
+  if (!Universe::is_module_initialized() &&
+      !ModuleEntryTable::javabase_defined() &&
+      mod_entry == NULL) {
+    mod_entry = ModuleEntryTable::javabase_module();
+  }
+
+  // The module must be a named module
+  if (mod_entry != NULL && mod_entry->is_named()) {
+    int num_of_entries = module_list->length();
+    const Symbol* class_module_name = mod_entry->name();
+
+    // Loop through all the modules in either the xpatch or exploded entries looking for module
+    for (int i = 0; i < num_of_entries; i++) {
+      ModuleClassPathList* module_cpl = module_list->at(i);
+      Symbol* module_cpl_name = module_cpl->module_name();
+
+      if (module_cpl_name->fast_compare(class_module_name) == 0) {
+        // Class' module has been located, attempt to load
+        // the class from the module's ClassPathEntry list.
+        ClassPathEntry* e = module_cpl->module_first_entry();
+        while (e != NULL) {
+          stream = e->open_stream(file_name, CHECK_NULL);
+          // No context.check is required since CDS is not supported
+          // for an exploded modules build or if -Xpatch is specified.
+          if (NULL != stream) {
+            return stream;
+          }
+          e = e->next();
+        }
+        // If the module was located, break out even if the class was not
+        // located successfully from that module's ClassPathEntry list.
+        // There will not be another valid entry for that module.
+        return NULL;
+      }
+    }
+  }
+
+  return NULL;
+}
+
 instanceKlassHandle ClassLoader::load_class(Symbol* name, bool search_append_only, TRAPS) {
   assert(name != NULL, "invariant");
   assert(THREAD->is_Java_thread(), "must be a JavaThread");
@@ -1321,18 +1418,19 @@
   s2 classpath_index = 0;
   ClassPathEntry* e = NULL;
 
-  // If DumpSharedSpaces is true, boot loader visibility boundaries are set
-  // to be _first_entry to the end (all path entries). No -Xpatch entries are
-  // included since CDS and AppCDS are not supported if -Xpatch is specified.
+  // If DumpSharedSpaces is true boot loader visibility boundaries are set to:
+  //   - [jimage] + [_first_append_entry to _last_append_entry] (all path entries).
+  // No -Xpatch entries or exploded module builds are included since CDS
+  // is not supported if -Xpatch or exploded module builds are used.
   //
   // If search_append_only is true, boot loader visibility boundaries are
   // set to be _first_append_entry to the end. This includes:
   //   [-Xbootclasspath/a]; [jvmti appended entries]
   //
   // If both DumpSharedSpaces and search_append_only are false, boot loader
-  // visibility boundaries are set to be _first_entry to the entry before
-  // the _first_append_entry.  This would include:
-  //   [-Xpatch:<module>=<file>(<pathsep><file>)*];  [exploded build | jimage]
+  // visibility boundaries are set to be the -Xpatch entries plus the base piece.
+  // This would include:
+  //   [-Xpatch:<module>=<file>(<pathsep><file>)*]; [jimage | exploded module build]
   //
   // DumpSharedSpaces and search_append_only are mutually exclusive and cannot
   // be true at the same time.
@@ -1341,85 +1439,37 @@
   // Load Attempt #1: -Xpatch
   // Determine the class' defining module.  If it appears in the _xpatch_entries,
   // attempt to load the class from those locations specific to the module.
+  // Specifications to -Xpatch can contain a partial number of classes
+  // that are part of the overall module definition.  So if a particular class is not
+  // found within its module specification, the search should continue to Load Attempt #2.
   // Note: The -Xpatch entries are never searched if the boot loader's
   //       visibility boundary is limited to only searching the append entries.
   if (_xpatch_entries != NULL && !search_append_only && !DumpSharedSpaces) {
-    // Find the module in the boot loader's module entry table
-    PackageEntry* pkg_entry = get_package_entry(class_name, ClassLoaderData::the_null_class_loader_data(), THREAD);
-    ModuleEntry* mod_entry = (pkg_entry != NULL) ? pkg_entry->module() : NULL;
-
-    // If the module system has not defined java.base yet, then
-    // classes loaded are assumed to be defined to java.base.
-    // When java.base is eventually defined by the module system,
-    // all packages of classes that have been previously loaded
-    // are verified in ModuleEntryTable::verify_javabase_packages().
-    if (!Universe::is_module_initialized() &&
-        !ModuleEntryTable::javabase_defined() &&
-        mod_entry == NULL) {
-      mod_entry = ModuleEntryTable::javabase_module();
-    }
-
-    // The module must be a named module
-    if (mod_entry != NULL && mod_entry->is_named()) {
-      int num_of_entries = _xpatch_entries->length();
-      const Symbol* class_module_name = mod_entry->name();
-
-      // Loop through all the xpatch entries looking for module
-      for (int i = 0; i < num_of_entries; i++) {
-        ModuleClassPathList* module_cpl = _xpatch_entries->at(i);
-        Symbol* module_cpl_name = module_cpl->module_name();
-
-        if (module_cpl_name->fast_compare(class_module_name) == 0) {
-          // Class' module has been located, attempt to load
-          // the class from the module's ClassPathEntry list.
-          e = module_cpl->module_first_entry();
-          while (e != NULL) {
-            stream = e->open_stream(file_name, CHECK_NULL);
-            // No context.check is required since both CDS
-            // and AppCDS are turned off if -Xpatch is specified.
-            if (NULL != stream) {
-              break;
-            }
-            e = e->next();
-          }
-          // If the module was located in the xpatch entries, break out
-          // even if the class was not located successfully from that module's
-          // ClassPathEntry list. There will not be another valid entry for
-          // that module in the _xpatch_entries array.
-          break;
-        }
-      }
-    }
+    stream = search_module_entries(_xpatch_entries, class_name, file_name, CHECK_NULL);
   }
 
-  // Load Attempt #2: [exploded build | jimage]
+  // Load Attempt #2: [jimage | exploded build]
   if (!search_append_only && (NULL == stream)) {
-    e = _first_entry;
-    while ((e != NULL) && (e != _first_append_entry)) {
-      stream = e->open_stream(file_name, CHECK_NULL);
+    if (has_jrt_entry()) {
+      e = _jrt_entry;
+      stream = _jrt_entry->open_stream(file_name, CHECK_NULL);
       if (!context.check(stream, classpath_index)) {
         return NULL;
       }
-      if (NULL != stream) {
-        break;
-      }
-      e = e->next();
-      ++classpath_index;
+    } else {
+      // Exploded build - attempt to locate class in its defining module's location.
+      assert(_exploded_entries != NULL, "No exploded build entries present");
+      stream = search_module_entries(_exploded_entries, class_name, file_name, CHECK_NULL);
     }
   }
 
   // Load Attempt #3: [-Xbootclasspath/a]; [jvmti appended entries]
   if ((search_append_only || DumpSharedSpaces) && (NULL == stream)) {
-    // For the boot loader append path search, must calculate
-    // the starting classpath_index prior to attempting to
-    // load the classfile.
-    if (search_append_only) {
-      ClassPathEntry *tmp_e = _first_entry;
-      while ((tmp_e != NULL) && (tmp_e != _first_append_entry)) {
-        tmp_e = tmp_e->next();
-        ++classpath_index;
-      }
-    }
+    // For the boot loader append path search, the starting classpath_index
+    // for the appended piece is always 1 to account for either the
+    // _jrt_entry or the _exploded_entries.
+    assert(classpath_index == 0, "The classpath_index has been incremented incorrectly");
+    classpath_index = 1;
 
     e = _first_append_entry;
     while (e != NULL) {
@@ -1453,7 +1503,6 @@
                                                                 protection_domain,
                                                                 NULL, // host_klass
                                                                 NULL, // cp_patches
-                                                                NULL, // parsed_name
                                                                 THREAD);
   if (HAS_PENDING_EXCEPTION) {
     if (DumpSharedSpaces) {
@@ -1597,16 +1646,25 @@
 }
 
 // Complete the ClassPathEntry setup for the boot loader
-void classLoader_init2() {
+void ClassLoader::classLoader_init2(TRAPS) {
+  // Create the moduleEntry for java.base
+  create_javabase();
+
   // Setup the list of module/path pairs for -Xpatch processing
   // This must be done after the SymbolTable is created in order
   // to use fast_compare on module names instead of a string compare.
   if (Arguments::get_xpatchprefix() != NULL) {
-    ClassLoader::setup_xpatch_entries();
+    setup_xpatch_entries();
   }
 
-  // Determine if this is an exploded build
-  ClassLoader::set_has_jimage();
+  // Setup the initial java.base/path pair for the exploded build entries.
+  // As more modules are defined during module system initialization, more
+  // entries will be added to the exploded build array.
+  if (!has_jrt_entry()) {
+    assert(!DumpSharedSpaces, "DumpSharedSpaces not supported with exploded module builds");
+    assert(!UseSharedSpaces, "UsedSharedSpaces not supported with exploded module builds");
+    add_to_exploded_build_list(vmSymbols::java_base(), CHECK);
+  }
 }
 
 
@@ -1654,26 +1712,6 @@
   }
 }
 
-void ClassLoader::set_has_jimage() {
-  // Determine if this is an exploded build. When looking for
-  // the jimage file, only search the piece of the boot
-  // loader's boot class path which contains [exploded build | jimage].
-  // Do not search the boot loader's xpatch entries or append path.
-  ClassPathEntry* e = _first_entry;
-  ClassPathEntry* last_e = _first_append_entry;
-  while ((e != NULL) && (e != last_e)) {
-    JImageFile *jimage = e->jimage();
-    if (jimage != NULL && e->is_jrt()) {
-      _has_jimage = true;
-#if INCLUDE_CDS
-      ClassLoader::initialize_module_loader_map(jimage);
-#endif
-      return;
-    }
-    e = e->next();
-  }
-}
-
 #ifndef PRODUCT
 
 // CompileTheWorld
@@ -1762,14 +1800,19 @@
   HandleMark hm(THREAD);
   ResourceMark rm(THREAD);
 
+  assert(has_jrt_entry(), "Compile The World not supported with exploded module build");
+
   // Find bootstrap loader
   Handle system_class_loader (THREAD, SystemDictionary::java_system_loader());
-  // Iterate over all bootstrap class path entries
-  ClassPathEntry* e = _first_entry;
   jlong start = os::javaTimeMillis();
+
+  // Compile the world for the modular java runtime image
+  _jrt_entry->compile_the_world(system_class_loader, CATCH);
+
+  // Iterate over all bootstrap class path appended entries
+  ClassPathEntry* e = _first_append_entry;
   while (e != NULL) {
-    // We stop at "modules" jimage, unless it is the first bootstrap path entry
-    if (e->is_jrt() && e != _first_entry) break;
+    assert(!e->is_jrt(), "A modular java runtime image is present on the list of appended entries");
     e->compile_the_world(system_class_loader, CATCH);
     e = e->next();
   }
diff --git a/hotspot/src/share/vm/classfile/classLoader.hpp b/hotspot/src/share/vm/classfile/classLoader.hpp
index c59697c..045bfab 100644
--- a/hotspot/src/share/vm/classfile/classLoader.hpp
+++ b/hotspot/src/share/vm/classfile/classLoader.hpp
@@ -216,33 +216,34 @@
   //  1. the module/path pairs specified to -Xpatch
   //    -Xpatch:<module>=<file>(<pathsep><file>)*
   //  2. the base piece
-  //    [exploded build | jimage]
+  //    [jimage | build with exploded modules]
   //  3. boot loader append path
   //    [-Xbootclasspath/a]; [jvmti appended entries]
   //
   // The boot loader must obey this order when attempting
   // to load a class.
 
-  // Contains the module/path pairs specified to -Xpatch
+  // 1. Contains the module/path pairs specified to -Xpatch
   static GrowableArray<ModuleClassPathList*>* _xpatch_entries;
 
-  // Contains the ClassPathEntry instances that include
-  // both the base piece and the boot loader append path.
-  static ClassPathEntry* _first_entry;
-  // Last entry in linked list of ClassPathEntry instances
-  static ClassPathEntry* _last_entry;
-  static int _num_entries;
+  // 2. the base piece
+  //    Contains the ClassPathEntry of the modular java runtime image.
+  //    If no java runtime image is present, this indicates a
+  //    build with exploded modules is being used instead.
+  static ClassPathEntry* _jrt_entry;
+  static GrowableArray<ModuleClassPathList*>* _exploded_entries;
+  enum { EXPLODED_ENTRY_SIZE = 80 }; // Initial number of exploded modules
 
-  // Marks the start of:
-  //   - the boot loader's append path
-  //     [-Xbootclasspath/a]; [jvmti appended entries]
-  // within the linked list of ClassPathEntry instances.
+  // 3. the boot loader's append path
+  //    [-Xbootclasspath/a]; [jvmti appended entries]
+  //    Note: boot loader append path does not support named modules.
   static ClassPathEntry* _first_append_entry;
+  // Last entry in linked list of appended ClassPathEntry instances
+  static ClassPathEntry* _last_append_entry;
 
-  static const char* _shared_archive;
-
-  // True if the boot path has a "modules" jimage
-  static bool _has_jimage;
+  // Note: _num_entries includes the java runtime image and all
+  //       the entries on the _first_append_entry linked list.
+  static int _num_entries;
 
   // Array of module names associated with the boot class loader
   CDS_ONLY(static GrowableArray<char*>* _boot_modules_array;)
@@ -253,9 +254,14 @@
   // Info used by CDS
   CDS_ONLY(static SharedPathsMiscInfo * _shared_paths_misc_info;)
 
-  // Initialization
+  // Initialization:
+  //   - setup the boot loader's system class path
+  //   - setup the boot loader's xpatch entries, if present
+  //   - create the ModuleEntry for java.base
   static void setup_bootstrap_search_path();
   static void setup_search_path(const char *class_path, bool setting_bootstrap);
+  static void setup_xpatch_entries();
+  static void create_javabase();
 
   static void load_zip_library();
   static void load_jimage_library();
@@ -285,8 +291,6 @@
   static int crc32(int crc, const char* buf, int len);
   static bool update_class_path_entry_list(const char *path,
                                            bool check_for_duplicates,
-                                           bool mark_append_entry,
-                                           bool prepend_entry,
                                            bool is_boot_append,
                                            bool throw_exception=true);
   static void print_bootclasspath();
@@ -352,15 +356,17 @@
     return _load_instance_class_failCounter;
   }
 
-  // Set up the module/path pairs as specified to -Xpatch
-  static void setup_xpatch_entries();
+  // Modular java runtime image is present vs. a build with exploded modules
+  static bool has_jrt_entry() { return (_jrt_entry != NULL); }
+  static ClassPathEntry* get_jrt_entry() { return _jrt_entry; }
 
-  // Sets _has_jimage to TRUE if "modules" jimage file exists
-  static void set_has_jimage();
-  static bool has_jimage() { return _has_jimage; }
+  // Add a module's exploded directory to the boot loader's exploded module build list
+  static void add_to_exploded_build_list(Symbol* module_name, TRAPS);
 
-  // Create the ModuleEntry for java.base
-  static void create_javabase();
+  // Attempt load of individual class from either the xpatch or exploded modules build lists
+  static ClassFileStream* search_module_entries(const GrowableArray<ModuleClassPathList*>* const module_list,
+                                                const char* const class_name,
+                                                const char* const file_name, TRAPS);
 
   // Load individual .class file
   static instanceKlassHandle load_class(Symbol* class_name, bool search_append_only, TRAPS);
@@ -381,17 +387,28 @@
 
   // Initialization
   static void initialize();
+  static void classLoader_init2(TRAPS);
   CDS_ONLY(static void initialize_shared_path();)
 
   static int compute_Object_vtable();
 
   static ClassPathEntry* classpath_entry(int n) {
-    ClassPathEntry* e = ClassLoader::_first_entry;
-    while (--n >= 0) {
-      assert(e != NULL, "Not that many classpath entries.");
-      e = e->next();
+    if (n == 0) {
+      assert(has_jrt_entry(), "No class path entry at 0 for exploded module builds");
+      return ClassLoader::_jrt_entry;
+    } else {
+      // The java runtime image is always the first entry
+      // in the FileMapInfo::_classpath_entry_table. Even though
+      // the _jrt_entry is not included in the _first_append_entry
+      // linked list, it must be accounted for when comparing the
+      // class path vs. the shared archive class path.
+      ClassPathEntry* e = ClassLoader::_first_append_entry;
+      while (--n >= 1) {
+        assert(e != NULL, "Not that many classpath entries.");
+        e = e->next();
+      }
+      return e;
     }
-    return e;
   }
 
 #if INCLUDE_CDS
@@ -429,18 +446,12 @@
   // adds a class path list
   static void add_to_list(ClassPathEntry* new_entry);
 
-  // prepends a class path list
-  static void prepend_to_list(ClassPathEntry* new_entry);
-
   // creates a class path zip entry (returns NULL if JAR file cannot be opened)
   static ClassPathZipEntry* create_class_path_zip_entry(const char *apath, bool is_boot_append);
 
   // add a path to class path list
   static void add_to_list(const char* apath);
 
-  // prepend a path to class path list
-  static void prepend_to_list(const char* apath);
-
   static bool string_ends_with(const char* str, const char* str_to_find);
 
   // obtain package name from a fully qualified class name
diff --git a/hotspot/src/share/vm/classfile/classLoaderExt.hpp b/hotspot/src/share/vm/classfile/classLoaderExt.hpp
index 6ce2275..1f0b1b6 100644
--- a/hotspot/src/share/vm/classfile/classLoaderExt.hpp
+++ b/hotspot/src/share/vm/classfile/classLoaderExt.hpp
@@ -71,22 +71,11 @@
 
 
   static void add_class_path_entry(const char* path, bool check_for_duplicates,
-                                   ClassPathEntry* new_entry, bool prepend_entry) {
-    if (prepend_entry) {
-      ClassLoader::prepend_to_list(new_entry);
-    } else {
-      ClassLoader::add_to_list(new_entry);
-    }
+                                   ClassPathEntry* new_entry) {
+    ClassLoader::add_to_list(new_entry);
   }
   static void append_boot_classpath(ClassPathEntry* new_entry) {
     ClassLoader::add_to_list(new_entry);
-    // During jvmti live phase an entry can be appended to the boot
-    // loader's ClassPathEntry instances.  Need to mark the start
-    // of the boot loader's append path in case there was no reason
-    // to mark it initially in setup_bootstrap_search_path.
-    if (ClassLoader::_first_append_entry == NULL) {
-      ClassLoader::set_first_append_entry(new_entry);
-    }
   }
   static void setup_search_paths() {}
   static bool is_boot_classpath(int classpath_index) {
diff --git a/hotspot/src/share/vm/classfile/dictionary.cpp b/hotspot/src/share/vm/classfile/dictionary.cpp
index c7ea145..56d59d2 100644
--- a/hotspot/src/share/vm/classfile/dictionary.cpp
+++ b/hotspot/src/share/vm/classfile/dictionary.cpp
@@ -396,14 +396,15 @@
 DictionaryEntry* Dictionary::get_entry(int index, unsigned int hash,
                                        Symbol* class_name,
                                        ClassLoaderData* loader_data) {
-  debug_only(_lookup_count++);
+  DEBUG_ONLY(_lookup_count++);
   for (DictionaryEntry* entry = bucket(index);
                         entry != NULL;
                         entry = entry->next()) {
     if (entry->hash() == hash && entry->equals(class_name, loader_data)) {
+      DEBUG_ONLY(bucket_count_hit(index));
       return entry;
     }
-    debug_only(_lookup_length++);
+    DEBUG_ONLY(_lookup_length++);
   }
   return NULL;
 }
@@ -596,7 +597,7 @@
   }
   guarantee(number_of_entries() == element_count,
             "Verify of protection domain cache table failed");
-  debug_only(verify_lookup_length((double)number_of_entries() / table_size()));
+  DEBUG_ONLY(verify_lookup_length((double)number_of_entries() / table_size()));
 }
 
 void ProtectionDomainCacheEntry::verify() {
@@ -737,19 +738,65 @@
                    table_size(), number_of_entries());
     tty->print_cr("^ indicates that initiating loader is different from "
                   "defining loader");
+    tty->print_cr("1st number: th bucket index");
+    tty->print_cr("2nd number: the entry's index within this bucket");
+#ifdef ASSERT
+    tty->print_cr("3rd number: the hit percentage of this entry");
+    tty->print_cr("4th number: the hash index of this entry");
+#endif
   }
 
+#ifdef ASSERT
+  // find top buckets with highest lookup count
+  #define TOP_COUNT 16
+  int topItemsIndicies[TOP_COUNT];
+  for (int i = 0; i < TOP_COUNT; i++) {
+    topItemsIndicies[i] = i;
+  }
+  double total = 0.0;
+  for (int i = 0; i < table_size(); i++) {
+    // find the total count number, so later on we can
+    // express bucket lookup count as a percentage of all lookups
+    unsigned value = bucket_hits(i);
+    total += value;
+
+    // find the entry with min value
+    int index = 0;
+    unsigned min = bucket_hits(topItemsIndicies[index]);
+    for (int j = 1; j < TOP_COUNT; j++) {
+      if (bucket_hits(topItemsIndicies[j]) < min) {
+        min = bucket_hits(topItemsIndicies[j]);
+        index = j;
+      }
+    }
+    // if the bucket loookup value is bigger than the current min
+    // move that bucket index into the top list
+    if (value > min) {
+      topItemsIndicies[index] = i;
+    }
+  }
+#endif
+
   for (int index = 0; index < table_size(); index++) {
+#ifdef ASSERT
+    double percentage = 100.0 * (double)bucket_hits(index)/total;
+#endif
+    int chain = 0;
     for (DictionaryEntry* probe = bucket(index);
                           probe != NULL;
                           probe = probe->next()) {
-      if (Verbose) tty->print("%4d: ", index);
       Klass* e = probe->klass();
       ClassLoaderData* loader_data =  probe->loader_data();
       bool is_defining_class =
          (loader_data == e->class_loader_data());
+      if (details) {
+        tty->print("%4d: %3d: ", index, chain);
+#ifdef ASSERT
+        tty->print("%5.2f%%: %10u:", percentage, probe->hash());
+#endif
+      }
       tty->print("%s%s", ((!details) || is_defining_class) ? " " : "^",
-                   e->external_name());
+                 e->external_name());
 
       if (details) {
         tty->print(", loader ");
@@ -760,9 +807,30 @@
         }
       }
       tty->cr();
+
+      chain++;
+    }
+    if (details && (chain == 0)) {
+      tty->print("%4d:", index);
+      tty->cr();
     }
   }
 
+#ifdef ASSERT
+  // print out the TOP_COUNT of buckets with highest lookup count (unsorted)
+  if (details) {
+    tty->cr();
+    tty->print("Top %d buckets:", TOP_COUNT);
+    tty->cr();
+    for (int i = 0; i < TOP_COUNT; i++) {
+      tty->print("%4d: hits %5.2f%%",
+                 topItemsIndicies[i],
+                 100.0*(double)bucket_hits(topItemsIndicies[i])/total);
+      tty->cr();
+    }
+  }
+#endif
+
   if (details) {
     tty->cr();
     _pd_cache_table->print();
@@ -795,7 +863,7 @@
   }
   guarantee(number_of_entries() == element_count,
             "Verify of system dictionary failed");
-  debug_only(verify_lookup_length((double)number_of_entries() / table_size()));
+  DEBUG_ONLY(if (!verify_lookup_length((double)number_of_entries() / table_size())) this->print(true));
 
   _pd_cache_table->verify();
 }
diff --git a/hotspot/src/share/vm/classfile/javaClasses.cpp b/hotspot/src/share/vm/classfile/javaClasses.cpp
index d6cdf2e..6df74ae 100644
--- a/hotspot/src/share/vm/classfile/javaClasses.cpp
+++ b/hotspot/src/share/vm/classfile/javaClasses.cpp
@@ -3243,15 +3243,6 @@
   mname->address_field_put(_vmindex_offset, (address) index);
 }
 
-bool java_lang_invoke_MemberName::equals(oop mn1, oop mn2) {
-  if (mn1 == mn2) {
-     return true;
-  }
-  return (vmtarget(mn1) == vmtarget(mn2) && flags(mn1) == flags(mn2) &&
-          vmindex(mn1) == vmindex(mn2) &&
-          clazz(mn1) == clazz(mn2));
-}
-
 oop java_lang_invoke_LambdaForm::vmentry(oop lform) {
   assert(is_instance(lform), "wrong type");
   return lform->obj_field(_vmentry_offset);
diff --git a/hotspot/src/share/vm/classfile/javaClasses.hpp b/hotspot/src/share/vm/classfile/javaClasses.hpp
index fbf68e6..7d101b8 100644
--- a/hotspot/src/share/vm/classfile/javaClasses.hpp
+++ b/hotspot/src/share/vm/classfile/javaClasses.hpp
@@ -777,9 +777,6 @@
     static Handle create(Handle loader, Handle module_name, TRAPS);
 
     // Testers
-    static bool is_subclass(Klass* klass) {
-      return klass->is_subclass_of(SystemDictionary::reflect_Module_klass());
-    }
     static bool is_instance(oop obj);
 
     // Accessors
@@ -1110,8 +1107,6 @@
   static int flags_offset_in_bytes()            { return _flags_offset; }
   static int vmtarget_offset_in_bytes()         { return _vmtarget_offset; }
   static int vmindex_offset_in_bytes()          { return _vmindex_offset; }
-
-  static bool equals(oop mt1, oop mt2);
 };
 
 
diff --git a/hotspot/src/share/vm/classfile/javaClasses.inline.hpp b/hotspot/src/share/vm/classfile/javaClasses.inline.hpp
index 180bc5b..b1c4a3f 100644
--- a/hotspot/src/share/vm/classfile/javaClasses.inline.hpp
+++ b/hotspot/src/share/vm/classfile/javaClasses.inline.hpp
@@ -168,11 +168,8 @@
   return obj != NULL && is_subclass(obj->klass());
 }
 
-
-
-
 inline bool java_lang_reflect_Module::is_instance(oop obj) {
-  return obj != NULL && is_subclass(obj->klass());
+  return obj != NULL && obj->klass() == SystemDictionary::reflect_Module_klass();
 }
 
 inline int Backtrace::merge_bci_and_version(int bci, int version) {
diff --git a/hotspot/src/share/vm/classfile/klassFactory.cpp b/hotspot/src/share/vm/classfile/klassFactory.cpp
index 11b07f6..6eb6ccc 100644
--- a/hotspot/src/share/vm/classfile/klassFactory.cpp
+++ b/hotspot/src/share/vm/classfile/klassFactory.cpp
@@ -96,7 +96,6 @@
                                                      Handle protection_domain,
                                                      const Klass* host_klass,
                                                      GrowableArray<Handle>* cp_patches,
-                                                     TempNewSymbol* parsed_name,
                                                      TRAPS) {
 
   assert(stream != NULL, "invariant");
@@ -123,7 +122,6 @@
                          name,
                          loader_data,
                          protection_domain,
-                         parsed_name,
                          host_klass,
                          cp_patches,
                          ClassFileParser::BROADCAST, // publicity level
diff --git a/hotspot/src/share/vm/classfile/klassFactory.hpp b/hotspot/src/share/vm/classfile/klassFactory.hpp
index 107c8d3..6783f27 100644
--- a/hotspot/src/share/vm/classfile/klassFactory.hpp
+++ b/hotspot/src/share/vm/classfile/klassFactory.hpp
@@ -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
@@ -74,7 +74,6 @@
                                                 Handle protection_domain,
                                                 const Klass* host_klass,
                                                 GrowableArray<Handle>* cp_patches,
-                                                TempNewSymbol* parsed_name,
                                                 TRAPS);
 };
 
diff --git a/hotspot/src/share/vm/classfile/modules.cpp b/hotspot/src/share/vm/classfile/modules.cpp
index d9d086a..8986eb6 100644
--- a/hotspot/src/share/vm/classfile/modules.cpp
+++ b/hotspot/src/share/vm/classfile/modules.cpp
@@ -102,7 +102,8 @@
 static ModuleEntry* get_module_entry(jobject module, TRAPS) {
   Handle module_h(THREAD, JNIHandles::resolve(module));
   if (!java_lang_reflect_Module::is_instance(module_h())) {
-    THROW_MSG_NULL(vmSymbols::java_lang_IllegalArgumentException(), "Bad module object");
+    THROW_MSG_NULL(vmSymbols::java_lang_IllegalArgumentException(),
+                   "module is not an instance of type java.lang.reflect.Module");
   }
   return java_lang_reflect_Module::module_entry(module_h(), CHECK_NULL);
 }
@@ -133,36 +134,6 @@
   return NULL;
 }
 
-// If using exploded build, append <java.home>/modules/module_name, if it exists,
-// to the system boot class path in order for the boot loader to locate class files.
-static void add_to_exploded_build_list(char *module_name, TRAPS) {
-  assert(!ClassLoader::has_jimage(), "Exploded build not applicable");
-  // java.base is handled by os::set_boot_path
-  assert(strcmp(module_name, "java.base") != 0, "Unexpected java.base module name");
-
-  char file_sep = os::file_separator()[0];
-  size_t module_len = strlen(module_name);
-
-  const char* home = Arguments::get_java_home();
-  size_t len = strlen(home) + module_len + 32;
-  char* path = NEW_C_HEAP_ARRAY(char, len, mtModule);
-  jio_snprintf(path, len, "%s%cmodules%c%s", home, file_sep, file_sep, module_name);
-  struct stat st;
-  // See if exploded module path exists
-  if ((os::stat(path, &st) != 0)) {
-    FREE_C_HEAP_ARRAY(char, path);
-    path = NULL;
-  }
-
-  if (path != NULL) {
-    HandleMark hm;
-    Handle loader_lock = Handle(THREAD, SystemDictionary::system_loader_lock());
-    ObjectLocker ol(loader_lock, THREAD);
-    log_info(class, load)("opened: %s", path);
-    ClassLoader::add_to_list(path);
-  }
-}
-
 bool Modules::is_package_defined(Symbol* package, Handle h_loader, TRAPS) {
   PackageEntry* res = get_package_entry_by_name(package, h_loader, CHECK_false);
   return res != NULL;
@@ -297,9 +268,9 @@
     THROW_MSG(vmSymbols::java_lang_NullPointerException(), "Null module object");
   }
   Handle module_handle(THREAD, JNIHandles::resolve(module));
-  if (!java_lang_reflect_Module::is_subclass(module_handle->klass())) {
+  if (!java_lang_reflect_Module::is_instance(module_handle())) {
     THROW_MSG(vmSymbols::java_lang_IllegalArgumentException(),
-              "module is not a subclass of java.lang.reflect.Module");
+              "module is not an instance of type java.lang.reflect.Module");
   }
 
   char* module_name = get_module_name(module_handle(), CHECK);
@@ -470,8 +441,8 @@
   // used, prepend <java.home>/modules/modules_name, if it exists, to the system boot class path.
   if (loader == NULL &&
       !Universe::is_module_initialized() &&
-      !ClassLoader::has_jimage()) {
-    add_to_exploded_build_list(module_name, CHECK);
+      !ClassLoader::has_jrt_entry()) {
+    ClassLoader::add_to_exploded_build_list(module_symbol, CHECK);
   }
 }
 
@@ -482,9 +453,9 @@
     THROW_MSG(vmSymbols::java_lang_NullPointerException(), "Null module object");
   }
   Handle module_handle(THREAD, JNIHandles::resolve(module));
-  if (!java_lang_reflect_Module::is_subclass(module_handle->klass())) {
+  if (!java_lang_reflect_Module::is_instance(module_handle())) {
     THROW_MSG(vmSymbols::java_lang_IllegalArgumentException(),
-              "module is not a subclass of java.lang.reflect.Module");
+              "module is not an instance of type java.lang.reflect.Module");
   }
 
   // Ensure that this is an unnamed module
@@ -758,7 +729,7 @@
   oop module = java_lang_Class::module(mirror);
 
   assert(module != NULL, "java.lang.Class module field not set");
-  assert(java_lang_reflect_Module::is_subclass(module->klass()), "Module is not a java.lang.reflect.Module");
+  assert(java_lang_reflect_Module::is_instance(module), "module is not an instance of type java.lang.reflect.Module");
 
   if (log_is_enabled(Debug, modules)) {
     ResourceMark rm(THREAD);
diff --git a/hotspot/src/share/vm/classfile/sharedPathsMiscInfo.hpp b/hotspot/src/share/vm/classfile/sharedPathsMiscInfo.hpp
index 435630f..77de03b 100644
--- a/hotspot/src/share/vm/classfile/sharedPathsMiscInfo.hpp
+++ b/hotspot/src/share/vm/classfile/sharedPathsMiscInfo.hpp
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2014, 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2014, 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
@@ -29,7 +29,7 @@
 #include "runtime/os.hpp"
 
 // During dumping time, when processing class paths, we build up the dump-time
-// classpath. The JAR files that exist are stored in the list ClassLoader::_first_entry.
+// classpath. The JAR files that exist are stored in the list ClassLoader::_first_append_entry.
 // However, we need to store other "misc" information for run-time checking, such as
 //
 // + The values of Arguments::get_sysclasspath() used during dumping.
diff --git a/hotspot/src/share/vm/classfile/systemDictionary.cpp b/hotspot/src/share/vm/classfile/systemDictionary.cpp
index b747fae..033980e 100644
--- a/hotspot/src/share/vm/classfile/systemDictionary.cpp
+++ b/hotspot/src/share/vm/classfile/systemDictionary.cpp
@@ -70,7 +70,6 @@
 #include "services/threadService.hpp"
 #include "trace/traceMacros.hpp"
 #include "utilities/macros.hpp"
-#include "utilities/stringUtils.hpp"
 #include "utilities/ticks.hpp"
 #if INCLUDE_CDS
 #include "classfile/sharedClassUtil.hpp"
@@ -140,24 +139,6 @@
 }
 
 // ----------------------------------------------------------------------------
-// debugging
-
-#ifdef ASSERT
-
-// return true if class_name contains no '.' (internal format is '/')
-bool SystemDictionary::is_internal_format(Symbol* class_name) {
-  if (class_name != NULL) {
-    ResourceMark rm;
-    char* name = class_name->as_C_string();
-    return strchr(name, '.') == NULL;
-  } else {
-    return true;
-  }
-}
-
-#endif
-
-// ----------------------------------------------------------------------------
 // Parallel class loading check
 
 bool SystemDictionary::is_parallelCapable(Handle class_loader) {
@@ -335,6 +316,10 @@
 // Must be called, even if superclass is null, since this is
 // where the placeholder entry is created which claims this
 // thread is loading this class/classloader.
+// Be careful when modifying this code: once you have run
+// placeholders()->find_and_add(PlaceholderTable::LOAD_SUPER),
+// you need to find_and_remove it before returning.
+// So be careful to not exit with a CHECK_ macro betweeen these calls.
 Klass* SystemDictionary::resolve_super_or_fail(Symbol* child_name,
                                                  Symbol* class_name,
                                                  Handle class_loader,
@@ -399,6 +384,7 @@
       }
     }
     if (!throw_circularity_error) {
+      // Be careful not to exit resolve_super
       PlaceholderEntry* newprobe = placeholders()->find_and_add(p_index, p_hash, child_name, loader_data, PlaceholderTable::LOAD_SUPER, class_name, THREAD);
     }
   }
@@ -655,6 +641,24 @@
 #endif // INCLUDE_TRACE
 }
 
+// utility function for class define event
+static void class_define_event(instanceKlassHandle k) {
+#if INCLUDE_TRACE
+  EventClassDefine event(UNTIMED);
+  if (event.should_commit()) {
+    event.set_definedClass(k());
+    oop defining_class_loader = k->class_loader();
+    event.set_definingClassLoader(defining_class_loader != NULL ?
+      defining_class_loader->klass() : (Klass*)NULL);
+    event.commit();
+  }
+#endif // INCLUDE_TRACE
+}
+
+// Be careful when modifying this code: once you have run
+// placeholders()->find_and_add(PlaceholderTable::LOAD_INSTANCE),
+// you need to find_and_remove it before returning.
+// So be careful to not exit with a CHECK_ macro betweeen these calls.
 Klass* SystemDictionary::resolve_instance_class_or_null(Symbol* name,
                                                         Handle class_loader,
                                                         Handle protection_domain,
@@ -1016,8 +1020,9 @@
 }
 
 // Note: this method is much like resolve_from_stream, but
-// updates no supplemental data structures.
-// TODO consolidate the two methods with a helper routine?
+// does not publish the classes via the SystemDictionary.
+// Handles unsafe_DefineAnonymousClass and redefineclasses
+// RedefinedClasses do not add to the class hierarchy
 Klass* SystemDictionary::parse_stream(Symbol* class_name,
                                       Handle class_loader,
                                       Handle protection_domain,
@@ -1054,8 +1059,7 @@
                                                            protection_domain,
                                                            host_klass,
                                                            cp_patches,
-                                                           NULL, // parsed_name
-                                                           THREAD);
+                                                           CHECK_NULL);
 
   if (host_klass != NULL && k.not_null()) {
     // If it's anonymous, initialize it now, since nobody else will.
@@ -1126,8 +1130,6 @@
   // already be present in the SystemDictionary, otherwise we would not
   // throw potential ClassFormatErrors.
   //
-  // Note: "parsed_name" is updated.
-  TempNewSymbol parsed_name = NULL;
 
  instanceKlassHandle k;
 
@@ -1139,9 +1141,7 @@
                                                  CHECK_NULL);
 #endif
 
-  if (k.not_null()) {
-    parsed_name = k->name();
-  } else {
+  if (k.is_null()) {
     if (st->buffer() == NULL) {
       return NULL;
     }
@@ -1151,64 +1151,28 @@
                                          protection_domain,
                                          NULL, // host_klass
                                          NULL, // cp_patches
-                                         &parsed_name,
-                                         THREAD);
+                                         CHECK_NULL);
   }
 
-  const char* pkg = "java/";
-  if (!HAS_PENDING_EXCEPTION &&
-      !class_loader.is_null() &&
-      !SystemDictionary::is_platform_class_loader(class_loader) &&
-      parsed_name != NULL &&
-      !strncmp((const char*)parsed_name->bytes(), pkg, strlen(pkg))) {
-    // It is illegal to define classes in the "java." package from
-    // JVM_DefineClass or jni_DefineClass unless you're the bootclassloader
-    ResourceMark rm(THREAD);
-    TempNewSymbol pkg_name = InstanceKlass::package_from_name(parsed_name, CHECK_NULL);
-    assert(pkg_name != NULL, "Error in parsing package name starting with 'java/'");
-    char* name = pkg_name->as_C_string();
-    StringUtils::replace_no_expand(name, "/", ".");
-    const char* msg_text = "Prohibited package name: ";
-    size_t len = strlen(msg_text) + strlen(name) + 1;
-    char* message = NEW_RESOURCE_ARRAY(char, len);
-    jio_snprintf(message, len, "%s%s", msg_text, name);
-    Exceptions::_throw_msg(THREAD_AND_LOCATION,
-      vmSymbols::java_lang_SecurityException(), message);
-  }
+  assert(k.not_null(), "no klass created");
+  Symbol* h_name = k->name();
+  assert(class_name == NULL || class_name == h_name, "name mismatch");
 
-  if (!HAS_PENDING_EXCEPTION) {
-    assert(parsed_name != NULL, "Sanity");
-    assert(class_name == NULL || class_name == parsed_name, "name mismatch");
-    // Verification prevents us from creating names with dots in them, this
-    // asserts that that's the case.
-    assert(is_internal_format(parsed_name),
-           "external class name format used internally");
-
-    // Add class just loaded
-    // If a class loader supports parallel classloading handle parallel define requests
-    // find_or_define_instance_class may return a different InstanceKlass
-    if (is_parallelCapable(class_loader)) {
-      k = find_or_define_instance_class(class_name, class_loader, k, THREAD);
-    } else {
-      define_instance_class(k, THREAD);
-    }
+  // Add class just loaded
+  // If a class loader supports parallel classloading handle parallel define requests
+  // find_or_define_instance_class may return a different InstanceKlass
+  if (is_parallelCapable(class_loader)) {
+    k = find_or_define_instance_class(h_name, class_loader, k, CHECK_NULL);
+  } else {
+    define_instance_class(k, CHECK_NULL);
   }
 
   // Make sure we have an entry in the SystemDictionary on success
   debug_only( {
-    if (!HAS_PENDING_EXCEPTION) {
-      assert(parsed_name != NULL, "parsed_name is still null?");
-      Symbol*  h_name    = k->name();
-      ClassLoaderData *defining_loader_data = k->class_loader_data();
+    MutexLocker mu(SystemDictionary_lock, THREAD);
 
-      MutexLocker mu(SystemDictionary_lock, THREAD);
-
-      Klass* check = find_class(parsed_name, loader_data);
-      assert(check == k(), "should be present in the dictionary");
-
-      Klass* check2 = find_class(h_name, defining_loader_data);
-      assert(check == check2, "name inconsistancy in SystemDictionary");
-    }
+    Klass* check = find_class(h_name, k->class_loader_data());
+    assert(check == k(), "should be present in the dictionary");
   } );
 
   return k();
@@ -1246,12 +1210,16 @@
 
 instanceKlassHandle SystemDictionary::load_shared_class(
                  Symbol* class_name, Handle class_loader, TRAPS) {
-  instanceKlassHandle ik (THREAD, find_shared_class(class_name));
-  // Make sure we only return the boot class for the NULL classloader.
-  if (ik.not_null() &&
-      ik->is_shared_boot_class() && class_loader.is_null()) {
-    Handle protection_domain;
-    return load_shared_class(ik, class_loader, protection_domain, THREAD);
+  // Don't load shared class when JvmtiExport::should_post_class_file_load_hook()
+  // is enabled since posting CFLH is not supported when loading shared class.
+  if (!JvmtiExport::should_post_class_file_load_hook()) {
+    instanceKlassHandle ik (THREAD, find_shared_class(class_name));
+    // Make sure we only return the boot class for the NULL classloader.
+    if (ik.not_null() &&
+        ik->is_shared_boot_class() && class_loader.is_null()) {
+      Handle protection_domain;
+      return load_shared_class(ik, class_loader, protection_domain, THREAD);
+    }
   }
   return instanceKlassHandle();
 }
@@ -1334,8 +1302,14 @@
 instanceKlassHandle SystemDictionary::load_shared_class(instanceKlassHandle ik,
                                                         Handle class_loader,
                                                         Handle protection_domain, TRAPS) {
+  instanceKlassHandle nh = instanceKlassHandle(); // null Handle
+  if (JvmtiExport::should_post_class_file_load_hook()) {
+    // Don't load shared class when JvmtiExport::should_post_class_file_load_hook()
+    // is enabled since posting CFLH is not supported when loading shared class.
+    return nh;
+  }
+
   if (ik.not_null()) {
-    instanceKlassHandle nh = instanceKlassHandle(); // null Handle
     Symbol* class_name = ik->name();
 
     bool visible = is_shared_class_visible(
@@ -1400,6 +1374,8 @@
       Handle lockObject = compute_loader_lock_object(class_loader, THREAD);
       check_loader_lock_contention(lockObject, THREAD);
       ObjectLocker ol(lockObject, THREAD, true);
+      // prohibited package check assumes all classes loaded from archive call
+      // restore_unshareable_info which calls ik->set_package()
       ik->restore_unshareable_info(loader_data, protection_domain, CHECK_(nh));
     }
 
@@ -1665,9 +1641,8 @@
       JvmtiExport::post_class_load((JavaThread *) THREAD, k());
 
   }
-
   TRACE_KLASS_DEFINITION(k, THREAD);
-
+  class_define_event(k);
 }
 
 // Support parallel classloading
@@ -1686,6 +1661,10 @@
 // findClass(), i.e. FindLoadedClass/DefineClassIfAbsent or they
 // potentially waste time reading and parsing the bytestream.
 // Note: VM callers should ensure consistency of k/class_name,class_loader
+// Be careful when modifying this code: once you have run
+// placeholders()->find_and_add(PlaceholderTable::DEFINE_CLASS),
+// you need to find_and_remove it before returning.
+// So be careful to not exit with a CHECK_ macro betweeen these calls.
 instanceKlassHandle SystemDictionary::find_or_define_instance_class(Symbol* class_name, Handle class_loader, instanceKlassHandle k, TRAPS) {
 
   instanceKlassHandle nh = instanceKlassHandle(); // null Handle
@@ -2125,7 +2104,7 @@
 
   // Create the ModuleEntry for java.base.  This call needs to be done here,
   // after vmSymbols::initialize() is called but before any classes are pre-loaded.
-  ClassLoader::create_javabase();
+  ClassLoader::classLoader_init2(CHECK);
 
   // Preload commonly used klasses
   WKID scan = FIRST_WKID;
diff --git a/hotspot/src/share/vm/classfile/systemDictionary.hpp b/hotspot/src/share/vm/classfile/systemDictionary.hpp
index 76a0b07..6dd7d20 100644
--- a/hotspot/src/share/vm/classfile/systemDictionary.hpp
+++ b/hotspot/src/share/vm/classfile/systemDictionary.hpp
@@ -281,6 +281,7 @@
 
   // Parse new stream. This won't update the system dictionary or
   // class hierarchy, simply parse the stream. Used by JVMTI RedefineClasses.
+  // Also used by Unsafe_DefineAnonymousClass
   static Klass* parse_stream(Symbol* class_name,
                              Handle class_loader,
                              Handle protection_domain,
@@ -413,10 +414,6 @@
   // Verification
   static void verify();
 
-#ifdef ASSERT
-  static bool is_internal_format(Symbol* class_name);
-#endif
-
   // Initialization
   static void initialize(TRAPS);
 
diff --git a/hotspot/src/share/vm/code/nativeInst.hpp b/hotspot/src/share/vm/code/nativeInst.hpp
index 7917a64..dd8f7ee 100644
--- a/hotspot/src/share/vm/code/nativeInst.hpp
+++ b/hotspot/src/share/vm/code/nativeInst.hpp
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2014, 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
@@ -25,23 +25,8 @@
 #ifndef SHARE_VM_CODE_NATIVEINST_HPP
 #define SHARE_VM_CODE_NATIVEINST_HPP
 
-#ifdef TARGET_ARCH_x86
-# include "nativeInst_x86.hpp"
-#endif
-#ifdef TARGET_ARCH_sparc
-# include "nativeInst_sparc.hpp"
-#endif
-#ifdef TARGET_ARCH_zero
-# include "nativeInst_zero.hpp"
-#endif
-#ifdef TARGET_ARCH_arm
-# include "nativeInst_arm.hpp"
-#endif
-#ifdef TARGET_ARCH_ppc
-# include "nativeInst_ppc.hpp"
-#endif
-#ifdef TARGET_ARCH_aarch64
-# include "nativeInst_aarch64.hpp"
-#endif
+#include "utilities/macros.hpp"
+
+#include CPU_HEADER(nativeInst)
 
 #endif // SHARE_VM_CODE_NATIVEINST_HPP
diff --git a/hotspot/src/share/vm/code/nmethod.cpp b/hotspot/src/share/vm/code/nmethod.cpp
index e15e732..d09518c 100644
--- a/hotspot/src/share/vm/code/nmethod.cpp
+++ b/hotspot/src/share/vm/code/nmethod.cpp
@@ -51,21 +51,6 @@
 #include "utilities/events.hpp"
 #include "utilities/xmlstream.hpp"
 #include "logging/log.hpp"
-#ifdef TARGET_ARCH_x86
-# include "nativeInst_x86.hpp"
-#endif
-#ifdef TARGET_ARCH_sparc
-# include "nativeInst_sparc.hpp"
-#endif
-#ifdef TARGET_ARCH_zero
-# include "nativeInst_zero.hpp"
-#endif
-#ifdef TARGET_ARCH_arm
-# include "nativeInst_arm.hpp"
-#endif
-#ifdef TARGET_ARCH_ppc
-# include "nativeInst_ppc.hpp"
-#endif
 #ifdef SHARK
 #include "shark/sharkCompiler.hpp"
 #endif
diff --git a/hotspot/src/share/vm/code/relocInfo.hpp b/hotspot/src/share/vm/code/relocInfo.hpp
index deaa38c2..de22f48 100644
--- a/hotspot/src/share/vm/code/relocInfo.hpp
+++ b/hotspot/src/share/vm/code/relocInfo.hpp
@@ -27,6 +27,7 @@
 
 #include "memory/allocation.hpp"
 #include "runtime/os.hpp"
+#include "utilities/macros.hpp"
 
 class nmethod;
 class CompiledMethod;
@@ -423,24 +424,7 @@
   static void remove_reloc_info_for_address(RelocIterator *itr, address pc, relocType old_type);
 
   // Machine dependent stuff
-#ifdef TARGET_ARCH_x86
-# include "relocInfo_x86.hpp"
-#endif
-#ifdef TARGET_ARCH_sparc
-# include "relocInfo_sparc.hpp"
-#endif
-#ifdef TARGET_ARCH_zero
-# include "relocInfo_zero.hpp"
-#endif
-#ifdef TARGET_ARCH_arm
-# include "relocInfo_arm.hpp"
-#endif
-#ifdef TARGET_ARCH_ppc
-# include "relocInfo_ppc.hpp"
-#endif
-#ifdef TARGET_ARCH_aarch64
-# include "relocInfo_aarch64.hpp"
-#endif
+#include CPU_HEADER(relocInfo)
 
  protected:
   // Derived constant, based on format_width which is PD:
diff --git a/hotspot/src/share/vm/code/vmreg.hpp b/hotspot/src/share/vm/code/vmreg.hpp
index e6bc343..5ff4656 100644
--- a/hotspot/src/share/vm/code/vmreg.hpp
+++ b/hotspot/src/share/vm/code/vmreg.hpp
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1998, 2014, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1998, 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
@@ -28,6 +28,7 @@
 #include "asm/register.hpp"
 #include "memory/allocation.hpp"
 #include "utilities/globalDefinitions.hpp"
+#include "utilities/macros.hpp"
 #include "utilities/ostream.hpp"
 #ifdef COMPILER2
 #include "opto/adlcVMDeps.hpp"
@@ -139,25 +140,7 @@
 
   static void set_regName();
 
-#ifdef TARGET_ARCH_x86
-# include "vmreg_x86.hpp"
-#endif
-#ifdef TARGET_ARCH_sparc
-# include "vmreg_sparc.hpp"
-#endif
-#ifdef TARGET_ARCH_zero
-# include "vmreg_zero.hpp"
-#endif
-#ifdef TARGET_ARCH_arm
-# include "vmreg_arm.hpp"
-#endif
-#ifdef TARGET_ARCH_ppc
-# include "vmreg_ppc.hpp"
-#endif
-#ifdef TARGET_ARCH_aarch64
-# include "vmreg_aarch64.hpp"
-#endif
-
+#include CPU_HEADER(vmreg)
 
 };
 
diff --git a/hotspot/src/share/vm/code/vmreg.inline.hpp b/hotspot/src/share/vm/code/vmreg.inline.hpp
index 314e14a..1124e66 100644
--- a/hotspot/src/share/vm/code/vmreg.inline.hpp
+++ b/hotspot/src/share/vm/code/vmreg.inline.hpp
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2014, 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,23 +27,6 @@
 
 #include "asm/register.hpp"
 #include "code/vmreg.hpp"
-#ifdef TARGET_ARCH_x86
-# include "vmreg_x86.inline.hpp"
-#endif
-#ifdef TARGET_ARCH_sparc
-# include "vmreg_sparc.inline.hpp"
-#endif
-#ifdef TARGET_ARCH_zero
-# include "vmreg_zero.inline.hpp"
-#endif
-#ifdef TARGET_ARCH_arm
-# include "vmreg_arm.inline.hpp"
-#endif
-#ifdef TARGET_ARCH_ppc
-# include "vmreg_ppc.inline.hpp"
-#endif
-#ifdef TARGET_ARCH_aarch64
-# include "vmreg_aarch64.inline.hpp"
-#endif
+#include CPU_HEADER_INLINE(vmreg)
 
 #endif // SHARE_VM_CODE_VMREG_INLINE_HPP
diff --git a/hotspot/src/share/vm/compiler/compileBroker.cpp b/hotspot/src/share/vm/compiler/compileBroker.cpp
index d49c080..f9768b5 100644
--- a/hotspot/src/share/vm/compiler/compileBroker.cpp
+++ b/hotspot/src/share/vm/compiler/compileBroker.cpp
@@ -551,17 +551,6 @@
       } else {
         c1_count = JVMCIHostThreads;
       }
-
-      if (!UseInterpreter || !BackgroundCompilation) {
-        // Force initialization of JVMCI compiler otherwise JVMCI
-        // compilations will not block until JVMCI is initialized
-        ResourceMark rm;
-        TempNewSymbol getCompiler = SymbolTable::new_symbol("getCompiler", CHECK);
-        TempNewSymbol sig = SymbolTable::new_symbol("()Ljdk/vm/ci/runtime/JVMCICompiler;", CHECK);
-        Handle jvmciRuntime = JVMCIRuntime::get_HotSpotJVMCIRuntime(CHECK);
-        JavaValue result(T_OBJECT);
-        JavaCalls::call_virtual(&result, jvmciRuntime, HotSpotJVMCIRuntime::klass(), getCompiler, sig, CHECK);
-      }
     }
   }
 #endif // INCLUDE_JVMCI
@@ -1079,6 +1068,12 @@
     return NULL;
   }
 
+#if INCLUDE_JVMCI
+  if (comp->is_jvmci() && !JVMCIRuntime::can_initialize_JVMCI()) {
+    return NULL;
+  }
+#endif
+
   if (osr_bci == InvocationEntryBci) {
     // standard compilation
     CompiledMethod* method_code = method->code();
diff --git a/hotspot/src/share/vm/compiler/compileTask.cpp b/hotspot/src/share/vm/compiler/compileTask.cpp
index 9c3ea04..b5af75d 100644
--- a/hotspot/src/share/vm/compiler/compileTask.cpp
+++ b/hotspot/src/share/vm/compiler/compileTask.cpp
@@ -186,8 +186,10 @@
 void CompileTask::print_tty() {
   ttyLocker ttyl;  // keep the following output all in one block
   // print compiler name if requested
-  if (CIPrintCompilerName) tty->print("%s:", CompileBroker::compiler_name(comp_level()));
-    print(tty);
+  if (CIPrintCompilerName) {
+    tty->print("%s:", CompileBroker::compiler_name(comp_level()));
+  }
+  print(tty);
 }
 
 // ------------------------------------------------------------------
diff --git a/hotspot/src/share/vm/compiler/compilerOracle.cpp b/hotspot/src/share/vm/compiler/compilerOracle.cpp
index 4e5b240..3327dea 100644
--- a/hotspot/src/share/vm/compiler/compilerOracle.cpp
+++ b/hotspot/src/share/vm/compiler/compilerOracle.cpp
@@ -819,7 +819,6 @@
 
       if (className == NULL) {
         className = newName;
-        c_match = MethodMatcher::Prefix;
       } else {
         methodName = newName;
       }
@@ -829,26 +828,15 @@
       if (className == NULL) {
         className = "";
         c_match = MethodMatcher::Any;
-      } else {
-        // foo/bar.blah is an exact match on foo/bar, bar.blah is a suffix match on bar
-        if (strchr(className, '/') != NULL) {
-          c_match = MethodMatcher::Exact;
-        } else {
-          c_match = MethodMatcher::Suffix;
-        }
       }
     } else {
       // got foo or foo/bar
       if (className == NULL) {
         ShouldNotReachHere();
       } else {
-        // got foo or foo/bar
-        if (strchr(className, '/') != NULL) {
-          c_match = MethodMatcher::Prefix;
-        } else if (className[0] == '\0') {
+        // missing class name handled as "Any" class match
+        if (className[0] == '\0') {
           c_match = MethodMatcher::Any;
-        } else {
-          c_match = MethodMatcher::Substring;
         }
       }
     }
diff --git a/hotspot/src/share/vm/compiler/disassembler.cpp b/hotspot/src/share/vm/compiler/disassembler.cpp
index 8d443b7..4cc15c6 100644
--- a/hotspot/src/share/vm/compiler/disassembler.cpp
+++ b/hotspot/src/share/vm/compiler/disassembler.cpp
@@ -35,24 +35,7 @@
 #include "runtime/os.hpp"
 #include "runtime/stubCodeGenerator.hpp"
 #include "runtime/stubRoutines.hpp"
-#ifdef TARGET_ARCH_x86
-# include "depChecker_x86.hpp"
-#endif
-#ifdef TARGET_ARCH_sparc
-# include "depChecker_sparc.hpp"
-#endif
-#ifdef TARGET_ARCH_zero
-# include "depChecker_zero.hpp"
-#endif
-#ifdef TARGET_ARCH_arm
-# include "depChecker_arm.hpp"
-#endif
-#ifdef TARGET_ARCH_ppc
-# include "depChecker_ppc.hpp"
-#endif
-#ifdef TARGET_ARCH_aarch64
-# include "depChecker_aarch64.hpp"
-#endif
+#include CPU_HEADER(depChecker)
 #ifdef SHARK
 #include "shark/sharkEntry.hpp"
 #endif
diff --git a/hotspot/src/share/vm/compiler/disassembler.hpp b/hotspot/src/share/vm/compiler/disassembler.hpp
index eca47a7..4755ce7 100644
--- a/hotspot/src/share/vm/compiler/disassembler.hpp
+++ b/hotspot/src/share/vm/compiler/disassembler.hpp
@@ -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
@@ -27,6 +27,7 @@
 
 #include "asm/codeBuffer.hpp"
 #include "runtime/globals.hpp"
+#include "utilities/macros.hpp"
 
 class decode_env;
 
@@ -63,25 +64,7 @@
   static bool load_library();
 
   // Machine dependent stuff
-#ifdef TARGET_ARCH_x86
-# include "disassembler_x86.hpp"
-#endif
-#ifdef TARGET_ARCH_sparc
-# include "disassembler_sparc.hpp"
-#endif
-#ifdef TARGET_ARCH_zero
-# include "disassembler_zero.hpp"
-#endif
-#ifdef TARGET_ARCH_arm
-# include "disassembler_arm.hpp"
-#endif
-#ifdef TARGET_ARCH_ppc
-# include "disassembler_ppc.hpp"
-#endif
-#ifdef TARGET_ARCH_aarch64
-# include "disassembler_aarch64.hpp"
-#endif
-
+#include CPU_HEADER(disassembler)
 
  public:
   static bool can_decode() {
diff --git a/hotspot/src/share/vm/compiler/oopMap.cpp b/hotspot/src/share/vm/compiler/oopMap.cpp
index 197324a..378198e 100644
--- a/hotspot/src/share/vm/compiler/oopMap.cpp
+++ b/hotspot/src/share/vm/compiler/oopMap.cpp
@@ -273,14 +273,9 @@
 static DoNothingClosure do_nothing;
 
 static void add_derived_oop(oop* base, oop* derived) {
-#ifndef TIERED
+#if !defined(TIERED) && !defined(INCLUDE_JVMCI)
   COMPILER1_PRESENT(ShouldNotReachHere();)
-#if INCLUDE_JVMCI
-  if (UseJVMCICompiler) {
-    ShouldNotReachHere();
-  }
-#endif
-#endif // TIERED
+#endif // !defined(TIERED) && !defined(INCLUDE_JVMCI)
 #if defined(COMPILER2) || INCLUDE_JVMCI
   DerivedPointerTable::add(derived, base);
 #endif // COMPILER2 || INCLUDE_JVMCI
@@ -473,13 +468,8 @@
 #ifndef PRODUCT
 
 bool ImmutableOopMap::has_derived_pointer() const {
-#ifndef TIERED
+#if !defined(TIERED) && !defined(INCLUDE_JVMCI)
   COMPILER1_PRESENT(return false);
-#if INCLUDE_JVMCI
-  if (UseJVMCICompiler) {
-    return false;
-  }
-#endif
 #endif // !TIERED
 #if defined(COMPILER2) || INCLUDE_JVMCI
   OopMapStream oms(this,OopMapValue::derived_oop_value);
diff --git a/hotspot/src/share/vm/gc/cms/concurrentMarkSweepGeneration.cpp b/hotspot/src/share/vm/gc/cms/concurrentMarkSweepGeneration.cpp
index 1df96bd..cbbbfbd 100644
--- a/hotspot/src/share/vm/gc/cms/concurrentMarkSweepGeneration.cpp
+++ b/hotspot/src/share/vm/gc/cms/concurrentMarkSweepGeneration.cpp
@@ -2888,7 +2888,10 @@
 
       CMSParInitialMarkTask tsk(this, &srs, n_workers);
       initialize_sequential_subtasks_for_young_gen_rescan(n_workers);
-      if (n_workers > 1) {
+      // If the total workers is greater than 1, then multiple workers
+      // may be used at some time and the initialization has been set
+      // such that the single threaded path cannot be used.
+      if (workers->total_workers() > 1) {
         workers->run_task(&tsk);
       } else {
         tsk.work(0);
@@ -3507,7 +3510,7 @@
   uint num_workers = AdaptiveSizePolicy::calc_active_conc_workers(conc_workers()->total_workers(),
                                                                   conc_workers()->active_workers(),
                                                                   Threads::number_of_non_daemon_threads());
-  conc_workers()->set_active_workers(num_workers);
+  num_workers = conc_workers()->update_active_workers(num_workers);
 
   CompactibleFreeListSpace* cms_space  = _cmsGen->cmsSpace();
 
diff --git a/hotspot/src/share/vm/gc/cms/parNewGeneration.cpp b/hotspot/src/share/vm/gc/cms/parNewGeneration.cpp
index adf5156..da6b6d6 100644
--- a/hotspot/src/share/vm/gc/cms/parNewGeneration.cpp
+++ b/hotspot/src/share/vm/gc/cms/parNewGeneration.cpp
@@ -898,7 +898,7 @@
        AdaptiveSizePolicy::calc_active_workers(workers->total_workers(),
                                                workers->active_workers(),
                                                Threads::number_of_non_daemon_threads());
-  workers->set_active_workers(active_workers);
+  active_workers = workers->update_active_workers(active_workers);
   _old_gen = gch->old_gen();
 
   // If the next generation is too full to accommodate worst-case promotion
@@ -952,7 +952,9 @@
     // separate thread causes wide variance in run times.  We can't help this
     // in the multi-threaded case, but we special-case n=1 here to get
     // repeatable measurements of the 1-thread overhead of the parallel code.
-    if (active_workers > 1) {
+    // Might multiple workers ever be used?  If yes, initialization
+    // has been done such that the single threaded path should not be used.
+    if (workers->total_workers() > 1) {
       workers->run_task(&tsk);
     } else {
       tsk.work(0);
diff --git a/hotspot/src/share/vm/gc/g1/dirtyCardQueue.cpp b/hotspot/src/share/vm/gc/g1/dirtyCardQueue.cpp
index f95c29a..b16ccc6 100644
--- a/hotspot/src/share/vm/gc/g1/dirtyCardQueue.cpp
+++ b/hotspot/src/share/vm/gc/g1/dirtyCardQueue.cpp
@@ -122,7 +122,7 @@
 
 // Determines how many mutator threads can process the buffers in parallel.
 uint DirtyCardQueueSet::num_par_ids() {
-  return (uint)os::processor_count();
+  return (uint)os::initial_active_processor_count();
 }
 
 void DirtyCardQueueSet::initialize(CardTableEntryClosure* cl,
diff --git a/hotspot/src/share/vm/gc/g1/g1CollectedHeap.cpp b/hotspot/src/share/vm/gc/g1/g1CollectedHeap.cpp
index 1369a3e..d84e100 100644
--- a/hotspot/src/share/vm/gc/g1/g1CollectedHeap.cpp
+++ b/hotspot/src/share/vm/gc/g1/g1CollectedHeap.cpp
@@ -1331,7 +1331,7 @@
         AdaptiveSizePolicy::calc_active_workers(workers()->total_workers(),
                                                 workers()->active_workers(),
                                                 Threads::number_of_non_daemon_threads());
-      workers()->set_active_workers(n_workers);
+      workers()->update_active_workers(n_workers);
 
       ParRebuildRSTask rebuild_rs_task(this);
       workers()->run_task(&rebuild_rs_task);
@@ -3067,7 +3067,7 @@
     uint active_workers = AdaptiveSizePolicy::calc_active_workers(workers()->total_workers(),
                                                                   workers()->active_workers(),
                                                                   Threads::number_of_non_daemon_threads());
-    workers()->set_active_workers(active_workers);
+    workers()->update_active_workers(active_workers);
 
     TraceCollectorStats tcs(g1mm()->incremental_collection_counters());
     TraceMemoryManagerStats tms(false /* fullGC */, gc_cause());
@@ -4524,7 +4524,8 @@
 
 void G1CollectedHeap::free_region(HeapRegion* hr,
                                   FreeRegionList* free_list,
-                                  bool par,
+                                  bool skip_remset,
+                                  bool skip_hot_card_cache,
                                   bool locked) {
   assert(!hr->is_free(), "the region should not be free");
   assert(!hr->is_empty(), "the region should not be empty");
@@ -4539,20 +4540,20 @@
   // Clear the card counts for this region.
   // Note: we only need to do this if the region is not young
   // (since we don't refine cards in young regions).
-  if (!hr->is_young()) {
+  if (!skip_hot_card_cache && !hr->is_young()) {
     _hot_card_cache->reset_card_counts(hr);
   }
-  hr->hr_clear(par, true /* clear_space */, locked /* locked */);
+  hr->hr_clear(skip_remset, true /* clear_space */, locked /* locked */);
   free_list->add_ordered(hr);
 }
 
 void G1CollectedHeap::free_humongous_region(HeapRegion* hr,
                                             FreeRegionList* free_list,
-                                            bool par) {
+                                            bool skip_remset) {
   assert(hr->is_humongous(), "this is only for humongous regions");
   assert(free_list != NULL, "pre-condition");
   hr->clear_humongous();
-  free_region(hr, free_list, par);
+  free_region(hr, free_list, skip_remset);
 }
 
 void G1CollectedHeap::remove_from_old_sets(const uint old_regions_removed,
@@ -4600,137 +4601,280 @@
   workers()->run_task(&g1_par_scrub_rs_task);
 }
 
-class G1FreeCollectionSetClosure : public HeapRegionClosure {
+class G1FreeCollectionSetTask : public AbstractGangTask {
 private:
+
+  // Closure applied to all regions in the collection set to do work that needs to
+  // be done serially in a single thread.
+  class G1SerialFreeCollectionSetClosure : public HeapRegionClosure {
+  private:
+    EvacuationInfo* _evacuation_info;
+    const size_t* _surviving_young_words;
+
+    // Bytes used in successfully evacuated regions before the evacuation.
+    size_t _before_used_bytes;
+    // Bytes used in unsucessfully evacuated regions before the evacuation
+    size_t _after_used_bytes;
+
+    size_t _bytes_allocated_in_old_since_last_gc;
+
+    size_t _failure_used_words;
+    size_t _failure_waste_words;
+
+    FreeRegionList _local_free_list;
+  public:
+    G1SerialFreeCollectionSetClosure(EvacuationInfo* evacuation_info, const size_t* surviving_young_words) :
+      HeapRegionClosure(),
+      _evacuation_info(evacuation_info),
+      _surviving_young_words(surviving_young_words),
+      _before_used_bytes(0),
+      _after_used_bytes(0),
+      _bytes_allocated_in_old_since_last_gc(0),
+      _failure_used_words(0),
+      _failure_waste_words(0),
+      _local_free_list("Local Region List for CSet Freeing") {
+    }
+
+    virtual bool doHeapRegion(HeapRegion* r) {
+      G1CollectedHeap* g1h = G1CollectedHeap::heap();
+
+      assert(r->in_collection_set(), "Region %u should be in collection set.", r->hrm_index());
+      g1h->clear_in_cset(r);
+
+      if (r->is_young()) {
+        assert(r->young_index_in_cset() != -1 && (uint)r->young_index_in_cset() < g1h->collection_set()->young_region_length(),
+               "Young index %d is wrong for region %u of type %s with %u young regions",
+               r->young_index_in_cset(),
+               r->hrm_index(),
+               r->get_type_str(),
+               g1h->collection_set()->young_region_length());
+        size_t words_survived = _surviving_young_words[r->young_index_in_cset()];
+        r->record_surv_words_in_group(words_survived);
+      }
+
+      if (!r->evacuation_failed()) {
+        assert(r->not_empty(), "Region %u is an empty region in the collection set.", r->hrm_index());
+        _before_used_bytes += r->used();
+        g1h->free_region(r,
+                         &_local_free_list,
+                         true, /* skip_remset */
+                         true, /* skip_hot_card_cache */
+                         true  /* locked */);
+      } else {
+        r->uninstall_surv_rate_group();
+        r->set_young_index_in_cset(-1);
+        r->set_evacuation_failed(false);
+        // When moving a young gen region to old gen, we "allocate" that whole region
+        // there. This is in addition to any already evacuated objects. Notify the
+        // policy about that.
+        // Old gen regions do not cause an additional allocation: both the objects
+        // still in the region and the ones already moved are accounted for elsewhere.
+        if (r->is_young()) {
+          _bytes_allocated_in_old_since_last_gc += HeapRegion::GrainBytes;
+        }
+        // The region is now considered to be old.
+        r->set_old();
+        // Do some allocation statistics accounting. Regions that failed evacuation
+        // are always made old, so there is no need to update anything in the young
+        // gen statistics, but we need to update old gen statistics.
+        size_t used_words = r->marked_bytes() / HeapWordSize;
+
+        _failure_used_words += used_words;
+        _failure_waste_words += HeapRegion::GrainWords - used_words;
+
+        g1h->old_set_add(r);
+        _after_used_bytes += r->used();
+      }
+      return false;
+    }
+
+    void complete_work() {
+      G1CollectedHeap* g1h = G1CollectedHeap::heap();
+
+      _evacuation_info->set_regions_freed(_local_free_list.length());
+      _evacuation_info->increment_collectionset_used_after(_after_used_bytes);
+
+      g1h->prepend_to_freelist(&_local_free_list);
+      g1h->decrement_summary_bytes(_before_used_bytes);
+
+      G1Policy* policy = g1h->g1_policy();
+      policy->add_bytes_allocated_in_old_since_last_gc(_bytes_allocated_in_old_since_last_gc);
+
+      g1h->alloc_buffer_stats(InCSetState::Old)->add_failure_used_and_waste(_failure_used_words, _failure_waste_words);
+    }
+  };
+
+  G1CollectionSet* _collection_set;
+  G1SerialFreeCollectionSetClosure _cl;
   const size_t* _surviving_young_words;
 
-  FreeRegionList _local_free_list;
   size_t _rs_lengths;
-  // Bytes used in successfully evacuated regions before the evacuation.
-  size_t _before_used_bytes;
-  // Bytes used in unsucessfully evacuated regions before the evacuation
-  size_t _after_used_bytes;
 
-  size_t _bytes_allocated_in_old_since_last_gc;
+  volatile jint _serial_work_claim;
 
-  size_t _failure_used_words;
-  size_t _failure_waste_words;
+  struct WorkItem {
+    uint region_idx;
+    bool is_young;
+    bool evacuation_failed;
 
-  double _young_time;
-  double _non_young_time;
-public:
-  G1FreeCollectionSetClosure(const size_t* surviving_young_words) :
-    HeapRegionClosure(),
-    _surviving_young_words(surviving_young_words),
-    _local_free_list("Local Region List for CSet Freeing"),
-    _rs_lengths(0),
-    _before_used_bytes(0),
-    _after_used_bytes(0),
-    _bytes_allocated_in_old_since_last_gc(0),
-    _failure_used_words(0),
-    _failure_waste_words(0),
-    _young_time(0.0),
-    _non_young_time(0.0) {
+    WorkItem(HeapRegion* r) {
+      region_idx = r->hrm_index();
+      is_young = r->is_young();
+      evacuation_failed = r->evacuation_failed();
+    }
+  };
+
+  volatile size_t _parallel_work_claim;
+  size_t _num_work_items;
+  WorkItem* _work_items;
+
+  void do_serial_work() {
+    // Need to grab the lock to be allowed to modify the old region list.
+    MutexLockerEx x(OldSets_lock, Mutex::_no_safepoint_check_flag);
+    _collection_set->iterate(&_cl);
   }
 
-  virtual bool doHeapRegion(HeapRegion* r) {
-    double start_time = os::elapsedTime();
-
-    bool is_young = r->is_young();
-
+  void do_parallel_work_for_region(uint region_idx, bool is_young, bool evacuation_failed) {
     G1CollectedHeap* g1h = G1CollectedHeap::heap();
+
+    HeapRegion* r = g1h->region_at(region_idx);
     assert(!g1h->is_on_master_free_list(r), "sanity");
 
-    _rs_lengths += r->rem_set()->occupied_locked();
+    Atomic::add(r->rem_set()->occupied_locked(), &_rs_lengths);
 
-    assert(r->in_collection_set(), "Region %u should be in collection set.", r->hrm_index());
-    g1h->clear_in_cset(r);
-
-    if (is_young) {
-      int index = r->young_index_in_cset();
-      assert(index != -1, "Young index in collection set must not be -1 for region %u", r->hrm_index());
-      assert((uint) index < g1h->collection_set()->young_region_length(), "invariant");
-      size_t words_survived = _surviving_young_words[index];
-      r->record_surv_words_in_group(words_survived);
-    } else {
-      assert(r->young_index_in_cset() == -1, "Young index for old region %u in collection set must be -1", r->hrm_index());
+    if (!is_young) {
+      g1h->_hot_card_cache->reset_card_counts(r);
     }
 
-    if (!r->evacuation_failed()) {
-      assert(r->not_empty(), "Region %u is an empty region in the collection set.", r->hrm_index());
-      _before_used_bytes += r->used();
-      g1h->free_region(r, &_local_free_list, false /* par */, true /* locked */);
-    } else {
-      r->uninstall_surv_rate_group();
-      r->set_young_index_in_cset(-1);
-      r->set_evacuation_failed(false);
-      // When moving a young gen region to old gen, we "allocate" that whole region
-      // there. This is in addition to any already evacuated objects. Notify the
-      // policy about that.
-      // Old gen regions do not cause an additional allocation: both the objects
-      // still in the region and the ones already moved are accounted for elsewhere.
-      if (is_young) {
-        _bytes_allocated_in_old_since_last_gc += HeapRegion::GrainBytes;
-      }
-      // The region is now considered to be old.
-      r->set_old();
-      // Do some allocation statistics accounting. Regions that failed evacuation
-      // are always made old, so there is no need to update anything in the young
-      // gen statistics, but we need to update old gen statistics.
-      size_t used_words = r->marked_bytes() / HeapWordSize;
-
-      _failure_used_words += used_words;
-      _failure_waste_words += HeapRegion::GrainWords - used_words;
-
-      g1h->old_set_add(r);
-      _after_used_bytes += r->used();
+    if (!evacuation_failed) {
+      r->rem_set()->clear_locked();
     }
-
-    if (is_young) {
-      _young_time += os::elapsedTime() - start_time;
-    } else {
-      _non_young_time += os::elapsedTime() - start_time;
-    }
-    return false;
   }
 
-  FreeRegionList* local_free_list() { return &_local_free_list; }
-  size_t rs_lengths() const { return _rs_lengths; }
-  size_t before_used_bytes() const { return _before_used_bytes; }
-  size_t after_used_bytes() const { return _after_used_bytes; }
+  class G1PrepareFreeCollectionSetClosure : public HeapRegionClosure {
+  private:
+    size_t _cur_idx;
+    WorkItem* _work_items;
+  public:
+    G1PrepareFreeCollectionSetClosure(WorkItem* work_items) : HeapRegionClosure(), _cur_idx(0), _work_items(work_items) { }
 
-  size_t bytes_allocated_in_old_since_last_gc() const { return _bytes_allocated_in_old_since_last_gc; }
+    virtual bool doHeapRegion(HeapRegion* r) {
+      _work_items[_cur_idx++] = WorkItem(r);
+      return false;
+    }
+  };
 
-  size_t failure_used_words() const { return _failure_used_words; }
-  size_t failure_waste_words() const { return _failure_waste_words; }
+  void prepare_work() {
+    G1PrepareFreeCollectionSetClosure cl(_work_items);
+    _collection_set->iterate(&cl);
+  }
 
-  double young_time() const { return _young_time; }
-  double non_young_time() const { return _non_young_time; }
+  void complete_work() {
+    _cl.complete_work();
+
+    G1Policy* policy = G1CollectedHeap::heap()->g1_policy();
+    policy->record_max_rs_lengths(_rs_lengths);
+    policy->cset_regions_freed();
+  }
+public:
+  G1FreeCollectionSetTask(G1CollectionSet* collection_set, EvacuationInfo* evacuation_info, const size_t* surviving_young_words) :
+    AbstractGangTask("G1 Free Collection Set"),
+    _cl(evacuation_info, surviving_young_words),
+    _collection_set(collection_set),
+    _surviving_young_words(surviving_young_words),
+    _serial_work_claim(0),
+    _rs_lengths(0),
+    _parallel_work_claim(0),
+    _num_work_items(collection_set->region_length()),
+    _work_items(NEW_C_HEAP_ARRAY(WorkItem, _num_work_items, mtGC)) {
+    prepare_work();
+  }
+
+  ~G1FreeCollectionSetTask() {
+    complete_work();
+    FREE_C_HEAP_ARRAY(WorkItem, _work_items);
+  }
+
+  // Chunk size for work distribution. The chosen value has been determined experimentally
+  // to be a good tradeoff between overhead and achievable parallelism.
+  static uint chunk_size() { return 32; }
+
+  virtual void work(uint worker_id) {
+    G1GCPhaseTimes* timer = G1CollectedHeap::heap()->g1_policy()->phase_times();
+
+    // Claim serial work.
+    if (_serial_work_claim == 0) {
+      jint value = Atomic::add(1, &_serial_work_claim) - 1;
+      if (value == 0) {
+        double serial_time = os::elapsedTime();
+        do_serial_work();
+        timer->record_serial_free_cset_time_ms((os::elapsedTime() - serial_time) * 1000.0);
+      }
+    }
+
+    // Start parallel work.
+    double young_time = 0.0;
+    bool has_young_time = false;
+    double non_young_time = 0.0;
+    bool has_non_young_time = false;
+
+    while (true) {
+      size_t end = Atomic::add(chunk_size(), &_parallel_work_claim);
+      size_t cur = end - chunk_size();
+
+      if (cur >= _num_work_items) {
+        break;
+      }
+
+      double start_time = os::elapsedTime();
+
+      end = MIN2(end, _num_work_items);
+
+      for (; cur < end; cur++) {
+        bool is_young = _work_items[cur].is_young;
+
+        do_parallel_work_for_region(_work_items[cur].region_idx, is_young, _work_items[cur].evacuation_failed);
+
+        double end_time = os::elapsedTime();
+        double time_taken = end_time - start_time;
+        if (is_young) {
+          young_time += time_taken;
+          has_young_time = true;
+        } else {
+          non_young_time += time_taken;
+          has_non_young_time = true;
+        }
+        start_time = end_time;
+      }
+    }
+
+    if (has_young_time) {
+      timer->record_time_secs(G1GCPhaseTimes::YoungFreeCSet, worker_id, young_time);
+    }
+    if (has_non_young_time) {
+      timer->record_time_secs(G1GCPhaseTimes::NonYoungFreeCSet, worker_id, young_time);
+    }
+  }
 };
 
 void G1CollectedHeap::free_collection_set(G1CollectionSet* collection_set, EvacuationInfo& evacuation_info, const size_t* surviving_young_words) {
   _eden.clear();
 
-  G1FreeCollectionSetClosure cl(surviving_young_words);
-  collection_set_iterate(&cl);
+  double free_cset_start_time = os::elapsedTime();
 
-  evacuation_info.set_regions_freed(cl.local_free_list()->length());
-  evacuation_info.increment_collectionset_used_after(cl.after_used_bytes());
+  {
+    uint const num_chunks = MAX2(_collection_set.region_length() / G1FreeCollectionSetTask::chunk_size(), 1U);
+    uint const num_workers = MIN2(workers()->active_workers(), num_chunks);
 
-  G1Policy* policy = g1_policy();
+    G1FreeCollectionSetTask cl(collection_set, &evacuation_info, surviving_young_words);
 
-  policy->record_max_rs_lengths(cl.rs_lengths());
-  policy->cset_regions_freed();
-
-  prepend_to_freelist(cl.local_free_list());
-  decrement_summary_bytes(cl.before_used_bytes());
-
-  policy->add_bytes_allocated_in_old_since_last_gc(cl.bytes_allocated_in_old_since_last_gc());
-
-  _old_evac_stats.add_failure_used_and_waste(cl.failure_used_words(), cl.failure_waste_words());
-
-  policy->phase_times()->record_young_free_cset_time_ms(cl.young_time() * 1000.0);
-  policy->phase_times()->record_non_young_free_cset_time_ms(cl.non_young_time() * 1000.0);
+    log_debug(gc, ergo)("Running %s using %u workers for collection set length %u",
+                        cl.name(),
+                        num_workers,
+                        _collection_set.region_length());
+    workers()->run_task(&cl, num_workers);
+  }
+  g1_policy()->phase_times()->record_total_free_cset_time_ms((os::elapsedTime() - free_cset_start_time) * 1000.0);
 
   collection_set->clear();
 }
@@ -4825,7 +4969,7 @@
       _freed_bytes += r->used();
       r->set_containing_set(NULL);
       _humongous_regions_removed++;
-      g1h->free_humongous_region(r, _free_region_list, false);
+      g1h->free_humongous_region(r, _free_region_list, false /* skip_remset */ );
       r = next;
     } while (r != NULL);
 
diff --git a/hotspot/src/share/vm/gc/g1/g1CollectedHeap.hpp b/hotspot/src/share/vm/gc/g1/g1CollectedHeap.hpp
index 134f388..b477783 100644
--- a/hotspot/src/share/vm/gc/g1/g1CollectedHeap.hpp
+++ b/hotspot/src/share/vm/gc/g1/g1CollectedHeap.hpp
@@ -118,6 +118,7 @@
 };
 
 class G1CollectedHeap : public CollectedHeap {
+  friend class G1FreeCollectionSetTask;
   friend class VM_CollectForMetadataAllocation;
   friend class VM_G1CollectForAllocation;
   friend class VM_G1CollectFull;
@@ -642,13 +643,15 @@
   // adding it to the free list that's passed as a parameter (this is
   // usually a local list which will be appended to the master free
   // list later). The used bytes of freed regions are accumulated in
-  // pre_used. If par is true, the region's RSet will not be freed
-  // up. The assumption is that this will be done later.
+  // pre_used. If skip_remset is true, the region's RSet will not be freed
+  // up. If skip_hot_card_cache is true, the region's hot card cache will not
+  // be freed up. The assumption is that this will be done later.
   // The locked parameter indicates if the caller has already taken
   // care of proper synchronization. This may allow some optimizations.
   void free_region(HeapRegion* hr,
                    FreeRegionList* free_list,
-                   bool par,
+                   bool skip_remset,
+                   bool skip_hot_card_cache = false,
                    bool locked = false);
 
   // It dirties the cards that cover the block so that the post
@@ -662,11 +665,11 @@
   // will be added to the free list that's passed as a parameter (this
   // is usually a local list which will be appended to the master free
   // list later). The used bytes of freed regions are accumulated in
-  // pre_used. If par is true, the region's RSet will not be freed
+  // pre_used. If skip_remset is true, the region's RSet will not be freed
   // up. The assumption is that this will be done later.
   void free_humongous_region(HeapRegion* hr,
                              FreeRegionList* free_list,
-                             bool par);
+                             bool skip_remset);
 
   // Facility for allocating in 'archive' regions in high heap memory and
   // recording the allocated ranges. These should all be called from the
diff --git a/hotspot/src/share/vm/gc/g1/g1ConcurrentMark.cpp b/hotspot/src/share/vm/gc/g1/g1ConcurrentMark.cpp
index e61175a..454c598 100644
--- a/hotspot/src/share/vm/gc/g1/g1ConcurrentMark.cpp
+++ b/hotspot/src/share/vm/gc/g1/g1ConcurrentMark.cpp
@@ -132,109 +132,114 @@
                    heapWordToOffset(mr.end()), false);
 }
 
-G1CMMarkStack::G1CMMarkStack(G1ConcurrentMark* cm) :
-  _base(NULL), _cm(cm)
-{}
+G1CMMarkStack::G1CMMarkStack() :
+  _reserved_space(),
+  _base(NULL),
+  _capacity(0),
+  _saved_index((size_t)AllBits),
+  _should_expand(false) {
+  set_empty();
+}
 
-bool G1CMMarkStack::allocate(size_t capacity) {
-  // allocate a stack of the requisite depth
-  ReservedSpace rs(ReservedSpace::allocation_align_size_up(capacity * sizeof(oop)));
+bool G1CMMarkStack::resize(size_t new_capacity) {
+  assert(is_empty(), "Only resize when stack is empty.");
+  assert(new_capacity <= MarkStackSizeMax,
+         "Trying to resize stack to " SIZE_FORMAT " elements when the maximum is " SIZE_FORMAT, new_capacity, MarkStackSizeMax);
+
+  size_t reservation_size = ReservedSpace::allocation_align_size_up(new_capacity * sizeof(oop));
+
+  ReservedSpace rs(reservation_size);
   if (!rs.is_reserved()) {
-    log_warning(gc)("ConcurrentMark MarkStack allocation failure");
+    log_warning(gc)("Failed to reserve memory for new overflow mark stack with " SIZE_FORMAT " elements and size " SIZE_FORMAT "B.", new_capacity, reservation_size);
     return false;
   }
-  MemTracker::record_virtual_memory_type((address)rs.base(), mtGC);
-  if (!_virtual_space.initialize(rs, rs.size())) {
-    log_warning(gc)("ConcurrentMark MarkStack backing store failure");
-    // Release the virtual memory reserved for the marking stack
+
+  VirtualSpace vs;
+
+  if (!vs.initialize(rs, rs.size())) {
     rs.release();
+    log_warning(gc)("Failed to commit memory for new overflow mark stack of size " SIZE_FORMAT "B.", rs.size());
     return false;
   }
-  assert(_virtual_space.committed_size() == rs.size(),
-         "Didn't reserve backing store for all of G1ConcurrentMark stack?");
-  _base = (oop*) _virtual_space.low();
-  setEmpty();
-  _capacity = (jint) capacity;
-  _saved_index = -1;
+
+  assert(vs.committed_size() == rs.size(), "Failed to commit all of the mark stack.");
+
+  // Release old mapping.
+  _reserved_space.release();
+
+  // Save new mapping for future unmapping.
+  _reserved_space = rs;
+
+  MemTracker::record_virtual_memory_type((address)_reserved_space.base(), mtGC);
+
+  _base = (oop*) vs.low();
+  _capacity = new_capacity;
+  set_empty();
   _should_expand = false;
+
   return true;
 }
 
-void G1CMMarkStack::expand() {
-  // Called, during remark, if we've overflown the marking stack during marking.
-  assert(isEmpty(), "stack should been emptied while handling overflow");
-  assert(_capacity <= (jint) MarkStackSizeMax, "stack bigger than permitted");
-  // Clear expansion flag
-  _should_expand = false;
-  if (_capacity == (jint) MarkStackSizeMax) {
-    log_trace(gc)("(benign) Can't expand marking stack capacity, at max size limit");
-    return;
-  }
-  // Double capacity if possible
-  jint new_capacity = MIN2(_capacity*2, (jint) MarkStackSizeMax);
-  // Do not give up existing stack until we have managed to
-  // get the double capacity that we desired.
-  ReservedSpace rs(ReservedSpace::allocation_align_size_up(new_capacity *
-                                                           sizeof(oop)));
-  if (rs.is_reserved()) {
-    // Release the backing store associated with old stack
-    _virtual_space.release();
-    // Reinitialize virtual space for new stack
-    if (!_virtual_space.initialize(rs, rs.size())) {
-      fatal("Not enough swap for expanded marking stack capacity");
-    }
-    _base = (oop*)(_virtual_space.low());
-    _index = 0;
-    _capacity = new_capacity;
-  } else {
-    // Failed to double capacity, continue;
-    log_trace(gc)("(benign) Failed to expand marking stack capacity from " SIZE_FORMAT "K to " SIZE_FORMAT "K",
-                  _capacity / K, new_capacity / K);
-  }
+bool G1CMMarkStack::allocate(size_t capacity) {
+  return resize(capacity);
 }
 
-void G1CMMarkStack::set_should_expand() {
-  // If we're resetting the marking state because of an
-  // marking stack overflow, record that we should, if
-  // possible, expand the stack.
-  _should_expand = _cm->has_overflown();
+void G1CMMarkStack::expand() {
+  // Clear expansion flag
+  _should_expand = false;
+
+  if (_capacity == MarkStackSizeMax) {
+    log_debug(gc)("Can not expand overflow mark stack further, already at maximum capacity of " SIZE_FORMAT " elements.", _capacity);
+    return;
+  }
+  size_t old_capacity = _capacity;
+  // Double capacity if possible
+  size_t new_capacity = MIN2(old_capacity * 2, MarkStackSizeMax);
+
+  if (resize(new_capacity)) {
+    log_debug(gc)("Expanded marking stack capacity from " SIZE_FORMAT " to " SIZE_FORMAT " elements",
+                  old_capacity, new_capacity);
+  } else {
+    log_warning(gc)("Failed to expand marking stack capacity from " SIZE_FORMAT " to " SIZE_FORMAT " elements",
+                    old_capacity, new_capacity);
+  }
 }
 
 G1CMMarkStack::~G1CMMarkStack() {
   if (_base != NULL) {
     _base = NULL;
-    _virtual_space.release();
+    _reserved_space.release();
   }
 }
 
-void G1CMMarkStack::par_push_arr(oop* ptr_arr, int n) {
+void G1CMMarkStack::par_push_arr(oop* buffer, size_t n) {
   MutexLockerEx x(ParGCRareEvent_lock, Mutex::_no_safepoint_check_flag);
-  jint start = _index;
-  jint next_index = start + n;
+  size_t start = _index;
+  size_t next_index = start + n;
   if (next_index > _capacity) {
     _overflow = true;
     return;
   }
   // Otherwise.
   _index = next_index;
-  for (int i = 0; i < n; i++) {
-    int ind = start + i;
+  for (size_t i = 0; i < n; i++) {
+    size_t ind = start + i;
     assert(ind < _capacity, "By overflow test above.");
-    _base[ind] = ptr_arr[i];
+    _base[ind] = buffer[i];
   }
 }
 
-bool G1CMMarkStack::par_pop_arr(oop* ptr_arr, int max, int* n) {
+bool G1CMMarkStack::par_pop_arr(oop* buffer, size_t max, size_t* n) {
   MutexLockerEx x(ParGCRareEvent_lock, Mutex::_no_safepoint_check_flag);
-  jint index = _index;
+  size_t index = _index;
   if (index == 0) {
     *n = 0;
     return false;
   } else {
-    int k = MIN2(max, index);
-    jint  new_ind = index - k;
-    for (int j = 0; j < k; j++) {
-      ptr_arr[j] = _base[new_ind + j];
+    size_t k = MIN2(max, index);
+    size_t new_ind = index - k;
+    for (size_t j = 0; j < k; j++) {
+      buffer[j] = _base[new_ind + j];
     }
     _index = new_ind;
     *n = k;
@@ -243,20 +248,14 @@
 }
 
 void G1CMMarkStack::note_start_of_gc() {
-  assert(_saved_index == -1,
-         "note_start_of_gc()/end_of_gc() bracketed incorrectly");
+  assert(_saved_index == (size_t)AllBits, "note_start_of_gc()/end_of_gc() calls bracketed incorrectly");
   _saved_index = _index;
 }
 
 void G1CMMarkStack::note_end_of_gc() {
-  // This is intentionally a guarantee, instead of an assert. If we
-  // accidentally add something to the mark stack during GC, it
-  // will be a correctness issue so it's better if we crash. we'll
-  // only check this once per GC anyway, so it won't be a performance
-  // issue in any way.
-  guarantee(_saved_index == _index,
-            "saved index: %d index: %d", _saved_index, _index);
-  _saved_index = -1;
+  guarantee(!stack_modified(), "Saved index " SIZE_FORMAT " must be the same as " SIZE_FORMAT, _saved_index, _index);
+
+  _saved_index = (size_t)AllBits;
 }
 
 G1CMRootRegions::G1CMRootRegions() :
@@ -351,7 +350,7 @@
   _prevMarkBitMap(&_markBitMap1),
   _nextMarkBitMap(&_markBitMap2),
 
-  _markStack(this),
+  _global_mark_stack(),
   // _finger set in set_non_marking_state
 
   _max_worker_id(ParallelGCThreads),
@@ -417,11 +416,10 @@
     double overall_cm_overhead =
       (double) MaxGCPauseMillis * marking_overhead /
       (double) GCPauseIntervalMillis;
-    double cpu_ratio = 1.0 / (double) os::processor_count();
+    double cpu_ratio = 1.0 / os::initial_active_processor_count();
     double marking_thread_num = ceil(overall_cm_overhead / cpu_ratio);
     double marking_task_overhead =
-      overall_cm_overhead / marking_thread_num *
-                                              (double) os::processor_count();
+      overall_cm_overhead / marking_thread_num * os::initial_active_processor_count();
     double sleep_factor =
                        (1.0 - marking_task_overhead) / marking_task_overhead;
 
@@ -485,8 +483,8 @@
     }
   }
 
-  if (!_markStack.allocate(MarkStackSize)) {
-    log_warning(gc)("Failed to allocate CM marking stack");
+  if (!_global_mark_stack.allocate(MarkStackSize)) {
+    vm_exit_during_initialization("Failed to allocate initial concurrent mark overflow mark stack.");
     return;
   }
 
@@ -541,8 +539,8 @@
 
 
 void G1ConcurrentMark::reset_marking_state(bool clear_overflow) {
-  _markStack.set_should_expand();
-  _markStack.setEmpty();        // Also clears the _markStack overflow flag
+  _global_mark_stack.set_should_expand(has_overflown());
+  _global_mark_stack.set_empty();        // Also clears the overflow stack's overflow flag
   if (clear_overflow) {
     clear_has_overflown();
   } else {
@@ -1033,11 +1031,14 @@
   uint active_workers = MAX2(1U, parallel_marking_threads());
   assert(active_workers > 0, "Should have been set");
 
+  // Setting active workers is not guaranteed since fewer
+  // worker threads may currently exist and more may not be
+  // available.
+  active_workers = _parallel_workers->update_active_workers(active_workers);
   // Parallel task terminator is set in "set_concurrency_and_phase()"
   set_concurrency_and_phase(active_workers, true /* concurrent */);
 
   G1CMConcurrentMarkingTask markingTask(this, cmThread());
-  _parallel_workers->set_active_workers(active_workers);
   _parallel_workers->run_task(&markingTask);
   print_stats();
 }
@@ -1076,7 +1077,7 @@
   weakRefsWork(clear_all_soft_refs);
 
   if (has_overflown()) {
-    // Oops.  We overflowed.  Restart concurrent marking.
+    // We overflowed.  Restart concurrent marking.
     _restart_for_overflow = true;
 
     // Verify the heap w.r.t. the previous marking bitmap.
@@ -1109,8 +1110,8 @@
   }
 
   // Expand the marking stack, if we have to and if we can.
-  if (_markStack.should_expand()) {
-    _markStack.expand();
+  if (_global_mark_stack.should_expand()) {
+    _global_mark_stack.expand();
   }
 
   // Statistics
@@ -1160,10 +1161,10 @@
       hr->set_containing_set(NULL);
       if (hr->is_humongous()) {
         _humongous_regions_removed++;
-        _g1->free_humongous_region(hr, _local_cleanup_list, true);
+        _g1->free_humongous_region(hr, _local_cleanup_list, true /* skip_remset */);
       } else {
         _old_regions_removed++;
-        _g1->free_region(hr, _local_cleanup_list, true);
+        _g1->free_region(hr, _local_cleanup_list, true /* skip_remset */);
       }
     } else {
       hr->rem_set()->do_cleanup_work(_hrrs_cleanup_task);
@@ -1637,7 +1638,7 @@
 
     // Set the soft reference policy
     rp->setup_policy(clear_all_soft_refs);
-    assert(_markStack.isEmpty(), "mark stack should be empty");
+    assert(_global_mark_stack.is_empty(), "mark stack should be empty");
 
     // Instances of the 'Keep Alive' and 'Complete GC' closures used
     // in serial reference processing. Note these closures are also
@@ -1692,10 +1693,10 @@
     // oop closures will set the has_overflown flag if we overflow the
     // global marking stack.
 
-    assert(_markStack.overflow() || _markStack.isEmpty(),
+    assert(_global_mark_stack.overflow() || _global_mark_stack.is_empty(),
             "mark stack should be empty (unless it overflowed)");
 
-    if (_markStack.overflow()) {
+    if (_global_mark_stack.overflow()) {
       // This should have been done already when we tried to push an
       // entry on to the global mark stack. But let's do it again.
       set_has_overflown();
@@ -1714,7 +1715,7 @@
     return;
   }
 
-  assert(_markStack.isEmpty(), "Marking should have completed");
+  assert(_global_mark_stack.is_empty(), "Marking should have completed");
 
   // Unload Klasses, String, Symbols, Code Cache, etc.
   if (ClassUnloadingWithConcurrentMark) {
@@ -1967,7 +1968,7 @@
   }
 
   // Verify entries on the global mark stack
-  _markStack.iterate(VerifyNoCSetOops("Stack"));
+  _global_mark_stack.iterate(VerifyNoCSetOops("Stack"));
 
   // Verify entries on the task queues
   for (uint i = 0; i < _max_worker_id; ++i) {
@@ -2366,13 +2367,13 @@
   // local array where we'll store the entries that will be popped
   // from the global stack.
   oop buffer[global_stack_transfer_size];
-  int n;
+  size_t n;
   _cm->mark_stack_pop(buffer, global_stack_transfer_size, &n);
   assert(n <= global_stack_transfer_size,
          "we should not pop more than the given limit");
   if (n > 0) {
     // yes, we did actually pop at least one entry
-    for (int i = 0; i < n; ++i) {
+    for (size_t i = 0; i < n; ++i) {
       bool success = _task_queue->push(buffer[i]);
       // We only call this when the local queue is empty or under a
       // given target limit. So, we do not expect this push to fail.
diff --git a/hotspot/src/share/vm/gc/g1/g1ConcurrentMark.hpp b/hotspot/src/share/vm/gc/g1/g1ConcurrentMark.hpp
index 03e3346..0331976 100644
--- a/hotspot/src/share/vm/gc/g1/g1ConcurrentMark.hpp
+++ b/hotspot/src/share/vm/gc/g1/g1ConcurrentMark.hpp
@@ -145,53 +145,56 @@
   void clear_range(MemRegion mr);
 };
 
-// Represents a marking stack used by ConcurrentMarking in the G1 collector.
+// Represents the overflow mark stack used by concurrent marking.
+//
+// Stores oops in a huge buffer in virtual memory that is always fully committed.
+// Resizing may only happen during a STW pause when the stack is empty.
 class G1CMMarkStack VALUE_OBJ_CLASS_SPEC {
-  VirtualSpace _virtual_space;   // Underlying backing store for actual stack
-  G1ConcurrentMark* _cm;
-  oop* _base;        // bottom of stack
-  jint _index;       // one more than last occupied index
-  jint _capacity;    // max #elements
-  jint _saved_index; // value of _index saved at start of GC
+  ReservedSpace _reserved_space; // Space currently reserved for the mark stack.
+
+  oop* _base;                    // Bottom address of allocated memory area.
+  size_t _capacity;              // Maximum number of elements.
+  size_t _index;                 // One more than last occupied index.
+
+  size_t _saved_index;           // Value of _index saved at start of GC to detect mark stack modifications during that time.
 
   bool  _overflow;
   bool  _should_expand;
 
+  // Resizes the mark stack to the given new capacity. Releases any previous
+  // memory if successful.
+  bool resize(size_t new_capacity);
+
+  bool stack_modified() const { return _index != _saved_index; }
  public:
-  G1CMMarkStack(G1ConcurrentMark* cm);
+  G1CMMarkStack();
   ~G1CMMarkStack();
 
   bool allocate(size_t capacity);
 
-  // Pushes the first "n" elements of "ptr_arr" on the stack.
-  // Locking impl: concurrency is allowed only with
-  // "par_push_arr" and/or "par_pop_arr" operations, which use the same
-  // locking strategy.
-  void par_push_arr(oop* ptr_arr, int n);
+  // Pushes the first "n" elements of the given buffer on the stack.
+  void par_push_arr(oop* buffer, size_t n);
 
-  // If returns false, the array was empty.  Otherwise, removes up to "max"
-  // elements from the stack, and transfers them to "ptr_arr" in an
-  // unspecified order.  The actual number transferred is given in "n" ("n
-  // == 0" is deliberately redundant with the return value.)  Locking impl:
-  // concurrency is allowed only with "par_push_arr" and/or "par_pop_arr"
-  // operations, which use the same locking strategy.
-  bool par_pop_arr(oop* ptr_arr, int max, int* n);
+  // Moves up to max elements from the stack into the given buffer. Returns
+  // the number of elements pushed, and false if the array has been empty.
+  // Returns true if the buffer contains at least one element.
+  bool par_pop_arr(oop* buffer, size_t max, size_t* n);
 
-  bool isEmpty()    { return _index == 0; }
-  int  maxElems()   { return _capacity; }
+  bool is_empty() const { return _index == 0; }
+  size_t capacity() const  { return _capacity; }
 
-  bool overflow() { return _overflow; }
+  bool overflow() const { return _overflow; }
   void clear_overflow() { _overflow = false; }
 
   bool should_expand() const { return _should_expand; }
-  void set_should_expand();
+  void set_should_expand(bool value) { _should_expand = value; }
 
   // Expand the stack, typically in response to an overflow condition
   void expand();
 
-  int  size() { return _index; }
+  size_t size() const { return _index; }
 
-  void setEmpty()   { _index = 0; clear_overflow(); }
+  void set_empty() { _index = 0; clear_overflow(); }
 
   // Record the current index.
   void note_start_of_gc();
@@ -308,7 +311,7 @@
   G1CMRootRegions         _root_regions;
 
   // For gray objects
-  G1CMMarkStack           _markStack; // Grey objects behind global finger
+  G1CMMarkStack           _global_mark_stack; // Grey objects behind global finger
   HeapWord* volatile      _finger;  // The global finger, region aligned,
                                     // always points to the end of the
                                     // last claimed region
@@ -478,21 +481,21 @@
   // The push and pop operations are used by tasks for transfers
   // between task-local queues and the global mark stack, and use
   // locking for concurrency safety.
-  bool mark_stack_push(oop* arr, int n) {
-    _markStack.par_push_arr(arr, n);
-    if (_markStack.overflow()) {
+  bool mark_stack_push(oop* arr, size_t n) {
+    _global_mark_stack.par_push_arr(arr, n);
+    if (_global_mark_stack.overflow()) {
       set_has_overflown();
       return false;
     }
     return true;
   }
-  void mark_stack_pop(oop* arr, int max, int* n) {
-    _markStack.par_pop_arr(arr, max, n);
+  void mark_stack_pop(oop* arr, size_t max, size_t* n) {
+    _global_mark_stack.par_pop_arr(arr, max, n);
   }
-  size_t mark_stack_size()                { return _markStack.size(); }
-  size_t partial_mark_stack_size_target() { return _markStack.maxElems()/3; }
-  bool mark_stack_overflow()              { return _markStack.overflow(); }
-  bool mark_stack_empty()                 { return _markStack.isEmpty(); }
+  size_t mark_stack_size()                { return _global_mark_stack.size(); }
+  size_t partial_mark_stack_size_target() { return _global_mark_stack.capacity()/3; }
+  bool mark_stack_overflow()              { return _global_mark_stack.overflow(); }
+  bool mark_stack_empty()                 { return _global_mark_stack.is_empty(); }
 
   G1CMRootRegions* root_regions() { return &_root_regions; }
 
@@ -598,12 +601,12 @@
 
   // Notify data structures that a GC has started.
   void note_start_of_gc() {
-    _markStack.note_start_of_gc();
+    _global_mark_stack.note_start_of_gc();
   }
 
   // Notify data structures that a GC is finished.
   void note_end_of_gc() {
-    _markStack.note_end_of_gc();
+    _global_mark_stack.note_end_of_gc();
   }
 
   // Verify that there are no CSet oops on the stacks (taskqueues /
@@ -660,17 +663,17 @@
 class G1CMTask : public TerminatorTerminator {
 private:
   enum PrivateConstants {
-    // the regular clock call is called once the scanned words reaches
+    // The regular clock call is called once the scanned words reaches
     // this limit
     words_scanned_period          = 12*1024,
-    // the regular clock call is called once the number of visited
+    // The regular clock call is called once the number of visited
     // references reaches this limit
     refs_reached_period           = 384,
-    // initial value for the hash seed, used in the work stealing code
+    // Initial value for the hash seed, used in the work stealing code
     init_hash_seed                = 17,
-    // how many entries will be transferred between global stack and
-    // local queues
-    global_stack_transfer_size    = 16
+    // How many entries will be transferred between global stack and
+    // local queues at once.
+    global_stack_transfer_size    = 1024
   };
 
   uint                        _worker_id;
diff --git a/hotspot/src/share/vm/gc/g1/g1ConcurrentMark.inline.hpp b/hotspot/src/share/vm/gc/g1/g1ConcurrentMark.inline.hpp
index b0401d3..40336ae 100644
--- a/hotspot/src/share/vm/gc/g1/g1ConcurrentMark.inline.hpp
+++ b/hotspot/src/share/vm/gc/g1/g1ConcurrentMark.inline.hpp
@@ -91,8 +91,9 @@
 
 template<typename Fn>
 inline void G1CMMarkStack::iterate(Fn fn) {
-  assert(_saved_index == _index, "saved index: %d index: %d", _saved_index, _index);
-  for (int i = 0; i < _index; ++i) {
+  assert_at_safepoint(true);
+  assert(!stack_modified(), "Saved index " SIZE_FORMAT " must be the same as " SIZE_FORMAT, _saved_index, _index);
+  for (size_t i = 0; i < _index; ++i) {
     fn(_base[i]);
   }
 }
diff --git a/hotspot/src/share/vm/gc/g1/g1DefaultPolicy.cpp b/hotspot/src/share/vm/gc/g1/g1DefaultPolicy.cpp
index c15a382..454f73b 100644
--- a/hotspot/src/share/vm/gc/g1/g1DefaultPolicy.cpp
+++ b/hotspot/src/share/vm/gc/g1/g1DefaultPolicy.cpp
@@ -97,47 +97,64 @@
   phase_times()->note_gc_start();
 }
 
-bool G1DefaultPolicy::predict_will_fit(uint young_length,
-                                       double base_time_ms,
-                                       uint base_free_regions,
-                                       double target_pause_time_ms) const {
-  if (young_length >= base_free_regions) {
-    // end condition 1: not enough space for the young regions
-    return false;
+class G1YoungLengthPredictor VALUE_OBJ_CLASS_SPEC {
+  const bool _during_cm;
+  const double _base_time_ms;
+  const double _base_free_regions;
+  const double _target_pause_time_ms;
+  const G1DefaultPolicy* const _policy;
+
+ public:
+  G1YoungLengthPredictor(bool during_cm,
+                         double base_time_ms,
+                         double base_free_regions,
+                         double target_pause_time_ms,
+                         const G1DefaultPolicy* policy) :
+    _during_cm(during_cm),
+    _base_time_ms(base_time_ms),
+    _base_free_regions(base_free_regions),
+    _target_pause_time_ms(target_pause_time_ms),
+    _policy(policy) {}
+
+  bool will_fit(uint young_length) const {
+    if (young_length >= _base_free_regions) {
+      // end condition 1: not enough space for the young regions
+      return false;
+    }
+
+    const double accum_surv_rate = _policy->accum_yg_surv_rate_pred((int) young_length - 1);
+    const size_t bytes_to_copy =
+                 (size_t) (accum_surv_rate * (double) HeapRegion::GrainBytes);
+    const double copy_time_ms =
+      _policy->analytics()->predict_object_copy_time_ms(bytes_to_copy, _during_cm);
+    const double young_other_time_ms = _policy->analytics()->predict_young_other_time_ms(young_length);
+    const double pause_time_ms = _base_time_ms + copy_time_ms + young_other_time_ms;
+    if (pause_time_ms > _target_pause_time_ms) {
+      // end condition 2: prediction is over the target pause time
+      return false;
+    }
+
+    const size_t free_bytes = (_base_free_regions - young_length) * HeapRegion::GrainBytes;
+
+    // When copying, we will likely need more bytes free than is live in the region.
+    // Add some safety margin to factor in the confidence of our guess, and the
+    // natural expected waste.
+    // (100.0 / G1ConfidencePercent) is a scale factor that expresses the uncertainty
+    // of the calculation: the lower the confidence, the more headroom.
+    // (100 + TargetPLABWastePct) represents the increase in expected bytes during
+    // copying due to anticipated waste in the PLABs.
+    const double safety_factor = (100.0 / G1ConfidencePercent) * (100 + TargetPLABWastePct) / 100.0;
+    const size_t expected_bytes_to_copy = (size_t)(safety_factor * bytes_to_copy);
+
+    if (expected_bytes_to_copy > free_bytes) {
+      // end condition 3: out-of-space
+      return false;
+    }
+
+    // success!
+    return true;
   }
-
-  double accum_surv_rate = accum_yg_surv_rate_pred((int) young_length - 1);
-  size_t bytes_to_copy =
-               (size_t) (accum_surv_rate * (double) HeapRegion::GrainBytes);
-  double copy_time_ms = _analytics->predict_object_copy_time_ms(bytes_to_copy,
-                                                                collector_state()->during_concurrent_mark());
-  double young_other_time_ms = _analytics->predict_young_other_time_ms(young_length);
-  double pause_time_ms = base_time_ms + copy_time_ms + young_other_time_ms;
-  if (pause_time_ms > target_pause_time_ms) {
-    // end condition 2: prediction is over the target pause time
-    return false;
-  }
-
-  size_t free_bytes = (base_free_regions - young_length) * HeapRegion::GrainBytes;
-
-  // When copying, we will likely need more bytes free than is live in the region.
-  // Add some safety margin to factor in the confidence of our guess, and the
-  // natural expected waste.
-  // (100.0 / G1ConfidencePercent) is a scale factor that expresses the uncertainty
-  // of the calculation: the lower the confidence, the more headroom.
-  // (100 + TargetPLABWastePct) represents the increase in expected bytes during
-  // copying due to anticipated waste in the PLABs.
-  double safety_factor = (100.0 / G1ConfidencePercent) * (100 + TargetPLABWastePct) / 100.0;
-  size_t expected_bytes_to_copy = (size_t)(safety_factor * bytes_to_copy);
-
-  if (expected_bytes_to_copy > free_bytes) {
-    // end condition 3: out-of-space
-    return false;
-  }
-
-  // success!
-  return true;
-}
+};
 
 void G1DefaultPolicy::record_new_heap_size(uint new_number_of_regions) {
   // re-calculate the necessary reserve
@@ -279,31 +296,32 @@
   assert(desired_max_length > base_min_length, "invariant");
   uint max_young_length = desired_max_length - base_min_length;
 
-  double target_pause_time_ms = _mmu_tracker->max_gc_time() * 1000.0;
-  double survivor_regions_evac_time = predict_survivor_regions_evac_time();
-  size_t pending_cards = _analytics->predict_pending_cards();
-  size_t adj_rs_lengths = rs_lengths + _analytics->predict_rs_length_diff();
-  size_t scanned_cards = _analytics->predict_card_num(adj_rs_lengths, /* gcs_are_young */ true);
-  double base_time_ms =
+  const double target_pause_time_ms = _mmu_tracker->max_gc_time() * 1000.0;
+  const double survivor_regions_evac_time = predict_survivor_regions_evac_time();
+  const size_t pending_cards = _analytics->predict_pending_cards();
+  const size_t adj_rs_lengths = rs_lengths + _analytics->predict_rs_length_diff();
+  const size_t scanned_cards = _analytics->predict_card_num(adj_rs_lengths, /* gcs_are_young */ true);
+  const double base_time_ms =
     predict_base_elapsed_time_ms(pending_cards, scanned_cards) +
     survivor_regions_evac_time;
-  uint available_free_regions = _free_regions_at_end_of_collection;
-  uint base_free_regions = 0;
-  if (available_free_regions > _reserve_regions) {
-    base_free_regions = available_free_regions - _reserve_regions;
-  }
+  const uint available_free_regions = _free_regions_at_end_of_collection;
+  const uint base_free_regions =
+    available_free_regions > _reserve_regions ? available_free_regions - _reserve_regions : 0;
 
   // Here, we will make sure that the shortest young length that
   // makes sense fits within the target pause time.
 
-  if (predict_will_fit(min_young_length, base_time_ms,
-                       base_free_regions, target_pause_time_ms)) {
+  G1YoungLengthPredictor p(collector_state()->during_concurrent_mark(),
+                           base_time_ms,
+                           base_free_regions,
+                           target_pause_time_ms,
+                           this);
+  if (p.will_fit(min_young_length)) {
     // The shortest young length will fit into the target pause time;
     // we'll now check whether the absolute maximum number of young
     // regions will fit in the target pause time. If not, we'll do
     // a binary search between min_young_length and max_young_length.
-    if (predict_will_fit(max_young_length, base_time_ms,
-                         base_free_regions, target_pause_time_ms)) {
+    if (p.will_fit(max_young_length)) {
       // The maximum young length will fit into the target pause time.
       // We are done so set min young length to the maximum length (as
       // the result is assumed to be returned in min_young_length).
@@ -328,8 +346,7 @@
       uint diff = (max_young_length - min_young_length) / 2;
       while (diff > 0) {
         uint young_length = min_young_length + diff;
-        if (predict_will_fit(young_length, base_time_ms,
-                             base_free_regions, target_pause_time_ms)) {
+        if (p.will_fit(young_length)) {
           min_young_length = young_length;
         } else {
           max_young_length = young_length;
@@ -344,12 +361,10 @@
       assert(min_young_length < max_young_length,
              "otherwise we should have discovered that max_young_length "
              "fits into the pause target and not done the binary search");
-      assert(predict_will_fit(min_young_length, base_time_ms,
-                              base_free_regions, target_pause_time_ms),
+      assert(p.will_fit(min_young_length),
              "min_young_length, the result of the binary search, should "
              "fit into the pause target");
-      assert(!predict_will_fit(min_young_length + 1, base_time_ms,
-                               base_free_regions, target_pause_time_ms),
+      assert(!p.will_fit(min_young_length + 1),
              "min_young_length, the result of the binary search, should be "
              "optimal, so no larger length should fit into the pause target");
     }
@@ -501,13 +516,12 @@
 
 double G1DefaultPolicy::young_other_time_ms() const {
   return phase_times()->young_cset_choice_time_ms() +
-         phase_times()->young_free_cset_time_ms();
+         phase_times()->average_time_ms(G1GCPhaseTimes::YoungFreeCSet);
 }
 
 double G1DefaultPolicy::non_young_other_time_ms() const {
   return phase_times()->non_young_cset_choice_time_ms() +
-         phase_times()->non_young_free_cset_time_ms();
-
+         phase_times()->average_time_ms(G1GCPhaseTimes::NonYoungFreeCSet);
 }
 
 double G1DefaultPolicy::other_time_ms(double pause_time_ms) const {
@@ -515,7 +529,7 @@
 }
 
 double G1DefaultPolicy::constant_other_time_ms(double pause_time_ms) const {
-  return other_time_ms(pause_time_ms) - young_other_time_ms() - non_young_other_time_ms();
+  return other_time_ms(pause_time_ms) - phase_times()->total_free_cset_time_ms();
 }
 
 CollectionSetChooser* G1DefaultPolicy::cset_chooser() const {
diff --git a/hotspot/src/share/vm/gc/g1/g1GCPhaseTimes.cpp b/hotspot/src/share/vm/gc/g1/g1GCPhaseTimes.cpp
index f7e8b1d..a5dac2a 100644
--- a/hotspot/src/share/vm/gc/g1/g1GCPhaseTimes.cpp
+++ b/hotspot/src/share/vm/gc/g1/g1GCPhaseTimes.cpp
@@ -91,6 +91,9 @@
   _redirtied_cards = new WorkerDataArray<size_t>(max_gc_threads, "Redirtied Cards:");
   _gc_par_phases[RedirtyCards]->link_thread_work_items(_redirtied_cards);
 
+  _gc_par_phases[YoungFreeCSet] = new WorkerDataArray<double>(max_gc_threads, "Young Free Collection Set (ms):");
+  _gc_par_phases[NonYoungFreeCSet] = new WorkerDataArray<double>(max_gc_threads, "Non-Young Free Collection Set (ms):");
+
   _gc_par_phases[PreserveCMReferents] = new WorkerDataArray<double>(max_gc_threads, "Parallel Preserve CM Refs (ms):");
 }
 
@@ -278,10 +281,11 @@
   info_line_and_account("Clear Card Table", _cur_clear_ct_time_ms);
   info_line_and_account("Expand Heap After Collection", _cur_expand_heap_time_ms);
 
-  double free_cset_time = _recorded_young_free_cset_time_ms + _recorded_non_young_free_cset_time_ms;
-  info_line_and_account("Free Collection Set", free_cset_time);
-  debug_line("Young Free Collection Set", _recorded_young_free_cset_time_ms);
-  debug_line("Non-Young Free Collection Set", _recorded_non_young_free_cset_time_ms);
+  info_line_and_account("Free Collection Set", _recorded_total_free_cset_time_ms);
+  debug_line("Free Collection Set Serial", _recorded_serial_free_cset_time_ms);
+  debug_phase(_gc_par_phases[YoungFreeCSet]);
+  debug_phase(_gc_par_phases[NonYoungFreeCSet]);
+
   info_line_and_account("Merge Per-Thread State", _recorded_merge_pss_time_ms);
 
   info_line("Other", _gc_pause_time_ms - accounted_time_ms);
diff --git a/hotspot/src/share/vm/gc/g1/g1GCPhaseTimes.hpp b/hotspot/src/share/vm/gc/g1/g1GCPhaseTimes.hpp
index 88deb79..87fed3f 100644
--- a/hotspot/src/share/vm/gc/g1/g1GCPhaseTimes.hpp
+++ b/hotspot/src/share/vm/gc/g1/g1GCPhaseTimes.hpp
@@ -67,6 +67,8 @@
     StringDedupTableFixup,
     RedirtyCards,
     PreserveCMReferents,
+    YoungFreeCSet,
+    NonYoungFreeCSet,
     GCParPhasesSentinel
   };
 
@@ -110,8 +112,9 @@
 
   double _recorded_merge_pss_time_ms;
 
-  double _recorded_young_free_cset_time_ms;
-  double _recorded_non_young_free_cset_time_ms;
+  double _recorded_total_free_cset_time_ms;
+
+  double _recorded_serial_free_cset_time_ms;
 
   double _cur_fast_reclaim_humongous_time_ms;
   double _cur_fast_reclaim_humongous_register_time_ms;
@@ -199,12 +202,12 @@
     _root_region_scan_wait_time_ms = time_ms;
   }
 
-  void record_young_free_cset_time_ms(double time_ms) {
-    _recorded_young_free_cset_time_ms = time_ms;
+  void record_total_free_cset_time_ms(double time_ms) {
+    _recorded_total_free_cset_time_ms = time_ms;
   }
 
-  void record_non_young_free_cset_time_ms(double time_ms) {
-    _recorded_non_young_free_cset_time_ms = time_ms;
+  void record_serial_free_cset_time_ms(double time_ms) {
+    _recorded_serial_free_cset_time_ms = time_ms;
   }
 
   void record_fast_reclaim_humongous_stats(double time_ms, size_t total, size_t candidates) {
@@ -278,18 +281,14 @@
     return _recorded_young_cset_choice_time_ms;
   }
 
-  double young_free_cset_time_ms() {
-    return _recorded_young_free_cset_time_ms;
+  double total_free_cset_time_ms() {
+    return _recorded_total_free_cset_time_ms;
   }
 
   double non_young_cset_choice_time_ms() {
     return _recorded_non_young_cset_choice_time_ms;
   }
 
-  double non_young_free_cset_time_ms() {
-    return _recorded_non_young_free_cset_time_ms;
-  }
-
   double fast_reclaim_humongous_time_ms() {
     return _cur_fast_reclaim_humongous_time_ms;
   }
diff --git a/hotspot/src/share/vm/gc/g1/g1MarkSweep.cpp b/hotspot/src/share/vm/gc/g1/g1MarkSweep.cpp
index 80aaad3..3d8866d 100644
--- a/hotspot/src/share/vm/gc/g1/g1MarkSweep.cpp
+++ b/hotspot/src/share/vm/gc/g1/g1MarkSweep.cpp
@@ -340,7 +340,7 @@
   hr->set_containing_set(NULL);
   _humongous_regions_removed++;
 
-  _g1h->free_humongous_region(hr, &dummy_free_list, false /* par */);
+  _g1h->free_humongous_region(hr, &dummy_free_list, false /* skip_remset */);
   prepare_for_compaction(hr, end);
   dummy_free_list.remove_all();
 }
diff --git a/hotspot/src/share/vm/gc/g1/g1PageBasedVirtualSpace.cpp b/hotspot/src/share/vm/gc/g1/g1PageBasedVirtualSpace.cpp
index 46cd63f..7f419bd 100644
--- a/hotspot/src/share/vm/gc/g1/g1PageBasedVirtualSpace.cpp
+++ b/hotspot/src/share/vm/gc/g1/g1PageBasedVirtualSpace.cpp
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2014, 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2014, 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,22 +26,8 @@
 #include "gc/g1/g1PageBasedVirtualSpace.hpp"
 #include "oops/markOop.hpp"
 #include "oops/oop.inline.hpp"
+#include "runtime/os.inline.hpp"
 #include "services/memTracker.hpp"
-#ifdef TARGET_OS_FAMILY_linux
-# include "os_linux.inline.hpp"
-#endif
-#ifdef TARGET_OS_FAMILY_solaris
-# include "os_solaris.inline.hpp"
-#endif
-#ifdef TARGET_OS_FAMILY_windows
-# include "os_windows.inline.hpp"
-#endif
-#ifdef TARGET_OS_FAMILY_aix
-# include "os_aix.inline.hpp"
-#endif
-#ifdef TARGET_OS_FAMILY_bsd
-# include "os_bsd.inline.hpp"
-#endif
 #include "utilities/bitMap.inline.hpp"
 
 G1PageBasedVirtualSpace::G1PageBasedVirtualSpace(ReservedSpace rs, size_t used_size, size_t page_size) :
diff --git a/hotspot/src/share/vm/gc/g1/g1YoungGenSizer.cpp b/hotspot/src/share/vm/gc/g1/g1YoungGenSizer.cpp
index d06d712..df0c761 100644
--- a/hotspot/src/share/vm/gc/g1/g1YoungGenSizer.cpp
+++ b/hotspot/src/share/vm/gc/g1/g1YoungGenSizer.cpp
@@ -45,7 +45,7 @@
                             "A new max generation size of " SIZE_FORMAT "k will be used.",
                             NewSize/K, MaxNewSize/K, NewSize/K);
     }
-    MaxNewSize = NewSize;
+    FLAG_SET_ERGO(size_t, MaxNewSize, NewSize);
   }
 
   if (FLAG_IS_CMDLINE(NewSize)) {
diff --git a/hotspot/src/share/vm/gc/g1/heapRegion.cpp b/hotspot/src/share/vm/gc/g1/heapRegion.cpp
index 52ad443..13143a3 100644
--- a/hotspot/src/share/vm/gc/g1/heapRegion.cpp
+++ b/hotspot/src/share/vm/gc/g1/heapRegion.cpp
@@ -167,7 +167,7 @@
   init_top_at_mark_start();
 }
 
-void HeapRegion::hr_clear(bool par, bool clear_space, bool locked) {
+void HeapRegion::hr_clear(bool keep_remset, bool clear_space, bool locked) {
   assert(_humongous_start_region == NULL,
          "we should have already filtered out humongous regions");
   assert(!in_collection_set(),
@@ -179,15 +179,14 @@
   set_free();
   reset_pre_dummy_top();
 
-  if (!par) {
-    // If this is parallel, this will be done later.
-    HeapRegionRemSet* hrrs = rem_set();
+  if (!keep_remset) {
     if (locked) {
-      hrrs->clear_locked();
+      rem_set()->clear_locked();
     } else {
-      hrrs->clear();
+      rem_set()->clear();
     }
   }
+
   zero_marked_bytes();
 
   init_top_at_mark_start();
diff --git a/hotspot/src/share/vm/gc/g1/heapRegion.hpp b/hotspot/src/share/vm/gc/g1/heapRegion.hpp
index a020792..f4bf95e 100644
--- a/hotspot/src/share/vm/gc/g1/heapRegion.hpp
+++ b/hotspot/src/share/vm/gc/g1/heapRegion.hpp
@@ -512,8 +512,11 @@
 #endif // ASSERT
 
 
-  // Reset HR stuff to default values.
-  void hr_clear(bool par, bool clear_space, bool locked = false);
+  // Reset the HeapRegion to default values.
+  // If skip_remset is true, do not clear the remembered set.
+  void hr_clear(bool skip_remset, bool clear_space, bool locked = false);
+  // Clear the parts skipped by skip_remset in hr_clear() in the HeapRegion during
+  // a concurrent phase.
   void par_clear();
 
   // Get the start of the unmarked area in this region.
diff --git a/hotspot/src/share/vm/gc/parallel/gcTaskManager.cpp b/hotspot/src/share/vm/gc/parallel/gcTaskManager.cpp
index 4b47eef..8045027 100644
--- a/hotspot/src/share/vm/gc/parallel/gcTaskManager.cpp
+++ b/hotspot/src/share/vm/gc/parallel/gcTaskManager.cpp
@@ -537,7 +537,7 @@
         created_workers() - active_workers() - idle_workers();
       if (more_inactive_workers < 0) {
         int reduced_active_workers = active_workers() + more_inactive_workers;
-        set_active_workers(reduced_active_workers);
+        update_active_workers(reduced_active_workers);
         more_inactive_workers = 0;
       }
       log_trace(gc, task)("JT: %d  workers %d  active  %d  idle %d  more %d",
diff --git a/hotspot/src/share/vm/gc/parallel/gcTaskManager.hpp b/hotspot/src/share/vm/gc/parallel/gcTaskManager.hpp
index d05869a..5bc5d4c 100644
--- a/hotspot/src/share/vm/gc/parallel/gcTaskManager.hpp
+++ b/hotspot/src/share/vm/gc/parallel/gcTaskManager.hpp
@@ -457,11 +457,12 @@
   uint workers() const {
     return _workers;
   }
-  void set_active_workers(uint v) {
+  uint update_active_workers(uint v) {
     assert(v <= _workers, "Trying to set more workers active than there are");
     _active_workers = MIN2(v, _workers);
     assert(v != 0, "Trying to set active workers to 0");
     _active_workers = MAX2(1U, _active_workers);
+    return _active_workers;
   }
   // Sets the number of threads that will be used in a collection
   void set_active_gang();
diff --git a/hotspot/src/share/vm/gc/parallel/psScavenge.cpp b/hotspot/src/share/vm/gc/parallel/psScavenge.cpp
index 82caad3..a80d3ec 100644
--- a/hotspot/src/share/vm/gc/parallel/psScavenge.cpp
+++ b/hotspot/src/share/vm/gc/parallel/psScavenge.cpp
@@ -391,11 +391,15 @@
       ParallelTaskTerminator terminator(
         active_workers,
                   (TaskQueueSetSuper*) promotion_manager->stack_array_depth());
-      if (active_workers > 1) {
-        for (uint j = 0; j < active_workers; j++) {
-          q->enqueue(new StealTask(&terminator));
+        // If active_workers can exceed 1, add a StrealTask.
+        // PSPromotionManager::drain_stacks_depth() does not fully drain its
+        // stacks and expects a StealTask to complete the draining if
+        // ParallelGCThreads is > 1.
+        if (gc_task_manager()->workers() > 1) {
+          for (uint j = 0; j < active_workers; j++) {
+            q->enqueue(new StealTask(&terminator));
+          }
         }
-      }
 
       gc_task_manager()->execute_and_wait(q);
     }
diff --git a/hotspot/src/share/vm/gc/shared/collectorPolicy.cpp b/hotspot/src/share/vm/gc/shared/collectorPolicy.cpp
index 1cb0597..fd44924 100644
--- a/hotspot/src/share/vm/gc/shared/collectorPolicy.cpp
+++ b/hotspot/src/share/vm/gc/shared/collectorPolicy.cpp
@@ -50,7 +50,6 @@
     _initial_heap_byte_size(InitialHeapSize),
     _max_heap_byte_size(MaxHeapSize),
     _min_heap_byte_size(Arguments::min_heap_size()),
-    _max_heap_size_cmdline(false),
     _size_policy(NULL),
     _should_clear_all_soft_refs(false),
     _all_soft_refs_clear(false)
@@ -92,7 +91,6 @@
     if (_min_heap_byte_size != 0 && MaxHeapSize < _min_heap_byte_size) {
       vm_exit_during_initialization("Incompatible minimum and maximum heap sizes specified");
     }
-    _max_heap_size_cmdline = true;
   }
 
   // Check heap parameter properties
@@ -285,7 +283,7 @@
          "heap_alignment: " SIZE_FORMAT " not aligned by gen_alignment: " SIZE_FORMAT,
          _heap_alignment, _gen_alignment);
 
-  // All generational heaps have a youngest gen; handle those flags here
+  // All generational heaps have a young gen; handle those flags here
 
   // Make sure the heap is large enough for two generations
   size_t smallest_new_size = young_gen_size_lower_bound();
@@ -307,7 +305,7 @@
   // Make sure NewSize allows an old generation to fit even if set on the command line
   if (FLAG_IS_CMDLINE(NewSize) && NewSize >= _initial_heap_byte_size) {
     log_warning(gc, ergo)("NewSize was set larger than initial heap size, will use initial heap size.");
-    NewSize = bound_minus_alignment(NewSize, _initial_heap_byte_size);
+    FLAG_SET_ERGO(size_t, NewSize, bound_minus_alignment(NewSize, _initial_heap_byte_size));
   }
 
   // Now take the actual NewSize into account. We will silently increase NewSize
@@ -315,10 +313,7 @@
   size_t bounded_new_size = bound_minus_alignment(NewSize, MaxHeapSize);
   bounded_new_size = MAX2(smallest_new_size, (size_t)align_size_down(bounded_new_size, _gen_alignment));
   if (bounded_new_size != NewSize) {
-    // Do not use FLAG_SET_ERGO to update NewSize here, since this will override
-    // if NewSize was set on the command line or not. This information is needed
-    // later when setting the initial and minimum young generation size.
-    NewSize = bounded_new_size;
+    FLAG_SET_ERGO(size_t, NewSize, bounded_new_size);
   }
   _min_young_size = smallest_new_size;
   _initial_young_size = NewSize;
@@ -361,11 +356,11 @@
     vm_exit_during_initialization("Invalid young gen ratio specified");
   }
 
-  OldSize = MAX2(OldSize, old_gen_size_lower_bound());
+  if (OldSize < old_gen_size_lower_bound()) {
+    FLAG_SET_ERGO(size_t, OldSize, old_gen_size_lower_bound());
+  }
   if (!is_size_aligned(OldSize, _gen_alignment)) {
-    // Setting OldSize directly to preserve information about the possible
-    // setting of OldSize on the command line.
-    OldSize = align_size_down(OldSize, _gen_alignment);
+    FLAG_SET_ERGO(size_t, OldSize, align_size_down(OldSize, _gen_alignment));
   }
 
   if (FLAG_IS_CMDLINE(OldSize) && FLAG_IS_DEFAULT(MaxHeapSize)) {
@@ -384,7 +379,7 @@
 
   // Adjust NewSize and OldSize or MaxHeapSize to match each other
   if (NewSize + OldSize > MaxHeapSize) {
-    if (_max_heap_size_cmdline) {
+    if (FLAG_IS_CMDLINE(MaxHeapSize)) {
       // Somebody has set a maximum heap size with the intention that we should not
       // exceed it. Adjust New/OldSize as necessary.
       size_t calculated_size = NewSize + OldSize;
@@ -927,8 +922,23 @@
 
     save_flags();
 
+    // If NewSize has been ergonomically set, the collector policy
+    // should use it for min but calculate the initial young size
+    // using NewRatio.
+    flag_value = 20 * M;
+    set_basic_flag_values();
+    FLAG_SET_ERGO(size_t, NewSize, flag_value);
+    verify_young_min(flag_value);
+
+    set_basic_flag_values();
+    FLAG_SET_ERGO(size_t, NewSize, flag_value);
+    verify_scaled_young_initial(InitialHeapSize);
+
     // If NewSize is set on the command line, it should be used
     // for both min and initial young size if less than min heap.
+    // Note that once a flag has been set with FLAG_SET_CMDLINE it
+    // will be treated as it have been set on the command line for
+    // the rest of the VM lifetime. This is an irreversible change.
     flag_value = 20 * M;
     set_basic_flag_values();
     FLAG_SET_CMDLINE(size_t, NewSize, flag_value);
@@ -945,18 +955,6 @@
     FLAG_SET_CMDLINE(size_t, NewSize, flag_value);
     verify_young_initial(flag_value);
 
-    // If NewSize has been ergonomically set, the collector policy
-    // should use it for min but calculate the initial young size
-    // using NewRatio.
-    flag_value = 20 * M;
-    set_basic_flag_values();
-    FLAG_SET_ERGO(size_t, NewSize, flag_value);
-    verify_young_min(flag_value);
-
-    set_basic_flag_values();
-    FLAG_SET_ERGO(size_t, NewSize, flag_value);
-    verify_scaled_young_initial(InitialHeapSize);
-
     restore_flags();
   }
 
diff --git a/hotspot/src/share/vm/gc/shared/collectorPolicy.hpp b/hotspot/src/share/vm/gc/shared/collectorPolicy.hpp
index 8c9b65e..5e8e235 100644
--- a/hotspot/src/share/vm/gc/shared/collectorPolicy.hpp
+++ b/hotspot/src/share/vm/gc/shared/collectorPolicy.hpp
@@ -72,10 +72,6 @@
   size_t _space_alignment;
   size_t _heap_alignment;
 
-  // Needed to keep information if MaxHeapSize was set on the command line
-  // when the flag value is aligned etc by ergonomics.
-  bool _max_heap_size_cmdline;
-
   // The sizing of the heap is controlled by a sizing policy.
   AdaptiveSizePolicy* _size_policy;
 
diff --git a/hotspot/src/share/vm/gc/shared/concurrentGCThread.cpp b/hotspot/src/share/vm/gc/shared/concurrentGCThread.cpp
index 322931e..df72f04 100644
--- a/hotspot/src/share/vm/gc/shared/concurrentGCThread.cpp
+++ b/hotspot/src/share/vm/gc/shared/concurrentGCThread.cpp
@@ -43,7 +43,7 @@
     // unless "aggressive mode" set; priority
     // should be just less than that of VMThread.
     os::set_priority(this, prio);
-    if (!_should_terminate && !DisableStartThread) {
+    if (!_should_terminate) {
       os::start_thread(this);
     }
   }
diff --git a/hotspot/src/share/vm/gc/shared/gcTraceSend.cpp b/hotspot/src/share/vm/gc/shared/gcTraceSend.cpp
index db538eb..e51e8fe 100644
--- a/hotspot/src/share/vm/gc/shared/gcTraceSend.cpp
+++ b/hotspot/src/share/vm/gc/shared/gcTraceSend.cpp
@@ -278,7 +278,7 @@
     evt.set_gcId(GCId::current());
     evt.set_threshold(threshold);
     evt.set_targetOccupancy(target_occupancy);
-    evt.set_thresholdPercentage(target_occupancy > 0 ? (threshold * 100 / target_occupancy) : 0);
+    evt.set_thresholdPercentage(target_occupancy > 0 ? ((double)threshold / target_occupancy) : 0.0);
     evt.set_currentOccupancy(current_occupancy);
     evt.set_lastAllocationSize(last_allocation_size);
     evt.set_lastAllocationDuration(last_allocation_duration);
@@ -299,7 +299,7 @@
   if (evt.should_commit()) {
     evt.set_gcId(GCId::current());
     evt.set_threshold(threshold);
-    evt.set_thresholdPercentage(internal_target_occupancy > 0 ? (threshold * 100 / internal_target_occupancy) : 0);
+    evt.set_thresholdPercentage(internal_target_occupancy > 0 ? ((double)threshold / internal_target_occupancy) : 0.0);
     evt.set_internalTargetOccupancy(internal_target_occupancy);
     evt.set_currentOccupancy(current_occupancy);
     evt.set_additionalBufferSize(additional_buffer_size);
diff --git a/hotspot/src/share/vm/gc/shared/memset_with_concurrent_readers.hpp b/hotspot/src/share/vm/gc/shared/memset_with_concurrent_readers.hpp
index 43deac7..4d7dc2b 100644
--- a/hotspot/src/share/vm/gc/shared/memset_with_concurrent_readers.hpp
+++ b/hotspot/src/share/vm/gc/shared/memset_with_concurrent_readers.hpp
@@ -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
@@ -25,9 +25,10 @@
 #ifndef SRC_SHARE_VM_GC_SHARED_MEMSETWITHCONCURRENTREADERS_HPP
 #define SRC_SHARE_VM_GC_SHARED_MEMSETWITHCONCURRENTREADERS_HPP
 
+#include "utilities/macros.hpp"
+
 #include <stddef.h>
 #include <string.h>
-#include "utilities/macros.hpp"
 
 // Only used by concurrent collectors.
 #if INCLUDE_ALL_GCS
@@ -36,7 +37,7 @@
 // understanding that there may be concurrent readers of that memory.
 void memset_with_concurrent_readers(void* to, int value, size_t size);
 
-#ifdef TARGET_ARCH_sparc
+#ifdef SPARC
 
 // SPARC requires special handling.  See SPARC-specific definition.
 
@@ -51,4 +52,4 @@
 
 #endif // INCLUDE_ALL_GCS
 
-#endif // include guard
+#endif // SRC_SHARE_VM_GC_SHARED_MEMSETWITHCONCURRENTREADERS_HPP
diff --git a/hotspot/src/share/vm/gc/shared/workerManager.hpp b/hotspot/src/share/vm/gc/shared/workerManager.hpp
index e4ac465..6758c08 100644
--- a/hotspot/src/share/vm/gc/shared/workerManager.hpp
+++ b/hotspot/src/share/vm/gc/shared/workerManager.hpp
@@ -55,18 +55,29 @@
     uint start = created_workers;
     uint end = MIN2(active_workers, total_workers);
     for (uint worker_id = start; worker_id < end; worker_id += 1) {
-      WorkerThread* new_worker = holder->install_worker(worker_id);
-      assert(new_worker != NULL, "Failed to allocate GangWorker");
+      WorkerThread* new_worker = NULL;
+      if (initializing || !InjectGCWorkerCreationFailure) {
+        new_worker = holder->install_worker(worker_id);
+      }
       if (new_worker == NULL || !os::create_thread(new_worker, worker_type)) {
-        if (initializing) {
-          vm_exit_out_of_memory(0, OOM_MALLOC_ERROR,
-                  "Cannot create worker GC thread. Out of system resources.");
+        log_trace(gc, task)("WorkerManager::add_workers() : "
+                            "creation failed due to failed allocation of native %s",
+                            new_worker == NULL ?  "memory" : "thread");
+        if (new_worker != NULL) {
+           delete new_worker;
         }
+        if (initializing) {
+          vm_exit_out_of_memory(0, OOM_MALLOC_ERROR, "Cannot create worker GC thread. Out of system resources.");
+        }
+        break;
       }
       created_workers++;
       os::start_thread(new_worker);
     }
 
+    log_trace(gc, task)("WorkerManager::add_workers() : "
+                        "created_workers: %u", created_workers);
+
     return created_workers;
   }
 
diff --git a/hotspot/src/share/vm/gc/shared/workgroup.cpp b/hotspot/src/share/vm/gc/shared/workgroup.cpp
index 42334dc..84016fe 100644
--- a/hotspot/src/share/vm/gc/shared/workgroup.cpp
+++ b/hotspot/src/share/vm/gc/shared/workgroup.cpp
@@ -274,8 +274,10 @@
             "Trying to execute task %s with %u workers which is more than the amount of total workers %u.",
             task->name(), num_workers, total_workers());
   guarantee(num_workers > 0, "Trying to execute task %s with zero workers", task->name());
-  add_workers(num_workers, false);
+  uint old_num_workers = _active_workers;
+  update_active_workers(num_workers);
   _dispatcher->coordinator_execute_on_workers(task, num_workers);
+  update_active_workers(old_num_workers);
 }
 
 AbstractGangWorker::AbstractGangWorker(AbstractWorkGang* gang, uint id) {
diff --git a/hotspot/src/share/vm/gc/shared/workgroup.hpp b/hotspot/src/share/vm/gc/shared/workgroup.hpp
index 1208d42..00eb705 100644
--- a/hotspot/src/share/vm/gc/shared/workgroup.hpp
+++ b/hotspot/src/share/vm/gc/shared/workgroup.hpp
@@ -156,15 +156,14 @@
     return _active_workers;
   }
 
-  void set_active_workers(uint v) {
+  uint update_active_workers(uint v) {
     assert(v <= _total_workers,
            "Trying to set more workers active than there are");
     _active_workers = MIN2(v, _total_workers);
     add_workers(false /* exit_on_failure */);
     assert(v != 0, "Trying to set active workers to 0");
-    assert(UseDynamicNumberOfGCThreads || _active_workers == _total_workers,
-           "Unless dynamic should use total workers");
     log_info(gc, task)("GC Workers: using %d out of %d", _active_workers, _total_workers);
+    return _active_workers;
   }
 
   // Add GC workers as needed.
diff --git a/hotspot/src/share/vm/interpreter/bytecodeInterpreter.hpp b/hotspot/src/share/vm/interpreter/bytecodeInterpreter.hpp
index 5adbe46..93f22cc 100644
--- a/hotspot/src/share/vm/interpreter/bytecodeInterpreter.hpp
+++ b/hotspot/src/share/vm/interpreter/bytecodeInterpreter.hpp
@@ -32,6 +32,7 @@
 #include "runtime/frame.hpp"
 #include "runtime/globals.hpp"
 #include "utilities/globalDefinitions.hpp"
+#include "utilities/macros.hpp"
 
 #ifdef CC_INTERP
 
@@ -572,7 +573,7 @@
 void print();
 #endif // PRODUCT
 
-#ifdef TARGET_ARCH_zero
+#ifdef ZERO
 # include "bytecodeInterpreter_zero.hpp"
 #else
 #error "Only Zero Bytecode Interpreter is supported"
diff --git a/hotspot/src/share/vm/interpreter/bytecodeInterpreter.inline.hpp b/hotspot/src/share/vm/interpreter/bytecodeInterpreter.inline.hpp
index fcc8f5e..6ec8f11 100644
--- a/hotspot/src/share/vm/interpreter/bytecodeInterpreter.inline.hpp
+++ b/hotspot/src/share/vm/interpreter/bytecodeInterpreter.inline.hpp
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2002, 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2002, 2016, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -27,6 +27,7 @@
 
 #include "interpreter/bytecodeInterpreter.hpp"
 #include "runtime/stubRoutines.hpp"
+#include "utilities/macros.hpp"
 
 // This file holds platform-independent bodies of inline functions for the C++ based interpreter
 
@@ -42,7 +43,7 @@
 #define VERIFY_OOP(o)
 #endif
 
-#ifdef TARGET_ARCH_zero
+#ifdef ZERO
 # include "bytecodeInterpreter_zero.inline.hpp"
 #else
 #error "Only Zero Bytecode Interpreter is supported"
diff --git a/hotspot/src/share/vm/interpreter/cppInterpreter.hpp b/hotspot/src/share/vm/interpreter/cppInterpreter.hpp
index 3d90155..98970b5 100644
--- a/hotspot/src/share/vm/interpreter/cppInterpreter.hpp
+++ b/hotspot/src/share/vm/interpreter/cppInterpreter.hpp
@@ -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
@@ -26,6 +26,8 @@
 #define SHARE_VM_INTERPRETER_CPPINTERPRETER_HPP
 
 #include "interpreter/abstractInterpreter.hpp"
+#include "utilities/macros.hpp"
+
 #ifdef CC_INTERP
 
 class InterpreterCodelet;
@@ -60,7 +62,7 @@
                          address   entry_point,
                          address   osr_buf,
                          TRAPS);
-#ifdef TARGET_ARCH_zero
+#ifdef ZERO
 # include "cppInterpreter_zero.hpp"
 #endif
 
diff --git a/hotspot/src/share/vm/interpreter/interp_masm.hpp b/hotspot/src/share/vm/interpreter/interp_masm.hpp
index dddbbe5..1705e34 100644
--- a/hotspot/src/share/vm/interpreter/interp_masm.hpp
+++ b/hotspot/src/share/vm/interpreter/interp_masm.hpp
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2014, 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2014, 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,19 +26,8 @@
 #define SHARE_VM_INTERPRETER_INTERP_MASM_HPP
 
 #include "asm/macroAssembler.hpp"
+#include "utilities/macros.hpp"
 
-#if defined INTERP_MASM_MD_HPP
-# include INTERP_MASM_MD_HPP
-#elif defined TARGET_ARCH_x86
-# include "interp_masm_x86.hpp"
-#elif defined TARGET_ARCH_MODEL_sparc
-# include "interp_masm_sparc.hpp"
-#elif defined TARGET_ARCH_MODEL_zero
-# include "interp_masm_zero.hpp"
-#elif defined TARGET_ARCH_MODEL_ppc_64
-# include "interp_masm_ppc_64.hpp"
-#elif defined TARGET_ARCH_MODEL_aarch64
-# include "interp_masm_aarch64.hpp"
-#endif
+#include CPU_HEADER(interp_masm)
 
 #endif // SHARE_VM_INTERPRETER_INTERP_MASM_HPP
diff --git a/hotspot/src/share/vm/interpreter/interpreterRuntime.hpp b/hotspot/src/share/vm/interpreter/interpreterRuntime.hpp
index d8ef297..b70ab5e 100644
--- a/hotspot/src/share/vm/interpreter/interpreterRuntime.hpp
+++ b/hotspot/src/share/vm/interpreter/interpreterRuntime.hpp
@@ -32,6 +32,7 @@
 #include "runtime/frame.inline.hpp"
 #include "runtime/signature.hpp"
 #include "runtime/thread.hpp"
+#include "utilities/macros.hpp"
 
 // The InterpreterRuntime is called by the interpreter for everything
 // that cannot/should not be dealt with in assembly and needs C support.
@@ -167,24 +168,7 @@
   static intptr_t trace_bytecode(JavaThread* thread, intptr_t preserve_this_value, intptr_t tos, intptr_t tos2) PRODUCT_RETURN0;
 
   // Platform dependent stuff
-#ifdef TARGET_ARCH_x86
-# include "interpreterRT_x86.hpp"
-#endif
-#ifdef TARGET_ARCH_sparc
-# include "interpreterRT_sparc.hpp"
-#endif
-#ifdef TARGET_ARCH_zero
-# include "interpreterRT_zero.hpp"
-#endif
-#ifdef TARGET_ARCH_arm
-# include "interpreterRT_arm.hpp"
-#endif
-#ifdef TARGET_ARCH_ppc
-# include "interpreterRT_ppc.hpp"
-#endif
-#ifdef TARGET_ARCH_aarch64
-# include "interpreterRT_aarch64.hpp"
-#endif
+#include CPU_HEADER(interpreterRT)
 
   // optional normalization of fingerprints to reduce the number of adapters
   static uint64_t normalize_fast_native_fingerprint(uint64_t fingerprint);
diff --git a/hotspot/src/share/vm/interpreter/templateInterpreterGenerator.cpp b/hotspot/src/share/vm/interpreter/templateInterpreterGenerator.cpp
index a2c427f..d57eb46 100644
--- a/hotspot/src/share/vm/interpreter/templateInterpreterGenerator.cpp
+++ b/hotspot/src/share/vm/interpreter/templateInterpreterGenerator.cpp
@@ -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
@@ -476,7 +476,7 @@
   case Interpreter::java_lang_Double_doubleToRawLongBits:
     native = true;
     break;
-#endif // defined(TARGET_ARCH_x86) && !defined(_LP64)
+#endif // !IA32
   default:
     fatal("unexpected method kind: %d", kind);
     break;
diff --git a/hotspot/src/share/vm/interpreter/templateInterpreterGenerator.hpp b/hotspot/src/share/vm/interpreter/templateInterpreterGenerator.hpp
index 38bad18..6f8972e 100644
--- a/hotspot/src/share/vm/interpreter/templateInterpreterGenerator.hpp
+++ b/hotspot/src/share/vm/interpreter/templateInterpreterGenerator.hpp
@@ -101,14 +101,16 @@
   address generate_Double_longBitsToDouble_entry();
   address generate_Double_doubleToRawLongBits_entry();
 #endif // IA32
+  // Some platforms don't need registers, other need two. Unused function is
+  // left unimplemented.
   void generate_stack_overflow_check(void);
+  void generate_stack_overflow_check(Register Rframe_size, Register Rscratch);
 
   void generate_counter_incr(Label* overflow, Label* profile_method, Label* profile_method_continue);
   void generate_counter_overflow(Label& continue_entry);
 
   void generate_fixed_frame(bool native_call);
 #ifdef SPARC
-  void generate_stack_overflow_check(Register Rframe_size, Register Rscratch);
   void save_native_result(void);
   void restore_native_result(void);
 #endif // SPARC
@@ -119,10 +121,7 @@
 
 #ifdef PPC
   void lock_method(Register Rflags, Register Rscratch1, Register Rscratch2, bool flags_preloaded=false);
-  void unlock_method(bool check_exceptions = true);
-
   void generate_fixed_frame(bool native_call, Register Rsize_of_parameters, Register Rsize_of_locals);
-  void generate_stack_overflow_check(Register Rframe_size, Register Rscratch1);
 #endif // PPC
 
  public:
diff --git a/hotspot/src/share/vm/interpreter/templateTable.hpp b/hotspot/src/share/vm/interpreter/templateTable.hpp
index e32b37a..5ffe249 100644
--- a/hotspot/src/share/vm/interpreter/templateTable.hpp
+++ b/hotspot/src/share/vm/interpreter/templateTable.hpp
@@ -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
@@ -28,6 +28,7 @@
 #include "interpreter/bytecodes.hpp"
 #include "memory/allocation.hpp"
 #include "runtime/frame.hpp"
+#include "utilities/macros.hpp"
 
 #ifndef CC_INTERP
 // All the necessary definitions used for (bytecode) template generation. Instead of
@@ -349,17 +350,7 @@
   static Template* template_for_wide(Bytecodes::Code code)  { Bytecodes::wide_check(code); return &_template_table_wide[code]; }
 
   // Platform specifics
-#if defined TEMPLATETABLE_MD_HPP
-# include TEMPLATETABLE_MD_HPP
-#elif defined (TARGET_ARCH_MODEL_x86_32) || defined (TARGET_ARCH_MODEL_x86_64)
-# include "templateTable_x86.hpp"
-#elif defined TARGET_ARCH_MODEL_sparc
-# include "templateTable_sparc.hpp"
-#elif defined TARGET_ARCH_MODEL_ppc_64
-# include "templateTable_ppc_64.hpp"
-#elif defined TARGET_ARCH_MODEL_aarch64
-# include "templateTable_aarch64.hpp"
-#endif
+#include CPU_HEADER(templateTable)
 
 };
 #endif /* !CC_INTERP */
diff --git a/hotspot/src/share/vm/jvmci/jvmciCodeInstaller.cpp b/hotspot/src/share/vm/jvmci/jvmciCodeInstaller.cpp
index 979be2a..6ec47c9 100644
--- a/hotspot/src/share/vm/jvmci/jvmciCodeInstaller.cpp
+++ b/hotspot/src/share/vm/jvmci/jvmciCodeInstaller.cpp
@@ -22,38 +22,21 @@
  */
 
 #include "precompiled.hpp"
+#include "asm/register.hpp"
+#include "classfile/vmSymbols.hpp"
 #include "code/compiledIC.hpp"
+#include "code/vmreg.inline.hpp"
 #include "compiler/compileBroker.hpp"
 #include "compiler/disassembler.hpp"
-#include "oops/oop.inline.hpp"
-#include "oops/objArrayOop.inline.hpp"
-#include "runtime/javaCalls.hpp"
 #include "jvmci/jvmciEnv.hpp"
 #include "jvmci/jvmciCompiler.hpp"
 #include "jvmci/jvmciCodeInstaller.hpp"
 #include "jvmci/jvmciJavaClasses.hpp"
 #include "jvmci/jvmciCompilerToVM.hpp"
 #include "jvmci/jvmciRuntime.hpp"
-#include "asm/register.hpp"
-#include "classfile/vmSymbols.hpp"
-#include "code/vmreg.hpp"
-
-#ifdef TARGET_ARCH_x86
-# include "vmreg_x86.inline.hpp"
-#endif
-#ifdef TARGET_ARCH_sparc
-# include "vmreg_sparc.inline.hpp"
-#endif
-#ifdef TARGET_ARCH_zero
-# include "vmreg_zero.inline.hpp"
-#endif
-#ifdef TARGET_ARCH_arm
-# include "vmreg_arm.inline.hpp"
-#endif
-#ifdef TARGET_ARCH_ppc
-# include "vmreg_ppc.inline.hpp"
-#endif
-
+#include "oops/oop.inline.hpp"
+#include "oops/objArrayOop.inline.hpp"
+#include "runtime/javaCalls.hpp"
 
 // frequently used constants
 // Allocate them with new so they are never destroyed (otherwise, a
@@ -782,7 +765,7 @@
     }
     last_pc_offset = pc_offset;
 
-    if (CodeInstallSafepointChecks && SafepointSynchronize::do_call_back()) {
+    if (SafepointSynchronize::do_call_back()) {
       // this is a hacky way to force a safepoint check but nothing else was jumping out at me.
       ThreadToNativeFromVM ttnfv(JavaThread::current());
     }
diff --git a/hotspot/src/share/vm/jvmci/jvmciRuntime.cpp b/hotspot/src/share/vm/jvmci/jvmciRuntime.cpp
index 6bb862e..ce6e8b5 100644
--- a/hotspot/src/share/vm/jvmci/jvmciRuntime.cpp
+++ b/hotspot/src/share/vm/jvmci/jvmciRuntime.cpp
@@ -44,6 +44,7 @@
 #include "runtime/sharedRuntime.hpp"
 #include "utilities/debug.hpp"
 #include "utilities/defaultStream.hpp"
+#include "utilities/macros.hpp"
 
 #if defined(_MSC_VER)
 #define strtoll _strtoi64
@@ -612,6 +613,17 @@
   return value;
 JRT_END
 
+void JVMCIRuntime::force_initialization(TRAPS) {
+  JVMCIRuntime::initialize_well_known_classes(CHECK);
+
+  ResourceMark rm;
+  TempNewSymbol getCompiler = SymbolTable::new_symbol("getCompiler", CHECK);
+  TempNewSymbol sig = SymbolTable::new_symbol("()Ljdk/vm/ci/runtime/JVMCICompiler;", CHECK);
+  Handle jvmciRuntime = JVMCIRuntime::get_HotSpotJVMCIRuntime(CHECK);
+  JavaValue result(T_OBJECT);
+  JavaCalls::call_virtual(&result, jvmciRuntime, HotSpotJVMCIRuntime::klass(), getCompiler, sig, CHECK);
+}
+
 // private static JVMCIRuntime JVMCI.initializeRuntime()
 JVM_ENTRY(jobject, JVM_GetJVMCIRuntime(JNIEnv *env, jclass c))
   if (!EnableJVMCI) {
@@ -686,8 +698,21 @@
   assert(_HotSpotJVMCIRuntime_initialized == true, "what?");
 }
 
+bool JVMCIRuntime::can_initialize_JVMCI() {
+  // Initializing JVMCI requires the module system to be initialized past phase 3.
+  // The JVMCI API itself isn't available until phase 2 and ServiceLoader (which
+  // JVMCI initialization requires) isn't usable until after phase 3. Testing
+  // whether the system loader is initialized satisfies all these invariants.
+  if (SystemDictionary::java_system_loader() == NULL) {
+    return false;
+  }
+  assert(Universe::is_module_initialized(), "must be");
+  return true;
+}
+
 void JVMCIRuntime::initialize_well_known_classes(TRAPS) {
   if (JVMCIRuntime::_well_known_classes_initialized == false) {
+    guarantee(can_initialize_JVMCI(), "VM is not yet sufficiently booted to initialize JVMCI");
     SystemDictionary::WKID scan = SystemDictionary::FIRST_JVMCI_WKID;
     SystemDictionary::initialize_wk_klasses_through(SystemDictionary::LAST_JVMCI_WKID, scan, CHECK);
     JVMCIJavaClasses::compute_offsets(CHECK);
@@ -770,14 +795,14 @@
   }
 
 #ifdef _LP64
-#ifndef TARGET_ARCH_sparc
+#ifndef SPARC
   uintptr_t heap_end = (uintptr_t) Universe::heap()->reserved_region().end();
   uintptr_t allocation_end = heap_end + ((uintptr_t)16) * 1024 * 1024 * 1024;
   guarantee(heap_end < allocation_end, "heap end too close to end of address space (might lead to erroneous TLAB allocations)");
-#endif // TARGET_ARCH_sparc
+#endif // !SPARC
 #else
   fatal("check TLAB allocation code for address space conflicts");
-#endif
+#endif // _LP64
 
   JVMCIRuntime::initialize_well_known_classes(CHECK);
 
diff --git a/hotspot/src/share/vm/jvmci/jvmciRuntime.hpp b/hotspot/src/share/vm/jvmci/jvmciRuntime.hpp
index bf7b59e..0aa9bca 100644
--- a/hotspot/src/share/vm/jvmci/jvmciRuntime.hpp
+++ b/hotspot/src/share/vm/jvmci/jvmciRuntime.hpp
@@ -87,6 +87,11 @@
   static Handle callStatic(const char* className, const char* methodName, const char* returnType, JavaCallArguments* args, TRAPS);
 
   /**
+   * Determines if the VM is sufficiently booted to initialize JVMCI.
+   */
+  static bool can_initialize_JVMCI();
+
+  /**
    * Trigger initialization of HotSpotJVMCIRuntime through JVMCI.getRuntime()
    */
   static void initialize_JVMCI(TRAPS);
@@ -157,6 +162,9 @@
   static void throw_klass_external_name_exception(JavaThread* thread, const char* exception, Klass* klass);
   static void throw_class_cast_exception(JavaThread* thread, const char* exception, Klass* caster_klass, Klass* target_klass);
 
+  // Forces initialization of the JVMCI runtime.
+  static void force_initialization(TRAPS);
+
   // Test only function
   static int test_deoptimize_call_int(JavaThread* thread, int value);
 };
diff --git a/hotspot/src/share/vm/jvmci/jvmci_globals.cpp b/hotspot/src/share/vm/jvmci/jvmci_globals.cpp
index 12dd0c1..7308935 100644
--- a/hotspot/src/share/vm/jvmci/jvmci_globals.cpp
+++ b/hotspot/src/share/vm/jvmci/jvmci_globals.cpp
@@ -39,196 +39,65 @@
             IGNORE_CONSTRAINT, \
             IGNORE_WRITEABLE)
 
-#define JVMCI_IGNORE_FLAG_FOUR_PARAM(type, name, value, doc)
-#define JVMCI_IGNORE_FLAG_THREE_PARAM(type, name, doc)
-
 // Return true if jvmci flags are consistent.
 bool JVMCIGlobals::check_jvmci_flags_are_consistent() {
-  if (EnableJVMCI) {
-    return true;
-  }
-
-  // "FLAG_IS_DEFAULT" fail count.
-  int fail_count = 0;
-  // Number of "FLAG_IS_DEFAULT" fails that should be skipped before code
-  // detect real consistency failure.
-  int skip_fail_count;
-
-  // EnableJVMCI flag is false here.
-  // If any other flag is changed, consistency check should fail.
-  // JVMCI_FLAGS macros added below can handle all JVMCI flags automatically.
-  // But it contains check for EnableJVMCI flag too, which is required to be
-  // skipped. This can't be handled easily!
-  // So the code looks for at-least two flag changes to detect consistency
-  // failure when EnableJVMCI flag is changed.
-  // Otherwise one flag change is sufficient to detect consistency failure.
-  // Set skip_fail_count to 0 if EnableJVMCI flag is default.
-  // Set skip_fail_count to 1 if EnableJVMCI flag is changed.
-  // This value will be used to skip fails in macro expanded code later.
-  if (!FLAG_IS_DEFAULT(EnableJVMCI)) {
-    skip_fail_count = 1;
-  } else {
-    skip_fail_count = 0;
-  }
-
-#define EMIT_FLAG_VALUE_CHANGED_CHECK_CODE(FLAG)  \
-  if (!FLAG_IS_DEFAULT(FLAG)) {                   \
-    fail_count++;                                 \
-    if (fail_count > skip_fail_count) {           \
-      return false;                               \
-    }                                             \
-  }
-
-#define JVMCI_DIAGNOSTIC_FLAG_VALUE_CHANGED_CHECK_CODE(type, name, value, doc)     EMIT_FLAG_VALUE_CHANGED_CHECK_CODE(name)
-#define JVMCI_EXPERIMENTAL_FLAG_VALUE_CHANGED_CHECK_CODE(type, name, value, doc)   EMIT_FLAG_VALUE_CHANGED_CHECK_CODE(name)
-
-  // Check consistency of diagnostic flags if UnlockDiagnosticVMOptions is true
-  // or not default. UnlockDiagnosticVMOptions is default true in debug builds.
-  if (UnlockDiagnosticVMOptions || !FLAG_IS_DEFAULT(UnlockDiagnosticVMOptions)) {
-    JVMCI_FLAGS(JVMCI_IGNORE_FLAG_FOUR_PARAM, \
-                JVMCI_IGNORE_FLAG_THREE_PARAM, \
-                JVMCI_IGNORE_FLAG_FOUR_PARAM, \
-                JVMCI_IGNORE_FLAG_THREE_PARAM, \
-                JVMCI_DIAGNOSTIC_FLAG_VALUE_CHANGED_CHECK_CODE, \
-                JVMCI_IGNORE_FLAG_THREE_PARAM, \
-                JVMCI_IGNORE_FLAG_FOUR_PARAM, \
-                JVMCI_IGNORE_FLAG_FOUR_PARAM, \
-                IGNORE_RANGE, \
-                IGNORE_CONSTRAINT, \
-                IGNORE_WRITEABLE)
-  }
-
-  // Check consistency of experimental flags if UnlockExperimentalVMOptions is
-  // true or not default.
-  if (UnlockExperimentalVMOptions || !FLAG_IS_DEFAULT(UnlockExperimentalVMOptions)) {
-    JVMCI_FLAGS(JVMCI_IGNORE_FLAG_FOUR_PARAM, \
-                JVMCI_IGNORE_FLAG_THREE_PARAM, \
-                JVMCI_IGNORE_FLAG_FOUR_PARAM, \
-                JVMCI_IGNORE_FLAG_THREE_PARAM, \
-                JVMCI_IGNORE_FLAG_FOUR_PARAM, \
-                JVMCI_IGNORE_FLAG_THREE_PARAM, \
-                JVMCI_EXPERIMENTAL_FLAG_VALUE_CHANGED_CHECK_CODE, \
-                JVMCI_IGNORE_FLAG_FOUR_PARAM, \
-                IGNORE_RANGE, \
-                IGNORE_CONSTRAINT, \
-                IGNORE_WRITEABLE)
-  }
 
 #ifndef PRODUCT
-#define JVMCI_DEVELOP_FLAG_VALUE_CHANGED_CHECK_CODE(type, name, value, doc)        EMIT_FLAG_VALUE_CHANGED_CHECK_CODE(name)
-#define JVMCI_PD_DEVELOP_FLAG_VALUE_CHANGED_CHECK_CODE(type, name, doc)            EMIT_FLAG_VALUE_CHANGED_CHECK_CODE(name)
-#define JVMCI_NOTPRODUCT_FLAG_VALUE_CHANGED_CHECK_CODE(type, name, value, doc)     EMIT_FLAG_VALUE_CHANGED_CHECK_CODE(name)
+#define APPLY_JVMCI_FLAGS(params3, params4) \
+  JVMCI_FLAGS(params4, params3, params4, params3, params4, params3, params4, params4, IGNORE_RANGE, IGNORE_CONSTRAINT, IGNORE_WRITEABLE)
+#define JVMCI_DECLARE_CHECK4(type, name, value, doc) bool name##checked = false;
+#define JVMCI_DECLARE_CHECK3(type, name, doc)        bool name##checked = false;
+#define JVMCI_FLAG_CHECKED(name)                          name##checked = true;
+  APPLY_JVMCI_FLAGS(JVMCI_DECLARE_CHECK3, JVMCI_DECLARE_CHECK4)
 #else
-#define JVMCI_DEVELOP_FLAG_VALUE_CHANGED_CHECK_CODE(type, name, value, doc)
-#define JVMCI_PD_DEVELOP_FLAG_VALUE_CHANGED_CHECK_CODE(type, name, doc)
-#define JVMCI_NOTPRODUCT_FLAG_VALUE_CHANGED_CHECK_CODE(type, name, value, doc)
+#define JVMCI_FLAG_CHECKED(name)
 #endif
 
-#define JVMCI_PD_PRODUCT_FLAG_VALUE_CHANGED_CHECK_CODE(type, name, doc)            EMIT_FLAG_VALUE_CHANGED_CHECK_CODE(name)
-#define JVMCI_PRODUCT_FLAG_VALUE_CHANGED_CHECK_CODE(type, name, value, doc)        EMIT_FLAG_VALUE_CHANGED_CHECK_CODE(name)
+  // Checks that a given flag is not set if a given guard flag is false.
+#define CHECK_NOT_SET(FLAG, GUARD)                     \
+  JVMCI_FLAG_CHECKED(FLAG)                             \
+  if (!GUARD && !FLAG_IS_DEFAULT(FLAG)) {              \
+    jio_fprintf(defaultStream::error_stream(),         \
+        "Improperly specified VM option '%s': '%s' must be enabled\n", #FLAG, #GUARD); \
+    return false;                                      \
+  }
 
-  JVMCI_FLAGS(JVMCI_DEVELOP_FLAG_VALUE_CHANGED_CHECK_CODE, \
-              JVMCI_PD_DEVELOP_FLAG_VALUE_CHANGED_CHECK_CODE, \
-              JVMCI_PRODUCT_FLAG_VALUE_CHANGED_CHECK_CODE, \
-              JVMCI_PD_PRODUCT_FLAG_VALUE_CHANGED_CHECK_CODE, \
-              JVMCI_IGNORE_FLAG_FOUR_PARAM, \
-              JVMCI_IGNORE_FLAG_THREE_PARAM, \
-              JVMCI_IGNORE_FLAG_FOUR_PARAM, \
-              JVMCI_NOTPRODUCT_FLAG_VALUE_CHANGED_CHECK_CODE, \
-              IGNORE_RANGE, \
-              IGNORE_CONSTRAINT, \
-              IGNORE_WRITEABLE)
+  JVMCI_FLAG_CHECKED(UseJVMCICompiler)
+  JVMCI_FLAG_CHECKED(EnableJVMCI)
 
-#undef EMIT_FLAG_VALUE_CHANGED_CHECK_CODE
-#undef JVMCI_DEVELOP_FLAG_VALUE_CHANGED_CHECK_CODE
-#undef JVMCI_PD_DEVELOP_FLAG_VALUE_CHANGED_CHECK_CODE
-#undef JVMCI_NOTPRODUCT_FLAG_VALUE_CHANGED_CHECK_CODE
-#undef JVMCI_DIAGNOSTIC_FLAG_VALUE_CHANGED_CHECK_CODE
-#undef JVMCI_PD_PRODUCT_FLAG_VALUE_CHANGED_CHECK_CODE
-#undef JVMCI_PRODUCT_FLAG_VALUE_CHANGED_CHECK_CODE
-#undef JVMCI_EXPERIMENTAL_FLAG_VALUE_CHANGED_CHECK_CODE
+  CHECK_NOT_SET(BootstrapJVMCI,   UseJVMCICompiler)
+  CHECK_NOT_SET(PrintBootstrap,   UseJVMCICompiler)
+  CHECK_NOT_SET(JVMCIThreads,     UseJVMCICompiler)
+  CHECK_NOT_SET(JVMCIHostThreads, UseJVMCICompiler)
 
+  if (UseJVMCICompiler) {
+    if (!FLAG_IS_DEFAULT(EnableJVMCI) && !EnableJVMCI) {
+      jio_fprintf(defaultStream::error_stream(),
+          "Improperly specified VM option UseJVMCICompiler: EnableJVMCI cannot be disabled\n");
+      return false;
+    }
+    FLAG_SET_DEFAULT(EnableJVMCI, true);
+  }
+
+  CHECK_NOT_SET(JVMCITraceLevel,              EnableJVMCI)
+  CHECK_NOT_SET(JVMCICounterSize,             EnableJVMCI)
+  CHECK_NOT_SET(JVMCICountersExcludeCompiler, EnableJVMCI)
+  CHECK_NOT_SET(JVMCIUseFastLocking,          EnableJVMCI)
+  CHECK_NOT_SET(JVMCINMethodSizeLimit,        EnableJVMCI)
+  CHECK_NOT_SET(TraceUncollectedSpeculations, EnableJVMCI)
+
+#ifndef PRODUCT
+#define JVMCI_CHECK4(type, name, value, doc) assert(name##checked, #name " flag not checked");
+#define JVMCI_CHECK3(type, name, doc)        assert(name##checked, #name " flag not checked");
+  // Ensures that all JVMCI flags are checked by this method.
+  APPLY_JVMCI_FLAGS(JVMCI_CHECK3, JVMCI_CHECK4)
+#undef APPLY_JVMCI_FLAGS
+#undef JVMCI_DECLARE_CHECK3
+#undef JVMCI_DECLARE_CHECK4
+#undef JVMCI_CHECK3
+#undef JVMCI_CHECK4
+#undef JVMCI_FLAG_CHECKED
+#endif
+#undef CHECK_NOT_SET
   return true;
 }
-
-// Print jvmci arguments inconsistency error message.
-void JVMCIGlobals::print_jvmci_args_inconsistency_error_message() {
-  const char* error_msg = "Improperly specified VM option '%s'\n";
-  jio_fprintf(defaultStream::error_stream(), "EnableJVMCI must be enabled\n");
-
-#define EMIT_CHECK_PRINT_ERR_MSG_CODE(FLAG)                         \
-  if (!FLAG_IS_DEFAULT(FLAG)) {                                     \
-    if (strcmp(#FLAG, "EnableJVMCI")) {                             \
-      jio_fprintf(defaultStream::error_stream(), error_msg, #FLAG); \
-    }                                                               \
-  }
-
-#define JVMCI_DIAGNOSTIC_FLAG_CHECK_PRINT_ERR_MSG_CODE(type, name, value, doc)     EMIT_CHECK_PRINT_ERR_MSG_CODE(name)
-#define JVMCI_EXPERIMENTAL_FLAG_CHECK_PRINT_ERR_MSG_CODE(type, name, value, doc)   EMIT_CHECK_PRINT_ERR_MSG_CODE(name)
-
-  if (UnlockDiagnosticVMOptions || !FLAG_IS_DEFAULT(UnlockDiagnosticVMOptions)) {
-    JVMCI_FLAGS(JVMCI_IGNORE_FLAG_FOUR_PARAM, \
-                JVMCI_IGNORE_FLAG_THREE_PARAM, \
-                JVMCI_IGNORE_FLAG_FOUR_PARAM, \
-                JVMCI_IGNORE_FLAG_THREE_PARAM, \
-                JVMCI_DIAGNOSTIC_FLAG_CHECK_PRINT_ERR_MSG_CODE, \
-                JVMCI_IGNORE_FLAG_THREE_PARAM, \
-                JVMCI_IGNORE_FLAG_FOUR_PARAM, \
-                JVMCI_IGNORE_FLAG_FOUR_PARAM, \
-                IGNORE_RANGE, \
-                IGNORE_CONSTRAINT, \
-                IGNORE_WRITEABLE)
-  }
-
-  if (UnlockExperimentalVMOptions || !FLAG_IS_DEFAULT(UnlockExperimentalVMOptions)) {
-    JVMCI_FLAGS(JVMCI_IGNORE_FLAG_FOUR_PARAM, \
-                JVMCI_IGNORE_FLAG_THREE_PARAM, \
-                JVMCI_IGNORE_FLAG_FOUR_PARAM, \
-                JVMCI_IGNORE_FLAG_THREE_PARAM, \
-                JVMCI_IGNORE_FLAG_FOUR_PARAM, \
-                JVMCI_IGNORE_FLAG_THREE_PARAM, \
-                JVMCI_EXPERIMENTAL_FLAG_CHECK_PRINT_ERR_MSG_CODE, \
-                JVMCI_IGNORE_FLAG_FOUR_PARAM, \
-                IGNORE_RANGE, \
-                IGNORE_CONSTRAINT, \
-                IGNORE_WRITEABLE)
-  }
-
-#ifndef PRODUCT
-#define JVMCI_DEVELOP_FLAG_CHECK_PRINT_ERR_MSG_CODE(type, name, value, doc)        EMIT_CHECK_PRINT_ERR_MSG_CODE(name)
-#define JVMCI_PD_DEVELOP_FLAG_CHECK_PRINT_ERR_MSG_CODE(type, name, doc)            EMIT_CHECK_PRINT_ERR_MSG_CODE(name)
-#define JVMCI_NOTPRODUCT_FLAG_CHECK_PRINT_ERR_MSG_CODE(type, name, value, doc)     EMIT_CHECK_PRINT_ERR_MSG_CODE(name)
-#else
-#define JVMCI_DEVELOP_FLAG_CHECK_PRINT_ERR_MSG_CODE(type, name, value, doc)
-#define JVMCI_PD_DEVELOP_FLAG_CHECK_PRINT_ERR_MSG_CODE(type, name, doc)
-#define JVMCI_NOTPRODUCT_FLAG_CHECK_PRINT_ERR_MSG_CODE(type, name, value, doc)
-#endif
-
-#define JVMCI_PD_PRODUCT_FLAG_CHECK_PRINT_ERR_MSG_CODE(type, name, doc)            EMIT_CHECK_PRINT_ERR_MSG_CODE(name)
-#define JVMCI_PRODUCT_FLAG_CHECK_PRINT_ERR_MSG_CODE(type, name, value, doc)        EMIT_CHECK_PRINT_ERR_MSG_CODE(name)
-
-  JVMCI_FLAGS(JVMCI_DEVELOP_FLAG_CHECK_PRINT_ERR_MSG_CODE, \
-              JVMCI_PD_DEVELOP_FLAG_CHECK_PRINT_ERR_MSG_CODE, \
-              JVMCI_PRODUCT_FLAG_CHECK_PRINT_ERR_MSG_CODE, \
-              JVMCI_PD_PRODUCT_FLAG_CHECK_PRINT_ERR_MSG_CODE, \
-              JVMCI_IGNORE_FLAG_FOUR_PARAM, \
-              JVMCI_IGNORE_FLAG_THREE_PARAM, \
-              JVMCI_IGNORE_FLAG_FOUR_PARAM, \
-              JVMCI_NOTPRODUCT_FLAG_CHECK_PRINT_ERR_MSG_CODE, \
-              IGNORE_RANGE, \
-              IGNORE_CONSTRAINT, \
-              IGNORE_WRITEABLE)
-
-#undef EMIT_CHECK_PRINT_ERR_MSG_CODE
-#undef JVMCI_DEVELOP_FLAG_CHECK_PRINT_ERR_MSG_CODE
-#undef JVMCI_PD_DEVELOP_FLAG_CHECK_PRINT_ERR_MSG_CODE
-#undef JVMCI_NOTPRODUCT_FLAG_CHECK_PRINT_ERR_MSG_CODE
-#undef JVMCI_PD_PRODUCT_FLAG_CHECK_PRINT_ERR_MSG_CODE
-#undef JVMCI_PRODUCT_FLAG_CHECK_PRINT_ERR_MSG_CODE
-#undef JVMCI_DIAGNOSTIC_FLAG_CHECK_PRINT_ERR_MSG_CODE
-#undef JVMCI_EXPERIMENTAL_FLAG_CHECK_PRINT_ERR_MSG_CODE
-
-}
-
-#undef JVMCI_IGNORE_FLAG_FOUR_PARAM
-#undef JVMCI_IGNORE_FLAG_THREE_PARAM
diff --git a/hotspot/src/share/vm/jvmci/jvmci_globals.hpp b/hotspot/src/share/vm/jvmci/jvmci_globals.hpp
index 0a19e61..c2905f5 100644
--- a/hotspot/src/share/vm/jvmci/jvmci_globals.hpp
+++ b/hotspot/src/share/vm/jvmci/jvmci_globals.hpp
@@ -29,8 +29,7 @@
 
 //
 // Defines all global flags used by the JVMCI compiler. Only flags that need
-// to be accessible to the JVMCI C++ code should be defined here. All other
-// JVMCI flags should be defined in JVMCIOptions.java.
+// to be accessible to the JVMCI C++ code should be defined here.
 //
 #define JVMCI_FLAGS(develop, \
                     develop_pd, \
@@ -64,9 +63,6 @@
           "Force number of compiler threads for JVMCI host compiler")       \
           range(1, max_jint)                                                \
                                                                             \
-  experimental(bool, CodeInstallSafepointChecks, true,                      \
-          "Perform explicit safepoint checks while installing code")        \
-                                                                            \
   NOT_COMPILER2(product(intx, MaxVectorSize, 64,                            \
           "Max vector size in bytes, "                                      \
           "actual size could be less depending on elements type"))          \
@@ -112,9 +108,9 @@
 
 class JVMCIGlobals {
  public:
-  // Return true if jvmci flags are consistent.
+  // Return true if jvmci flags are consistent. If not consistent,
+  // an error message describing the inconsistency is printed before
+  // returning false.
   static bool check_jvmci_flags_are_consistent();
-  // Print jvmci arguments inconsistency error message.
-  static void print_jvmci_args_inconsistency_error_message();
 };
 #endif // SHARE_VM_JVMCI_JVMCIGLOBALS_HPP
diff --git a/hotspot/src/share/vm/jvmci/vmStructs_jvmci.cpp b/hotspot/src/share/vm/jvmci/vmStructs_jvmci.cpp
index 9244cd4..90f5cf1 100644
--- a/hotspot/src/share/vm/jvmci/vmStructs_jvmci.cpp
+++ b/hotspot/src/share/vm/jvmci/vmStructs_jvmci.cpp
@@ -550,7 +550,7 @@
   declare_function(os::javaTimeNanos)                                     \
                                                                           \
   declare_function(Deoptimization::fetch_unroll_info)                     \
-  COMPILER2_PRESENT(declare_function(Deoptimization::uncommon_trap))      \
+  declare_function(Deoptimization::uncommon_trap)                         \
   declare_function(Deoptimization::unpack_frames)                         \
                                                                           \
   declare_function(JVMCIRuntime::new_instance) \
@@ -591,31 +591,31 @@
 #endif // INCLUDE_ALL_GCS
 
 
-#ifdef TARGET_OS_FAMILY_linux
+#ifdef LINUX
 
 #define VM_ADDRESSES_OS(declare_address, declare_preprocessor_address, declare_function) \
   declare_preprocessor_address("RTLD_DEFAULT", RTLD_DEFAULT)
 
-#endif // TARGET_OS_FAMILY_linux
+#endif
 
 
-#ifdef TARGET_OS_FAMILY_bsd
+#ifdef BSD
 
 #define VM_ADDRESSES_OS(declare_address, declare_preprocessor_address, declare_function) \
   declare_preprocessor_address("RTLD_DEFAULT", RTLD_DEFAULT)
 
-#endif // TARGET_OS_FAMILY_bsd
+#endif
 
-
+// AARCH64 is defined in closed port, too. TARGET_ARCH_aarch64 is not.
 #ifdef TARGET_ARCH_aarch64
 
 #define VM_STRUCTS_CPU(nonstatic_field, static_field, unchecked_nonstatic_field, volatile_nonstatic_field, nonproduct_nonstatic_field, c2_nonstatic_field, unchecked_c1_static_field, unchecked_c2_static_field) \
   volatile_nonstatic_field(JavaFrameAnchor, _last_Java_fp, intptr_t*)
 
-#endif // TARGET_ARCH_aarch64
+#endif
 
 
-#ifdef TARGET_ARCH_x86
+#ifdef X86
 
 #define VM_STRUCTS_CPU(nonstatic_field, static_field, unchecked_nonstatic_field, volatile_nonstatic_field, nonproduct_nonstatic_field, c2_nonstatic_field, unchecked_c1_static_field, unchecked_c2_static_field) \
   volatile_nonstatic_field(JavaFrameAnchor, _last_Java_fp, intptr_t*)
@@ -661,10 +661,10 @@
   declare_preprocessor_constant("VM_Version::CPU_AVX512VL", CPU_AVX512VL) \
   declare_preprocessor_constant("VM_Version::CPU_SHA", CPU_SHA)
 
-#endif // TARGET_ARCH_x86
+#endif
 
 
-#ifdef TARGET_ARCH_sparc
+#ifdef SPARC
 
 #define VM_STRUCTS_CPU(nonstatic_field, static_field, unchecked_nonstatic_field, volatile_nonstatic_field, nonproduct_nonstatic_field, c2_nonstatic_field, unchecked_c1_static_field, unchecked_c2_static_field) \
   volatile_nonstatic_field(JavaFrameAnchor, _flags, int)
@@ -694,7 +694,7 @@
   declare_constant(VM_Version::sha256_instruction_m)                      \
   declare_constant(VM_Version::sha512_instruction_m)
 
-#endif // TARGET_ARCH_sparc
+#endif
 
 
 /*
diff --git a/hotspot/src/share/vm/memory/filemap.cpp b/hotspot/src/share/vm/memory/filemap.cpp
index b442f4c..e4ec1c1 100644
--- a/hotspot/src/share/vm/memory/filemap.cpp
+++ b/hotspot/src/share/vm/memory/filemap.cpp
@@ -199,11 +199,45 @@
   size_t entry_size = SharedClassUtil::shared_class_path_entry_size();
 
   for (int pass=0; pass<2; pass++) {
-    ClassPathEntry *cpe = ClassLoader::classpath_entry(0);
 
-    for (int cur_entry = 0 ; cpe != NULL; cpe = cpe->next(), cur_entry++) {
+    // Process the modular java runtime image first
+    ClassPathEntry* jrt_entry = ClassLoader::get_jrt_entry();
+    assert(jrt_entry != NULL,
+           "No modular java runtime image present when allocating the CDS classpath entry table");
+    const char *name = jrt_entry->name();
+    int name_bytes = (int)(strlen(name) + 1);
+    if (pass == 0) {
+      count++;
+      bytes += (int)entry_size;
+      bytes += name_bytes;
+      log_info(class, path)("add main shared path for modular java runtime image %s", name);
+    } else {
+      // The java runtime image is always in slot 0 on the shared class path.
+      SharedClassPathEntry* ent = shared_classpath(0);
+      struct stat st;
+      if (os::stat(name, &st) == 0) {
+        ent->_timestamp = st.st_mtime;
+        ent->_filesize = st.st_size;
+      }
+      if (ent->_filesize == 0) {
+        // unknown
+        ent->_filesize = -2;
+      }
+      ent->_name = strptr;
+      assert(strptr + name_bytes <= strptr_max, "miscalculated buffer size");
+      strncpy(strptr, name, (size_t)name_bytes); // name_bytes includes trailing 0.
+      strptr += name_bytes;
+    }
+
+    // Walk the appended entries, which includes the entries added for the classpath.
+    ClassPathEntry *cpe = ClassLoader::classpath_entry(1);
+
+    // Since the java runtime image is always in slot 0 on the shared class path, the
+    // appended entries are started at slot 1 immediately after.
+    for (int cur_entry = 1 ; cpe != NULL; cpe = cpe->next(), cur_entry++) {
       const char *name = cpe->name();
       int name_bytes = (int)(strlen(name) + 1);
+      assert(!cpe->is_jrt(), "A modular java runtime image is present on the list of appended entries");
 
       if (pass == 0) {
         count ++;
@@ -228,11 +262,7 @@
         } else {
           struct stat st;
           if (os::stat(name, &st) == 0) {
-            if (cpe->is_jrt()) {
-              // it's the "modules" jimage
-              ent->_timestamp = st.st_mtime;
-              ent->_filesize = st.st_size;
-            } else if ((st.st_mode & S_IFDIR) == S_IFDIR) {
+            if ((st.st_mode & S_IFDIR) == S_IFDIR) {
               if (!os::dir_is_empty(name)) {
                 ClassLoader::exit_with_path_failure(
                   "Cannot have non-empty directory in archived classpaths", name);
@@ -886,6 +916,11 @@
     return false;
   }
 
+  if (!Arguments::has_jimage()) {
+    FileMapInfo::fail_continue("The shared archive file cannot be used with an exploded module build.");
+    return false;
+  }
+
   if (_version != current_version()) {
     FileMapInfo::fail_continue("The shared archive file is the wrong version.");
     return false;
diff --git a/hotspot/src/share/vm/memory/metaspace.cpp b/hotspot/src/share/vm/memory/metaspace.cpp
index 5dce267..ac7d0f8 100644
--- a/hotspot/src/share/vm/memory/metaspace.cpp
+++ b/hotspot/src/share/vm/memory/metaspace.cpp
@@ -3164,39 +3164,47 @@
 #endif // _LP64
 #endif // INCLUDE_CDS
   } else {
-    // If using shared space, open the file that contains the shared space
-    // and map in the memory before initializing the rest of metaspace (so
-    // the addresses don't conflict)
-    address cds_address = NULL;
-    if (UseSharedSpaces) {
 #if INCLUDE_CDS
+    if (UseSharedSpaces) {
+      // If using shared space, open the file that contains the shared space
+      // and map in the memory before initializing the rest of metaspace (so
+      // the addresses don't conflict)
+      address cds_address = NULL;
       FileMapInfo* mapinfo = new FileMapInfo();
 
-      // Open the shared archive file, read and validate the header. If
-      // initialization fails, shared spaces [UseSharedSpaces] are
-      // disabled and the file is closed.
-      // Map in spaces now also
-      if (mapinfo->initialize() && MetaspaceShared::map_shared_spaces(mapinfo)) {
-        cds_total = FileMapInfo::shared_spaces_size();
-        cds_address = (address)mapinfo->header()->region_addr(0);
-#ifdef _LP64
-        if (using_class_space()) {
-          char* cds_end = (char*)(cds_address + cds_total);
-          cds_end = (char *)align_ptr_up(cds_end, _reserve_alignment);
-          // If UseCompressedClassPointers is set then allocate the metaspace area
-          // above the heap and above the CDS area (if it exists).
-          allocate_metaspace_compressed_klass_ptrs(cds_end, cds_address);
-          // Map the shared string space after compressed pointers
-          // because it relies on compressed class pointers setting to work
-          mapinfo->map_string_regions();
-        }
-#endif // _LP64
+      if (JvmtiExport::should_post_class_file_load_hook()) {
+        // Currently CDS does not support JVMTI CFLH when loading shared class.
+        // If JvmtiExport::should_post_class_file_load_hook is already enabled,
+        // just disable UseSharedSpaces.
+        FileMapInfo::fail_continue("Tool agent requires sharing to be disabled.");
+        delete mapinfo;
       } else {
-        assert(!mapinfo->is_open() && !UseSharedSpaces,
-               "archive file not closed or shared spaces not disabled.");
+        // Open the shared archive file, read and validate the header. If
+        // initialization fails, shared spaces [UseSharedSpaces] are
+        // disabled and the file is closed.
+        // Map in spaces now also
+        if (mapinfo->initialize() && MetaspaceShared::map_shared_spaces(mapinfo)) {
+          cds_total = FileMapInfo::shared_spaces_size();
+          cds_address = (address)mapinfo->header()->region_addr(0);
+#ifdef _LP64
+          if (using_class_space()) {
+            char* cds_end = (char*)(cds_address + cds_total);
+            cds_end = (char *)align_ptr_up(cds_end, _reserve_alignment);
+            // If UseCompressedClassPointers is set then allocate the metaspace area
+            // above the heap and above the CDS area (if it exists).
+            allocate_metaspace_compressed_klass_ptrs(cds_end, cds_address);
+            // Map the shared string space after compressed pointers
+            // because it relies on compressed class pointers setting to work
+            mapinfo->map_string_regions();
+          }
+#endif // _LP64
+        } else {
+          assert(!mapinfo->is_open() && !UseSharedSpaces,
+                 "archive file not closed or shared spaces not disabled.");
+        }
       }
-#endif // INCLUDE_CDS
     }
+#endif // INCLUDE_CDS
 
 #ifdef _LP64
     if (!UseSharedSpaces && using_class_space()) {
diff --git a/hotspot/src/share/vm/memory/virtualspace.cpp b/hotspot/src/share/vm/memory/virtualspace.cpp
index 3cb6d21..63c1b92 100644
--- a/hotspot/src/share/vm/memory/virtualspace.cpp
+++ b/hotspot/src/share/vm/memory/virtualspace.cpp
@@ -676,7 +676,7 @@
 
 
 void VirtualSpace::release() {
-  // This does not release memory it never reserved.
+  // This does not release memory it reserved.
   // Caller must release via rs.release();
   _low_boundary           = NULL;
   _high_boundary          = NULL;
diff --git a/hotspot/src/share/vm/oops/instanceKlass.cpp b/hotspot/src/share/vm/oops/instanceKlass.cpp
index 0310d28..1e7b1b1 100644
--- a/hotspot/src/share/vm/oops/instanceKlass.cpp
+++ b/hotspot/src/share/vm/oops/instanceKlass.cpp
@@ -67,6 +67,7 @@
 #include "services/threadService.hpp"
 #include "utilities/dtrace.hpp"
 #include "utilities/macros.hpp"
+#include "utilities/stringUtils.hpp"
 #include "logging/log.hpp"
 #ifdef COMPILER1
 #include "c1/c1_Compiler.hpp"
@@ -2225,9 +2226,14 @@
 }
 
 void InstanceKlass::set_package(ClassLoaderData* loader_data, TRAPS) {
+
+  // ensure java/ packages only loaded by boot or platform builtin loaders
+  check_prohibited_package(name(), loader_data->class_loader(), CHECK);
+
   TempNewSymbol pkg_name = package_from_name(name(), CHECK);
 
   if (pkg_name != NULL && loader_data != NULL) {
+
     // Find in class loader's package entry table.
     _package_entry = loader_data->packages()->lookup_only(pkg_name);
 
@@ -2376,6 +2382,31 @@
 }
 */
 
+// Only boot and platform class loaders can define classes in "java/" packages.
+void InstanceKlass::check_prohibited_package(Symbol* class_name,
+                                                Handle class_loader,
+                                                TRAPS) {
+  const char* javapkg = "java/";
+  ResourceMark rm(THREAD);
+  if (!class_loader.is_null() &&
+      !SystemDictionary::is_platform_class_loader(class_loader) &&
+      class_name != NULL &&
+      strncmp(class_name->as_C_string(), javapkg, strlen(javapkg)) == 0) {
+    TempNewSymbol pkg_name = InstanceKlass::package_from_name(class_name, CHECK);
+    assert(pkg_name != NULL, "Error in parsing package name starting with 'java/'");
+    char* name = pkg_name->as_C_string();
+    const char* class_loader_name = InstanceKlass::cast(class_loader()->klass())->name()->as_C_string();
+    StringUtils::replace_no_expand(name, "/", ".");
+    const char* msg_text1 = "Class loader (instance of): ";
+    const char* msg_text2 = " tried to load prohibited package name: ";
+    size_t len = strlen(msg_text1) + strlen(class_loader_name) + strlen(msg_text2) + strlen(name) + 1;
+    char* message = NEW_RESOURCE_ARRAY_IN_THREAD(THREAD, char, len);
+    jio_snprintf(message, len, "%s%s%s%s", msg_text1, class_loader_name, msg_text2, name);
+    THROW_MSG(vmSymbols::java_lang_SecurityException(), message);
+  }
+  return;
+}
+
 // tell if two classes have the same enclosing class (at package level)
 bool InstanceKlass::is_same_package_member_impl(const InstanceKlass* class1,
                                                 const Klass* class2,
@@ -2706,7 +2737,7 @@
   return NULL;
 }
 
-oop InstanceKlass::add_member_name(Handle mem_name, bool intern) {
+bool InstanceKlass::add_member_name(Handle mem_name) {
   jweak mem_name_wref = JNIHandles::make_weak_global(mem_name);
   MutexLocker ml(MemberNameTable_lock);
   DEBUG_ONLY(NoSafepointVerifier nsv);
@@ -2716,7 +2747,7 @@
   // is called!
   Method* method = (Method*)java_lang_invoke_MemberName::vmtarget(mem_name());
   if (method->is_obsolete()) {
-    return NULL;
+    return false;
   } else if (method->is_old()) {
     // Replace method with redefined version
     java_lang_invoke_MemberName::set_vmtarget(mem_name(), method_with_idnum(method->method_idnum()));
@@ -2725,11 +2756,8 @@
   if (_member_names == NULL) {
     _member_names = new (ResourceObj::C_HEAP, mtClass) MemberNameTable(idnum_allocated_count());
   }
-  if (intern) {
-    return _member_names->find_or_add_member_name(mem_name_wref);
-  } else {
-    return _member_names->add_member_name(mem_name_wref);
-  }
+  _member_names->add_member_name(mem_name_wref);
+  return true;
 }
 
 // -----------------------------------------------------------------------------------------------------
diff --git a/hotspot/src/share/vm/oops/instanceKlass.hpp b/hotspot/src/share/vm/oops/instanceKlass.hpp
index 9a69039..24da186 100644
--- a/hotspot/src/share/vm/oops/instanceKlass.hpp
+++ b/hotspot/src/share/vm/oops/instanceKlass.hpp
@@ -470,6 +470,12 @@
   static bool find_inner_classes_attr(instanceKlassHandle k,
                                       int* ooff, int* noff, TRAPS);
 
+ private:
+  // Check prohibited package ("java/" only loadable by boot or platform loaders)
+  static void check_prohibited_package(Symbol* class_name,
+                                       Handle class_loader,
+                                       TRAPS);
+ public:
   // tell if two classes have the same enclosing class (at package level)
   bool is_same_package_member(const Klass* class2, TRAPS) const {
     return is_same_package_member_impl(this, class2, THREAD);
@@ -786,7 +792,9 @@
   static void purge_previous_versions(InstanceKlass* ik) { return; };
   static bool has_previous_versions() { return false; }
 
-  void set_cached_class_file(JvmtiCachedClassFileData *data) { ShouldNotReachHere(); }
+  void set_cached_class_file(JvmtiCachedClassFileData *data) {
+    assert(data == NULL, "unexpected call with JVMTI disabled");
+  }
   JvmtiCachedClassFileData * get_cached_class_file() { return (JvmtiCachedClassFileData *)NULL; }
 
 #endif // INCLUDE_JVMTI
@@ -1298,7 +1306,7 @@
   // JSR-292 support
   MemberNameTable* member_names() { return _member_names; }
   void set_member_names(MemberNameTable* member_names) { _member_names = member_names; }
-  oop add_member_name(Handle member_name, bool intern);
+  bool add_member_name(Handle member_name);
 
 public:
   // JVMTI support
diff --git a/hotspot/src/share/vm/oops/symbol.hpp b/hotspot/src/share/vm/oops/symbol.hpp
index b2d71d5..b6801f0 100644
--- a/hotspot/src/share/vm/oops/symbol.hpp
+++ b/hotspot/src/share/vm/oops/symbol.hpp
@@ -91,12 +91,6 @@
 // The allocation (or lookup) of K increments the reference count for K
 // and the destructor decrements the reference count.
 //
-// Another example of TempNewSymbol usage is parsed_name used in
-// ClassFileParser::parseClassFile() where parsed_name is used in the cleanup
-// after a failed attempt to load a class.  Here parsed_name is a
-// TempNewSymbol (passed in as a parameter) so the reference count on its symbol
-// will be decremented when it goes out of scope.
-
 // This cannot be inherited from ResourceObj because it cannot have a vtable.
 // Since sometimes this is allocated from Metadata, pick a base allocation
 // type without virtual functions.
diff --git a/hotspot/src/share/vm/opto/ad.hpp b/hotspot/src/share/vm/opto/ad.hpp
index 7bd84eb..b2bf4d5 100644
--- a/hotspot/src/share/vm/opto/ad.hpp
+++ b/hotspot/src/share/vm/opto/ad.hpp
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2014, 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2014, 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
@@ -25,20 +25,9 @@
 #ifndef SHARE_VM_OPTO_AD_HPP
 #define SHARE_VM_OPTO_AD_HPP
 
-#if defined AD_MD_HPP
-# include AD_MD_HPP
-#elif defined TARGET_ARCH_MODEL_x86_32
-# include "adfiles/ad_x86_32.hpp"
-#elif defined TARGET_ARCH_MODEL_x86_64
-# include "adfiles/ad_x86_64.hpp"
-#elif defined TARGET_ARCH_MODEL_sparc
-# include "adfiles/ad_sparc.hpp"
-#elif defined TARGET_ARCH_MODEL_zero
-# include "adfiles/ad_zero.hpp"
-#elif defined TARGET_ARCH_MODEL_ppc_64
-# include "adfiles/ad_ppc_64.hpp"
-#elif defined TARGET_ARCH_MODEL_aarch64
-# include "adfiles/ad_aarch64.hpp"
-#endif
+
+#include "utilities/macros.hpp"
+
+#include CPU_HEADER(adfiles/ad)
 
 #endif // SHARE_VM_OPTO_AD_HPP
diff --git a/hotspot/src/share/vm/opto/c2_globals.hpp b/hotspot/src/share/vm/opto/c2_globals.hpp
index 686615a..3ba603d 100644
--- a/hotspot/src/share/vm/opto/c2_globals.hpp
+++ b/hotspot/src/share/vm/opto/c2_globals.hpp
@@ -26,36 +26,10 @@
 #define SHARE_VM_OPTO_C2_GLOBALS_HPP
 
 #include "runtime/globals.hpp"
-#ifdef TARGET_ARCH_x86
-# include "c2_globals_x86.hpp"
-#endif
-#ifdef TARGET_ARCH_sparc
-# include "c2_globals_sparc.hpp"
-#endif
-#ifdef TARGET_ARCH_arm
-# include "c2_globals_arm.hpp"
-#endif
-#ifdef TARGET_ARCH_ppc
-# include "c2_globals_ppc.hpp"
-#endif
-#ifdef TARGET_ARCH_aarch64
-# include "c2_globals_aarch64.hpp"
-#endif
-#ifdef TARGET_OS_FAMILY_linux
-# include "c2_globals_linux.hpp"
-#endif
-#ifdef TARGET_OS_FAMILY_solaris
-# include "c2_globals_solaris.hpp"
-#endif
-#ifdef TARGET_OS_FAMILY_windows
-# include "c2_globals_windows.hpp"
-#endif
-#ifdef TARGET_OS_FAMILY_aix
-# include "c2_globals_aix.hpp"
-#endif
-#ifdef TARGET_OS_FAMILY_bsd
-# include "c2_globals_bsd.hpp"
-#endif
+#include "utilities/macros.hpp"
+
+#include CPU_HEADER(c2_globals)
+#include OS_HEADER(c2_globals)
 
 //
 // Defines all globals flags used by the server compiler.
diff --git a/hotspot/src/share/vm/opto/compile.cpp b/hotspot/src/share/vm/opto/compile.cpp
index 9946071..7824b11 100644
--- a/hotspot/src/share/vm/opto/compile.cpp
+++ b/hotspot/src/share/vm/opto/compile.cpp
@@ -3814,6 +3814,7 @@
   if (can_be_reused() != other.can_be_reused())  return false;
   // For floating point values we compare the bit pattern.
   switch (type()) {
+  case T_INT:
   case T_FLOAT:   return (_v._value.i == other._v._value.i);
   case T_LONG:
   case T_DOUBLE:  return (_v._value.j == other._v._value.j);
@@ -3828,6 +3829,7 @@
 
 static int type_to_size_in_bytes(BasicType t) {
   switch (t) {
+  case T_INT:     return sizeof(jint   );
   case T_LONG:    return sizeof(jlong  );
   case T_FLOAT:   return sizeof(jfloat );
   case T_DOUBLE:  return sizeof(jdouble);
@@ -3896,6 +3898,7 @@
     Constant con = _constants.at(i);
     address constant_addr = NULL;
     switch (con.type()) {
+    case T_INT:    constant_addr = _masm.int_constant(   con.get_jint()   ); break;
     case T_LONG:   constant_addr = _masm.long_constant(  con.get_jlong()  ); break;
     case T_FLOAT:  constant_addr = _masm.float_constant( con.get_jfloat() ); break;
     case T_DOUBLE: constant_addr = _masm.double_constant(con.get_jdouble()); break;
diff --git a/hotspot/src/share/vm/opto/compile.hpp b/hotspot/src/share/vm/opto/compile.hpp
index 79575dc..f2f8c46 100644
--- a/hotspot/src/share/vm/opto/compile.hpp
+++ b/hotspot/src/share/vm/opto/compile.hpp
@@ -264,6 +264,7 @@
 
     BasicType type()      const    { return _type; }
 
+    jint    get_jint()    const    { return _v._value.i; }
     jlong   get_jlong()   const    { return _v._value.j; }
     jfloat  get_jfloat()  const    { return _v._value.f; }
     jdouble get_jdouble() const    { return _v._value.d; }
@@ -320,6 +321,14 @@
     Constant add(MachConstantNode* n, BasicType type, jvalue value);
     Constant add(Metadata* metadata);
     Constant add(MachConstantNode* n, MachOper* oper);
+    Constant add(MachConstantNode* n, jint i) {
+      jvalue value; value.i = i;
+      return add(n, T_INT, value);
+    }
+    Constant add(MachConstantNode* n, jlong j) {
+      jvalue value; value.j = j;
+      return add(n, T_LONG, value);
+    }
     Constant add(MachConstantNode* n, jfloat f) {
       jvalue value; value.f = f;
       return add(n, T_FLOAT, value);
diff --git a/hotspot/src/share/vm/opto/doCall.cpp b/hotspot/src/share/vm/opto/doCall.cpp
index ce7e6d1..97af80e 100644
--- a/hotspot/src/share/vm/opto/doCall.cpp
+++ b/hotspot/src/share/vm/opto/doCall.cpp
@@ -209,16 +209,22 @@
 
       int morphism = profile.morphism();
       if (speculative_receiver_type != NULL) {
-        // We have a speculative type, we should be able to resolve
-        // the call. We do that before looking at the profiling at
-        // this invoke because it may lead to bimorphic inlining which
-        // a speculative type should help us avoid.
-        receiver_method = callee->resolve_invoke(jvms->method()->holder(),
-                                                 speculative_receiver_type);
-        if (receiver_method == NULL) {
-          speculative_receiver_type = NULL;
+        if (!too_many_traps(caller, bci, Deoptimization::Reason_speculate_class_check)) {
+          // We have a speculative type, we should be able to resolve
+          // the call. We do that before looking at the profiling at
+          // this invoke because it may lead to bimorphic inlining which
+          // a speculative type should help us avoid.
+          receiver_method = callee->resolve_invoke(jvms->method()->holder(),
+                                                   speculative_receiver_type);
+          if (receiver_method == NULL) {
+            speculative_receiver_type = NULL;
+          } else {
+            morphism = 1;
+          }
         } else {
-          morphism = 1;
+          // speculation failed before. Use profiling at the call
+          // (could allow bimorphic inlining for instance).
+          speculative_receiver_type = NULL;
         }
       }
       if (receiver_method == NULL &&
@@ -255,7 +261,7 @@
           Deoptimization::DeoptReason reason = morphism == 2 ?
             Deoptimization::Reason_bimorphic : Deoptimization::reason_class_check(speculative_receiver_type != NULL);
           if ((morphism == 1 || (morphism == 2 && next_hit_cg != NULL)) &&
-              !too_many_traps(jvms->method(), jvms->bci(), reason)
+              !too_many_traps(caller, bci, reason)
              ) {
             // Generate uncommon trap for class check failure path
             // in case of monomorphic or bimorphic virtual call site.
diff --git a/hotspot/src/share/vm/opto/escape.cpp b/hotspot/src/share/vm/opto/escape.cpp
index 892a0d3..47bab94 100644
--- a/hotspot/src/share/vm/opto/escape.cpp
+++ b/hotspot/src/share/vm/opto/escape.cpp
@@ -2067,7 +2067,9 @@
         bt = field->layout_type();
       } else {
         // Check for unsafe oop field access
-        if (n->has_out_with(Op_StoreP, Op_LoadP, Op_StoreN, Op_LoadN)) {
+        if (n->has_out_with(Op_StoreP, Op_LoadP, Op_StoreN, Op_LoadN) ||
+            n->has_out_with(Op_GetAndSetP, Op_GetAndSetN, Op_CompareAndExchangeP, Op_CompareAndExchangeN) ||
+            n->has_out_with(Op_CompareAndSwapP, Op_CompareAndSwapN, Op_WeakCompareAndSwapP, Op_WeakCompareAndSwapN)) {
           bt = T_OBJECT;
           (*unsafe) = true;
         }
@@ -2083,7 +2085,9 @@
       }
     } else if (adr_type->isa_rawptr() || adr_type->isa_klassptr()) {
       // Allocation initialization, ThreadLocal field access, unsafe access
-      if (n->has_out_with(Op_StoreP, Op_LoadP, Op_StoreN, Op_LoadN)) {
+      if (n->has_out_with(Op_StoreP, Op_LoadP, Op_StoreN, Op_LoadN) ||
+          n->has_out_with(Op_GetAndSetP, Op_GetAndSetN, Op_CompareAndExchangeP, Op_CompareAndExchangeN) ||
+          n->has_out_with(Op_CompareAndSwapP, Op_CompareAndSwapN, Op_WeakCompareAndSwapP, Op_WeakCompareAndSwapN)) {
         bt = T_OBJECT;
       }
     }
@@ -3134,8 +3138,8 @@
         }
       } else {
         uint op = use->Opcode();
-        if ((use->in(MemNode::Memory) == n) &&
-            (op == Op_StrCompressedCopy || op == Op_StrInflatedCopy)) {
+        if ((op == Op_StrCompressedCopy || op == Op_StrInflatedCopy) &&
+            (use->in(MemNode::Memory) == n)) {
           // They overwrite memory edge corresponding to destination array,
           memnode_worklist.append_if_missing(use);
         } else if (!(op == Op_CmpP || op == Op_Conv2B ||
diff --git a/hotspot/src/share/vm/opto/lcm.cpp b/hotspot/src/share/vm/opto/lcm.cpp
index 431bba1..aabb17a 100644
--- a/hotspot/src/share/vm/opto/lcm.cpp
+++ b/hotspot/src/share/vm/opto/lcm.cpp
@@ -1293,11 +1293,12 @@
     Block *sb = block->_succs[i];
     // Clone the entire area; ignoring the edge fixup for now.
     for( uint j = end; j > beg; j-- ) {
-      // It is safe here to clone a node with anti_dependence
-      // since clones dominate on each path.
       Node *clone = block->get_node(j-1)->clone();
       sb->insert_node(clone, 1);
       map_node_to_block(clone, sb);
+      if (clone->needs_anti_dependence_check()) {
+        insert_anti_dependences(sb, clone);
+      }
     }
   }
 
diff --git a/hotspot/src/share/vm/opto/library_call.cpp b/hotspot/src/share/vm/opto/library_call.cpp
index af27b91..5de8f72 100644
--- a/hotspot/src/share/vm/opto/library_call.cpp
+++ b/hotspot/src/share/vm/opto/library_call.cpp
@@ -222,7 +222,6 @@
   Node* round_double_node(Node* n);
   bool runtime_math(const TypeFunc* call_type, address funcAddr, const char* funcName);
   bool inline_math_native(vmIntrinsics::ID id);
-  bool inline_trig(vmIntrinsics::ID id);
   bool inline_math(vmIntrinsics::ID id);
   template <typename OverflowOp>
   bool inline_math_overflow(Node* arg1, Node* arg2);
@@ -1404,18 +1403,20 @@
          (!compress && src_elem == T_BYTE && (dst_elem == T_BYTE || dst_elem == T_CHAR)),
          "Unsupported array types for inline_string_copy");
 
-  // Range checks
-  generate_string_range_check(src, src_offset, length, compress && src_elem == T_BYTE);
-  generate_string_range_check(dst, dst_offset, length, !compress && dst_elem == T_BYTE);
-  if (stopped()) {
-    return true;
+  // Convert char[] offsets to byte[] offsets
+  bool convert_src = (compress && src_elem == T_BYTE);
+  bool convert_dst = (!compress && dst_elem == T_BYTE);
+  if (convert_src) {
+    src_offset = _gvn.transform(new LShiftINode(src_offset, intcon(1)));
+  } else if (convert_dst) {
+    dst_offset = _gvn.transform(new LShiftINode(dst_offset, intcon(1)));
   }
 
-  // Convert char[] offsets to byte[] offsets
-  if (compress && src_elem == T_BYTE) {
-    src_offset = _gvn.transform(new LShiftINode(src_offset, intcon(1)));
-  } else if (!compress && dst_elem == T_BYTE) {
-    dst_offset = _gvn.transform(new LShiftINode(dst_offset, intcon(1)));
+  // Range checks
+  generate_string_range_check(src, src_offset, length, convert_src);
+  generate_string_range_check(dst, dst_offset, length, convert_dst);
+  if (stopped()) {
+    return true;
   }
 
   Node* src_start = array_element_address(src, src_offset, src_elem);
@@ -1691,94 +1692,6 @@
   return true;
 }
 
-//------------------------------inline_trig----------------------------------
-// Inline sin/cos/tan instructions, if possible.  If rounding is required, do
-// argument reduction which will turn into a fast/slow diamond.
-bool LibraryCallKit::inline_trig(vmIntrinsics::ID id) {
-  Node* arg = round_double_node(argument(0));
-  Node* n = NULL;
-
-  n = _gvn.transform(n);
-
-  // Rounding required?  Check for argument reduction!
-  if (Matcher::strict_fp_requires_explicit_rounding) {
-    static const double     pi_4 =  0.7853981633974483;
-    static const double neg_pi_4 = -0.7853981633974483;
-    // pi/2 in 80-bit extended precision
-    // static const unsigned char pi_2_bits_x[] = {0x35,0xc2,0x68,0x21,0xa2,0xda,0x0f,0xc9,0xff,0x3f,0x00,0x00,0x00,0x00,0x00,0x00};
-    // -pi/2 in 80-bit extended precision
-    // static const unsigned char neg_pi_2_bits_x[] = {0x35,0xc2,0x68,0x21,0xa2,0xda,0x0f,0xc9,0xff,0xbf,0x00,0x00,0x00,0x00,0x00,0x00};
-    // Cutoff value for using this argument reduction technique
-    //static const double    pi_2_minus_epsilon =  1.564660403643354;
-    //static const double neg_pi_2_plus_epsilon = -1.564660403643354;
-
-    // Pseudocode for sin:
-    // if (x <= Math.PI / 4.0) {
-    //   if (x >= -Math.PI / 4.0) return  fsin(x);
-    //   if (x >= -Math.PI / 2.0) return -fcos(x + Math.PI / 2.0);
-    // } else {
-    //   if (x <=  Math.PI / 2.0) return  fcos(x - Math.PI / 2.0);
-    // }
-    // return StrictMath.sin(x);
-
-    // Pseudocode for cos:
-    // if (x <= Math.PI / 4.0) {
-    //   if (x >= -Math.PI / 4.0) return  fcos(x);
-    //   if (x >= -Math.PI / 2.0) return  fsin(x + Math.PI / 2.0);
-    // } else {
-    //   if (x <=  Math.PI / 2.0) return -fsin(x - Math.PI / 2.0);
-    // }
-    // return StrictMath.cos(x);
-
-    // Actually, sticking in an 80-bit Intel value into C2 will be tough; it
-    // requires a special machine instruction to load it.  Instead we'll try
-    // the 'easy' case.  If we really need the extra range +/- PI/2 we'll
-    // probably do the math inside the SIN encoding.
-
-    // Make the merge point
-    RegionNode* r = new RegionNode(3);
-    Node* phi = new PhiNode(r, Type::DOUBLE);
-
-    // Flatten arg so we need only 1 test
-    Node *abs = _gvn.transform(new AbsDNode(arg));
-    // Node for PI/4 constant
-    Node *pi4 = makecon(TypeD::make(pi_4));
-    // Check PI/4 : abs(arg)
-    Node *cmp = _gvn.transform(new CmpDNode(pi4,abs));
-    // Check: If PI/4 < abs(arg) then go slow
-    Node *bol = _gvn.transform(new BoolNode( cmp, BoolTest::lt ));
-    // Branch either way
-    IfNode *iff = create_and_xform_if(control(),bol, PROB_STATIC_FREQUENT, COUNT_UNKNOWN);
-    set_control(opt_iff(r,iff));
-
-    // Set fast path result
-    phi->init_req(2, n);
-
-    // Slow path - non-blocking leaf call
-    Node* call = NULL;
-    switch (id) {
-    case vmIntrinsics::_dtan:
-      call = make_runtime_call(RC_LEAF, OptoRuntime::Math_D_D_Type(),
-                               CAST_FROM_FN_PTR(address, SharedRuntime::dtan),
-                               "Tan", NULL, arg, top());
-      break;
-    }
-    assert(control()->in(0) == call, "");
-    Node* slow_result = _gvn.transform(new ProjNode(call, TypeFunc::Parms));
-    r->init_req(1, control());
-    phi->init_req(1, slow_result);
-
-    // Post-merge
-    set_control(_gvn.transform(r));
-    record_for_igvn(r);
-    n = _gvn.transform(phi);
-
-    C->set_has_split_ifs(true); // Has chance for split-if optimization
-  }
-  set_result(n);
-  return true;
-}
-
 //------------------------------runtime_math-----------------------------
 bool LibraryCallKit::runtime_math(const TypeFunc* call_type, address funcAddr, const char* funcName) {
   assert(call_type == OptoRuntime::Math_DD_D_Type() || call_type == OptoRuntime::Math_D_D_Type(),
@@ -2429,6 +2342,8 @@
       return false;
     }
     mismatched = (bt != type);
+  } else if (alias_type->adr_type() == TypeOopPtr::BOTTOM) {
+    mismatched = true; // conservatively mark all "wide" on-heap accesses as mismatched
   }
 
   // First guess at the value type.
@@ -3304,7 +3219,7 @@
   // drop through to next case
   set_control( _gvn.transform(new IfTrueNode(iff_bit)));
 
-#ifndef TARGET_OS_FAMILY_windows
+#ifndef _WINDOWS
   // (c) Or, if interrupt bit is set and clear_int is false, use 2nd fast path.
   Node* clr_arg = argument(1);
   Node* cmp_arg = _gvn.transform(new CmpINode(clr_arg, intcon(0)));
@@ -3321,7 +3236,7 @@
 #else
   // To return true on Windows you must read the _interrupted field
   // and check the event state i.e. take the slow path.
-#endif // TARGET_OS_FAMILY_windows
+#endif // _WINDOWS
 
   // (d) Otherwise, go to the slow path.
   slow_region->add_req(control());
diff --git a/hotspot/src/share/vm/opto/loopTransform.cpp b/hotspot/src/share/vm/opto/loopTransform.cpp
index 282c5c1..b9368b42 100644
--- a/hotspot/src/share/vm/opto/loopTransform.cpp
+++ b/hotspot/src/share/vm/opto/loopTransform.cpp
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2000, 2015, 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
@@ -70,9 +70,9 @@
 }
 
 //------------------------------compute_exact_trip_count-----------------------
-// Compute loop exact trip count if possible. Do not recalculate trip count for
+// Compute loop trip count if possible. Do not recalculate trip count for
 // split loops (pre-main-post) which have their limits and inits behind Opaque node.
-void IdealLoopTree::compute_exact_trip_count( PhaseIdealLoop *phase ) {
+void IdealLoopTree::compute_trip_count(PhaseIdealLoop* phase) {
   if (!_head->as_Loop()->is_valid_counted_loop()) {
     return;
   }
@@ -94,17 +94,21 @@
 
   Node* init_n = cl->init_trip();
   Node* limit_n = cl->limit();
-  if (init_n  != NULL &&  init_n->is_Con() &&
-      limit_n != NULL && limit_n->is_Con()) {
+  if (init_n != NULL && limit_n != NULL) {
     // Use longs to avoid integer overflow.
-    int stride_con  = cl->stride_con();
-    jlong init_con   = cl->init_trip()->get_int();
-    jlong limit_con  = cl->limit()->get_int();
-    int stride_m    = stride_con - (stride_con > 0 ? 1 : -1);
+    int stride_con = cl->stride_con();
+    jlong init_con = phase->_igvn.type(init_n)->is_int()->_lo;
+    jlong limit_con = phase->_igvn.type(limit_n)->is_int()->_hi;
+    int stride_m   = stride_con - (stride_con > 0 ? 1 : -1);
     jlong trip_count = (limit_con - init_con + stride_m)/stride_con;
     if (trip_count > 0 && (julong)trip_count < (julong)max_juint) {
-      // Set exact trip count.
-      cl->set_exact_trip_count((uint)trip_count);
+      if (init_n->is_Con() && limit_n->is_Con()) {
+        // Set exact trip count.
+        cl->set_exact_trip_count((uint)trip_count);
+      } else if (cl->unrolled_count() == 1) {
+        // Set maximum trip count before unrolling.
+        cl->set_trip_count((uint)trip_count);
+      }
     }
   }
 }
@@ -1305,7 +1309,7 @@
   assert(main_exit->Opcode() == Op_IfFalse, "");
   int dd_main_exit = dom_depth(main_exit);
 
-  // Step A1: Clone the loop body of main.  The clone becomes the vector post-loop.
+  // Step A1: Clone the loop body of main. The clone becomes the post-loop.
   // The main loop pre-header illegally has 2 control users (old & new loops).
   clone_loop(loop, old_new, dd_main_exit);
   assert(old_new[main_end->_idx]->Opcode() == Op_CountedLoopEnd, "");
@@ -2095,8 +2099,7 @@
   // the loop is in canonical form to multiversion.
   closed_range_checks = 0;
 
-  // Check loop body for tests of trip-counter plus loop-invariant vs
-  // loop-invariant.
+  // Check loop body for tests of trip-counter plus loop-invariant vs loop-variant.
   for( uint i = 0; i < loop->_body.size(); i++ ) {
     Node *iff = loop->_body[i];
     if (iff->Opcode() == Op_If ||
@@ -2298,7 +2301,7 @@
   // skip this loop if it is already checked
   if (cl->has_been_range_checked()) return;
 
-  // Now check for existance of range checks
+  // Now check for existence of range checks
   for (uint i = 0; i < loop->_body.size(); i++) {
     Node *iff = loop->_body[i];
     int iff_opc = iff->Opcode();
@@ -2319,7 +2322,7 @@
   CountedLoopNode *legacy_cl = legacy_loop->_head->as_CountedLoop();
   assert(legacy_cl->is_post_loop(), "");
 
-  // Check for existance of range checks using the unique instance to make a guard with
+  // Check for existence of range checks using the unique instance to make a guard with
   Unique_Node_List worklist;
   for (uint i = 0; i < legacy_loop->_body.size(); i++) {
     Node *iff = legacy_loop->_body[i];
@@ -2422,7 +2425,7 @@
 }
 
 //-------------------------poison_rce_post_loop--------------------------------
-// Causes the rce'd post loop to be optimized away if multiverioning fails
+// Causes the rce'd post loop to be optimized away if multiversioning fails
 void PhaseIdealLoop::poison_rce_post_loop(IdealLoopTree *rce_loop) {
   CountedLoopNode *rce_cl = rce_loop->_head->as_CountedLoop();
   Node* ctrl = rce_cl->in(LoopNode::EntryControl);
@@ -2710,8 +2713,8 @@
 //=============================================================================
 //------------------------------iteration_split_impl---------------------------
 bool IdealLoopTree::iteration_split_impl( PhaseIdealLoop *phase, Node_List &old_new ) {
-  // Compute exact loop trip count if possible.
-  compute_exact_trip_count(phase);
+  // Compute loop trip count if possible.
+  compute_trip_count(phase);
 
   // Convert one iteration loop into normal code.
   if (policy_do_one_iteration_loop(phase))
diff --git a/hotspot/src/share/vm/opto/loopnode.cpp b/hotspot/src/share/vm/opto/loopnode.cpp
index 7862a71..727e0b9 100644
--- a/hotspot/src/share/vm/opto/loopnode.cpp
+++ b/hotspot/src/share/vm/opto/loopnode.cpp
@@ -279,8 +279,16 @@
     return false;
 
   // Allow funny placement of Safepoint
-  if (back_control->Opcode() == Op_SafePoint)
+  if (back_control->Opcode() == Op_SafePoint) {
+    if (UseCountedLoopSafepoints) {
+      // Leaving the safepoint on the backedge and creating a
+      // CountedLoop will confuse optimizations. We can't move the
+      // safepoint around because its jvm state wouldn't match a new
+      // location. Give up on that loop.
+      return false;
+    }
     back_control = back_control->in(TypeFunc::Control);
+  }
 
   // Controlling test for loop
   Node *iftrue = back_control;
diff --git a/hotspot/src/share/vm/opto/loopnode.hpp b/hotspot/src/share/vm/opto/loopnode.hpp
index 1e21509..3419b78 100644
--- a/hotspot/src/share/vm/opto/loopnode.hpp
+++ b/hotspot/src/share/vm/opto/loopnode.hpp
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1998, 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1998, 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
@@ -520,8 +520,8 @@
   // Return TRUE if "iff" is a range check.
   bool is_range_check_if(IfNode *iff, PhaseIdealLoop *phase, Invariance& invar) const;
 
-  // Compute loop exact trip count if possible
-  void compute_exact_trip_count( PhaseIdealLoop *phase );
+  // Compute loop trip count if possible
+  void compute_trip_count(PhaseIdealLoop* phase);
 
   // Compute loop trip count from profile data
   void compute_profile_trip_cnt( PhaseIdealLoop *phase );
diff --git a/hotspot/src/share/vm/opto/macro.cpp b/hotspot/src/share/vm/opto/macro.cpp
index 993f60f..653d20f 100644
--- a/hotspot/src/share/vm/opto/macro.cpp
+++ b/hotspot/src/share/vm/opto/macro.cpp
@@ -1596,8 +1596,12 @@
         // All nodes that depended on the InitializeNode for control
         // and memory must now depend on the MemBarNode that itself
         // depends on the InitializeNode
-        _igvn.replace_node(init_ctrl, ctrl);
-        _igvn.replace_node(init_mem, mem);
+        if (init_ctrl != NULL) {
+          _igvn.replace_node(init_ctrl, ctrl);
+        }
+        if (init_mem != NULL) {
+          _igvn.replace_node(init_mem, mem);
+        }
       }
     }
 
diff --git a/hotspot/src/share/vm/opto/memnode.cpp b/hotspot/src/share/vm/opto/memnode.cpp
index f0d588a..1ea3bd2 100644
--- a/hotspot/src/share/vm/opto/memnode.cpp
+++ b/hotspot/src/share/vm/opto/memnode.cpp
@@ -1713,9 +1713,6 @@
       }
     }
   } else if (tp->base() == Type::InstPtr) {
-    ciEnv* env = C->env();
-    const TypeInstPtr* tinst = tp->is_instptr();
-    ciKlass* klass = tinst->klass();
     assert( off != Type::OffsetBot ||
             // arrays can be cast to Objects
             tp->is_oopptr()->klass()->is_java_lang_Object() ||
@@ -1723,9 +1720,11 @@
             C->has_unsafe_access(),
             "Field accesses must be precise" );
     // For oop loads, we expect the _type to be precise.
-    // Optimizations for constant objects
+
+    // Optimize loads from constant fields.
+    const TypeInstPtr* tinst = tp->is_instptr();
     ciObject* const_oop = tinst->const_oop();
-    if (const_oop != NULL && const_oop->is_instance()) {
+    if (!is_mismatched_access() && off != Type::OffsetBot && const_oop != NULL && const_oop->is_instance()) {
       const Type* con_type = Type::make_constant_from_field(const_oop->as_instance(), off, is_unsigned(), memory_type());
       if (con_type != NULL) {
         return con_type;
diff --git a/hotspot/src/share/vm/opto/node.cpp b/hotspot/src/share/vm/opto/node.cpp
index 6d8b13a..833b760 100644
--- a/hotspot/src/share/vm/opto/node.cpp
+++ b/hotspot/src/share/vm/opto/node.cpp
@@ -295,9 +295,6 @@
   if (req > 0) {
     // Allocate space for _in array to have double alignment.
     _in = (Node **) ((char *) (C->node_arena()->Amalloc_D(req * sizeof(void*))));
-#ifdef ASSERT
-    _in[req-1] = this; // magic cookie for assertion check
-#endif
   }
   // If there are default notes floating around, capture them:
   Node_Notes* nn = C->default_node_notes();
@@ -326,10 +323,8 @@
   debug_only( verify_construction() );
   NOT_PRODUCT(nodes_created++);
   if (req == 0) {
-    assert( _in == (Node**)this, "Must not pass arg count to 'new'" );
     _in = NULL;
   } else {
-    assert( _in[req-1] == this, "Must pass arg count to 'new'" );
     Node** to = _in;
     for(uint i = 0; i < req; i++) {
       to[i] = NULL;
@@ -346,8 +341,6 @@
 {
   debug_only( verify_construction() );
   NOT_PRODUCT(nodes_created++);
-  // Assert we allocated space for input array already
-  assert( _in[0] == this, "Must pass arg count to 'new'" );
   assert( is_not_dead(n0), "can not use dead node");
   _in[0] = n0; if (n0 != NULL) n0->add_out((Node *)this);
 }
@@ -361,8 +354,6 @@
 {
   debug_only( verify_construction() );
   NOT_PRODUCT(nodes_created++);
-  // Assert we allocated space for input array already
-  assert( _in[1] == this, "Must pass arg count to 'new'" );
   assert( is_not_dead(n0), "can not use dead node");
   assert( is_not_dead(n1), "can not use dead node");
   _in[0] = n0; if (n0 != NULL) n0->add_out((Node *)this);
@@ -378,8 +369,6 @@
 {
   debug_only( verify_construction() );
   NOT_PRODUCT(nodes_created++);
-  // Assert we allocated space for input array already
-  assert( _in[2] == this, "Must pass arg count to 'new'" );
   assert( is_not_dead(n0), "can not use dead node");
   assert( is_not_dead(n1), "can not use dead node");
   assert( is_not_dead(n2), "can not use dead node");
@@ -397,8 +386,6 @@
 {
   debug_only( verify_construction() );
   NOT_PRODUCT(nodes_created++);
-  // Assert we allocated space for input array already
-  assert( _in[3] == this, "Must pass arg count to 'new'" );
   assert( is_not_dead(n0), "can not use dead node");
   assert( is_not_dead(n1), "can not use dead node");
   assert( is_not_dead(n2), "can not use dead node");
@@ -418,8 +405,6 @@
 {
   debug_only( verify_construction() );
   NOT_PRODUCT(nodes_created++);
-  // Assert we allocated space for input array already
-  assert( _in[4] == this, "Must pass arg count to 'new'" );
   assert( is_not_dead(n0), "can not use dead node");
   assert( is_not_dead(n1), "can not use dead node");
   assert( is_not_dead(n2), "can not use dead node");
@@ -442,8 +427,6 @@
 {
   debug_only( verify_construction() );
   NOT_PRODUCT(nodes_created++);
-  // Assert we allocated space for input array already
-  assert( _in[5] == this, "Must pass arg count to 'new'" );
   assert( is_not_dead(n0), "can not use dead node");
   assert( is_not_dead(n1), "can not use dead node");
   assert( is_not_dead(n2), "can not use dead node");
@@ -468,8 +451,6 @@
 {
   debug_only( verify_construction() );
   NOT_PRODUCT(nodes_created++);
-  // Assert we allocated space for input array already
-  assert( _in[6] == this, "Must pass arg count to 'new'" );
   assert( is_not_dead(n0), "can not use dead node");
   assert( is_not_dead(n1), "can not use dead node");
   assert( is_not_dead(n2), "can not use dead node");
diff --git a/hotspot/src/share/vm/opto/node.hpp b/hotspot/src/share/vm/opto/node.hpp
index e368e62..658b54f 100644
--- a/hotspot/src/share/vm/opto/node.hpp
+++ b/hotspot/src/share/vm/opto/node.hpp
@@ -217,9 +217,6 @@
   inline void* operator new(size_t x) throw() {
     Compile* C = Compile::current();
     Node* n = (Node*)C->node_arena()->Amalloc_D(x);
-#ifdef ASSERT
-    n->_in = (Node**)n; // magic cookie for assertion check
-#endif
     return (void*)n;
   }
 
diff --git a/hotspot/src/share/vm/opto/optoreg.hpp b/hotspot/src/share/vm/opto/optoreg.hpp
index 53f5afe..3ec88f08 100644
--- a/hotspot/src/share/vm/opto/optoreg.hpp
+++ b/hotspot/src/share/vm/opto/optoreg.hpp
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2006, 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2006, 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
@@ -25,23 +25,11 @@
 #ifndef SHARE_VM_OPTO_OPTOREG_HPP
 #define SHARE_VM_OPTO_OPTOREG_HPP
 
+#include "utilities/macros.hpp"
+
 // AdGlobals contains c2 specific register handling code as specified
 // in the .ad files.
-#if defined ADGLOBALS_MD_HPP
-# include ADGLOBALS_MD_HPP
-#elif defined TARGET_ARCH_MODEL_x86_32
-# include "adfiles/adGlobals_x86_32.hpp"
-#elif defined TARGET_ARCH_MODEL_x86_64
-# include "adfiles/adGlobals_x86_64.hpp"
-#elif defined TARGET_ARCH_MODEL_sparc
-# include "adfiles/adGlobals_sparc.hpp"
-#elif defined TARGET_ARCH_MODEL_zero
-# include "adfiles/adGlobals_zero.hpp"
-#elif defined TARGET_ARCH_MODEL_ppc_64
-# include "adfiles/adGlobals_ppc_64.hpp"
-#elif defined TARGET_ARCH_MODEL_aarch64
-# include "adfiles/adGlobals_aarch64.hpp"
-#endif
+#include CPU_HEADER(adfiles/adGlobals)
 
 //------------------------------OptoReg----------------------------------------
 // We eventually need Registers for the Real World.  Registers are essentially
diff --git a/hotspot/src/share/vm/opto/output.cpp b/hotspot/src/share/vm/opto/output.cpp
index 39f4abd..312bbf8 100644
--- a/hotspot/src/share/vm/opto/output.cpp
+++ b/hotspot/src/share/vm/opto/output.cpp
@@ -952,7 +952,7 @@
   // Set the initially allocated size
   int  code_req   = initial_code_capacity;
   int  locs_req   = initial_locs_capacity;
-  int  stub_req   = TraceJumps ? initial_stub_capacity * 10 : initial_stub_capacity;
+  int  stub_req   = initial_stub_capacity;
   int  const_req  = initial_const_capacity;
 
   int  pad_req    = NativeCall::instruction_size;
diff --git a/hotspot/src/share/vm/opto/runtime.cpp b/hotspot/src/share/vm/opto/runtime.cpp
index 53db5ec..3626009 100644
--- a/hotspot/src/share/vm/opto/runtime.cpp
+++ b/hotspot/src/share/vm/opto/runtime.cpp
@@ -59,6 +59,7 @@
 #include "opto/mulnode.hpp"
 #include "opto/runtime.hpp"
 #include "opto/subnode.hpp"
+#include "prims/jvmtiThreadState.hpp"
 #include "runtime/atomic.inline.hpp"
 #include "runtime/fprofiler.hpp"
 #include "runtime/handles.inline.hpp"
@@ -1451,6 +1452,11 @@
   }
 #endif
 
+  JvmtiThreadState *state = thread->jvmti_thread_state();
+  if (state != NULL) {
+    state->set_exception_detected();
+  }
+
   thread->set_vm_result(exception);
   // Frame not compiled (handles deoptimization blob)
   return SharedRuntime::raw_exception_handler_for_return_address(thread, ret_pc);
diff --git a/hotspot/src/share/vm/opto/type.hpp b/hotspot/src/share/vm/opto/type.hpp
index 4c79e90..07b91cb 100644
--- a/hotspot/src/share/vm/opto/type.hpp
+++ b/hotspot/src/share/vm/opto/type.hpp
@@ -936,7 +936,7 @@
 };
 
 //------------------------------TypeOopPtr-------------------------------------
-// Some kind of oop (Java pointer), either klass or instance or array.
+// Some kind of oop (Java pointer), either instance or array.
 class TypeOopPtr : public TypePtr {
 protected:
   TypeOopPtr(TYPES t, PTR ptr, ciKlass* k, bool xk, ciObject* o, int offset, int instance_id,
diff --git a/hotspot/src/share/vm/prims/jni_md.h b/hotspot/src/share/vm/prims/jni_md.h
index 3bd4e31..6a078ed 100644
--- a/hotspot/src/share/vm/prims/jni_md.h
+++ b/hotspot/src/share/vm/prims/jni_md.h
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1997, 2011, 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
@@ -23,26 +23,10 @@
  * questions.
  */
 
-/* Switch to the correct jni_md.h file without reliance on -I options. */
-#ifdef TARGET_ARCH_x86
-# include "jni_x86.h"
-#endif
-#ifdef TARGET_ARCH_sparc
-# include "jni_sparc.h"
-#endif
-#ifdef TARGET_ARCH_zero
-# include "jni_zero.h"
-#endif
-#ifdef TARGET_ARCH_arm
-# include "jni_arm.h"
-#endif
-#ifdef TARGET_ARCH_ppc
-# include "jni_ppc.h"
-#endif
-#ifdef TARGET_ARCH_aarch64
-# include "jni_aarch64.h"
-#endif
+#include "utilities/macros.hpp"
 
+/* Switch to the correct jni_md.h file without reliance on -I options. */
+#include CPU_HEADER_H(jni)
 
 /*
   The local copies of JNI header files may be refreshed
diff --git a/hotspot/src/share/vm/prims/jvm.cpp b/hotspot/src/share/vm/prims/jvm.cpp
index 4da3a64..79c450b 100644
--- a/hotspot/src/share/vm/prims/jvm.cpp
+++ b/hotspot/src/share/vm/prims/jvm.cpp
@@ -84,21 +84,6 @@
 #include "classfile/sharedClassUtil.hpp"
 #include "classfile/systemDictionaryShared.hpp"
 #endif
-#ifdef TARGET_OS_FAMILY_linux
-# include "jvm_linux.h"
-#endif
-#ifdef TARGET_OS_FAMILY_solaris
-# include "jvm_solaris.h"
-#endif
-#ifdef TARGET_OS_FAMILY_windows
-# include "jvm_windows.h"
-#endif
-#ifdef TARGET_OS_FAMILY_aix
-# include "jvm_aix.h"
-#endif
-#ifdef TARGET_OS_FAMILY_bsd
-# include "jvm_bsd.h"
-#endif
 
 #include <errno.h>
 
@@ -695,7 +680,7 @@
       // This can safepoint and redefine method, so need both new_obj and method
       // in a handle, for two different reasons.  new_obj can move, method can be
       // deleted if nothing is using it on the stack.
-      m->method_holder()->add_member_name(new_obj(), false);
+      m->method_holder()->add_member_name(new_obj());
     }
   }
 
diff --git a/hotspot/src/share/vm/prims/jvm.h b/hotspot/src/share/vm/prims/jvm.h
index 5a05599..58a8fbf 100644
--- a/hotspot/src/share/vm/prims/jvm.h
+++ b/hotspot/src/share/vm/prims/jvm.h
@@ -26,21 +26,9 @@
 #define SHARE_VM_PRIMS_JVM_H
 
 #include "prims/jni.h"
-#ifdef TARGET_OS_FAMILY_linux
-# include "jvm_linux.h"
-#endif
-#ifdef TARGET_OS_FAMILY_solaris
-# include "jvm_solaris.h"
-#endif
-#ifdef TARGET_OS_FAMILY_windows
-# include "jvm_windows.h"
-#endif
-#ifdef TARGET_OS_FAMILY_aix
-# include "jvm_aix.h"
-#endif
-#ifdef TARGET_OS_FAMILY_bsd
-# include "jvm_bsd.h"
-#endif
+#include "utilities/macros.hpp"
+
+#include OS_HEADER_H(jvm)
 
 #ifndef _JAVASOFT_JVM_H_
 #define _JAVASOFT_JVM_H_
diff --git a/hotspot/src/share/vm/prims/methodHandles.cpp b/hotspot/src/share/vm/prims/methodHandles.cpp
index f91cf0d..d21c0fa 100644
--- a/hotspot/src/share/vm/prims/methodHandles.cpp
+++ b/hotspot/src/share/vm/prims/methodHandles.cpp
@@ -178,7 +178,7 @@
   return NULL;
 }
 
-oop MethodHandles::init_method_MemberName(Handle mname, CallInfo& info, bool intern) {
+oop MethodHandles::init_method_MemberName(Handle mname, CallInfo& info) {
   assert(info.resolved_appendix().is_null(), "only normal methods here");
   methodHandle m = info.resolved_method();
   assert(m.not_null(), "null method handle");
@@ -279,7 +279,13 @@
   // If relevant, the vtable or itable value is stored as vmindex.
   // This is done eagerly, since it is readily available without
   // constructing any new objects.
-  return m->method_holder()->add_member_name(mname, intern);
+  // TO DO: maybe intern mname_oop
+  if (m->method_holder()->add_member_name(mname)) {
+    return mname();
+  } else {
+    // Redefinition caused this to fail.  Return NULL (and an exception?)
+    return NULL;
+  }
 }
 
 oop MethodHandles::init_field_MemberName(Handle mname, fieldDescriptor& fd, bool is_setter) {
@@ -969,9 +975,7 @@
         if (!java_lang_invoke_MemberName::is_instance(result()))
           return -99;  // caller bug!
         CallInfo info(m);
-        // Since this is going through the methods to create MemberNames, don't search
-        // for matching methods already in the table
-        oop saved = MethodHandles::init_method_MemberName(result, info, /*intern*/false);
+        oop saved = MethodHandles::init_method_MemberName(result, info);
         if (saved != result())
           results->obj_at_put(rfill-1, saved);  // show saved instance to user
       } else if (++overflow >= overflow_limit) {
@@ -1052,34 +1056,9 @@
   }
 }
 
-oop MemberNameTable::add_member_name(jweak mem_name_wref) {
+void MemberNameTable::add_member_name(jweak mem_name_wref) {
   assert_locked_or_safepoint(MemberNameTable_lock);
   this->push(mem_name_wref);
-  return JNIHandles::resolve(mem_name_wref);
-}
-
-oop MemberNameTable::find_or_add_member_name(jweak mem_name_wref) {
-  assert_locked_or_safepoint(MemberNameTable_lock);
-  oop new_mem_name = JNIHandles::resolve(mem_name_wref);
-
-  // Find matching member name in the list.
-  // This is linear because these because these are short lists.
-  int len = this->length();
-  int new_index = len;
-  for (int idx = 0; idx < len; idx++) {
-    oop mname = JNIHandles::resolve(this->at(idx));
-    if (mname == NULL) {
-      new_index = idx;
-      continue;
-    }
-    if (java_lang_invoke_MemberName::equals(new_mem_name, mname)) {
-      JNIHandles::destroy_weak_global(mem_name_wref);
-      return mname;
-    }
-  }
-  // Not found, push the new one, or reuse empty slot
-  this->at_put_grow(new_index, mem_name_wref);
-  return new_mem_name;
 }
 
 #if INCLUDE_JVMTI
diff --git a/hotspot/src/share/vm/prims/methodHandles.hpp b/hotspot/src/share/vm/prims/methodHandles.hpp
index b6bc97e..4a82546 100644
--- a/hotspot/src/share/vm/prims/methodHandles.hpp
+++ b/hotspot/src/share/vm/prims/methodHandles.hpp
@@ -30,13 +30,13 @@
 #include "runtime/frame.inline.hpp"
 #include "runtime/globals.hpp"
 #include "runtime/interfaceSupport.hpp"
+#include "utilities/macros.hpp"
 
-#ifdef TARGET_ARCH_zero
+#ifdef ZERO
 # include "entry_zero.hpp"
 #endif
 
 
-
 class MacroAssembler;
 class Label;
 
@@ -66,7 +66,7 @@
   static Handle new_MemberName(TRAPS);  // must be followed by init_MemberName
   static oop init_MemberName(Handle mname_h, Handle target_h); // compute vmtarget/vmindex from target
   static oop init_field_MemberName(Handle mname_h, fieldDescriptor& fd, bool is_setter = false);
-  static oop init_method_MemberName(Handle mname_h, CallInfo& info, bool intern = true);
+  static oop init_method_MemberName(Handle mname_h, CallInfo& info);
   static int method_ref_kind(Method* m, bool do_dispatch_if_possible = true);
   static int find_MemberNames(KlassHandle k, Symbol* name, Symbol* sig,
                               int mflags, KlassHandle caller,
@@ -192,25 +192,7 @@
             ref_kind == JVM_REF_invokeInterface);
   }
 
-
-#ifdef TARGET_ARCH_x86
-# include "methodHandles_x86.hpp"
-#endif
-#ifdef TARGET_ARCH_sparc
-# include "methodHandles_sparc.hpp"
-#endif
-#ifdef TARGET_ARCH_zero
-# include "methodHandles_zero.hpp"
-#endif
-#ifdef TARGET_ARCH_arm
-# include "methodHandles_arm.hpp"
-#endif
-#ifdef TARGET_ARCH_ppc
-# include "methodHandles_ppc.hpp"
-#endif
-#ifdef TARGET_ARCH_aarch64
-# include "methodHandles_aarch64.hpp"
-#endif
+#include CPU_HEADER(methodHandles)
 
   // Tracing
   static void trace_method_handle(MacroAssembler* _masm, const char* adaptername) PRODUCT_RETURN;
@@ -253,8 +235,7 @@
  public:
   MemberNameTable(int methods_cnt);
   ~MemberNameTable();
-  oop add_member_name(jweak mem_name_ref);
-  oop find_or_add_member_name(jweak mem_name_ref);
+  void add_member_name(jweak mem_name_ref);
 
 #if INCLUDE_JVMTI
   // RedefineClasses() API support:
diff --git a/hotspot/src/share/vm/prims/stackwalk.cpp b/hotspot/src/share/vm/prims/stackwalk.cpp
index 70f46f7..3cce63b 100644
--- a/hotspot/src/share/vm/prims/stackwalk.cpp
+++ b/hotspot/src/share/vm/prims/stackwalk.cpp
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2015, 2016 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
diff --git a/hotspot/src/share/vm/prims/stackwalk.hpp b/hotspot/src/share/vm/prims/stackwalk.hpp
index e222e62..cbc4405 100644
--- a/hotspot/src/share/vm/prims/stackwalk.hpp
+++ b/hotspot/src/share/vm/prims/stackwalk.hpp
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2015, 2016 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
diff --git a/hotspot/src/share/vm/prims/whitebox.cpp b/hotspot/src/share/vm/prims/whitebox.cpp
index e1a83af..6a6389d 100644
--- a/hotspot/src/share/vm/prims/whitebox.cpp
+++ b/hotspot/src/share/vm/prims/whitebox.cpp
@@ -350,6 +350,11 @@
   return (jlong)alignment;
 WB_END
 
+WB_ENTRY(jlong, WB_GetHeapAlignment(JNIEnv* env, jobject o))
+  size_t alignment = Universe::heap()->collector_policy()->heap_alignment();
+  return (jlong)alignment;
+WB_END
+
 #if INCLUDE_ALL_GCS
 WB_ENTRY(jboolean, WB_G1IsHumongous(JNIEnv* env, jobject o, jobject obj))
   G1CollectedHeap* g1 = G1CollectedHeap::heap();
@@ -401,14 +406,21 @@
 WB_END
 
 WB_ENTRY(jlong, WB_PSVirtualSpaceAlignment(JNIEnv* env, jobject o))
-  ParallelScavengeHeap* ps = ParallelScavengeHeap::heap();
-  size_t alignment = ps->gens()->virtual_spaces()->alignment();
-  return (jlong)alignment;
+#if INCLUDE_ALL_GCS
+  if (UseParallelGC) {
+    return ParallelScavengeHeap::heap()->gens()->virtual_spaces()->alignment();
+  }
+#endif // INCLUDE_ALL_GCS
+  THROW_MSG_0(vmSymbols::java_lang_RuntimeException(), "WB_PSVirtualSpaceAlignment: Parallel GC is not enabled");
 WB_END
 
 WB_ENTRY(jlong, WB_PSHeapGenerationAlignment(JNIEnv* env, jobject o))
-  size_t alignment = ParallelScavengeHeap::heap()->generation_alignment();
-  return (jlong)alignment;
+#if INCLUDE_ALL_GCS
+  if (UseParallelGC) {
+    return ParallelScavengeHeap::heap()->generation_alignment();
+  }
+#endif // INCLUDE_ALL_GCS
+  THROW_MSG_0(vmSymbols::java_lang_RuntimeException(), "WB_PSHeapGenerationAlignment: Parallel GC is not enabled");
 WB_END
 
 WB_ENTRY(jobject, WB_G1AuxiliaryMemoryUsage(JNIEnv* env))
@@ -1693,6 +1705,7 @@
   {CC"getVMAllocationGranularity",       CC"()J",                   (void*)&WB_GetVMAllocationGranularity },
   {CC"getVMLargePageSize",               CC"()J",                   (void*)&WB_GetVMLargePageSize},
   {CC"getHeapSpaceAlignment",            CC"()J",                   (void*)&WB_GetHeapSpaceAlignment},
+  {CC"getHeapAlignment",                 CC"()J",                   (void*)&WB_GetHeapAlignment},
   {CC"isClassAlive0",                    CC"(Ljava/lang/String;)Z", (void*)&WB_IsClassAlive      },
   {CC"parseCommandLine0",
       CC"(Ljava/lang/String;C[Lsun/hotspot/parser/DiagnosticCommand;)[Ljava/lang/Object;",
diff --git a/hotspot/src/share/vm/runtime/arguments.cpp b/hotspot/src/share/vm/runtime/arguments.cpp
index a9e944e..45d1de2 100644
--- a/hotspot/src/share/vm/runtime/arguments.cpp
+++ b/hotspot/src/share/vm/runtime/arguments.cpp
@@ -85,7 +85,6 @@
 const char*  Arguments::_sun_java_launcher      = DEFAULT_JAVA_LAUNCHER;
 int    Arguments::_sun_java_launcher_pid        = -1;
 bool   Arguments::_sun_java_launcher_is_altjvm  = false;
-int    Arguments::_bootclassloader_append_index = -1;
 
 // These parameters are reset in method parse_vm_init_args()
 bool   Arguments::_AlwaysCompileLoopMethods     = AlwaysCompileLoopMethods;
@@ -113,6 +112,7 @@
 
 GrowableArray<ModuleXPatchPath*> *Arguments::_xpatchprefix = NULL;
 PathString *Arguments::_system_boot_class_path = NULL;
+bool Arguments::_has_jimage = false;
 
 char* Arguments::_ext_dirs = NULL;
 
@@ -1305,6 +1305,11 @@
     }
     sp = sp->next();
   }
+
+  // Check for an exploded module build in use with -Xshare:dump.
+  if (!has_jimage()) {
+    vm_exit_during_initialization("Dumping the shared archive is not supported with an exploded module build");
+  }
 }
 #endif
 
@@ -1779,11 +1784,7 @@
     if (should_auto_select_low_pause_collector()) {
       FLAG_SET_ERGO_IF_DEFAULT(bool, UseConcMarkSweepGC, true);
     } else {
-#if defined(JAVASE_EMBEDDED)
-      FLAG_SET_ERGO_IF_DEFAULT(bool, UseParallelGC, true);
-#else
       FLAG_SET_ERGO_IF_DEFAULT(bool, UseG1GC, true);
-#endif
     }
   } else {
     FLAG_SET_ERGO_IF_DEFAULT(bool, UseSerialGC, true);
@@ -2276,11 +2277,7 @@
 #if INCLUDE_JVMCI
 // Check consistency of jvmci vm argument settings.
 bool Arguments::check_jvmci_args_consistency() {
-  if (!EnableJVMCI && !JVMCIGlobals::check_jvmci_flags_are_consistent()) {
-    JVMCIGlobals::print_jvmci_args_inconsistency_error_message();
-    return false;
-  }
-  return true;
+   return JVMCIGlobals::check_jvmci_flags_are_consistent();
 }
 #endif //INCLUDE_JVMCI
 
@@ -2676,7 +2673,6 @@
         return JNI_EINVAL;
     // -bootclasspath/a:
     } else if (match_option(option, "-Xbootclasspath/a:", &tail)) {
-      Arguments::set_bootclassloader_append_index((int)strlen(Arguments::get_sysclasspath())+1);
       Arguments::append_sysclasspath(tail);
     // -bootclasspath/p:
     } else if (match_option(option, "-Xbootclasspath/p:", &tail)) {
@@ -3323,18 +3319,6 @@
   _xpatchprefix->push(new ModuleXPatchPath(module_name, path));
 }
 
-// Set property jdk.boot.class.path.append to the contents of the bootclasspath
-// that follows either the jimage file or exploded module directories.  The
-// property will contain -Xbootclasspath/a and/or jvmti appended additions.
-void Arguments::set_jdkbootclasspath_append() {
-  char *sysclasspath = get_sysclasspath();
-  assert(sysclasspath != NULL, "NULL sysclasspath");
-  int bcp_a_idx = bootclassloader_append_index();
-  if (bcp_a_idx != -1 && bcp_a_idx < (int)strlen(sysclasspath)) {
-    _jdk_boot_class_path_append->set_value(sysclasspath + bcp_a_idx);
-  }
-}
-
 // Remove all empty paths from the app classpath (if IgnoreEmptyClassPaths is enabled)
 //
 // This is necessary because some apps like to specify classpath like -cp foo.jar:${XYZ}:bar.jar
@@ -3457,8 +3441,6 @@
     return JNI_ERR;
   }
 
-  Arguments::set_bootclassloader_append_index(((int)strlen(Arguments::get_sysclasspath()))+1);
-
   // This must be done after all arguments have been processed.
   // java_compiler() true means set to "NONE" or empty.
   if (java_compiler() && !xdebug_mode()) {
diff --git a/hotspot/src/share/vm/runtime/arguments.hpp b/hotspot/src/share/vm/runtime/arguments.hpp
index 8c8399d..e72c492 100644
--- a/hotspot/src/share/vm/runtime/arguments.hpp
+++ b/hotspot/src/share/vm/runtime/arguments.hpp
@@ -363,6 +363,9 @@
   // -Xbootclasspath/p was supported.
   static PathString *_system_boot_class_path;
 
+  // Set if a modular java runtime image is present vs. a build with exploded modules
+  static bool _has_jimage;
+
   // temporary: to emit warning if the default ext dirs are not empty.
   // remove this variable when the warning is no longer needed.
   static char* _ext_dirs;
@@ -411,11 +414,6 @@
   static void set_java_compiler(bool arg) { _java_compiler = arg; }
   static bool java_compiler()   { return _java_compiler; }
 
-  // Capture the index location of -Xbootclasspath\a within sysclasspath.
-  // Used when setting up the bootstrap search path in order to
-  // mark the boot loader's append path observability boundary.
-  static int _bootclassloader_append_index;
-
   // -Xdebug flag
   static bool _xdebug_mode;
   static void set_xdebug_mode(bool arg) { _xdebug_mode = arg; }
@@ -669,17 +667,6 @@
   static size_t min_heap_size()             { return _min_heap_size; }
   static void  set_min_heap_size(size_t v)  { _min_heap_size = v;  }
 
-  // -Xbootclasspath/a
-  static int  bootclassloader_append_index() {
-    return _bootclassloader_append_index;
-  }
-  static void set_bootclassloader_append_index(int value) {
-    // Set only if the index has not been set yet
-    if (_bootclassloader_append_index == -1) {
-      _bootclassloader_append_index = value;
-    }
-  }
-
   // -Xrun
   static AgentLibrary* libraries()          { return _libraryList.first(); }
   static bool init_libraries_at_startup()   { return !_libraryList.is_empty(); }
@@ -739,19 +726,21 @@
 
   // Set up the underlying pieces of the system boot class path
   static void add_xpatchprefix(const char *module_name, const char *path, bool* xpatch_javabase);
-  static void set_sysclasspath(const char *value) {
+  static void set_sysclasspath(const char *value, bool has_jimage) {
+    // During start up, set by os::set_boot_path()
+    assert(get_sysclasspath() == NULL, "System boot class path previously set");
     _system_boot_class_path->set_value(value);
-    set_jdkbootclasspath_append();
+    _has_jimage = has_jimage;
   }
   static void append_sysclasspath(const char *value) {
     _system_boot_class_path->append_value(value);
-    set_jdkbootclasspath_append();
+    _jdk_boot_class_path_append->append_value(value);
   }
-  static void set_jdkbootclasspath_append();
 
   static GrowableArray<ModuleXPatchPath*>* get_xpatchprefix() { return _xpatchprefix; }
   static char* get_sysclasspath() { return _system_boot_class_path->value(); }
   static char* get_jdk_boot_class_path_append() { return _jdk_boot_class_path_append->value(); }
+  static bool has_jimage() { return _has_jimage; }
 
   static char* get_java_home()    { return _java_home->value(); }
   static char* get_dll_dir()      { return _sun_boot_library_path->value(); }
diff --git a/hotspot/src/share/vm/runtime/atomic.inline.hpp b/hotspot/src/share/vm/runtime/atomic.inline.hpp
index 8abc729..690be7d 100644
--- a/hotspot/src/share/vm/runtime/atomic.inline.hpp
+++ b/hotspot/src/share/vm/runtime/atomic.inline.hpp
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2012, 2014, 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
@@ -26,52 +26,9 @@
 #define SHARE_VM_RUNTIME_ATOMIC_INLINE_HPP
 
 #include "runtime/atomic.hpp"
+#include "utilities/macros.hpp"
 
-// Linux
-#ifdef TARGET_OS_ARCH_linux_x86
-# include "atomic_linux_x86.inline.hpp"
-#endif
-#ifdef TARGET_OS_ARCH_linux_sparc
-# include "atomic_linux_sparc.inline.hpp"
-#endif
-#ifdef TARGET_OS_ARCH_linux_zero
-# include "atomic_linux_zero.inline.hpp"
-#endif
-#ifdef TARGET_OS_ARCH_linux_arm
-# include "atomic_linux_arm.inline.hpp"
-#endif
-#ifdef TARGET_OS_ARCH_linux_ppc
-# include "atomic_linux_ppc.inline.hpp"
-#endif
-#ifdef TARGET_OS_ARCH_linux_aarch64
-# include "atomic_linux_aarch64.inline.hpp"
-#endif
-
-// Solaris
-#ifdef TARGET_OS_ARCH_solaris_x86
-# include "atomic_solaris_x86.inline.hpp"
-#endif
-#ifdef TARGET_OS_ARCH_solaris_sparc
-# include "atomic_solaris_sparc.inline.hpp"
-#endif
-
-// Windows
-#ifdef TARGET_OS_ARCH_windows_x86
-# include "atomic_windows_x86.inline.hpp"
-#endif
-
-// AIX
-#ifdef TARGET_OS_ARCH_aix_ppc
-# include "atomic_aix_ppc.inline.hpp"
-#endif
-
-// BSD
-#ifdef TARGET_OS_ARCH_bsd_x86
-# include "atomic_bsd_x86.inline.hpp"
-#endif
-#ifdef TARGET_OS_ARCH_bsd_zero
-# include "atomic_bsd_zero.inline.hpp"
-#endif
+#include OS_CPU_HEADER_INLINE(atomic)
 
 // size_t casts...
 #if (SIZE_MAX != UINTPTR_MAX)
diff --git a/hotspot/src/share/vm/runtime/frame.hpp b/hotspot/src/share/vm/runtime/frame.hpp
index b71585a..d3974d7 100644
--- a/hotspot/src/share/vm/runtime/frame.hpp
+++ b/hotspot/src/share/vm/runtime/frame.hpp
@@ -29,7 +29,8 @@
 #include "runtime/basicLock.hpp"
 #include "runtime/monitorChunk.hpp"
 #include "runtime/registerMap.hpp"
-#ifdef TARGET_ARCH_zero
+#include "utilities/macros.hpp"
+#ifdef ZERO
 # include "stack_zero.hpp"
 #endif
 
@@ -415,24 +416,7 @@
 
   int pd_oop_map_offset_adjustment() const;
 
-#ifdef TARGET_ARCH_x86
-# include "frame_x86.hpp"
-#endif
-#ifdef TARGET_ARCH_sparc
-# include "frame_sparc.hpp"
-#endif
-#ifdef TARGET_ARCH_zero
-# include "frame_zero.hpp"
-#endif
-#ifdef TARGET_ARCH_arm
-# include "frame_arm.hpp"
-#endif
-#ifdef TARGET_ARCH_ppc
-# include "frame_ppc.hpp"
-#endif
-#ifdef TARGET_ARCH_aarch64
-# include "frame_aarch64.hpp"
-#endif
+#include CPU_HEADER(frame)
 
 };
 
diff --git a/hotspot/src/share/vm/runtime/frame.inline.hpp b/hotspot/src/share/vm/runtime/frame.inline.hpp
index 79ba0f9..1ac6302 100644
--- a/hotspot/src/share/vm/runtime/frame.inline.hpp
+++ b/hotspot/src/share/vm/runtime/frame.inline.hpp
@@ -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
@@ -31,13 +31,16 @@
 #include "oops/method.hpp"
 #include "runtime/frame.hpp"
 #include "runtime/signature.hpp"
-#ifdef TARGET_ARCH_zero
+#include "utilities/macros.hpp"
+#ifdef ZERO
 # include "entryFrame_zero.hpp"
 # include "fakeStubFrame_zero.hpp"
 # include "interpreterFrame_zero.hpp"
 # include "sharkFrame_zero.hpp"
 #endif
 
+#include CPU_HEADER_INLINE(frame)
+
 inline bool frame::is_entry_frame() const {
   return StubRoutines::returns_to_call_stub(pc());
 }
@@ -50,26 +53,4 @@
   return is_entry_frame() && entry_frame_is_first();
 }
 
-// here are the platform-dependent bodies:
-
-#ifdef TARGET_ARCH_x86
-# include "frame_x86.inline.hpp"
-#endif
-#ifdef TARGET_ARCH_sparc
-# include "frame_sparc.inline.hpp"
-#endif
-#ifdef TARGET_ARCH_zero
-# include "frame_zero.inline.hpp"
-#endif
-#ifdef TARGET_ARCH_arm
-# include "frame_arm.inline.hpp"
-#endif
-#ifdef TARGET_ARCH_ppc
-# include "frame_ppc.inline.hpp"
-#endif
-#ifdef TARGET_ARCH_aarch64
-# include "frame_aarch64.inline.hpp"
-#endif
-
-
 #endif // SHARE_VM_RUNTIME_FRAME_INLINE_HPP
diff --git a/hotspot/src/share/vm/runtime/globals.cpp b/hotspot/src/share/vm/runtime/globals.cpp
index c878da3..b0a0d79 100644
--- a/hotspot/src/share/vm/runtime/globals.cpp
+++ b/hotspot/src/share/vm/runtime/globals.cpp
@@ -334,7 +334,8 @@
 
 void Flag::set_origin(Flags origin) {
   assert((origin & VALUE_ORIGIN_MASK) == origin, "sanity");
-  _flags = Flags((_flags & ~VALUE_ORIGIN_MASK) | origin);
+  Flags new_origin = Flags((origin == COMMAND_LINE) ? Flags(origin | ORIG_COMMAND_LINE) : origin);
+  _flags = Flags((_flags & ~VALUE_ORIGIN_MASK) | new_origin);
 }
 
 bool Flag::is_default() {
@@ -346,7 +347,11 @@
 }
 
 bool Flag::is_command_line() {
-  return (get_origin() == COMMAND_LINE);
+  return (_flags & ORIG_COMMAND_LINE) != 0;
+}
+
+void Flag::set_command_line() {
+  _flags = Flags(_flags | ORIG_COMMAND_LINE);
 }
 
 bool Flag::is_product() const {
@@ -464,25 +469,31 @@
   }
 
   if (!printRanges) {
-
-    st->print("%9s %-40s %c= ", _type, _name, (!is_default() ? ':' : ' '));
+    // The print below assumes that the flag name is 40 characters or less.
+    // This works for most flags, but there are exceptions. Our longest flag
+    // name right now is UseAdaptiveGenerationSizePolicyAtMajorCollection and
+    // its minor collection buddy. These are 48 characters. We use a buffer of
+    // 10 spaces below to adjust the space between the flag value and the
+    // column of flag type and origin that is printed in the end of the line.
+    char spaces[10 + 1] = "          ";
+    st->print("%9s %-40s = ", _type, _name);
 
     if (is_bool()) {
-      st->print("%-16s", get_bool() ? "true" : "false");
+      st->print("%-20s", get_bool() ? "true" : "false");
     } else if (is_int()) {
-      st->print("%-16d", get_int());
+      st->print("%-20d", get_int());
     } else if (is_uint()) {
-      st->print("%-16u", get_uint());
+      st->print("%-20u", get_uint());
     } else if (is_intx()) {
-      st->print(INTX_FORMAT_W(-16), get_intx());
+      st->print(INTX_FORMAT_W(-20), get_intx());
     } else if (is_uintx()) {
-      st->print(UINTX_FORMAT_W(-16), get_uintx());
+      st->print(UINTX_FORMAT_W(-20), get_uintx());
     } else if (is_uint64_t()) {
-      st->print(UINT64_FORMAT_W(-16), get_uint64_t());
+      st->print(UINT64_FORMAT_W(-20), get_uint64_t());
     } else if (is_size_t()) {
-      st->print(SIZE_FORMAT_W(-16), get_size_t());
+      st->print(SIZE_FORMAT_W(-20), get_size_t());
     } else if (is_double()) {
-      st->print("%-16f", get_double());
+      st->print("%-20f", get_double());
     } else if (is_ccstr()) {
       const char* cp = get_ccstr();
       if (cp != NULL) {
@@ -494,13 +505,14 @@
           cp = eol+1;
           st->print("%5s %-35s += ", "", _name);
         }
-        st->print("%-16s", cp);
+        st->print("%-20s", cp);
       }
-      else st->print("%-16s", "");
+      else st->print("%-20s", "");
     }
-
-    st->print("%-20s", " ");
-    print_kind(st);
+    assert(strlen(_name) < 50, "Flag name is longer than expected");
+    spaces[50 - MAX2((size_t)40, strlen(_name))] = '\0';
+    st->print("%s", spaces);
+    print_kind_and_origin(st);
 
 #ifndef PRODUCT
     if (withComments) {
@@ -533,8 +545,8 @@
     }
     CommandLineFlagRangeList::print(st, _name, func);
 
-    st->print(" %-20s", " ");
-    print_kind(st);
+    st->print(" %-16s", " ");
+    print_kind_and_origin(st);
 
 #ifndef PRODUCT
     if (withComments) {
@@ -546,7 +558,7 @@
   }
 }
 
-void Flag::print_kind(outputStream* st) {
+void Flag::print_kind_and_origin(outputStream* st) {
   struct Data {
     int flag;
     const char* name;
@@ -572,23 +584,58 @@
   };
 
   if ((_flags & KIND_MASK) != 0) {
-    st->print("{");
     bool is_first = true;
+    const size_t buffer_size = 64;
+    size_t buffer_used = 0;
+    char kind[buffer_size];
 
+    jio_snprintf(kind, buffer_size, "{");
+    buffer_used++;
     for (int i = 0; data[i].flag != -1; i++) {
       Data d = data[i];
       if ((_flags & d.flag) != 0) {
         if (is_first) {
           is_first = false;
         } else {
-          st->print(" ");
+          assert(buffer_used + 1 < buffer_size, "Too small buffer");
+          jio_snprintf(kind + buffer_used, buffer_size - buffer_used, " ");
+          buffer_used++;
         }
-        st->print("%s", d.name);
+        size_t length = strlen(d.name);
+        assert(buffer_used + length < buffer_size, "Too small buffer");
+        jio_snprintf(kind + buffer_used, buffer_size - buffer_used, "%s", d.name);
+        buffer_used += length;
       }
     }
-
-    st->print("}");
+    assert(buffer_used + 2 <= buffer_size, "Too small buffer");
+    jio_snprintf(kind + buffer_used, buffer_size - buffer_used, "}");
+    st->print("%20s", kind);
   }
+
+  int origin = _flags & VALUE_ORIGIN_MASK;
+  st->print(" {");
+  switch(origin) {
+    case DEFAULT:
+      st->print("default"); break;
+    case COMMAND_LINE:
+      st->print("command line"); break;
+    case ENVIRON_VAR:
+      st->print("environment"); break;
+    case CONFIG_FILE:
+      st->print("config file"); break;
+    case MANAGEMENT:
+      st->print("management"); break;
+    case ERGONOMIC:
+      if (_flags & ORIG_COMMAND_LINE) {
+        st->print("command line, ");
+      }
+      st->print("ergonomic"); break;
+    case ATTACH_ON_DEMAND:
+      st->print("attach"); break;
+    case INTERNAL:
+      st->print("internal"); break;
+  }
+  st->print("}");
 }
 
 void Flag::print_as_flag(outputStream* st) {
@@ -918,6 +965,12 @@
   return true;
 }
 
+void CommandLineFlagsEx::setOnCmdLine(CommandLineFlagWithType flag) {
+  Flag* faddr = address_of_flag(flag);
+  assert(faddr != NULL, "Unknown flag");
+  faddr->set_command_line();
+}
+
 template<class E, class T>
 static void trace_flag_changed(const char* name, const T old_value, const T new_value, const Flag::Flags origin) {
   E e;
diff --git a/hotspot/src/share/vm/runtime/globals.hpp b/hotspot/src/share/vm/runtime/globals.hpp
index e54ea9a..930c51a 100644
--- a/hotspot/src/share/vm/runtime/globals.hpp
+++ b/hotspot/src/share/vm/runtime/globals.hpp
@@ -26,6 +26,8 @@
 #define SHARE_VM_RUNTIME_GLOBALS_HPP
 
 #include "utilities/debug.hpp"
+#include "utilities/macros.hpp"
+
 #include <float.h> // for DBL_MAX
 
 // use this for flags that are true per default in the tiered build
@@ -38,141 +40,19 @@
 #define falseInTiered true
 #endif
 
-#ifdef TARGET_ARCH_x86
-# include "globals_x86.hpp"
-#endif
-#ifdef TARGET_ARCH_sparc
-# include "globals_sparc.hpp"
-#endif
-#ifdef TARGET_ARCH_zero
-# include "globals_zero.hpp"
-#endif
-#ifdef TARGET_ARCH_arm
-# include "globals_arm.hpp"
-#endif
-#ifdef TARGET_ARCH_ppc
-# include "globals_ppc.hpp"
-#endif
-#ifdef TARGET_ARCH_aarch64
-# include "globals_aarch64.hpp"
-#endif
-#ifdef TARGET_OS_FAMILY_linux
-# include "globals_linux.hpp"
-#endif
-#ifdef TARGET_OS_FAMILY_solaris
-# include "globals_solaris.hpp"
-#endif
-#ifdef TARGET_OS_FAMILY_windows
-# include "globals_windows.hpp"
-#endif
-#ifdef TARGET_OS_FAMILY_aix
-# include "globals_aix.hpp"
-#endif
-#ifdef TARGET_OS_FAMILY_bsd
-# include "globals_bsd.hpp"
-#endif
-#ifdef TARGET_OS_ARCH_linux_x86
-# include "globals_linux_x86.hpp"
-#endif
-#ifdef TARGET_OS_ARCH_linux_sparc
-# include "globals_linux_sparc.hpp"
-#endif
-#ifdef TARGET_OS_ARCH_linux_zero
-# include "globals_linux_zero.hpp"
-#endif
-#ifdef TARGET_OS_ARCH_solaris_x86
-# include "globals_solaris_x86.hpp"
-#endif
-#ifdef TARGET_OS_ARCH_solaris_sparc
-# include "globals_solaris_sparc.hpp"
-#endif
-#ifdef TARGET_OS_ARCH_windows_x86
-# include "globals_windows_x86.hpp"
-#endif
-#ifdef TARGET_OS_ARCH_linux_arm
-# include "globals_linux_arm.hpp"
-#endif
-#ifdef TARGET_OS_ARCH_linux_ppc
-# include "globals_linux_ppc.hpp"
-#endif
-#ifdef TARGET_OS_ARCH_linux_aarch64
-# include "globals_linux_aarch64.hpp"
-#endif
-#ifdef TARGET_OS_ARCH_aix_ppc
-# include "globals_aix_ppc.hpp"
-#endif
-#ifdef TARGET_OS_ARCH_bsd_x86
-# include "globals_bsd_x86.hpp"
-#endif
-#ifdef TARGET_OS_ARCH_bsd_zero
-# include "globals_bsd_zero.hpp"
-#endif
+#include CPU_HEADER(globals)
+#include OS_HEADER(globals)
+#include OS_CPU_HEADER(globals)
 #ifdef COMPILER1
-#ifdef TARGET_ARCH_x86
-# include "c1_globals_x86.hpp"
-#endif
-#ifdef TARGET_ARCH_sparc
-# include "c1_globals_sparc.hpp"
-#endif
-#ifdef TARGET_ARCH_arm
-# include "c1_globals_arm.hpp"
-#endif
-#ifdef TARGET_ARCH_aarch64
-# include "c1_globals_aarch64.hpp"
-#endif
-#ifdef TARGET_OS_FAMILY_linux
-# include "c1_globals_linux.hpp"
-#endif
-#ifdef TARGET_OS_FAMILY_solaris
-# include "c1_globals_solaris.hpp"
-#endif
-#ifdef TARGET_OS_FAMILY_windows
-# include "c1_globals_windows.hpp"
-#endif
-#ifdef TARGET_OS_FAMILY_aix
-# include "c1_globals_aix.hpp"
-#endif
-#ifdef TARGET_OS_FAMILY_bsd
-# include "c1_globals_bsd.hpp"
-#endif
-#ifdef TARGET_ARCH_ppc
-# include "c1_globals_ppc.hpp"
-#endif
+#include CPU_HEADER(c1_globals)
+#include OS_HEADER(c1_globals)
 #endif
 #ifdef COMPILER2
-#ifdef TARGET_ARCH_x86
-# include "c2_globals_x86.hpp"
-#endif
-#ifdef TARGET_ARCH_sparc
-# include "c2_globals_sparc.hpp"
-#endif
-#ifdef TARGET_ARCH_arm
-# include "c2_globals_arm.hpp"
-#endif
-#ifdef TARGET_ARCH_ppc
-# include "c2_globals_ppc.hpp"
-#endif
-#ifdef TARGET_ARCH_aarch64
-# include "c2_globals_aarch64.hpp"
-#endif
-#ifdef TARGET_OS_FAMILY_linux
-# include "c2_globals_linux.hpp"
-#endif
-#ifdef TARGET_OS_FAMILY_solaris
-# include "c2_globals_solaris.hpp"
-#endif
-#ifdef TARGET_OS_FAMILY_windows
-# include "c2_globals_windows.hpp"
-#endif
-#ifdef TARGET_OS_FAMILY_aix
-# include "c2_globals_aix.hpp"
-#endif
-#ifdef TARGET_OS_FAMILY_bsd
-# include "c2_globals_bsd.hpp"
-#endif
+#include CPU_HEADER(c2_globals)
+#include OS_HEADER(c2_globals)
 #endif
 #ifdef SHARK
-#ifdef TARGET_ARCH_zero
+#ifdef ZERO
 # include "shark_globals_zero.hpp"
 #endif
 #endif
@@ -229,7 +109,7 @@
 
 struct Flag {
   enum Flags {
-    // value origin
+    // latest value origin
     DEFAULT          = 0,
     COMMAND_LINE     = 1,
     ENVIRON_VAR      = 2,
@@ -260,7 +140,10 @@
     KIND_COMMERCIAL         = 1 << 17,
     KIND_JVMCI              = 1 << 18,
 
-    KIND_MASK = ~VALUE_ORIGIN_MASK
+    // set this bit if the flag was set on the command line
+    ORIG_COMMAND_LINE       = 1 << 19,
+
+    KIND_MASK = ~(VALUE_ORIGIN_MASK | ORIG_COMMAND_LINE)
   };
 
   enum Error {
@@ -272,7 +155,7 @@
     MISSING_VALUE,
     // error parsing the textual form of the value
     WRONG_FORMAT,
-    // flag is not writeable
+    // flag is not writable
     NON_WRITABLE,
     // flag value is outside of its bounds
     OUT_OF_BOUNDS,
@@ -367,6 +250,7 @@
   bool is_default();
   bool is_ergonomic();
   bool is_command_line();
+  void set_command_line();
 
   bool is_product() const;
   bool is_manageable() const;
@@ -396,7 +280,7 @@
 
   // printRanges will print out flags type, name and range values as expected by -XX:+PrintFlagsRanges
   void print_on(outputStream* st, bool withComments = false, bool printRanges = false);
-  void print_kind(outputStream* st);
+  void print_kind_and_origin(outputStream* st);
   void print_as_flag(outputStream* st);
 
   static const char* flag_error_str(Flag::Error error);
@@ -574,12 +458,6 @@
 #define falseInProduct true
 #endif
 
-#ifdef JAVASE_EMBEDDED
-#define falseInEmbedded false
-#else
-#define falseInEmbedded true
-#endif
-
 // develop flags are settable / visible only during development and are constant in the PRODUCT version
 // product flags are always settable / visible
 // notproduct flags are settable / visible only during development and are not declared in the PRODUCT version
@@ -708,7 +586,7 @@
   product_pd(bool, UseMembar,                                               \
           "(Unstable) Issues membars on thread state transitions")          \
                                                                             \
-  develop(bool, CleanChunkPoolAsync, falseInEmbedded,                       \
+  develop(bool, CleanChunkPoolAsync, true,                                  \
           "Clean the chunk pool asynchronously")                            \
                                                                             \
   experimental(bool, AlwaysSafeConstructors, false,                         \
@@ -802,9 +680,6 @@
   develop(bool, TracePcPatching, false,                                     \
           "Trace usage of frame::patch_pc")                                 \
                                                                             \
-  develop(bool, TraceJumps, false,                                          \
-          "Trace assembly jumps in thread ring buffer")                     \
-                                                                            \
   develop(bool, TraceRelocator, false,                                      \
           "Trace the bytecode relocator")                                   \
                                                                             \
@@ -1563,6 +1438,10 @@
           "Dynamically choose the number of parallel threads "              \
           "parallel gc will use")                                           \
                                                                             \
+  diagnostic(bool, InjectGCWorkerCreationFailure, false,                    \
+             "Inject thread creation failures for "                         \
+             "UseDynamicNumberOfGCThreads")                                 \
+                                                                            \
   diagnostic(bool, ForceDynamicNumberOfGCThreads, false,                    \
           "Force dynamic selection of the number of "                       \
           "parallel threads parallel gc will use to aid debugging")         \
@@ -3006,15 +2885,10 @@
                                                                             \
   /* notice: the max range value here is max_jint, not max_intx  */         \
   /* because of overflow issue                                   */         \
-  NOT_EMBEDDED(diagnostic(intx, GuaranteedSafepointInterval, 1000,          \
+  diagnostic(intx, GuaranteedSafepointInterval, 1000,                       \
           "Guarantee a safepoint (at least) every so many milliseconds "    \
-          "(0 means none)"))                                                \
-  NOT_EMBEDDED(range(0, max_jint))                                          \
-                                                                            \
-  EMBEDDED_ONLY(product(intx, GuaranteedSafepointInterval, 0,               \
-          "Guarantee a safepoint (at least) every so many milliseconds "    \
-          "(0 means none)"))                                                \
-  EMBEDDED_ONLY(range(0, max_jint))                                         \
+          "(0 means none)")                                                 \
+          range(0, max_jint)                                                \
                                                                             \
   product(intx, SafepointTimeoutDelay, 10000,                               \
           "Delay in milliseconds for option SafepointTimeout")              \
@@ -3916,7 +3790,7 @@
                                                                             \
   /* flags for performance data collection */                               \
                                                                             \
-  product(bool, UsePerfData, falseInEmbedded,                               \
+  product(bool, UsePerfData, true,                                          \
           "Flag to disable jvmstat instrumentation for performance testing "\
           "and problem isolation purposes")                                 \
                                                                             \
diff --git a/hotspot/src/share/vm/runtime/globals_extension.hpp b/hotspot/src/share/vm/runtime/globals_extension.hpp
index 881d3ef..f38723d 100644
--- a/hotspot/src/share/vm/runtime/globals_extension.hpp
+++ b/hotspot/src/share/vm/runtime/globals_extension.hpp
@@ -334,8 +334,9 @@
 
 #define FLAG_SET_DEFAULT(name, value) ((name) = (value))
 
-#define FLAG_SET_CMDLINE(type, name, value) (CommandLineFlagsEx::type##AtPut(FLAG_MEMBER_WITH_TYPE(name,type), (type)(value), Flag::COMMAND_LINE))
-#define FLAG_SET_ERGO(type, name, value)    (CommandLineFlagsEx::type##AtPut(FLAG_MEMBER_WITH_TYPE(name,type), (type)(value), Flag::ERGONOMIC))
+#define FLAG_SET_CMDLINE(type, name, value) (CommandLineFlagsEx::setOnCmdLine(FLAG_MEMBER_WITH_TYPE(name, type)), \
+                                             CommandLineFlagsEx::type##AtPut(FLAG_MEMBER_WITH_TYPE(name, type), (type)(value), Flag::COMMAND_LINE))
+#define FLAG_SET_ERGO(type, name, value)    (CommandLineFlagsEx::type##AtPut(FLAG_MEMBER_WITH_TYPE(name, type), (type)(value), Flag::ERGONOMIC))
 #define FLAG_SET_ERGO_IF_DEFAULT(type, name, value) \
   do {                                              \
     if (FLAG_IS_DEFAULT(name)) {                    \
@@ -361,6 +362,8 @@
   static bool is_default(CommandLineFlag flag);
   static bool is_ergo(CommandLineFlag flag);
   static bool is_cmdline(CommandLineFlag flag);
+
+  static void setOnCmdLine(CommandLineFlagWithType flag);
 };
 
 #endif // SHARE_VM_RUNTIME_GLOBALS_EXTENSION_HPP
diff --git a/hotspot/src/share/vm/runtime/icache.hpp b/hotspot/src/share/vm/runtime/icache.hpp
index 9a3b9c8..637ea13 100644
--- a/hotspot/src/share/vm/runtime/icache.hpp
+++ b/hotspot/src/share/vm/runtime/icache.hpp
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1997, 2011, 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,6 +27,7 @@
 
 #include "memory/allocation.hpp"
 #include "runtime/stubCodeGenerator.hpp"
+#include "utilities/macros.hpp"
 
 // Interface for updating the instruction cache.  Whenever the VM modifies
 // code, part of the processor instruction cache potentially has to be flushed.
@@ -68,26 +69,7 @@
 // Must be included before the definition of ICacheStubGenerator
 // because ICacheStubGenerator uses ICache definitions.
 
-#ifdef TARGET_ARCH_x86
-# include "icache_x86.hpp"
-#endif
-#ifdef TARGET_ARCH_sparc
-# include "icache_sparc.hpp"
-#endif
-#ifdef TARGET_ARCH_zero
-# include "icache_zero.hpp"
-#endif
-#ifdef TARGET_ARCH_arm
-# include "icache_arm.hpp"
-#endif
-#ifdef TARGET_ARCH_ppc
-# include "icache_ppc.hpp"
-#endif
-#ifdef TARGET_ARCH_aarch64
-# include "icache_aarch64.hpp"
-#endif
-
-
+#include CPU_HEADER(icache)
 
 class ICacheStubGenerator : public StubCodeGenerator {
  public:
diff --git a/hotspot/src/share/vm/runtime/init.cpp b/hotspot/src/share/vm/runtime/init.cpp
index b74a3da..939dae7 100644
--- a/hotspot/src/share/vm/runtime/init.cpp
+++ b/hotspot/src/share/vm/runtime/init.cpp
@@ -53,7 +53,6 @@
 void management_init();
 void bytecodes_init();
 void classLoader_init1();
-void classLoader_init2(); // note: ClassLoader need 2-phase init
 void compilationPolicy_init();
 void codeCache_init();
 void VM_Version_init();
@@ -117,7 +116,6 @@
   if (status != JNI_OK)
     return status;
 
-  classLoader_init2();  // after SymbolTable creation, set up -Xpatch entries
   CodeCacheExtensions::complete_step(CodeCacheExtensionsSteps::Universe);
   interpreter_init();  // before any methods loaded
   CodeCacheExtensions::complete_step(CodeCacheExtensionsSteps::Interpreter);
diff --git a/hotspot/src/share/vm/runtime/interfaceSupport.hpp b/hotspot/src/share/vm/runtime/interfaceSupport.hpp
index de3ef8f..4d4d51b 100644
--- a/hotspot/src/share/vm/runtime/interfaceSupport.hpp
+++ b/hotspot/src/share/vm/runtime/interfaceSupport.hpp
@@ -34,6 +34,7 @@
 #include "runtime/thread.inline.hpp"
 #include "runtime/vmThread.hpp"
 #include "utilities/globalDefinitions.hpp"
+#include "utilities/macros.hpp"
 #include "utilities/preserveException.hpp"
 
 // Wrapper for all entry points to the virtual machine.
@@ -90,21 +91,8 @@
 
  public:
   // OS dependent stuff
-#ifdef TARGET_OS_FAMILY_linux
-# include "interfaceSupport_linux.hpp"
-#endif
-#ifdef TARGET_OS_FAMILY_solaris
-# include "interfaceSupport_solaris.hpp"
-#endif
-#ifdef TARGET_OS_FAMILY_windows
-# include "interfaceSupport_windows.hpp"
-#endif
-#ifdef TARGET_OS_FAMILY_aix
-# include "interfaceSupport_aix.hpp"
-#endif
-#ifdef TARGET_OS_FAMILY_bsd
-# include "interfaceSupport_bsd.hpp"
-#endif
+
+#include OS_HEADER(interfaceSupport)
 
 };
 
diff --git a/hotspot/src/share/vm/runtime/javaCalls.hpp b/hotspot/src/share/vm/runtime/javaCalls.hpp
index 0d88568..dd67b7e 100644
--- a/hotspot/src/share/vm/runtime/javaCalls.hpp
+++ b/hotspot/src/share/vm/runtime/javaCalls.hpp
@@ -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
@@ -31,24 +31,9 @@
 #include "runtime/javaFrameAnchor.hpp"
 #include "runtime/thread.hpp"
 #include "runtime/vmThread.hpp"
-#ifdef TARGET_ARCH_x86
-# include "jniTypes_x86.hpp"
-#endif
-#ifdef TARGET_ARCH_sparc
-# include "jniTypes_sparc.hpp"
-#endif
-#ifdef TARGET_ARCH_zero
-# include "jniTypes_zero.hpp"
-#endif
-#ifdef TARGET_ARCH_arm
-# include "jniTypes_arm.hpp"
-#endif
-#ifdef TARGET_ARCH_ppc
-# include "jniTypes_ppc.hpp"
-#endif
-#ifdef TARGET_ARCH_aarch64
-# include "jniTypes_aarch64.hpp"
-#endif
+#include "utilities/macros.hpp"
+
+#include CPU_HEADER(jniTypes)
 
 // A JavaCallWrapper is constructed before each JavaCall and destructed after the call.
 // Its purpose is to allocate/deallocate a new handle block and to save/restore the last
diff --git a/hotspot/src/share/vm/runtime/javaFrameAnchor.hpp b/hotspot/src/share/vm/runtime/javaFrameAnchor.hpp
index 777698c..64565a2 100644
--- a/hotspot/src/share/vm/runtime/javaFrameAnchor.hpp
+++ b/hotspot/src/share/vm/runtime/javaFrameAnchor.hpp
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2002, 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2002, 2016, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -25,8 +25,9 @@
 #ifndef SHARE_VM_RUNTIME_JAVAFRAMEANCHOR_HPP
 #define SHARE_VM_RUNTIME_JAVAFRAMEANCHOR_HPP
 
-#include "utilities/globalDefinitions.hpp"
 #include "runtime/orderAccess.inline.hpp"
+#include "utilities/globalDefinitions.hpp"
+#include "utilities/macros.hpp"
 
 //
 // An object for encapsulating the machine/os dependent part of a JavaThread frame state
@@ -77,25 +78,7 @@
   // and no one should look at the other fields.
   void zap(void)                                     { _last_Java_sp = NULL; }
 
-#ifdef TARGET_ARCH_x86
-# include "javaFrameAnchor_x86.hpp"
-#endif
-#ifdef TARGET_ARCH_sparc
-# include "javaFrameAnchor_sparc.hpp"
-#endif
-#ifdef TARGET_ARCH_zero
-# include "javaFrameAnchor_zero.hpp"
-#endif
-#ifdef TARGET_ARCH_arm
-# include "javaFrameAnchor_arm.hpp"
-#endif
-#ifdef TARGET_ARCH_ppc
-# include "javaFrameAnchor_ppc.hpp"
-#endif
-#ifdef TARGET_ARCH_aarch64
-# include "javaFrameAnchor_aarch64.hpp"
-#endif
-
+#include CPU_HEADER(javaFrameAnchor)
 
 public:
   JavaFrameAnchor()                              { clear(); }
diff --git a/hotspot/src/share/vm/runtime/mutex.cpp b/hotspot/src/share/vm/runtime/mutex.cpp
index a065fb1..f24e2a0 100644
--- a/hotspot/src/share/vm/runtime/mutex.cpp
+++ b/hotspot/src/share/vm/runtime/mutex.cpp
@@ -30,18 +30,7 @@
 #include "runtime/osThread.hpp"
 #include "runtime/thread.inline.hpp"
 #include "utilities/events.hpp"
-#ifdef TARGET_OS_FAMILY_linux
-# include "mutex_linux.inline.hpp"
-#endif
-#ifdef TARGET_OS_FAMILY_solaris
-# include "mutex_solaris.inline.hpp"
-#endif
-#ifdef TARGET_OS_FAMILY_windows
-# include "mutex_windows.inline.hpp"
-#endif
-#ifdef TARGET_OS_FAMILY_bsd
-# include "mutex_bsd.inline.hpp"
-#endif
+#include "utilities/macros.hpp"
 
 // o-o-o-o-o-o-o-o-o-o-o-o-o-o-o-o-o-o-o-o-o-o-o-o-o-o-o-o-o-o-o-o-o-o-o-o-o-o-o-o
 //
diff --git a/hotspot/src/share/vm/runtime/orderAccess.inline.hpp b/hotspot/src/share/vm/runtime/orderAccess.inline.hpp
index bc32373..0907a43 100644
--- a/hotspot/src/share/vm/runtime/orderAccess.inline.hpp
+++ b/hotspot/src/share/vm/runtime/orderAccess.inline.hpp
@@ -1,6 +1,6 @@
 /*
- * Copyright (c) 2014, 2015, Oracle and/or its affiliates. All rights reserved.
- * Copyright (c) 2014 SAP SE. All rights reserved.
+ * Copyright (c) 2014, 2016, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2014, 2016 SAP SE. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -28,52 +28,9 @@
 
 #include "runtime/atomic.inline.hpp"
 #include "runtime/orderAccess.hpp"
+#include "utilities/macros.hpp"
 
-// Linux
-#ifdef TARGET_OS_ARCH_linux_x86
-# include "orderAccess_linux_x86.inline.hpp"
-#endif
-#ifdef TARGET_OS_ARCH_linux_sparc
-# include "orderAccess_linux_sparc.inline.hpp"
-#endif
-#ifdef TARGET_OS_ARCH_linux_zero
-# include "orderAccess_linux_zero.inline.hpp"
-#endif
-#ifdef TARGET_OS_ARCH_linux_arm
-# include "orderAccess_linux_arm.inline.hpp"
-#endif
-#ifdef TARGET_OS_ARCH_linux_aarch64
-# include "orderAccess_linux_aarch64.inline.hpp"
-#endif
-#ifdef TARGET_OS_ARCH_linux_ppc
-# include "orderAccess_linux_ppc.inline.hpp"
-#endif
-
-// Solaris
-#ifdef TARGET_OS_ARCH_solaris_x86
-# include "orderAccess_solaris_x86.inline.hpp"
-#endif
-#ifdef TARGET_OS_ARCH_solaris_sparc
-# include "orderAccess_solaris_sparc.inline.hpp"
-#endif
-
-// Windows
-#ifdef TARGET_OS_ARCH_windows_x86
-# include "orderAccess_windows_x86.inline.hpp"
-#endif
-
-// AIX
-#ifdef TARGET_OS_ARCH_aix_ppc
-# include "orderAccess_aix_ppc.inline.hpp"
-#endif
-
-// BSD
-#ifdef TARGET_OS_ARCH_bsd_x86
-# include "orderAccess_bsd_x86.inline.hpp"
-#endif
-#ifdef TARGET_OS_ARCH_bsd_zero
-# include "orderAccess_bsd_zero.inline.hpp"
-#endif
+#include OS_CPU_HEADER_INLINE(orderAccess)
 
 #ifdef VM_HAS_GENERALIZED_ORDER_ACCESS
 
diff --git a/hotspot/src/share/vm/runtime/os.cpp b/hotspot/src/share/vm/runtime/os.cpp
index 554a183..e9ff778 100644
--- a/hotspot/src/share/vm/runtime/os.cpp
+++ b/hotspot/src/share/vm/runtime/os.cpp
@@ -71,6 +71,7 @@
 uintptr_t         os::_serialize_page_mask = 0;
 long              os::_rand_seed          = 1;
 int               os::_processor_count    = 0;
+int               os::_initial_active_processor_count = 0;
 size_t            os::_page_sizes[os::page_sizes_max];
 
 #ifndef PRODUCT
@@ -315,6 +316,7 @@
 }
 
 void os::init_before_ergo() {
+  initialize_initial_active_processor_count();
   // We need to initialize large page support here because ergonomics takes some
   // decisions depending on large page support and the calculated large page size.
   large_page_init();
@@ -829,7 +831,11 @@
   st->print("CPU:");
   st->print("total %d", os::processor_count());
   // It's not safe to query number of active processors after crash
-  // st->print("(active %d)", os::active_processor_count());
+  // st->print("(active %d)", os::active_processor_count()); but we can
+  // print the initial number of active processors.
+  // We access the raw value here because the assert in the accessor will
+  // fail if the crash occurs before initialization of this value.
+  st->print(" (initial active %d)", _initial_active_processor_count);
   st->print(" %s", VM_Version::features_string());
   st->cr();
   pd_print_cpu_info(st, buf, buflen);
@@ -1207,7 +1213,7 @@
   if (jimage == NULL) return false;
   bool has_jimage = (os::stat(jimage, &st) == 0);
   if (has_jimage) {
-    Arguments::set_sysclasspath(jimage);
+    Arguments::set_sysclasspath(jimage, true);
     FREE_C_HEAP_ARRAY(char, jimage);
     return true;
   }
@@ -1217,7 +1223,7 @@
   char* base_classes = format_boot_path("%/modules/java.base", home, home_len, fileSep, pathSep);
   if (base_classes == NULL) return false;
   if (os::stat(base_classes, &st) == 0) {
-    Arguments::set_sysclasspath(base_classes);
+    Arguments::set_sysclasspath(base_classes, false);
     FREE_C_HEAP_ARRAY(char, base_classes);
     return true;
   }
@@ -1597,6 +1603,12 @@
   return result;
 }
 
+void os::initialize_initial_active_processor_count() {
+  assert(_initial_active_processor_count == 0, "Initial active processor count already set.");
+  _initial_active_processor_count = active_processor_count();
+  log_debug(os)("Initial active processor count set to %d" , _initial_active_processor_count);
+}
+
 void os::SuspendedThreadTask::run() {
   assert(Threads_lock->owned_by_self() || (_thread == VMThread::vm_thread()), "must have threads lock to call this");
   internal_do_task();
@@ -1742,7 +1754,7 @@
   pd_realign_memory(addr, bytes, alignment_hint);
 }
 
-#ifndef TARGET_OS_FAMILY_windows
+#ifndef _WINDOWS
 /* try to switch state from state "from" to state "to"
  * returns the state set after the method is complete
  */
diff --git a/hotspot/src/share/vm/runtime/os.hpp b/hotspot/src/share/vm/runtime/os.hpp
index f99088b..0cf1bd6 100644
--- a/hotspot/src/share/vm/runtime/os.hpp
+++ b/hotspot/src/share/vm/runtime/os.hpp
@@ -26,29 +26,15 @@
 #define SHARE_VM_RUNTIME_OS_HPP
 
 #include "jvmtifiles/jvmti.h"
+#include "prims/jvm.h"
 #include "runtime/extendedPC.hpp"
 #include "runtime/handles.hpp"
-#ifdef TARGET_OS_FAMILY_linux
-# include "jvm_linux.h"
+#include "utilities/macros.hpp"
+#ifndef _WINDOWS
 # include <setjmp.h>
 #endif
-#ifdef TARGET_OS_FAMILY_solaris
-# include "jvm_solaris.h"
-# include <setjmp.h>
-#endif
-#ifdef TARGET_OS_FAMILY_windows
-# include "jvm_windows.h"
-#endif
-#ifdef TARGET_OS_FAMILY_aix
-# include "jvm_aix.h"
-# include <setjmp.h>
-#endif
-#ifdef TARGET_OS_FAMILY_bsd
-# include "jvm_bsd.h"
-# include <setjmp.h>
-# ifdef __APPLE__
-#  include <mach/mach_time.h>
-# endif
+#ifdef __APPLE__
+# include <mach/mach_time.h>
 #endif
 
 class AgentLibrary;
@@ -154,6 +140,7 @@
   static void  get_summary_cpu_info(char* buf, size_t buflen);
   static void  get_summary_os_info(char* buf, size_t buflen);
 
+  static void initialize_initial_active_processor_count();
  public:
   static void init(void);                      // Called before command line parsing
   static void init_before_ergo(void);          // Called after command line parsing
@@ -241,6 +228,13 @@
   // Note that on some OSes this can change dynamically.
   static int active_processor_count();
 
+  // At startup the number of active CPUs this process is allowed to run on.
+  // This value does not change dynamically. May be different from active_processor_count().
+  static int initial_active_processor_count() {
+    assert(_initial_active_processor_count > 0, "Initial active processor count not set yet.");
+    return _initial_active_processor_count;
+  }
+
   // Bind processes to processors.
   //     This is a two step procedure:
   //     first you generate a distribution of processes to processors,
@@ -816,61 +810,11 @@
   };
 
   // Platform dependent stuff
-#ifdef TARGET_OS_FAMILY_linux
-# include "os_linux.hpp"
+#ifndef _WINDOWS
 # include "os_posix.hpp"
 #endif
-#ifdef TARGET_OS_FAMILY_solaris
-# include "os_solaris.hpp"
-# include "os_posix.hpp"
-#endif
-#ifdef TARGET_OS_FAMILY_windows
-# include "os_windows.hpp"
-#endif
-#ifdef TARGET_OS_FAMILY_aix
-# include "os_aix.hpp"
-# include "os_posix.hpp"
-#endif
-#ifdef TARGET_OS_FAMILY_bsd
-# include "os_posix.hpp"
-# include "os_bsd.hpp"
-#endif
-#ifdef TARGET_OS_ARCH_linux_x86
-# include "os_linux_x86.hpp"
-#endif
-#ifdef TARGET_OS_ARCH_linux_sparc
-# include "os_linux_sparc.hpp"
-#endif
-#ifdef TARGET_OS_ARCH_linux_zero
-# include "os_linux_zero.hpp"
-#endif
-#ifdef TARGET_OS_ARCH_solaris_x86
-# include "os_solaris_x86.hpp"
-#endif
-#ifdef TARGET_OS_ARCH_solaris_sparc
-# include "os_solaris_sparc.hpp"
-#endif
-#ifdef TARGET_OS_ARCH_windows_x86
-# include "os_windows_x86.hpp"
-#endif
-#ifdef TARGET_OS_ARCH_linux_arm
-# include "os_linux_arm.hpp"
-#endif
-#ifdef TARGET_OS_ARCH_linux_ppc
-# include "os_linux_ppc.hpp"
-#endif
-#ifdef TARGET_OS_ARCH_aix_ppc
-# include "os_aix_ppc.hpp"
-#endif
-#ifdef TARGET_OS_ARCH_linux_aarch64
-# include "os_linux_aarch64.hpp"
-#endif
-#ifdef TARGET_OS_ARCH_bsd_x86
-# include "os_bsd_x86.hpp"
-#endif
-#ifdef TARGET_OS_ARCH_bsd_zero
-# include "os_bsd_zero.hpp"
-#endif
+#include OS_CPU_HEADER(os)
+#include OS_HEADER(os)
 
 #ifndef OS_NATIVE_THREAD_CREATION_FAILED_MSG
 #define OS_NATIVE_THREAD_CREATION_FAILED_MSG "unable to create native thread: possibly out of memory or process/resource limits reached"
@@ -937,7 +881,7 @@
     bool _done;
   };
 
-#ifndef TARGET_OS_FAMILY_windows
+#ifndef _WINDOWS
   // Suspend/resume support
   // Protocol:
   //
@@ -1008,12 +952,13 @@
       return _state == SR_SUSPENDED;
     }
   };
-#endif
+#endif // !WINDOWS
 
 
  protected:
-  static long _rand_seed;                   // seed for random number generator
-  static int _processor_count;              // number of processors
+  static long _rand_seed;                     // seed for random number generator
+  static int _processor_count;                // number of processors
+  static int _initial_active_processor_count; // number of active processors during initialization.
 
   static char* format_boot_path(const char* format_string,
                                 const char* home,
diff --git a/hotspot/src/share/vm/runtime/os.inline.hpp b/hotspot/src/share/vm/runtime/os.inline.hpp
index 392e44d..3814b56 100644
--- a/hotspot/src/share/vm/runtime/os.inline.hpp
+++ b/hotspot/src/share/vm/runtime/os.inline.hpp
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2014, 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,20 +27,6 @@
 
 #include "runtime/os.hpp"
 
-#ifdef TARGET_OS_FAMILY_linux
-# include "os_linux.inline.hpp"
-#endif
-#ifdef TARGET_OS_FAMILY_solaris
-# include "os_solaris.inline.hpp"
-#endif
-#ifdef TARGET_OS_FAMILY_windows
-# include "os_windows.inline.hpp"
-#endif
-#ifdef TARGET_OS_FAMILY_aix
-# include "os_aix.inline.hpp"
-#endif
-#ifdef TARGET_OS_FAMILY_bsd
-# include "os_bsd.inline.hpp"
-#endif
+#include OS_HEADER_INLINE(os)
 
 #endif // SHARE_VM_RUNTIME_OS_INLINE_HPP
diff --git a/hotspot/src/share/vm/runtime/osThread.hpp b/hotspot/src/share/vm/runtime/osThread.hpp
index 16cc2e8..1e8bcf0 100644
--- a/hotspot/src/share/vm/runtime/osThread.hpp
+++ b/hotspot/src/share/vm/runtime/osThread.hpp
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1997, 2012, 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
@@ -29,6 +29,7 @@
 #include "runtime/handles.hpp"
 #include "runtime/javaFrameAnchor.hpp"
 #include "runtime/objectMonitor.hpp"
+#include "utilities/macros.hpp"
 
 // The OSThread class holds OS-specific thread information.  It is equivalent
 // to the sys_thread_t structure of the classic JVM implementation.
@@ -96,21 +97,7 @@
   static ByteSize interrupted_offset()            { return byte_offset_of(OSThread, _interrupted); }
 
   // Platform dependent stuff
-#ifdef TARGET_OS_FAMILY_linux
-# include "osThread_linux.hpp"
-#endif
-#ifdef TARGET_OS_FAMILY_solaris
-# include "osThread_solaris.hpp"
-#endif
-#ifdef TARGET_OS_FAMILY_windows
-# include "osThread_windows.hpp"
-#endif
-#ifdef TARGET_OS_FAMILY_aix
-# include "osThread_aix.hpp"
-#endif
-#ifdef TARGET_OS_FAMILY_bsd
-# include "osThread_bsd.hpp"
-#endif
+#include OS_HEADER(osThread)
 
  public:
   static ByteSize thread_id_offset()              { return byte_offset_of(OSThread, _thread_id); }
diff --git a/hotspot/src/share/vm/runtime/prefetch.inline.hpp b/hotspot/src/share/vm/runtime/prefetch.inline.hpp
index f4e30de..1ff1671 100644
--- a/hotspot/src/share/vm/runtime/prefetch.inline.hpp
+++ b/hotspot/src/share/vm/runtime/prefetch.inline.hpp
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2014, 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,51 +26,7 @@
 #define SHARE_VM_RUNTIME_PREFETCH_INLINE_HPP
 
 #include "runtime/prefetch.hpp"
-
-// Linux
-#ifdef TARGET_OS_ARCH_linux_x86
-# include "prefetch_linux_x86.inline.hpp"
-#endif
-#ifdef TARGET_OS_ARCH_linux_sparc
-# include "prefetch_linux_sparc.inline.hpp"
-#endif
-#ifdef TARGET_OS_ARCH_linux_zero
-# include "prefetch_linux_zero.inline.hpp"
-#endif
-#ifdef TARGET_OS_ARCH_linux_arm
-# include "prefetch_linux_arm.inline.hpp"
-#endif
-#ifdef TARGET_OS_ARCH_linux_aarch64
-# include "prefetch_linux_aarch64.inline.hpp"
-#endif
-#ifdef TARGET_OS_ARCH_linux_ppc
-# include "prefetch_linux_ppc.inline.hpp"
-#endif
-
-// Solaris
-#ifdef TARGET_OS_ARCH_solaris_x86
-# include "prefetch_solaris_x86.inline.hpp"
-#endif
-#ifdef TARGET_OS_ARCH_solaris_sparc
-# include "prefetch_solaris_sparc.inline.hpp"
-#endif
-
-// Windows
-#ifdef TARGET_OS_ARCH_windows_x86
-# include "prefetch_windows_x86.inline.hpp"
-#endif
-
-// AIX
-#ifdef TARGET_OS_ARCH_aix_ppc
-# include "prefetch_aix_ppc.inline.hpp"
-#endif
-
-// BSD
-#ifdef TARGET_OS_ARCH_bsd_x86
-# include "prefetch_bsd_x86.inline.hpp"
-#endif
-#ifdef TARGET_OS_ARCH_bsd_zero
-# include "prefetch_bsd_zero.inline.hpp"
-#endif
+#include "utilities/macros.hpp"
+#include OS_CPU_HEADER_INLINE(prefetch)
 
 #endif // SHARE_VM_RUNTIME_PREFETCH_INLINE_HPP
diff --git a/hotspot/src/share/vm/runtime/registerMap.hpp b/hotspot/src/share/vm/runtime/registerMap.hpp
index 0b2d410..046e9fe 100644
--- a/hotspot/src/share/vm/runtime/registerMap.hpp
+++ b/hotspot/src/share/vm/runtime/registerMap.hpp
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2002, 2014, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2002, 2016, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -27,6 +27,7 @@
 
 #include "code/vmreg.hpp"
 #include "utilities/globalDefinitions.hpp"
+#include "utilities/macros.hpp"
 
 class JavaThread;
 
@@ -120,24 +121,7 @@
   void print() const;
 
   // the following contains the definition of pd_xxx methods
-#ifdef TARGET_ARCH_x86
-# include "registerMap_x86.hpp"
-#endif
-#ifdef TARGET_ARCH_sparc
-# include "registerMap_sparc.hpp"
-#endif
-#ifdef TARGET_ARCH_zero
-# include "registerMap_zero.hpp"
-#endif
-#ifdef TARGET_ARCH_arm
-# include "registerMap_arm.hpp"
-#endif
-#ifdef TARGET_ARCH_ppc
-# include "registerMap_ppc.hpp"
-#endif
-#ifdef TARGET_ARCH_aarch64
-# include "registerMap_aarch64.hpp"
-#endif
+#include CPU_HEADER(registerMap)
 
 };
 
diff --git a/hotspot/src/share/vm/runtime/semaphore.hpp b/hotspot/src/share/vm/runtime/semaphore.hpp
index 8a282d4..ecf8e8a 100644
--- a/hotspot/src/share/vm/runtime/semaphore.hpp
+++ b/hotspot/src/share/vm/runtime/semaphore.hpp
@@ -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,11 +27,11 @@
 
 #include "memory/allocation.hpp"
 
-#if defined(TARGET_OS_FAMILY_linux) || defined(TARGET_OS_FAMILY_solaris) || defined(TARGET_OS_FAMILY_aix)
+#if defined(LINUX) || defined(SOLARIS) || defined(AIX)
 # include "semaphore_posix.hpp"
-#elif defined(TARGET_OS_FAMILY_bsd)
+#elif defined(BSD)
 # include "semaphore_bsd.hpp"
-#elif defined(TARGET_OS_FAMILY_windows)
+#elif defined(_WINDOWS)
 # include "semaphore_windows.hpp"
 #else
 # error "No semaphore implementation provided for this OS"
diff --git a/hotspot/src/share/vm/runtime/sharedRuntime.hpp b/hotspot/src/share/vm/runtime/sharedRuntime.hpp
index eb9797f..02824bb 100644
--- a/hotspot/src/share/vm/runtime/sharedRuntime.hpp
+++ b/hotspot/src/share/vm/runtime/sharedRuntime.hpp
@@ -388,16 +388,6 @@
   static int c_calling_convention(const BasicType *sig_bt, VMRegPair *regs, VMRegPair *regs2,
                                   int total_args_passed);
 
-  // Compute the new number of arguments in the signature if 32 bit ints
-  // must be converted to longs. Needed if CCallingConventionRequiresIntsAsLongs
-  // is true.
-  static int  convert_ints_to_longints_argcnt(int in_args_count, BasicType* in_sig_bt);
-  // Adapt a method's signature if it contains 32 bit integers that must
-  // be converted to longs. Needed if CCallingConventionRequiresIntsAsLongs
-  // is true.
-  static void convert_ints_to_longints(int i2l_argcnt, int& in_args_count,
-                                       BasicType*& in_sig_bt, VMRegPair*& in_regs);
-
   static size_t trampoline_size();
 
   static void generate_trampoline(MacroAssembler *masm, address destination);
diff --git a/hotspot/src/share/vm/runtime/simpleThresholdPolicy.cpp b/hotspot/src/share/vm/runtime/simpleThresholdPolicy.cpp
index 4fbfd00..e38c692 100644
--- a/hotspot/src/share/vm/runtime/simpleThresholdPolicy.cpp
+++ b/hotspot/src/share/vm/runtime/simpleThresholdPolicy.cpp
@@ -237,13 +237,6 @@
     return;
   }
 
-#if INCLUDE_JVMCI
-  // We can't compile with a JVMCI compiler until the module system is initialized.
-  if (level == CompLevel_full_optimization && UseJVMCICompiler && !Universe::is_module_initialized()) {
-    return;
-  }
-#endif
-
   // Check if the method can be compiled. If it cannot be compiled with C1, continue profiling
   // in the interpreter and then compile with C2 (the transition function will request that,
   // see common() ). If the method cannot be compiled with C2 but still can with C1, compile it with
diff --git a/hotspot/src/share/vm/runtime/stubRoutines.hpp b/hotspot/src/share/vm/runtime/stubRoutines.hpp
index 729886f..0ec3219 100644
--- a/hotspot/src/share/vm/runtime/stubRoutines.hpp
+++ b/hotspot/src/share/vm/runtime/stubRoutines.hpp
@@ -30,6 +30,7 @@
 #include "runtime/frame.hpp"
 #include "runtime/mutexLocker.hpp"
 #include "runtime/stubCodeGenerator.hpp"
+#include "utilities/macros.hpp"
 
 // StubRoutines provides entry points to assembly routines used by
 // compiled code and the run-time system. Platform-specific entry
@@ -83,21 +84,8 @@
 
   // Dependencies
   friend class StubGenerator;
-#if defined STUBROUTINES_MD_HPP
-# include STUBROUTINES_MD_HPP
-#elif defined TARGET_ARCH_MODEL_x86_32
-# include "stubRoutines_x86_32.hpp"
-#elif defined TARGET_ARCH_MODEL_x86_64
-# include "stubRoutines_x86_64.hpp"
-#elif defined TARGET_ARCH_MODEL_sparc
-# include "stubRoutines_sparc.hpp"
-#elif defined TARGET_ARCH_MODEL_zero
-# include "stubRoutines_zero.hpp"
-#elif defined TARGET_ARCH_MODEL_ppc_64
-# include "stubRoutines_ppc_64.hpp"
-#elif defined TARGET_ARCH_MODEL_aarch64
-# include "stubRoutines_aarch64.hpp"
-#endif
+
+#include CPU_HEADER(stubRoutines)
 
   static jint    _verify_oop_count;
   static address _verify_oop_subroutine_entry;
diff --git a/hotspot/src/share/vm/runtime/thread.cpp b/hotspot/src/share/vm/runtime/thread.cpp
index 588c263..26c7e87 100644
--- a/hotspot/src/share/vm/runtime/thread.cpp
+++ b/hotspot/src/share/vm/runtime/thread.cpp
@@ -3773,6 +3773,14 @@
   // cache the system class loader
   SystemDictionary::compute_java_system_loader(CHECK_(JNI_ERR));
 
+#if INCLUDE_JVMCI
+  if (EnableJVMCI && UseJVMCICompiler && (!UseInterpreter || !BackgroundCompilation)) {
+    // 8145270: Force initialization of JVMCI runtime otherwise requests for blocking
+    // compilations via JVMCI will not actually block until JVMCI is initialized.
+    JVMCIRuntime::force_initialization(CHECK_JNI_ERR);
+  }
+#endif
+
   // Always call even when there are not JVMTI environments yet, since environments
   // may be attached late and JVMTI must track phases of VM execution
   JvmtiExport::enter_live_phase();
diff --git a/hotspot/src/share/vm/runtime/thread.hpp b/hotspot/src/share/vm/runtime/thread.hpp
index 46828d4..37e6ed3 100644
--- a/hotspot/src/share/vm/runtime/thread.hpp
+++ b/hotspot/src/share/vm/runtime/thread.hpp
@@ -50,7 +50,7 @@
 #include "gc/g1/dirtyCardQueue.hpp"
 #include "gc/g1/satbMarkQueue.hpp"
 #endif // INCLUDE_ALL_GCS
-#ifdef TARGET_ARCH_zero
+#ifdef ZERO
 # include "stack_zero.hpp"
 #endif
 
@@ -1905,43 +1905,7 @@
 #endif // INCLUDE_ALL_GCS
 
   // Machine dependent stuff
-#ifdef TARGET_OS_ARCH_linux_x86
-# include "thread_linux_x86.hpp"
-#endif
-#ifdef TARGET_OS_ARCH_linux_sparc
-# include "thread_linux_sparc.hpp"
-#endif
-#ifdef TARGET_OS_ARCH_linux_zero
-# include "thread_linux_zero.hpp"
-#endif
-#ifdef TARGET_OS_ARCH_solaris_x86
-# include "thread_solaris_x86.hpp"
-#endif
-#ifdef TARGET_OS_ARCH_solaris_sparc
-# include "thread_solaris_sparc.hpp"
-#endif
-#ifdef TARGET_OS_ARCH_windows_x86
-# include "thread_windows_x86.hpp"
-#endif
-#ifdef TARGET_OS_ARCH_linux_arm
-# include "thread_linux_arm.hpp"
-#endif
-#ifdef TARGET_OS_ARCH_linux_ppc
-# include "thread_linux_ppc.hpp"
-#endif
-#ifdef TARGET_OS_ARCH_linux_aarch64
-# include "thread_linux_aarch64.hpp"
-#endif
-#ifdef TARGET_OS_ARCH_aix_ppc
-# include "thread_aix_ppc.hpp"
-#endif
-#ifdef TARGET_OS_ARCH_bsd_x86
-# include "thread_bsd_x86.hpp"
-#endif
-#ifdef TARGET_OS_ARCH_bsd_zero
-# include "thread_bsd_zero.hpp"
-#endif
-
+#include OS_CPU_HEADER(thread)
 
  public:
   void set_blocked_on_compilation(bool value) {
diff --git a/hotspot/src/share/vm/runtime/vmStructs.cpp b/hotspot/src/share/vm/runtime/vmStructs.cpp
index 610dc13..a068753 100644
--- a/hotspot/src/share/vm/runtime/vmStructs.cpp
+++ b/hotspot/src/share/vm/runtime/vmStructs.cpp
@@ -107,77 +107,9 @@
 #include "utilities/hashtable.hpp"
 #include "utilities/macros.hpp"
 
-#ifdef TARGET_OS_FAMILY_linux
-# include "vmStructs_linux.hpp"
-#endif
-#ifdef TARGET_OS_FAMILY_solaris
-# include "vmStructs_solaris.hpp"
-#endif
-#ifdef TARGET_OS_FAMILY_windows
-# include "vmStructs_windows.hpp"
-#endif
-#ifdef TARGET_OS_FAMILY_aix
-# include "vmStructs_aix.hpp"
-#endif
-#ifdef TARGET_OS_FAMILY_bsd
-# include "vmStructs_bsd.hpp"
-#endif
-
-#ifdef TARGET_ARCH_x86
-# include "vmStructs_x86.hpp"
-#endif
-#ifdef TARGET_ARCH_sparc
-# include "vmStructs_sparc.hpp"
-#endif
-#ifdef TARGET_ARCH_zero
-# include "vmStructs_zero.hpp"
-#endif
-#ifdef TARGET_ARCH_arm
-# include "vmStructs_arm.hpp"
-#endif
-#ifdef TARGET_ARCH_ppc
-# include "vmStructs_ppc.hpp"
-#endif
-#ifdef TARGET_ARCH_aarch64
-# include "vmStructs_aarch64.hpp"
-#endif
-
-#ifdef TARGET_OS_ARCH_linux_x86
-# include "vmStructs_linux_x86.hpp"
-#endif
-#ifdef TARGET_OS_ARCH_linux_sparc
-# include "vmStructs_linux_sparc.hpp"
-#endif
-#ifdef TARGET_OS_ARCH_linux_zero
-# include "vmStructs_linux_zero.hpp"
-#endif
-#ifdef TARGET_OS_ARCH_solaris_x86
-# include "vmStructs_solaris_x86.hpp"
-#endif
-#ifdef TARGET_OS_ARCH_solaris_sparc
-# include "vmStructs_solaris_sparc.hpp"
-#endif
-#ifdef TARGET_OS_ARCH_windows_x86
-# include "vmStructs_windows_x86.hpp"
-#endif
-#ifdef TARGET_OS_ARCH_linux_arm
-# include "vmStructs_linux_arm.hpp"
-#endif
-#ifdef TARGET_OS_ARCH_linux_ppc
-# include "vmStructs_linux_ppc.hpp"
-#endif
-#ifdef TARGET_OS_ARCH_linux_aarch64
-# include "vmStructs_linux_aarch64.hpp"
-#endif
-#ifdef TARGET_OS_ARCH_aix_ppc
-# include "vmStructs_aix_ppc.hpp"
-#endif
-#ifdef TARGET_OS_ARCH_bsd_x86
-# include "vmStructs_bsd_x86.hpp"
-#endif
-#ifdef TARGET_OS_ARCH_bsd_zero
-# include "vmStructs_bsd_zero.hpp"
-#endif
+#include CPU_HEADER(vmStructs)
+#include OS_HEADER(vmStructs)
+#include OS_CPU_HEADER(vmStructs)
 
 #if INCLUDE_ALL_GCS
 #include "gc/cms/compactibleFreeListSpace.hpp"
diff --git a/hotspot/src/share/vm/runtime/vm_version.cpp b/hotspot/src/share/vm/runtime/vm_version.cpp
index 98e90d5..942feb1 100644
--- a/hotspot/src/share/vm/runtime/vm_version.cpp
+++ b/hotspot/src/share/vm/runtime/vm_version.cpp
@@ -110,7 +110,7 @@
 #ifndef HOTSPOT_VM_DISTRO
   #error HOTSPOT_VM_DISTRO must be defined
 #endif
-#define VMNAME HOTSPOT_VM_DISTRO " " VMLP EMBEDDED_ONLY("Embedded ") VMTYPE " VM"
+#define VMNAME HOTSPOT_VM_DISTRO " " VMLP VMTYPE " VM"
 
 const char* Abstract_VM_Version::vm_name() {
   return VMNAME;
@@ -295,7 +295,7 @@
     // processor after the first 8.  For example, on a 72 cpu machine
     // and a chosen fraction of 5/8
     // use 8 + (72 - 8) * (5/8) == 48 worker threads.
-    unsigned int ncpus = (unsigned int) os::active_processor_count();
+    unsigned int ncpus = (unsigned int) os::initial_active_processor_count();
     threads = (ncpus <= switch_pt) ?
              ncpus :
              (switch_pt + ((ncpus - switch_pt) * num) / den);
diff --git a/hotspot/src/share/vm/runtime/vm_version.hpp b/hotspot/src/share/vm/runtime/vm_version.hpp
index a9e5733..e0f89ea 100644
--- a/hotspot/src/share/vm/runtime/vm_version.hpp
+++ b/hotspot/src/share/vm/runtime/vm_version.hpp
@@ -27,6 +27,7 @@
 
 #include "memory/allocation.hpp"
 #include "utilities/ostream.hpp"
+#include "utilities/macros.hpp"
 
 // VM_Version provides information about the VM.
 
@@ -160,20 +161,6 @@
   static bool supports_on_spin_wait() { return false; }
 };
 
-#ifdef TARGET_ARCH_x86
-# include "vm_version_x86.hpp"
-#endif
-#ifdef TARGET_ARCH_sparc
-# include "vm_version_sparc.hpp"
-#endif
-#ifdef TARGET_ARCH_zero
-# include "vm_version_zero.hpp"
-#endif
-#ifdef TARGET_ARCH_arm
-# include "vm_version_arm.hpp"
-#endif
-#ifdef TARGET_ARCH_ppc
-# include "vm_version_ppc.hpp"
-#endif
+#include CPU_HEADER(vm_version)
 
 #endif // SHARE_VM_RUNTIME_VM_VERSION_HPP
diff --git a/hotspot/src/share/vm/services/diagnosticArgument.cpp b/hotspot/src/share/vm/services/diagnosticArgument.cpp
index 0c51a70..abd8349 100644
--- a/hotspot/src/share/vm/services/diagnosticArgument.cpp
+++ b/hotspot/src/share/vm/services/diagnosticArgument.cpp
@@ -98,7 +98,7 @@
     strncpy(buf, str, len);
     buf[len] = '\0';
     Exceptions::fthrow(THREAD_AND_LOCATION, vmSymbols::java_lang_IllegalArgumentException(),
-      "Integer parsing error in command argument '%s'. Could not parse: %s.", _name, buf);
+      "Integer parsing error in command argument '%s'. Could not parse: %s.\n", _name, buf);
   }
 }
 
@@ -132,7 +132,7 @@
       strncpy(buf, str, len);
       buf[len] = '\0';
       Exceptions::fthrow(THREAD_AND_LOCATION, vmSymbols::java_lang_IllegalArgumentException(),
-        "Boolean parsing error in command argument '%s'. Could not parse: %s.", _name, buf);
+        "Boolean parsing error in command argument '%s'. Could not parse: %s.\n", _name, buf);
     }
   }
 }
@@ -183,13 +183,13 @@
                                                  size_t len, TRAPS) {
   if (str == NULL) {
     THROW_MSG(vmSymbols::java_lang_IllegalArgumentException(),
-              "Integer parsing error nanotime value: syntax error, value is null");
+              "Integer parsing error nanotime value: syntax error, value is null\n");
   }
 
   int argc = sscanf(str, JLONG_FORMAT, &_value._time);
   if (argc != 1) {
     THROW_MSG(vmSymbols::java_lang_IllegalArgumentException(),
-              "Integer parsing error nanotime value: syntax error");
+              "Integer parsing error nanotime value: syntax error\n");
   }
   size_t idx = 0;
   while(idx < len && isdigit(str[idx])) {
@@ -199,7 +199,7 @@
     // only accept missing unit if the value is 0
     if (_value._time != 0) {
       THROW_MSG(vmSymbols::java_lang_IllegalArgumentException(),
-                "Integer parsing error nanotime value: unit required");
+                "Integer parsing error nanotime value: unit required\n");
     } else {
       _value._nanotime = 0;
       strcpy(_value._unit, "ns");
@@ -207,7 +207,7 @@
     }
   } else if(len - idx > 2) {
     THROW_MSG(vmSymbols::java_lang_IllegalArgumentException(),
-              "Integer parsing error nanotime value: illegal unit");
+              "Integer parsing error nanotime value: illegal unit\n");
   } else {
     strncpy(_value._unit, &str[idx], len - idx);
     /*Write an extra null termination. This is safe because _value._unit
@@ -234,7 +234,7 @@
     _value._nanotime = _value._time * 24 * 60 * 60 * 1000 * 1000 * 1000;
   } else {
      THROW_MSG(vmSymbols::java_lang_IllegalArgumentException(),
-               "Integer parsing error nanotime value: illegal unit");
+               "Integer parsing error nanotime value: illegal unit\n");
   }
 }
 
@@ -280,12 +280,11 @@
                                                   size_t len, TRAPS) {
   if (str == NULL) {
     THROW_MSG(vmSymbols::java_lang_IllegalArgumentException(),
-               "Parsing error memory size value: syntax error, value is null");
+               "Parsing error memory size value: syntax error, value is null\n");
   }
-
   if (*str == '-') {
     THROW_MSG(vmSymbols::java_lang_IllegalArgumentException(),
-               "Parsing error memory size value: negative values not allowed");
+               "Parsing error memory size value: negative values not allowed\n");
   }
   int res = sscanf(str, UINT64_FORMAT "%c", &_value._val, &_value._multiplier);
   if (res == 2) {
@@ -310,7 +309,7 @@
      _value._size = _value._val;
    } else {
      THROW_MSG(vmSymbols::java_lang_IllegalArgumentException(),
-               "Parsing error memory size value: invalid value");
+               "Parsing error memory size value: invalid value\n");
    }
 }
 
diff --git a/hotspot/src/share/vm/services/lowMemoryDetector.cpp b/hotspot/src/share/vm/services/lowMemoryDetector.cpp
index 6fbfc9a..33e1f45 100644
--- a/hotspot/src/share/vm/services/lowMemoryDetector.cpp
+++ b/hotspot/src/share/vm/services/lowMemoryDetector.cpp
@@ -281,8 +281,6 @@
 }
 
 void SensorInfo::process_pending_requests(TRAPS) {
-  assert(has_pending_requests(), "Must have pending request");
-
   int pending_count = pending_trigger_count();
   if (pending_clear_count() > 0) {
     clear(pending_count, CHECK);
diff --git a/hotspot/src/share/vm/shark/sharkRuntime.cpp b/hotspot/src/share/vm/shark/sharkRuntime.cpp
index c6fd028..454c87f 100644
--- a/hotspot/src/share/vm/shark/sharkRuntime.cpp
+++ b/hotspot/src/share/vm/shark/sharkRuntime.cpp
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1999, 2012, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1999, 2016, Oracle and/or its affiliates. All rights reserved.
  * Copyright 2008, 2009, 2010 Red Hat, Inc.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
@@ -30,7 +30,8 @@
 #include "runtime/thread.hpp"
 #include "shark/llvmHeaders.hpp"
 #include "shark/sharkRuntime.hpp"
-#ifdef TARGET_ARCH_zero
+#include "utilities/macros.hpp"
+#ifdef ZERO
 # include "stack_zero.inline.hpp"
 #endif
 
diff --git a/hotspot/src/share/vm/shark/shark_globals.hpp b/hotspot/src/share/vm/shark/shark_globals.hpp
index 1c33fd3..3ee0b9a1 100644
--- a/hotspot/src/share/vm/shark/shark_globals.hpp
+++ b/hotspot/src/share/vm/shark/shark_globals.hpp
@@ -27,7 +27,8 @@
 #define SHARE_VM_SHARK_SHARK_GLOBALS_HPP
 
 #include "runtime/globals.hpp"
-#ifdef TARGET_ARCH_zero
+#include "utilities/macros.hpp"
+#ifdef ZERO
 # include "shark_globals_zero.hpp"
 #endif
 
diff --git a/hotspot/src/share/vm/trace/traceevents.xml b/hotspot/src/share/vm/trace/traceevents.xml
index 83bb051..10671cf 100644
--- a/hotspot/src/share/vm/trace/traceevents.xml
+++ b/hotspot/src/share/vm/trace/traceevents.xml
@@ -116,6 +116,12 @@
     <value type="CLASS" field="initiatingClassLoader" label="Initiating Class Loader"/>
   </event>
 
+  <event id="ClassDefine" path="vm/class/define" label="Class Define"
+          has_thread="true" has_stacktrace="true" is_instant="true">
+    <value type="CLASS" field="definedClass" label="Defined Class"/>
+    <value type="CLASS" field="definingClassLoader" label="Defining Class Loader"/>
+  </event>
+
   <event id="ClassUnload" path="vm/class/unload" label="Class Unload"
       has_thread="true" is_instant="true">
     <value type="CLASS" field="unloadedClass" label="Unloaded Class"/>
@@ -374,7 +380,7 @@
          description="Basic statistics related to current IHOP calculation">
     <value type="UINT" field="gcId" label="GC ID" relation="GC_ID"/>
     <value type="BYTES64" field="threshold" label="Current IHOP threshold" description="Current IHOP threshold in bytes"/>
-    <value type="BYTES64" field="thresholdPercentage" label="Current IHOP threshold in percent" description="Current IHOP threshold in percent of old gen"/>
+    <value type="PERCENTAGE" field="thresholdPercentage" label="Current IHOP threshold in percent" description="Current IHOP threshold in percent of old gen"/>
     <value type="BYTES64" field="targetOccupancy" label="Target occupancy" description="Target old gen occupancy to reach at the start of mixed GC in bytes"/>
     <value type="BYTES64" field="currentOccupancy" label="Current occupancy" description="Current old gen occupancy in bytes"/>
     <value type="BYTES64" field="lastAllocationSize" label="Last mutator allocation size" description="Mutator allocation during mutator operation since last GC in bytes"/>
@@ -387,7 +393,7 @@
          description="Statistics related to current adaptive IHOP calculation">
     <value type="UINT" field="gcId" label="GC ID" relation="GC_ID"/>
     <value type="BYTES64" field="threshold" label="Current IHOP threshold" description="Current IHOP threshold in bytes"/>
-    <value type="BYTES64" field="thresholdPercentage" label="Current IHOP threshold in percent" description="Current IHOP threshold in percent of the internal target occupancy"/>
+    <value type="PERCENTAGE" field="thresholdPercentage" label="Current IHOP threshold in percent" description="Current IHOP threshold in percent of the internal target occupancy"/>
     <value type="BYTES64" field="internalTargetOccupancy" label="Target occupancy" description="Internal target old gen occupancy to reach at the start of mixed GC in bytes"/>
     <value type="BYTES64" field="currentOccupancy" label="Current occupancy" description="Current old gen occupancy in bytes"/>
     <value type="BYTES64" field="additionalBufferSize" label="Additional buffer size" description="Additional buffer size in bytes"/>
diff --git a/hotspot/src/share/vm/utilities/bytes.hpp b/hotspot/src/share/vm/utilities/bytes.hpp
index 8b5aa9b..9ea1782 100644
--- a/hotspot/src/share/vm/utilities/bytes.hpp
+++ b/hotspot/src/share/vm/utilities/bytes.hpp
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2014, 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
@@ -25,23 +25,8 @@
 #ifndef SHARE_VM_UTILITIES_BYTES_HPP
 #define SHARE_VM_UTILITIES_BYTES_HPP
 
-#ifdef TARGET_ARCH_x86
-# include "bytes_x86.hpp"
-#endif
-#ifdef TARGET_ARCH_sparc
-# include "bytes_sparc.hpp"
-#endif
-#ifdef TARGET_ARCH_zero
-# include "bytes_zero.hpp"
-#endif
-#ifdef TARGET_ARCH_arm
-# include "bytes_arm.hpp"
-#endif
-#ifdef TARGET_ARCH_ppc
-# include "bytes_ppc.hpp"
-#endif
-#ifdef TARGET_ARCH_aarch64
-# include "bytes_aarch64.hpp"
-#endif
+#include "utilities/macros.hpp"
+
+#include CPU_HEADER(bytes)
 
 #endif // SHARE_VM_UTILITIES_BYTES_HPP
diff --git a/hotspot/src/share/vm/utilities/copy.hpp b/hotspot/src/share/vm/utilities/copy.hpp
index 242867e..e8d733b9 100644
--- a/hotspot/src/share/vm/utilities/copy.hpp
+++ b/hotspot/src/share/vm/utilities/copy.hpp
@@ -26,6 +26,7 @@
 #define SHARE_VM_UTILITIES_COPY_HPP
 
 #include "runtime/stubRoutines.hpp"
+#include "utilities/macros.hpp"
 
 // Assembly code for platforms that need it.
 extern "C" {
@@ -332,24 +333,7 @@
   }
 
   // Platform dependent implementations of the above methods.
-#ifdef TARGET_ARCH_x86
-# include "copy_x86.hpp"
-#endif
-#ifdef TARGET_ARCH_sparc
-# include "copy_sparc.hpp"
-#endif
-#ifdef TARGET_ARCH_zero
-# include "copy_zero.hpp"
-#endif
-#ifdef TARGET_ARCH_arm
-# include "copy_arm.hpp"
-#endif
-#ifdef TARGET_ARCH_ppc
-# include "copy_ppc.hpp"
-#endif
-#ifdef TARGET_ARCH_aarch64
-# include "copy_aarch64.hpp"
-#endif
+#include CPU_HEADER(copy)
 
 };
 
diff --git a/hotspot/src/share/vm/utilities/globalDefinitions.hpp b/hotspot/src/share/vm/utilities/globalDefinitions.hpp
index 4c9e513..aec8ab9 100644
--- a/hotspot/src/share/vm/utilities/globalDefinitions.hpp
+++ b/hotspot/src/share/vm/utilities/globalDefinitions.hpp
@@ -73,7 +73,6 @@
 #define ATTRIBUTE_SCANF(fmt, vargs)
 #endif
 
-
 #include "utilities/macros.hpp"
 
 // This file holds all globally used constants & types, class (forward)
@@ -456,24 +455,7 @@
 // Allow targets to reduce the default size of the code cache.
 #define CODE_CACHE_DEFAULT_LIMIT CODE_CACHE_SIZE_LIMIT
 
-#ifdef TARGET_ARCH_x86
-# include "globalDefinitions_x86.hpp"
-#endif
-#ifdef TARGET_ARCH_sparc
-# include "globalDefinitions_sparc.hpp"
-#endif
-#ifdef TARGET_ARCH_zero
-# include "globalDefinitions_zero.hpp"
-#endif
-#ifdef TARGET_ARCH_arm
-# include "globalDefinitions_arm.hpp"
-#endif
-#ifdef TARGET_ARCH_ppc
-# include "globalDefinitions_ppc.hpp"
-#endif
-#ifdef TARGET_ARCH_aarch64
-# include "globalDefinitions_aarch64.hpp"
-#endif
+#include CPU_HEADER(globalDefinitions)
 
 #ifndef INCLUDE_RTM_OPT
 #define INCLUDE_RTM_OPT 0
@@ -951,7 +933,7 @@
   CompLevel_full_profile      = 3,         // C1, invocation & backedge counters + mdo
   CompLevel_full_optimization = 4,         // C2, Shark or JVMCI
 
-#if defined(COMPILER2) || defined(SHARK) || INCLUDE_JVMCI
+#if defined(COMPILER2) || defined(SHARK)
   CompLevel_highest_tier      = CompLevel_full_optimization,  // pure C2 and tiered or JVMCI and tiered
 #elif defined(COMPILER1)
   CompLevel_highest_tier      = CompLevel_simple,             // pure C1 or JVMCI
diff --git a/hotspot/src/share/vm/utilities/globalDefinitions_sparcWorks.hpp b/hotspot/src/share/vm/utilities/globalDefinitions_sparcWorks.hpp
index 755eba0..22f8b4e 100644
--- a/hotspot/src/share/vm/utilities/globalDefinitions_sparcWorks.hpp
+++ b/hotspot/src/share/vm/utilities/globalDefinitions_sparcWorks.hpp
@@ -33,9 +33,6 @@
 
 
 # include <ctype.h>
-#define __USE_LEGACY_PROTOTYPES__
-# include <dirent.h>
-#undef __USE_LEGACY_PROTOTYPES__
 # include <string.h>
 # include <strings.h>     // for bsd'isms
 # include <stdarg.h>
diff --git a/hotspot/src/share/vm/utilities/hashtable.cpp b/hotspot/src/share/vm/utilities/hashtable.cpp
index 2d4bd0b..da3cfde 100644
--- a/hotspot/src/share/vm/utilities/hashtable.cpp
+++ b/hotspot/src/share/vm/utilities/hashtable.cpp
@@ -342,13 +342,18 @@
 
 #ifdef ASSERT
 
-template <MEMFLAGS F> void BasicHashtable<F>::verify_lookup_length(double load) {
-  if ((double)_lookup_length / (double)_lookup_count > load * 2.0) {
+template <MEMFLAGS F> bool BasicHashtable<F>::verify_lookup_length(double load) {
+  if ((!_lookup_warning) && (_lookup_count != 0)
+      && ((double)_lookup_length / (double)_lookup_count > load * 2.0)) {
     warning("Performance bug: SystemDictionary lookup_count=%d "
             "lookup_length=%d average=%lf load=%f",
             _lookup_count, _lookup_length,
-            (double) _lookup_length / _lookup_count, load);
+            (double)_lookup_length / _lookup_count, load);
+    _lookup_warning = true;
+
+    return false;
   }
+  return true;
 }
 
 #endif
diff --git a/hotspot/src/share/vm/utilities/hashtable.hpp b/hotspot/src/share/vm/utilities/hashtable.hpp
index 09c5d58..be8203c 100644
--- a/hotspot/src/share/vm/utilities/hashtable.hpp
+++ b/hotspot/src/share/vm/utilities/hashtable.hpp
@@ -124,9 +124,17 @@
   // Instance variable
   BasicHashtableEntry<F>*       _entry;
 
+#ifdef ASSERT
+private:
+  unsigned _hits;
+public:
+  unsigned hits()   { return _hits; }
+  void count_hit()  { _hits++; }
+#endif
+
 public:
   // Accessing
-  void clear()                        { _entry = NULL; }
+  void clear()                        { _entry = NULL; DEBUG_ONLY(_hits = 0); }
 
   // The following methods use order access methods to avoid race
   // conditions in multiprocessor systems.
@@ -135,6 +143,7 @@
 
   // The following method is not MT-safe and must be done under lock.
   BasicHashtableEntry<F>** entry_addr()  { return &_entry; }
+
 };
 
 
@@ -173,9 +182,10 @@
 protected:
 
 #ifdef ASSERT
+  bool              _lookup_warning;
   mutable int       _lookup_count;
   mutable int       _lookup_length;
-  void verify_lookup_length(double load);
+  bool verify_lookup_length(double load);
 #endif
 
   void initialize(int table_size, int entry_size, int number_of_entries);
@@ -226,6 +236,15 @@
   int number_of_entries() { return _number_of_entries; }
 
   void verify() PRODUCT_RETURN;
+
+#ifdef ASSERT
+  void bucket_count_hit(int i) const {
+    _buckets[i].count_hit();
+  }
+  unsigned bucket_hits(int i) const {
+    return _buckets[i].hits();
+  }
+#endif
 };
 
 
diff --git a/hotspot/src/share/vm/utilities/hashtable.inline.hpp b/hotspot/src/share/vm/utilities/hashtable.inline.hpp
index ee22ba8..8497193 100644
--- a/hotspot/src/share/vm/utilities/hashtable.inline.hpp
+++ b/hotspot/src/share/vm/utilities/hashtable.inline.hpp
@@ -65,6 +65,7 @@
   _end_block = NULL;
   _number_of_entries = number_of_entries;
 #ifdef ASSERT
+  _lookup_warning = false;
   _lookup_count = 0;
   _lookup_length = 0;
 #endif
diff --git a/hotspot/src/share/vm/utilities/macros.hpp b/hotspot/src/share/vm/utilities/macros.hpp
index 62b117e..ebcaaee 100644
--- a/hotspot/src/share/vm/utilities/macros.hpp
+++ b/hotspot/src/share/vm/utilities/macros.hpp
@@ -316,6 +316,7 @@
 #endif
 
 #if defined(__FreeBSD__) || defined(__NetBSD__) || defined(__OpenBSD__) || defined(__APPLE__)
+#define BSD
 #define BSD_ONLY(code) code
 #define NOT_BSD(code)
 #else
@@ -429,6 +430,10 @@
 #define NOT_E500V2(code) code
 #endif
 
+// Note: There are three ARM ports. They set the following in the makefiles:
+// 1. Closed 32-bit port:   -DARM -DARM32           -DTARGET_ARCH_arm
+// 2. Closed 64-bit port:   -DARM -DAARCH64 -D_LP64 -DTARGET_ARCH_arm
+// 3. Open   64-bit port:         -DAARCH64 -D_LP64 -DTARGET_ARCH_aaarch64
 #ifdef ARM
 #define ARM_ONLY(code) code
 #define NOT_ARM(code)
@@ -453,14 +458,32 @@
 #define NOT_AARCH64(code) code
 #endif
 
-#ifdef JAVASE_EMBEDDED
-#define EMBEDDED_ONLY(code) code
-#define NOT_EMBEDDED(code)
-#else
-#define EMBEDDED_ONLY(code)
-#define NOT_EMBEDDED(code) code
-#endif
-
 #define define_pd_global(type, name, value) const type pd_##name = value;
 
+// Helper macros for constructing file names for includes.
+#define CPU_HEADER_STEM(basename) PASTE_TOKENS(basename, INCLUDE_SUFFIX_CPU)
+#define OS_HEADER_STEM(basename) PASTE_TOKENS(basename, INCLUDE_SUFFIX_OS)
+#define OS_CPU_HEADER_STEM(basename) PASTE_TOKENS(basename, PASTE_TOKENS(INCLUDE_SUFFIX_OS, INCLUDE_SUFFIX_CPU))
+
+// Include platform dependent files.
+//
+// This macro constructs from basename and INCLUDE_SUFFIX_OS /
+// INCLUDE_SUFFIX_CPU, which are set on the command line, the name of
+// platform dependent files to be included.
+// Example: INCLUDE_SUFFIX_OS=_linux / INCLUDE_SUFFIX_CPU=_sparc
+//   CPU_HEADER_INLINE(macroAssembler) --> macroAssembler_sparc.inline.hpp
+//   OS_CPU_HEADER(vmStructs)          --> vmStructs_linux_sparc.hpp
+//
+// basename<cpu>.hpp / basename<cpu>.inline.hpp
+#define CPU_HEADER_H(basename)         XSTR(CPU_HEADER_STEM(basename).h)
+#define CPU_HEADER(basename)           XSTR(CPU_HEADER_STEM(basename).hpp)
+#define CPU_HEADER_INLINE(basename)    XSTR(CPU_HEADER_STEM(basename).inline.hpp)
+// basename<os>.hpp / basename<os>.inline.hpp
+#define OS_HEADER_H(basename)          XSTR(OS_HEADER_STEM(basename).h)
+#define OS_HEADER(basename)            XSTR(OS_HEADER_STEM(basename).hpp)
+#define OS_HEADER_INLINE(basename)     XSTR(OS_HEADER_STEM(basename).inline.hpp)
+// basename<os><cpu>.hpp / basename<os><cpu>.inline.hpp
+#define OS_CPU_HEADER(basename)        XSTR(OS_CPU_HEADER_STEM(basename).hpp)
+#define OS_CPU_HEADER_INLINE(basename) XSTR(OS_CPU_HEADER_STEM(basename).inline.hpp)
+
 #endif // SHARE_VM_UTILITIES_MACROS_HPP
diff --git a/hotspot/src/share/vm/utilities/resourceHash.cpp b/hotspot/src/share/vm/utilities/resourceHash.cpp
index 36088ac..7365c0c 100644
--- a/hotspot/src/share/vm/utilities/resourceHash.cpp
+++ b/hotspot/src/share/vm/utilities/resourceHash.cpp
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2015 Oracle and/or its affiliates. All rights reserved.
+ * 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
diff --git a/hotspot/src/share/vm/utilities/resourceHash.hpp b/hotspot/src/share/vm/utilities/resourceHash.hpp
index bfd0a1f..6941d40 100644
--- a/hotspot/src/share/vm/utilities/resourceHash.hpp
+++ b/hotspot/src/share/vm/utilities/resourceHash.hpp
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2012, 2015 Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2012, 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
diff --git a/hotspot/test/TEST.groups b/hotspot/test/TEST.groups
index b46499f..e1bdec2 100644
--- a/hotspot/test/TEST.groups
+++ b/hotspot/test/TEST.groups
@@ -130,8 +130,8 @@
 # Tests that require the full JRE
 #
 needs_jre = \
-  compiler/c2/6852078/Test6852078.java \
-  compiler/c2/7047069/Test7047069.java \
+  compiler/c2/Test6852078.java \
+  compiler/c2/Test7047069.java \
   runtime/6294277/SourceDebugExtension.java \
   runtime/ClassFile/JsrRewriting.java \
   runtime/ClassFile/OomWhileParsingRepeatedJsr.java \
@@ -277,16 +277,16 @@
   compiler/arraycopy/ \
   compiler/c1/ \
   compiler/c2/ \
-  -compiler/c2/5091921/Test6850611.java \
-  -compiler/c2/5091921/Test6890943.java \
-  -compiler/c2/5091921/Test6905845.java \
-  -compiler/c2/6340864 \
-  -compiler/c2/6589834 \
-  -compiler/c2/6603011 \
-  -compiler/c2/6912517 \
-  -compiler/c2/6792161 \
-  -compiler/c2/7070134 \
-  -compiler/c2/8004867
+  -compiler/c2/Test6850611.java \
+  -compiler/c2/cr6890943/Test6890943.java \
+  -compiler/c2/Test6905845.java \
+  -compiler/c2/cr6340864 \
+  -compiler/c2/cr6589834 \
+  -compiler/c2/cr8004867
+  -compiler/c2/stemmer \
+  -compiler/c2/Test6792161.java \
+  -compiler/c2/Test6603011.java \
+  -compiler/c2/Test6912517.java \
 
 hotspot_fast_compiler_2 = \
   compiler/classUnloading/ \
@@ -303,7 +303,7 @@
   compiler/integerArithmetic/ \
   compiler/interpreter/ \
   compiler/jvmci/ \
-  -compiler/codegen/7184394 \
+  -compiler/codegen/aes \
   -compiler/codecache/stress \
   -compiler/gcbarriers/PreserveFPRegistersTest.java
 
@@ -320,13 +320,13 @@
   compiler/types/ \
   compiler/uncommontrap/ \
   compiler/unsafe/ \
-  -compiler/intrinsics/adler32 \
   -compiler/intrinsics/bmi \
   -compiler/intrinsics/mathexact \
-  -compiler/intrinsics/multiplytolen \
   -compiler/intrinsics/sha \
-  -compiler/loopopts/7052494 \
-  -compiler/runtime/6826736
+  -compiler/intrinsics/bigInteger/TestMultiplyToLen.java \
+  -compiler/intrinsics/zip/TestAdler32.java \
+  -compiler/loopopts/Test7052494.java \
+  -compiler/runtime/Test6826736.java
 
 hotspot_fast_compiler_closed = \
   sanity/ExecuteInternalVMTests.java
diff --git a/hotspot/test/compiler/arguments/BMICommandLineOptionTestBase.java b/hotspot/test/compiler/arguments/BMICommandLineOptionTestBase.java
index ae65188..089679d 100644
--- a/hotspot/test/compiler/arguments/BMICommandLineOptionTestBase.java
+++ b/hotspot/test/compiler/arguments/BMICommandLineOptionTestBase.java
@@ -21,7 +21,10 @@
  * questions.
  */
 
-import jdk.test.lib.cli.*;
+package compiler.arguments;
+
+import jdk.test.lib.cli.CPUSpecificCommandLineOptionTest;
+import jdk.test.lib.cli.CommandLineOptionTest;
 
 /**
  * Base class for all X86 bit manipulation related command line options.
diff --git a/hotspot/test/compiler/arguments/BMISupportedCPUTest.java b/hotspot/test/compiler/arguments/BMISupportedCPUTest.java
index 6e73c1a..9582e8f 100644
--- a/hotspot/test/compiler/arguments/BMISupportedCPUTest.java
+++ b/hotspot/test/compiler/arguments/BMISupportedCPUTest.java
@@ -21,8 +21,10 @@
  * questions.
  */
 
-import jdk.test.lib.*;
-import jdk.test.lib.cli.*;
+package compiler.arguments;
+
+import jdk.test.lib.ExitCode;
+import jdk.test.lib.cli.CommandLineOptionTest;
 
 /**
  * Test on bit manipulation related command line options,
diff --git a/hotspot/test/compiler/arguments/BMIUnsupportedCPUTest.java b/hotspot/test/compiler/arguments/BMIUnsupportedCPUTest.java
index 0cb554c..103d2a9 100644
--- a/hotspot/test/compiler/arguments/BMIUnsupportedCPUTest.java
+++ b/hotspot/test/compiler/arguments/BMIUnsupportedCPUTest.java
@@ -21,8 +21,11 @@
  * questions.
  */
 
-import jdk.test.lib.*;
-import jdk.test.lib.cli.*;
+package compiler.arguments;
+
+import jdk.test.lib.ExitCode;
+import jdk.test.lib.Platform;
+import jdk.test.lib.cli.CommandLineOptionTest;
 
 /**
  * Test on bit manipulation related command line options,
diff --git a/hotspot/test/compiler/arguments/CheckCICompilerCount.java b/hotspot/test/compiler/arguments/CheckCICompilerCount.java
index f568dbe..1c361cf 100644
--- a/hotspot/test/compiler/arguments/CheckCICompilerCount.java
+++ b/hotspot/test/compiler/arguments/CheckCICompilerCount.java
@@ -21,19 +21,22 @@
  * questions.
  */
 
-import jdk.test.lib.*;
-
 /*
  * @test CheckCheckCICompilerCount
  * @bug 8130858
  * @bug 8132525
  * @summary Check that correct range of values for CICompilerCount are allowed depending on whether tiered is enabled or not
- * @library /testlibrary
+ * @library /testlibrary /
  * @modules java.base/jdk.internal.misc
  *          java.management
- * @run main CheckCICompilerCount
+ * @run driver compiler.arguments.CheckCICompilerCount
  */
 
+package compiler.arguments;
+
+import jdk.test.lib.OutputAnalyzer;
+import jdk.test.lib.ProcessTools;
+
 public class CheckCICompilerCount {
     private static final String[][] NON_TIERED_ARGUMENTS = {
         {
@@ -72,14 +75,14 @@
             "Improperly specified VM option 'CICompilerCount=0'"
         },
         {
-            "intx CICompilerCount                          := 1                                   {product}"
+            "intx CICompilerCount                          = 1                                        {product} {command line}"
         },
         {
             "CICompilerCount (0) must be at least 1",
             "Improperly specified VM option 'CICompilerCount=0'"
         },
         {
-            "intx CICompilerCount                          := 1                                   {product}"
+            "intx CICompilerCount                          = 1                                        {product} {command line}"
         }
     };
 
@@ -127,14 +130,14 @@
             "Improperly specified VM option 'CICompilerCount=1'"
         },
         {
-            "intx CICompilerCount                          := 2                                   {product}"
+            "intx CICompilerCount                          = 2                                        {product} {command line, ergonomic}"
         },
         {
             "CICompilerCount (1) must be at least 2",
             "Improperly specified VM option 'CICompilerCount=1'"
         },
         {
-            "intx CICompilerCount                          := 2                                   {product}"
+            "intx CICompilerCount                          = 2                                        {product} {command line, ergonomic}"
         }
     };
 
diff --git a/hotspot/test/compiler/arguments/CheckCompileThresholdScaling.java b/hotspot/test/compiler/arguments/CheckCompileThresholdScaling.java
index 653536f..ecfe31d 100644
--- a/hotspot/test/compiler/arguments/CheckCompileThresholdScaling.java
+++ b/hotspot/test/compiler/arguments/CheckCompileThresholdScaling.java
@@ -21,18 +21,21 @@
  * questions.
  */
 
-import jdk.test.lib.*;
-
 /*
  * @test CheckCompileThresholdScaling
  * @bug 8059604
- * @summary "Add CompileThresholdScaling flag to control when methods are first compiled (with +/-TieredCompilation)"
+ * @summary Add CompileThresholdScaling flag to control when methods are first compiled (with +/-TieredCompilation)
  * @library /testlibrary
  * @modules java.base/jdk.internal.misc
  *          java.management
- * @run main CheckCompileThresholdScaling
+ * @run driver compiler.arguments.CheckCompileThresholdScaling
  */
 
+package compiler.arguments;
+
+import jdk.test.lib.OutputAnalyzer;
+import jdk.test.lib.ProcessTools;
+
 public class CheckCompileThresholdScaling {
 
     // The flag CompileThresholdScaling scales compilation thresholds
@@ -105,25 +108,25 @@
 
     private static final String[][] NON_TIERED_EXPECTED_OUTPUTS = {
         {
-            "intx CompileThreshold                         := 1000                                {pd product}",
-            "double CompileThresholdScaling                   = 1.000000                            {product}"
+            "intx CompileThreshold                         = 1000                                  {pd product} {command line}",
+            "double CompileThresholdScaling                  = 1.000000                                 {product} {default}"
         },
         {
-            "intx CompileThreshold                         := 1250                                {pd product}",
-            "double CompileThresholdScaling                  := 1.250000                            {product}"
+            "intx CompileThreshold                         = 1250                                  {pd product} {command line, ergonomic}",
+            "double CompileThresholdScaling                  = 1.250000                                 {product} {command line}"
         },
         {
-            "intx CompileThreshold                         := 750                                 {pd product}",
-            "double CompileThresholdScaling                  := 0.750000                            {product}"
+            "intx CompileThreshold                         = 750                                   {pd product} {command line, ergonomic}",
+            "double CompileThresholdScaling                  = 0.750000                                 {product} {command line}"
         },
         {
-            "intx CompileThreshold                         := 1000                                {pd product}",
-            "double CompileThresholdScaling                  := 0.000000                            {product}",
+            "intx CompileThreshold                         = 1000                                  {pd product} {command line}",
+            "double CompileThresholdScaling                  = 0.000000                                 {product} {command line}",
             "interpreted mode"
         },
         {
-            "intx CompileThreshold                         := 0                                   {pd product}",
-            "double CompileThresholdScaling                  := 0.750000                            {product}",
+            "intx CompileThreshold                         = 0                                     {pd product} {command line, ergonomic}",
+            "double CompileThresholdScaling                  = 0.750000                                 {product} {command line}",
             "interpreted mode"
         }
     };
@@ -237,94 +240,94 @@
 
     private static final String[][] TIERED_EXPECTED_OUTPUTS = {
         {
-            "intx Tier0BackedgeNotifyFreqLog               := 10                                  {product}",
-            "intx Tier0InvokeNotifyFreqLog                 := 7                                   {product}",
-            "intx Tier23InlineeNotifyFreqLog               := 20                                  {product}",
-            "intx Tier2BackedgeNotifyFreqLog               := 14                                  {product}",
-            "intx Tier2InvokeNotifyFreqLog                 := 11                                  {product}",
-            "intx Tier3BackEdgeThreshold                   := 60000                               {product}",
-            "intx Tier3BackedgeNotifyFreqLog               := 13                                  {product}",
-            "intx Tier3CompileThreshold                    := 2000                                {product}",
-            "intx Tier3InvocationThreshold                 := 200                                 {product}",
-            "intx Tier3InvokeNotifyFreqLog                 := 10                                  {product}",
-            "intx Tier3MinInvocationThreshold              := 100                                 {product}",
-            "intx Tier4BackEdgeThreshold                   := 40000                               {product}",
-            "intx Tier4CompileThreshold                    := 15000                               {product}",
-            "intx Tier4InvocationThreshold                 := 5000                                {product}",
-            "intx Tier4MinInvocationThreshold              := 600                                 {product}",
-            "double CompileThresholdScaling                   = 1.000000                            {product}"
+            "intx Tier0BackedgeNotifyFreqLog               = 10                                       {product} {command line}",
+            "intx Tier0InvokeNotifyFreqLog                 = 7                                        {product} {command line}",
+            "intx Tier23InlineeNotifyFreqLog               = 20                                       {product} {command line}",
+            "intx Tier2BackedgeNotifyFreqLog               = 14                                       {product} {command line}",
+            "intx Tier2InvokeNotifyFreqLog                 = 11                                       {product} {command line}",
+            "intx Tier3BackEdgeThreshold                   = 60000                                    {product} {command line}",
+            "intx Tier3BackedgeNotifyFreqLog               = 13                                       {product} {command line}",
+            "intx Tier3CompileThreshold                    = 2000                                     {product} {command line}",
+            "intx Tier3InvocationThreshold                 = 200                                      {product} {command line}",
+            "intx Tier3InvokeNotifyFreqLog                 = 10                                       {product} {command line}",
+            "intx Tier3MinInvocationThreshold              = 100                                      {product} {command line}",
+            "intx Tier4BackEdgeThreshold                   = 40000                                    {product} {command line}",
+            "intx Tier4CompileThreshold                    = 15000                                    {product} {command line}",
+            "intx Tier4InvocationThreshold                 = 5000                                     {product} {command line}",
+            "intx Tier4MinInvocationThreshold              = 600                                      {product} {command line}",
+            "double CompileThresholdScaling                  = 1.000000                                 {product} {default}"
         },
         {
-            "intx Tier0BackedgeNotifyFreqLog               := 9                                   {product}",
-            "intx Tier0InvokeNotifyFreqLog                 := 6                                   {product}",
-            "intx Tier23InlineeNotifyFreqLog               := 19                                  {product}",
-            "intx Tier2BackedgeNotifyFreqLog               := 13                                  {product}",
-            "intx Tier2InvokeNotifyFreqLog                 := 10                                  {product}",
-            "intx Tier3BackEdgeThreshold                   := 45000                               {product}",
-            "intx Tier3BackedgeNotifyFreqLog               := 12                                  {product}",
-            "intx Tier3CompileThreshold                    := 1500                                {product}",
-            "intx Tier3InvocationThreshold                 := 150                                 {product}",
-            "intx Tier3InvokeNotifyFreqLog                 := 9                                   {product}",
-            "intx Tier3MinInvocationThreshold              := 75                                  {product}",
-            "intx Tier4BackEdgeThreshold                   := 30000                               {product}",
-            "intx Tier4CompileThreshold                    := 11250                               {product}",
-            "intx Tier4InvocationThreshold                 := 3750                                {product}",
-            "intx Tier4MinInvocationThreshold              := 450                                 {product}",
-            "double CompileThresholdScaling                  := 0.750000                            {product}"
+            "intx Tier0BackedgeNotifyFreqLog               = 9                                        {product} {command line, ergonomic}",
+            "intx Tier0InvokeNotifyFreqLog                 = 6                                        {product} {command line, ergonomic}",
+            "intx Tier23InlineeNotifyFreqLog               = 19                                       {product} {command line, ergonomic}",
+            "intx Tier2BackedgeNotifyFreqLog               = 13                                       {product} {command line, ergonomic}",
+            "intx Tier2InvokeNotifyFreqLog                 = 10                                       {product} {command line, ergonomic}",
+            "intx Tier3BackEdgeThreshold                   = 45000                                    {product} {command line, ergonomic}",
+            "intx Tier3BackedgeNotifyFreqLog               = 12                                       {product} {command line, ergonomic}",
+            "intx Tier3CompileThreshold                    = 1500                                     {product} {command line, ergonomic}",
+            "intx Tier3InvocationThreshold                 = 150                                      {product} {command line, ergonomic}",
+            "intx Tier3InvokeNotifyFreqLog                 = 9                                        {product} {command line, ergonomic}",
+            "intx Tier3MinInvocationThreshold              = 75                                       {product} {command line, ergonomic}",
+            "intx Tier4BackEdgeThreshold                   = 30000                                    {product} {command line, ergonomic}",
+            "intx Tier4CompileThreshold                    = 11250                                    {product} {command line, ergonomic}",
+            "intx Tier4InvocationThreshold                 = 3750                                     {product} {command line, ergonomic}",
+            "intx Tier4MinInvocationThreshold              = 450                                      {product} {command line, ergonomic}",
+            "double CompileThresholdScaling                  = 0.750000                                 {product} {command line}"
         },
         {
-            "intx Tier0BackedgeNotifyFreqLog               := 10                                  {product}",
-            "intx Tier0InvokeNotifyFreqLog                 := 7                                   {product}",
-            "intx Tier23InlineeNotifyFreqLog               := 20                                  {product}",
-            "intx Tier2BackedgeNotifyFreqLog               := 14                                  {product}",
-            "intx Tier2InvokeNotifyFreqLog                 := 11                                  {product}",
-            "intx Tier3BackEdgeThreshold                   := 75000                               {product}",
-            "intx Tier3BackedgeNotifyFreqLog               := 13                                  {product}",
-            "intx Tier3CompileThreshold                    := 2500                                {product}",
-            "intx Tier3InvocationThreshold                 := 250                                 {product}",
-            "intx Tier3InvokeNotifyFreqLog                 := 10                                  {product}",
-            "intx Tier3MinInvocationThreshold              := 125                                 {product}",
-            "intx Tier4BackEdgeThreshold                   := 50000                               {product}",
-            "intx Tier4CompileThreshold                    := 18750                               {product}",
-            "intx Tier4InvocationThreshold                 := 6250                                {product}",
-            "intx Tier4MinInvocationThreshold              := 750                                 {product}",
-            "double CompileThresholdScaling                  := 1.250000                            {product}"
+            "intx Tier0BackedgeNotifyFreqLog               = 10                                       {product} {command line, ergonomic}",
+            "intx Tier0InvokeNotifyFreqLog                 = 7                                        {product} {command line, ergonomic}",
+            "intx Tier23InlineeNotifyFreqLog               = 20                                       {product} {command line, ergonomic}",
+            "intx Tier2BackedgeNotifyFreqLog               = 14                                       {product} {command line, ergonomic}",
+            "intx Tier2InvokeNotifyFreqLog                 = 11                                       {product} {command line, ergonomic}",
+            "intx Tier3BackEdgeThreshold                   = 75000                                    {product} {command line, ergonomic}",
+            "intx Tier3BackedgeNotifyFreqLog               = 13                                       {product} {command line, ergonomic}",
+            "intx Tier3CompileThreshold                    = 2500                                     {product} {command line, ergonomic}",
+            "intx Tier3InvocationThreshold                 = 250                                      {product} {command line, ergonomic}",
+            "intx Tier3InvokeNotifyFreqLog                 = 10                                       {product} {command line, ergonomic}",
+            "intx Tier3MinInvocationThreshold              = 125                                      {product} {command line, ergonomic}",
+            "intx Tier4BackEdgeThreshold                   = 50000                                    {product} {command line, ergonomic}",
+            "intx Tier4CompileThreshold                    = 18750                                    {product} {command line, ergonomic}",
+            "intx Tier4InvocationThreshold                 = 6250                                     {product} {command line, ergonomic}",
+            "intx Tier4MinInvocationThreshold              = 750                                      {product} {command line, ergonomic}",
+            "double CompileThresholdScaling                  = 1.250000                                 {product} {command line}"
         },
         {
-            "intx Tier0BackedgeNotifyFreqLog               := 11                                  {product}",
-            "intx Tier0InvokeNotifyFreqLog                 := 8                                   {product}",
-            "intx Tier23InlineeNotifyFreqLog               := 21                                  {product}",
-            "intx Tier2BackedgeNotifyFreqLog               := 15                                  {product}",
-            "intx Tier2InvokeNotifyFreqLog                 := 12                                  {product}",
-            "intx Tier3BackEdgeThreshold                   := 120000                              {product}",
-            "intx Tier3BackedgeNotifyFreqLog               := 14                                  {product}",
-            "intx Tier3CompileThreshold                    := 4000                                {product}",
-            "intx Tier3InvocationThreshold                 := 400                                 {product}",
-            "intx Tier3InvokeNotifyFreqLog                 := 11                                  {product}",
-            "intx Tier3MinInvocationThreshold              := 200                                 {product}",
-            "intx Tier4BackEdgeThreshold                   := 80000                               {product}",
-            "intx Tier4CompileThreshold                    := 30000                               {product}",
-            "intx Tier4InvocationThreshold                 := 10000                               {product}",
-            "intx Tier4MinInvocationThreshold              := 1200                                {product}",
-            "double CompileThresholdScaling                  := 2.000000                            {product}"
+            "intx Tier0BackedgeNotifyFreqLog               = 11                                       {product} {command line, ergonomic}",
+            "intx Tier0InvokeNotifyFreqLog                 = 8                                        {product} {command line, ergonomic}",
+            "intx Tier23InlineeNotifyFreqLog               = 21                                       {product} {command line, ergonomic}",
+            "intx Tier2BackedgeNotifyFreqLog               = 15                                       {product} {command line, ergonomic}",
+            "intx Tier2InvokeNotifyFreqLog                 = 12                                       {product} {command line, ergonomic}",
+            "intx Tier3BackEdgeThreshold                   = 120000                                   {product} {command line, ergonomic}",
+            "intx Tier3BackedgeNotifyFreqLog               = 14                                       {product} {command line, ergonomic}",
+            "intx Tier3CompileThreshold                    = 4000                                     {product} {command line, ergonomic}",
+            "intx Tier3InvocationThreshold                 = 400                                      {product} {command line, ergonomic}",
+            "intx Tier3InvokeNotifyFreqLog                 = 11                                       {product} {command line, ergonomic}",
+            "intx Tier3MinInvocationThreshold              = 200                                      {product} {command line, ergonomic}",
+            "intx Tier4BackEdgeThreshold                   = 80000                                    {product} {command line, ergonomic}",
+            "intx Tier4CompileThreshold                    = 30000                                    {product} {command line, ergonomic}",
+            "intx Tier4InvocationThreshold                 = 10000                                    {product} {command line, ergonomic}",
+            "intx Tier4MinInvocationThreshold              = 1200                                     {product} {command line, ergonomic}",
+            "double CompileThresholdScaling                  = 2.000000                                 {product} {command line}"
         },
         {
-            "intx Tier0BackedgeNotifyFreqLog               := 10                                  {product}",
-            "intx Tier0InvokeNotifyFreqLog                 := 7                                   {product}",
-            "intx Tier23InlineeNotifyFreqLog               := 20                                  {product}",
-            "intx Tier2BackedgeNotifyFreqLog               := 14                                  {product}",
-            "intx Tier2InvokeNotifyFreqLog                 := 11                                  {product}",
-            "intx Tier3BackEdgeThreshold                   := 60000                               {product}",
-            "intx Tier3BackedgeNotifyFreqLog               := 13                                  {product}",
-            "intx Tier3CompileThreshold                    := 2000                                {product}",
-            "intx Tier3InvocationThreshold                 := 200                                 {product}",
-            "intx Tier3InvokeNotifyFreqLog                 := 10                                  {product}",
-            "intx Tier3MinInvocationThreshold              := 100                                 {product}",
-            "intx Tier4BackEdgeThreshold                   := 40000                               {product}",
-            "intx Tier4CompileThreshold                    := 15000                               {product}",
-            "intx Tier4InvocationThreshold                 := 5000                                {product}",
-            "intx Tier4MinInvocationThreshold              := 600                                 {product}",
-            "double CompileThresholdScaling                  := 0.000000                            {product}",
+            "intx Tier0BackedgeNotifyFreqLog               = 10                                       {product} {command line}",
+            "intx Tier0InvokeNotifyFreqLog                 = 7                                        {product} {command line}",
+            "intx Tier23InlineeNotifyFreqLog               = 20                                       {product} {command line}",
+            "intx Tier2BackedgeNotifyFreqLog               = 14                                       {product} {command line}",
+            "intx Tier2InvokeNotifyFreqLog                 = 11                                       {product} {command line}",
+            "intx Tier3BackEdgeThreshold                   = 60000                                    {product} {command line}",
+            "intx Tier3BackedgeNotifyFreqLog               = 13                                       {product} {command line}",
+            "intx Tier3CompileThreshold                    = 2000                                     {product} {command line}",
+            "intx Tier3InvocationThreshold                 = 200                                      {product} {command line}",
+            "intx Tier3InvokeNotifyFreqLog                 = 10                                       {product} {command line}",
+            "intx Tier3MinInvocationThreshold              = 100                                      {product} {command line}",
+            "intx Tier4BackEdgeThreshold                   = 40000                                    {product} {command line}",
+            "intx Tier4CompileThreshold                    = 15000                                    {product} {command line}",
+            "intx Tier4InvocationThreshold                 = 5000                                     {product} {command line}",
+            "intx Tier4MinInvocationThreshold              = 600                                      {product} {command line}",
+            "double CompileThresholdScaling                  = 0.000000                                 {product} {command line}",
             "interpreted mode"
         }
     };
diff --git a/hotspot/test/compiler/arguments/TestUseBMI1InstructionsOnSupportedCPU.java b/hotspot/test/compiler/arguments/TestUseBMI1InstructionsOnSupportedCPU.java
index d05a24e..5d7f9fc 100644
--- a/hotspot/test/compiler/arguments/TestUseBMI1InstructionsOnSupportedCPU.java
+++ b/hotspot/test/compiler/arguments/TestUseBMI1InstructionsOnSupportedCPU.java
@@ -26,19 +26,19 @@
  * @bug 8031321
  * @summary Verify processing of UseBMI1Instructions option on CPU with
  *          BMI1 feature support.
- * @library /testlibrary /test/lib
+ * @library /testlibrary /test/lib /
  * @modules java.base/jdk.internal.misc
  *          java.management
- * @build TestUseBMI1InstructionsOnSupportedCPU
- *        BMISupportedCPUTest
- * @run main ClassFileInstaller sun.hotspot.WhiteBox
- *                              sun.hotspot.WhiteBox$WhiteBoxPermission
+ * @build compiler.arguments.TestUseBMI1InstructionsOnSupportedCPU
+ *        compiler.arguments.BMISupportedCPUTest
+ * @run driver ClassFileInstaller sun.hotspot.WhiteBox
+ *                                sun.hotspot.WhiteBox$WhiteBoxPermission
  * @run main/othervm -Xbootclasspath/a:. -XX:+UnlockDiagnosticVMOptions
- *                   -XX:+WhiteBoxAPI TestUseBMI1InstructionsOnSupportedCPU
+ *                   -XX:+WhiteBoxAPI
+ *                   compiler.arguments.TestUseBMI1InstructionsOnSupportedCPU
  */
 
-import sun.hotspot.cpuinfo.CPUInfo;
-import jdk.test.lib.*;
+package compiler.arguments;
 
 public class TestUseBMI1InstructionsOnSupportedCPU
      extends BMISupportedCPUTest {
diff --git a/hotspot/test/compiler/arguments/TestUseBMI1InstructionsOnUnsupportedCPU.java b/hotspot/test/compiler/arguments/TestUseBMI1InstructionsOnUnsupportedCPU.java
index 716e069..4fd996f 100644
--- a/hotspot/test/compiler/arguments/TestUseBMI1InstructionsOnUnsupportedCPU.java
+++ b/hotspot/test/compiler/arguments/TestUseBMI1InstructionsOnUnsupportedCPU.java
@@ -26,20 +26,19 @@
  * @bug 8031321
  * @summary Verify processing of UseBMI1Instructions option on CPU without
  *          BMI1 feature support.
- * @library /testlibrary /test/lib
+ * @library /testlibrary /test/lib /
  * @modules java.base/jdk.internal.misc
  *          java.management
- * @build TestUseBMI1InstructionsOnUnsupportedCPU
- *        BMIUnsupportedCPUTest
- * @run main ClassFileInstaller sun.hotspot.WhiteBox
- *                              sun.hotspot.WhiteBox$WhiteBoxPermission
+ * @build compiler.arguments.TestUseBMI1InstructionsOnUnsupportedCPU
+ *        compiler.arguments.BMIUnsupportedCPUTest
+ * @run driver ClassFileInstaller sun.hotspot.WhiteBox
+ *                                sun.hotspot.WhiteBox$WhiteBoxPermission
  * @run main/othervm -Xbootclasspath/a:. -XX:+UnlockDiagnosticVMOptions
- *                   -XX:+WhiteBoxAPI TestUseBMI1InstructionsOnUnsupportedCPU
+ *                   -XX:+WhiteBoxAPI
+ *                   compiler.arguments.TestUseBMI1InstructionsOnUnsupportedCPU
  */
 
-import sun.hotspot.cpuinfo.CPUInfo;
-import jdk.test.lib.*;
-import jdk.test.lib.cli.*;
+package compiler.arguments;
 
 public class TestUseBMI1InstructionsOnUnsupportedCPU
       extends BMIUnsupportedCPUTest {
diff --git a/hotspot/test/compiler/arguments/TestUseCompiler.java b/hotspot/test/compiler/arguments/TestUseCompiler.java
index edf3540..75f229e 100644
--- a/hotspot/test/compiler/arguments/TestUseCompiler.java
+++ b/hotspot/test/compiler/arguments/TestUseCompiler.java
@@ -25,10 +25,13 @@
  * @test TestUseCompiler
  * @bug 8086068
  * @summary Tests execution with inconsistent UseCompiler flag combination.
- * @run main/othervm -Xint -XX:+UseCompiler TestUseCompiler
- * @run main/othervm -XX:+UseCompiler -Xint TestUseCompiler
+ *
+ * @run main/othervm -Xint -XX:+UseCompiler compiler.arguments.TestUseCompiler
+ * @run main/othervm -XX:+UseCompiler -Xint compiler.arguments.TestUseCompiler
  */
 
+package compiler.arguments;
+
 public class TestUseCompiler {
 
     public static void main(String args[]) {
diff --git a/hotspot/test/compiler/arguments/TestUseCountLeadingZerosInstructionOnSupportedCPU.java b/hotspot/test/compiler/arguments/TestUseCountLeadingZerosInstructionOnSupportedCPU.java
index 0ffa6ea..3ebd44d 100644
--- a/hotspot/test/compiler/arguments/TestUseCountLeadingZerosInstructionOnSupportedCPU.java
+++ b/hotspot/test/compiler/arguments/TestUseCountLeadingZerosInstructionOnSupportedCPU.java
@@ -26,20 +26,19 @@
  * @bug 8031321
  * @summary Verify processing of UseCountLeadingZerosInstruction option
  *          on CPU with LZCNT support.
- * @library /testlibrary /test/lib
+ * @library /testlibrary /test/lib /
  * @modules java.base/jdk.internal.misc
  *          java.management
- * @build TestUseCountLeadingZerosInstructionOnSupportedCPU
- *        BMISupportedCPUTest
- * @run main ClassFileInstaller sun.hotspot.WhiteBox
- *                              sun.hotspot.WhiteBox$WhiteBoxPermission
+ *
+ * @build compiler.arguments.TestUseCountLeadingZerosInstructionOnSupportedCPU
+ * @run driver ClassFileInstaller sun.hotspot.WhiteBox
+ *                                sun.hotspot.WhiteBox$WhiteBoxPermission
  * @run main/othervm -Xbootclasspath/a:. -XX:+UnlockDiagnosticVMOptions
  *                   -XX:+WhiteBoxAPI
- *                   TestUseCountLeadingZerosInstructionOnSupportedCPU
+ *                   compiler.arguments.TestUseCountLeadingZerosInstructionOnSupportedCPU
  */
 
-import sun.hotspot.cpuinfo.CPUInfo;
-import jdk.test.lib.*;
+package compiler.arguments;
 
 public class TestUseCountLeadingZerosInstructionOnSupportedCPU
      extends BMISupportedCPUTest {
diff --git a/hotspot/test/compiler/arguments/TestUseCountLeadingZerosInstructionOnUnsupportedCPU.java b/hotspot/test/compiler/arguments/TestUseCountLeadingZerosInstructionOnUnsupportedCPU.java
index 1209315..4285c27 100644
--- a/hotspot/test/compiler/arguments/TestUseCountLeadingZerosInstructionOnUnsupportedCPU.java
+++ b/hotspot/test/compiler/arguments/TestUseCountLeadingZerosInstructionOnUnsupportedCPU.java
@@ -26,20 +26,19 @@
  * @bug 8031321
  * @summary Verify processing of UseCountLeadingZerosInstruction option
  *          on CPU without LZCNT support.
- * @library /testlibrary /test/lib
+ * @library /testlibrary /test/lib /
  * @modules java.base/jdk.internal.misc
  *          java.management
- * @build TestUseCountLeadingZerosInstructionOnUnsupportedCPU
- *        BMIUnsupportedCPUTest
- * @run main ClassFileInstaller sun.hotspot.WhiteBox
- *                              sun.hotspot.WhiteBox$WhiteBoxPermission
+ *
+ * @build compiler.arguments.TestUseCountLeadingZerosInstructionOnUnsupportedCPU
+ * @run driver ClassFileInstaller sun.hotspot.WhiteBox
+ *                                sun.hotspot.WhiteBox$WhiteBoxPermission
  * @run main/othervm -Xbootclasspath/a:. -XX:+UnlockDiagnosticVMOptions
  *                   -XX:+WhiteBoxAPI
- *                   TestUseCountLeadingZerosInstructionOnUnsupportedCPU
+ *                   compiler.arguments.TestUseCountLeadingZerosInstructionOnUnsupportedCPU
  */
 
-import sun.hotspot.cpuinfo.CPUInfo;
-import jdk.test.lib.*;
+package compiler.arguments;
 
 public class TestUseCountLeadingZerosInstructionOnUnsupportedCPU
      extends BMIUnsupportedCPUTest {
diff --git a/hotspot/test/compiler/arguments/TestUseCountTrailingZerosInstructionOnSupportedCPU.java b/hotspot/test/compiler/arguments/TestUseCountTrailingZerosInstructionOnSupportedCPU.java
index 397bdc9..3e988e6 100644
--- a/hotspot/test/compiler/arguments/TestUseCountTrailingZerosInstructionOnSupportedCPU.java
+++ b/hotspot/test/compiler/arguments/TestUseCountTrailingZerosInstructionOnSupportedCPU.java
@@ -26,21 +26,21 @@
  * @bug 8031321
  * @summary Verify processing of UseCountTrailingZerosInstruction option
  *          on CPU with TZCNT (BMI1 feature) support.
- * @library /testlibrary /test/lib
+ * @library /testlibrary /test/lib /
  * @modules java.base/jdk.internal.misc
  *          java.management
- * @build TestUseCountTrailingZerosInstructionOnSupportedCPU
- *        BMISupportedCPUTest
- * @run main ClassFileInstaller sun.hotspot.WhiteBox
- *                              sun.hotspot.WhiteBox$WhiteBoxPermission
+ *
+ * @build compiler.arguments.TestUseCountTrailingZerosInstructionOnSupportedCPU
+ * @run driver ClassFileInstaller sun.hotspot.WhiteBox
+ *                                sun.hotspot.WhiteBox$WhiteBoxPermission
  * @run main/othervm -Xbootclasspath/a:. -XX:+UnlockDiagnosticVMOptions
  *                   -XX:+WhiteBoxAPI
- *                   TestUseCountTrailingZerosInstructionOnSupportedCPU
+ *                   compiler.arguments.TestUseCountTrailingZerosInstructionOnSupportedCPU
  */
 
-import sun.hotspot.cpuinfo.CPUInfo;
-import jdk.test.lib.*;
-import jdk.test.lib.cli.*;
+package compiler.arguments;
+
+import jdk.test.lib.cli.CommandLineOptionTest;
 
 public class TestUseCountTrailingZerosInstructionOnSupportedCPU
         extends BMISupportedCPUTest {
diff --git a/hotspot/test/compiler/arguments/TestUseCountTrailingZerosInstructionOnUnsupportedCPU.java b/hotspot/test/compiler/arguments/TestUseCountTrailingZerosInstructionOnUnsupportedCPU.java
index 73aad61..96ccd67 100644
--- a/hotspot/test/compiler/arguments/TestUseCountTrailingZerosInstructionOnUnsupportedCPU.java
+++ b/hotspot/test/compiler/arguments/TestUseCountTrailingZerosInstructionOnUnsupportedCPU.java
@@ -26,21 +26,21 @@
  * @bug 8031321
  * @summary Verify processing of UseCountTrailingZerosInstruction option
  *          on CPU without TZCNT instruction (BMI1 feature) support.
- * @library /testlibrary /test/lib
+ * @library /testlibrary /test/lib /
  * @modules java.base/jdk.internal.misc
  *          java.management
- * @build TestUseCountTrailingZerosInstructionOnUnsupportedCPU
- *        BMIUnsupportedCPUTest
- * @run main ClassFileInstaller sun.hotspot.WhiteBox
- *                              sun.hotspot.WhiteBox$WhiteBoxPermission
+ *
+ * @build compiler.arguments.TestUseCountTrailingZerosInstructionOnUnsupportedCPU
+ * @run driver ClassFileInstaller sun.hotspot.WhiteBox
+ *                                sun.hotspot.WhiteBox$WhiteBoxPermission
  * @run main/othervm -Xbootclasspath/a:. -XX:+UnlockDiagnosticVMOptions
  *                   -XX:+WhiteBoxAPI
- *                   TestUseCountTrailingZerosInstructionOnUnsupportedCPU
+ *                   compiler.arguments.TestUseCountTrailingZerosInstructionOnUnsupportedCPU
  */
 
-import sun.hotspot.cpuinfo.CPUInfo;
-import jdk.test.lib.*;
-import jdk.test.lib.cli.*;
+package compiler.arguments;
+
+import jdk.test.lib.cli.CommandLineOptionTest;
 
 public class TestUseCountTrailingZerosInstructionOnUnsupportedCPU
         extends BMIUnsupportedCPUTest {
diff --git a/hotspot/test/compiler/arraycopy/TestArrayCloneBadAssert.java b/hotspot/test/compiler/arraycopy/TestArrayCloneBadAssert.java
index a603333..7203ca2 100644
--- a/hotspot/test/compiler/arraycopy/TestArrayCloneBadAssert.java
+++ b/hotspot/test/compiler/arraycopy/TestArrayCloneBadAssert.java
@@ -25,10 +25,14 @@
  * @test
  * @bug 8073792
  * @summary assert broken when array size becomes known during igvn
- * @run main/othervm -Xcomp -XX:CompileOnly=TestArrayCloneBadAssert.m TestArrayCloneBadAssert
  *
+ * @run main/othervm -Xcomp
+ *      -XX:CompileCommand=compileonly,compiler.arraycopy.TestArrayCloneBadAssert::m
+ *      compiler.arraycopy.TestArrayCloneBadAssert
  */
 
+package compiler.arraycopy;
+
 public class TestArrayCloneBadAssert {
 
     static final int[] array = new int[5];
diff --git a/hotspot/test/compiler/arraycopy/TestArrayCopyAsLoadsStores.java b/hotspot/test/compiler/arraycopy/TestArrayCopyAsLoadsStores.java
index 6a1b4e6..4c4c388 100644
--- a/hotspot/test/compiler/arraycopy/TestArrayCopyAsLoadsStores.java
+++ b/hotspot/test/compiler/arraycopy/TestArrayCopyAsLoadsStores.java
@@ -25,13 +25,22 @@
  * @test
  * @bug 6912521
  * @summary small array copy as loads/stores
- * @compile TestArrayCopyAsLoadsStores.java TestArrayCopyUtils.java
- * @run main/othervm -ea -XX:-BackgroundCompilation -XX:-UseOnStackReplacement -XX:CompileCommand=dontinline,TestArrayCopyAsLoadsStores::m* -XX:TypeProfileLevel=200 TestArrayCopyAsLoadsStores
- * @run main/othervm -ea -XX:-BackgroundCompilation -XX:-UseOnStackReplacement -XX:CompileCommand=dontinline,TestArrayCopyAsLoadsStores::m* -XX:+IgnoreUnrecognizedVMOptions -XX:+StressArrayCopyMacroNode -XX:TypeProfileLevel=200 TestArrayCopyAsLoadsStores
+ * @library /
  *
+ * @run main/othervm -ea -XX:-BackgroundCompilation -XX:-UseOnStackReplacement
+ *                   -XX:CompileCommand=dontinline,compiler.arraycopy.TestArrayCopyAsLoadsStores::m*
+ *                   -XX:TypeProfileLevel=200
+ *                   compiler.arraycopy.TestArrayCopyAsLoadsStores
+ * @run main/othervm -ea -XX:-BackgroundCompilation -XX:-UseOnStackReplacement
+ *                   -XX:CompileCommand=dontinline,compiler.arraycopy.TestArrayCopyAsLoadsStores::m*
+ *                   -XX:TypeProfileLevel=200
+ *                   -XX:+IgnoreUnrecognizedVMOptions -XX:+StressArrayCopyMacroNode
+ *                   compiler.arraycopy.TestArrayCopyAsLoadsStores
  */
 
-import java.util.*;
+package compiler.arraycopy;
+
+import java.util.Arrays;
 
 public class TestArrayCopyAsLoadsStores extends TestArrayCopyUtils {
 
diff --git a/hotspot/test/compiler/arraycopy/TestArrayCopyBadReexec.java b/hotspot/test/compiler/arraycopy/TestArrayCopyBadReexec.java
index 09b03328..93eb1b2 100644
--- a/hotspot/test/compiler/arraycopy/TestArrayCopyBadReexec.java
+++ b/hotspot/test/compiler/arraycopy/TestArrayCopyBadReexec.java
@@ -25,10 +25,13 @@
  * @test
  * @bug 8073866
  * @summary Fix for 8064703 may also cause stores between the allocation and arraycopy to be rexecuted after a deoptimization
- * @run main/othervm -XX:-BackgroundCompilation -XX:-UseOnStackReplacement TestArrayCopyBadReexec
  *
+ * @run main/othervm -XX:-BackgroundCompilation -XX:-UseOnStackReplacement
+ *                   compiler.arraycopy.TestArrayCopyBadReexec
  */
 
+package compiler.arraycopy;
+
 public class TestArrayCopyBadReexec {
 
     static int val;
diff --git a/hotspot/test/compiler/arraycopy/TestArrayCopyMacro.java b/hotspot/test/compiler/arraycopy/TestArrayCopyMacro.java
index 9a451af..15b2e73 100644
--- a/hotspot/test/compiler/arraycopy/TestArrayCopyMacro.java
+++ b/hotspot/test/compiler/arraycopy/TestArrayCopyMacro.java
@@ -25,10 +25,13 @@
  * @test
  * @bug 7173584
  * @summary arraycopy as macro node
- * @run main/othervm -XX:-BackgroundCompilation -XX:-UseOnStackReplacement TestArrayCopyMacro
  *
+ * @run main/othervm -XX:-BackgroundCompilation -XX:-UseOnStackReplacement
+ *                   compiler.arraycopy.TestArrayCopyMacro
  */
 
+package compiler.arraycopy;
+
 public class TestArrayCopyMacro {
     static class A {
     }
diff --git a/hotspot/test/compiler/arraycopy/TestArrayCopyNoInit.java b/hotspot/test/compiler/arraycopy/TestArrayCopyNoInit.java
index 8d9978a..828fb5a 100644
--- a/hotspot/test/compiler/arraycopy/TestArrayCopyNoInit.java
+++ b/hotspot/test/compiler/arraycopy/TestArrayCopyNoInit.java
@@ -25,10 +25,13 @@
  * @test
  * @bug 8064703
  * @summary Deoptimization between array allocation and arraycopy may result in non initialized array
- * @run main/othervm -XX:-BackgroundCompilation -XX:-UseOnStackReplacement -XX:TypeProfileLevel=020 TestArrayCopyNoInit
  *
+ * @run main/othervm -XX:-BackgroundCompilation -XX:-UseOnStackReplacement -XX:TypeProfileLevel=020
+ *                   compiler.arraycopy.TestArrayCopyNoInit
  */
 
+package compiler.arraycopy;
+
 public class TestArrayCopyNoInit {
 
     static int[] m1(int[] src) {
diff --git a/hotspot/test/compiler/arraycopy/TestArrayCopyNoInitDeopt.java b/hotspot/test/compiler/arraycopy/TestArrayCopyNoInitDeopt.java
index 6451b38..c3ee9a4 100644
--- a/hotspot/test/compiler/arraycopy/TestArrayCopyNoInitDeopt.java
+++ b/hotspot/test/compiler/arraycopy/TestArrayCopyNoInitDeopt.java
@@ -25,22 +25,26 @@
  * @test
  * @bug 8072016
  * @summary Infinite deoptimization/recompilation cycles in case of arraycopy with tightly coupled allocation
+ * @requires vm.flavor == "server"
  * @library /testlibrary /test/lib /
  * @modules java.base/jdk.internal.misc
  *          java.management
- * @build TestArrayCopyNoInitDeopt
- * @run driver ClassFileInstaller sun.hotspot.WhiteBox
+ *
+ * @build compiler.arraycopy.TestArrayCopyNoInitDeopt
+ * @run driver ClassFileInstaller sun.hotspot.WhiteBox sun.hotspot.WhiteBox$WhiteBoxPermission
  *                                jdk.test.lib.Platform
  * @run main/othervm -Xmixed -Xbootclasspath/a:. -XX:+UnlockDiagnosticVMOptions -XX:+WhiteBoxAPI
  *                   -XX:-BackgroundCompilation -XX:-UseOnStackReplacement -XX:TypeProfileLevel=020
- *                   TestArrayCopyNoInitDeopt
+ *                   compiler.arraycopy.TestArrayCopyNoInitDeopt
  */
 
-import sun.hotspot.WhiteBox;
-import sun.hotspot.code.NMethod;
-import jdk.test.lib.Platform;
-import java.lang.reflect.*;
+package compiler.arraycopy;
+
 import compiler.whitebox.CompilerWhiteBoxTest;
+import jdk.test.lib.Platform;
+import sun.hotspot.WhiteBox;
+
+import java.lang.reflect.Method;
 
 public class TestArrayCopyNoInitDeopt {
 
@@ -83,9 +87,11 @@
     }
 
     static public void main(String[] args) throws Exception {
+        if (!Platform.isServer()) {
+            throw new Error("TESTBUG: Not server VM");
+        }
         // Only execute if C2 is available
-        if (Platform.isServer() &&
-            TIERED_STOP_AT_LEVEL == CompilerWhiteBoxTest.COMP_LEVEL_FULL_OPTIMIZATION) {
+        if (TIERED_STOP_AT_LEVEL == CompilerWhiteBoxTest.COMP_LEVEL_FULL_OPTIMIZATION) {
             int[] src = new int[10];
             Object src_obj = new Object();
             Method method_m1 = TestArrayCopyNoInitDeopt.class.getMethod("m1", Object.class);
diff --git a/hotspot/test/compiler/arraycopy/TestArrayCopyOfStopped.java b/hotspot/test/compiler/arraycopy/TestArrayCopyOfStopped.java
index 1d60235..d2a9d45 100644
--- a/hotspot/test/compiler/arraycopy/TestArrayCopyOfStopped.java
+++ b/hotspot/test/compiler/arraycopy/TestArrayCopyOfStopped.java
@@ -25,10 +25,13 @@
  * @test
  * @bug 8074676
  * @summary after guards in Arrays.copyOf() intrinsic, control may become top
- * @run main/othervm -XX:-BackgroundCompilation -XX:-UseOnStackReplacement TestArrayCopyOfStopped
  *
+ * @run main/othervm -XX:-BackgroundCompilation -XX:-UseOnStackReplacement
+ *                   compiler.arraycopy.TestArrayCopyOfStopped
  */
 
+package compiler.arraycopy;
+
 import java.util.Arrays;
 
 public class TestArrayCopyOfStopped {
diff --git a/hotspot/test/compiler/arraycopy/TestArrayCopyOverflowArguments.java b/hotspot/test/compiler/arraycopy/TestArrayCopyOverflowArguments.java
index 1bfaa35..bc23717 100644
--- a/hotspot/test/compiler/arraycopy/TestArrayCopyOverflowArguments.java
+++ b/hotspot/test/compiler/arraycopy/TestArrayCopyOverflowArguments.java
@@ -28,10 +28,13 @@
  *          are properly sign extended to 64 bit (e.g., PPC64, s390x). This can fail
  *          if slow_arraycopy_C() is commpiled by the C compiler without any imlicit
  *          casts (as spill stores to the stack that are done with 4-byte instruction).
- * @run main/othervm -XX:-BackgroundCompilation -XX:-UseOnStackReplacement TestArrayCopyOverflowArguments
  *
+ * @run main/othervm -XX:-BackgroundCompilation -XX:-UseOnStackReplacement
+ *                   compiler.arraycopy.TestArrayCopyOverflowArguments
  */
 
+package compiler.arraycopy;
+
 public class TestArrayCopyOverflowArguments {
 
     // Without volatile the overflowing computation was moved up and then
diff --git a/hotspot/test/compiler/arraycopy/TestArrayCopyOverflowInBoundChecks.java b/hotspot/test/compiler/arraycopy/TestArrayCopyOverflowInBoundChecks.java
index 883df96..b45bbce 100644
--- a/hotspot/test/compiler/arraycopy/TestArrayCopyOverflowInBoundChecks.java
+++ b/hotspot/test/compiler/arraycopy/TestArrayCopyOverflowInBoundChecks.java
@@ -25,9 +25,13 @@
  * @test
  * @bug 8134468
  * @summary test that checks whether an array load falls into the range of an arraycopy is incorrect on 32bits
- * @run main/othervm -XX:-BackgroundCompilation -XX:-UseOnStackReplacement TestArrayCopyOverflowInBoundChecks
  *
+ * @run main/othervm -XX:-BackgroundCompilation -XX:-UseOnStackReplacement
+ *                    compiler.arraycopy.TestArrayCopyOverflowInBoundChecks
  */
+
+package compiler.arraycopy;
+
 public class TestArrayCopyOverflowInBoundChecks {
 
     static byte[] src_array = { 'a', 'b', 'c', 'd', 'e' };
diff --git a/hotspot/test/compiler/arraycopy/TestArrayCopyStoppedAfterGuards.java b/hotspot/test/compiler/arraycopy/TestArrayCopyStoppedAfterGuards.java
index c75a696..05f1c24 100644
--- a/hotspot/test/compiler/arraycopy/TestArrayCopyStoppedAfterGuards.java
+++ b/hotspot/test/compiler/arraycopy/TestArrayCopyStoppedAfterGuards.java
@@ -25,10 +25,16 @@
  * @test
  * @bug 8075921
  * @summary control becomes top after arraycopy guards and confuses tighly coupled allocation logic
- * @run main/othervm -Xcomp -XX:CompileOnly=TestArrayCopyStoppedAfterGuards.test,System.arraycopy TestArrayCopyStoppedAfterGuards
+ *
+ * @run main/othervm -Xcomp
+ *      -XX:CompileCommand=compileonly,java.lang.System::arraycopy
+ *      -XX:CompileCommand=compileonly,compiler.arraycopy.TestArrayCopyStoppedAfterGuards::test
+ *      compiler.arraycopy.TestArrayCopyStoppedAfterGuards
  *
  */
 
+package compiler.arraycopy;
+
 public class TestArrayCopyStoppedAfterGuards {
 
     static void test() {
diff --git a/hotspot/test/compiler/arraycopy/TestArrayCopyUtils.java b/hotspot/test/compiler/arraycopy/TestArrayCopyUtils.java
index de6af41..990400d 100644
--- a/hotspot/test/compiler/arraycopy/TestArrayCopyUtils.java
+++ b/hotspot/test/compiler/arraycopy/TestArrayCopyUtils.java
@@ -21,9 +21,13 @@
  * questions.
  */
 
-import java.lang.annotation.*;
-import java.lang.reflect.*;
-import java.util.*;
+package compiler.arraycopy;
+
+import java.lang.annotation.Retention;
+import java.lang.annotation.RetentionPolicy;
+import java.lang.reflect.Method;
+import java.lang.reflect.Modifier;
+import java.util.HashMap;
 
 abstract class TestArrayCopyUtils {
     public enum ArraySrc {
diff --git a/hotspot/test/compiler/arraycopy/TestArraysCopyOfNoTypeCheck.java b/hotspot/test/compiler/arraycopy/TestArraysCopyOfNoTypeCheck.java
index b24bc3b..f78e3e2 100644
--- a/hotspot/test/compiler/arraycopy/TestArraysCopyOfNoTypeCheck.java
+++ b/hotspot/test/compiler/arraycopy/TestArraysCopyOfNoTypeCheck.java
@@ -25,10 +25,13 @@
  * @test
  * @bug 8055910
  * @summary Arrays.copyOf doesn't perform subtype check
- * @run main/othervm -XX:-BackgroundCompilation -XX:-UseOnStackReplacement TestArraysCopyOfNoTypeCheck
  *
+ * @run main/othervm -XX:-BackgroundCompilation -XX:-UseOnStackReplacement
+ *                   compiler.arraycopy.TestArraysCopyOfNoTypeCheck
  */
 
+package compiler.arraycopy;
+
 import java.util.Arrays;
 
 public class TestArraysCopyOfNoTypeCheck {
diff --git a/hotspot/test/compiler/arraycopy/TestDeadArrayCopyOnMemChain.java b/hotspot/test/compiler/arraycopy/TestDeadArrayCopyOnMemChain.java
index 1492254..d175182 100644
--- a/hotspot/test/compiler/arraycopy/TestDeadArrayCopyOnMemChain.java
+++ b/hotspot/test/compiler/arraycopy/TestDeadArrayCopyOnMemChain.java
@@ -25,10 +25,13 @@
  * @test
  * @bug 8080699
  * @summary eliminated arraycopy node still reachable through exception edges
- * @run main/othervm -XX:-UseOnStackReplacement -XX:-BackgroundCompilation TestDeadArrayCopyOnMemChain
  *
+ * @run main/othervm -XX:-UseOnStackReplacement -XX:-BackgroundCompilation
+ *                   compiler.arraycopy.TestDeadArrayCopyOnMemChain
  */
 
+package compiler.arraycopy;
+
 public class TestDeadArrayCopyOnMemChain {
     static class A {
         int f;
diff --git a/hotspot/test/compiler/arraycopy/TestEliminateArrayCopy.java b/hotspot/test/compiler/arraycopy/TestEliminateArrayCopy.java
index 624a65c..3364ffa 100644
--- a/hotspot/test/compiler/arraycopy/TestEliminateArrayCopy.java
+++ b/hotspot/test/compiler/arraycopy/TestEliminateArrayCopy.java
@@ -25,11 +25,16 @@
  * @test
  * @bug 8076188
  * @summary arraycopy to non escaping destination may be eliminated
- * @compile TestEliminateArrayCopy.java TestArrayCopyUtils.java
- * @run main/othervm -ea -XX:-BackgroundCompilation -XX:-UseOnStackReplacement -XX:CompileCommand=dontinline,TestEliminateArrayCopy*::m* TestEliminateArrayCopy
+ * @library /
+ *
+ * @run main/othervm -ea -XX:-BackgroundCompilation -XX:-UseOnStackReplacement
+ *                   -XX:CompileCommand=dontinline,compiler.arraycopy.TestEliminateArrayCopy*::m*
+ *                   compiler.arraycopy.TestEliminateArrayCopy
  *
  */
 
+package compiler.arraycopy;
+
 public class TestEliminateArrayCopy {
 
     static class CloneTests extends TestInstanceCloneUtils {
diff --git a/hotspot/test/compiler/arraycopy/TestEliminatedArrayCopyDeopt.java b/hotspot/test/compiler/arraycopy/TestEliminatedArrayCopyDeopt.java
index fb98c65..80f81c6 100644
--- a/hotspot/test/compiler/arraycopy/TestEliminatedArrayCopyDeopt.java
+++ b/hotspot/test/compiler/arraycopy/TestEliminatedArrayCopyDeopt.java
@@ -25,8 +25,12 @@
  * @test
  * @bug 8130847 8156760
  * @summary Eliminated instance/array written to by an array copy variant must be correctly initialized when reallocated at a deopt
- * @run main/othervm -XX:-BackgroundCompilation -XX:-UseOnStackReplacement TestEliminatedArrayCopyDeopt
- * @run main/othervm -XX:-BackgroundCompilation -XX:-UseOnStackReplacement -XX:+IgnoreUnrecognizedVMOptions -XX:-ReduceInitialCardMarks TestEliminatedArrayCopyDeopt
+ * @ignore 8136818
+ * @run main/othervm -XX:-BackgroundCompilation -XX:-UseOnStackReplacement
+ *                   compiler.arraycopy.TestEliminatedArrayCopyDeopt
+ * @run main/othervm -XX:-BackgroundCompilation -XX:-UseOnStackReplacement
+ *                   -XX:+IgnoreUnrecognizedVMOptions -XX:-ReduceInitialCardMarks
+ *                   compiler.arraycopy.TestEliminatedArrayCopyDeopt
  */
 
 // Test that if an ArrayCopy node is eliminated because it doesn't
@@ -34,6 +38,8 @@
 // on a deoptimization, when the object/array is reallocated, it is
 // correctly initialized
 
+package compiler.arraycopy;
+
 public class TestEliminatedArrayCopyDeopt {
 
     static class A implements Cloneable {
diff --git a/hotspot/test/compiler/arraycopy/TestEliminatedArrayCopyPhi.java b/hotspot/test/compiler/arraycopy/TestEliminatedArrayCopyPhi.java
index 83edd32..62d55b9 100644
--- a/hotspot/test/compiler/arraycopy/TestEliminatedArrayCopyPhi.java
+++ b/hotspot/test/compiler/arraycopy/TestEliminatedArrayCopyPhi.java
@@ -25,10 +25,13 @@
  * @test
  * @bug 8134321
  * @summary Code that capture field values of eliminated allocation at a safepoint when there's an arraycopy behind a Phi is broken
- * @run main/othervm -XX:-BackgroundCompilation -XX:-UseOnStackReplacement TestEliminatedArrayCopyPhi
  *
+ * @run main/othervm -XX:-BackgroundCompilation -XX:-UseOnStackReplacement
+ *                   compiler.arraycopy.TestEliminatedArrayCopyPhi
  */
 
+package compiler.arraycopy;
+
 public class TestEliminatedArrayCopyPhi {
 
     static int[] escaped;
diff --git a/hotspot/test/compiler/arraycopy/TestEliminatedArrayLoopPredicateCopyDeopt.java b/hotspot/test/compiler/arraycopy/TestEliminatedArrayLoopPredicateCopyDeopt.java
index d0ce772..b7e677c 100644
--- a/hotspot/test/compiler/arraycopy/TestEliminatedArrayLoopPredicateCopyDeopt.java
+++ b/hotspot/test/compiler/arraycopy/TestEliminatedArrayLoopPredicateCopyDeopt.java
@@ -25,10 +25,13 @@
  * @test
  * @bug 8134974
  * @summary Cannot pin eliminated arraycopy loads for deopt state in uncommon trap path if it is a loop predicate unc
- * @run main/othervm -XX:-BackgroundCompilation -XX:-UseOnStackReplacement TestEliminatedArrayLoopPredicateCopyDeopt
  *
+ * @run main/othervm -XX:-BackgroundCompilation -XX:-UseOnStackReplacement
+ *                   compiler.arraycopy.TestEliminatedArrayLoopPredicateCopyDeopt
  */
 
+package compiler.arraycopy;
+
 public class TestEliminatedArrayLoopPredicateCopyDeopt {
 
     static boolean test(int[] array_src) {
diff --git a/hotspot/test/compiler/arraycopy/TestInstanceCloneAsLoadsStores.java b/hotspot/test/compiler/arraycopy/TestInstanceCloneAsLoadsStores.java
index 640c686..fd3b64d 100644
--- a/hotspot/test/compiler/arraycopy/TestInstanceCloneAsLoadsStores.java
+++ b/hotspot/test/compiler/arraycopy/TestInstanceCloneAsLoadsStores.java
@@ -25,12 +25,23 @@
  * @test
  * @bug 6700100 8156760
  * @summary small instance clone as loads/stores
- * @compile TestInstanceCloneAsLoadsStores.java TestInstanceCloneUtils.java
- * @run main/othervm -XX:-BackgroundCompilation -XX:-UseOnStackReplacement -XX:CompileCommand=dontinline,TestInstanceCloneAsLoadsStores::m* TestInstanceCloneAsLoadsStores
- * @run main/othervm -XX:-BackgroundCompilation -XX:-UseOnStackReplacement -XX:CompileCommand=dontinline,TestInstanceCloneAsLoadsStores::m* -XX:+IgnoreUnrecognizedVMOptions -XX:+StressArrayCopyMacroNode TestInstanceCloneAsLoadsStores
- * @run main/othervm -XX:-BackgroundCompilation -XX:-UseOnStackReplacement -XX:CompileCommand=dontinline,TestInstanceCloneAsLoadsStores::m* -XX:+IgnoreUnrecognizedVMOptions -XX:-ReduceInitialCardMarks TestInstanceCloneAsLoadsStores
+ * @library /
+ *
+ * @run main/othervm -XX:-BackgroundCompilation -XX:-UseOnStackReplacement
+ *                   -XX:CompileCommand=dontinline,compiler.arraycopy.TestInstanceCloneAsLoadsStores::m*
+ *                   compiler.arraycopy.TestInstanceCloneAsLoadsStores
+ * @run main/othervm -XX:-BackgroundCompilation -XX:-UseOnStackReplacement
+ *                   -XX:CompileCommand=dontinline,compiler.arraycopy.TestInstanceCloneAsLoadsStores::m*
+ *                   -XX:+IgnoreUnrecognizedVMOptions -XX:+StressArrayCopyMacroNode
+ *                   compiler.arraycopy.TestInstanceCloneAsLoadsStores
+ * @run main/othervm -XX:-BackgroundCompilation -XX:-UseOnStackReplacement
+ *                   -XX:CompileCommand=dontinline,compiler.arraycopy.TestInstanceCloneAsLoadsStores::m*
+ *                   -XX:+IgnoreUnrecognizedVMOptions -XX:-ReduceInitialCardMarks
+ *                   compiler.arraycopy.TestInstanceCloneAsLoadsStores
  */
 
+package compiler.arraycopy;
+
 public class TestInstanceCloneAsLoadsStores extends TestInstanceCloneUtils {
 
     // Should be compiled as loads/stores
diff --git a/hotspot/test/compiler/arraycopy/TestInstanceCloneUtils.java b/hotspot/test/compiler/arraycopy/TestInstanceCloneUtils.java
index af1e6fc..0e99257 100644
--- a/hotspot/test/compiler/arraycopy/TestInstanceCloneUtils.java
+++ b/hotspot/test/compiler/arraycopy/TestInstanceCloneUtils.java
@@ -21,8 +21,12 @@
  * questions.
  */
 
-import java.lang.reflect.*;
-import java.util.*;
+package compiler.arraycopy;
+
+import java.lang.reflect.Field;
+import java.lang.reflect.Method;
+import java.lang.reflect.Modifier;
+import java.util.HashMap;
 
 abstract class TestInstanceCloneUtils {
     static class Base implements Cloneable {
diff --git a/hotspot/test/compiler/arraycopy/TestLoadBypassArrayCopy.java b/hotspot/test/compiler/arraycopy/TestLoadBypassArrayCopy.java
index 697b974..d4e4ca1 100644
--- a/hotspot/test/compiler/arraycopy/TestLoadBypassArrayCopy.java
+++ b/hotspot/test/compiler/arraycopy/TestLoadBypassArrayCopy.java
@@ -25,10 +25,15 @@
  * @test
  * @bug 8086046
  * @summary load bypasses arraycopy that sets the value after the ArrayCopyNode is expanded
- * @run main/othervm -XX:-BackgroundCompilation  -XX:-UseOnStackReplacement -XX:CompileCommand=dontinline,TestLoadBypassArrayCopy::test_helper -XX:-TieredCompilation TestLoadBypassArrayCopy
  *
+ * @run main/othervm -XX:-BackgroundCompilation  -XX:-UseOnStackReplacement
+ *                   -XX:CompileCommand=dontinline,compiler.arraycopy.TestLoadBypassArrayCopy::test_helper
+ *                   -XX:-TieredCompilation
+ *                   compiler.arraycopy.TestLoadBypassArrayCopy
  */
 
+package compiler.arraycopy;
+
 public class TestLoadBypassArrayCopy {
 
     static long i;
diff --git a/hotspot/test/compiler/arraycopy/TestMissingControl.java b/hotspot/test/compiler/arraycopy/TestMissingControl.java
index 503e24b..f362e53 100644
--- a/hotspot/test/compiler/arraycopy/TestMissingControl.java
+++ b/hotspot/test/compiler/arraycopy/TestMissingControl.java
@@ -25,9 +25,14 @@
  * @test
  * @bug 8055153
  * @summary missing control on LoadRange and LoadKlass when array copy macro node is expanded
- * @run main/othervm -XX:-BackgroundCompilation -XX:-UseOnStackReplacement -XX:-TieredCompilation TestMissingControl
+ *
+ * @run main/othervm -XX:-BackgroundCompilation -XX:-UseOnStackReplacement -XX:-TieredCompilation
+ *                   compiler.arraycopy.TestMissingControl
  *
  */
+
+package compiler.arraycopy;
+
 public class TestMissingControl {
 
     static int[] m1(int[] a2) {
diff --git a/hotspot/test/compiler/arraycopy/TestObjectArrayClone.java b/hotspot/test/compiler/arraycopy/TestObjectArrayClone.java
index 3cf5c65..9be6fa0 100644
--- a/hotspot/test/compiler/arraycopy/TestObjectArrayClone.java
+++ b/hotspot/test/compiler/arraycopy/TestObjectArrayClone.java
@@ -25,8 +25,14 @@
  * @test
  * @bug 8155643
  * @summary Test Object.clone() intrinsic if ReduceInitialCardMarks is disabled.
- * @run main/othervm -XX:+IgnoreUnrecognizedVMOptions -Xcomp -XX:CompileOnly=TestObjectArrayClone.test -XX:-ReduceInitialCardMarks TestObjectArrayClone
+ *
+ * @run main/othervm -XX:+IgnoreUnrecognizedVMOptions -Xcomp -XX:-ReduceInitialCardMarks
+ *                   -XX:CompileCommand=compileonly,compiler.arraycopy.TestObjectArrayClone::test
+ *                   compiler.arraycopy.TestObjectArrayClone
  */
+
+package compiler.arraycopy;
+
 public class TestObjectArrayClone {
 
     public static TestObjectArrayClone[] test(TestObjectArrayClone[] arr) {
diff --git a/hotspot/test/compiler/arraycopy/TestReduceBulkZeroingDisabled.java b/hotspot/test/compiler/arraycopy/TestReduceBulkZeroingDisabled.java
index 2c789c0..873eb1b 100644
--- a/hotspot/test/compiler/arraycopy/TestReduceBulkZeroingDisabled.java
+++ b/hotspot/test/compiler/arraycopy/TestReduceBulkZeroingDisabled.java
@@ -25,8 +25,13 @@
  * @test
  * @bug 8155241
  * @summary Test arraycopy elimination with ReduceBulkZeroing disabled.
- * @run main/othervm -XX:+IgnoreUnrecognizedVMOptions -Xcomp -XX:-ReduceBulkZeroing TestReduceBulkZeroingDisabled
+ *
+ * @run main/othervm -XX:+IgnoreUnrecognizedVMOptions -Xcomp -XX:-ReduceBulkZeroing
+ *                   compiler.arraycopy.TestReduceBulkZeroingDisabled
  */
+
+package compiler.arraycopy;
+
 public class TestReduceBulkZeroingDisabled {
 
     static public void main(String[] args) {
diff --git a/hotspot/test/compiler/c1/6478991/NullCheckTest.java b/hotspot/test/compiler/c1/6478991/NullCheckTest.java
deleted file mode 100644
index 760e80c..0000000
--- a/hotspot/test/compiler/c1/6478991/NullCheckTest.java
+++ /dev/null
@@ -1,72 +0,0 @@
-/*
- * Copyright (c) 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.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- *
- */
-
-/**
- * @test
- * @bug 6478991
- * @summary C1 NullCheckEliminator yields incorrect exceptions
- *
- * @run main/othervm -XX:CompileOnly=NullCheckTest.test,NullCheckTest.inlined  -Xcomp NullCheckTest
- */
-
-public class NullCheckTest {
-        static class A {
-                int f;
-
-                public final void inlined(A a) {
-                        // This cast is intended to fail.
-                        B b = ((B) a);
-                }
-        }
-
-        static class B extends A {
-        }
-
-
-        private static void test(A a1, A a2) {
-                // Inlined call must do a null check on a1.
-                // However, the exlipcit NullCheck instruction is eliminated and
-                // the null check is folded into the field load below, so the
-                // exception in the inlined method is thrown before the null check
-                // and the NullPointerException is not thrown.
-                a1.inlined(a2);
-
-                int x = a1.f;
-        }
-
-        public static void main(String[] args) {
-                // load classes
-                new B();
-                try {
-                        test(null, new A());
-
-                        throw new InternalError("FAILURE: no exception");
-                } catch (NullPointerException ex) {
-                        System.out.println("CORRECT: NullPointerException");
-                } catch (ClassCastException ex) {
-                        System.out.println("FAILURE: ClassCastException");
-                        throw ex;
-                }
-        }
-}
diff --git a/hotspot/test/compiler/c1/CanonicalizeArrayLength.java b/hotspot/test/compiler/c1/CanonicalizeArrayLength.java
index ee2649a..64255c9 100644
--- a/hotspot/test/compiler/c1/CanonicalizeArrayLength.java
+++ b/hotspot/test/compiler/c1/CanonicalizeArrayLength.java
@@ -25,11 +25,29 @@
  * @test
  * @bug 8150102 8150514 8150534
  * @summary C1 crashes in Canonicalizer::do_ArrayLength() after fix for JDK-8150102
- * @run main/othervm -XX:+IgnoreUnrecognizedVMOptions -XX:+UnlockDiagnosticVMOptions -XX:CompileThreshold=100 -XX:+TieredCompilation -XX:TieredStopAtLevel=1 -XX:-BackgroundCompilation CanonicalizeArrayLength
- * @run main/othervm -XX:+IgnoreUnrecognizedVMOptions -XX:+UnlockDiagnosticVMOptions -XX:CompileThreshold=100 -XX:+TieredCompilation -XX:TieredStopAtLevel=1 -XX:-BackgroundCompilation -XX:+PatchALot CanonicalizeArrayLength
- * @run main/othervm -XX:+IgnoreUnrecognizedVMOptions -XX:+UnlockDiagnosticVMOptions -XX:CompileThreshold=100 -XX:+TieredCompilation -XX:TieredStopAtLevel=1 -XX:-BackgroundCompilation -XX:ScavengeRootsInCode=0 CanonicalizeArrayLength
- * @run main/othervm -XX:+IgnoreUnrecognizedVMOptions -XX:+UnlockDiagnosticVMOptions -XX:CompileThreshold=100 -XX:+TieredCompilation -XX:TieredStopAtLevel=1 -XX:-BackgroundCompilation -XX:ScavengeRootsInCode=1 CanonicalizeArrayLength
+ *
+ * @run main/othervm -XX:+IgnoreUnrecognizedVMOptions -XX:+UnlockDiagnosticVMOptions
+ *                   -XX:CompileThreshold=100 -XX:+TieredCompilation -XX:TieredStopAtLevel=1
+ *                   -XX:-BackgroundCompilation
+ *                   compiler.c1.CanonicalizeArrayLength
+ * @run main/othervm -XX:+IgnoreUnrecognizedVMOptions -XX:+UnlockDiagnosticVMOptions
+ *                   -XX:CompileThreshold=100 -XX:+TieredCompilation -XX:TieredStopAtLevel=1
+ *                   -XX:-BackgroundCompilation
+ *                   -XX:+PatchALot
+ *                   compiler.c1.CanonicalizeArrayLength
+ * @run main/othervm -XX:+IgnoreUnrecognizedVMOptions -XX:+UnlockDiagnosticVMOptions
+ *                   -XX:CompileThreshold=100 -XX:+TieredCompilation -XX:TieredStopAtLevel=1
+ *                   -XX:-BackgroundCompilation
+ *                   -XX:ScavengeRootsInCode=0
+ *                   compiler.c1.CanonicalizeArrayLength
+ * @run main/othervm -XX:+IgnoreUnrecognizedVMOptions -XX:+UnlockDiagnosticVMOptions
+ *                   -XX:CompileThreshold=100 -XX:+TieredCompilation -XX:TieredStopAtLevel=1
+ *                   -XX:-BackgroundCompilation -XX:ScavengeRootsInCode=1
+ *                   compiler.c1.CanonicalizeArrayLength
  */
+
+package compiler.c1;
+
 public class CanonicalizeArrayLength {
     int[] arr = new int[42];
     int[] arrNull = null;
diff --git a/hotspot/test/compiler/c1/NullCheckTest.java b/hotspot/test/compiler/c1/NullCheckTest.java
new file mode 100644
index 0000000..24f72a4
--- /dev/null
+++ b/hotspot/test/compiler/c1/NullCheckTest.java
@@ -0,0 +1,77 @@
+/*
+ * Copyright (c) 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.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ *
+ */
+
+/**
+ * @test
+ * @bug 6478991
+ * @summary C1 NullCheckEliminator yields incorrect exceptions
+ *
+ * @run main/othervm -Xcomp
+ *      -XX:CompileCommand=compileonly,compiler.c1.NullCheckTest::test
+ *      -XX:CompileCommand=compileonly,compiler.c1.NullCheckTest::inlined
+ *      compiler.c1.NullCheckTest
+ */
+
+package compiler.c1;
+
+public class NullCheckTest {
+    static class A {
+        int f;
+
+        public final void inlined(A a) {
+            // This cast is intended to fail.
+            B b = ((B) a);
+        }
+    }
+
+    static class B extends A {
+    }
+
+
+    private static void test(A a1, A a2) {
+        // Inlined call must do a null check on a1.
+        // However, the exlipcit NullCheck instruction is eliminated and
+        // the null check is folded into the field load below, so the
+        // exception in the inlined method is thrown before the null check
+        // and the NullPointerException is not thrown.
+        a1.inlined(a2);
+
+        int x = a1.f;
+    }
+
+    public static void main(String[] args) {
+        // load classes
+        new B();
+        try {
+                test(null, new A());
+
+                throw new InternalError("FAILURE: no exception");
+        } catch (NullPointerException ex) {
+                System.out.println("CORRECT: NullPointerException");
+        } catch (ClassCastException ex) {
+                System.out.println("FAILURE: ClassCastException");
+                throw ex;
+        }
+    }
+}
diff --git a/hotspot/test/compiler/c1/6579789/Test6579789.java b/hotspot/test/compiler/c1/Test6579789.java
similarity index 90%
rename from hotspot/test/compiler/c1/6579789/Test6579789.java
rename to hotspot/test/compiler/c1/Test6579789.java
index 344a08f..23603ea 100644
--- a/hotspot/test/compiler/c1/6579789/Test6579789.java
+++ b/hotspot/test/compiler/c1/Test6579789.java
@@ -26,9 +26,14 @@
  * @test
  * @bug 6579789
  * @summary Internal error "c1_LinearScan.cpp:1429 Error: assert(false,"")" in debuggee with fastdebug VM
- * @run main/othervm -Xcomp -XX:UseSSE=0 -XX:CompileOnly=Test6579789.bug Test6579789
+ *
+ * @run main/othervm -Xcomp -XX:UseSSE=0
+ *      -XX:CompileCommand=compileonly,compiler.c1.Test6579789::bug
+ *      compiler.c1.Test6579789
  */
 
+package compiler.c1;
+
 public class Test6579789 {
     public static void main(String[] args) {
         bug(4);
diff --git a/hotspot/test/compiler/c1/6756768/Test6756768.java b/hotspot/test/compiler/c1/Test6756768.java
similarity index 95%
rename from hotspot/test/compiler/c1/6756768/Test6756768.java
rename to hotspot/test/compiler/c1/Test6756768.java
index 42a7474..f1158ef 100644
--- a/hotspot/test/compiler/c1/6756768/Test6756768.java
+++ b/hotspot/test/compiler/c1/Test6756768.java
@@ -26,9 +26,11 @@
  * @bug 6756768
  * @summary C1 generates invalid code
  *
- * @run main/othervm -Xcomp Test6756768
+ * @run main/othervm -Xcomp compiler.c1.Test6756768
  */
 
+package compiler.c1;
+
 class Test6756768a
 {
     static boolean var_1 = true;
diff --git a/hotspot/test/compiler/c1/6756768/Test6756768_2.java b/hotspot/test/compiler/c1/Test6756768_2.java
similarity index 95%
rename from hotspot/test/compiler/c1/6756768/Test6756768_2.java
rename to hotspot/test/compiler/c1/Test6756768_2.java
index b391500..16406cb 100644
--- a/hotspot/test/compiler/c1/6756768/Test6756768_2.java
+++ b/hotspot/test/compiler/c1/Test6756768_2.java
@@ -26,9 +26,11 @@
  * @bug 6756768
  * @summary C1 generates invalid code
  *
- * @run main/othervm -Xcomp Test6756768_2
+ * @run main/othervm -Xcomp compiler.c1.Test6756768_2
  */
 
+package compiler.c1;
+
 class Test6756768_2a {
     static int var = ++Test6756768_2.var;
 }
diff --git a/hotspot/test/compiler/c1/6757316/Test6757316.java b/hotspot/test/compiler/c1/Test6757316.java
similarity index 94%
rename from hotspot/test/compiler/c1/6757316/Test6757316.java
rename to hotspot/test/compiler/c1/Test6757316.java
index 9585caa3..9566dfa 100644
--- a/hotspot/test/compiler/c1/6757316/Test6757316.java
+++ b/hotspot/test/compiler/c1/Test6757316.java
@@ -25,9 +25,12 @@
  * @test
  * @bug 6757316
  * @summary load_constant() produces a wrong long constant, with high a low words swapped
- * @run main/othervm -Xcomp Test6757316
+ *
+ * @run main/othervm -Xcomp compiler.c1.Test6757316
  */
 
+package compiler.c1;
+
 public class Test6757316 {
     public static void main(String[] args) {
         long[] arr = {
diff --git a/hotspot/test/compiler/c1/6758234/Test6758234.java b/hotspot/test/compiler/c1/Test6758234.java
similarity index 89%
rename from hotspot/test/compiler/c1/6758234/Test6758234.java
rename to hotspot/test/compiler/c1/Test6758234.java
index 8b880c6..d014354 100644
--- a/hotspot/test/compiler/c1/6758234/Test6758234.java
+++ b/hotspot/test/compiler/c1/Test6758234.java
@@ -25,9 +25,14 @@
  * @test
  * @bug 6758234
  * @summary if (k cond (a ? : b: c)) returns reversed answer if k is constant and b and c are longs
- * @run main/othervm -Xcomp -XX:CompileOnly=Test6758234.main Test6758234
+ *
+ * @run main/othervm -Xcomp
+ *      -XX:CompileCommand=compileonly,compiler.c1.Test6758234::main
+ *      compiler.c1.Test6758234
  */
 
+package compiler.c1;
+
 public class Test6758234 {
     static int x = 0;
     static int y = 1;
diff --git a/hotspot/test/compiler/c1/6795465/Test6795465.java b/hotspot/test/compiler/c1/Test6795465.java
similarity index 95%
rename from hotspot/test/compiler/c1/6795465/Test6795465.java
rename to hotspot/test/compiler/c1/Test6795465.java
index 2e9db1d..5f3ca9c 100644
--- a/hotspot/test/compiler/c1/6795465/Test6795465.java
+++ b/hotspot/test/compiler/c1/Test6795465.java
@@ -27,9 +27,11 @@
  * @bug 6795465
  * @summary Crash in assembler_sparc.cpp with client compiler on solaris-sparc
  *
- * @run main Test6795465
+ * @run main compiler.c1.Test6795465
  */
 
+package compiler.c1;
+
 public class Test6795465 {
     static long var_1 = -1;
 
diff --git a/hotspot/test/compiler/c1/6849574/Test.java b/hotspot/test/compiler/c1/Test6849574.java
similarity index 89%
rename from hotspot/test/compiler/c1/6849574/Test.java
rename to hotspot/test/compiler/c1/Test6849574.java
index 7639d03..70d1a29 100644
--- a/hotspot/test/compiler/c1/6849574/Test.java
+++ b/hotspot/test/compiler/c1/Test6849574.java
@@ -27,12 +27,15 @@
  * @bug 6849574
  * @summary VM crash using NonBlockingHashMap (high_scale_lib)
  *
- * @run main/othervm -XX:+UnlockDiagnosticVMOptions -XX:+VerifyBeforeGC Test
+ * @run main/othervm -XX:+UnlockDiagnosticVMOptions -XX:+VerifyBeforeGC
+ *      compiler.c1.Test6849574
  */
 
-import java.util.concurrent.atomic.*;
+package compiler.c1;
 
-public class Test extends Thread {
+import java.util.concurrent.atomic.AtomicReferenceArray;
+
+public class Test6849574 extends Thread {
 
     public static void main(String[] args) {
         AtomicReferenceArray a = new AtomicReferenceArray(10000);
diff --git a/hotspot/test/compiler/c1/6855215/Test6855215.java b/hotspot/test/compiler/c1/Test6855215.java
similarity index 95%
rename from hotspot/test/compiler/c1/6855215/Test6855215.java
rename to hotspot/test/compiler/c1/Test6855215.java
index 914ec12..3ea0ad5 100644
--- a/hotspot/test/compiler/c1/6855215/Test6855215.java
+++ b/hotspot/test/compiler/c1/Test6855215.java
@@ -27,9 +27,11 @@
  * @bug 6855215
  * @summary Calculation error (NaN) after about 1500 calculations
  *
- * @run main/othervm -Xbatch -XX:UseSSE=0 Test6855215
+ * @run main/othervm -Xbatch -XX:UseSSE=0 compiler.c1.Test6855215
  */
 
+package compiler.c1;
+
 public class Test6855215 {
     private double m;
     private double b;
diff --git a/hotspot/test/compiler/c1/6932496/Test6932496.java b/hotspot/test/compiler/c1/Test6932496.java
similarity index 97%
rename from hotspot/test/compiler/c1/6932496/Test6932496.java
rename to hotspot/test/compiler/c1/Test6932496.java
index 3b75dd7..2679c7e 100644
--- a/hotspot/test/compiler/c1/6932496/Test6932496.java
+++ b/hotspot/test/compiler/c1/Test6932496.java
@@ -27,19 +27,25 @@
  * @bug 6932496
  * @summary incorrect deopt of jsr subroutine on 64 bit c1
  * @modules java.base/jdk.internal.org.objectweb.asm
- * @run main/othervm -Xcomp -XX:CompileOnly=Test.test Test6932496
+ *
+ * @run main/othervm -Xcomp
+ *      -XX:CompileCommand=compileonly,compiler.c1.Test6932496::test
+ *      compiler.c1.Test6932496
  */
+
+package compiler.c1;
+
+import jdk.internal.org.objectweb.asm.ClassWriter;
+import jdk.internal.org.objectweb.asm.FieldVisitor;
+import jdk.internal.org.objectweb.asm.Label;
+import jdk.internal.org.objectweb.asm.MethodVisitor;
+import jdk.internal.org.objectweb.asm.Opcodes;
+import jdk.internal.org.objectweb.asm.Type;
+
+import java.io.IOException;
 import java.lang.reflect.Method;
 import java.nio.file.Files;
 import java.nio.file.Paths;
-import java.io.IOException;
-
-import jdk.internal.org.objectweb.asm.ClassWriter;
-import jdk.internal.org.objectweb.asm.MethodVisitor;
-import jdk.internal.org.objectweb.asm.FieldVisitor;
-import jdk.internal.org.objectweb.asm.Opcodes;
-import jdk.internal.org.objectweb.asm.Type;
-import jdk.internal.org.objectweb.asm.Label;
 
 public class Test6932496 extends ClassLoader {
     private static final int CLASS_FILE_VERSION = 49;
diff --git a/hotspot/test/compiler/c1/7042153/Test7042153.java b/hotspot/test/compiler/c1/Test7042153.java
similarity index 79%
rename from hotspot/test/compiler/c1/7042153/Test7042153.java
rename to hotspot/test/compiler/c1/Test7042153.java
index 4319b3b..c743920 100644
--- a/hotspot/test/compiler/c1/7042153/Test7042153.java
+++ b/hotspot/test/compiler/c1/Test7042153.java
@@ -27,19 +27,19 @@
  * @bug 7042153
  * @summary Bad folding of IfOps with unloaded constant arguments in C1
  *
- * @run main/othervm -Xcomp Test7042153
+ * @run main/othervm -Xcomp compiler.c1.Test7042153
  */
 
-import java.lang.reflect.*;
+package compiler.c1;
 
 public class Test7042153 {
-  static public class Bar { }
-  static public class Foo { }
+    static public class Bar { }
+    static public class Foo { }
 
-  static volatile boolean z;
-  public static void main(String [] args) {
-    Class cx = Bar.class;
-    Class cy = Foo.class;
-    z = (cx == cy);
-  }
+    static volatile boolean z;
+    public static void main(String [] args) {
+        Class cx = Bar.class;
+        Class cy = Foo.class;
+        z = (cx == cy);
+    }
 }
diff --git a/hotspot/test/compiler/c1/7090976/Test7090976.java b/hotspot/test/compiler/c1/Test7090976.java
similarity index 96%
rename from hotspot/test/compiler/c1/7090976/Test7090976.java
rename to hotspot/test/compiler/c1/Test7090976.java
index 84ff20a..8f77641 100644
--- a/hotspot/test/compiler/c1/7090976/Test7090976.java
+++ b/hotspot/test/compiler/c1/Test7090976.java
@@ -27,9 +27,12 @@
  * @bug 7090976
  * @summary Eclipse/CDT causes a JVM crash while indexing C++ code
  *
- * @run main/othervm -XX:-BackgroundCompilation -XX:-UseOnStackReplacement Test7090976
+ * @run main/othervm -XX:-BackgroundCompilation -XX:-UseOnStackReplacement
+ *      compiler.c1.Test7090976
  */
 
+package compiler.c1;
+
 public class Test7090976 {
 
     static interface I1 {
diff --git a/hotspot/test/compiler/c1/7103261/Test7103261.java b/hotspot/test/compiler/c1/Test7103261.java
similarity index 98%
rename from hotspot/test/compiler/c1/7103261/Test7103261.java
rename to hotspot/test/compiler/c1/Test7103261.java
index afb3064..a5d7eca 100644
--- a/hotspot/test/compiler/c1/7103261/Test7103261.java
+++ b/hotspot/test/compiler/c1/Test7103261.java
@@ -27,9 +27,11 @@
  * @bug 7103261
  * @summary crash with jittester on sparc
  *
- * @run main Test7103261
+ * @run main compiler.c1.Test7103261
  */
 
+package compiler.c1;
+
 // exercise implicit null checking in the compiler for various field types
 public class Test7103261 {
     static Test7103261 null_value;
diff --git a/hotspot/test/compiler/c1/7123108/Test7123108.java b/hotspot/test/compiler/c1/Test7123108.java
similarity index 95%
rename from hotspot/test/compiler/c1/7123108/Test7123108.java
rename to hotspot/test/compiler/c1/Test7123108.java
index 66d3a01..908f0ab 100644
--- a/hotspot/test/compiler/c1/7123108/Test7123108.java
+++ b/hotspot/test/compiler/c1/Test7123108.java
@@ -27,9 +27,11 @@
  * @bug 7123108
  * @summary C1 crashes with assert(if_state != NULL) failed: states do not match up
  *
- * @run main/othervm -Xcomp Test7123108
+ * @run main/othervm -Xcomp compiler.c1.Test7123108
  */
 
+package compiler.c1;
+
 public class Test7123108 {
 
     static class Test_Class_0 {
diff --git a/hotspot/test/compiler/c1/8004051/Test8004051.java b/hotspot/test/compiler/c1/Test8004051.java
similarity index 96%
rename from hotspot/test/compiler/c1/8004051/Test8004051.java
rename to hotspot/test/compiler/c1/Test8004051.java
index 981effb..73667f7 100644
--- a/hotspot/test/compiler/c1/8004051/Test8004051.java
+++ b/hotspot/test/compiler/c1/Test8004051.java
@@ -28,9 +28,11 @@
  * @bug 8005722
  * @summary assert(_oprs_len[mode] < maxNumberOfOperands) failed: array overflow
  *
- * @run main/othervm -Xcomp Test8004051
+ * @run main/othervm -Xcomp compiler.c1.Test8004051
  */
 
+package compiler.c1;
+
 public class Test8004051 {
     public static void main(String[] argv) {
         Object o = new Object();
diff --git a/hotspot/test/compiler/c1/8011706/Test8011706.java b/hotspot/test/compiler/c1/Test8011706.java
similarity index 96%
rename from hotspot/test/compiler/c1/8011706/Test8011706.java
rename to hotspot/test/compiler/c1/Test8011706.java
index 4c31737..7703d32 100644
--- a/hotspot/test/compiler/c1/8011706/Test8011706.java
+++ b/hotspot/test/compiler/c1/Test8011706.java
@@ -25,10 +25,13 @@
  * @test
  * @bug 8011706
  * @summary loop invariant code motion may move load before store to the same field
- * @run main/othervm -XX:-UseOnStackReplacement -XX:-BackgroundCompilation Test8011706
  *
+ * @run main/othervm -XX:-UseOnStackReplacement -XX:-BackgroundCompilation
+ *      compiler.c1.Test8011706
  */
 
+package compiler.c1;
+
 public class Test8011706 {
     int[] array;
 
diff --git a/hotspot/test/compiler/c1/8011771/Test8011771.java b/hotspot/test/compiler/c1/Test8011771.java
similarity index 96%
rename from hotspot/test/compiler/c1/8011771/Test8011771.java
rename to hotspot/test/compiler/c1/Test8011771.java
index 7827150..25e724f 100644
--- a/hotspot/test/compiler/c1/8011771/Test8011771.java
+++ b/hotspot/test/compiler/c1/Test8011771.java
@@ -25,10 +25,12 @@
  * @test
  * @bug 8011771
  * @summary Array bound check elimination's in block motion doesn't always reset its data structures from one step to the other.
- * @run main/othervm -XX:-BackgroundCompilation Test8011771
  *
+ * @run main/othervm -XX:-BackgroundCompilation compiler.c1.Test8011771
  */
 
+package compiler.c1;
+
 public class Test8011771 {
 
     static void m(int[] a, int[] b, int j) {
diff --git a/hotspot/test/compiler/c1/6769124/TestArrayCopy6769124.java b/hotspot/test/compiler/c1/TestArrayCopy.java
similarity index 93%
rename from hotspot/test/compiler/c1/6769124/TestArrayCopy6769124.java
rename to hotspot/test/compiler/c1/TestArrayCopy.java
index 61868e7..01ffd0a 100644
--- a/hotspot/test/compiler/c1/6769124/TestArrayCopy6769124.java
+++ b/hotspot/test/compiler/c1/TestArrayCopy.java
@@ -26,9 +26,13 @@
  * @test
  * @bug 6769124
  * @summary arraycopy may crash the VM with c1 on 64 bit
+ *
+ * @run main compiler.c1.TestArrayCopy
  */
 
-public class TestArrayCopy6769124 {
+package compiler.c1;
+
+public class TestArrayCopy {
 
     public static void main(String[] args) {
 
diff --git a/hotspot/test/compiler/c1/6769124/TestDeoptInt6769124.java b/hotspot/test/compiler/c1/TestDeoptInt.java
similarity index 89%
rename from hotspot/test/compiler/c1/6769124/TestDeoptInt6769124.java
rename to hotspot/test/compiler/c1/TestDeoptInt.java
index f6ecdb6..75d0d2b 100644
--- a/hotspot/test/compiler/c1/6769124/TestDeoptInt6769124.java
+++ b/hotspot/test/compiler/c1/TestDeoptInt.java
@@ -27,10 +27,14 @@
  * @bug 6769124
  * @summary int value might not be correctly decoded on deopt with c1 on 64 bit
  *
- * @run main/othervm -Xcomp -XX:CompileOnly=TestDeoptInt6769124.m TestDeoptInt6769124
+ * @run main/othervm -Xcomp
+ *      -XX:CompileCommand=compileonly,compiler.c1.TestDeoptInt::m
+ *      compiler.c1.TestDeoptInt
  */
 
-public class TestDeoptInt6769124 {
+package compiler.c1;
+
+public class TestDeoptInt {
 
     static class A {
         volatile int vl;
diff --git a/hotspot/test/compiler/c1/6769124/TestUnalignedLoad6769124.java b/hotspot/test/compiler/c1/TestUnalignedLoad.java
similarity index 94%
rename from hotspot/test/compiler/c1/6769124/TestUnalignedLoad6769124.java
rename to hotspot/test/compiler/c1/TestUnalignedLoad.java
index 11c40cf..1149493 100644
--- a/hotspot/test/compiler/c1/6769124/TestUnalignedLoad6769124.java
+++ b/hotspot/test/compiler/c1/TestUnalignedLoad.java
@@ -26,9 +26,13 @@
  * @test
  * @bug 6769124
  * @summary unaligned load may fail with c1 on 64 bit
+ *
+ * @run main compiler.c1.TestUnalignedLoad
  */
 
-public class TestUnalignedLoad6769124 {
+package compiler.c1;
+
+public class TestUnalignedLoad {
 
     static long l1v = 0x200000003L;
     static long l2v = 0x400000005L;
diff --git a/hotspot/test/compiler/c2/5091921/Test6186134.java b/hotspot/test/compiler/c2/5091921/Test6186134.java
deleted file mode 100644
index d5f57d1..0000000
--- a/hotspot/test/compiler/c2/5091921/Test6186134.java
+++ /dev/null
@@ -1,71 +0,0 @@
-/*
- * Copyright (c) 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.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- *
- */
-
-/**
- * @test
- * @bug 6186134
- * @summary Server virtual machine produces/exeutes incorrect code.
- *
- * @run main Test6186134 100000
- */
-import java.util.ArrayList;
-
-public class Test6186134 {
-
-  int num = 0;
-
-  public Test6186134(int n) {
-    num = n;
-  }
-
-  public boolean more() {
-    return num-- > 0;
-  }
-
-  public ArrayList test1() {
-    ArrayList res = new ArrayList();
-    int maxResults = Integer.MAX_VALUE;
-    int n = 0;
-    boolean more = more();
-    while ((n++ < maxResults) && more) {
-      res.add(new Object());
-      more = more();
-    }
-    return res;
-  }
-
-  public static void main(String[] pars) {
-    int n = Integer.parseInt(pars[0]);
-    for (int i=0; i<n; i++) {
-      Test6186134 t = new Test6186134(10);
-      int size = t.test1().size();
-      if (size != 10) {
-        System.out.println("wrong size: " + size +", should be 10");
-        System.exit(97);
-      }
-    }
-    System.out.println("Passed");
-  }
-}
-
diff --git a/hotspot/test/compiler/c2/5091921/Test6905845.java b/hotspot/test/compiler/c2/5091921/Test6905845.java
deleted file mode 100644
index 1cb2f74..0000000
--- a/hotspot/test/compiler/c2/5091921/Test6905845.java
+++ /dev/null
@@ -1,76 +0,0 @@
-/*
- * Copyright (c) 2011, 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.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- *
- */
-
-/**
- * @test
- * @bug 6905845
- * @summary Server VM improperly optimizing away loop.
- *
- * @run main/timeout=480 Test6905845
- */
-
-public class Test6905845 {
-
-   public static void main(String[] args){
-      for (int asdf = 0; asdf < 5; asdf++){
-         //test block
-         {
-            StringBuilder strBuf1 = new StringBuilder(65);
-            long          start   = System.currentTimeMillis();
-            int           count   = 0;
-
-            for (int i = Integer.MIN_VALUE; i < (Integer.MAX_VALUE - 80); i += 79){
-               strBuf1.append(i);
-               count++;
-               strBuf1.delete(0, 65);
-            }
-
-            System.out.println(count);
-            if (count != 54366674) {
-              System.out.println("wrong count: " + count +", should be 54366674");
-              System.exit(97);
-            }
-         }
-         //test block
-         {
-            StringBuilder strBuf1 = new StringBuilder(65);
-            long          start   = System.currentTimeMillis();
-            int           count   = 0;
-
-            for (int i = Integer.MIN_VALUE; i < (Integer.MAX_VALUE - 80); i += 79){
-               strBuf1.append(i);
-               count++;
-               strBuf1.delete(0, 65);
-            }
-
-            System.out.println(count);
-            if (count != 54366674) {
-              System.out.println("wrong count: " + count +", should be 54366674");
-              System.exit(97);
-            }
-         }
-      }
-   }
-}
-
diff --git a/hotspot/test/compiler/c2/6646019/Test.java b/hotspot/test/compiler/c2/6646019/Test.java
deleted file mode 100644
index 102280c..0000000
--- a/hotspot/test/compiler/c2/6646019/Test.java
+++ /dev/null
@@ -1,51 +0,0 @@
-/*
- * Copyright (c) 2008, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-
-/*
- * @test
- * @bug 6646019
- * @summary array subscript expressions become top() with -d64
- * @run main/othervm -Xcomp -XX:CompileOnly=Test.test Test
-*/
-
-
-public class Test  {
-  final static int i = 2076285318;
-  long l = 2;
-  short s;
-
-  public static void main(String[] args) {
-    Test t = new Test();
-    try { t.test(); }
-    catch (Throwable e) {
-      if (t.l != 5) {
-        System.out.println("Fails: " + t.l + " != 5");
-      }
-    }
-  }
-
-  private void test() {
-    l = 5;
-    l = (new short[(byte)-2])[(byte)(l = i)];
-  }
-}
diff --git a/hotspot/test/compiler/c2/6823453/Test.java b/hotspot/test/compiler/c2/6823453/Test.java
deleted file mode 100644
index 46f3c4c..0000000
--- a/hotspot/test/compiler/c2/6823453/Test.java
+++ /dev/null
@@ -1,96 +0,0 @@
-/*
- * Copyright (c) 2009, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- *
- */
-
-/*
- * @test
- * @bug 6823453
- * @summary DeoptimizeALot causes fastdebug server jvm to fail with assert(false,"unscheduable graph")
- * @run main/othervm -Xcomp -XX:+IgnoreUnrecognizedVMOptions -XX:CompileOnly=Test -XX:+DeoptimizeALot Test
- */
-
-public class Test {
-
-   static long vara_1 = 1L;
-
-   static void testa() {
-      short var_2 = (byte) 1.0E10;
-
-      for ( Object temp = new byte[(byte)1.0E10];  true ;
-            var_2 = "1".equals("0") ? ((byte) vara_1) : 1 ) {}
-   }
-
-   static void testb() {
-      long var_1 = -1L;
-
-      short var_2 = (byte) 1.0E10;
-
-      for ( Object temp = new byte[(byte)1.0E10];  true ;
-            var_2 = "1".equals("0") ? ((byte) var_1) : 1 ) {}
-   }
-
-   static void testc() {
-      long var_1 = -1L;
-      if (vara_1 > 0)  var_1 = 1L;
-
-      int var_2 = (byte)var_1 - 128;
-
-      for ( Object temp = new byte[var_2];  true ;
-            var_2 = "1".equals("0") ? 2 : 1 ) {}
-   }
-
-   static void testd() {
-      long var_1 = 0L;
-
-      int var_2 = (byte)var_1 + 1;
-      for (int i=0; i<2 ; i++)  var_2 = var_2 - 1;
-
-      for ( Object temp = new byte[var_2];  true ;
-            var_2 = "1".equals("0") ? 2 : 1 ) {}
-   }
-
-   public static void main(String[] args) throws Exception {
-      int nex = 0;
-
-      try {
-         testa();
-      }
-      catch (java.lang.NegativeArraySizeException ex) { nex++; }
-      try {
-         testb();
-      }
-      catch (java.lang.NegativeArraySizeException ex) { nex++; }
-      try {
-         testc();
-      }
-      catch (java.lang.NegativeArraySizeException ex) { nex++; }
-      try {
-         testd();
-      }
-      catch (java.lang.NegativeArraySizeException ex) { nex++; }
-
-      if (nex != 4)
-        System.exit(97);
-   }
-}
-
diff --git a/hotspot/test/compiler/c2/6851282/Test.java b/hotspot/test/compiler/c2/6851282/Test.java
deleted file mode 100644
index b011ac2..0000000
--- a/hotspot/test/compiler/c2/6851282/Test.java
+++ /dev/null
@@ -1,124 +0,0 @@
-/*
- * Copyright (c) 2009, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- *
- */
-
-/**
- * @test
- * @bug 6851282
- * @summary JIT miscompilation results in null entry in array when using CompressedOops
- *
- * @run main/othervm/timeout=600 -Xmx256m -XX:+IgnoreUnrecognizedVMOptions -XX:+UseCompressedOops Test
- */
-
-import java.util.ArrayList;
-import java.util.List;
-
-public class Test {
-  void foo(A a, A[] as) {
-    for (A a1 : as) {
-      B[] filtered = a.c(a1);
-      for (B b : filtered) {
-        if (b == null) {
-          System.out.println("bug: b == null");
-          System.exit(97);
-        }
-      }
-    }
-  }
-
-  public static void main(String[] args) {
-    List<A> as = new ArrayList<A>();
-    for (int i = 0; i < 5000; i++) {
-      List<B> bs = new ArrayList<B>();
-      for (int j = i; j < i + 1000; j++)
-        bs.add(new B(j));
-      as.add(new A(bs.toArray(new B[0])));
-    }
-    new Test().foo(as.get(0), as.subList(1, as.size()).toArray(new A[0]));
-  }
-}
-
-class A {
-  final B[] bs;
-
-  public A(B[] bs) {
-    this.bs = bs;
-  }
-
-  final B[] c(final A a) {
-    return new BoxedArray<B>(bs).filter(new Function<B, Boolean>() {
-      public Boolean apply(B arg) {
-        for (B b : a.bs) {
-          if (b.d == arg.d)
-            return true;
-        }
-        return false;
-      }
-    });
-  }
-}
-
-class BoxedArray<T> {
-
-  private final T[] array;
-
-  BoxedArray(T[] array) {
-    this.array = array;
-  }
-
-  public T[] filter(Function<T, Boolean> function) {
-    boolean[] include = new boolean[array.length];
-    int len = 0;
-    int i = 0;
-    while (i < array.length) {
-      if (function.apply(array[i])) {
-        include[i] = true;
-        len += 1;
-      }
-      i += 1;
-    }
-    T[] result = (T[]) java.lang.reflect.Array.newInstance(array.getClass().getComponentType(), len);
-    len = 0;
-    i = 0;
-    while (len < result.length) {
-      if (include[i]) {
-        result[len] = array[i];
-        len += 1;
-      }
-      i += 1;
-    }
-    return result;
-  }
-}
-
-interface Function<T, R> {
-  R apply(T arg);
-}
-
-class B {
-  final int d;
-  public B(int d) {
-    this.d = d;
-  }
-}
-
diff --git a/hotspot/test/compiler/c2/6857159/Test6857159.java b/hotspot/test/compiler/c2/6857159/Test6857159.java
deleted file mode 100644
index f412adf..0000000
--- a/hotspot/test/compiler/c2/6857159/Test6857159.java
+++ /dev/null
@@ -1,75 +0,0 @@
-/*
- * Copyright (c) 2009, 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.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- *
- */
-
-/**
- * @test
- * @bug 6857159
- * @summary local schedule failed with checkcast of Thread.currentThread()
- * @library /testlibrary
- * @modules java.base/jdk.internal.misc
- *          java.management
- */
-
-import jdk.test.lib.*;
-
-public class Test6857159 {
-    public static void main(String[] args) throws Throwable {
-        OutputAnalyzer analyzer = ProcessTools.executeTestJvm("-Xbatch",
-                "-XX:+PrintCompilation", "-XX:CompileOnly=Test$ct.run", "Test");
-        analyzer.shouldNotContain("COMPILE SKIPPED");
-        analyzer.shouldContain("Test$ct0::run (16 bytes)");
-        analyzer.shouldHaveExitValue(0);
-    }
-}
-
-class Test extends Thread {
-    static class ct0 extends Test {
-        public void message() { }
-
-        public void run() {
-             message();
-             ct0 ct = (ct0) Thread.currentThread();
-             ct.message();
-        }
-    }
-    static class ct1 extends ct0 {
-        public void message() { }
-    }
-    static class ct2 extends ct0 {
-        public void message() { }
-    }
-
-    public static void main(String[] args) throws Exception {
-        for (int i = 0; i < 20000; i++) {
-            Thread t = null;
-            switch (i % 3) {
-              case 0: t = new ct0(); break;
-              case 1: t = new ct1(); break;
-              case 2: t = new ct2(); break;
-            }
-            t.start();
-            t.join();
-        }
-    }
-}
diff --git a/hotspot/test/compiler/c2/6910618/Test.java b/hotspot/test/compiler/c2/6910618/Test.java
deleted file mode 100644
index d50edb0..0000000
--- a/hotspot/test/compiler/c2/6910618/Test.java
+++ /dev/null
@@ -1,74 +0,0 @@
-/*
- * Copyright (c) 2010, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- *
- */
-
-/**
- * @test
- * @bug 6910605
- * @summary C2: NullPointerException/ClassCaseException is thrown when C2 with DeoptimizeALot is used
- *
- * @run main/othervm -Xmx64m -XX:+IgnoreUnrecognizedVMOptions -XX:+DeoptimizeALot -XX:+DoEscapeAnalysis -Xbatch -XX:InlineSmallCode=2000 Test
- *
- */
-
-/*
- * Added InlineSmallCode=2000 to guaranty inlining of StringBuilder::append() to allow scalar replace StringBuilder object.
- *
- * original test: gc/gctests/StringGC
- */
-
-public class Test {
-        private final String toAdd = "0123456789abcdef";
-        private int maxLength;
-        private static final int numberOfThreads = 8;
-
-        private class StringAdder extends Thread {
-                private String s;
-
-                public void test() {
-                        s = s + toAdd;
-                }
-                public void run() {
-                        do {
-                                test();
-                        } while (s.length() < maxLength);
-                 }
-        }
-
-        public void test() throws InterruptedException {
-                maxLength = toAdd.length() * 15000/ numberOfThreads;
-                StringAdder[] sa = new StringAdder[numberOfThreads];
-                for (int i = 0; i < numberOfThreads; i++) {
-                        sa[i] = new StringAdder();
-                        sa[i].start();
-                }
-                for (int i = 0; i < numberOfThreads; i++) {
-                        sa[i].join();
-                }
-        }
-
-        public static void main(String[] args) throws InterruptedException {
-                Test t = new Test();
-                t.test();
-        }
-}
diff --git a/hotspot/test/compiler/c2/7190310/Test7190310.java b/hotspot/test/compiler/c2/7190310/Test7190310.java
deleted file mode 100644
index b45c60b..0000000
--- a/hotspot/test/compiler/c2/7190310/Test7190310.java
+++ /dev/null
@@ -1,87 +0,0 @@
-/*
- * Copyright (c) 2012, 2013, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- *
- */
-
-/*
- * @test
- * @bug 7190310
- * @summary Inlining WeakReference.get(), and hoisting $referent may lead to non-terminating loops
- * @run main/othervm/timeout=600 -Xbatch Test7190310
- */
-
-/*
- * Note bug exhibits as infinite loop, timeout is helpful.
- * It should normally finish pretty quickly, but on some especially slow machines
- * it may not.  The companion _unsafe test lacks a timeout, but that is okay.
- */
-
-import java.lang.ref.*;
-
-public class Test7190310 {
-  private static Object str = new Object() {
-    public String toString() {
-      return "The Object";
-    }
-
-    protected void finalize() throws Throwable {
-      System.out.println("The Object is being finalized");
-      super.finalize();
-    }
-  };
-  private final static ReferenceQueue<Object> rq =
-      new ReferenceQueue<Object>();
-  private final static WeakReference<Object> wr =
-      new WeakReference<Object>(str, rq);
-
-  public static void main(String[] args)
-      throws InterruptedException {
-    Thread reader = new Thread() {
-      public void run() {
-        while (wr.get() != null) {
-        }
-        System.out.println("wr.get() returned null");
-      }
-    };
-
-    Thread queueReader = new Thread() {
-      public void run() {
-        try {
-          Reference<? extends Object> ref = rq.remove();
-          System.out.println(ref);
-          System.out.println("queueReader returned, ref==wr is "
-              + (ref == wr));
-        } catch (InterruptedException e) {
-          System.err.println("Sleep interrupted - exiting");
-        }
-      }
-    };
-
-    reader.start();
-    queueReader.start();
-
-    Thread.sleep(1000);
-    str = null;
-    System.gc();
-  }
-}
-
diff --git a/hotspot/test/compiler/c2/7190310/Test7190310_unsafe.java b/hotspot/test/compiler/c2/7190310/Test7190310_unsafe.java
deleted file mode 100644
index de48a6e..0000000
--- a/hotspot/test/compiler/c2/7190310/Test7190310_unsafe.java
+++ /dev/null
@@ -1,143 +0,0 @@
-/*
- * Copyright (c) 2012, 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.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- *
- */
-
-/*
- * @test
- * @bug 7190310
- * @summary Inlining WeakReference.get(), and hoisting $referent may lead to non-terminating loops
- * @modules java.base/jdk.internal.misc
- * @run main/othervm -Xbatch Test7190310_unsafe
- */
-
-import java.lang.ref.*;
-import java.lang.reflect.*;
-import jdk.internal.misc.Unsafe;
-
-public class Test7190310_unsafe {
-
-  static class TestObject {
-    public String toString() {
-      return "TestObject";
-    }
-  };
-
-  private static TestObject str = new TestObject();
-  private static final WeakReference ref = new WeakReference(str);
-
-  private TestObject obj;
-
-  public static void main(String[] args) throws Exception {
-    Class c = Test7190310_unsafe.class.getClassLoader().loadClass("jdk.internal.misc.Unsafe");
-    Field f = c.getDeclaredField("theUnsafe");
-    f.setAccessible(true);
-    Unsafe unsafe = (Unsafe)f.get(c);
-
-    f = Reference.class.getDeclaredField("referent");
-    f.setAccessible(true);
-    long referent_offset = unsafe.objectFieldOffset(f);
-
-    Test7190310_unsafe t = new Test7190310_unsafe();
-    TestObject o = new TestObject();
-    t.obj = o;
-
-    // Warmup (compile methods)
-    System.err.println("Warmup");
-    Object obj = null;
-    for (int i = 0; i < 11000; i++) {
-      obj = getRef0(ref);
-    }
-    for (int i = 0; i < 11000; i++) {
-      obj = getRef1(unsafe, ref, referent_offset);
-    }
-    for (int i = 0; i < 11000; i++) {
-      obj = getRef2(unsafe, ref, referent_offset);
-    }
-    for (int i = 0; i < 11000; i++) {
-      obj = getRef3(unsafe, ref, referent_offset);
-    }
-    for (int i = 0; i < 11000; i++) {
-      obj = getRef4(unsafe, t, referent_offset);
-    }
-
-    // Access verification
-    System.err.println("Verification");
-    if (!verifyGet(referent_offset, unsafe)) {
-      System.exit(97);
-    }
-
-    obj = getRef3(unsafe, t, referent_offset);
-    if (obj != o) {
-      System.out.println("FAILED: unsafe.getObject(Object, " + referent_offset + ") " + obj + " != " + o);
-      System.exit(97);
-    }
-    obj = getRef4(unsafe, t, referent_offset);
-    if (obj != o) {
-      System.out.println("FAILED: unsafe.getObject(Test7190310, " + referent_offset + ") " + obj + " != " + o);
-      System.exit(97);
-    }
-  }
-
-  static boolean verifyGet(long referent_offset, Unsafe unsafe) throws Exception {
-    // Access verification
-    System.out.println("referent: " + str);
-    Object obj = getRef0(ref);
-    if (obj != str) {
-      System.out.println("FAILED: weakRef.get() " + obj + " != " + str);
-      return false;
-    }
-    obj = getRef1(unsafe, ref, referent_offset);
-    if (obj != str) {
-      System.out.println("FAILED: unsafe.getObject(weakRef, " + referent_offset + ") " + obj + " != " + str);
-      return false;
-    }
-    obj = getRef2(unsafe, ref, referent_offset);
-    if (obj != str) {
-      System.out.println("FAILED: unsafe.getObject(abstRef, " + referent_offset + ") " + obj + " != " + str);
-      return false;
-    }
-    obj = getRef3(unsafe, ref, referent_offset);
-    if (obj != str) {
-      System.out.println("FAILED: unsafe.getObject(Object, " + referent_offset + ") " + obj + " != " + str);
-      return false;
-    }
-    return true;
-  }
-
-  static Object getRef0(WeakReference ref) throws Exception {
-    return ref.get();
-  }
-  static Object getRef1(Unsafe unsafe, WeakReference ref, long referent_offset) throws Exception {
-    return unsafe.getObject(ref, referent_offset);
-  }
-  static Object getRef2(Unsafe unsafe, Reference ref, long referent_offset) throws Exception {
-    return unsafe.getObject(ref, referent_offset);
-  }
-  static Object getRef3(Unsafe unsafe, Object ref, long referent_offset) throws Exception {
-    return unsafe.getObject(ref, referent_offset);
-  }
-  static Object getRef4(Unsafe unsafe, Test7190310_unsafe ref, long referent_offset) throws Exception {
-    return unsafe.getObject(ref, referent_offset);
-  }
-}
-
diff --git a/hotspot/test/compiler/c2/8002069/Test8002069.java b/hotspot/test/compiler/c2/8002069/Test8002069.java
deleted file mode 100644
index 9d11c25..0000000
--- a/hotspot/test/compiler/c2/8002069/Test8002069.java
+++ /dev/null
@@ -1,98 +0,0 @@
-/*
- * Copyright (c) 2012, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- *
- */
-
-/**
- * @test
- * @bug 8002069
- * @summary Assert failed in C2: assert(field->edge_count() > 0) failed: sanity
- *
- * @run main/othervm -Xmx32m -XX:+IgnoreUnrecognizedVMOptions -Xbatch -XX:CompileCommand=exclude,Test8002069.dummy Test8002069
- */
-
-abstract class O {
-  int f;
-  public O() { f = 5; }
-  abstract void put(int i);
-  public int foo(int i) {
-    put(i);
-    return i;
-  }
-};
-
-class A extends O {
-  int[] a;
-  public A(int s) {
-    a = new int[s];
-  }
-  public void put(int i) {
-    a[i%a.length] = i;
-  }
-}
-
-class B extends O {
-  int sz;
-  int[] a;
-  public B(int s) {
-    sz = s;
-    a = new int[s];
-  }
-  public void put(int i) {
-    a[i%sz] = i;
-  }
-}
-
-public class Test8002069 {
-  public static void main(String args[]) {
-    int sum = 0;
-    for (int i=0; i<8000; i++) {
-      sum += test1(i);
-    }
-    for (int i=0; i<100000; i++) {
-      sum += test2(i);
-    }
-    System.out.println("PASSED. sum = " + sum);
-  }
-
-  private O o;
-
-  private int foo(int i) {
-    return o.foo(i);
-  }
-  static int test1(int i) {
-    Test8002069 t = new Test8002069();
-    t.o = new A(5);
-    return t.foo(i);
-  }
-  static int test2(int i) {
-    Test8002069 t = new Test8002069();
-    t.o = new B(5);
-    dummy(i);
-    return t.foo(i);
-  }
-
-  static int dummy(int i) {
-    return i*2;
-  }
-}
-
diff --git a/hotspot/test/compiler/c2/FloatingPointFoldingTest.java b/hotspot/test/compiler/c2/FloatingPointFoldingTest.java
index cb3ce01..78431c2 100644
--- a/hotspot/test/compiler/c2/FloatingPointFoldingTest.java
+++ b/hotspot/test/compiler/c2/FloatingPointFoldingTest.java
@@ -26,9 +26,19 @@
  * @test
  * @bug 8073670
  * @summary Test that causes C2 to fold two NaNs with different values into a single NaN.
- * @run main/othervm -XX:-TieredCompilation -Xcomp -XX:CompileCommand=compileonly,FloatingPointFoldingTest.test_double_inf -XX:CompileCommand=compileonly,FloatingPointFoldingTest.test_double_zero -XX:CompileCommand=compileonly,FloatingPointFoldingTest.test_double_nan -XX:CompileCommand=compileonly,FloatingPointFoldingTest.test_float_inf -XX:CompileCommand=compileonly,FloatingPointFoldingTest.test_float_zero -XX:CompileCommand=compileonly,FloatingPointFoldingTest.test_float_nan FloatingPointFoldingTest
+ *
+ * @run main/othervm -XX:-TieredCompilation -Xcomp
+ *      -XX:CompileCommand=compileonly,compiler.c2.FloatingPointFoldingTest::test_double_inf
+ *      -XX:CompileCommand=compileonly,compiler.c2.FloatingPointFoldingTest::test_double_zero
+ *      -XX:CompileCommand=compileonly,compiler.c2.FloatingPointFoldingTest::test_double_nan
+ *      -XX:CompileCommand=compileonly,compiler.c2.FloatingPointFoldingTest::test_float_inf
+ *      -XX:CompileCommand=compileonly,compiler.c2.FloatingPointFoldingTest::test_float_zero
+ *      -XX:CompileCommand=compileonly,compiler.c2.FloatingPointFoldingTest::test_float_nan
+ *      compiler.c2.FloatingPointFoldingTest
  */
 
+package compiler.c2;
+
 public class FloatingPointFoldingTest {
     // Double values.
     public static final long MINUS_INF_LONGBITS = 0xfff0000000000000L;
diff --git a/hotspot/test/compiler/c2/6663621/IVTest.java b/hotspot/test/compiler/c2/IVTest.java
similarity index 98%
rename from hotspot/test/compiler/c2/6663621/IVTest.java
rename to hotspot/test/compiler/c2/IVTest.java
index 0ef480b..b6239d0 100644
--- a/hotspot/test/compiler/c2/6663621/IVTest.java
+++ b/hotspot/test/compiler/c2/IVTest.java
@@ -26,8 +26,12 @@
  * @test
  * @bug 6663621
  * @summary JVM crashes while trying to execute api/java_security/Signature/SignatureTests.html#initSign tests.
+ *
+ * @run main compiler.c2.IVTest
  */
 
+package compiler.c2;
+
 public class IVTest {
     static int paddedSize;
 
diff --git a/hotspot/test/compiler/c2/6772683/InterruptedTest.java b/hotspot/test/compiler/c2/InterruptedTest.java
similarity index 97%
rename from hotspot/test/compiler/c2/6772683/InterruptedTest.java
rename to hotspot/test/compiler/c2/InterruptedTest.java
index aa513fa..b4caace 100644
--- a/hotspot/test/compiler/c2/6772683/InterruptedTest.java
+++ b/hotspot/test/compiler/c2/InterruptedTest.java
@@ -26,9 +26,12 @@
  * @test
  * @bug 6772683
  * @summary Thread.isInterrupted() fails to return true on multiprocessor PC
- * @run main/othervm InterruptedTest 100
+ *
+ * @run main/othervm compiler.c2.InterruptedTest 100
  */
 
+package compiler.c2;
+
 public class InterruptedTest {
 
     public static void main(String[] args) throws Exception {
diff --git a/hotspot/test/compiler/c2/6894807/IsInstanceTest.java b/hotspot/test/compiler/c2/IsInstanceTest.java
similarity index 96%
rename from hotspot/test/compiler/c2/6894807/IsInstanceTest.java
rename to hotspot/test/compiler/c2/IsInstanceTest.java
index 6350109..75ee459 100644
--- a/hotspot/test/compiler/c2/6894807/IsInstanceTest.java
+++ b/hotspot/test/compiler/c2/IsInstanceTest.java
@@ -25,9 +25,12 @@
  * @test
  * @bug 6894807
  * @summary No ClassCastException for HashAttributeSet constructors if run with -Xcomp
- * @run main IsInstanceTest
+ *
+ * @run main compiler.c2.IsInstanceTest
 */
 
+package compiler.c2;
+
 public class IsInstanceTest {
 
     public static void main(String[] args) {
diff --git a/hotspot/test/compiler/c2/8005956/PolynomialRoot.java b/hotspot/test/compiler/c2/PolynomialRoot.java
similarity index 98%
rename from hotspot/test/compiler/c2/8005956/PolynomialRoot.java
rename to hotspot/test/compiler/c2/PolynomialRoot.java
index ae59572..86836d0 100644
--- a/hotspot/test/compiler/c2/8005956/PolynomialRoot.java
+++ b/hotspot/test/compiler/c2/PolynomialRoot.java
@@ -10,16 +10,20 @@
  */
 
 /**
-* @test
-* @bug 8005956
-* @summary C2: assert(!def_outside->member(r)) failed: Use of external LRG overlaps the same LRG defined in this block
-* @library /testlibrary
-* @modules java.base/jdk.internal.misc
-*          java.management
-* @run main/timeout=300 PolynomialRoot
-*/
+ * @test
+ * @bug 8005956
+ * @summary C2: assert(!def_outside->member(r)) failed: Use of external LRG overlaps the same LRG defined in this block
+ * @library /testlibrary
+ * @modules java.base/jdk.internal.misc
+ *          java.management
+ *
+ * @run main/timeout=300 compiler.c2.PolynomialRoot
+ */
+
+package compiler.c2;
 
 import jdk.test.lib.Utils;
+
 import java.util.Arrays;
 import java.util.Random;
 
diff --git a/hotspot/test/compiler/c2/5057225/Test5057225.java b/hotspot/test/compiler/c2/Test5057225.java
similarity index 91%
rename from hotspot/test/compiler/c2/5057225/Test5057225.java
rename to hotspot/test/compiler/c2/Test5057225.java
index 7cf64f9..632f678 100644
--- a/hotspot/test/compiler/c2/5057225/Test5057225.java
+++ b/hotspot/test/compiler/c2/Test5057225.java
@@ -27,9 +27,13 @@
  * @summary Remove useless I2L conversions
  * @modules java.base/jdk.internal.misc
  * @library /testlibrary
- * @run main/othervm -Xcomp -XX:CompileOnly=Test5057225.doload Test5057225
+ *
+ * @run main/othervm -Xcomp
+ *      -XX:CompileCommand=compileonly,compiler.c2.Test5057225::doload
+ *      compiler.c2.Test5057225
  */
 
+package compiler.c2;
 import jdk.test.lib.Utils;
 
 public class Test5057225 {
@@ -69,17 +73,17 @@
     public static void main(String[] args) throws Exception {
         for (int i = 0; i < BYTE_MASKS.length; i++) {
             System.setProperty("value", "" + BYTE_MASKS[i]);
-            loadAndRunClass("Test5057225$loadUB2L");
+            loadAndRunClass(Test5057225.class.getName() + "$loadUB2L");
         }
 
         for (int i = 0; i < SHORT_MASKS.length; i++) {
             System.setProperty("value", "" + SHORT_MASKS[i]);
-            loadAndRunClass("Test5057225$loadUS2L");
+            loadAndRunClass(Test5057225.class.getName() + "$loadUS2L");
         }
 
         for (int i = 0; i < INT_MASKS.length; i++) {
             System.setProperty("value", "" + INT_MASKS[i]);
-            loadAndRunClass("Test5057225$loadUI2L");
+            loadAndRunClass(Test5057225.class.getName() + "$loadUI2L");
         }
     }
 
diff --git a/hotspot/test/compiler/c2/5091921/Test5091921.java b/hotspot/test/compiler/c2/Test5091921.java
similarity index 97%
rename from hotspot/test/compiler/c2/5091921/Test5091921.java
rename to hotspot/test/compiler/c2/Test5091921.java
index dff43e7..07fa59d 100644
--- a/hotspot/test/compiler/c2/5091921/Test5091921.java
+++ b/hotspot/test/compiler/c2/Test5091921.java
@@ -27,9 +27,13 @@
  * @bug 5091921
  * @summary Sign flip issues in loop optimizer
  *
- * @run main/othervm -Xcomp -XX:CompileOnly=Test5091921 -XX:MaxInlineSize=1 Test5091921
+ * @run main/othervm -Xcomp -XX:MaxInlineSize=1
+ *    -XX:CompileCommand=compileonly,compiler.c2.Test5091921::*
+ *    compiler.c2.Test5091921
  */
 
+package compiler.c2;
+
 public class Test5091921 {
   private static int result = 0;
 
diff --git a/hotspot/test/compiler/c2/Test6186134.java b/hotspot/test/compiler/c2/Test6186134.java
new file mode 100644
index 0000000..bf00dc8
--- /dev/null
+++ b/hotspot/test/compiler/c2/Test6186134.java
@@ -0,0 +1,74 @@
+/*
+ * Copyright (c) 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.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ *
+ */
+
+/**
+ * @test
+ * @bug 6186134
+ * @summary Server virtual machine produces/exeutes incorrect code.
+ *
+ * @run main compiler.c2.Test6186134 100000
+ */
+
+package compiler.c2;
+
+import java.util.ArrayList;
+
+public class Test6186134 {
+
+    int num = 0;
+
+    public Test6186134(int n) {
+        num = n;
+    }
+
+    public boolean more() {
+        return num-- > 0;
+    }
+
+    public ArrayList test1() {
+        ArrayList res = new ArrayList();
+        int maxResults = Integer.MAX_VALUE;
+        int n = 0;
+        boolean more = more();
+        while ((n++ < maxResults) && more) {
+            res.add(new Object());
+            more = more();
+        }
+        return res;
+    }
+
+    public static void main(String[] pars) {
+        int n = Integer.parseInt(pars[0]);
+        for (int i = 0; i < n; i++) {
+            Test6186134 t = new Test6186134(10);
+            int size = t.test1().size();
+            if (size != 10) {
+                System.out.println("wrong size: " + size + ", should be 10");
+                System.exit(97);
+            }
+        }
+        System.out.println("Passed");
+    }
+}
+
diff --git a/hotspot/test/compiler/c2/5091921/Test6196102.java b/hotspot/test/compiler/c2/Test6196102.java
similarity index 95%
rename from hotspot/test/compiler/c2/5091921/Test6196102.java
rename to hotspot/test/compiler/c2/Test6196102.java
index 004a68b..aec2616 100644
--- a/hotspot/test/compiler/c2/5091921/Test6196102.java
+++ b/hotspot/test/compiler/c2/Test6196102.java
@@ -27,9 +27,11 @@
  * @bug 6196102
  * @summary Integer seems to be greater than Integer.MAX_VALUE
  *
- * @run main Test6196102
+ * @run main compiler.c2.Test6196102
  */
 
+package compiler.c2;
+
 public class Test6196102 {
     static public void main(String[] args) {
         int i1 = 0;
diff --git a/hotspot/test/compiler/c2/5091921/Test6357214.java b/hotspot/test/compiler/c2/Test6357214.java
similarity index 85%
rename from hotspot/test/compiler/c2/5091921/Test6357214.java
rename to hotspot/test/compiler/c2/Test6357214.java
index 019364d..e9ed37c 100644
--- a/hotspot/test/compiler/c2/5091921/Test6357214.java
+++ b/hotspot/test/compiler/c2/Test6357214.java
@@ -27,46 +27,48 @@
  * @bug 6357214
  * @summary Hotspot server compiler gets integer comparison wrong
  *
- * @run main/othervm/timeout=60 -DshowAll=ffo -DeventID=444 Test6357214
+ * @run main/othervm/timeout=60 -DshowAll=ffo -DeventID=444 compiler.c2.Test6357214
  */
 
+package compiler.c2;
+
 // The test hangs after few iterations before the fix. So it fails if timeout.
-class MyResult {
+public class Test6357214 {
+    static class MyResult {
         public boolean next() {
-                return true;
+            return true;
         }
 
         public String getString(String in) {
-                if (in.equals("id"))
-                        return "idFoo";
-                if (in.equals("contentKey"))
-                        return "ckFoo";
-                return "Foo";
+            if (in.equals("id"))
+                return "idFoo";
+            if (in.equals("contentKey"))
+                return "ckFoo";
+            return "Foo";
         }
 
         public int getInt(String in) {
-                if (in.equals("processingComplete"))
-                        return 0;
-                return 1;
+            if (in.equals("processingComplete"))
+                return 0;
+            return 1;
         }
 
         public byte[] getBytes(String in) {
-                byte[] arr = null;
-                if (in.equals("content")) {
-                        arr = new byte[65536];
-                        byte j = 32;
-                        for (int i=0; i<65536; i++) {
-                                arr[i] = j;
-                                if (++j == 127)
-                                        j=32;
-                        }
+            byte[] arr = null;
+            if (in.equals("content")) {
+                arr = new byte[65536];
+                byte j = 32;
+                for (int i=0; i<65536; i++) {
+                    arr[i] = j;
+                    if (++j == 127)
+                        j=32;
                 }
-                return arr;
+            }
+            return arr;
         }
-}
+    }
 
-public class Test6357214 {
-        public static volatile boolean bollocks = true;
+    public static volatile boolean bollocks = true;
     public String create(String context) throws Exception {
 
         //
diff --git a/hotspot/test/compiler/c2/6443505/Test6443505.java b/hotspot/test/compiler/c2/Test6443505.java
similarity index 95%
rename from hotspot/test/compiler/c2/6443505/Test6443505.java
rename to hotspot/test/compiler/c2/Test6443505.java
index 28461b5..d86cc75 100644
--- a/hotspot/test/compiler/c2/6443505/Test6443505.java
+++ b/hotspot/test/compiler/c2/Test6443505.java
@@ -27,9 +27,13 @@
  * @bug 6443505
  * @summary Some cases for CmpLTMask missed; also wrong code.
  *
- * @run main/othervm -Xcomp -XX:CompileOnly="Test6443505.compiled" Test6443505
+ * @run main/othervm -Xcomp
+ *      -XX:CompileCommand=compileonly,compiler.c2.Test6443505::compiled
+ *      compiler.c2.Test6443505
  */
 
+package compiler.c2;
+
 public class Test6443505 {
 
     public static void main(String[] args) throws InterruptedException {
diff --git a/hotspot/test/compiler/c2/5091921/Test6559156.java b/hotspot/test/compiler/c2/Test6559156.java
similarity index 97%
rename from hotspot/test/compiler/c2/5091921/Test6559156.java
rename to hotspot/test/compiler/c2/Test6559156.java
index 7655323..fafe586 100644
--- a/hotspot/test/compiler/c2/5091921/Test6559156.java
+++ b/hotspot/test/compiler/c2/Test6559156.java
@@ -27,9 +27,11 @@
  * @bug 6559156
  * @summary Server compiler generates bad code for "<= Integer.MAX_VALUE" expression
  *
- * @run main Test6559156
+ * @run main compiler.c2.Test6559156
  */
 
+package compiler.c2;
+
 public class Test6559156 {
 
     static final int N_TESTS = 1000000;
diff --git a/hotspot/test/compiler/c2/6603011/Test.java b/hotspot/test/compiler/c2/Test6603011.java
similarity index 91%
rename from hotspot/test/compiler/c2/6603011/Test.java
rename to hotspot/test/compiler/c2/Test6603011.java
index 39c0419..9495fe3 100644
--- a/hotspot/test/compiler/c2/6603011/Test.java
+++ b/hotspot/test/compiler/c2/Test6603011.java
@@ -27,7 +27,8 @@
  * @summary long/int division by constant
  * @modules java.base/jdk.internal.misc
  * @library /testlibrary
- * @run main/othervm -Xcomp -Xbatch -XX:-Inline Test
+ *
+ * @run main/othervm -Xcomp -Xbatch -XX:-Inline compiler.c2.Test6603011
  */
 
 //
@@ -37,16 +38,17 @@
 //   dividend and divisor combinations are tested
 //
 
+package compiler.c2;
+
 import jdk.test.lib.Utils;
 
-class s {
-  static int  divi(int  dividend, int  divisor) { return dividend / divisor; }
-  static int  modi(int  dividend, int  divisor) { return dividend % divisor; }
-  static long divl(long dividend, long divisor) { return dividend / divisor; }
-  static long modl(long dividend, long divisor) { return dividend % divisor; }
-}
-
-public class Test implements Runnable {
+public class Test6603011 implements Runnable {
+  static class s {
+    static int  divi(int  dividend, int  divisor) { return dividend / divisor; }
+    static int  modi(int  dividend, int  divisor) { return dividend % divisor; }
+    static long divl(long dividend, long divisor) { return dividend / divisor; }
+    static long modl(long dividend, long divisor) { return dividend % divisor; }
+  }
   // Report verbose messages on failure; turn off to suppress
   // too much output with gross numbers of failures.
   static final boolean VERBOSE = true;
@@ -194,13 +196,13 @@
     System.setProperty("divisor", "" + divisor);
     ClassLoader loader
                 = Utils.getTestClassPathURLClassLoader(apploader.getParent());
-    Class c = loader.loadClass("Test");
+    Class c = loader.loadClass(Test6603011.class.getName());
     Runnable r = (Runnable)c.newInstance();
     r.run();
   }
 
   public static void main(String[] args) throws Exception {
-    Class cl = Class.forName("Test");
+    Class cl = Test6603011.class;
     ClassLoader apploader = cl.getClassLoader();
 
 
diff --git a/hotspot/test/compiler/c2/6636138/Test1.java b/hotspot/test/compiler/c2/Test6636138_1.java
similarity index 91%
rename from hotspot/test/compiler/c2/6636138/Test1.java
rename to hotspot/test/compiler/c2/Test6636138_1.java
index d57582f..1ae3a45 100644
--- a/hotspot/test/compiler/c2/6636138/Test1.java
+++ b/hotspot/test/compiler/c2/Test6636138_1.java
@@ -26,10 +26,14 @@
  * @bug 6636138
  * @summary SuperWord::co_locate_pack(Node_List* p) generates memory graph that leads to memory order violation.
  *
- * @run main/othervm -Xbatch -XX:CompileOnly=Test1.init Test1
+ * @run main/othervm -Xbatch
+ *      -XX:CompileCommand=compileonly,compiler.c2.Test6636138_1::init
+ *      compiler.c2.Test6636138_1
  */
 
-public class Test1 {
+package compiler.c2;
+
+public class Test6636138_1 {
 
     public static void init(int src[], int [] dst, int[] ref) {
         // initialize the arrays
diff --git a/hotspot/test/compiler/c2/6636138/Test2.java b/hotspot/test/compiler/c2/Test6636138_2.java
similarity index 67%
rename from hotspot/test/compiler/c2/6636138/Test2.java
rename to hotspot/test/compiler/c2/Test6636138_2.java
index 29e5546..bb2759a 100644
--- a/hotspot/test/compiler/c2/6636138/Test2.java
+++ b/hotspot/test/compiler/c2/Test6636138_2.java
@@ -26,10 +26,14 @@
  * @bug 6636138
  * @summary SuperWord::co_locate_pack(Node_List* p) generates memory graph that leads to memory order violation.
  *
- * @run main/othervm -Xbatch -XX:CompileOnly=Test2.shift Test2
+ * @run main/othervm -Xbatch
+ *      -XX:CompileCommand=compileonly,compiler.c2.Test6636138_2::shift
+ *      compiler.c2.Test6636138_2
  */
 
-public class Test2 {
+package compiler.c2;
+
+public class Test6636138_2 {
 
     public static void init(int src[]) {
         // Initialize the array
@@ -37,22 +41,22 @@
             src[i] = i;
     }
 
-   public static void shift(int src[]) {
-       //left-shift the array
-       for (int i = src.length-1; i > 0; i--){
-           int tmp  = src[i];
-           src[i]   = src[i-1];
-           src[i-1] = tmp;
-       }
+    public static void shift(int src[]) {
+        //left-shift the array
+        for (int i = src.length - 1; i > 0; i--) {
+            int tmp = src[i];
+            src[i] = src[i - 1];
+            src[i - 1] = tmp;
+        }
     }
 
     public static void verify(int src[]) {
-        for (int i = 0; i < src.length; i++){
-            int value = (i-1 + src.length)%src.length; // correct value after shifting
-                if (src[i] != value) {
-                    System.out.println("Error: src["+i+"] should be "+ value + " instead of " + src[i]);
-                    System.exit(97);
-                }
+        for (int i = 0; i < src.length; i++) {
+            int value = (i - 1 + src.length) % src.length; // correct value after shifting
+            if (src[i] != value) {
+                System.out.println("Error: src[" + i + "] should be " + value + " instead of " + src[i]);
+                System.exit(97);
+            }
         }
     }
 
@@ -64,7 +68,7 @@
     }
 
     public static void main(String[] args) {
-        for (int i=0; i< 2000; i++)
+        for (int i = 0; i < 2000; i++)
             test();
     }
-}
+}
\ No newline at end of file
diff --git a/hotspot/test/compiler/c2/6695810/Test.java b/hotspot/test/compiler/c2/Test6646019.java
similarity index 64%
copy from hotspot/test/compiler/c2/6695810/Test.java
copy to hotspot/test/compiler/c2/Test6646019.java
index 7751a5e..2e2060d 100644
--- a/hotspot/test/compiler/c2/6695810/Test.java
+++ b/hotspot/test/compiler/c2/Test6646019.java
@@ -23,33 +23,34 @@
 
 /*
  * @test
- * @bug 6695810
- * @summary null oop passed to encode_heap_oop_not_null
- * @run main/othervm -Xbatch Test
- */
+ * @bug 6646019
+ * @summary array subscript expressions become top() with -d64
+ *
+ * @run main/othervm -Xcomp
+ *      -XX:CompileCommand=compileonly,compiler.c2.Test6646019::test
+ *      compiler.c2.Test6646019
+*/
 
-public class Test {
-    Test _t;
+package compiler.c2;
 
-    static void test(Test t1, Test t2) {
-        if (t2 != null)
-            t1._t = t2;
-
-        if (t2 != null)
-            t1._t = t2;
-    }
+public class Test6646019 {
+    final static int i = 2076285318;
+    long l = 2;
+    short s;
 
     public static void main(String[] args) {
-        Test t = new Test();
-        for (int i = 0; i < 50; i++) {
-            for (int j = 0; j < 100; j++) {
-                test(t, t);
+        Test6646019 t = new Test6646019();
+        try {
+            t.test();
+        } catch (Throwable e) {
+            if (t.l != 5) {
+                System.out.println("Fails: " + t.l + " != 5");
             }
-            test(t, null);
         }
-        for (int i = 0; i < 10000; i++) {
-            test(t, t);
-        }
-        test(t, null);
+    }
+
+    private void test() {
+        l = 5;
+        l = (new short[(byte) -2])[(byte) (l = i)];
     }
 }
diff --git a/hotspot/test/compiler/c2/6661247/Test.java b/hotspot/test/compiler/c2/Test6661247.java
similarity index 97%
rename from hotspot/test/compiler/c2/6661247/Test.java
rename to hotspot/test/compiler/c2/Test6661247.java
index 12f1c2c..5175e38 100644
--- a/hotspot/test/compiler/c2/6661247/Test.java
+++ b/hotspot/test/compiler/c2/Test6661247.java
@@ -26,16 +26,20 @@
  * @test
  * @bug 6661247
  * @summary Internal bug in 32-bit HotSpot optimizer while bit manipulations
+ *
+ * @run main compiler.c2.Test6661247
  */
 
+package compiler.c2;
+
+import java.nio.LongBuffer;
 import java.util.Random;
-import java.nio.*;
 
 // This isn't a completely reliable test for 6661247 since the results
 // depend on what the local schedule looks like but it does reproduce
 // the issue in current builds.
 
-public class Test {
+public class Test6661247 {
 
     public static void test(boolean[] src, int srcPos, LongBuffer dest, long destPos, int count) {
         int countStart = (destPos & 63) == 0 ? 0 : 64 - (int)(destPos & 63);
diff --git a/hotspot/test/compiler/c2/6695810/Test.java b/hotspot/test/compiler/c2/Test6695810.java
similarity index 86%
rename from hotspot/test/compiler/c2/6695810/Test.java
rename to hotspot/test/compiler/c2/Test6695810.java
index 7751a5e..a454d6c 100644
--- a/hotspot/test/compiler/c2/6695810/Test.java
+++ b/hotspot/test/compiler/c2/Test6695810.java
@@ -25,13 +25,16 @@
  * @test
  * @bug 6695810
  * @summary null oop passed to encode_heap_oop_not_null
- * @run main/othervm -Xbatch Test
+ *
+ * @run main/othervm -Xbatch compiler.c2.Test6695810
  */
 
-public class Test {
-    Test _t;
+package compiler.c2;
 
-    static void test(Test t1, Test t2) {
+public class Test6695810 {
+    Test6695810 _t;
+
+    static void test(Test6695810 t1, Test6695810 t2) {
         if (t2 != null)
             t1._t = t2;
 
@@ -40,7 +43,7 @@
     }
 
     public static void main(String[] args) {
-        Test t = new Test();
+        Test6695810 t = new Test6695810();
         for (int i = 0; i < 50; i++) {
             for (int j = 0; j < 100; j++) {
                 test(t, t);
diff --git a/hotspot/test/compiler/c2/6700047/Test6700047.java b/hotspot/test/compiler/c2/Test6700047.java
similarity index 96%
rename from hotspot/test/compiler/c2/6700047/Test6700047.java
rename to hotspot/test/compiler/c2/Test6700047.java
index 789f693..120a9c8 100644
--- a/hotspot/test/compiler/c2/6700047/Test6700047.java
+++ b/hotspot/test/compiler/c2/Test6700047.java
@@ -25,9 +25,12 @@
  * @test
  * @bug 6700047
  * @summary C2 failed in idom_no_update
- * @run main Test6700047
+ *
+ * @run main compiler.c2.Test6700047
  */
 
+package compiler.c2;
+
 public class Test6700047 {
     static byte[] dummy = new byte[256];
 
diff --git a/hotspot/test/compiler/c2/6711100/Test.java b/hotspot/test/compiler/c2/Test6711100.java
similarity index 85%
rename from hotspot/test/compiler/c2/6711100/Test.java
rename to hotspot/test/compiler/c2/Test6711100.java
index 090476c..dbdae35 100644
--- a/hotspot/test/compiler/c2/6711100/Test.java
+++ b/hotspot/test/compiler/c2/Test6711100.java
@@ -25,16 +25,21 @@
  * @test
  * @bug 6711100
  * @summary 64bit fastdebug server vm crashes with assert(_base == Int,"Not an Int")
- * @run main/othervm -Xcomp -XX:CompileOnly=Test.<init> Test
+ *
+ * @run main/othervm -Xcomp
+ *      -XX:CompileCommand=compileonly,compiler.c2.Test6711100::<init>
+ *      compiler.c2.Test6711100
  */
 
-public class Test {
+package compiler.c2;
+
+public class Test6711100 {
 
     static byte b;
 
     // The server compiler chokes on compiling
     // this method when f() is not inlined
-    public Test() {
+    public Test6711100() {
         b = (new byte[1])[(new byte[f()])[-1]];
     }
 
@@ -44,7 +49,7 @@
 
     public static void main(String[] args) {
       try {
-        Test t = new Test();
+        Test6711100 t = new Test6711100();
       } catch (ArrayIndexOutOfBoundsException e) {
       }
     }
diff --git a/hotspot/test/compiler/c2/6724218/Test.java b/hotspot/test/compiler/c2/Test6724218.java
similarity index 85%
rename from hotspot/test/compiler/c2/6724218/Test.java
rename to hotspot/test/compiler/c2/Test6724218.java
index 5dea55f..0bef15b 100644
--- a/hotspot/test/compiler/c2/6724218/Test.java
+++ b/hotspot/test/compiler/c2/Test6724218.java
@@ -25,21 +25,26 @@
  * @test
  * @bug 6724218
  * @summary Fix raise_LCA_above_marks() early termination
- * @run main/othervm -Xbatch -XX:CompileCommand=exclude,Test.update Test
+ *
+ * @run main/othervm -Xbatch
+ *      -XX:CompileCommand=exclude,compiler.c2.Test6724218::update
+ *      compiler.c2.Test6724218
  */
 
-public class Test {
-    Test   next  = null;
+package compiler.c2;
+
+public class Test6724218 {
+    Test6724218 next  = null;
     Object value = null;
 
     static boolean _closed = false;
     static int size = 0;
-    static Test list  = null;
+    static Test6724218 list  = null;
     static int cache_size = 0;
-    static Test cache = null;
+    static Test6724218 cache = null;
 
     Object get(int i) {
-        Test t = list;
+        Test6724218 t = list;
         list = t.next;
         size -= 1;
         Object o = t.value;
@@ -55,13 +60,13 @@
     void update() {
         // Exclude compilation of this one.
         if (size == 0) {
-            Test t;
+            Test6724218 t;
             if (cache_size > 0) {
                 t = cache;
                 cache = t.next;
                 cache_size = -1;
             } else {
-                t = new Test();
+                t = new Test6724218();
             }
             t.value = new Object();
             t.next = list;
@@ -82,7 +87,7 @@
     }
 
     public static void main(String argv[]) throws Exception {
-        Test t = new Test();
+        Test6724218 t = new Test6724218();
         int lim = 500000;
         Object o;
         for (int j = 0; j < lim; j++) {
diff --git a/hotspot/test/compiler/c2/6732154/Test6732154.java b/hotspot/test/compiler/c2/Test6732154.java
similarity index 96%
rename from hotspot/test/compiler/c2/6732154/Test6732154.java
rename to hotspot/test/compiler/c2/Test6732154.java
index 3618f67..bc695fe 100644
--- a/hotspot/test/compiler/c2/6732154/Test6732154.java
+++ b/hotspot/test/compiler/c2/Test6732154.java
@@ -27,8 +27,13 @@
  * @bug 6732154
  * @summary REG: Printing an Image using image/gif doc flavor crashes the VM, Solsparc
  *
- * @run main/othervm -Xcomp -XX:CompileOnly="Test6732154::ascii85Encode" Test6732154
+ * @run main/othervm -Xcomp
+ *      -XX:CompileCommand=compileonly,compiler.c2.Test6732154::ascii85Encode
+ *      compiler.c2.Test6732154
  */
+
+package compiler.c2;
+
 public class Test6732154 {
 
     // Exact copy of sun.print.PSPrinterJob.ascii85Encode([b)[b
diff --git a/hotspot/test/compiler/c2/6741738/Tester.java b/hotspot/test/compiler/c2/Test6741738.java
similarity index 67%
rename from hotspot/test/compiler/c2/6741738/Tester.java
rename to hotspot/test/compiler/c2/Test6741738.java
index f9833ae..58f4a6f 100644
--- a/hotspot/test/compiler/c2/6741738/Tester.java
+++ b/hotspot/test/compiler/c2/Test6741738.java
@@ -25,26 +25,31 @@
  * @test
  * @bug 6741738
  * @summary TypePtr::add_offset() set incorrect offset when the add overflows
- * @run main/othervm -Xcomp -XX:CompileOnly=Tester.foo Tester
+ *
+ * @run main/othervm -Xcomp
+ *      -XX:CompileCommand=compileonly,compiler.c2.Test6741738::foo
+ *      compiler.c2.Test6741738
  */
 
-public class Tester {
-        private String[] values;
-        private int count;
+package compiler.c2;
 
-        String foo() {
-                int i = Integer.MAX_VALUE-1;
-                String s;
-                try {
-                    s = values[i];
-                } catch (Throwable e) {
-                    s = "";
-                }
-                return s;
-        }
+public class Test6741738 {
+    private String[] values;
+    private int count;
 
-        public static void main(String[] args) {
-                Tester t = new Tester();
-                String s = t.foo();
+    String foo() {
+        int i = Integer.MAX_VALUE - 1;
+        String s;
+        try {
+            s = values[i];
+        } catch (Throwable e) {
+            s = "";
         }
+        return s;
+    }
+
+    public static void main(String[] args) {
+        Test6741738 t = new Test6741738();
+        String s = t.foo();
+    }
 }
diff --git a/hotspot/test/compiler/c2/5091921/Test6753639.java b/hotspot/test/compiler/c2/Test6753639.java
similarity index 95%
rename from hotspot/test/compiler/c2/5091921/Test6753639.java
rename to hotspot/test/compiler/c2/Test6753639.java
index 93466cf..6eba35a 100644
--- a/hotspot/test/compiler/c2/5091921/Test6753639.java
+++ b/hotspot/test/compiler/c2/Test6753639.java
@@ -27,9 +27,11 @@
  * @bug 6753639
  * @summary Strange optimisation in for loop with cyclic integer condition
  *
- * @run main/othervm -Xbatch Test6753639
+ * @run main/othervm -Xbatch compiler.c2.Test6753639
  */
 
+package compiler.c2;
+
 public class Test6753639 {
     public static void main(String[] args) throws InterruptedException {
         int END = Integer.MAX_VALUE;
diff --git a/hotspot/test/compiler/c2/6792161/Test6792161.java b/hotspot/test/compiler/c2/Test6792161.java
similarity index 89%
rename from hotspot/test/compiler/c2/6792161/Test6792161.java
rename to hotspot/test/compiler/c2/Test6792161.java
index 309c5bb..fa4aadd 100644
--- a/hotspot/test/compiler/c2/6792161/Test6792161.java
+++ b/hotspot/test/compiler/c2/Test6792161.java
@@ -27,10 +27,13 @@
  * @bug 6792161
  * @summary assert("No dead instructions after post-alloc")
  *
- * @run main/othervm/timeout=600 -Xcomp -XX:MaxInlineSize=120 Test6792161
+ * @run main/othervm/timeout=600 -Xcomp -XX:MaxInlineSize=120 compiler.c2.Test6792161
  */
 
+package compiler.c2;
+
 import java.lang.reflect.Constructor;
+
 public class Test6792161 {
     static Constructor test(Class cls) throws Exception {
         Class[] args= { String.class };
@@ -42,7 +45,7 @@
     public static void main(final String[] args) throws Exception {
         try {
             for (int i = 0; i < 100000; i++) {
-                Constructor ctor = test(Class.forName("Test6792161"));
+                Constructor ctor = test(Class.forName("compiler.c2.Test6792161"));
             }
         } catch (NoSuchMethodException e) {}
     }
diff --git a/hotspot/test/compiler/c2/6795362/Test6795362.java b/hotspot/test/compiler/c2/Test6795362.java
similarity index 90%
rename from hotspot/test/compiler/c2/6795362/Test6795362.java
rename to hotspot/test/compiler/c2/Test6795362.java
index ac47483..a78510b 100644
--- a/hotspot/test/compiler/c2/6795362/Test6795362.java
+++ b/hotspot/test/compiler/c2/Test6795362.java
@@ -26,9 +26,13 @@
  * @bug 6795362
  * @summary 32bit server compiler leads to wrong results on solaris-x86
  *
- * @run main/othervm -Xcomp -XX:CompileOnly=Test6795362.sub Test6795362
+ * @run main/othervm -Xcomp
+ *      -XX:CompileCommand=compileonly,compiler.c2.Test6795362::sub
+ *      compiler.c2.Test6795362
  */
 
+package compiler.c2;
+
 public class Test6795362 {
     public static void main(String[] args)
     {
diff --git a/hotspot/test/compiler/c2/6796786/Test6796786.java b/hotspot/test/compiler/c2/Test6796786.java
similarity index 95%
rename from hotspot/test/compiler/c2/6796786/Test6796786.java
rename to hotspot/test/compiler/c2/Test6796786.java
index 625b616..285f0d8 100644
--- a/hotspot/test/compiler/c2/6796786/Test6796786.java
+++ b/hotspot/test/compiler/c2/Test6796786.java
@@ -27,9 +27,11 @@
  * @bug 6796786
  * @summary invalid FP identity transform - (a - b) -> b - a
  *
- * @run main/othervm -Xbatch Test6796786
+ * @run main/othervm -Xbatch compiler.c2.Test6796786
  */
 
+package compiler.c2;
+
 public class Test6796786 {
     static volatile float d1;
     static volatile float d2;
diff --git a/hotspot/test/compiler/c2/6799693/Test.java b/hotspot/test/compiler/c2/Test6799693.java
similarity index 68%
rename from hotspot/test/compiler/c2/6799693/Test.java
rename to hotspot/test/compiler/c2/Test6799693.java
index 19a9156..8e3e83a 100644
--- a/hotspot/test/compiler/c2/6799693/Test.java
+++ b/hotspot/test/compiler/c2/Test6799693.java
@@ -26,22 +26,27 @@
  * @test
  * @bug 6799693
  * @summary Server compiler leads to data corruption when expression throws an Exception
- * @run main/othervm -Xcomp -XX:CompileOnly=Test Test
+ *
+ * @run main/othervm -Xcomp
+ *      -XX:CompileCommand=compileonly,compiler.c2.Test6799693::*
+ *      compiler.c2.Test6799693
  */
 
-public class Test {
-   static int var_bad = 1;
+package compiler.c2;
 
-   public static void main(String[] args)
-   {
-      var_bad++;
+public class Test6799693 {
+    static int var_bad = 1;
 
-      try {
-         for (int i = 0; i < 10; i++) (new byte[((byte)-1 << i)])[0]  = 0;
-      }
-      catch (Exception e) { System.out.println("Got " + e); }
+    public static void main(String[] args) {
+        var_bad++;
 
-      System.out.println("Test.var_bad = " +  var_bad + " (expected 2)\n");
-   }
+        try {
+            for (int i = 0; i < 10; i++) (new byte[((byte) -1 << i)])[0] = 0;
+        } catch (Exception e) {
+            System.out.println("Got " + e);
+        }
+
+        System.out.println("Test.var_bad = " + var_bad + " (expected 2)\n");
+    }
 }
 
diff --git a/hotspot/test/compiler/c2/6800154/Test6800154.java b/hotspot/test/compiler/c2/Test6800154.java
similarity index 92%
rename from hotspot/test/compiler/c2/6800154/Test6800154.java
rename to hotspot/test/compiler/c2/Test6800154.java
index b43c155..9de9b76 100644
--- a/hotspot/test/compiler/c2/6800154/Test6800154.java
+++ b/hotspot/test/compiler/c2/Test6800154.java
@@ -27,9 +27,15 @@
  * @summary Add comments to long_by_long_mulhi() for better understandability
  * @modules java.base/jdk.internal.misc
  * @library /testlibrary
- * @run main/othervm -Xcomp -XX:CompileOnly=Test6800154.divcomp Test6800154
+ *
+ * @run main/othervm -Xcomp
+ *      -XX:CompileCommand=compileonly,compiler.c2.Test6800154::divcomp
+ *      compiler.c2.Test6800154
  */
 
+
+package compiler.c2;
+
 import jdk.test.lib.Utils;
 
 public class Test6800154 implements Runnable {
@@ -78,7 +84,7 @@
 
     public static void main(String[] args) throws Exception
     {
-        Class cl = Class.forName("Test6800154");
+        Class cl = Test6800154.class;
         ClassLoader apploader = cl.getClassLoader();
 
         // Iterate over all divisors.
@@ -86,7 +92,7 @@
             System.setProperty("divisor", "" + DIVISORS[i]);
             ClassLoader loader
                     = Utils.getTestClassPathURLClassLoader(apploader.getParent());
-            Class c = loader.loadClass("Test6800154");
+            Class c = loader.loadClass(Test6800154.class.getName());
             Runnable r = (Runnable) c.newInstance();
             r.run();
         }
diff --git a/hotspot/test/compiler/c2/6805724/Test6805724.java b/hotspot/test/compiler/c2/Test6805724.java
similarity index 90%
rename from hotspot/test/compiler/c2/6805724/Test6805724.java
rename to hotspot/test/compiler/c2/Test6805724.java
index afa20d2..2433fce 100644
--- a/hotspot/test/compiler/c2/6805724/Test6805724.java
+++ b/hotspot/test/compiler/c2/Test6805724.java
@@ -28,9 +28,14 @@
  *          when divisor is any (2^k-1) constant.
  * @modules java.base/jdk.internal.misc
  * @library /testlibrary
- * @run main/othervm -Xcomp -XX:CompileOnly=Test6805724.fcomp Test6805724
+ *
+ * @run main/othervm -Xcomp
+ *      -XX:CompileCommand=compileonly,compiler.c2.Test6805724::fcomp
+ *      compiler.c2.Test6805724
  */
 
+package compiler.c2;
+
 import jdk.test.lib.Utils;
 
 public class Test6805724 implements Runnable {
@@ -66,7 +71,7 @@
     }
 
     public static void main(String args[]) throws Exception {
-        Class cl = Class.forName("Test6805724");
+        Class cl = Test6805724.class;
         ClassLoader apploader = cl.getClassLoader();
 
         // Iterate over all 2^k-1 divisors.
@@ -75,7 +80,7 @@
             System.setProperty("divisor", "" + divisor);
             ClassLoader loader
                     = Utils.getTestClassPathURLClassLoader(apploader.getParent());
-            Class c = loader.loadClass("Test6805724");
+            Class c = loader.loadClass(Test6805724.class.getName());
             Runnable r = (Runnable) c.newInstance();
             r.run();
         }
diff --git a/hotspot/test/compiler/c2/Test6823453.java b/hotspot/test/compiler/c2/Test6823453.java
new file mode 100644
index 0000000..96675ad
--- /dev/null
+++ b/hotspot/test/compiler/c2/Test6823453.java
@@ -0,0 +1,109 @@
+/*
+ * Copyright (c) 2009, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ *
+ */
+
+/*
+ * @test
+ * @bug 6823453
+ * @summary DeoptimizeALot causes fastdebug server jvm to fail with assert(false,"unscheduable graph")
+ *
+ * @run main/othervm -Xcomp -XX:+IgnoreUnrecognizedVMOptions -XX:+DeoptimizeALot
+ *      -XX:CompileCommand=compileonly,compiler.c2.Test6823453::*
+ *      compiler.c2.Test6823453
+ */
+
+package compiler.c2;
+
+public class Test6823453 {
+
+    static long vara_1 = 1L;
+
+    static void testa() {
+        short var_2 = (byte) 1.0E10;
+
+        for (Object temp = new byte[(byte) 1.0E10]; true;
+             var_2 = "1".equals("0") ? ((byte) vara_1) : 1) {
+        }
+    }
+
+    static void testb() {
+        long var_1 = -1L;
+
+        short var_2 = (byte) 1.0E10;
+
+        for (Object temp = new byte[(byte) 1.0E10]; true;
+             var_2 = "1".equals("0") ? ((byte) var_1) : 1) {
+        }
+    }
+
+    static void testc() {
+        long var_1 = -1L;
+        if (vara_1 > 0) var_1 = 1L;
+
+        int var_2 = (byte) var_1 - 128;
+
+        for (Object temp = new byte[var_2]; true;
+             var_2 = "1".equals("0") ? 2 : 1) {
+        }
+    }
+
+    static void testd() {
+        long var_1 = 0L;
+
+        int var_2 = (byte) var_1 + 1;
+        for (int i = 0; i < 2; i++) var_2 = var_2 - 1;
+
+        for (Object temp = new byte[var_2]; true;
+             var_2 = "1".equals("0") ? 2 : 1) {
+        }
+    }
+
+    public static void main(String[] args) throws Exception {
+        int nex = 0;
+
+        try {
+            testa();
+        } catch (java.lang.NegativeArraySizeException ex) {
+            nex++;
+        }
+        try {
+            testb();
+        } catch (java.lang.NegativeArraySizeException ex) {
+            nex++;
+        }
+        try {
+            testc();
+        } catch (java.lang.NegativeArraySizeException ex) {
+            nex++;
+        }
+        try {
+            testd();
+        } catch (java.lang.NegativeArraySizeException ex) {
+            nex++;
+        }
+
+        if (nex != 4)
+            System.exit(97);
+    }
+}
+
diff --git a/hotspot/test/compiler/c2/6832293/Test.java b/hotspot/test/compiler/c2/Test6832293.java
similarity index 74%
rename from hotspot/test/compiler/c2/6832293/Test.java
rename to hotspot/test/compiler/c2/Test6832293.java
index 302717b..d75c9ab 100644
--- a/hotspot/test/compiler/c2/6832293/Test.java
+++ b/hotspot/test/compiler/c2/Test6832293.java
@@ -26,52 +26,57 @@
  * @test
  * @bug 6832293
  * @summary JIT compiler got wrong result in type checking with -server
- * @run main/othervm  -Xcomp -XX:CompileOnly=Test.run Test
+ *
+ * @run main/othervm -Xcomp
+ *      -XX:CompileCommand=compileonly,compiler.c2.Test6832293::run
+ *      compiler.c2.Test6832293
  */
 
+package compiler.c2;
+
 import java.io.PrintStream;
 
-interface SomeInterface {
-    int SEVENS = 777;
-}
-
-interface AnotherInterface {
-    int THIRDS = 33;
-}
-
-class SomeClass implements SomeInterface {
-    int i;
-
-    SomeClass(int i) {
-        this.i = i;
+public class Test6832293 {
+    static interface SomeInterface {
+        int SEVENS = 777;
     }
-}
 
-class ImmediateSubclass extends SomeClass implements SomeInterface {
-    float f;
-
-    ImmediateSubclass(int i, float f) {
-        super(i);
-        this.f = f;
+    static interface AnotherInterface {
+        int THIRDS = 33;
     }
-}
 
-final class FinalSubclass extends ImmediateSubclass implements AnotherInterface {
-    double d;
+    static class SomeClass implements SomeInterface {
+        int i;
 
-     FinalSubclass(int i, float f, double d) {
-        super(i, f);
-        this.d = d;
+        SomeClass(int i) {
+            this.i = i;
+        }
     }
-}
 
-public class Test {
+    static class ImmediateSubclass extends SomeClass implements SomeInterface {
+        float f;
+
+        ImmediateSubclass(int i, float f) {
+            super(i);
+            this.f = f;
+        }
+    }
+
+    static final class FinalSubclass extends ImmediateSubclass implements AnotherInterface {
+        double d;
+
+        FinalSubclass(int i, float f, double d) {
+            super(i, f);
+            this.d = d;
+        }
+    }
 
     public static void main(String args[]) throws Exception{
         /* try to pre initialize */
         SomeClass[] a=new SomeClass[10];
-        Class.forName("ImmediateSubclass");
-        Class.forName("FinalSubclass");
+        String className = Test6832293.class.getName();
+        Class.forName(className + "$ImmediateSubclass");
+        Class.forName(className + "$FinalSubclass");
         System.exit(run(args, System.out) + 95/*STATUS_TEMP*/);
     }
 
diff --git a/hotspot/test/compiler/c2/6837011/Test6837011.java b/hotspot/test/compiler/c2/Test6837011.java
similarity index 90%
rename from hotspot/test/compiler/c2/6837011/Test6837011.java
rename to hotspot/test/compiler/c2/Test6837011.java
index be90060..0578f63 100644
--- a/hotspot/test/compiler/c2/6837011/Test6837011.java
+++ b/hotspot/test/compiler/c2/Test6837011.java
@@ -26,9 +26,13 @@
  * @bug 6837011
  * @summary SIGSEGV in PhaseIdealLoop in 32bit jvm
  *
- * @run main/othervm -Xcomp -XX:CompileOnly=Test6837011.main Test6837011
+ * @run main/othervm -Xcomp
+ *      -XX:CompileCommand=compileonly,compiler.c2.Test6837011::main
+ *      compiler.c2.Test6837011
  */
 
+package compiler.c2;
+
 public class Test6837011 {
     static boolean var_3 = true;
 
diff --git a/hotspot/test/compiler/c2/6837094/Test.java b/hotspot/test/compiler/c2/Test6837094.java
similarity index 76%
rename from hotspot/test/compiler/c2/6837094/Test.java
rename to hotspot/test/compiler/c2/Test6837094.java
index 231b476..e1f904b 100644
--- a/hotspot/test/compiler/c2/6837094/Test.java
+++ b/hotspot/test/compiler/c2/Test6837094.java
@@ -27,13 +27,19 @@
  * @bug 6837094
  * @summary False positive for "meet not symmetric" failure
  *
- * @run main/othervm -Xbatch -XX:CompileOnly=Test.collectIs,Test$Factory$1.getArray,Test$Factory$2.getArray Test
+ * @run main/othervm -Xbatch
+ *    -XX:CompileCommand=compileonly,compiler.c2.Test6837094::collectIs
+ *    -XX:CompileCommand=compileonly,compiler.c2.Test6837094$Factory$1::getArray
+ *    -XX:CompileCommand=compileonly,compiler.c2.Test6837094$Factory$2::getArray
+ *    compiler.c2.Test6837094
  */
 
-import java.util.Set;
-import java.util.HashSet;
+package compiler.c2;
 
-public class Test {
+import java.util.HashSet;
+import java.util.Set;
+
+public class Test6837094 {
 
   private interface Factory<M extends Interface> {
     Factory<Child0> Zero = new Factory<Child0>() {
@@ -72,23 +78,25 @@
       collectIs(Factory.One, s);
     }
   }
+
+  /**
+   * Establish necessary class hierarchy
+   */
+
+  static interface Interface {
+  }
+
+  static class Parent {
+  }
+
+  static class Child0 extends Parent implements Interface {
+  }
+
+  static class Child1 extends Parent implements Interface {
+  }
+
+  static class Child2 extends Parent implements Interface {
+  }
+
 }
 
-/**
- * Establish necessary class hierarchy
- */
-
-interface Interface {
-}
-
-class Parent {
-}
-
-class Child0 extends Parent implements Interface {
-}
-
-class Child1 extends Parent implements Interface {
-}
-
-class Child2 extends Parent implements Interface {
-}
diff --git a/hotspot/test/compiler/c2/6843752/Test.java b/hotspot/test/compiler/c2/Test6843752.java
similarity index 95%
rename from hotspot/test/compiler/c2/6843752/Test.java
rename to hotspot/test/compiler/c2/Test6843752.java
index 48afcd2..fbc891c 100644
--- a/hotspot/test/compiler/c2/6843752/Test.java
+++ b/hotspot/test/compiler/c2/Test6843752.java
@@ -25,10 +25,13 @@
  * @test
  * @bug 6843752
  * @summary missing code for an anti-dependent Phi in GCM
- * @run main/othervm -Xbatch Test
+ *
+ * @run main/othervm -Xbatch compiler.c2.Test6843752
  */
 
-public class Test {
+package compiler.c2;
+
+public class Test6843752 {
 
     Item list;
 
@@ -97,7 +100,7 @@
 
     static public void main(String[] args) {
         int caseCnt = 0;
-        Test bj = new Test();
+        Test6843752 bj = new Test6843752();
         try {
             for (; caseCnt < 500000;) {
                 int numItems = (++caseCnt % 2);
diff --git a/hotspot/test/compiler/c2/5091921/Test6850611.java b/hotspot/test/compiler/c2/Test6850611.java
similarity index 95%
rename from hotspot/test/compiler/c2/5091921/Test6850611.java
rename to hotspot/test/compiler/c2/Test6850611.java
index 87b0e6b..bbfa34f 100644
--- a/hotspot/test/compiler/c2/5091921/Test6850611.java
+++ b/hotspot/test/compiler/c2/Test6850611.java
@@ -27,9 +27,11 @@
  * @bug 6850611
  * @summary int / long arithmetic seems to be broken in 1.6.0_14 HotSpot Server VM (Win XP)
  *
- * @run main/timeout=480 Test6850611
+ * @run main/timeout=480 compiler.c2.Test6850611
  */
 
+package compiler.c2;
+
 public class Test6850611 {
 
     public static void main(String[] args) {
diff --git a/hotspot/test/compiler/c2/Test6851282.java b/hotspot/test/compiler/c2/Test6851282.java
new file mode 100644
index 0000000..8031a05
--- /dev/null
+++ b/hotspot/test/compiler/c2/Test6851282.java
@@ -0,0 +1,128 @@
+/*
+ * Copyright (c) 2009, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ *
+ */
+
+/**
+ * @test
+ * @bug 6851282
+ * @summary JIT miscompilation results in null entry in array when using CompressedOops
+ *
+ * @run main/othervm/timeout=600 -Xmx256m -XX:+IgnoreUnrecognizedVMOptions -XX:+UseCompressedOops
+ *    compiler.c2.Test6851282
+ */
+
+package compiler.c2;
+
+import java.util.ArrayList;
+import java.util.List;
+
+public class Test6851282 {
+  void foo(A a, A[] as) {
+    for (A a1 : as) {
+      B[] filtered = a.c(a1);
+      for (B b : filtered) {
+        if (b == null) {
+          System.out.println("bug: b == null");
+          System.exit(97);
+        }
+      }
+    }
+  }
+
+  public static void main(String[] args) {
+    List<A> as = new ArrayList<A>();
+    for (int i = 0; i < 5000; i++) {
+      List<B> bs = new ArrayList<B>();
+      for (int j = i; j < i + 1000; j++)
+        bs.add(new B(j));
+      as.add(new A(bs.toArray(new B[0])));
+    }
+    new Test6851282().foo(as.get(0), as.subList(1, as.size()).toArray(new A[0]));
+  }
+
+  static class A {
+    final B[] bs;
+
+    public A(B[] bs) {
+      this.bs = bs;
+    }
+
+    final B[] c(final A a) {
+      return new BoxedArray<B>(bs).filter(new Function<B, Boolean>() {
+        public Boolean apply(B arg) {
+          for (B b : a.bs) {
+            if (b.d == arg.d)
+              return true;
+          }
+          return false;
+        }
+      });
+    }
+  }
+
+  static class BoxedArray<T> {
+
+    private final T[] array;
+
+    BoxedArray(T[] array) {
+      this.array = array;
+    }
+
+    public T[] filter(Function<T, Boolean> function) {
+      boolean[] include = new boolean[array.length];
+      int len = 0;
+      int i = 0;
+      while (i < array.length) {
+        if (function.apply(array[i])) {
+          include[i] = true;
+          len += 1;
+        }
+        i += 1;
+      }
+      T[] result = (T[]) java.lang.reflect.Array.newInstance(array.getClass().getComponentType(), len);
+      len = 0;
+      i = 0;
+      while (len < result.length) {
+        if (include[i]) {
+          result[len] = array[i];
+          len += 1;
+        }
+        i += 1;
+      }
+      return result;
+    }
+  }
+
+  static interface Function<T, R> {
+    R apply(T arg);
+  }
+
+  static class B {
+    final int d;
+
+    public B(int d) {
+      this.d = d;
+    }
+  }
+}
+
diff --git a/hotspot/test/compiler/c2/6852078/Test6852078.java b/hotspot/test/compiler/c2/Test6852078.java
similarity index 95%
rename from hotspot/test/compiler/c2/6852078/Test6852078.java
rename to hotspot/test/compiler/c2/Test6852078.java
index 274c20b..dbf89a0 100644
--- a/hotspot/test/compiler/c2/6852078/Test6852078.java
+++ b/hotspot/test/compiler/c2/Test6852078.java
@@ -26,17 +26,20 @@
  * @test
  * @bug 6852078
  * @summary Disable SuperWord optimization for unsafe read/write
- *
  * @modules java.corba/com.sun.corba.se.impl.encoding
  *          java.corba/com.sun.jndi.toolkit.corba
- * @run main Test6852078
+ *
+ * @run main compiler.c2.Test6852078
  */
 
-import java.util.*;
-import java.nio.ByteBuffer;
+package compiler.c2;
+
 import com.sun.corba.se.impl.encoding.ByteBufferWithInfo;
 import com.sun.jndi.toolkit.corba.CorbaUtils;
 
+import java.nio.ByteBuffer;
+import java.util.Hashtable;
+
 public class Test6852078 {
 
     public Test6852078(String [] args) {
diff --git a/hotspot/test/compiler/c2/Test6857159.java b/hotspot/test/compiler/c2/Test6857159.java
new file mode 100644
index 0000000..894fc5f
--- /dev/null
+++ b/hotspot/test/compiler/c2/Test6857159.java
@@ -0,0 +1,94 @@
+/*
+ * Copyright (c) 2009, 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.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ *
+ */
+
+/**
+ * @test
+ * @bug 6857159
+ * @summary local schedule failed with checkcast of Thread.currentThread()
+ * @library /testlibrary
+ * @modules java.base/jdk.internal.misc
+ *          java.management
+ *
+ * @run driver compiler.c2.Test6857159
+ */
+
+package compiler.c2;
+
+import jdk.test.lib.OutputAnalyzer;
+import jdk.test.lib.ProcessTools;
+
+public class Test6857159 {
+    public static void main(String[] args) throws Throwable {
+        String className = Test.class.getName();
+        OutputAnalyzer analyzer = ProcessTools.executeTestJvm("-Xbatch",
+                "-XX:+PrintCompilation",
+                "-XX:CompileOnly="+ className + "$ct::run",
+                className);
+        analyzer.shouldNotContain("COMPILE SKIPPED");
+        analyzer.shouldContain(className + "$ct0::run (16 bytes)");
+        analyzer.shouldHaveExitValue(0);
+    }
+
+    static class Test extends Thread {
+        static class ct0 extends Test {
+            public void message() {
+            }
+
+            public void run() {
+                message();
+                ct0 ct = (ct0) Thread.currentThread();
+                ct.message();
+            }
+        }
+
+        static class ct1 extends ct0 {
+            public void message() {
+            }
+        }
+
+        static class ct2 extends ct0 {
+            public void message() {
+            }
+        }
+
+        public static void main(String[] args) throws Exception {
+            for (int i = 0; i < 20000; i++) {
+                Thread t = null;
+                switch (i % 3) {
+                    case 0:
+                        t = new ct0();
+                        break;
+                    case 1:
+                        t = new ct1();
+                        break;
+                    case 2:
+                        t = new ct2();
+                        break;
+                }
+                t.start();
+                t.join();
+            }
+        }
+    }
+}
diff --git a/hotspot/test/compiler/c2/6863155/Test6863155.java b/hotspot/test/compiler/c2/Test6863155.java
similarity index 90%
rename from hotspot/test/compiler/c2/6863155/Test6863155.java
rename to hotspot/test/compiler/c2/Test6863155.java
index edef9a9..848bfba 100644
--- a/hotspot/test/compiler/c2/6863155/Test6863155.java
+++ b/hotspot/test/compiler/c2/Test6863155.java
@@ -26,9 +26,13 @@
  * @bug 6863155
  * @summary Server compiler generates incorrect code (x86, long, bitshift, bitmask)
  *
- * @run main/othervm -Xcomp -XX:CompileOnly=Test6863155.test Test6863155
+ * @run main/othervm -Xcomp
+ *      -XX:CompileCommand=compileonly,compiler.c2.Test6863155::test
+ *      compiler.c2.Test6863155
  */
 
+package compiler.c2;
+
 public class Test6863155 {
     private static long test(byte b) {
         return b << 24 & 0xff000000L;
diff --git a/hotspot/test/compiler/c2/6866651/Test.java b/hotspot/test/compiler/c2/Test6866651.java
similarity index 94%
rename from hotspot/test/compiler/c2/6866651/Test.java
rename to hotspot/test/compiler/c2/Test6866651.java
index 41b7bd5..88cbf52 100644
--- a/hotspot/test/compiler/c2/6866651/Test.java
+++ b/hotspot/test/compiler/c2/Test6866651.java
@@ -26,10 +26,12 @@
  * @bug 6866651
  * @summary delay dead node elimination in set_req_X to prevent killing the current node when it is in use
  *
- * @run main Test
+ * @run main compiler.c2.Test6866651
  */
 
-public class Test {
+package compiler.c2;
+
+public class Test6866651 {
 
     static int sum() {
         int s = 0;
diff --git a/hotspot/test/compiler/c2/6877254/Test.java b/hotspot/test/compiler/c2/Test6877254.java
similarity index 93%
rename from hotspot/test/compiler/c2/6877254/Test.java
rename to hotspot/test/compiler/c2/Test6877254.java
index d470221..bc092d5 100644
--- a/hotspot/test/compiler/c2/6877254/Test.java
+++ b/hotspot/test/compiler/c2/Test6877254.java
@@ -26,10 +26,12 @@
  * @bug 6877254
  * @summary Implement StoreCMNode::Ideal to promote its OopStore above the MergeMem
  *
- * @run main/othervm -Xcomp Test
+ * @run main/othervm -Xcomp compiler.c2.Test6877254
  */
 
-public class Test {
+package compiler.c2;
+
+public class Test6877254 {
     static byte var_1;
     static String var_2 = "";
     static byte var_3;
diff --git a/hotspot/test/compiler/c2/6880034/Test6880034.java b/hotspot/test/compiler/c2/Test6880034.java
similarity index 84%
rename from hotspot/test/compiler/c2/6880034/Test6880034.java
rename to hotspot/test/compiler/c2/Test6880034.java
index 72af095..628e7b2 100644
--- a/hotspot/test/compiler/c2/6880034/Test6880034.java
+++ b/hotspot/test/compiler/c2/Test6880034.java
@@ -26,10 +26,13 @@
  * @bug 6880034
  * @summary SIGBUS during deoptimisation at a safepoint on 64bit-SPARC
  *
- * @run main/othervm -Xcomp -Xbatch -XX:CompileCommand=compileonly,Test6880034,deopt_compiledframe_at_safepoint -XX:+PrintCompilation Test6880034
+ * @run main/othervm -Xcomp -Xbatch
+ *    -XX:+PrintCompilation
+ *    -XX:CompileCommand=compileonly,compiler.c2.Test6880034::deopt_compiledframe_at_safepoint
+ *    compiler.c2.Test6880034
  */
 
-
+package compiler.c2;
 
 // This test provokes a deoptimisation at a safepoint.
 //
@@ -61,39 +64,38 @@
 //
 // Author: Volker H. Simonis
 
-class A {
-  public int doSomething() {
-    return 0;
-  }
-}
-
-class B extends A {
-  public B() {}
-  // override 'A::doSomething()'
-  public int doSomething() {
-    return 1;
-  }
-}
-
-class G {
-  public static volatile A a = new A();
-
-  // Change 'a' to point to a 'B' object
-  public static void setAtoB() {
-    try {
-      a =  (A) ClassLoader.
-        getSystemClassLoader().
-        loadClass("B").
-        getConstructor(new Class[] {}).
-        newInstance(new Object[] {});
-    }
-    catch (Exception e) {
-      System.out.println(e);
-    }
-  }
-}
-
 public class Test6880034 {
+  static class A {
+    public int doSomething() {
+      return 0;
+    }
+  }
+
+  static class B extends A {
+    public B() {}
+    // override 'A::doSomething()'
+    public int doSomething() {
+      return 1;
+    }
+  }
+
+  static class G {
+    public static volatile A a = new A();
+
+    // Change 'a' to point to a 'B' object
+    public static void setAtoB() {
+      try {
+        a =  (A) ClassLoader.
+                getSystemClassLoader().
+                loadClass("B").
+                getConstructor(new Class[] {}).
+                newInstance(new Object[] {});
+      }
+      catch (Exception e) {
+        System.out.println(e);
+      }
+    }
+  }
 
   public static volatile boolean is_in_loop = false;
   public static volatile boolean stop_while_loop = false;
diff --git a/hotspot/test/compiler/c2/6885584/Test6885584.java b/hotspot/test/compiler/c2/Test6885584.java
similarity index 95%
rename from hotspot/test/compiler/c2/6885584/Test6885584.java
rename to hotspot/test/compiler/c2/Test6885584.java
index 1048bcd..e5ba96f 100644
--- a/hotspot/test/compiler/c2/6885584/Test6885584.java
+++ b/hotspot/test/compiler/c2/Test6885584.java
@@ -27,10 +27,10 @@
  * @bug 6885584
  * @summary A particular class structure causes large allocation spike for jit
  *
- * @run main/othervm -Xbatch Test6885584
+ * @run main/othervm -Xbatch compiler.c2.Test6885584
  */
 
-
+package compiler.c2;
 
 public class Test6885584 {
    static private int i1;
diff --git a/hotspot/test/compiler/c2/5091921/Test6897150.java b/hotspot/test/compiler/c2/Test6897150.java
similarity index 96%
rename from hotspot/test/compiler/c2/5091921/Test6897150.java
rename to hotspot/test/compiler/c2/Test6897150.java
index 58a22ac..9fde86d 100644
--- a/hotspot/test/compiler/c2/5091921/Test6897150.java
+++ b/hotspot/test/compiler/c2/Test6897150.java
@@ -27,9 +27,11 @@
  * @bug 6897150
  * @summary Hotspot optimises away a valid loop
  *
- * @run main Test6897150
+ * @run main compiler.c2.Test6897150
  */
 
+package compiler.c2;
+
 // Should be compiled with javac from JDK1.3 to get bytecode which shows the problem.
 public class Test6897150 {
     public static void main(String[] args) {
diff --git a/hotspot/test/compiler/c2/6901572/Test.java b/hotspot/test/compiler/c2/Test6901572.java
similarity index 94%
rename from hotspot/test/compiler/c2/6901572/Test.java
rename to hotspot/test/compiler/c2/Test6901572.java
index 695373a..583e5e1 100644
--- a/hotspot/test/compiler/c2/6901572/Test.java
+++ b/hotspot/test/compiler/c2/Test6901572.java
@@ -26,11 +26,12 @@
  * @bug 6901572
  * @summary JVM 1.6.16 crash on loops: assert(has_node(i),"")
  *
- * @run main/othervm Test
+ * @run main/othervm compiler.c2.Test6901572
  */
 
+package compiler.c2;
 
-public class Test {
+public class Test6901572 {
 
     public static void main(String[] args) {
         for (int i = 0; i < 2; i++)
diff --git a/hotspot/test/compiler/c2/Test6905845.java b/hotspot/test/compiler/c2/Test6905845.java
new file mode 100644
index 0000000..18db36b
--- /dev/null
+++ b/hotspot/test/compiler/c2/Test6905845.java
@@ -0,0 +1,78 @@
+/*
+ * Copyright (c) 2011, 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.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ *
+ */
+
+/**
+ * @test
+ * @bug 6905845
+ * @summary Server VM improperly optimizing away loop.
+ *
+ * @run main/timeout=480 compiler.c2.Test6905845
+ */
+
+package compiler.c2;
+
+public class Test6905845 {
+
+    public static void main(String[] args) {
+        for (int asdf = 0; asdf < 5; asdf++) {
+            //test block
+            {
+                StringBuilder strBuf1 = new StringBuilder(65);
+                long start = System.currentTimeMillis();
+                int count = 0;
+
+                for (int i = Integer.MIN_VALUE; i < (Integer.MAX_VALUE - 80); i += 79) {
+                    strBuf1.append(i);
+                    count++;
+                    strBuf1.delete(0, 65);
+                }
+
+                System.out.println(count);
+                if (count != 54366674) {
+                    System.out.println("wrong count: " + count + ", should be 54366674");
+                    System.exit(97);
+                }
+            }
+            //test block
+            {
+                StringBuilder strBuf1 = new StringBuilder(65);
+                long start = System.currentTimeMillis();
+                int count = 0;
+
+                for (int i = Integer.MIN_VALUE; i < (Integer.MAX_VALUE - 80); i += 79) {
+                    strBuf1.append(i);
+                    count++;
+                    strBuf1.delete(0, 65);
+                }
+
+                System.out.println(count);
+                if (count != 54366674) {
+                    System.out.println("wrong count: " + count + ", should be 54366674");
+                    System.exit(97);
+                }
+            }
+        }
+    }
+}
+
diff --git a/hotspot/test/compiler/c2/6910484/Test.java b/hotspot/test/compiler/c2/Test6910484.java
similarity index 93%
rename from hotspot/test/compiler/c2/6910484/Test.java
rename to hotspot/test/compiler/c2/Test6910484.java
index 3907c98..5416523 100644
--- a/hotspot/test/compiler/c2/6910484/Test.java
+++ b/hotspot/test/compiler/c2/Test6910484.java
@@ -26,10 +26,12 @@
  * @bug 6910484
  * @summary incorrect integer optimization (loosing and op-r in a given example)
  *
- * @run main/othervm -Xbatch Test
+ * @run main/othervm -Xbatch compiler.c2.Test6910484
  */
 
-public class Test {
+package compiler.c2;
+
+public class Test6910484 {
 
     public static void main(String[] args) {
         long iteration = 0;
diff --git a/hotspot/test/compiler/c2/6910605/Test.java b/hotspot/test/compiler/c2/Test6910605_1.java
similarity index 95%
rename from hotspot/test/compiler/c2/6910605/Test.java
rename to hotspot/test/compiler/c2/Test6910605_1.java
index ffeb91c..6ab1ff4 100644
--- a/hotspot/test/compiler/c2/6910605/Test.java
+++ b/hotspot/test/compiler/c2/Test6910605_1.java
@@ -26,15 +26,16 @@
  * @test
  * @bug 6910605
  * @summary C2: NullPointerException/ClassCaseException is thrown when C2 with DeoptimizeALot is used
- *
- * @run main/othervm -XX:+IgnoreUnrecognizedVMOptions -XX:+DeoptimizeALot -Xbatch Test
- *
  * original test: nsk/coverage/runtime/runtime007
+ *
+ * @run main/othervm -XX:+IgnoreUnrecognizedVMOptions -XX:+DeoptimizeALot -Xbatch compiler.c2.Test6910605_1
  */
 
-import java.io.*;
+package compiler.c2;
 
-public class Test {
+import java.io.PrintStream;
+
+public class Test6910605_1 {
         public static int buf=0;
 
         public static void main( String argv[] ) {
diff --git a/hotspot/test/compiler/c2/Test6910605_2.java b/hotspot/test/compiler/c2/Test6910605_2.java
new file mode 100644
index 0000000..50dbedc
--- /dev/null
+++ b/hotspot/test/compiler/c2/Test6910605_2.java
@@ -0,0 +1,78 @@
+/*
+ * Copyright (c) 2010, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ *
+ */
+
+/**
+ * @test
+ * @bug 6910605
+ * @summary C2: NullPointerException/ClassCaseException is thrown when C2 with DeoptimizeALot is used
+ *
+ * @run main/othervm -Xmx64m -XX:+IgnoreUnrecognizedVMOptions -XX:+DeoptimizeALot
+ *      -XX:+DoEscapeAnalysis -Xbatch -XX:InlineSmallCode=2000
+ *      compiler.c2.Test6910605_2
+ */
+
+package compiler.c2;
+
+/*
+ * Added InlineSmallCode=2000 to guaranty inlining of StringBuilder::append() to allow scalar replace StringBuilder object.
+ *
+ * original test: gc/gctests/StringGC
+ */
+
+public class Test6910605_2 {
+    private final String toAdd = "0123456789abcdef";
+    private int maxLength;
+    private static final int numberOfThreads = 8;
+
+    private class StringAdder extends Thread {
+        private String s;
+
+        public void test() {
+            s = s + toAdd;
+        }
+
+        public void run() {
+            do {
+                test();
+            } while (s.length() < maxLength);
+        }
+    }
+
+    public void test() throws InterruptedException {
+        maxLength = toAdd.length() * 15000 / numberOfThreads;
+        StringAdder[] sa = new StringAdder[numberOfThreads];
+        for (int i = 0; i < numberOfThreads; i++) {
+            sa[i] = new StringAdder();
+            sa[i].start();
+        }
+        for (int i = 0; i < numberOfThreads; i++) {
+            sa[i].join();
+        }
+    }
+
+    public static void main(String[] args) throws InterruptedException {
+        Test6910605_2 t = new Test6910605_2();
+        t.test();
+    }
+}
diff --git a/hotspot/test/compiler/c2/6912517/Test.java b/hotspot/test/compiler/c2/Test6912517.java
similarity index 93%
rename from hotspot/test/compiler/c2/6912517/Test.java
rename to hotspot/test/compiler/c2/Test6912517.java
index 0d999fc..f682678 100644
--- a/hotspot/test/compiler/c2/6912517/Test.java
+++ b/hotspot/test/compiler/c2/Test6912517.java
@@ -26,14 +26,17 @@
  * @bug 6912517
  * @summary JIT bug compiles out (and stops running) code that needs to be run.  Causes NPE.
  *
- * @run main/othervm -Xbatch -XX:CompileThreshold=100 -XX:+IgnoreUnrecognizedVMOptions -XX:-UseCompressedOops Test
+ * @run main/othervm -Xbatch -XX:CompileThreshold=100 -XX:+IgnoreUnrecognizedVMOptions -XX:-UseCompressedOops
+ *      compiler.c2.Test6912517
  */
 
+package compiler.c2;
+
 /**
  * Highlights a bug with the JIT compiler.
  * @author Matt Bruce m b r u c e __\at/__ g m a i l DOT c o m
  */
-public class Test implements Runnable
+public class Test6912517 implements Runnable
 {
     private final Thread myThread;
     private Thread       myInitialThread;
@@ -42,7 +45,7 @@
     /**
      * Sets up the running thread, and starts it.
      */
-    public Test(int id)
+    public Test6912517(int id)
     {
         myThread = new Thread(this);
         myThread.setName("Runner: " + id);
@@ -69,7 +72,7 @@
         // let this run for a bit, so the "run" below is JITTed.
         for (int id = 0; id < 20; id++) {
             System.out.println("Starting thread: " + id);
-            Test bug = new Test(id);
+            Test6912517 bug = new Test6912517(id);
             bug.setShouldCheckThreads(true);
             Thread.sleep(2500);
         }
diff --git a/hotspot/test/compiler/c2/6916644/Test6916644.java b/hotspot/test/compiler/c2/Test6916644.java
similarity index 91%
rename from hotspot/test/compiler/c2/6916644/Test6916644.java
rename to hotspot/test/compiler/c2/Test6916644.java
index c64f245..8ad9e7b 100644
--- a/hotspot/test/compiler/c2/6916644/Test6916644.java
+++ b/hotspot/test/compiler/c2/Test6916644.java
@@ -27,9 +27,13 @@
  * @bug 6916644
  * @summary C2 compiler crash on x86
  *
- * @run main/othervm -Xcomp -XX:CompileOnly=Test6916644.test Test6916644
+ * @run main/othervm -Xcomp
+ *      -XX:CompileCommand=compileonly,compiler.c2.Test6916644::test
+ *      compiler.c2.Test6916644
  */
 
+package compiler.c2;
+
 public class Test6916644 {
     static int result;
     static int i1;
diff --git a/hotspot/test/compiler/c2/6930043/Test6930043.java b/hotspot/test/compiler/c2/Test6930043.java
similarity index 97%
rename from hotspot/test/compiler/c2/6930043/Test6930043.java
rename to hotspot/test/compiler/c2/Test6930043.java
index ac30f3a..66cbe10 100644
--- a/hotspot/test/compiler/c2/6930043/Test6930043.java
+++ b/hotspot/test/compiler/c2/Test6930043.java
@@ -27,10 +27,10 @@
  * @bug 6930043
  * @summary C2: SIGSEGV in javasoft.sqe.tests.lang.arr017.arr01702.arr01702.loop_forw(II)I
  *
- * @run main Test6930043
+ * @run main compiler.c2.Test6930043
  */
 
-import java.io.PrintStream;
+package compiler.c2;
 
 public class Test6930043 {
     int[] a;
diff --git a/hotspot/test/compiler/c2/5091921/Test6931567.java b/hotspot/test/compiler/c2/Test6931567.java
similarity index 96%
rename from hotspot/test/compiler/c2/5091921/Test6931567.java
rename to hotspot/test/compiler/c2/Test6931567.java
index 30e8701..7f75390 100644
--- a/hotspot/test/compiler/c2/5091921/Test6931567.java
+++ b/hotspot/test/compiler/c2/Test6931567.java
@@ -27,9 +27,11 @@
  * @bug 6931567
  * @summary JIT Error (on class file compiled with eclipse) on JVM x64 (but not on x32!).
  *
- * @run main Test6931567
+ * @run main compiler.c2.Test6931567
  */
 
+package compiler.c2;
+
 // Should be compiled with javac from JDK1.3 to get bytecode which shows the problem.
 public class Test6931567 {
 
diff --git a/hotspot/test/compiler/c2/5091921/Test6935022.java b/hotspot/test/compiler/c2/Test6935022.java
similarity index 97%
rename from hotspot/test/compiler/c2/5091921/Test6935022.java
rename to hotspot/test/compiler/c2/Test6935022.java
index 0dea6f9..da098a8 100644
--- a/hotspot/test/compiler/c2/5091921/Test6935022.java
+++ b/hotspot/test/compiler/c2/Test6935022.java
@@ -27,9 +27,11 @@
  * @bug 6935022
  * @summary Server VM incorrectly breaks out of while loop
  *
- * @run main Test6935022
+ * @run main compiler.c2.Test6935022
  */
 
+package compiler.c2;
+
 public class Test6935022 {
     public static final void main(String[] args) throws Exception {
         Test6935022 test = new Test6935022();
diff --git a/hotspot/test/compiler/c2/6956668/Test6956668.java b/hotspot/test/compiler/c2/Test6956668.java
similarity index 96%
rename from hotspot/test/compiler/c2/6956668/Test6956668.java
rename to hotspot/test/compiler/c2/Test6956668.java
index 1acf515..54b78d2 100644
--- a/hotspot/test/compiler/c2/6956668/Test6956668.java
+++ b/hotspot/test/compiler/c2/Test6956668.java
@@ -27,9 +27,10 @@
  * @bug 6956668
  * @summary misbehavior of XOR operator (^) with int
  *
- * @run main/othervm -Xbatch Test6956668
+ * @run main/othervm -Xbatch compiler.c2.Test6956668
  */
 
+package compiler.c2;
 
 public class Test6956668 {
 
diff --git a/hotspot/test/compiler/c2/6958485/Test.java b/hotspot/test/compiler/c2/Test6958485.java
similarity index 89%
rename from hotspot/test/compiler/c2/6958485/Test.java
rename to hotspot/test/compiler/c2/Test6958485.java
index 0bbc1ec..b8bc15f 100644
--- a/hotspot/test/compiler/c2/6958485/Test.java
+++ b/hotspot/test/compiler/c2/Test6958485.java
@@ -26,10 +26,14 @@
  * @bug 6958485
  * @summary fix for 6879921 was insufficient
  *
- * @run main/othervm -Xbatch -XX:CompileOnly=Test.init Test
+ * @run main/othervm -Xbatch
+ *      -XX:CompileCommand=compileonly,compiler.c2.Test6958485::init
+ *      compiler.c2.Test6958485
  */
 
-public class Test {
+package compiler.c2;
+
+public class Test6958485 {
 
     public static void init(Object src[], boolean[] dst) {
         // initialize the arrays
diff --git a/hotspot/test/compiler/c2/5091921/Test6959129.java b/hotspot/test/compiler/c2/Test6959129.java
similarity index 96%
rename from hotspot/test/compiler/c2/5091921/Test6959129.java
rename to hotspot/test/compiler/c2/Test6959129.java
index 53fd439..fb58383 100644
--- a/hotspot/test/compiler/c2/5091921/Test6959129.java
+++ b/hotspot/test/compiler/c2/Test6959129.java
@@ -27,9 +27,11 @@
  * @bug 6959129
  * @summary COMPARISON WITH INTEGER.MAX_INT DOES NOT WORK CORRECTLY IN THE CLIENT VM.
  *
- * @run main/othervm -ea Test6959129
+ * @run main/othervm -ea compiler.c2.Test6959129
  */
 
+package compiler.c2;
+
 public class Test6959129 {
 
   public static void main(String[] args) {
diff --git a/hotspot/test/compiler/c2/6968348/Test6968348.java b/hotspot/test/compiler/c2/Test6968348.java
similarity index 95%
rename from hotspot/test/compiler/c2/6968348/Test6968348.java
rename to hotspot/test/compiler/c2/Test6968348.java
index 432f45f..be609bf 100644
--- a/hotspot/test/compiler/c2/6968348/Test6968348.java
+++ b/hotspot/test/compiler/c2/Test6968348.java
@@ -26,13 +26,16 @@
  * @test
  * @bug 6968348
  * @summary Byteswapped memory access can point to wrong location after JIT
- *
  * @modules java.base/jdk.internal.misc
- * @run main Test6968348
+ *
+ * @run main compiler.c2.Test6968348
  */
 
+package compiler.c2;
+
 import jdk.internal.misc.Unsafe;
-import java.lang.reflect.*;
+
+import java.lang.reflect.Field;
 
 public class Test6968348 {
     static Unsafe unsafe;
diff --git a/hotspot/test/compiler/c2/6973329/Test.java b/hotspot/test/compiler/c2/Test6973329.java
similarity index 60%
rename from hotspot/test/compiler/c2/6973329/Test.java
rename to hotspot/test/compiler/c2/Test6973329.java
index caecf8b..9402120 100644
--- a/hotspot/test/compiler/c2/6973329/Test.java
+++ b/hotspot/test/compiler/c2/Test6973329.java
@@ -26,38 +26,42 @@
  * @bug 6973329
  * @summary C2 with Zero based COOP produces code with broken anti-dependency on x86
  *
- * @run main/othervm -Xbatch -Xcomp -XX:CompileOnly=Test Test
+ * @run main/othervm -Xbatch -Xcomp
+ *    -XX:CompileCommand=compileonly,compiler.c2.Test6973329::*
+ *    compiler.c2.Test6973329
  */
 
-class A {
-  A next;
-  int n;
+package compiler.c2;
 
-  public int get_n() {
-    return n+1;
-  }
-}
-public class Test {
+public class Test6973329 {
+    static class A {
+        A next;
+        int n;
 
-  A a;
-
-  void test (A new_next) {
-    A prev_next = a.next;
-    a.next = new_next;
-    if (prev_next == null) {
-      a.n = a.get_n();
+        public int get_n() {
+            return n + 1;
+        }
     }
-  }
 
-  public static void main(String args[]) {
-    Test t = new Test();
-    t.a = new A();
-    t.a.n = 1;
-    t.test(new A());
-    if (t.a.n != 2) {
-      System.out.println("Wrong value: " + t.a.n + " expected: 2");
-      System.exit(97);
+    A a;
+
+    void test(A new_next) {
+        A prev_next = a.next;
+        a.next = new_next;
+        if (prev_next == null) {
+            a.n = a.get_n();
+        }
     }
-  }
+
+    public static void main(String args[]) {
+        Test6973329 t = new Test6973329();
+        t.a = new A();
+        t.a.n = 1;
+        t.test(new A());
+        if (t.a.n != 2) {
+            System.out.println("Wrong value: " + t.a.n + " expected: 2");
+            System.exit(97);
+        }
+    }
 }
 
diff --git a/hotspot/test/compiler/c2/5091921/Test6985295.java b/hotspot/test/compiler/c2/Test6985295.java
similarity index 95%
rename from hotspot/test/compiler/c2/5091921/Test6985295.java
rename to hotspot/test/compiler/c2/Test6985295.java
index 3b3271f..ab18039 100644
--- a/hotspot/test/compiler/c2/5091921/Test6985295.java
+++ b/hotspot/test/compiler/c2/Test6985295.java
@@ -27,9 +27,11 @@
  * @bug 6985295
  * @summary JVM fails to evaluate condition randomly
  *
- * @run main/othervm -Xbatch Test6985295
+ * @run main/othervm -Xbatch compiler.c2.Test6985295
  */
 
+package compiler.c2;
+
 public class Test6985295 {
 
     public static void main(String[] args) {
diff --git a/hotspot/test/compiler/c2/5091921/Test6992759.java b/hotspot/test/compiler/c2/Test6992759.java
similarity index 96%
rename from hotspot/test/compiler/c2/5091921/Test6992759.java
rename to hotspot/test/compiler/c2/Test6992759.java
index 9adece6..8df7b26 100644
--- a/hotspot/test/compiler/c2/5091921/Test6992759.java
+++ b/hotspot/test/compiler/c2/Test6992759.java
@@ -27,9 +27,11 @@
  * @bug 6992759
  * @summary Bad code generated for integer <= comparison, fails for Integer.MAX_VALUE
  *
- * @run main/timeout=240 Test6992759
+ * @run main/timeout=240 compiler.c2.Test6992759
  */
 
+package compiler.c2;
+
 public class Test6992759 {
 
     static final int N_TESTS = 1000000000;
diff --git a/hotspot/test/compiler/c2/7002666/Test7002666.java b/hotspot/test/compiler/c2/Test7002666.java
similarity index 90%
rename from hotspot/test/compiler/c2/7002666/Test7002666.java
rename to hotspot/test/compiler/c2/Test7002666.java
index caca8d8..ebb0d97 100644
--- a/hotspot/test/compiler/c2/7002666/Test7002666.java
+++ b/hotspot/test/compiler/c2/Test7002666.java
@@ -27,8 +27,14 @@
  * @bug 7002666
  * @summary eclipse CDT projects crash with compressed oops
  *
- * @run main/othervm -Xbatch -XX:CompileOnly=Test7002666.test,java/lang/reflect/Array Test7002666
- *
+ * @run main/othervm -Xbatch
+ *      -XX:CompileCommand=compileonly,compiler.c2.Test7002666::test
+ *      -XX:CompileCommand=compileonly,java.lang.reflect.Array::*
+ *      compiler.c2.Test7002666
+ */
+
+package compiler.c2;
+/*
  * This will only reliably fail with a fastdebug build since it relies
  * on seeing garbage in the heap to die.  It could be made more
  * reliable in product mode but that would require greatly increasing
diff --git a/hotspot/test/compiler/c2/7009359/Test7009359.java b/hotspot/test/compiler/c2/Test7009359.java
similarity index 91%
rename from hotspot/test/compiler/c2/7009359/Test7009359.java
rename to hotspot/test/compiler/c2/Test7009359.java
index 8672493..48280c5 100644
--- a/hotspot/test/compiler/c2/7009359/Test7009359.java
+++ b/hotspot/test/compiler/c2/Test7009359.java
@@ -27,10 +27,13 @@
  * @bug 7009359
  * @summary HS with -XX:+AggressiveOpts optimize new StringBuffer(null) so it does not throw NPE as expected
  *
- * @run main/othervm -Xbatch -XX:+IgnoreUnrecognizedVMOptions -XX:+OptimizeStringConcat -XX:CompileCommand=dontinline,Test7009359,stringmakerBUG Test7009359
- *
+ * @run main/othervm -Xbatch -XX:+IgnoreUnrecognizedVMOptions -XX:+OptimizeStringConcat
+ *      -XX:CompileCommand=dontinline,compiler.c2.Test7009359::stringmakerBUG
+ *      compiler.c2.Test7009359
  */
 
+package compiler.c2;
+
 public class Test7009359 {
     public static void main (String[] args) {
         for(int i = 0; i < 100000; i++) {
diff --git a/hotspot/test/compiler/c2/7017746/Test.java b/hotspot/test/compiler/c2/Test7017746.java
similarity index 72%
rename from hotspot/test/compiler/c2/7017746/Test.java
rename to hotspot/test/compiler/c2/Test7017746.java
index eab4b7e..893eef3 100644
--- a/hotspot/test/compiler/c2/7017746/Test.java
+++ b/hotspot/test/compiler/c2/Test7017746.java
@@ -26,25 +26,27 @@
  * @bug 7017746
  * @summary Regression : C2 compiler crash due to SIGSEGV in PhaseCFG::schedule_early()
  *
- * @run main/othervm -Xbatch Test
+ * @run main/othervm -Xbatch compiler.c2.Test7017746
  */
 
-public class Test {
+package compiler.c2;
 
-  int i;
+public class Test7017746 {
 
-  static int test(Test t, int a, int b) {
-    int j = t.i;
-    int x = a - b;
-    if (a < b) x = x + j;
-    return x - j;
-  }
+    int i;
 
-  public static void main(String args[]) {
-    Test t = new Test();
-    for (int n = 0; n < 1000000; n++) {
-      int i = test(t, 1, 2);
+    static int test(Test7017746 t, int a, int b) {
+        int j = t.i;
+        int x = a - b;
+        if (a < b) x = x + j;
+        return x - j;
     }
-  }
+
+    public static void main(String args[]) {
+        Test7017746 t = new Test7017746();
+        for (int n = 0; n < 1000000; n++) {
+            int i = test(t, 1, 2);
+        }
+    }
 }
 
diff --git a/hotspot/test/compiler/c2/5091921/Test7020614.java b/hotspot/test/compiler/c2/Test7020614.java
similarity index 95%
rename from hotspot/test/compiler/c2/5091921/Test7020614.java
rename to hotspot/test/compiler/c2/Test7020614.java
index b1d8029..05b2481 100644
--- a/hotspot/test/compiler/c2/5091921/Test7020614.java
+++ b/hotspot/test/compiler/c2/Test7020614.java
@@ -27,9 +27,11 @@
  * @bug 7020614
  * @summary "-server" mode optimizer makes code hang
  *
- * @run main/othervm/timeout=30 -Xbatch Test7020614
+ * @run main/othervm/timeout=30 -Xbatch compiler.c2.Test7020614
  */
 
+package compiler.c2;
+
 public class Test7020614 {
 
     private static final int ITERATIONS = 1000;
diff --git a/hotspot/test/compiler/c2/7024475/Test7024475.java b/hotspot/test/compiler/c2/Test7024475.java
similarity index 97%
rename from hotspot/test/compiler/c2/7024475/Test7024475.java
rename to hotspot/test/compiler/c2/Test7024475.java
index 2f3b2e0..646993f 100644
--- a/hotspot/test/compiler/c2/7024475/Test7024475.java
+++ b/hotspot/test/compiler/c2/Test7024475.java
@@ -27,9 +27,11 @@
  * @bug 7024475
  * @summary loop doesn't terminate when compiled
  *
- * @run main Test7024475
+ * @run main compiler.c2.Test7024475
  */
 
+package compiler.c2;
+
 public class Test7024475 {
 
     static int i;
diff --git a/hotspot/test/compiler/c2/7029152/Test.java b/hotspot/test/compiler/c2/Test7029152.java
similarity index 70%
rename from hotspot/test/compiler/c2/7029152/Test.java
rename to hotspot/test/compiler/c2/Test7029152.java
index edc7fd9..bcd53dbb 100644
--- a/hotspot/test/compiler/c2/7029152/Test.java
+++ b/hotspot/test/compiler/c2/Test7029152.java
@@ -26,24 +26,26 @@
  * @bug 7029152
  * @summary Ideal nodes for String intrinsics miss memory edge optimization
  *
- * @run main/othervm -Xbatch Test
+ * @run main/othervm -Xbatch compiler.c2.Test7029152
  */
 
-public class Test {
+package compiler.c2;
 
-  static final String str = "11111xx11111xx1x";
-  static int idx = 0;
+public class Test7029152 {
 
-  static int IndexOfTest(String str) {
-    return str.indexOf("11111xx1x");
-  }
+    static final String str = "11111xx11111xx1x";
+    static int idx = 0;
 
-  public static void main(String args[]) {
-    final int ITERS=2000000;
-
-    for (int i=0; i<ITERS; i++) {
-      idx = IndexOfTest(str);
+    static int IndexOfTest(String str) {
+        return str.indexOf("11111xx1x");
     }
-    System.out.println("IndexOf = " + idx);
-  }
+
+    public static void main(String args[]) {
+        final int ITERS = 2000000;
+
+        for (int i = 0; i < ITERS; i++) {
+            idx = IndexOfTest(str);
+        }
+        System.out.println("IndexOf = " + idx);
+    }
 }
diff --git a/hotspot/test/compiler/c2/7041100/Test7041100.java b/hotspot/test/compiler/c2/Test7041100.java
similarity index 95%
rename from hotspot/test/compiler/c2/7041100/Test7041100.java
rename to hotspot/test/compiler/c2/Test7041100.java
index b6c1e8e..937253a 100644
--- a/hotspot/test/compiler/c2/7041100/Test7041100.java
+++ b/hotspot/test/compiler/c2/Test7041100.java
@@ -27,9 +27,11 @@
  * @bug 7041100
  * @summary The load in String.equals intrinsic executed before null check
  *
- * @run main/othervm -Xbatch Test7041100 abc def
+ * @run main/othervm -Xbatch compiler.c2.Test7041100 abc def
  */
 
+package compiler.c2;
+
 public class Test7041100 {
 
     static String n = null;
diff --git a/hotspot/test/compiler/c2/7046096/Test7046096.java b/hotspot/test/compiler/c2/Test7046096.java
similarity index 62%
rename from hotspot/test/compiler/c2/7046096/Test7046096.java
rename to hotspot/test/compiler/c2/Test7046096.java
index 5dff2db..f0937c4 100644
--- a/hotspot/test/compiler/c2/7046096/Test7046096.java
+++ b/hotspot/test/compiler/c2/Test7046096.java
@@ -27,39 +27,41 @@
  * @bug 7046096
  * @summary SEGV IN C2 WITH 6U25
  *
- * @run main/othervm -Xbatch -XX:+IgnoreUnrecognizedVMOptions -XX:+OptimizeStringConcat Test7046096
+ * @run main/othervm -Xbatch -XX:+IgnoreUnrecognizedVMOptions -XX:+OptimizeStringConcat
+ *    compiler.c2.Test7046096
  */
 
+package compiler.c2;
 
 public class Test7046096 {
 
-  static int first = 1;
+    static int first = 1;
 
-  String add(String str) {
-    if (first != 0) {
-      return str + "789";
-    } else {
-      return "null";
+    String add(String str) {
+        if (first != 0) {
+            return str + "789";
+        } else {
+            return "null";
+        }
     }
-  }
 
-  String test(String str) {
-    for (int i=0; i < first; i++) {
-      if (i > 1)
-        return "bad";
+    String test(String str) {
+        for (int i = 0; i < first; i++) {
+            if (i > 1)
+                return "bad";
+        }
+        return add(str + "456");
     }
-    return add(str+"456");
-  }
 
-  public static void main(String [] args) {
-    Test7046096 t = new Test7046096();
-    for (int i = 0; i < 11000; i++) {
-      String str = t.test("123");
-      if (!str.equals("123456789")) {
-        System.out.println("FAILED: " + str + " != \"123456789\"");
-        System.exit(97);
-      }
+    public static void main(String[] args) {
+        Test7046096 t = new Test7046096();
+        for (int i = 0; i < 11000; i++) {
+            String str = t.test("123");
+            if (!str.equals("123456789")) {
+                System.out.println("FAILED: " + str + " != \"123456789\"");
+                System.exit(97);
+            }
+        }
     }
-  }
 }
 
diff --git a/hotspot/test/compiler/c2/7047069/Test7047069.java b/hotspot/test/compiler/c2/Test7047069.java
similarity index 98%
rename from hotspot/test/compiler/c2/7047069/Test7047069.java
rename to hotspot/test/compiler/c2/Test7047069.java
index fcfee8c..812a5ac 100644
--- a/hotspot/test/compiler/c2/7047069/Test7047069.java
+++ b/hotspot/test/compiler/c2/Test7047069.java
@@ -26,13 +26,14 @@
  * @test
  * @bug 7047069
  * @summary Array can dynamically change size when assigned to an object field
- *
  * @modules java.desktop
- * @run main/othervm -Xbatch Test7047069
+ *
+ * @run main/othervm -Xbatch compiler.c2.Test7047069
  */
 
-import java.util.*;
-import java.awt.geom.*;
+package compiler.c2;
+
+import java.awt.geom.Line2D;
 
 public class Test7047069 {
     static boolean verbose;
diff --git a/hotspot/test/compiler/c2/7048332/Test7048332.java b/hotspot/test/compiler/c2/Test7048332.java
similarity index 62%
rename from hotspot/test/compiler/c2/7048332/Test7048332.java
rename to hotspot/test/compiler/c2/Test7048332.java
index fc6794e..2c850a4 100644
--- a/hotspot/test/compiler/c2/7048332/Test7048332.java
+++ b/hotspot/test/compiler/c2/Test7048332.java
@@ -27,34 +27,35 @@
  * @bug 7048332
  * @summary Cadd_cmpLTMask doesn't handle 64-bit tmp register properly
  *
- * @run main/othervm -Xbatch Test7048332
+ * @run main/othervm -Xbatch compiler.c2.Test7048332
  */
 
+package compiler.c2;
 
 public class Test7048332 {
 
-  static int capacity = 2;
-  static int first = 1;
-  static int last = 2;
+    static int capacity = 2;
+    static int first = 1;
+    static int last = 2;
 
-  static int test(int i1, int i2, int i3, int i4, int i5, int i6) {
-    final int result;
-    if (last >= first) {
-      result = last - first;
-    } else {
-      result = last - first + capacity;
+    static int test(int i1, int i2, int i3, int i4, int i5, int i6) {
+        final int result;
+        if (last >= first) {
+            result = last - first;
+        } else {
+            result = last - first + capacity;
+        }
+        return result;
     }
-    return result;
-  }
 
-  public static void main(String [] args) {
-    for (int i = 0; i < 11000; i++) {
-      last = (i & 1) << 1; // 0 or 2
-      int k = test(1, 2, 3, 4, 5, 6);
-      if (k != 1) {
-        System.out.println("FAILED: " + k + " != 1");
-        System.exit(97);
-      }
+    public static void main(String[] args) {
+        for (int i = 0; i < 11000; i++) {
+            last = (i & 1) << 1; // 0 or 2
+            int k = test(1, 2, 3, 4, 5, 6);
+            if (k != 1) {
+                System.out.println("FAILED: " + k + " != 1");
+                System.exit(97);
+            }
+        }
     }
-  }
 }
diff --git a/hotspot/test/compiler/c2/7068051/Test7068051.java b/hotspot/test/compiler/c2/Test7068051.java
similarity index 98%
rename from hotspot/test/compiler/c2/7068051/Test7068051.java
rename to hotspot/test/compiler/c2/Test7068051.java
index 7f75fe6..408fd6f 100644
--- a/hotspot/test/compiler/c2/7068051/Test7068051.java
+++ b/hotspot/test/compiler/c2/Test7068051.java
@@ -27,12 +27,14 @@
  * @bug 7068051
  * @summary SIGSEGV in PhaseIdealLoop::build_loop_late_post on T5440
  * @library /testlibrary
- *
  * @modules java.base/jdk.internal.misc
  *          java.management
- * @run main/othervm -showversion -Xbatch Test7068051
+ *
+ * @run main/othervm -showversion -Xbatch compiler.c2.Test7068051
  */
 
+package compiler.c2;
+
 import jdk.test.lib.JDKToolLauncher;
 import jdk.test.lib.OutputAnalyzer;
 
diff --git a/hotspot/test/compiler/c2/7110586/Test7110586.java b/hotspot/test/compiler/c2/Test7110586.java
similarity index 97%
rename from hotspot/test/compiler/c2/7110586/Test7110586.java
rename to hotspot/test/compiler/c2/Test7110586.java
index e40c903..62d2f5d 100644
--- a/hotspot/test/compiler/c2/7110586/Test7110586.java
+++ b/hotspot/test/compiler/c2/Test7110586.java
@@ -27,9 +27,11 @@
  * @bug 7110586
  * @summary C2 generates icorrect results
  *
- * @run main/othervm -Xbatch Test7110586
+ * @run main/othervm -Xbatch compiler.c2.Test7110586
  */
 
+package compiler.c2;
+
 public class Test7110586 {
   static int test1() {
     int i = 0;
diff --git a/hotspot/test/compiler/c2/7125879/Test7125879.java b/hotspot/test/compiler/c2/Test7125879.java
similarity index 95%
rename from hotspot/test/compiler/c2/7125879/Test7125879.java
rename to hotspot/test/compiler/c2/Test7125879.java
index 729aac6..a751c5a 100644
--- a/hotspot/test/compiler/c2/7125879/Test7125879.java
+++ b/hotspot/test/compiler/c2/Test7125879.java
@@ -27,9 +27,11 @@
  * @bug 7125879
  * @summary assert(proj != NULL) failed: must be found
  *
- * @run main/othervm -Xcomp Test7125879
+ * @run main/othervm -Xcomp compiler.c2.Test7125879
  */
 
+package compiler.c2;
+
 public class Test7125879 {
     String var_1 = "abc";
 
diff --git a/hotspot/test/compiler/c2/7160610/Test7160610.java b/hotspot/test/compiler/c2/Test7160610.java
similarity index 97%
rename from hotspot/test/compiler/c2/7160610/Test7160610.java
rename to hotspot/test/compiler/c2/Test7160610.java
index 62b2e6e..31d7134 100644
--- a/hotspot/test/compiler/c2/7160610/Test7160610.java
+++ b/hotspot/test/compiler/c2/Test7160610.java
@@ -27,9 +27,11 @@
  * @bug 7160610
  * @summary Unknown Native Code compilation issue.
  *
- * @run main/othervm -XX:+IgnoreUnrecognizedVMOptions -XX:-OptimizeFill Test7160610
+ * @run main/othervm -XX:+IgnoreUnrecognizedVMOptions -XX:-OptimizeFill compiler.c2.Test7160610
  */
 
+package compiler.c2;
+
 public class Test7160610 {
   private static final byte[] BYTE_ARRAY = new byte[7];
   private static int[] anIntArray1190 = new int[32768];
diff --git a/hotspot/test/compiler/c2/7169782/Test7169782.java b/hotspot/test/compiler/c2/Test7169782.java
similarity index 89%
rename from hotspot/test/compiler/c2/7169782/Test7169782.java
rename to hotspot/test/compiler/c2/Test7169782.java
index 381c4c9..8fbb9c1 100644
--- a/hotspot/test/compiler/c2/7169782/Test7169782.java
+++ b/hotspot/test/compiler/c2/Test7169782.java
@@ -27,9 +27,13 @@
  * @bug 7169782
  * @summary C2: SIGSEGV in LShiftLNode::Ideal(PhaseGVN*, bool)
  *
- * @run main/othervm -Xcomp -XX:CompileOnly="Test7169782::<clinit>" Test7169782
+ * @run main/othervm -Xcomp
+ *      -XX:CompileCommand=compileonly,compiler.c2.Test7169782::<clinit>
+ *      compiler.c2.Test7169782
  */
 
+package compiler.c2;
+
 public class Test7169782 {
     static long var_8;
 
diff --git a/hotspot/test/compiler/c2/7174363/Test7174363.java b/hotspot/test/compiler/c2/Test7174363.java
similarity index 89%
rename from hotspot/test/compiler/c2/7174363/Test7174363.java
rename to hotspot/test/compiler/c2/Test7174363.java
index 50f784d..77f2ff0 100644
--- a/hotspot/test/compiler/c2/7174363/Test7174363.java
+++ b/hotspot/test/compiler/c2/Test7174363.java
@@ -27,10 +27,12 @@
  * @bug 7174363
  * @summary crash with Arrays.copyOfRange(original, from, to) when from > original.length
  *
- * @run main/othervm -XX:-BackgroundCompilation Test7174363
+ * @run main/othervm -XX:-BackgroundCompilation compiler.c2.Test7174363
  */
 
-import java.util.*;
+package compiler.c2;
+
+import java.util.Arrays;
 
 public class Test7174363 {
 
@@ -43,7 +45,8 @@
     for (int i = 0; i < 20000; i++) {
       try {
         m(orig, 15, 20);
-      } catch(ArrayIndexOutOfBoundsException excp) {}
+      } catch (ArrayIndexOutOfBoundsException excp) {
+      }
     }
   }
 }
diff --git a/hotspot/test/compiler/c2/7177917/Test7177917.java b/hotspot/test/compiler/c2/Test7177917.java
similarity index 94%
rename from hotspot/test/compiler/c2/7177917/Test7177917.java
rename to hotspot/test/compiler/c2/Test7177917.java
index 0713b27..6fe88a3 100644
--- a/hotspot/test/compiler/c2/7177917/Test7177917.java
+++ b/hotspot/test/compiler/c2/Test7177917.java
@@ -22,11 +22,20 @@
  *
  */
 
-/*
- * Micro-benchmark for Math.pow() and Math.exp()
+/**
+ * @test
+ * @bug 7177917
+ * @summary Micro-benchmark for Math.pow() and Math.exp()
+ * @modules java.base/jdk.internal.misc
+ * @library /testlibrary
+ *
+ * @run main compiler.c2.Test7177917
  */
 
+package compiler.c2;
+
 import jdk.test.lib.Utils;
+
 import java.util.Random;
 
 public class Test7177917 {
diff --git a/hotspot/test/compiler/c2/7179138/Test7179138_1.java b/hotspot/test/compiler/c2/Test7179138_1.java
similarity index 96%
rename from hotspot/test/compiler/c2/7179138/Test7179138_1.java
rename to hotspot/test/compiler/c2/Test7179138_1.java
index afa8307..6cdbed4 100644
--- a/hotspot/test/compiler/c2/7179138/Test7179138_1.java
+++ b/hotspot/test/compiler/c2/Test7179138_1.java
@@ -25,11 +25,15 @@
  * @test
  * @bug 7179138
  * @summary Incorrect result with String concatenation optimization
- * @run main/othervm -Xbatch -XX:+IgnoreUnrecognizedVMOptions -XX:-TieredCompilation Test7179138_1
+ *
+ * @run main/othervm -Xbatch -XX:+IgnoreUnrecognizedVMOptions -XX:-TieredCompilation
+ *      compiler.c2.Test7179138_1
  *
  * @author Skip Balk
  */
 
+package compiler.c2;
+
 public class Test7179138_1 {
     public static void main(String[] args) throws Exception {
         System.out.println("Java Version: " + System.getProperty("java.vm.version"));
diff --git a/hotspot/test/compiler/c2/7179138/Test7179138_2.java b/hotspot/test/compiler/c2/Test7179138_2.java
similarity index 96%
rename from hotspot/test/compiler/c2/7179138/Test7179138_2.java
rename to hotspot/test/compiler/c2/Test7179138_2.java
index 615c614..4e89f6a 100644
--- a/hotspot/test/compiler/c2/7179138/Test7179138_2.java
+++ b/hotspot/test/compiler/c2/Test7179138_2.java
@@ -25,11 +25,15 @@
  * @test
  * @bug 7179138
  * @summary Incorrect result with String concatenation optimization
- * @run main/othervm -Xbatch -XX:+IgnoreUnrecognizedVMOptions -XX:-TieredCompilation Test7179138_2
+ *
+ * @run main/othervm -Xbatch -XX:+IgnoreUnrecognizedVMOptions -XX:-TieredCompilation
+ *      compiler.c2.Test7179138_2
  *
  * @author Skip Balk
  */
 
+package compiler.c2;
+
 public class Test7179138_2 {
     public static void main(String[] args) throws Exception {
         System.out.println("Java Version: " + System.getProperty("java.vm.version"));
diff --git a/hotspot/test/compiler/c2/Test7190310.java b/hotspot/test/compiler/c2/Test7190310.java
new file mode 100644
index 0000000..3e388e8
--- /dev/null
+++ b/hotspot/test/compiler/c2/Test7190310.java
@@ -0,0 +1,91 @@
+/*
+ * Copyright (c) 2012, 2013, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ *
+ */
+
+/*
+ * @test
+ * @bug 7190310
+ * @summary Inlining WeakReference.get(), and hoisting $referent may lead to non-terminating loops
+ *
+ * @run main/othervm/timeout=600 -Xbatch compiler.c2.Test7190310
+ */
+
+/*
+ * Note bug exhibits as infinite loop, timeout is helpful.
+ * It should normally finish pretty quickly, but on some especially slow machines
+ * it may not.  The companion _unsafe test lacks a timeout, but that is okay.
+ */
+package compiler.c2;
+
+import java.lang.ref.Reference;
+import java.lang.ref.ReferenceQueue;
+import java.lang.ref.WeakReference;
+
+public class Test7190310 {
+    private static Object str = new Object() {
+        public String toString() {
+            return "The Object";
+        }
+
+        protected void finalize() throws Throwable {
+            System.out.println("The Object is being finalized");
+            super.finalize();
+        }
+    };
+    private final static ReferenceQueue<Object> rq =
+            new ReferenceQueue<Object>();
+    private final static WeakReference<Object> wr =
+            new WeakReference<Object>(str, rq);
+
+    public static void main(String[] args)
+            throws InterruptedException {
+        Thread reader = new Thread() {
+            public void run() {
+                while (wr.get() != null) {
+                }
+                System.out.println("wr.get() returned null");
+            }
+        };
+
+        Thread queueReader = new Thread() {
+            public void run() {
+                try {
+                    Reference<? extends Object> ref = rq.remove();
+                    System.out.println(ref);
+                    System.out.println("queueReader returned, ref==wr is "
+                            + (ref == wr));
+                } catch (InterruptedException e) {
+                    System.err.println("Sleep interrupted - exiting");
+                }
+            }
+        };
+
+        reader.start();
+        queueReader.start();
+
+        Thread.sleep(1000);
+        str = null;
+        System.gc();
+    }
+}
+
diff --git a/hotspot/test/compiler/c2/Test7190310_unsafe.java b/hotspot/test/compiler/c2/Test7190310_unsafe.java
new file mode 100644
index 0000000..deaefb7
--- /dev/null
+++ b/hotspot/test/compiler/c2/Test7190310_unsafe.java
@@ -0,0 +1,154 @@
+/*
+ * Copyright (c) 2012, 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.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ *
+ */
+
+/*
+ * @test
+ * @bug 7190310
+ * @summary Inlining WeakReference.get(), and hoisting $referent may lead to non-terminating loops
+ * @modules java.base/jdk.internal.misc
+ *
+ * @run main/othervm -Xbatch compiler.c2.Test7190310_unsafe
+ */
+
+package compiler.c2;
+
+import jdk.internal.misc.Unsafe;
+
+import java.lang.ref.Reference;
+import java.lang.ref.WeakReference;
+import java.lang.reflect.Field;
+
+public class Test7190310_unsafe {
+
+    static class TestObject {
+        public String toString() {
+            return "TestObject";
+        }
+    }
+
+    ;
+
+    private static TestObject str = new TestObject();
+    private static final WeakReference ref = new WeakReference(str);
+
+    private TestObject obj;
+
+    public static void main(String[] args) throws Exception {
+        Class c = Test7190310_unsafe.class.getClassLoader().loadClass("jdk.internal.misc.Unsafe");
+        Field f = c.getDeclaredField("theUnsafe");
+        f.setAccessible(true);
+        Unsafe unsafe = (Unsafe) f.get(c);
+
+        f = Reference.class.getDeclaredField("referent");
+        f.setAccessible(true);
+        long referent_offset = unsafe.objectFieldOffset(f);
+
+        Test7190310_unsafe t = new Test7190310_unsafe();
+        TestObject o = new TestObject();
+        t.obj = o;
+
+        // Warmup (compile methods)
+        System.err.println("Warmup");
+        Object obj = null;
+        for (int i = 0; i < 11000; i++) {
+            obj = getRef0(ref);
+        }
+        for (int i = 0; i < 11000; i++) {
+            obj = getRef1(unsafe, ref, referent_offset);
+        }
+        for (int i = 0; i < 11000; i++) {
+            obj = getRef2(unsafe, ref, referent_offset);
+        }
+        for (int i = 0; i < 11000; i++) {
+            obj = getRef3(unsafe, ref, referent_offset);
+        }
+        for (int i = 0; i < 11000; i++) {
+            obj = getRef4(unsafe, t, referent_offset);
+        }
+
+        // Access verification
+        System.err.println("Verification");
+        if (!verifyGet(referent_offset, unsafe)) {
+            System.exit(97);
+        }
+
+        obj = getRef3(unsafe, t, referent_offset);
+        if (obj != o) {
+            System.out.println("FAILED: unsafe.getObject(Object, " + referent_offset + ") " + obj + " != " + o);
+            System.exit(97);
+        }
+        obj = getRef4(unsafe, t, referent_offset);
+        if (obj != o) {
+            System.out.println("FAILED: unsafe.getObject(Test7190310, " + referent_offset + ") " + obj + " != " + o);
+            System.exit(97);
+        }
+    }
+
+    static boolean verifyGet(long referent_offset, Unsafe unsafe) throws Exception {
+        // Access verification
+        System.out.println("referent: " + str);
+        Object obj = getRef0(ref);
+        if (obj != str) {
+            System.out.println("FAILED: weakRef.get() " + obj + " != " + str);
+            return false;
+        }
+        obj = getRef1(unsafe, ref, referent_offset);
+        if (obj != str) {
+            System.out.println("FAILED: unsafe.getObject(weakRef, " + referent_offset + ") " + obj + " != " + str);
+            return false;
+        }
+        obj = getRef2(unsafe, ref, referent_offset);
+        if (obj != str) {
+            System.out.println("FAILED: unsafe.getObject(abstRef, " + referent_offset + ") " + obj + " != " + str);
+            return false;
+        }
+        obj = getRef3(unsafe, ref, referent_offset);
+        if (obj != str) {
+            System.out.println("FAILED: unsafe.getObject(Object, " + referent_offset + ") " + obj + " != " + str);
+            return false;
+        }
+        return true;
+    }
+
+    static Object getRef0(WeakReference ref) throws Exception {
+        return ref.get();
+    }
+
+    static Object getRef1(Unsafe unsafe, WeakReference ref, long referent_offset) throws Exception {
+        return unsafe.getObject(ref, referent_offset);
+    }
+
+    static Object getRef2(Unsafe unsafe, Reference ref, long referent_offset) throws Exception {
+        return unsafe.getObject(ref, referent_offset);
+    }
+
+    static Object getRef3(Unsafe unsafe, Object ref, long referent_offset) throws Exception {
+        return unsafe.getObject(ref, referent_offset);
+    }
+
+    static Object getRef4(Unsafe unsafe, Test7190310_unsafe ref, long referent_offset) throws Exception {
+        return unsafe.getObject(ref, referent_offset);
+    }
+}
+
diff --git a/hotspot/test/compiler/c2/7199742/Test7199742.java b/hotspot/test/compiler/c2/Test7199742.java
similarity index 67%
rename from hotspot/test/compiler/c2/7199742/Test7199742.java
rename to hotspot/test/compiler/c2/Test7199742.java
index 7f29e96..a0ce4b0 100644
--- a/hotspot/test/compiler/c2/7199742/Test7199742.java
+++ b/hotspot/test/compiler/c2/Test7199742.java
@@ -27,28 +27,32 @@
  * @bug 7199742
  * @summary A lot of C2 OSR compilations of the same method's bci
  *
- * @run main/othervm -Xmx32m -Xbatch Test7199742
+ * @run main/othervm -Xmx32m -Xbatch compiler.c2.Test7199742
  */
 
+package compiler.c2;
+
 public class Test7199742 {
-  private static final int ITERS  = 10000000;
-  public static void main(String args[]) {
-    Test7199742 t = new Test7199742();
-    for (int i=0; i<10; i++) {
-      test(t, 7);
+    private static final int ITERS = 10000000;
+
+    public static void main(String args[]) {
+        Test7199742 t = new Test7199742();
+        for (int i = 0; i < 10; i++) {
+            test(t, 7);
+        }
     }
-  }
-  static Test7199742 test(Test7199742 t, int m) {
-    int i = -(ITERS/2);
-    if (i == 0) return null;
-    Test7199742 v = null;
-    while(i < ITERS) {
-      if ((i&m) == 0) {
-        v = t;
-      }
-      i++;
+
+    static Test7199742 test(Test7199742 t, int m) {
+        int i = -(ITERS / 2);
+        if (i == 0) return null;
+        Test7199742 v = null;
+        while (i < ITERS) {
+            if ((i & m) == 0) {
+                v = t;
+            }
+            i++;
+        }
+        return v;
     }
-    return v;
-  }
 }
 
diff --git a/hotspot/test/compiler/c2/8000805/Test8000805.java b/hotspot/test/compiler/c2/Test8000805.java
similarity index 62%
rename from hotspot/test/compiler/c2/8000805/Test8000805.java
rename to hotspot/test/compiler/c2/Test8000805.java
index 0776f92..8fee089 100644
--- a/hotspot/test/compiler/c2/8000805/Test8000805.java
+++ b/hotspot/test/compiler/c2/Test8000805.java
@@ -26,31 +26,35 @@
  * @bug 8000805
  * @summary JMM issue: short loads are non-atomic
  *
- * @run main/othervm -XX:+IgnoreUnrecognizedVMOptions -XX:-TieredCompilation -Xcomp -XX:+PrintCompilation -XX:CompileOnly=Test8000805.loadS2LmaskFF,Test8000805.loadS2Lmask16,Test8000805.loadS2Lmask13,Test8000805.loadUS_signExt,Test8000805.loadB2L_mask8 Test8000805
+ * @run main/othervm -XX:+IgnoreUnrecognizedVMOptions -XX:-TieredCompilation -Xcomp
+ *      -XX:+PrintCompilation
+ *      -XX:CompileCommand=compileonly,compiler.c2.Test8000805::load*
+ *      compiler.c2.Test8000805
  */
 
+package compiler.c2;
 public class Test8000805 {
-    static long loadS2LmaskFF   (short[] sa) { return sa[0] & 0xFF; }
-    static long loadS2LmaskFF_1 (short[] sa) { return sa[0] & 0xFF; }
+    static long  loadS2LmaskFF (short[] sa) { return sa[0] & 0xFF; }
+    static long _loadS2LmaskFF (short[] sa) { return sa[0] & 0xFF; }
 
-    static long loadS2Lmask16   (short[] sa) { return sa[0] & 0xFFFE; }
-    static long loadS2Lmask16_1 (short[] sa) { return sa[0] & 0xFFFE; }
+    static long  loadS2Lmask16 (short[] sa) { return sa[0] & 0xFFFE; }
+    static long _loadS2Lmask16 (short[] sa) { return sa[0] & 0xFFFE; }
 
-    static long loadS2Lmask13   (short[] sa) { return sa[0] & 0x0FFF; }
-    static long loadS2Lmask13_1 (short[] sa) { return sa[0] & 0x0FFF; }
+    static long  loadS2Lmask13 (short[] sa) { return sa[0] & 0x0FFF; }
+    static long _loadS2Lmask13 (short[] sa) { return sa[0] & 0x0FFF; }
 
-    static int loadUS_signExt   (char[] ca) { return (ca[0] << 16) >> 16; }
-    static int loadUS_signExt_1 (char[] ca) { return (ca[0] << 16) >> 16; }
+    static int  loadUS_signExt (char[] ca) { return (ca[0] << 16) >> 16; }
+    static int _loadUS_signExt (char[] ca) { return (ca[0] << 16) >> 16; }
 
-    static long loadB2L_mask8   (byte[] ba) { return ba[0] & 0x55; }
-    static long loadB2L_mask8_1 (byte[] ba) { return ba[0] & 0x55; }
+    static long  loadB2L_mask8 (byte[] ba) { return ba[0] & 0x55; }
+    static long _loadB2L_mask8 (byte[] ba) { return ba[0] & 0x55; }
 
     public static void main(String[] args) {
         for (int i = Byte.MIN_VALUE; i < Byte.MAX_VALUE; i++) {
             byte[] ba = new byte[]  { (byte) i};
 
-            { long v1 = loadB2L_mask8(ba);
-              long v2 = loadB2L_mask8_1(ba);
+            { long v1 =  loadB2L_mask8(ba);
+              long v2 = _loadB2L_mask8(ba);
               if (v1 != v2)
               throw new InternalError(String.format("loadB2L_mask8 failed: %x != %x", v1, v2)); }
         }
@@ -59,23 +63,23 @@
             short[] sa = new short[] { (short)i };
             char[] ca = new char[] { (char)i };
 
-            { long v1 = loadS2LmaskFF(sa);
-              long v2 = loadS2LmaskFF_1(sa);
+            { long v1 =  loadS2LmaskFF(sa);
+              long v2 = _loadS2LmaskFF(sa);
               if (v1 != v2)
               throw new InternalError(String.format("loadS2LmaskFF failed: %x != %x", v1, v2)); }
 
-            { long v1 = loadS2Lmask16(sa);
-              long v2 = loadS2Lmask16_1(sa);
+            { long v1 =  loadS2Lmask16(sa);
+              long v2 = _loadS2Lmask16(sa);
               if (v1 != v2)
               throw new InternalError(String.format("loadS2Lmask16 failed: %x != %x", v1, v2)); }
 
-            { long v1 = loadS2Lmask13(sa);
-              long v2 = loadS2Lmask13_1(sa);
+            { long v1 =  loadS2Lmask13(sa);
+              long v2 = _loadS2Lmask13(sa);
               if (v1 != v2)
               throw new InternalError(String.format("loadS2Lmask13 failed: %x != %x", v1, v2)); }
 
-            { int v1 = loadUS_signExt(ca);
-              int v2 = loadUS_signExt_1(ca);
+            { int v1 =  loadUS_signExt(ca);
+              int v2 = _loadUS_signExt(ca);
               if (v1 != v2)
                 throw new InternalError(String.format("loadUS_signExt failed: %x != %x", v1, v2)); }
         }
diff --git a/hotspot/test/compiler/c2/Test8002069.java b/hotspot/test/compiler/c2/Test8002069.java
new file mode 100644
index 0000000..5f19f56
--- /dev/null
+++ b/hotspot/test/compiler/c2/Test8002069.java
@@ -0,0 +1,113 @@
+/*
+ * Copyright (c) 2012, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ *
+ */
+
+/**
+ * @test
+ * @bug 8002069
+ * @summary Assert failed in C2: assert(field->edge_count() > 0) failed: sanity
+ *
+ * @run main/othervm -Xmx32m -XX:+IgnoreUnrecognizedVMOptions -Xbatch
+ *      -XX:CompileCommand=exclude,compiler.c2.Test8002069::dummy
+ *      compiler.c2.Test8002069
+ */
+
+package compiler.c2;
+
+public class Test8002069 {
+    static abstract class O {
+        int f;
+
+        public O() {
+            f = 5;
+        }
+
+        abstract void put(int i);
+
+        public int foo(int i) {
+            put(i);
+            return i;
+        }
+    }
+
+    static class A extends O {
+        int[] a;
+
+        public A(int s) {
+            a = new int[s];
+        }
+
+        public void put(int i) {
+            a[i % a.length] = i;
+        }
+    }
+
+    static class B extends O {
+        int sz;
+        int[] a;
+
+        public B(int s) {
+            sz = s;
+            a = new int[s];
+        }
+
+        public void put(int i) {
+            a[i % sz] = i;
+        }
+    }
+
+    public static void main(String args[]) {
+        int sum = 0;
+        for (int i = 0; i < 8000; i++) {
+            sum += test1(i);
+        }
+        for (int i = 0; i < 100000; i++) {
+            sum += test2(i);
+        }
+        System.out.println("PASSED. sum = " + sum);
+    }
+
+    private O o;
+
+    private int foo(int i) {
+        return o.foo(i);
+    }
+
+    static int test1(int i) {
+        Test8002069 t = new Test8002069();
+        t.o = new A(5);
+        return t.foo(i);
+    }
+
+    static int test2(int i) {
+        Test8002069 t = new Test8002069();
+        t.o = new B(5);
+        dummy(i);
+        return t.foo(i);
+    }
+
+    static int dummy(int i) {
+        return i * 2;
+    }
+}
+
diff --git a/hotspot/test/compiler/c2/8004741/Test8004741.java b/hotspot/test/compiler/c2/Test8004741.java
similarity index 93%
rename from hotspot/test/compiler/c2/8004741/Test8004741.java
rename to hotspot/test/compiler/c2/Test8004741.java
index 7e64ff1..f52a68e 100644
--- a/hotspot/test/compiler/c2/8004741/Test8004741.java
+++ b/hotspot/test/compiler/c2/Test8004741.java
@@ -25,11 +25,17 @@
  * @test Test8004741.java
  * @bug 8004741
  * @summary Missing compiled exception handle table entry for multidimensional array allocation
- * @run main/othervm -Xmx64m -Xbatch -XX:+IgnoreUnrecognizedVMOptions -XX:+UnlockDiagnosticVMOptions -XX:-TieredCompilation -XX:+StressCompiledExceptionHandlers -XX:+SafepointALot -XX:GuaranteedSafepointInterval=100 Test8004741
- * @run main/othervm -Xmx64m -Xbatch -XX:+IgnoreUnrecognizedVMOptions -XX:+UnlockDiagnosticVMOptions -XX:-TieredCompilation -XX:+StressCompiledExceptionHandlers Test8004741
+ *
+ * @run main/othervm -Xmx64m -Xbatch -XX:+IgnoreUnrecognizedVMOptions -XX:+UnlockDiagnosticVMOptions
+ *    -XX:-TieredCompilation -XX:+StressCompiledExceptionHandlers
+ *    -XX:+SafepointALot -XX:GuaranteedSafepointInterval=100
+ *    compiler.c2.Test8004741
+ * @run main/othervm -Xmx64m -Xbatch -XX:+IgnoreUnrecognizedVMOptions -XX:+UnlockDiagnosticVMOptions
+ *    -XX:-TieredCompilation -XX:+StressCompiledExceptionHandlers
+ *    compiler.c2.Test8004741
  */
 
-import java.util.*;
+package compiler.c2;
 
 public class Test8004741 extends Thread {
 
diff --git a/hotspot/test/compiler/c2/8007294/Test8007294.java b/hotspot/test/compiler/c2/Test8007294.java
similarity index 95%
rename from hotspot/test/compiler/c2/8007294/Test8007294.java
rename to hotspot/test/compiler/c2/Test8007294.java
index a335ba7..4f5295c 100644
--- a/hotspot/test/compiler/c2/8007294/Test8007294.java
+++ b/hotspot/test/compiler/c2/Test8007294.java
@@ -26,10 +26,14 @@
  * @bug 8007294
  * @bug 8146999
  * @summary ReduceFieldZeroing doesn't check for dependent load and can lead to incorrect execution
- * @run main/othervm -XX:+IgnoreUnrecognizedVMOptions -XX:+AlwaysIncrementalInline -XX:-UseOnStackReplacement -XX:-BackgroundCompilation Test8007294
  *
+ * @run main/othervm -XX:+IgnoreUnrecognizedVMOptions -XX:+AlwaysIncrementalInline
+ *      -XX:-UseOnStackReplacement -XX:-BackgroundCompilation
+ *      compiler.c2.Test8007294
  */
 
+package compiler.c2;
+
 public class Test8007294 {
 
     int i1;
diff --git a/hotspot/test/compiler/c2/8007722/Test8007722.java b/hotspot/test/compiler/c2/Test8007722.java
similarity index 93%
rename from hotspot/test/compiler/c2/8007722/Test8007722.java
rename to hotspot/test/compiler/c2/Test8007722.java
index 2e197a4..d01b91b 100644
--- a/hotspot/test/compiler/c2/8007722/Test8007722.java
+++ b/hotspot/test/compiler/c2/Test8007722.java
@@ -25,11 +25,14 @@
  * @test
  * @bug 8007722
  * @summary GetAndSetP's MachNode should capture bottom type
- * @run main/othervm -XX:-UseOnStackReplacement -XX:-BackgroundCompilation Test8007722
  *
+ * @run main/othervm -XX:-UseOnStackReplacement -XX:-BackgroundCompilation
+ *      compiler.c2.Test8007722
  */
 
-import java.util.concurrent.atomic.*;
+package compiler.c2;
+
+import java.util.concurrent.atomic.AtomicReference;
 
 public class Test8007722 {
 
diff --git a/hotspot/test/compiler/c2/6946040/TestCharShortByteSwap.java b/hotspot/test/compiler/c2/TestCharShortByteSwap.java
similarity index 91%
rename from hotspot/test/compiler/c2/6946040/TestCharShortByteSwap.java
rename to hotspot/test/compiler/c2/TestCharShortByteSwap.java
index cddbbd3..280bbf5 100644
--- a/hotspot/test/compiler/c2/6946040/TestCharShortByteSwap.java
+++ b/hotspot/test/compiler/c2/TestCharShortByteSwap.java
@@ -26,9 +26,15 @@
  * @test
  * @bug 6946040
  * @summary Tests Character/Short.reverseBytes and their intrinsics implementation in the server compiler
- * @run main/othervm -Xbatch -XX:CompileOnly=.testChar,.testShort TestCharShortByteSwap
+ *
+ * @run main/othervm -Xbatch
+ *      -XX:CompileCommand=compileonly,compiler.c2.TestCharShortByteSwap::testChar
+ *      -XX:CompileCommand=compileonly,compiler.c2.TestCharShortByteSwap::testShort
+ *      compiler.c2.TestCharShortByteSwap
  */
 
+package compiler.c2;
+
 // This test must run without any command line arguments.
 
 public class TestCharShortByteSwap {
diff --git a/hotspot/test/compiler/c2/TestDominatingDeadCheckCast.java b/hotspot/test/compiler/c2/TestDominatingDeadCheckCast.java
index 3c8f153..9b2e724 100644
--- a/hotspot/test/compiler/c2/TestDominatingDeadCheckCast.java
+++ b/hotspot/test/compiler/c2/TestDominatingDeadCheckCast.java
@@ -26,10 +26,15 @@
  * @test
  * @bug 8149797
  * @summary node replaced by dominating dead cast during parsing
- * @run main/othervm -XX:-UseOnStackReplacement -XX:-BackgroundCompilation -XX:TypeProfileLevel=200 -XX:CompileCommand=dontinline,TestDominatingDeadCheckCast::not_inlined TestDominatingDeadCheckCast
  *
+ * @run main/othervm -XX:-UseOnStackReplacement -XX:-BackgroundCompilation
+ *      -XX:TypeProfileLevel=200
+ *      -XX:CompileCommand=dontinline,compiler.c2.TestDominatingDeadCheckCast::not_inlined
+ *      compiler.c2.TestDominatingDeadCheckCast
  */
 
+package compiler.c2;
+
 public class TestDominatingDeadCheckCast {
 
     static class A {
diff --git a/hotspot/test/compiler/c2/6921969/TestMultiplyLongHiZero.java b/hotspot/test/compiler/c2/TestMultiplyLongHiZero.java
similarity index 88%
rename from hotspot/test/compiler/c2/6921969/TestMultiplyLongHiZero.java
rename to hotspot/test/compiler/c2/TestMultiplyLongHiZero.java
index 3c295e0..0725889 100644
--- a/hotspot/test/compiler/c2/6921969/TestMultiplyLongHiZero.java
+++ b/hotspot/test/compiler/c2/TestMultiplyLongHiZero.java
@@ -26,11 +26,20 @@
  * @test
  * @bug 6921969
  * @summary Tests shorter long multiply sequences when the high 32 bits of long operands are known to be zero on x86_32
- * @run main/othervm -Xbatch -XX:-Inline -XX:CompileOnly=.testNormal,.testLeftOptimized,.testRightOptimized,.testOptimized,.testLeftOptimized_LoadUI2L,.testRightOptimized_LoadUI2L,.testOptimized_LoadUI2L TestMultiplyLongHiZero
+ * @run main/othervm -Xbatch -XX:-Inline
+ *    -XX:CompileCommand=compileonly,compiler.c2.TestMultiplyLongHiZero::testNormal
+ *    -XX:CompileCommand=compileonly,compiler.c2.TestMultiplyLongHiZero::testLeftOptimized
+ *    -XX:CompileCommand=compileonly,compiler.c2.TestMultiplyLongHiZero::testRightOptimized
+ *    -XX:CompileCommand=compileonly,compiler.c2.TestMultiplyLongHiZero::testOptimized
+ *    -XX:CompileCommand=compileonly,compiler.c2.TestMultiplyLongHiZero::testLeftOptimized_LoadUI2L
+ *    -XX:CompileCommand=compileonly,compiler.c2.TestMultiplyLongHiZero::testRightOptimized_LoadUI2L
+ *    -XX:CompileCommand=compileonly,compiler.c2.TestMultiplyLongHiZero::testOptimized_LoadUI2L
+ *    compiler.c2.TestMultiplyLongHiZero
  */
 
-// This test must run without any command line arguments.
+package compiler.c2;
 
+// This test must run without any command line arguments.
 public class TestMultiplyLongHiZero {
 
   private static void check(long leftFactor, long rightFactor, long optimizedProduct, long constantProduct) {
diff --git a/hotspot/test/compiler/c2/6340864/TestByteVect.java b/hotspot/test/compiler/c2/cr6340864/TestByteVect.java
similarity index 99%
rename from hotspot/test/compiler/c2/6340864/TestByteVect.java
rename to hotspot/test/compiler/c2/cr6340864/TestByteVect.java
index 5db3687..b104530 100644
--- a/hotspot/test/compiler/c2/6340864/TestByteVect.java
+++ b/hotspot/test/compiler/c2/cr6340864/TestByteVect.java
@@ -27,9 +27,11 @@
  * @bug 6340864
  * @summary Implement vectorization optimizations in hotspot-server
  *
- * @run main/othervm/timeout=400 -Xbatch -Xmx64m TestByteVect
+ * @run main/othervm/timeout=400 -Xbatch -Xmx64m compiler.c2.cr6340864.TestByteVect
  */
 
+package compiler.c2.cr6340864;
+
 public class TestByteVect {
   private static final int ARRLEN = 997;
   private static final int ITERS  = 11000;
diff --git a/hotspot/test/compiler/c2/6340864/TestDoubleVect.java b/hotspot/test/compiler/c2/cr6340864/TestDoubleVect.java
similarity index 99%
rename from hotspot/test/compiler/c2/6340864/TestDoubleVect.java
rename to hotspot/test/compiler/c2/cr6340864/TestDoubleVect.java
index db0f460..adf1439 100644
--- a/hotspot/test/compiler/c2/6340864/TestDoubleVect.java
+++ b/hotspot/test/compiler/c2/cr6340864/TestDoubleVect.java
@@ -27,9 +27,11 @@
  * @bug 6340864
  * @summary Implement vectorization optimizations in hotspot-server
  *
- * @run main/othervm/timeout=400 -Xbatch -Xmx64m TestDoubleVect
+ * @run main/othervm/timeout=400 -Xbatch -Xmx64m compiler.c2.cr6340864.TestDoubleVect
  */
 
+package compiler.c2.cr6340864;
+
 public class TestDoubleVect {
   private static final int ARRLEN = 997;
   private static final int ITERS  = 11000;
diff --git a/hotspot/test/compiler/c2/6340864/TestFloatVect.java b/hotspot/test/compiler/c2/cr6340864/TestFloatVect.java
similarity index 99%
rename from hotspot/test/compiler/c2/6340864/TestFloatVect.java
rename to hotspot/test/compiler/c2/cr6340864/TestFloatVect.java
index 63f517c..9940a32 100644
--- a/hotspot/test/compiler/c2/6340864/TestFloatVect.java
+++ b/hotspot/test/compiler/c2/cr6340864/TestFloatVect.java
@@ -27,9 +27,11 @@
  * @bug 6340864
  * @summary Implement vectorization optimizations in hotspot-server
  *
- * @run main/othervm/timeout=400 -Xbatch -Xmx64m TestFloatVect
+ * @run main/othervm/timeout=400 -Xbatch -Xmx64m compiler.c2.cr6340864.TestFloatVect
  */
 
+package compiler.c2.cr6340864;
+
 public class TestFloatVect {
   private static final int ARRLEN = 997;
   private static final int ITERS  = 11000;
diff --git a/hotspot/test/compiler/c2/6340864/TestIntVect.java b/hotspot/test/compiler/c2/cr6340864/TestIntVect.java
similarity index 99%
rename from hotspot/test/compiler/c2/6340864/TestIntVect.java
rename to hotspot/test/compiler/c2/cr6340864/TestIntVect.java
index 5866b34..9f05bca 100644
--- a/hotspot/test/compiler/c2/6340864/TestIntVect.java
+++ b/hotspot/test/compiler/c2/cr6340864/TestIntVect.java
@@ -27,9 +27,11 @@
  * @bug 6340864
  * @summary Implement vectorization optimizations in hotspot-server
  *
- * @run main/othervm/timeout=400 -Xbatch -Xmx64m TestIntVect
+ * @run main/othervm/timeout=400 -Xbatch -Xmx64m compiler.c2.cr6340864.TestIntVect
  */
 
+package compiler.c2.cr6340864;
+
 public class TestIntVect {
   private static final int ARRLEN = 997;
   private static final int ITERS  = 11000;
diff --git a/hotspot/test/compiler/c2/6340864/TestLongVect.java b/hotspot/test/compiler/c2/cr6340864/TestLongVect.java
similarity index 99%
rename from hotspot/test/compiler/c2/6340864/TestLongVect.java
rename to hotspot/test/compiler/c2/cr6340864/TestLongVect.java
index 436a847..670576e 100644
--- a/hotspot/test/compiler/c2/6340864/TestLongVect.java
+++ b/hotspot/test/compiler/c2/cr6340864/TestLongVect.java
@@ -27,9 +27,11 @@
  * @bug 6340864
  * @summary Implement vectorization optimizations in hotspot-server
  *
- * @run main/othervm/timeout=400 -Xbatch -Xmx64m TestLongVect
+ * @run main/othervm/timeout=400 -Xbatch -Xmx64m compiler.c2.cr6340864.TestLongVect
  */
 
+package compiler.c2.cr6340864;
+
 public class TestLongVect {
   private static final int ARRLEN = 997;
   private static final int ITERS  = 11000;
diff --git a/hotspot/test/compiler/c2/6340864/TestShortVect.java b/hotspot/test/compiler/c2/cr6340864/TestShortVect.java
similarity index 99%
rename from hotspot/test/compiler/c2/6340864/TestShortVect.java
rename to hotspot/test/compiler/c2/cr6340864/TestShortVect.java
index 9f59c8f..a5c0d4b 100644
--- a/hotspot/test/compiler/c2/6340864/TestShortVect.java
+++ b/hotspot/test/compiler/c2/cr6340864/TestShortVect.java
@@ -27,9 +27,11 @@
  * @bug 6340864
  * @summary Implement vectorization optimizations in hotspot-server
  *
- * @run main/othervm/timeout=400 -Xbatch -Xmx64m TestShortVect
+ * @run main/othervm/timeout=400 -Xbatch -Xmx64m compiler.c2.cr6340864.TestShortVect
  */
 
+package compiler.c2.cr6340864;
+
 public class TestShortVect {
   private static final int ARRLEN = 997;
   private static final int ITERS  = 11000;
diff --git a/hotspot/test/compiler/c2/6589834/InlinedArrayCloneTestCase.java b/hotspot/test/compiler/c2/cr6589834/InlinedArrayCloneTestCase.java
similarity index 98%
rename from hotspot/test/compiler/c2/6589834/InlinedArrayCloneTestCase.java
rename to hotspot/test/compiler/c2/cr6589834/InlinedArrayCloneTestCase.java
index aadc105..9f23bdd 100644
--- a/hotspot/test/compiler/c2/6589834/InlinedArrayCloneTestCase.java
+++ b/hotspot/test/compiler/c2/cr6589834/InlinedArrayCloneTestCase.java
@@ -21,6 +21,8 @@
  * questions.
  */
 
+package compiler.c2.cr6589834;
+
 public class InlinedArrayCloneTestCase implements Runnable {
     private Test_ia32 executionController;
 
diff --git a/hotspot/test/compiler/c2/6589834/Test_ia32.java b/hotspot/test/compiler/c2/cr6589834/Test_ia32.java
similarity index 83%
rename from hotspot/test/compiler/c2/6589834/Test_ia32.java
rename to hotspot/test/compiler/c2/cr6589834/Test_ia32.java
index a9d11c6..c6cf651 100644
--- a/hotspot/test/compiler/c2/6589834/Test_ia32.java
+++ b/hotspot/test/compiler/c2/cr6589834/Test_ia32.java
@@ -26,27 +26,32 @@
  * @bug 6589834
  * @summary Safepoint placed between stack pointer increment and decrement leads
  *          to interpreter's stack corruption after deoptimization.
- * @library /testlibrary /test/lib
+ * @library /testlibrary /test/lib /
  * @modules java.base/jdk.internal.misc
  *          java.compiler
  *          java.management
  *          jdk.jvmstat/sun.jvmstat.monitor
+ *
  * @build ClassFileInstaller sun.hotspot.WhiteBox jdk.test.lib.*
- *        Test_ia32 InlinedArrayCloneTestCase
- * @run main ClassFileInstaller sun.hotspot.WhiteBox
- *                              sun.hotspot.WhiteBox$WhiteBoxPermission
+ *        compiler.c2.cr6589834.Test_ia32
+ *        compiler.c2.cr6589834.InlinedArrayCloneTestCase
+ * @run driver ClassFileInstaller sun.hotspot.WhiteBox
+ *                                sun.hotspot.WhiteBox$WhiteBoxPermission
  * @run main/othervm -Xbootclasspath/a:. -XX:+UnlockDiagnosticVMOptions
- *      -XX:+WhiteBoxAPI -XX:CompileOnly=InlinedArrayCloneTestCase
- *      -XX:CompileCommand=dontinline,InlinedArrayCloneTestCase.invokeArrayClone
- *      -XX:CompileCommand=inline,InlinedArrayCloneTestCase.verifyArguments
- *      -XX:+IgnoreUnrecognizedVMOptions -XX:+VerifyStack Test_ia32
+ *      -XX:+WhiteBoxAPI -XX:+IgnoreUnrecognizedVMOptions -XX:+VerifyStack
+ *      -XX:CompileCommand=compileonly,compiler.c2.cr6589834.InlinedArrayCloneTestCase::*
+ *      -XX:CompileCommand=dontinline,compiler.c2.cr6589834.InlinedArrayCloneTestCase::invokeArrayClone
+ *      -XX:CompileCommand=inline,compiler.c2.cr6589834.InlinedArrayCloneTestCase::verifyArguments
+ *      compiler.c2.cr6589834.Test_ia32
  */
 
-import java.lang.reflect.Method;
+package compiler.c2.cr6589834;
 
 import jdk.test.lib.Asserts;
 import sun.hotspot.WhiteBox;
 
+import java.lang.reflect.Method;
+
 public class Test_ia32 {
     private static final int NUM_THREADS
             = Math.min(100, 2 * Runtime.getRuntime().availableProcessors());
@@ -111,7 +116,7 @@
          * dependency.
          */
         try {
-            Class.forName("NotLoadedClass");
+            Class.forName(Test_ia32.class.getPackage().getName() + ".NotLoadedClass");
         } catch (ClassNotFoundException e) {
             throw new Error("Unable to load class that invalidates "
                     + "CHA-dependency for method " + method.getName(), e);
diff --git a/hotspot/test/compiler/c2/6646020/Tester.java b/hotspot/test/compiler/c2/cr6646020/Tester.java
similarity index 99%
rename from hotspot/test/compiler/c2/6646020/Tester.java
rename to hotspot/test/compiler/c2/cr6646020/Tester.java
index b9d5769..76c6f28 100644
--- a/hotspot/test/compiler/c2/6646020/Tester.java
+++ b/hotspot/test/compiler/c2/cr6646020/Tester.java
@@ -25,8 +25,12 @@
  * @test
  * @bug 6646020
  * @summary assert(in_bb(n),"must be in block") in -Xcomp mode
+ *
+ * @run main compiler.c2.cr6646020.Tester
  */
 
+package compiler.c2.cr6646020;
+
 /* Complexity upper bound: 3361 ops */
 
 class Tester_Class_0 {
diff --git a/hotspot/test/compiler/c2/6663848/Tester.java b/hotspot/test/compiler/c2/cr6663848/Tester.java
similarity index 99%
rename from hotspot/test/compiler/c2/6663848/Tester.java
rename to hotspot/test/compiler/c2/cr6663848/Tester.java
index 972e6c6..5d1a9e1 100644
--- a/hotspot/test/compiler/c2/6663848/Tester.java
+++ b/hotspot/test/compiler/c2/cr6663848/Tester.java
@@ -25,8 +25,11 @@
  * @test
  * @bug 6663848
  * @summary assert(i < Max(),"oob")
+ *
+ * @run main compiler.c2.cr6663848.Tester
  */
 
+package compiler.c2.cr6663848;
 /* Complexity upper bound: 296055 ops */
 
 final class Tester_Class_0 {
diff --git a/hotspot/test/compiler/c2/6663854/Test6663854.java b/hotspot/test/compiler/c2/cr6663854/Test6663854.java
similarity index 99%
rename from hotspot/test/compiler/c2/6663854/Test6663854.java
rename to hotspot/test/compiler/c2/cr6663854/Test6663854.java
index 9cbdbed..26aad09 100644
--- a/hotspot/test/compiler/c2/6663854/Test6663854.java
+++ b/hotspot/test/compiler/c2/cr6663854/Test6663854.java
@@ -27,9 +27,10 @@
  * @bug 6663854
  * @summary assert(n != __null,"Bad immediate dominator info.") in C2 with -Xcomp
  *
- * @run main/othervm -Xcomp Test6663854
+ * @run main/othervm -Xcomp compiler.c2.cr6663854.Test6663854
  */
 
+package compiler.c2.cr6663854;
 // This is a randomly generated test that exposed a crash so don't try
 // to make sense of what's it's doing.  The output produced is likely
 // to be stable but it is not being checked as part of this test.
diff --git a/hotspot/test/compiler/c2/6711117/Test.java b/hotspot/test/compiler/c2/cr6711117/Test.java
similarity index 99%
rename from hotspot/test/compiler/c2/6711117/Test.java
rename to hotspot/test/compiler/c2/cr6711117/Test.java
index 0b67f05..b5a2f6d 100644
--- a/hotspot/test/compiler/c2/6711117/Test.java
+++ b/hotspot/test/compiler/c2/cr6711117/Test.java
@@ -26,9 +26,14 @@
  * @test
  * @bug 6711117
  * @summary Assertion in 64bit server vm (flat != TypePtr::BOTTOM,"cannot alias-analyze an untyped ptr")
- * @run main/othervm -Xcomp -XX:+IgnoreUnrecognizedVMOptions -XX:+AggressiveOpts -XX:+UseCompressedOops Test
+ *
+ * @run main/othervm -Xcomp -XX:+IgnoreUnrecognizedVMOptions -XX:+AggressiveOpts
+ *      -XX:+UseCompressedOops
+ *       compiler.c2.cr6711117.Test
  */
 
+package compiler.c2.cr6711117;
+
 final class Test_Class_0 {
     final static char var_1 = 'E';
     short var_2 = 16213;
diff --git a/hotspot/test/compiler/c2/6712835/Test6712835.java b/hotspot/test/compiler/c2/cr6712835/Test6712835.java
similarity index 99%
rename from hotspot/test/compiler/c2/6712835/Test6712835.java
rename to hotspot/test/compiler/c2/cr6712835/Test6712835.java
index eee860a..efaeeb7 100644
--- a/hotspot/test/compiler/c2/6712835/Test6712835.java
+++ b/hotspot/test/compiler/c2/cr6712835/Test6712835.java
@@ -25,9 +25,12 @@
  * @test
  * @bug 6712835
  * @summary Server compiler fails with assertion (loop_count < K,"infinite loop in PhaseIterGVN::transform")
- * @run main/othervm -Xcomp Test6712835
+ *
+ * @run main/othervm -Xcomp compiler.c2.cr6712835.Test6712835
  */
 
+package compiler.c2.cr6712835;
+
 /* Complexity upper bound: 349851 ops */
 
 abstract class Tester_Class_0 {
diff --git a/hotspot/test/compiler/c2/6714694/Tester.java b/hotspot/test/compiler/c2/cr6714694/Tester.java
similarity index 99%
rename from hotspot/test/compiler/c2/6714694/Tester.java
rename to hotspot/test/compiler/c2/cr6714694/Tester.java
index 65f2ed2..dd7690f 100644
--- a/hotspot/test/compiler/c2/6714694/Tester.java
+++ b/hotspot/test/compiler/c2/cr6714694/Tester.java
@@ -25,9 +25,11 @@
  * @test
  * @bug 6714694
  * @summary assertion in 64bit server vm (store->find_edge(load) != -1,"missing precedence edge") with COOPs
- * @run main/othervm -Xcomp Tester
+ *
+ * @run main/othervm -Xcomp compiler.c2.cr6714694.Tester
  */
 
+package compiler.c2.cr6714694;
 /* Complexity upper bound: 38602 ops */
 
 interface Tester_Interface_0 {
diff --git a/hotspot/test/compiler/c2/6865031/Test.java b/hotspot/test/compiler/c2/cr6865031/Test.java
similarity index 98%
rename from hotspot/test/compiler/c2/6865031/Test.java
rename to hotspot/test/compiler/c2/cr6865031/Test.java
index 4f9db19..71689ea 100644
--- a/hotspot/test/compiler/c2/6865031/Test.java
+++ b/hotspot/test/compiler/c2/cr6865031/Test.java
@@ -26,9 +26,15 @@
  * @test
  * @bug 6865031
  * @summary Application gives bad result (throws bad exception) with compressed oops
- * @run main/othervm -XX:+IgnoreUnrecognizedVMOptions -XX:+UseCompressedOops -XX:HeapBaseMinAddress=32g -XX:-LoopUnswitching -XX:CompileCommand=inline,AbstractMemoryEfficientList.equals Test hello goodbye
+ *
+ * @run main/othervm -XX:+IgnoreUnrecognizedVMOptions -XX:+UseCompressedOops
+ *      -XX:HeapBaseMinAddress=32g -XX:-LoopUnswitching
+ *      -XX:CompileCommand=inline,compiler.c2.cr6865031.AbstractMemoryEfficientList::equals
+ *      compiler.c2.cr6865031.Test hello goodbye
  */
 
+package compiler.c2.cr6865031;
+
 import java.lang.ref.ReferenceQueue;
 import java.lang.ref.WeakReference;
 import java.util.ArrayList;
diff --git a/hotspot/test/compiler/c2/5091921/Test6890943.java b/hotspot/test/compiler/c2/cr6890943/Test6890943.java
similarity index 97%
rename from hotspot/test/compiler/c2/5091921/Test6890943.java
rename to hotspot/test/compiler/c2/cr6890943/Test6890943.java
index 9752b1d..605e9ff5 100644
--- a/hotspot/test/compiler/c2/5091921/Test6890943.java
+++ b/hotspot/test/compiler/c2/cr6890943/Test6890943.java
@@ -27,10 +27,13 @@
  * @bug 6890943
  * @summary JVM mysteriously gives wrong result on 64-bit 1.6 VMs in hotspot mode.
  *
- * @run main/othervm/timeout=240 Test6890943
+ * @run main/othervm/timeout=240 compiler.c2.cr6890943.Test6890943
  */
 
-import java.io.*;
+package compiler.c2.cr6890943;
+
+import java.io.FileInputStream;
+import java.io.FileNotFoundException;
 import java.nio.file.Path;
 import java.nio.file.Paths;
 import java.util.HashMap;
diff --git a/hotspot/test/compiler/c2/5091921/input6890943.txt b/hotspot/test/compiler/c2/cr6890943/input6890943.txt
similarity index 100%
rename from hotspot/test/compiler/c2/5091921/input6890943.txt
rename to hotspot/test/compiler/c2/cr6890943/input6890943.txt
diff --git a/hotspot/test/compiler/c2/5091921/output6890943.txt b/hotspot/test/compiler/c2/cr6890943/output6890943.txt
similarity index 100%
rename from hotspot/test/compiler/c2/5091921/output6890943.txt
rename to hotspot/test/compiler/c2/cr6890943/output6890943.txt
diff --git a/hotspot/test/compiler/c2/5091921/Test7005594.java b/hotspot/test/compiler/c2/cr7005594/Test7005594.java
similarity index 98%
rename from hotspot/test/compiler/c2/5091921/Test7005594.java
rename to hotspot/test/compiler/c2/cr7005594/Test7005594.java
index 32e8bae..0dbe8271 100644
--- a/hotspot/test/compiler/c2/5091921/Test7005594.java
+++ b/hotspot/test/compiler/c2/cr7005594/Test7005594.java
@@ -30,6 +30,8 @@
  * @run shell Test7005594.sh
  */
 
+package compiler.c2.cr7005594;
+
 public class Test7005594 {
 
       static int test(byte a[]){
diff --git a/hotspot/test/compiler/c2/5091921/Test7005594.sh b/hotspot/test/compiler/c2/cr7005594/Test7005594.sh
similarity index 93%
rename from hotspot/test/compiler/c2/5091921/Test7005594.sh
rename to hotspot/test/compiler/c2/cr7005594/Test7005594.sh
index 6350a08..503d0aa 100644
--- a/hotspot/test/compiler/c2/5091921/Test7005594.sh
+++ b/hotspot/test/compiler/c2/cr7005594/Test7005594.sh
@@ -78,7 +78,10 @@
 
 ${COMPILEJAVA}/bin/javac ${TESTJAVACOPTS} -d . Test7005594.java
 
-${TESTJAVA}/bin/java ${TESTOPTS} -Xmx1600m -Xms1600m -XX:+IgnoreUnrecognizedVMOptions -XX:-ZapUnusedHeapArea -Xcomp -XX:CompileOnly=Test7005594.test -XX:CompileCommand=quiet Test7005594 > test.out 2>&1
+${TESTJAVA}/bin/java ${TESTOPTS} -Xmx1600m -Xms1600m -XX:+IgnoreUnrecognizedVMOptions \
+        -XX:-ZapUnusedHeapArea -Xcomp -XX:CompileCommand=quiet \
+        -XX:CompileOnly=compiler.c2.cr7005594.Test7005594::test \
+        compiler.c2.cr7005594.Test7005594 > test.out 2>&1
 
 result=$?
 
diff --git a/hotspot/test/compiler/c2/7192963/TestByteVect.java b/hotspot/test/compiler/c2/cr7192963/TestByteVect.java
similarity index 97%
rename from hotspot/test/compiler/c2/7192963/TestByteVect.java
rename to hotspot/test/compiler/c2/cr7192963/TestByteVect.java
index fd466ff..208a9aa 100644
--- a/hotspot/test/compiler/c2/7192963/TestByteVect.java
+++ b/hotspot/test/compiler/c2/cr7192963/TestByteVect.java
@@ -27,9 +27,11 @@
  * @bug 7192963
  * @summary assert(_in[req-1] == this) failed: Must pass arg count to 'new'
  *
- * @run main/othervm/timeout=400 -Xbatch -Xmx64m TestByteVect
+ * @run main/othervm/timeout=400 -Xbatch -Xmx64m compiler.c2.cr7192963.TestByteVect
  */
 
+package compiler.c2.cr7192963;
+
 public class TestByteVect {
   private static final int ARRLEN = 997;
   private static final int ITERS  = 11000;
diff --git a/hotspot/test/compiler/c2/7192963/TestDoubleVect.java b/hotspot/test/compiler/c2/cr7192963/TestDoubleVect.java
similarity index 97%
rename from hotspot/test/compiler/c2/7192963/TestDoubleVect.java
rename to hotspot/test/compiler/c2/cr7192963/TestDoubleVect.java
index 872eb42..f969cf7 100644
--- a/hotspot/test/compiler/c2/7192963/TestDoubleVect.java
+++ b/hotspot/test/compiler/c2/cr7192963/TestDoubleVect.java
@@ -27,9 +27,11 @@
  * @bug 7192963
  * @summary assert(_in[req-1] == this) failed: Must pass arg count to 'new'
  *
- * @run main/othervm/timeout=400 -Xbatch -Xmx64m TestDoubleVect
+ * @run main/othervm/timeout=400 -Xbatch -Xmx64m compiler.c2.cr7192963.TestDoubleVect
  */
 
+package compiler.c2.cr7192963;
+
 public class TestDoubleVect {
   private static final int ARRLEN = 997;
   private static final int ITERS  = 11000;
diff --git a/hotspot/test/compiler/c2/7192963/TestFloatVect.java b/hotspot/test/compiler/c2/cr7192963/TestFloatVect.java
similarity index 97%
rename from hotspot/test/compiler/c2/7192963/TestFloatVect.java
rename to hotspot/test/compiler/c2/cr7192963/TestFloatVect.java
index 399e68e..d608def 100644
--- a/hotspot/test/compiler/c2/7192963/TestFloatVect.java
+++ b/hotspot/test/compiler/c2/cr7192963/TestFloatVect.java
@@ -27,9 +27,11 @@
  * @bug 7192963
  * @summary assert(_in[req-1] == this) failed: Must pass arg count to 'new'
  *
- * @run main/othervm/timeout=400 -Xbatch -Xmx64m TestFloatVect
+ * @run main/othervm/timeout=400 -Xbatch -Xmx64m compiler.c2.cr7192963.TestFloatVect
  */
 
+package compiler.c2.cr7192963;
+
 public class TestFloatVect {
   private static final int ARRLEN = 997;
   private static final int ITERS  = 11000;
diff --git a/hotspot/test/compiler/c2/7192963/TestIntVect.java b/hotspot/test/compiler/c2/cr7192963/TestIntVect.java
similarity index 97%
rename from hotspot/test/compiler/c2/7192963/TestIntVect.java
rename to hotspot/test/compiler/c2/cr7192963/TestIntVect.java
index b1bb147..d9f25ab 100644
--- a/hotspot/test/compiler/c2/7192963/TestIntVect.java
+++ b/hotspot/test/compiler/c2/cr7192963/TestIntVect.java
@@ -27,9 +27,11 @@
  * @bug 7192963
  * @summary assert(_in[req-1] == this) failed: Must pass arg count to 'new'
  *
- * @run main/othervm/timeout=400 -Xbatch -Xmx64m TestIntVect
+ * @run main/othervm/timeout=400 -Xbatch -Xmx64m compiler.c2.cr7192963.TestIntVect
  */
 
+package compiler.c2.cr7192963;
+
 public class TestIntVect {
   private static final int ARRLEN = 997;
   private static final int ITERS  = 11000;
diff --git a/hotspot/test/compiler/c2/7192963/TestLongVect.java b/hotspot/test/compiler/c2/cr7192963/TestLongVect.java
similarity index 97%
rename from hotspot/test/compiler/c2/7192963/TestLongVect.java
rename to hotspot/test/compiler/c2/cr7192963/TestLongVect.java
index 7266352..d0f2eba 100644
--- a/hotspot/test/compiler/c2/7192963/TestLongVect.java
+++ b/hotspot/test/compiler/c2/cr7192963/TestLongVect.java
@@ -27,9 +27,11 @@
  * @bug 7192963
  * @summary assert(_in[req-1] == this) failed: Must pass arg count to 'new'
  *
- * @run main/othervm/timeout=400 -Xbatch -Xmx64m TestLongVect
+ * @run main/othervm/timeout=400 -Xbatch -Xmx64m compiler.c2.cr7192963.TestLongVect
  */
 
+package compiler.c2.cr7192963;
+
 public class TestLongVect {
   private static final int ARRLEN = 997;
   private static final int ITERS  = 11000;
diff --git a/hotspot/test/compiler/c2/7192963/TestShortVect.java b/hotspot/test/compiler/c2/cr7192963/TestShortVect.java
similarity index 97%
rename from hotspot/test/compiler/c2/7192963/TestShortVect.java
rename to hotspot/test/compiler/c2/cr7192963/TestShortVect.java
index f83e5ff..ae0dcf3 100644
--- a/hotspot/test/compiler/c2/7192963/TestShortVect.java
+++ b/hotspot/test/compiler/c2/cr7192963/TestShortVect.java
@@ -27,9 +27,11 @@
  * @bug 7192963
  * @summary assert(_in[req-1] == this) failed: Must pass arg count to 'new'
  *
- * @run main/othervm/timeout=400 -Xbatch -Xmx64m TestShortVect
+ * @run main/othervm/timeout=400 -Xbatch -Xmx64m compiler.c2.cr7192963.TestShortVect
  */
 
+package compiler.c2.cr7192963;
+
 public class TestShortVect {
   private static final int ARRLEN = 997;
   private static final int ITERS  = 11000;
diff --git a/hotspot/test/compiler/c2/7200264/Test7200264.sh b/hotspot/test/compiler/c2/cr7200264/Test7200264.sh
similarity index 95%
rename from hotspot/test/compiler/c2/7200264/Test7200264.sh
rename to hotspot/test/compiler/c2/cr7200264/Test7200264.sh
index df2d1ba..7848bff 100644
--- a/hotspot/test/compiler/c2/7200264/Test7200264.sh
+++ b/hotspot/test/compiler/c2/cr7200264/Test7200264.sh
@@ -56,7 +56,9 @@
 ${COMPILEJAVA}${FS}bin${FS}javac ${TESTJAVACOPTS} -d . TestIntVect.java
 
 # CICompilerCount must be at least 2 with -TieredCompilation
-${TESTJAVA}${FS}bin${FS}java ${TESTOPTS} -Xbatch -XX:-TieredCompilation -XX:CICompilerCount=2 -XX:+PrintCompilation -XX:+TraceNewVectors TestIntVect > test.out 2>&1
+${TESTJAVA}${FS}bin${FS}java ${TESTOPTS} -Xbatch -XX:-TieredCompilation  \
+        -XX:CICompilerCount=2 -XX:+PrintCompilation -XX:+TraceNewVectors \
+        compiler.c2.cr7200264.TestIntVect > test.out 2>&1
 
 COUNT=`grep AddVI test.out | wc -l | awk '{print $1}'`
 if [ $COUNT -lt 4 ]
diff --git a/hotspot/test/compiler/c2/7200264/TestIntVect.java b/hotspot/test/compiler/c2/cr7200264/TestIntVect.java
similarity index 99%
rename from hotspot/test/compiler/c2/7200264/TestIntVect.java
rename to hotspot/test/compiler/c2/cr7200264/TestIntVect.java
index f85d4ff..1a24815 100644
--- a/hotspot/test/compiler/c2/7200264/TestIntVect.java
+++ b/hotspot/test/compiler/c2/cr7200264/TestIntVect.java
@@ -30,6 +30,7 @@
  * @run shell Test7200264.sh
  */
 
+package compiler.c2.cr7200264;
 /*
  * Copy of test/compiler/6340864/TestIntVect.java without performance tests.
  */
diff --git a/hotspot/test/compiler/c2/8004867/TestIntAtomicCAS.java b/hotspot/test/compiler/c2/cr8004867/TestIntAtomicCAS.java
similarity index 99%
rename from hotspot/test/compiler/c2/8004867/TestIntAtomicCAS.java
rename to hotspot/test/compiler/c2/cr8004867/TestIntAtomicCAS.java
index 16d7d97..fa2fafb 100644
--- a/hotspot/test/compiler/c2/8004867/TestIntAtomicCAS.java
+++ b/hotspot/test/compiler/c2/cr8004867/TestIntAtomicCAS.java
@@ -27,10 +27,16 @@
  * @bug 8004867
  * @summary VM crashing with assert "share/vm/opto/node.hpp:357 - assert(i < _max) failed: oob"
  *
- * @run main/othervm/timeout=300 -Xbatch -XX:+IgnoreUnrecognizedVMOptions -XX:-TieredCompilation -XX:-OptimizeFill TestIntAtomicCAS
- * @run main/othervm/timeout=300 -Xbatch -XX:+IgnoreUnrecognizedVMOptions -XX:-TieredCompilation -XX:+OptimizeFill TestIntAtomicCAS
+ * @run main/othervm/timeout=300 -Xbatch -XX:+IgnoreUnrecognizedVMOptions -XX:-TieredCompilation
+ *    -XX:-OptimizeFill
+ *    compiler.c2.cr8004867.TestIntAtomicCAS
+ * @run main/othervm/timeout=300 -Xbatch -XX:+IgnoreUnrecognizedVMOptions -XX:-TieredCompilation
+ *    -XX:+OptimizeFill
+ *    compiler.c2.cr8004867.TestIntAtomicCAS
  */
 
+package compiler.c2.cr8004867;
+
 import java.util.concurrent.atomic.AtomicIntegerArray;
 
 public class TestIntAtomicCAS {
diff --git a/hotspot/test/compiler/c2/8004867/TestIntAtomicOrdered.java b/hotspot/test/compiler/c2/cr8004867/TestIntAtomicOrdered.java
similarity index 98%
rename from hotspot/test/compiler/c2/8004867/TestIntAtomicOrdered.java
rename to hotspot/test/compiler/c2/cr8004867/TestIntAtomicOrdered.java
index 8e81f6c..d7f1151 100644
--- a/hotspot/test/compiler/c2/8004867/TestIntAtomicOrdered.java
+++ b/hotspot/test/compiler/c2/cr8004867/TestIntAtomicOrdered.java
@@ -27,10 +27,16 @@
  * @bug 8004867
  * @summary VM crashing with assert "share/vm/opto/node.hpp:357 - assert(i < _max) failed: oob"
  *
- * @run main/othervm/timeout=300 -Xbatch -XX:+IgnoreUnrecognizedVMOptions -XX:-TieredCompilation -XX:-OptimizeFill TestIntAtomicOrdered
- * @run main/othervm/timeout=300 -Xbatch -XX:+IgnoreUnrecognizedVMOptions -XX:-TieredCompilation -XX:+OptimizeFill TestIntAtomicOrdered
+ * @run main/othervm/timeout=300 -Xbatch -XX:+IgnoreUnrecognizedVMOptions -XX:-TieredCompilation
+ *    -XX:-OptimizeFill
+ *    compiler.c2.cr8004867.TestIntAtomicOrdered
+ * @run main/othervm/timeout=300 -Xbatch -XX:+IgnoreUnrecognizedVMOptions -XX:-TieredCompilation
+ *    -XX:+OptimizeFill
+ *    compiler.c2.cr8004867.TestIntAtomicOrdered
  */
 
+package compiler.c2.cr8004867;
+
 import java.util.concurrent.atomic.AtomicIntegerArray;
 
 public class TestIntAtomicOrdered {
diff --git a/hotspot/test/compiler/c2/8004867/TestIntAtomicVolatile.java b/hotspot/test/compiler/c2/cr8004867/TestIntAtomicVolatile.java
similarity index 98%
rename from hotspot/test/compiler/c2/8004867/TestIntAtomicVolatile.java
rename to hotspot/test/compiler/c2/cr8004867/TestIntAtomicVolatile.java
index ed0563d..6b1a067 100644
--- a/hotspot/test/compiler/c2/8004867/TestIntAtomicVolatile.java
+++ b/hotspot/test/compiler/c2/cr8004867/TestIntAtomicVolatile.java
@@ -27,10 +27,16 @@
  * @bug 8004867
  * @summary VM crashing with assert "share/vm/opto/node.hpp:357 - assert(i < _max) failed: oob"
  *
- * @run main/othervm/timeout=300 -Xbatch -XX:+IgnoreUnrecognizedVMOptions -XX:-TieredCompilation -XX:-OptimizeFill TestIntAtomicVolatile
- * @run main/othervm/timeout=300 -Xbatch -XX:+IgnoreUnrecognizedVMOptions -XX:-TieredCompilation -XX:+OptimizeFill TestIntAtomicVolatile
+ * @run main/othervm/timeout=300 -Xbatch -XX:+IgnoreUnrecognizedVMOptions -XX:-TieredCompilation
+ *    -XX:-OptimizeFill
+ *    compiler.c2.cr8004867.TestIntAtomicVolatile
+ * @run main/othervm/timeout=300 -Xbatch -XX:+IgnoreUnrecognizedVMOptions -XX:-TieredCompilation
+ *    -XX:+OptimizeFill
+ *    compiler.c2.cr8004867.TestIntAtomicVolatile
  */
 
+package compiler.c2.cr8004867;
+
 import java.util.concurrent.atomic.AtomicIntegerArray;
 
 public class TestIntAtomicVolatile {
diff --git a/hotspot/test/compiler/c2/8004867/TestIntUnsafeCAS.java b/hotspot/test/compiler/c2/cr8004867/TestIntUnsafeCAS.java
similarity index 98%
rename from hotspot/test/compiler/c2/8004867/TestIntUnsafeCAS.java
rename to hotspot/test/compiler/c2/cr8004867/TestIntUnsafeCAS.java
index a405f56..4499ed5 100644
--- a/hotspot/test/compiler/c2/8004867/TestIntUnsafeCAS.java
+++ b/hotspot/test/compiler/c2/cr8004867/TestIntUnsafeCAS.java
@@ -26,14 +26,21 @@
  * @test
  * @bug 8004867
  * @summary VM crashing with assert "share/vm/opto/node.hpp:357 - assert(i < _max) failed: oob"
- *
  * @modules java.base/jdk.internal.misc
- * @run main/othervm/timeout=300 -Xbatch -XX:+IgnoreUnrecognizedVMOptions -XX:-TieredCompilation -XX:-OptimizeFill TestIntUnsafeCAS
- * @run main/othervm/timeout=300 -Xbatch -XX:+IgnoreUnrecognizedVMOptions -XX:-TieredCompilation -XX:+OptimizeFill TestIntUnsafeCAS
+ *
+ * @run main/othervm/timeout=300 -Xbatch -XX:+IgnoreUnrecognizedVMOptions -XX:-TieredCompilation
+ *    -XX:-OptimizeFill
+ *    compiler.c2.cr8004867.TestIntUnsafeCAS
+ * @run main/othervm/timeout=300 -Xbatch -XX:+IgnoreUnrecognizedVMOptions -XX:-TieredCompilation
+ *    -XX:+OptimizeFill
+ *    compiler.c2.cr8004867.TestIntUnsafeCAS
  */
 
+package compiler.c2.cr8004867;
+
 import jdk.internal.misc.Unsafe;
-import java.lang.reflect.*;
+
+import java.lang.reflect.Field;
 
 public class TestIntUnsafeCAS {
   private static final int ARRLEN = 97;
diff --git a/hotspot/test/compiler/c2/8004867/TestIntUnsafeOrdered.java b/hotspot/test/compiler/c2/cr8004867/TestIntUnsafeOrdered.java
similarity index 98%
rename from hotspot/test/compiler/c2/8004867/TestIntUnsafeOrdered.java
rename to hotspot/test/compiler/c2/cr8004867/TestIntUnsafeOrdered.java
index 3fec4bd..3298e1b 100644
--- a/hotspot/test/compiler/c2/8004867/TestIntUnsafeOrdered.java
+++ b/hotspot/test/compiler/c2/cr8004867/TestIntUnsafeOrdered.java
@@ -26,13 +26,20 @@
  * @test
  * @bug 8004867
  * @summary VM crashing with assert "share/vm/opto/node.hpp:357 - assert(i < _max) failed: oob"
- *
  * @modules java.base/jdk.internal.misc
- * @run main/othervm/timeout=300 -Xbatch -XX:+IgnoreUnrecognizedVMOptions -XX:-TieredCompilation -XX:-OptimizeFill TestIntUnsafeOrdered
- * @run main/othervm/timeout=300 -Xbatch -XX:+IgnoreUnrecognizedVMOptions -XX:-TieredCompilation -XX:+OptimizeFill TestIntUnsafeOrdered
+ *
+ * @run main/othervm/timeout=300 -Xbatch -XX:+IgnoreUnrecognizedVMOptions -XX:-TieredCompilation
+ *    -XX:-OptimizeFill
+ *    compiler.c2.cr8004867.TestIntUnsafeOrdered
+ * @run main/othervm/timeout=300 -Xbatch -XX:+IgnoreUnrecognizedVMOptions -XX:-TieredCompilation
+ *    -XX:+OptimizeFill
+ *    compiler.c2.cr8004867.TestIntUnsafeOrdered
  */
 
+package compiler.c2.cr8004867;
+
 import jdk.internal.misc.Unsafe;
+
 import java.lang.reflect.Field;
 
 public class TestIntUnsafeOrdered {
diff --git a/hotspot/test/compiler/c2/8004867/TestIntUnsafeVolatile.java b/hotspot/test/compiler/c2/cr8004867/TestIntUnsafeVolatile.java
similarity index 98%
rename from hotspot/test/compiler/c2/8004867/TestIntUnsafeVolatile.java
rename to hotspot/test/compiler/c2/cr8004867/TestIntUnsafeVolatile.java
index 6cbab7a..6bcd398 100644
--- a/hotspot/test/compiler/c2/8004867/TestIntUnsafeVolatile.java
+++ b/hotspot/test/compiler/c2/cr8004867/TestIntUnsafeVolatile.java
@@ -26,14 +26,21 @@
  * @test
  * @bug 8004867
  * @summary VM crashing with assert "share/vm/opto/node.hpp:357 - assert(i < _max) failed: oob"
- *
  * @modules java.base/jdk.internal.misc
- * @run main/othervm/timeout=300 -Xbatch -XX:+IgnoreUnrecognizedVMOptions -XX:-TieredCompilation -XX:-OptimizeFill TestIntUnsafeVolatile
- * @run main/othervm/timeout=300 -Xbatch -XX:+IgnoreUnrecognizedVMOptions -XX:-TieredCompilation -XX:+OptimizeFill TestIntUnsafeVolatile
+ *
+ * @run main/othervm/timeout=300 -Xbatch -XX:+IgnoreUnrecognizedVMOptions -XX:-TieredCompilation
+ *    -XX:-OptimizeFill
+ *    compiler.c2.cr8004867.TestIntUnsafeVolatile
+ * @run main/othervm/timeout=300 -Xbatch -XX:+IgnoreUnrecognizedVMOptions -XX:-TieredCompilation
+ *    -XX:+OptimizeFill
+ *    compiler.c2.cr8004867.TestIntUnsafeVolatile
  */
 
+package compiler.c2.cr8004867;
+
 import jdk.internal.misc.Unsafe;
-import java.lang.reflect.*;
+
+import java.lang.reflect.Field;
 
 public class TestIntUnsafeVolatile {
   private static final int ARRLEN = 97;
diff --git a/hotspot/test/compiler/c2/7070134/Stemmer.java b/hotspot/test/compiler/c2/stemmer/Stemmer.java
similarity index 98%
rename from hotspot/test/compiler/c2/7070134/Stemmer.java
rename to hotspot/test/compiler/c2/stemmer/Stemmer.java
index b8dbc05..0f8cb29 100644
--- a/hotspot/test/compiler/c2/7070134/Stemmer.java
+++ b/hotspot/test/compiler/c2/stemmer/Stemmer.java
@@ -4,8 +4,9 @@
  * @summary Hotspot crashes with sigsegv from PorterStemmer
  * @modules java.base/jdk.internal.misc
  * @library /testlibrary
+ *
  * @run driver jdk.test.lib.FileInstaller words words
- * @run main/othervm -Xbatch Stemmer words
+ * @run main/othervm -Xbatch compiler.c2.stemmer.Stemmer words
  */
 
 /*
@@ -53,7 +54,11 @@
 
 */
 
-import java.io.*;
+package compiler.c2.stemmer;
+
+import java.io.FileInputStream;
+import java.io.FileNotFoundException;
+import java.io.IOException;
 
 /**
   * Stemmer, implementing the Porter Stemming Algorithm
diff --git a/hotspot/test/compiler/c2/7070134/words b/hotspot/test/compiler/c2/stemmer/words
similarity index 100%
rename from hotspot/test/compiler/c2/7070134/words
rename to hotspot/test/compiler/c2/stemmer/words
diff --git a/hotspot/test/compiler/native/TestDirtyInt.java b/hotspot/test/compiler/calls/TestDirtyInt.java
similarity index 95%
rename from hotspot/test/compiler/native/TestDirtyInt.java
rename to hotspot/test/compiler/calls/TestDirtyInt.java
index 607fd2d..ee89177 100644
--- a/hotspot/test/compiler/native/TestDirtyInt.java
+++ b/hotspot/test/compiler/calls/TestDirtyInt.java
@@ -22,8 +22,12 @@
  */
 
 /* @test
- * @run main/native TestDirtyInt
+
+ * @run main/native compiler.calls.TestDirtyInt
  */
+
+package compiler.calls;
+
 public class TestDirtyInt {
     static {
         System.loadLibrary("TestDirtyInt");
diff --git a/hotspot/test/compiler/calls/common/CallsBase.java b/hotspot/test/compiler/calls/common/CallsBase.java
index f6a9ad9..44549a3 100644
--- a/hotspot/test/compiler/calls/common/CallsBase.java
+++ b/hotspot/test/compiler/calls/common/CallsBase.java
@@ -24,11 +24,12 @@
 package compiler.calls.common;
 
 import compiler.testlibrary.CompilerUtils;
-import java.lang.reflect.Method;
-import java.util.Arrays;
 import jdk.test.lib.Asserts;
 import sun.hotspot.WhiteBox;
 
+import java.lang.reflect.Method;
+import java.util.Arrays;
+
 /**
  * A common class for Invoke* classes
  */
diff --git a/hotspot/test/compiler/calls/common/InvokeDynamicPatcher.java b/hotspot/test/compiler/calls/common/InvokeDynamicPatcher.java
index 644f0a2..f38c949 100644
--- a/hotspot/test/compiler/calls/common/InvokeDynamicPatcher.java
+++ b/hotspot/test/compiler/calls/common/InvokeDynamicPatcher.java
@@ -23,6 +23,14 @@
 
 package compiler.calls.common;
 
+import jdk.internal.org.objectweb.asm.ClassReader;
+import jdk.internal.org.objectweb.asm.ClassVisitor;
+import jdk.internal.org.objectweb.asm.ClassWriter;
+import jdk.internal.org.objectweb.asm.Handle;
+import jdk.internal.org.objectweb.asm.Label;
+import jdk.internal.org.objectweb.asm.MethodVisitor;
+import jdk.internal.org.objectweb.asm.Opcodes;
+
 import java.io.FileInputStream;
 import java.io.IOException;
 import java.lang.invoke.CallSite;
@@ -33,13 +41,6 @@
 import java.nio.file.Path;
 import java.nio.file.Paths;
 import java.nio.file.StandardOpenOption;
-import jdk.internal.org.objectweb.asm.ClassReader;
-import jdk.internal.org.objectweb.asm.ClassVisitor;
-import jdk.internal.org.objectweb.asm.ClassWriter;
-import jdk.internal.org.objectweb.asm.Handle;
-import jdk.internal.org.objectweb.asm.Label;
-import jdk.internal.org.objectweb.asm.MethodVisitor;
-import jdk.internal.org.objectweb.asm.Opcodes;
 
 /**
  * A class which patch InvokeDynamic class bytecode with invokydynamic
diff --git a/hotspot/test/compiler/calls/fromCompiled/CompiledInvokeDynamic2CompiledTest.java b/hotspot/test/compiler/calls/fromCompiled/CompiledInvokeDynamic2CompiledTest.java
index 3124d3d..0ba2498 100644
--- a/hotspot/test/compiler/calls/fromCompiled/CompiledInvokeDynamic2CompiledTest.java
+++ b/hotspot/test/compiler/calls/fromCompiled/CompiledInvokeDynamic2CompiledTest.java
@@ -23,11 +23,13 @@
 
 /*
  * @test
+ * @summary check calls from compiled to compiled using InvokeDynamic
  * @library /test/lib /testlibrary /
  * @modules java.base/jdk.internal.misc
- * @modules java.base/jdk.internal.org.objectweb.asm
+ *          java.base/jdk.internal.org.objectweb.asm
+ *
  * @build compiler.calls.common.InvokeDynamic
- * @build compiler.calls.common.InvokeDynamicPatcher
+ *        compiler.calls.common.InvokeDynamicPatcher
  * @run main compiler.calls.common.InvokeDynamicPatcher
  * @run driver ClassFileInstaller sun.hotspot.WhiteBox
  *    sun.hotspot.WhiteBox$WhiteBoxPermission
@@ -43,5 +45,4 @@
  * @run main/othervm -XX:+UnlockDiagnosticVMOptions -XX:+WhiteBoxAPI -Xbootclasspath/a:.
  *    -Xbatch compiler.calls.common.InvokeDynamic
  *    -compileCaller 4 -checkCallerCompileLevel 4 -compileCallee 4 -checkCalleeCompileLevel 4
- * @summary check calls from compiled to compiled using InvokeDynamic
  */
diff --git a/hotspot/test/compiler/calls/fromCompiled/CompiledInvokeDynamic2InterpretedTest.java b/hotspot/test/compiler/calls/fromCompiled/CompiledInvokeDynamic2InterpretedTest.java
index 4916220..98a86b1 100644
--- a/hotspot/test/compiler/calls/fromCompiled/CompiledInvokeDynamic2InterpretedTest.java
+++ b/hotspot/test/compiler/calls/fromCompiled/CompiledInvokeDynamic2InterpretedTest.java
@@ -23,9 +23,11 @@
 
 /*
  * @test
+ * @summary check calls from compiled to interpreted using InvokeDynamic
  * @library /test/lib /testlibrary /
  * @modules java.base/jdk.internal.misc
- * @modules java.base/jdk.internal.org.objectweb.asm
+ *          java.base/jdk.internal.org.objectweb.asm
+ *
  * @build compiler.calls.common.InvokeDynamic
  * @build compiler.calls.common.InvokeDynamicPatcher
  * @run main compiler.calls.common.InvokeDynamicPatcher
@@ -37,5 +39,4 @@
  * @run main/othervm -XX:+UnlockDiagnosticVMOptions -XX:+WhiteBoxAPI -Xbootclasspath/a:.
  *    -Xbatch -XX:CompileCommand=exclude,compiler.calls.common.InvokeDynamic::callee compiler.calls.common.InvokeDynamic
  *    -compileCaller 4 -checkCallerCompileLevel 4 -checkCalleeCompileLevel 0
- * @summary check calls from compiled to interpreted using InvokeDynamic
  */
diff --git a/hotspot/test/compiler/calls/fromCompiled/CompiledInvokeDynamic2NativeTest.java b/hotspot/test/compiler/calls/fromCompiled/CompiledInvokeDynamic2NativeTest.java
index 3721632..397faf2 100644
--- a/hotspot/test/compiler/calls/fromCompiled/CompiledInvokeDynamic2NativeTest.java
+++ b/hotspot/test/compiler/calls/fromCompiled/CompiledInvokeDynamic2NativeTest.java
@@ -23,11 +23,13 @@
 
 /*
  * @test
+ * @summary check calls from compiled to native using InvokeDynamic
  * @library /test/lib /testlibrary /
  * @modules java.base/jdk.internal.misc
- * @modules java.base/jdk.internal.org.objectweb.asm
+ *          java.base/jdk.internal.org.objectweb.asm
+ *
  * @build compiler.calls.common.InvokeDynamic
- * @build compiler.calls.common.InvokeDynamicPatcher
+ *        compiler.calls.common.InvokeDynamicPatcher
  * @run main compiler.calls.common.InvokeDynamicPatcher
  * @run driver ClassFileInstaller sun.hotspot.WhiteBox
  *    sun.hotspot.WhiteBox$WhiteBoxPermission
@@ -37,5 +39,4 @@
  * @run main/othervm -XX:+UnlockDiagnosticVMOptions -XX:+WhiteBoxAPI -Xbootclasspath/a:.
  *    -Xbatch  compiler.calls.common.InvokeDynamic
  *    -compileCaller 4 -checkCallerCompileLevel 4 -nativeCallee
- * @summary check calls from compiled to native using InvokeDynamic
  */
diff --git a/hotspot/test/compiler/calls/fromCompiled/CompiledInvokeInterface2CompiledTest.java b/hotspot/test/compiler/calls/fromCompiled/CompiledInvokeInterface2CompiledTest.java
index 34f86cd..46667c9 100644
--- a/hotspot/test/compiler/calls/fromCompiled/CompiledInvokeInterface2CompiledTest.java
+++ b/hotspot/test/compiler/calls/fromCompiled/CompiledInvokeInterface2CompiledTest.java
@@ -24,7 +24,9 @@
 /*
  * @test
  * @modules java.base/jdk.internal.misc
+ * @summary check calls from compiled to compiled using InvokeInterface
  * @library /test/lib /testlibrary /
+ *
  * @build compiler.calls.common.InvokeInterface
  * @run driver ClassFileInstaller sun.hotspot.WhiteBox
  *    sun.hotspot.WhiteBox$WhiteBoxPermission
@@ -40,5 +42,4 @@
  * @run main/othervm -XX:+UnlockDiagnosticVMOptions -XX:+WhiteBoxAPI -Xbootclasspath/a:.
  *    -Xbatch compiler.calls.common.InvokeInterface
  *    -compileCaller 4 -checkCallerCompileLevel 4 -compileCallee 4 -checkCalleeCompileLevel 4
- * @summary check calls from compiled to compiled using InvokeInterface
  */
diff --git a/hotspot/test/compiler/calls/fromCompiled/CompiledInvokeInterface2InterpretedTest.java b/hotspot/test/compiler/calls/fromCompiled/CompiledInvokeInterface2InterpretedTest.java
index fb30210..07fcff1 100644
--- a/hotspot/test/compiler/calls/fromCompiled/CompiledInvokeInterface2InterpretedTest.java
+++ b/hotspot/test/compiler/calls/fromCompiled/CompiledInvokeInterface2InterpretedTest.java
@@ -23,8 +23,10 @@
 
 /*
  * @test
+ * @summary check calls from compiled to interpreted using InvokeInterface
  * @modules java.base/jdk.internal.misc
  * @library /test/lib /testlibrary /
+ *
  * @build compiler.calls.common.InvokeInterface
  * @run driver ClassFileInstaller sun.hotspot.WhiteBox
  *    sun.hotspot.WhiteBox$WhiteBoxPermission
@@ -34,5 +36,4 @@
  * @run main/othervm -XX:+UnlockDiagnosticVMOptions -XX:+WhiteBoxAPI -Xbootclasspath/a:.
  *    -Xbatch -XX:CompileCommand=exclude,compiler.calls.common.InvokeInterface::callee compiler.calls.common.InvokeInterface
  *    -compileCaller 4 -checkCallerCompileLevel 4 -checkCalleeCompileLevel 0
- * @summary check calls from compiled to interpreted using InvokeInterface
  */
diff --git a/hotspot/test/compiler/calls/fromCompiled/CompiledInvokeInterface2NativeTest.java b/hotspot/test/compiler/calls/fromCompiled/CompiledInvokeInterface2NativeTest.java
index a930528..e3a6895 100644
--- a/hotspot/test/compiler/calls/fromCompiled/CompiledInvokeInterface2NativeTest.java
+++ b/hotspot/test/compiler/calls/fromCompiled/CompiledInvokeInterface2NativeTest.java
@@ -23,8 +23,10 @@
 
 /*
  * @test
+ * @summary check calls from compiled to native using InvokeInterface
  * @modules java.base/jdk.internal.misc
  * @library /test/lib /testlibrary /
+ *
  * @build compiler.calls.common.InvokeInterface
  * @run driver ClassFileInstaller sun.hotspot.WhiteBox
  *    sun.hotspot.WhiteBox$WhiteBoxPermission
@@ -34,5 +36,4 @@
  * @run main/othervm -XX:+UnlockDiagnosticVMOptions -XX:+WhiteBoxAPI -Xbootclasspath/a:.
  *    -Xbatch  compiler.calls.common.InvokeInterface
  *    -compileCaller 4 -checkCallerCompileLevel 4 -nativeCallee
- * @summary check calls from compiled to native using InvokeInterface
  */
diff --git a/hotspot/test/compiler/calls/fromCompiled/CompiledInvokeSpecial2CompiledTest.java b/hotspot/test/compiler/calls/fromCompiled/CompiledInvokeSpecial2CompiledTest.java
index 39648e7..07e6fc9 100644
--- a/hotspot/test/compiler/calls/fromCompiled/CompiledInvokeSpecial2CompiledTest.java
+++ b/hotspot/test/compiler/calls/fromCompiled/CompiledInvokeSpecial2CompiledTest.java
@@ -23,8 +23,10 @@
 
 /*
  * @test
+ * @summary check calls from compiled to compiled using InvokeSpecial
  * @modules java.base/jdk.internal.misc
  * @library /test/lib /testlibrary /
+ *
  * @build compiler.calls.common.InvokeSpecial
  * @run driver ClassFileInstaller sun.hotspot.WhiteBox
  *    sun.hotspot.WhiteBox$WhiteBoxPermission
@@ -40,5 +42,4 @@
  * @run main/othervm -XX:+UnlockDiagnosticVMOptions -XX:+WhiteBoxAPI -Xbootclasspath/a:.
  *    -Xbatch compiler.calls.common.InvokeSpecial
  *    -compileCaller 4 -checkCallerCompileLevel 4 -compileCallee 4 -checkCalleeCompileLevel 4
- * @summary check calls from compiled to compiled using InvokeSpecial
  */
diff --git a/hotspot/test/compiler/calls/fromCompiled/CompiledInvokeSpecial2InterpretedTest.java b/hotspot/test/compiler/calls/fromCompiled/CompiledInvokeSpecial2InterpretedTest.java
index 25cac6b..e08784d 100644
--- a/hotspot/test/compiler/calls/fromCompiled/CompiledInvokeSpecial2InterpretedTest.java
+++ b/hotspot/test/compiler/calls/fromCompiled/CompiledInvokeSpecial2InterpretedTest.java
@@ -23,8 +23,10 @@
 
 /*
  * @test
+ * @summary check calls from compiled to interpreted using InvokeSpecial
  * @modules java.base/jdk.internal.misc
  * @library /test/lib /testlibrary /
+ *
  * @build compiler.calls.common.InvokeSpecial
  * @run driver ClassFileInstaller sun.hotspot.WhiteBox
  *    sun.hotspot.WhiteBox$WhiteBoxPermission
@@ -34,5 +36,4 @@
  * @run main/othervm -XX:+UnlockDiagnosticVMOptions -XX:+WhiteBoxAPI -Xbootclasspath/a:.
  *    -Xbatch -XX:CompileCommand=exclude,compiler.calls.common.InvokeSpecial::callee compiler.calls.common.InvokeSpecial
  *    -compileCaller 4 -checkCallerCompileLevel 4 -checkCalleeCompileLevel 0
- * @summary check calls from compiled to interpreted using InvokeSpecial
  */
diff --git a/hotspot/test/compiler/calls/fromCompiled/CompiledInvokeSpecial2NativeTest.java b/hotspot/test/compiler/calls/fromCompiled/CompiledInvokeSpecial2NativeTest.java
index e30115a..600301b 100644
--- a/hotspot/test/compiler/calls/fromCompiled/CompiledInvokeSpecial2NativeTest.java
+++ b/hotspot/test/compiler/calls/fromCompiled/CompiledInvokeSpecial2NativeTest.java
@@ -23,8 +23,10 @@
 
 /*
  * @test
+ * @summary check calls from compiled to native using InvokeSpecial
  * @modules java.base/jdk.internal.misc
  * @library /test/lib /testlibrary /
+ *
  * @build compiler.calls.common.InvokeSpecial
  * @run driver ClassFileInstaller sun.hotspot.WhiteBox
  *    sun.hotspot.WhiteBox$WhiteBoxPermission
@@ -34,5 +36,4 @@
  * @run main/othervm -XX:+UnlockDiagnosticVMOptions -XX:+WhiteBoxAPI -Xbootclasspath/a:.
  *    -Xbatch  compiler.calls.common.InvokeSpecial
  *    -compileCaller 4 -checkCallerCompileLevel 4 -nativeCallee
- * @summary check calls from compiled to native using InvokeSpecial
  */
diff --git a/hotspot/test/compiler/calls/fromCompiled/CompiledInvokeStatic2CompiledTest.java b/hotspot/test/compiler/calls/fromCompiled/CompiledInvokeStatic2CompiledTest.java
index 8cda5e0..ddd88ab 100644
--- a/hotspot/test/compiler/calls/fromCompiled/CompiledInvokeStatic2CompiledTest.java
+++ b/hotspot/test/compiler/calls/fromCompiled/CompiledInvokeStatic2CompiledTest.java
@@ -23,8 +23,10 @@
 
 /*
  * @test
+ * @summary check calls from compiled to compiled using InvokeStatic
  * @modules java.base/jdk.internal.misc
  * @library /test/lib /testlibrary /
+ *
  * @build compiler.calls.common.InvokeStatic
  * @run driver ClassFileInstaller sun.hotspot.WhiteBox
  *    sun.hotspot.WhiteBox$WhiteBoxPermission
@@ -40,5 +42,4 @@
  * @run main/othervm -XX:+UnlockDiagnosticVMOptions -XX:+WhiteBoxAPI -Xbootclasspath/a:.
  *    -Xbatch compiler.calls.common.InvokeStatic
  *    -compileCaller 4 -checkCallerCompileLevel 4 -compileCallee 4 -checkCalleeCompileLevel 4
- * @summary check calls from compiled to compiled using InvokeStatic
  */
diff --git a/hotspot/test/compiler/calls/fromCompiled/CompiledInvokeStatic2InterpretedTest.java b/hotspot/test/compiler/calls/fromCompiled/CompiledInvokeStatic2InterpretedTest.java
index 1d998e0..7ca6263 100644
--- a/hotspot/test/compiler/calls/fromCompiled/CompiledInvokeStatic2InterpretedTest.java
+++ b/hotspot/test/compiler/calls/fromCompiled/CompiledInvokeStatic2InterpretedTest.java
@@ -23,8 +23,10 @@
 
 /*
  * @test
+ * @summary check calls from compiled to interpreted using InvokeStatic
  * @modules java.base/jdk.internal.misc
  * @library /test/lib /testlibrary /
+ *
  * @build compiler.calls.common.InvokeStatic
  * @run driver ClassFileInstaller sun.hotspot.WhiteBox
  *    sun.hotspot.WhiteBox$WhiteBoxPermission
@@ -34,5 +36,4 @@
  * @run main/othervm -XX:+UnlockDiagnosticVMOptions -XX:+WhiteBoxAPI -Xbootclasspath/a:.
  *    -Xbatch -XX:CompileCommand=exclude,compiler.calls.common.InvokeStatic::callee compiler.calls.common.InvokeStatic
  *    -compileCaller 4 -checkCallerCompileLevel 4 -checkCalleeCompileLevel 0
- * @summary check calls from compiled to interpreted using InvokeStatic
  */
diff --git a/hotspot/test/compiler/calls/fromCompiled/CompiledInvokeStatic2NativeTest.java b/hotspot/test/compiler/calls/fromCompiled/CompiledInvokeStatic2NativeTest.java
index a0c8009..560c807 100644
--- a/hotspot/test/compiler/calls/fromCompiled/CompiledInvokeStatic2NativeTest.java
+++ b/hotspot/test/compiler/calls/fromCompiled/CompiledInvokeStatic2NativeTest.java
@@ -23,8 +23,10 @@
 
 /*
  * @test
+ * @summary check calls from compiled to native using InvokeStatic
  * @modules java.base/jdk.internal.misc
  * @library /test/lib /testlibrary /
+ *
  * @build compiler.calls.common.InvokeStatic
  * @run driver ClassFileInstaller sun.hotspot.WhiteBox
  *    sun.hotspot.WhiteBox$WhiteBoxPermission
@@ -34,5 +36,4 @@
  * @run main/othervm -XX:+UnlockDiagnosticVMOptions -XX:+WhiteBoxAPI -Xbootclasspath/a:.
  *    -Xbatch  compiler.calls.common.InvokeStatic
  *    -compileCaller 4 -checkCallerCompileLevel 4 -nativeCallee
- * @summary check calls from compiled to native using InvokeStatic
  */
diff --git a/hotspot/test/compiler/calls/fromCompiled/CompiledInvokeVirtual2CompiledTest.java b/hotspot/test/compiler/calls/fromCompiled/CompiledInvokeVirtual2CompiledTest.java
index 6ac0e2b..ef408fd 100644
--- a/hotspot/test/compiler/calls/fromCompiled/CompiledInvokeVirtual2CompiledTest.java
+++ b/hotspot/test/compiler/calls/fromCompiled/CompiledInvokeVirtual2CompiledTest.java
@@ -23,8 +23,10 @@
 
 /*
  * @test
+ * @summary check calls from compiled to compiled using InvokeVirtual
  * @modules java.base/jdk.internal.misc
  * @library /test/lib /testlibrary /
+ *
  * @build compiler.calls.common.InvokeVirtual
  * @run driver ClassFileInstaller sun.hotspot.WhiteBox
  *    sun.hotspot.WhiteBox$WhiteBoxPermission
@@ -40,5 +42,4 @@
  * @run main/othervm -XX:+UnlockDiagnosticVMOptions -XX:+WhiteBoxAPI -Xbootclasspath/a:.
  *    -Xbatch compiler.calls.common.InvokeVirtual
  *    -compileCaller 4 -checkCallerCompileLevel 4 -compileCallee 4 -checkCalleeCompileLevel 4
- * @summary check calls from compiled to compiled using InvokeVirtual
  */
diff --git a/hotspot/test/compiler/calls/fromCompiled/CompiledInvokeVirtual2InterpretedTest.java b/hotspot/test/compiler/calls/fromCompiled/CompiledInvokeVirtual2InterpretedTest.java
index 9f03a2c..718aef2 100644
--- a/hotspot/test/compiler/calls/fromCompiled/CompiledInvokeVirtual2InterpretedTest.java
+++ b/hotspot/test/compiler/calls/fromCompiled/CompiledInvokeVirtual2InterpretedTest.java
@@ -23,8 +23,10 @@
 
 /*
  * @test
+ * @summary check calls from compiled to interpreted using InvokeVirtual
  * @modules java.base/jdk.internal.misc
  * @library /test/lib /testlibrary /
+ *
  * @build compiler.calls.common.InvokeVirtual
  * @run driver ClassFileInstaller sun.hotspot.WhiteBox
  *    sun.hotspot.WhiteBox$WhiteBoxPermission
@@ -34,5 +36,4 @@
  * @run main/othervm -XX:+UnlockDiagnosticVMOptions -XX:+WhiteBoxAPI -Xbootclasspath/a:.
  *    -Xbatch -XX:CompileCommand=exclude,compiler.calls.common.InvokeVirtual::callee compiler.calls.common.InvokeVirtual
  *    -compileCaller 4 -checkCallerCompileLevel 4 -checkCalleeCompileLevel 0
- * @summary check calls from compiled to interpreted using InvokeVirtual
  */
diff --git a/hotspot/test/compiler/calls/fromCompiled/CompiledInvokeVirtual2NativeTest.java b/hotspot/test/compiler/calls/fromCompiled/CompiledInvokeVirtual2NativeTest.java
index 93643d6..e161834 100644
--- a/hotspot/test/compiler/calls/fromCompiled/CompiledInvokeVirtual2NativeTest.java
+++ b/hotspot/test/compiler/calls/fromCompiled/CompiledInvokeVirtual2NativeTest.java
@@ -23,8 +23,10 @@
 
 /*
  * @test
+ * @summary check calls from compiled to native using InvokeVirtual
  * @modules java.base/jdk.internal.misc
  * @library /test/lib /testlibrary /
+ *
  * @build compiler.calls.common.InvokeVirtual
  * @run driver ClassFileInstaller sun.hotspot.WhiteBox
  *    sun.hotspot.WhiteBox$WhiteBoxPermission
@@ -34,5 +36,4 @@
  * @run main/othervm -XX:+UnlockDiagnosticVMOptions -XX:+WhiteBoxAPI -Xbootclasspath/a:.
  *    -Xbatch  compiler.calls.common.InvokeVirtual
  *    -compileCaller 4 -checkCallerCompileLevel 4 -nativeCallee
- * @summary check calls from compiled to native using InvokeVirtual
  */
diff --git a/hotspot/test/compiler/calls/fromInterpreted/InterpretedInvokeDynamic2CompiledTest.java b/hotspot/test/compiler/calls/fromInterpreted/InterpretedInvokeDynamic2CompiledTest.java
index 17d1512..f83beb4 100644
--- a/hotspot/test/compiler/calls/fromInterpreted/InterpretedInvokeDynamic2CompiledTest.java
+++ b/hotspot/test/compiler/calls/fromInterpreted/InterpretedInvokeDynamic2CompiledTest.java
@@ -23,11 +23,13 @@
 
 /*
  * @test
+ * @summary check calls from interpreted to compiled using InvokeDynamic
  * @library /test/lib /testlibrary /
  * @modules java.base/jdk.internal.misc
- * @modules java.base/jdk.internal.org.objectweb.asm
+ *          java.base/jdk.internal.org.objectweb.asm
+ *
  * @build compiler.calls.common.InvokeDynamic
- * @build compiler.calls.common.InvokeDynamicPatcher
+ *        compiler.calls.common.InvokeDynamicPatcher
  * @run main compiler.calls.common.InvokeDynamicPatcher
  * @run driver ClassFileInstaller sun.hotspot.WhiteBox
  *    sun.hotspot.WhiteBox$WhiteBoxPermission
@@ -37,5 +39,4 @@
  * @run main/othervm -XX:+UnlockDiagnosticVMOptions -XX:+WhiteBoxAPI -Xbootclasspath/a:.
  *    -XX:CompileCommand=exclude,compiler.calls.common.InvokeDynamic::caller -Xbatch compiler.calls.common.InvokeDynamic
  *    -checkCallerCompileLevel 0 -compileCallee 4 -checkCalleeCompileLevel 4
- * @summary check calls from interpreted to compiled using InvokeDynamic
  */
diff --git a/hotspot/test/compiler/calls/fromInterpreted/InterpretedInvokeDynamic2InterpretedTest.java b/hotspot/test/compiler/calls/fromInterpreted/InterpretedInvokeDynamic2InterpretedTest.java
index 5988ac6..e4ff099 100644
--- a/hotspot/test/compiler/calls/fromInterpreted/InterpretedInvokeDynamic2InterpretedTest.java
+++ b/hotspot/test/compiler/calls/fromInterpreted/InterpretedInvokeDynamic2InterpretedTest.java
@@ -23,16 +23,17 @@
 
 /*
  * @test
+ * @summary check calls from interpreted to interpreted using InvokeDynamic
  * @library /test/lib /testlibrary /
  * @modules java.base/jdk.internal.misc
- * @modules java.base/jdk.internal.org.objectweb.asm
+ *          java.base/jdk.internal.org.objectweb.asm
+ *
  * @build compiler.calls.common.InvokeDynamic
- * @build compiler.calls.common.InvokeDynamicPatcher
+ *        compiler.calls.common.InvokeDynamicPatcher
  * @run main compiler.calls.common.InvokeDynamicPatcher
  * @run driver ClassFileInstaller sun.hotspot.WhiteBox
  *    sun.hotspot.WhiteBox$WhiteBoxPermission
  * @run main/othervm -XX:+UnlockDiagnosticVMOptions -XX:+WhiteBoxAPI -Xbootclasspath/a:.
  *    -XX:CompileCommand=exclude,compiler.calls.common.InvokeDynamic::caller -XX:CompileCommand=exclude,compiler.calls.common.InvokeDynamic::callee compiler.calls.common.InvokeDynamic
  *    -checkCallerCompileLevel 0 -checkCalleeCompileLevel 0
- * @summary check calls from interpreted to interpreted using InvokeDynamic
  */
diff --git a/hotspot/test/compiler/calls/fromInterpreted/InterpretedInvokeDynamic2NativeTest.java b/hotspot/test/compiler/calls/fromInterpreted/InterpretedInvokeDynamic2NativeTest.java
index 7f0015a..3785058 100644
--- a/hotspot/test/compiler/calls/fromInterpreted/InterpretedInvokeDynamic2NativeTest.java
+++ b/hotspot/test/compiler/calls/fromInterpreted/InterpretedInvokeDynamic2NativeTest.java
@@ -23,16 +23,17 @@
 
 /*
  * @test
+ * @summary check calls from interpreted to native using InvokeDynamic
  * @library /test/lib /testlibrary /
  * @modules java.base/jdk.internal.misc
- * @modules java.base/jdk.internal.org.objectweb.asm
+ *          java.base/jdk.internal.org.objectweb.asm
+ *
  * @build compiler.calls.common.InvokeDynamic
- * @build compiler.calls.common.InvokeDynamicPatcher
+ *        compiler.calls.common.InvokeDynamicPatcher
  * @run main compiler.calls.common.InvokeDynamicPatcher
  * @run driver ClassFileInstaller sun.hotspot.WhiteBox
  *    sun.hotspot.WhiteBox$WhiteBoxPermission
  * @run main/othervm -XX:+UnlockDiagnosticVMOptions -XX:+WhiteBoxAPI -Xbootclasspath/a:.
  *    -XX:CompileCommand=exclude,compiler.calls.common.InvokeDynamic::caller  compiler.calls.common.InvokeDynamic
  *    -checkCallerCompileLevel 0 -nativeCallee
- * @summary check calls from interpreted to native using InvokeDynamic
  */
diff --git a/hotspot/test/compiler/calls/fromInterpreted/InterpretedInvokeInterface2CompiledTest.java b/hotspot/test/compiler/calls/fromInterpreted/InterpretedInvokeInterface2CompiledTest.java
index ea458db..83024bb 100644
--- a/hotspot/test/compiler/calls/fromInterpreted/InterpretedInvokeInterface2CompiledTest.java
+++ b/hotspot/test/compiler/calls/fromInterpreted/InterpretedInvokeInterface2CompiledTest.java
@@ -23,8 +23,10 @@
 
 /*
  * @test
+ * @summary check calls from interpreted to compiled using InvokeInterface
  * @modules java.base/jdk.internal.misc
  * @library /test/lib /testlibrary /
+ *
  * @build compiler.calls.common.InvokeInterface
  * @run driver ClassFileInstaller sun.hotspot.WhiteBox
  *    sun.hotspot.WhiteBox$WhiteBoxPermission
@@ -34,5 +36,4 @@
  * @run main/othervm -XX:+UnlockDiagnosticVMOptions -XX:+WhiteBoxAPI -Xbootclasspath/a:.
  *    -XX:CompileCommand=exclude,compiler.calls.common.InvokeInterface::caller -Xbatch compiler.calls.common.InvokeInterface
  *    -checkCallerCompileLevel 0 -compileCallee 4 -checkCalleeCompileLevel 4
- * @summary check calls from interpreted to compiled using InvokeInterface
  */
diff --git a/hotspot/test/compiler/calls/fromInterpreted/InterpretedInvokeInterface2InterpretedTest.java b/hotspot/test/compiler/calls/fromInterpreted/InterpretedInvokeInterface2InterpretedTest.java
index ed150e4..2a81110 100644
--- a/hotspot/test/compiler/calls/fromInterpreted/InterpretedInvokeInterface2InterpretedTest.java
+++ b/hotspot/test/compiler/calls/fromInterpreted/InterpretedInvokeInterface2InterpretedTest.java
@@ -23,13 +23,14 @@
 
 /*
  * @test
+ * @summary check calls from interpreted to interpreted using InvokeInterface
  * @modules java.base/jdk.internal.misc
  * @library /test/lib /testlibrary /
+ *
  * @build compiler.calls.common.InvokeInterface
  * @run driver ClassFileInstaller sun.hotspot.WhiteBox
  *    sun.hotspot.WhiteBox$WhiteBoxPermission
  * @run main/othervm -XX:+UnlockDiagnosticVMOptions -XX:+WhiteBoxAPI -Xbootclasspath/a:.
  *    -XX:CompileCommand=exclude,compiler.calls.common.InvokeInterface::caller -XX:CompileCommand=exclude,compiler.calls.common.InvokeInterface::callee compiler.calls.common.InvokeInterface
  *    -checkCallerCompileLevel 0 -checkCalleeCompileLevel 0
- * @summary check calls from interpreted to interpreted using InvokeInterface
  */
diff --git a/hotspot/test/compiler/calls/fromInterpreted/InterpretedInvokeInterface2NativeTest.java b/hotspot/test/compiler/calls/fromInterpreted/InterpretedInvokeInterface2NativeTest.java
index 8adc7a6..72c9275 100644
--- a/hotspot/test/compiler/calls/fromInterpreted/InterpretedInvokeInterface2NativeTest.java
+++ b/hotspot/test/compiler/calls/fromInterpreted/InterpretedInvokeInterface2NativeTest.java
@@ -23,13 +23,14 @@
 
 /*
  * @test
+ * @summary check calls from interpreted to native using InvokeInterface
  * @modules java.base/jdk.internal.misc
  * @library /test/lib /testlibrary /
+ *
  * @build compiler.calls.common.InvokeInterface
  * @run driver ClassFileInstaller sun.hotspot.WhiteBox
  *    sun.hotspot.WhiteBox$WhiteBoxPermission
  * @run main/othervm -XX:+UnlockDiagnosticVMOptions -XX:+WhiteBoxAPI -Xbootclasspath/a:.
  *    -XX:CompileCommand=exclude,compiler.calls.common.InvokeInterface::caller  compiler.calls.common.InvokeInterface
  *    -checkCallerCompileLevel 0 -nativeCallee
- * @summary check calls from interpreted to native using InvokeInterface
  */
diff --git a/hotspot/test/compiler/calls/fromInterpreted/InterpretedInvokeSpecial2InterpretedTest.java b/hotspot/test/compiler/calls/fromInterpreted/InterpretedInvokeSpecial2InterpretedTest.java
index 324ad86..a6a3ae4 100644
--- a/hotspot/test/compiler/calls/fromInterpreted/InterpretedInvokeSpecial2InterpretedTest.java
+++ b/hotspot/test/compiler/calls/fromInterpreted/InterpretedInvokeSpecial2InterpretedTest.java
@@ -23,13 +23,14 @@
 
 /*
  * @test
+ * @summary check calls from interpreted to interpreted using InvokeSpecial
  * @modules java.base/jdk.internal.misc
  * @library /test/lib /testlibrary /
+ *
  * @build compiler.calls.common.InvokeSpecial
  * @run driver ClassFileInstaller sun.hotspot.WhiteBox
  *    sun.hotspot.WhiteBox$WhiteBoxPermission
  * @run main/othervm -XX:+UnlockDiagnosticVMOptions -XX:+WhiteBoxAPI -Xbootclasspath/a:.
  *    -XX:CompileCommand=exclude,compiler.calls.common.InvokeSpecial::caller -XX:CompileCommand=exclude,compiler.calls.common.InvokeSpecial::callee compiler.calls.common.InvokeSpecial
  *    -checkCallerCompileLevel 0 -checkCalleeCompileLevel 0
- * @summary check calls from interpreted to interpreted using InvokeSpecial
  */
diff --git a/hotspot/test/compiler/calls/fromInterpreted/InterpretedInvokeSpecial2NativeTest.java b/hotspot/test/compiler/calls/fromInterpreted/InterpretedInvokeSpecial2NativeTest.java
index e34cca0..f52dd62 100644
--- a/hotspot/test/compiler/calls/fromInterpreted/InterpretedInvokeSpecial2NativeTest.java
+++ b/hotspot/test/compiler/calls/fromInterpreted/InterpretedInvokeSpecial2NativeTest.java
@@ -23,13 +23,14 @@
 
 /*
  * @test
+ * @summary check calls from interpreted to native using InvokeSpecial
  * @modules java.base/jdk.internal.misc
  * @library /test/lib /testlibrary /
+ *
  * @build compiler.calls.common.InvokeSpecial
  * @run driver ClassFileInstaller sun.hotspot.WhiteBox
  *    sun.hotspot.WhiteBox$WhiteBoxPermission
  * @run main/othervm -XX:+UnlockDiagnosticVMOptions -XX:+WhiteBoxAPI -Xbootclasspath/a:.
  *    -XX:CompileCommand=exclude,compiler.calls.common.InvokeSpecial::caller  compiler.calls.common.InvokeSpecial
  *    -checkCallerCompileLevel 0 -nativeCallee
- * @summary check calls from interpreted to native using InvokeSpecial
  */
diff --git a/hotspot/test/compiler/calls/fromInterpreted/InterpretedInvokeStatic2CompiledTest.java b/hotspot/test/compiler/calls/fromInterpreted/InterpretedInvokeStatic2CompiledTest.java
index 96501a1..1db1014 100644
--- a/hotspot/test/compiler/calls/fromInterpreted/InterpretedInvokeStatic2CompiledTest.java
+++ b/hotspot/test/compiler/calls/fromInterpreted/InterpretedInvokeStatic2CompiledTest.java
@@ -23,8 +23,10 @@
 
 /*
  * @test
+ * @summary check calls from interpreted to compiled using InvokeStatic
  * @modules java.base/jdk.internal.misc
  * @library /test/lib /testlibrary /
+ *
  * @build compiler.calls.common.InvokeStatic
  * @run driver ClassFileInstaller sun.hotspot.WhiteBox
  *    sun.hotspot.WhiteBox$WhiteBoxPermission
@@ -34,5 +36,4 @@
  * @run main/othervm -XX:+UnlockDiagnosticVMOptions -XX:+WhiteBoxAPI -Xbootclasspath/a:.
  *    -XX:CompileCommand=exclude,compiler.calls.common.InvokeStatic::caller -Xbatch compiler.calls.common.InvokeStatic
  *    -checkCallerCompileLevel 0 -compileCallee 4 -checkCalleeCompileLevel 4
- * @summary check calls from interpreted to compiled using InvokeStatic
  */
diff --git a/hotspot/test/compiler/calls/fromInterpreted/InterpretedInvokeStatic2InterpretedTest.java b/hotspot/test/compiler/calls/fromInterpreted/InterpretedInvokeStatic2InterpretedTest.java
index 8efd93d..7e39254 100644
--- a/hotspot/test/compiler/calls/fromInterpreted/InterpretedInvokeStatic2InterpretedTest.java
+++ b/hotspot/test/compiler/calls/fromInterpreted/InterpretedInvokeStatic2InterpretedTest.java
@@ -23,13 +23,14 @@
 
 /*
  * @test
+ * @summary check calls from interpreted to interpreted using InvokeStatic
  * @modules java.base/jdk.internal.misc
  * @library /test/lib /testlibrary /
+ *
  * @build compiler.calls.common.InvokeStatic
  * @run driver ClassFileInstaller sun.hotspot.WhiteBox
  *    sun.hotspot.WhiteBox$WhiteBoxPermission
  * @run main/othervm -XX:+UnlockDiagnosticVMOptions -XX:+WhiteBoxAPI -Xbootclasspath/a:.
  *    -XX:CompileCommand=exclude,compiler.calls.common.InvokeStatic::caller -XX:CompileCommand=exclude,compiler.calls.common.InvokeStatic::callee compiler.calls.common.InvokeStatic
  *    -checkCallerCompileLevel 0 -checkCalleeCompileLevel 0
- * @summary check calls from interpreted to interpreted using InvokeStatic
  */
diff --git a/hotspot/test/compiler/calls/fromInterpreted/InterpretedInvokeStatic2NativeTest.java b/hotspot/test/compiler/calls/fromInterpreted/InterpretedInvokeStatic2NativeTest.java
index 0bcbb37..789fe9c 100644
--- a/hotspot/test/compiler/calls/fromInterpreted/InterpretedInvokeStatic2NativeTest.java
+++ b/hotspot/test/compiler/calls/fromInterpreted/InterpretedInvokeStatic2NativeTest.java
@@ -23,13 +23,14 @@
 
 /*
  * @test
+ * @summary check calls from interpreted to native using InvokeStatic
  * @modules java.base/jdk.internal.misc
  * @library /test/lib /testlibrary /
+ *
  * @build compiler.calls.common.InvokeStatic
  * @run driver ClassFileInstaller sun.hotspot.WhiteBox
  *    sun.hotspot.WhiteBox$WhiteBoxPermission
  * @run main/othervm -XX:+UnlockDiagnosticVMOptions -XX:+WhiteBoxAPI -Xbootclasspath/a:.
  *    -XX:CompileCommand=exclude,compiler.calls.common.InvokeStatic::caller  compiler.calls.common.InvokeStatic
  *    -checkCallerCompileLevel 0 -nativeCallee
- * @summary check calls from interpreted to native using InvokeStatic
  */
diff --git a/hotspot/test/compiler/calls/fromInterpreted/InterpretedInvokeVirtual2CompiledTest.java b/hotspot/test/compiler/calls/fromInterpreted/InterpretedInvokeVirtual2CompiledTest.java
index eefe4e6..41e89d3 100644
--- a/hotspot/test/compiler/calls/fromInterpreted/InterpretedInvokeVirtual2CompiledTest.java
+++ b/hotspot/test/compiler/calls/fromInterpreted/InterpretedInvokeVirtual2CompiledTest.java
@@ -23,8 +23,10 @@
 
 /*
  * @test
+ * @summary check calls from interpreted to compiled using InvokeVirtual
  * @modules java.base/jdk.internal.misc
  * @library /test/lib /testlibrary /
+ *
  * @build compiler.calls.common.InvokeVirtual
  * @run driver ClassFileInstaller sun.hotspot.WhiteBox
  *    sun.hotspot.WhiteBox$WhiteBoxPermission
@@ -34,5 +36,4 @@
  * @run main/othervm -XX:+UnlockDiagnosticVMOptions -XX:+WhiteBoxAPI -Xbootclasspath/a:.
  *    -XX:CompileCommand=exclude,compiler.calls.common.InvokeVirtual::caller -Xbatch compiler.calls.common.InvokeVirtual
  *    -checkCallerCompileLevel 0 -compileCallee 4 -checkCalleeCompileLevel 4
- * @summary check calls from interpreted to compiled using InvokeVirtual
  */
diff --git a/hotspot/test/compiler/calls/fromInterpreted/InterpretedInvokeVirtual2InterpretedTest.java b/hotspot/test/compiler/calls/fromInterpreted/InterpretedInvokeVirtual2InterpretedTest.java
index d44e140..f299f4a 100644
--- a/hotspot/test/compiler/calls/fromInterpreted/InterpretedInvokeVirtual2InterpretedTest.java
+++ b/hotspot/test/compiler/calls/fromInterpreted/InterpretedInvokeVirtual2InterpretedTest.java
@@ -23,13 +23,14 @@
 
 /*
  * @test
+ * @summary check calls from interpreted to interpreted using InvokeVirtual
  * @modules java.base/jdk.internal.misc
  * @library /test/lib /testlibrary /
+ *
  * @build compiler.calls.common.InvokeVirtual
  * @run driver ClassFileInstaller sun.hotspot.WhiteBox
  *    sun.hotspot.WhiteBox$WhiteBoxPermission
  * @run main/othervm -XX:+UnlockDiagnosticVMOptions -XX:+WhiteBoxAPI -Xbootclasspath/a:.
  *    -XX:CompileCommand=exclude,compiler.calls.common.InvokeVirtual::caller -XX:CompileCommand=exclude,compiler.calls.common.InvokeVirtual::callee compiler.calls.common.InvokeVirtual
  *    -checkCallerCompileLevel 0 -checkCalleeCompileLevel 0
- * @summary check calls from interpreted to interpreted using InvokeVirtual
  */
diff --git a/hotspot/test/compiler/calls/fromInterpreted/InterpretedInvokeVirtual2NativeTest.java b/hotspot/test/compiler/calls/fromInterpreted/InterpretedInvokeVirtual2NativeTest.java
index 2011993..5a99727 100644
--- a/hotspot/test/compiler/calls/fromInterpreted/InterpretedInvokeVirtual2NativeTest.java
+++ b/hotspot/test/compiler/calls/fromInterpreted/InterpretedInvokeVirtual2NativeTest.java
@@ -23,13 +23,14 @@
 
 /*
  * @test
+ * @summary check calls from interpreted to native using InvokeVirtual
  * @modules java.base/jdk.internal.misc
  * @library /test/lib /testlibrary /
+ *
  * @build compiler.calls.common.InvokeVirtual
  * @run driver ClassFileInstaller sun.hotspot.WhiteBox
  *    sun.hotspot.WhiteBox$WhiteBoxPermission
  * @run main/othervm -XX:+UnlockDiagnosticVMOptions -XX:+WhiteBoxAPI -Xbootclasspath/a:.
  *    -XX:CompileCommand=exclude,compiler.calls.common.InvokeVirtual::caller  compiler.calls.common.InvokeVirtual
  *    -checkCallerCompileLevel 0 -nativeCallee
- * @summary check calls from interpreted to native using InvokeVirtual
  */
diff --git a/hotspot/test/compiler/calls/fromNative/NativeInvokeSpecial2CompiledTest.java b/hotspot/test/compiler/calls/fromNative/NativeInvokeSpecial2CompiledTest.java
index 86a0784..b25f7a1 100644
--- a/hotspot/test/compiler/calls/fromNative/NativeInvokeSpecial2CompiledTest.java
+++ b/hotspot/test/compiler/calls/fromNative/NativeInvokeSpecial2CompiledTest.java
@@ -23,8 +23,10 @@
 
 /*
  * @test
+ * @summary check calls from native to compiled using InvokeSpecial
  * @modules java.base/jdk.internal.misc
  * @library /test/lib /testlibrary /
+ *
  * @build compiler.calls.common.InvokeSpecial
  * @run driver ClassFileInstaller sun.hotspot.WhiteBox
  *    sun.hotspot.WhiteBox$WhiteBoxPermission
@@ -34,5 +36,4 @@
  * @run main/othervm -XX:+UnlockDiagnosticVMOptions -XX:+WhiteBoxAPI -Xbootclasspath/a:.
  *    -Xbatch compiler.calls.common.InvokeSpecial
  *    -nativeCaller -compileCallee 4 -checkCalleeCompileLevel 4
- * @summary check calls from native to compiled using InvokeSpecial
  */
diff --git a/hotspot/test/compiler/calls/fromNative/NativeInvokeSpecial2InterpretedTest.java b/hotspot/test/compiler/calls/fromNative/NativeInvokeSpecial2InterpretedTest.java
index 83520ce..f7c66cf 100644
--- a/hotspot/test/compiler/calls/fromNative/NativeInvokeSpecial2InterpretedTest.java
+++ b/hotspot/test/compiler/calls/fromNative/NativeInvokeSpecial2InterpretedTest.java
@@ -23,13 +23,14 @@
 
 /*
  * @test
+ * @summary check calls from native to interpreted using InvokeSpecial
  * @modules java.base/jdk.internal.misc
  * @library /test/lib /testlibrary /
+ *
  * @build compiler.calls.common.InvokeSpecial
  * @run driver ClassFileInstaller sun.hotspot.WhiteBox
  *    sun.hotspot.WhiteBox$WhiteBoxPermission
  * @run main/othervm -XX:+UnlockDiagnosticVMOptions -XX:+WhiteBoxAPI -Xbootclasspath/a:.
  *    -XX:CompileCommand=exclude,compiler.calls.common.InvokeSpecial::callee compiler.calls.common.InvokeSpecial
  *    -nativeCaller -checkCalleeCompileLevel 0
- * @summary check calls from native to interpreted using InvokeSpecial
  */
diff --git a/hotspot/test/compiler/calls/fromNative/NativeInvokeSpecial2NativeTest.java b/hotspot/test/compiler/calls/fromNative/NativeInvokeSpecial2NativeTest.java
index f9b3ce5..041af4f 100644
--- a/hotspot/test/compiler/calls/fromNative/NativeInvokeSpecial2NativeTest.java
+++ b/hotspot/test/compiler/calls/fromNative/NativeInvokeSpecial2NativeTest.java
@@ -23,13 +23,14 @@
 
 /*
  * @test
+ * @summary check calls from native to native using InvokeSpecial
  * @modules java.base/jdk.internal.misc
  * @library /test/lib /testlibrary /
+ *
  * @build compiler.calls.common.InvokeSpecial
  * @run driver ClassFileInstaller sun.hotspot.WhiteBox
  *    sun.hotspot.WhiteBox$WhiteBoxPermission
  * @run main/othervm -XX:+UnlockDiagnosticVMOptions -XX:+WhiteBoxAPI -Xbootclasspath/a:.
  *    compiler.calls.common.InvokeSpecial
  *    -nativeCaller -nativeCallee
- * @summary check calls from native to native using InvokeSpecial
  */
diff --git a/hotspot/test/compiler/calls/fromNative/NativeInvokeStatic2CompiledTest.java b/hotspot/test/compiler/calls/fromNative/NativeInvokeStatic2CompiledTest.java
index 7133571..f7e8f52 100644
--- a/hotspot/test/compiler/calls/fromNative/NativeInvokeStatic2CompiledTest.java
+++ b/hotspot/test/compiler/calls/fromNative/NativeInvokeStatic2CompiledTest.java
@@ -23,8 +23,10 @@
 
 /*
  * @test
+ * @summary check calls from native to compiled using InvokeStatic
  * @modules java.base/jdk.internal.misc
  * @library /test/lib /testlibrary /
+ *
  * @build compiler.calls.common.InvokeStatic
  * @run driver ClassFileInstaller sun.hotspot.WhiteBox
  *    sun.hotspot.WhiteBox$WhiteBoxPermission
@@ -34,5 +36,4 @@
  * @run main/othervm -XX:+UnlockDiagnosticVMOptions -XX:+WhiteBoxAPI -Xbootclasspath/a:.
  *    -Xbatch compiler.calls.common.InvokeStatic
  *    -nativeCaller -compileCallee 4 -checkCalleeCompileLevel 4
- * @summary check calls from native to compiled using InvokeStatic
  */
diff --git a/hotspot/test/compiler/calls/fromNative/NativeInvokeStatic2InterpretedTest.java b/hotspot/test/compiler/calls/fromNative/NativeInvokeStatic2InterpretedTest.java
index 541b364..ab0e447 100644
--- a/hotspot/test/compiler/calls/fromNative/NativeInvokeStatic2InterpretedTest.java
+++ b/hotspot/test/compiler/calls/fromNative/NativeInvokeStatic2InterpretedTest.java
@@ -23,13 +23,14 @@
 
 /*
  * @test
+ * @summary check calls from native to interpreted using InvokeStatic
  * @modules java.base/jdk.internal.misc
  * @library /test/lib /testlibrary /
+ *
  * @build compiler.calls.common.InvokeStatic
  * @run driver ClassFileInstaller sun.hotspot.WhiteBox
  *    sun.hotspot.WhiteBox$WhiteBoxPermission
  * @run main/othervm -XX:+UnlockDiagnosticVMOptions -XX:+WhiteBoxAPI -Xbootclasspath/a:.
  *    -XX:CompileCommand=exclude,compiler.calls.common.InvokeStatic::callee compiler.calls.common.InvokeStatic
  *    -nativeCaller -checkCalleeCompileLevel 0
- * @summary check calls from native to interpreted using InvokeStatic
  */
diff --git a/hotspot/test/compiler/calls/fromNative/NativeInvokeStatic2NativeTest.java b/hotspot/test/compiler/calls/fromNative/NativeInvokeStatic2NativeTest.java
index 34ad481..de0b8c1 100644
--- a/hotspot/test/compiler/calls/fromNative/NativeInvokeStatic2NativeTest.java
+++ b/hotspot/test/compiler/calls/fromNative/NativeInvokeStatic2NativeTest.java
@@ -23,13 +23,14 @@
 
 /*
  * @test
+ * @summary check calls from native to native using InvokeStatic
  * @modules java.base/jdk.internal.misc
  * @library /test/lib /testlibrary /
+ *
  * @build compiler.calls.common.InvokeStatic
  * @run driver ClassFileInstaller sun.hotspot.WhiteBox
  *    sun.hotspot.WhiteBox$WhiteBoxPermission
  * @run main/othervm -XX:+UnlockDiagnosticVMOptions -XX:+WhiteBoxAPI -Xbootclasspath/a:.
  *    compiler.calls.common.InvokeStatic
  *    -nativeCaller -nativeCallee
- * @summary check calls from native to native using InvokeStatic
  */
diff --git a/hotspot/test/compiler/calls/fromNative/NativeInvokeVirtual2CompiledTest.java b/hotspot/test/compiler/calls/fromNative/NativeInvokeVirtual2CompiledTest.java
index 4f86421..4361a8d 100644
--- a/hotspot/test/compiler/calls/fromNative/NativeInvokeVirtual2CompiledTest.java
+++ b/hotspot/test/compiler/calls/fromNative/NativeInvokeVirtual2CompiledTest.java
@@ -23,8 +23,10 @@
 
 /*
  * @test
+ * @summary check calls from native to compiled using InvokeVirtual
  * @modules java.base/jdk.internal.misc
  * @library /test/lib /testlibrary /
+ *
  * @build compiler.calls.common.InvokeVirtual
  * @run driver ClassFileInstaller sun.hotspot.WhiteBox
  *    sun.hotspot.WhiteBox$WhiteBoxPermission
@@ -34,5 +36,4 @@
  * @run main/othervm -XX:+UnlockDiagnosticVMOptions -XX:+WhiteBoxAPI -Xbootclasspath/a:.
  *    -Xbatch compiler.calls.common.InvokeVirtual
  *    -nativeCaller -compileCallee 4 -checkCalleeCompileLevel 4
- * @summary check calls from native to compiled using InvokeVirtual
  */
diff --git a/hotspot/test/compiler/calls/fromNative/NativeInvokeVirtual2InterpretedTest.java b/hotspot/test/compiler/calls/fromNative/NativeInvokeVirtual2InterpretedTest.java
index c0d3b77..fde2465 100644
--- a/hotspot/test/compiler/calls/fromNative/NativeInvokeVirtual2InterpretedTest.java
+++ b/hotspot/test/compiler/calls/fromNative/NativeInvokeVirtual2InterpretedTest.java
@@ -23,13 +23,14 @@
 
 /*
  * @test
+ * @summary check calls from native to interpreted using InvokeVirtual
  * @modules java.base/jdk.internal.misc
  * @library /test/lib /testlibrary /
  * @build compiler.calls.common.InvokeVirtual
+ *
  * @run driver ClassFileInstaller sun.hotspot.WhiteBox
  *    sun.hotspot.WhiteBox$WhiteBoxPermission
  * @run main/othervm -XX:+UnlockDiagnosticVMOptions -XX:+WhiteBoxAPI -Xbootclasspath/a:.
  *    -XX:CompileCommand=exclude,compiler.calls.common.InvokeVirtual::callee compiler.calls.common.InvokeVirtual
  *    -nativeCaller -checkCalleeCompileLevel 0
- * @summary check calls from native to interpreted using InvokeVirtual
  */
diff --git a/hotspot/test/compiler/calls/fromNative/NativeInvokeVirtual2NativeTest.java b/hotspot/test/compiler/calls/fromNative/NativeInvokeVirtual2NativeTest.java
index b83b9330..a075107 100644
--- a/hotspot/test/compiler/calls/fromNative/NativeInvokeVirtual2NativeTest.java
+++ b/hotspot/test/compiler/calls/fromNative/NativeInvokeVirtual2NativeTest.java
@@ -23,13 +23,14 @@
 
 /*
  * @test
+ * @summary check calls from native to native using InvokeVirtual
  * @modules java.base/jdk.internal.misc
  * @library /test/lib /testlibrary /
+ *
  * @build compiler.calls.common.InvokeVirtual
  * @run driver ClassFileInstaller sun.hotspot.WhiteBox
  *    sun.hotspot.WhiteBox$WhiteBoxPermission
  * @run main/othervm -XX:+UnlockDiagnosticVMOptions -XX:+WhiteBoxAPI -Xbootclasspath/a:.
  *    compiler.calls.common.InvokeVirtual
  *    -nativeCaller -nativeCallee
- * @summary check calls from native to native using InvokeVirtual
  */
diff --git a/hotspot/test/compiler/native/libTestDirtyInt.c b/hotspot/test/compiler/calls/libTestDirtyInt.c
similarity index 92%
rename from hotspot/test/compiler/native/libTestDirtyInt.c
rename to hotspot/test/compiler/calls/libTestDirtyInt.c
index b688a36..229df0f 100644
--- a/hotspot/test/compiler/native/libTestDirtyInt.c
+++ b/hotspot/test/compiler/calls/libTestDirtyInt.c
@@ -26,7 +26,7 @@
 
 static int array = 0x42;
 
-JNIEXPORT jint JNICALL Java_TestDirtyInt_test(JNIEnv* env, jclass jclazz, jint v)
+JNIEXPORT jint JNICALL Java_compiler_calls_TestDirtyInt_test(JNIEnv* env, jclass jclazz, jint v)
 {
   int* ptr = &array + v + 4;
   return *ptr;
diff --git a/hotspot/test/compiler/ciReplay/TestVM_no_comp_level.sh b/hotspot/test/compiler/ciReplay/TestVM_no_comp_level.sh
index fd0bd00..85ce38b 100644
--- a/hotspot/test/compiler/ciReplay/TestVM_no_comp_level.sh
+++ b/hotspot/test/compiler/ciReplay/TestVM_no_comp_level.sh
@@ -29,7 +29,6 @@
 ## @summary testing of ciReplay with using generated by VM replay.txt w/o comp_level
 ## @author igor.ignatyev@oracle.com
 ## @requires vm.flightRecorder != true
-## @ignore 8157984
 ## @run shell TestVM_no_comp_level.sh
 ##
 
diff --git a/hotspot/test/compiler/classUnloading/anonymousClass/TestAnonymousClassUnloading.java b/hotspot/test/compiler/classUnloading/anonymousClass/TestAnonymousClassUnloading.java
index 65b3d58..694b6e7 100644
--- a/hotspot/test/compiler/classUnloading/anonymousClass/TestAnonymousClassUnloading.java
+++ b/hotspot/test/compiler/classUnloading/anonymousClass/TestAnonymousClassUnloading.java
@@ -21,26 +21,28 @@
  * questions.
  */
 
-import sun.hotspot.WhiteBox;
+/*
+ * @test TestAnonymousClassUnloading
+ * @bug 8054402
+ * @summary "Tests unloading of anonymous classes."
+ * @library /testlibrary /test/lib /
+ * @modules java.base/jdk.internal.misc
+ *
+ * @run main/othervm/bootclasspath -XX:+UnlockDiagnosticVMOptions -XX:+WhiteBoxAPI
+ *      -XX:-BackgroundCompilation
+ *      compiler.classUnloading.anonymousClass.TestAnonymousClassUnloading
+ */
+
+package compiler.classUnloading.anonymousClass;
+
 import jdk.internal.misc.Unsafe;
+import sun.hotspot.WhiteBox;
 
 import java.io.IOException;
 import java.lang.reflect.Method;
 import java.net.URL;
 import java.net.URLConnection;
 
-/*
- * @test TestAnonymousClassUnloading
- * @bug 8054402
- * @summary "Tests unloading of anonymous classes."
- * @library /testlibrary /test/lib
- * @modules java.base/jdk.internal.misc
- * @compile TestAnonymousClassUnloading.java
- * @run main ClassFileInstaller TestAnonymousClassUnloading
- *                              sun.hotspot.WhiteBox
- *                              sun.hotspot.WhiteBox$WhiteBoxPermission
- * @run main/othervm -Xbootclasspath/a:. -XX:+UnlockDiagnosticVMOptions -XX:+WhiteBoxAPI -XX:-BackgroundCompilation TestAnonymousClassUnloading
- */
 public class TestAnonymousClassUnloading {
     private static final WhiteBox WHITE_BOX = WhiteBox.getWhiteBox();
     private static final Unsafe UNSAFE = Unsafe.getUnsafe();
@@ -107,7 +109,8 @@
      */
     static public void main(String[] args) throws Exception {
         // (1) Load an anonymous version of this class using the corresponding Unsafe method
-        URL classUrl = TestAnonymousClassUnloading.class.getResource("TestAnonymousClassUnloading.class");
+        URL classUrl = TestAnonymousClassUnloading.class.getResource(
+                TestAnonymousClassUnloading.class.getName().replace('.', '/') + ".class");
         URLConnection connection = classUrl.openConnection();
 
         int length = connection.getContentLength();
diff --git a/hotspot/test/compiler/classUnloading/methodUnloading/TestMethodUnloading.java b/hotspot/test/compiler/classUnloading/methodUnloading/TestMethodUnloading.java
index d141546..d0f022d 100644
--- a/hotspot/test/compiler/classUnloading/methodUnloading/TestMethodUnloading.java
+++ b/hotspot/test/compiler/classUnloading/methodUnloading/TestMethodUnloading.java
@@ -21,26 +21,34 @@
  * questions.
  */
 
+/*
+ * @test MethodUnloadingTest
+ * @bug 8029443
+ * @summary Tests the unloading of methods to to class unloading
+ * @modules java.base/jdk.internal.misc
+ * @library /testlibrary /test/lib /
+ *
+ * @build compiler.classUnloading.methodUnloading.TestMethodUnloading
+ *        compiler.classUnloading.methodUnloading.WorkerClass
+ * @run driver ClassFileInstaller sun.hotspot.WhiteBox
+ *                              sun.hotspot.WhiteBox$WhiteBoxPermission
+ * @run main/othervm -Xbootclasspath/a:. -XX:+IgnoreUnrecognizedVMOptions
+ *                   -XX:+UnlockDiagnosticVMOptions -XX:+WhiteBoxAPI
+ *                   -XX:-BackgroundCompilation -XX:-UseCompressedOops
+ *                   -XX:CompileCommand=compileonly,compiler.classUnloading.methodUnloading.TestMethodUnloading::doWork
+ *                   compiler.classUnloading.methodUnloading.TestMethodUnloading
+ */
+
+package compiler.classUnloading.methodUnloading;
+
 import sun.hotspot.WhiteBox;
 
 import java.lang.reflect.Method;
 import java.net.URL;
 import java.net.URLClassLoader;
 
-/*
- * @test MethodUnloadingTest
- * @bug 8029443
- * @summary "Tests the unloading of methods to to class unloading"
- * @modules java.base/jdk.internal.misc
- * @library /testlibrary /test/lib
- * @build TestMethodUnloading
- * @build WorkerClass
- * @run main ClassFileInstaller sun.hotspot.WhiteBox
- *                              sun.hotspot.WhiteBox$WhiteBoxPermission
- * @run main/othervm -Xbootclasspath/a:. -XX:+IgnoreUnrecognizedVMOptions -XX:+UnlockDiagnosticVMOptions -XX:+WhiteBoxAPI -XX:-BackgroundCompilation -XX:-UseCompressedOops -XX:CompileOnly=TestMethodUnloading::doWork TestMethodUnloading
- */
 public class TestMethodUnloading {
-    private static final String workerClassName = "WorkerClass";
+    private static final String workerClassName = "compiler.classUnloading.methodUnloading.WorkerClass";
     private static int work = -1;
 
     private static final WhiteBox WHITE_BOX = WhiteBox.getWhiteBox();
diff --git a/hotspot/test/compiler/classUnloading/methodUnloading/WorkerClass.java b/hotspot/test/compiler/classUnloading/methodUnloading/WorkerClass.java
index c67154f..4d7c7ac 100644
--- a/hotspot/test/compiler/classUnloading/methodUnloading/WorkerClass.java
+++ b/hotspot/test/compiler/classUnloading/methodUnloading/WorkerClass.java
@@ -24,6 +24,9 @@
 /**
  * Worker class that is dynamically loaded/unloaded by TestMethodUnloading.
  */
+
+package compiler.classUnloading.methodUnloading;
+
 public class WorkerClass {
     /**
      * We override hashCode here to be able to access this implementation
diff --git a/hotspot/test/compiler/codecache/CheckReservedInitialCodeCacheSizeArgOrder.java b/hotspot/test/compiler/codecache/CheckReservedInitialCodeCacheSizeArgOrder.java
index 0fee258..1c8d70f 100644
--- a/hotspot/test/compiler/codecache/CheckReservedInitialCodeCacheSizeArgOrder.java
+++ b/hotspot/test/compiler/codecache/CheckReservedInitialCodeCacheSizeArgOrder.java
@@ -27,29 +27,34 @@
  * @summary Test checks that the order in which ReversedCodeCacheSize and
  *          InitialCodeCacheSize are passed to the VM is irrelevant.
  * @library /testlibrary
- *
  * @modules java.base/jdk.internal.misc
  *          java.management
+ *
+ * @run driver compiler.codecache.CheckReservedInitialCodeCacheSizeArgOrder
  */
-import jdk.test.lib.*;
+
+package compiler.codecache;
+
+import jdk.test.lib.OutputAnalyzer;
+import jdk.test.lib.ProcessTools;
 
 public class CheckReservedInitialCodeCacheSizeArgOrder {
-  public static void main(String[] args) throws Exception {
-    ProcessBuilder pb1,  pb2;
-    OutputAnalyzer out1, out2;
+    public static void main(String[] args) throws Exception {
+        ProcessBuilder pb1,  pb2;
+        OutputAnalyzer out1, out2;
 
-    pb1 = ProcessTools.createJavaProcessBuilder("-XX:InitialCodeCacheSize=4m", "-XX:ReservedCodeCacheSize=8m", "-version");
-    pb2 = ProcessTools.createJavaProcessBuilder("-XX:ReservedCodeCacheSize=8m", "-XX:InitialCodeCacheSize=4m", "-version");
+        pb1 = ProcessTools.createJavaProcessBuilder("-XX:InitialCodeCacheSize=4m", "-XX:ReservedCodeCacheSize=8m", "-version");
+        pb2 = ProcessTools.createJavaProcessBuilder("-XX:ReservedCodeCacheSize=8m", "-XX:InitialCodeCacheSize=4m", "-version");
 
-    out1 = new OutputAnalyzer(pb1.start());
-    out2 = new OutputAnalyzer(pb2.start());
+        out1 = new OutputAnalyzer(pb1.start());
+        out2 = new OutputAnalyzer(pb2.start());
 
-    // Check that the outputs are equal
-    if (out1.getStdout().compareTo(out2.getStdout()) != 0) {
-      throw new RuntimeException("Test failed");
+        // Check that the outputs are equal
+        if (out1.getStdout().compareTo(out2.getStdout()) != 0) {
+            throw new RuntimeException("Test failed");
+        }
+
+        out1.shouldHaveExitValue(0);
+        out2.shouldHaveExitValue(0);
     }
-
-    out1.shouldHaveExitValue(0);
-    out2.shouldHaveExitValue(0);
-  }
 }
diff --git a/hotspot/test/compiler/codecache/CheckSegmentedCodeCache.java b/hotspot/test/compiler/codecache/CheckSegmentedCodeCache.java
index 45ae4b8..2e09a4a 100644
--- a/hotspot/test/compiler/codecache/CheckSegmentedCodeCache.java
+++ b/hotspot/test/compiler/codecache/CheckSegmentedCodeCache.java
@@ -21,131 +21,139 @@
  * questions.
  */
 
-import jdk.test.lib.*;
-import sun.hotspot.WhiteBox;
-
 /*
  * @test CheckSegmentedCodeCache
  * @bug 8015774
+ * @summary Checks VM options related to the segmented code cache
  * @library /testlibrary /test/lib
- * @summary "Checks VM options related to the segmented code cache"
  * @modules java.base/jdk.internal.misc
  *          java.management
- * @build CheckSegmentedCodeCache
- * @run main ClassFileInstaller sun.hotspot.WhiteBox
- *                              sun.hotspot.WhiteBox$WhiteBoxPermission
- * @run main/othervm -Xbootclasspath/a:. -XX:+UnlockDiagnosticVMOptions -XX:+WhiteBoxAPI CheckSegmentedCodeCache
+ *
+ * @build compiler.codecache.CheckSegmentedCodeCache
+ * @run driver ClassFileInstaller sun.hotspot.WhiteBox
+ *                                sun.hotspot.WhiteBox$WhiteBoxPermission
+ * @run main/othervm -Xbootclasspath/a:. -XX:+UnlockDiagnosticVMOptions
+ *                   -XX:+WhiteBoxAPI
+ *                   compiler.codecache.CheckSegmentedCodeCache
  */
+
+package compiler.codecache;
+
+import jdk.test.lib.OutputAnalyzer;
+import jdk.test.lib.Platform;
+import jdk.test.lib.ProcessTools;
+import sun.hotspot.WhiteBox;
+
 public class CheckSegmentedCodeCache {
-  private static final WhiteBox WHITE_BOX = WhiteBox.getWhiteBox();
-  // Code heap names
-  private static final String NON_METHOD = "CodeHeap 'non-nmethods'";
-  private static final String PROFILED = "CodeHeap 'profiled nmethods'";
-  private static final String NON_PROFILED = "CodeHeap 'non-profiled nmethods'";
+    private static final WhiteBox WHITE_BOX = WhiteBox.getWhiteBox();
+    // Code heap names
+    private static final String NON_METHOD = "CodeHeap 'non-nmethods'";
+    private static final String PROFILED = "CodeHeap 'profiled nmethods'";
+    private static final String NON_PROFILED = "CodeHeap 'non-profiled nmethods'";
 
-  private static void verifySegmentedCodeCache(ProcessBuilder pb, boolean enabled) throws Exception {
-    OutputAnalyzer out = new OutputAnalyzer(pb.start());
-    out.shouldHaveExitValue(0);
-    if (enabled) {
-      try {
-        // Non-nmethod code heap should be always available with the segmented code cache
-        out.shouldContain(NON_METHOD);
-      } catch (RuntimeException e) {
-        // Check if TieredCompilation is disabled (in a client VM)
-        if(!out.getOutput().contains("-XX:+TieredCompilation not supported in this VM")) {
-          // Code cache is not segmented
-          throw new RuntimeException("No code cache segmentation.");
+    private static void verifySegmentedCodeCache(ProcessBuilder pb, boolean enabled) throws Exception {
+        OutputAnalyzer out = new OutputAnalyzer(pb.start());
+        out.shouldHaveExitValue(0);
+        if (enabled) {
+            try {
+                // Non-nmethod code heap should be always available with the segmented code cache
+                out.shouldContain(NON_METHOD);
+            } catch (RuntimeException e) {
+                // Check if TieredCompilation is disabled (in a client VM)
+                if(!out.getOutput().contains("-XX:+TieredCompilation not supported in this VM")) {
+                    // Code cache is not segmented
+                    throw new RuntimeException("No code cache segmentation.");
+                    }
+            }
+        } else {
+            out.shouldNotContain(NON_METHOD);
         }
-      }
-    } else {
-      out.shouldNotContain(NON_METHOD);
     }
-  }
 
-  private static void verifyCodeHeapNotExists(ProcessBuilder pb, String... heapNames) throws Exception {
-    OutputAnalyzer out = new OutputAnalyzer(pb.start());
-    out.shouldHaveExitValue(0);
-    for (String name : heapNames) {
-      out.shouldNotContain(name);
+    private static void verifyCodeHeapNotExists(ProcessBuilder pb, String... heapNames) throws Exception {
+        OutputAnalyzer out = new OutputAnalyzer(pb.start());
+        out.shouldHaveExitValue(0);
+        for (String name : heapNames) {
+            out.shouldNotContain(name);
+        }
     }
-  }
 
-  private static void failsWith(ProcessBuilder pb, String message) throws Exception {
-    OutputAnalyzer out = new OutputAnalyzer(pb.start());
-    out.shouldContain(message);
-    out.shouldHaveExitValue(1);
-  }
+    private static void failsWith(ProcessBuilder pb, String message) throws Exception {
+        OutputAnalyzer out = new OutputAnalyzer(pb.start());
+        out.shouldContain(message);
+        out.shouldHaveExitValue(1);
+    }
 
-  /**
-   * Check the result of segmented code cache related VM options.
-   */
-  public static void main(String[] args) throws Exception {
-    ProcessBuilder pb;
+    /**
+    * Check the result of segmented code cache related VM options.
+    */
+    public static void main(String[] args) throws Exception {
+        ProcessBuilder pb;
 
-    // Disabled with ReservedCodeCacheSize < 240MB
-    pb = ProcessTools.createJavaProcessBuilder("-XX:ReservedCodeCacheSize=239m",
-                                               "-XX:+PrintCodeCache", "-version");
-    verifySegmentedCodeCache(pb, false);
+        // Disabled with ReservedCodeCacheSize < 240MB
+        pb = ProcessTools.createJavaProcessBuilder("-XX:ReservedCodeCacheSize=239m",
+                                                   "-XX:+PrintCodeCache", "-version");
+        verifySegmentedCodeCache(pb, false);
 
-    // Disabled without TieredCompilation
-    pb = ProcessTools.createJavaProcessBuilder("-XX:-TieredCompilation",
-                                               "-XX:+PrintCodeCache", "-version");
-    verifySegmentedCodeCache(pb, false);
+        // Disabled without TieredCompilation
+        pb = ProcessTools.createJavaProcessBuilder("-XX:-TieredCompilation",
+                                                   "-XX:+PrintCodeCache", "-version");
+        verifySegmentedCodeCache(pb, false);
 
-    // Enabled with TieredCompilation and ReservedCodeCacheSize >= 240MB
-    pb = ProcessTools.createJavaProcessBuilder("-XX:+TieredCompilation",
-                                               "-XX:ReservedCodeCacheSize=240m",
-                                               "-XX:+PrintCodeCache", "-version");
-    verifySegmentedCodeCache(pb, true);
-    pb = ProcessTools.createJavaProcessBuilder("-XX:+TieredCompilation",
-                                               "-XX:ReservedCodeCacheSize=400m",
-                                               "-XX:+PrintCodeCache", "-version");
-    verifySegmentedCodeCache(pb, true);
+        // Enabled with TieredCompilation and ReservedCodeCacheSize >= 240MB
+        pb = ProcessTools.createJavaProcessBuilder("-XX:+TieredCompilation",
+                                                   "-XX:ReservedCodeCacheSize=240m",
+                                                   "-XX:+PrintCodeCache", "-version");
+        verifySegmentedCodeCache(pb, true);
+        pb = ProcessTools.createJavaProcessBuilder("-XX:+TieredCompilation",
+                                                   "-XX:ReservedCodeCacheSize=400m",
+                                                   "-XX:+PrintCodeCache", "-version");
+        verifySegmentedCodeCache(pb, true);
 
-    // Always enabled if SegmentedCodeCache is set
-    pb = ProcessTools.createJavaProcessBuilder("-XX:+SegmentedCodeCache",
-                                               "-XX:-TieredCompilation",
-                                               "-XX:ReservedCodeCacheSize=239m",
-                                               "-XX:+PrintCodeCache", "-version");
-    verifySegmentedCodeCache(pb, true);
+        // Always enabled if SegmentedCodeCache is set
+        pb = ProcessTools.createJavaProcessBuilder("-XX:+SegmentedCodeCache",
+                                                   "-XX:-TieredCompilation",
+                                                   "-XX:ReservedCodeCacheSize=239m",
+                                                   "-XX:+PrintCodeCache", "-version");
+        verifySegmentedCodeCache(pb, true);
 
-    // The profiled and non-profiled code heaps should not be available in
-    // interpreter-only mode
-    pb = ProcessTools.createJavaProcessBuilder("-XX:+SegmentedCodeCache",
-                                               "-Xint",
-                                               "-XX:+PrintCodeCache", "-version");
-    verifyCodeHeapNotExists(pb, PROFILED, NON_PROFILED);
+        // The profiled and non-profiled code heaps should not be available in
+        // interpreter-only mode
+        pb = ProcessTools.createJavaProcessBuilder("-XX:+SegmentedCodeCache",
+                                                   "-Xint",
+                                                   "-XX:+PrintCodeCache", "-version");
+        verifyCodeHeapNotExists(pb, PROFILED, NON_PROFILED);
 
-    // If we stop compilation at CompLevel_none or CompLevel_simple we
-    // don't need a profiled code heap.
-    pb = ProcessTools.createJavaProcessBuilder("-XX:+SegmentedCodeCache",
-                                               "-XX:TieredStopAtLevel=0",
-                                               "-XX:+PrintCodeCache", "-version");
-    verifyCodeHeapNotExists(pb, PROFILED);
-    pb = ProcessTools.createJavaProcessBuilder("-XX:+SegmentedCodeCache",
-                                               "-XX:TieredStopAtLevel=1",
-                                               "-XX:+PrintCodeCache", "-version");
-    verifyCodeHeapNotExists(pb, PROFILED);
+        // If we stop compilation at CompLevel_none or CompLevel_simple we
+        // don't need a profiled code heap.
+        pb = ProcessTools.createJavaProcessBuilder("-XX:+SegmentedCodeCache",
+                                                   "-XX:TieredStopAtLevel=0",
+                                                   "-XX:+PrintCodeCache", "-version");
+        verifyCodeHeapNotExists(pb, PROFILED);
+        pb = ProcessTools.createJavaProcessBuilder("-XX:+SegmentedCodeCache",
+                                                   "-XX:TieredStopAtLevel=1",
+                                                   "-XX:+PrintCodeCache", "-version");
+        verifyCodeHeapNotExists(pb, PROFILED);
 
-    // Fails with too small non-nmethod code heap size
-    pb = ProcessTools.createJavaProcessBuilder("-XX:NonNMethodCodeHeapSize=100K");
-    failsWith(pb, "Invalid NonNMethodCodeHeapSize");
+        // Fails with too small non-nmethod code heap size
+        pb = ProcessTools.createJavaProcessBuilder("-XX:NonNMethodCodeHeapSize=100K");
+        failsWith(pb, "Invalid NonNMethodCodeHeapSize");
 
-    // Fails if code heap sizes do not add up
-    pb = ProcessTools.createJavaProcessBuilder("-XX:+SegmentedCodeCache",
-                                               "-XX:ReservedCodeCacheSize=10M",
-                                               "-XX:NonNMethodCodeHeapSize=5M",
-                                               "-XX:ProfiledCodeHeapSize=5M",
-                                               "-XX:NonProfiledCodeHeapSize=5M");
-    failsWith(pb, "Invalid code heap sizes");
+        // Fails if code heap sizes do not add up
+        pb = ProcessTools.createJavaProcessBuilder("-XX:+SegmentedCodeCache",
+                                                   "-XX:ReservedCodeCacheSize=10M",
+                                                   "-XX:NonNMethodCodeHeapSize=5M",
+                                                   "-XX:ProfiledCodeHeapSize=5M",
+                                                   "-XX:NonProfiledCodeHeapSize=5M");
+        failsWith(pb, "Invalid code heap sizes");
 
-    // Fails if not enough space for VM internal code
-    long minUseSpace = WHITE_BOX.getUintxVMFlag("CodeCacheMinimumUseSpace");
-    // minimum size: CodeCacheMinimumUseSpace DEBUG_ONLY(* 3)
-    long minSize = (Platform.isDebugBuild() ? 3 : 1) * minUseSpace;
-    pb = ProcessTools.createJavaProcessBuilder("-XX:+SegmentedCodeCache",
-                                               "-XX:ReservedCodeCacheSize=" + minSize,
-                                               "-XX:InitialCodeCacheSize=100K");
-    failsWith(pb, "Not enough space in non-nmethod code heap to run VM");
-  }
+        // Fails if not enough space for VM internal code
+        long minUseSpace = WHITE_BOX.getUintxVMFlag("CodeCacheMinimumUseSpace");
+        // minimum size: CodeCacheMinimumUseSpace DEBUG_ONLY(* 3)
+        long minSize = (Platform.isDebugBuild() ? 3 : 1) * minUseSpace;
+        pb = ProcessTools.createJavaProcessBuilder("-XX:+SegmentedCodeCache",
+                                                   "-XX:ReservedCodeCacheSize=" + minSize,
+                                                   "-XX:InitialCodeCacheSize=100K");
+        failsWith(pb, "Not enough space in non-nmethod code heap to run VM");
+    }
 }
diff --git a/hotspot/test/compiler/codecache/CheckUpperLimit.java b/hotspot/test/compiler/codecache/CheckUpperLimit.java
index 086532f..d4c34ca 100644
--- a/hotspot/test/compiler/codecache/CheckUpperLimit.java
+++ b/hotspot/test/compiler/codecache/CheckUpperLimit.java
@@ -26,20 +26,25 @@
  * @bug 8015635
  * @summary Test ensures that the ReservedCodeCacheSize is at most MAXINT
  * @library /testlibrary
- *
  * @modules java.base/jdk.internal.misc
  *          java.management
+ *
+ * @run driver compiler.codecache.CheckUpperLimit
  */
-import jdk.test.lib.*;
+
+package compiler.codecache;
+
+import jdk.test.lib.OutputAnalyzer;
+import jdk.test.lib.ProcessTools;
 
 public class CheckUpperLimit {
-  public static void main(String[] args) throws Exception {
-    ProcessBuilder pb;
-    OutputAnalyzer out;
+    public static void main(String[] args) throws Exception {
+        ProcessBuilder pb;
+        OutputAnalyzer out;
 
-    pb = ProcessTools.createJavaProcessBuilder("-XX:ReservedCodeCacheSize=2049m", "-version");
-    out = new OutputAnalyzer(pb.start());
-    out.shouldContain("Invalid ReservedCodeCacheSize=");
-    out.shouldHaveExitValue(1);
-  }
+        pb = ProcessTools.createJavaProcessBuilder("-XX:ReservedCodeCacheSize=2049m", "-version");
+        out = new OutputAnalyzer(pb.start());
+        out.shouldContain("Invalid ReservedCodeCacheSize=");
+        out.shouldHaveExitValue(1);
+    }
 }
diff --git a/hotspot/test/compiler/codecache/OverflowCodeCacheTest.java b/hotspot/test/compiler/codecache/OverflowCodeCacheTest.java
index 31e8d2b..6b45694 100644
--- a/hotspot/test/compiler/codecache/OverflowCodeCacheTest.java
+++ b/hotspot/test/compiler/codecache/OverflowCodeCacheTest.java
@@ -22,32 +22,38 @@
  *
  */
 
-import java.lang.management.MemoryPoolMXBean;
-import java.util.EnumSet;
-import java.util.ArrayList;
-
-import sun.hotspot.WhiteBox;
-import sun.hotspot.code.BlobType;
-import sun.hotspot.code.CodeBlob;
-import jdk.test.lib.Asserts;
-
 /*
  * @test OverflowCodeCacheTest
  * @bug 8059550
+ * @summary testing of code cache segments overflow
  * @library /testlibrary /test/lib
  * @modules java.base/jdk.internal.misc
- * @modules java.management
- * @build OverflowCodeCacheTest
- * @run main ClassFileInstaller sun.hotspot.WhiteBox
- *                              sun.hotspot.WhiteBox$WhiteBoxPermission
+ *          java.management
+ *
+ * @build compiler.codecache.OverflowCodeCacheTest
+ * @run driver ClassFileInstaller sun.hotspot.WhiteBox
+ *                                sun.hotspot.WhiteBox$WhiteBoxPermission
  * @run main/othervm -Xbootclasspath/a:. -XX:+UnlockDiagnosticVMOptions
  *                   -XX:+WhiteBoxAPI -XX:CompileCommand=compileonly,null::*
- *                   -XX:-SegmentedCodeCache OverflowCodeCacheTest
+ *                   -XX:-SegmentedCodeCache
+ *                   compiler.codecache.OverflowCodeCacheTest
  * @run main/othervm -Xbootclasspath/a:. -XX:+UnlockDiagnosticVMOptions
  *                   -XX:+WhiteBoxAPI -XX:CompileCommand=compileonly,null::*
- *                   -XX:+SegmentedCodeCache OverflowCodeCacheTest
- * @summary testing of code cache segments overflow
+ *                   -XX:+SegmentedCodeCache
+ *                   compiler.codecache.OverflowCodeCacheTest
  */
+
+package compiler.codecache;
+
+import jdk.test.lib.Asserts;
+import sun.hotspot.WhiteBox;
+import sun.hotspot.code.BlobType;
+import sun.hotspot.code.CodeBlob;
+
+import java.lang.management.MemoryPoolMXBean;
+import java.util.ArrayList;
+import java.util.EnumSet;
+
 public class OverflowCodeCacheTest {
     private static final WhiteBox WHITE_BOX = WhiteBox.getWhiteBox();
 
diff --git a/hotspot/test/compiler/codecache/cli/TestSegmentedCodeCacheOption.java b/hotspot/test/compiler/codecache/cli/TestSegmentedCodeCacheOption.java
index 5bb55b3..c5db695 100644
--- a/hotspot/test/compiler/codecache/cli/TestSegmentedCodeCacheOption.java
+++ b/hotspot/test/compiler/codecache/cli/TestSegmentedCodeCacheOption.java
@@ -20,24 +20,29 @@
  * or visit www.oracle.com if you need additional information or have any
  * questions.
  */
-import jdk.test.lib.ExitCode;
-import jdk.test.lib.Platform;
-import jdk.test.lib.cli.CommandLineOptionTest;
-import common.CodeCacheOptions;
-import sun.hotspot.code.BlobType;
 
 /**
  * @test
  * @bug 8015774
  * @summary Verify SegmentedCodeCache option's processing
- * @library /testlibrary /test/lib
+ * @library /testlibrary /test/lib /
  * @modules java.base/jdk.internal.misc
  *          java.compiler
  *          java.management
  *          jdk.jvmstat/sun.jvmstat.monitor
- * @build TestSegmentedCodeCacheOption jdk.test.lib.*
- * @run main TestSegmentedCodeCacheOption
+ *
+ * @build jdk.test.lib.*
+ * @run driver compiler.codecache.cli.TestSegmentedCodeCacheOption
  */
+
+package compiler.codecache.cli;
+
+import compiler.codecache.cli.common.CodeCacheOptions;
+import jdk.test.lib.ExitCode;
+import jdk.test.lib.Platform;
+import jdk.test.lib.cli.CommandLineOptionTest;
+import sun.hotspot.code.BlobType;
+
 public class TestSegmentedCodeCacheOption {
     private static final String INT_MODE = "-Xint";
     private static final String TIERED_COMPILATION = "TieredCompilation";
diff --git a/hotspot/test/compiler/codecache/cli/codeheapsize/CodeCacheFreeSpaceRunner.java b/hotspot/test/compiler/codecache/cli/codeheapsize/CodeCacheFreeSpaceRunner.java
index c8588eb..ffc333c 100644
--- a/hotspot/test/compiler/codecache/cli/codeheapsize/CodeCacheFreeSpaceRunner.java
+++ b/hotspot/test/compiler/codecache/cli/codeheapsize/CodeCacheFreeSpaceRunner.java
@@ -20,13 +20,14 @@
  * or visit www.oracle.com if you need additional information or have any
  * questions.
  */
-package codeheapsize;
 
+package compiler.codecache.cli.codeheapsize;
+
+import compiler.codecache.cli.common.CodeCacheCLITestCase;
+import compiler.codecache.cli.common.CodeCacheOptions;
 import jdk.test.lib.ExitCode;
 import jdk.test.lib.Platform;
 import jdk.test.lib.cli.CommandLineOptionTest;
-import common.CodeCacheCLITestCase;
-import common.CodeCacheOptions;
 import sun.hotspot.code.BlobType;
 
 /**
diff --git a/hotspot/test/compiler/codecache/cli/codeheapsize/GenericCodeHeapSizeRunner.java b/hotspot/test/compiler/codecache/cli/codeheapsize/GenericCodeHeapSizeRunner.java
index 5d26ea9..a8186fc 100644
--- a/hotspot/test/compiler/codecache/cli/codeheapsize/GenericCodeHeapSizeRunner.java
+++ b/hotspot/test/compiler/codecache/cli/codeheapsize/GenericCodeHeapSizeRunner.java
@@ -20,11 +20,12 @@
  * or visit www.oracle.com if you need additional information or have any
  * questions.
  */
-package codeheapsize;
 
+package compiler.codecache.cli.codeheapsize;
+
+import compiler.codecache.cli.common.CodeCacheCLITestCase;
+import compiler.codecache.cli.common.CodeCacheOptions;
 import jdk.test.lib.cli.CommandLineOptionTest;
-import common.CodeCacheCLITestCase;
-import common.CodeCacheOptions;
 import sun.hotspot.code.BlobType;
 
 /**
diff --git a/hotspot/test/compiler/codecache/cli/codeheapsize/JVMStartupRunner.java b/hotspot/test/compiler/codecache/cli/codeheapsize/JVMStartupRunner.java
index 4f15fa6..8eb8d15 100644
--- a/hotspot/test/compiler/codecache/cli/codeheapsize/JVMStartupRunner.java
+++ b/hotspot/test/compiler/codecache/cli/codeheapsize/JVMStartupRunner.java
@@ -20,14 +20,16 @@
  * or visit www.oracle.com if you need additional information or have any
  * questions.
  */
-package codeheapsize;
 
-import common.CodeCacheCLITestCase;
-import common.CodeCacheOptions;
+package compiler.codecache.cli.codeheapsize;
+
+import compiler.codecache.cli.common.CodeCacheCLITestCase;
+import compiler.codecache.cli.common.CodeCacheOptions;
 import jdk.test.lib.ExitCode;
 import jdk.test.lib.Utils;
 import jdk.test.lib.cli.CommandLineOptionTest;
 import sun.hotspot.code.BlobType;
+
 import java.util.Random;
 
 /**
diff --git a/hotspot/test/compiler/codecache/cli/codeheapsize/TestCodeHeapSizeOptions.java b/hotspot/test/compiler/codecache/cli/codeheapsize/TestCodeHeapSizeOptions.java
index f664e1b..ce57610 100644
--- a/hotspot/test/compiler/codecache/cli/codeheapsize/TestCodeHeapSizeOptions.java
+++ b/hotspot/test/compiler/codecache/cli/codeheapsize/TestCodeHeapSizeOptions.java
@@ -20,26 +20,30 @@
  * or visit www.oracle.com if you need additional information or have any
  * questions.
  */
-package codeheapsize;
 
-import jdk.test.lib.Platform;
-import common.CodeCacheCLITestBase;
-import common.CodeCacheCLITestCase;
-import sun.hotspot.code.BlobType;
-import java.util.EnumSet;
 /**
  * @test
  * @bug 8015774
  * @summary Verify processing of options related to code heaps sizing.
- * @library /testlibrary .. /test/lib
+ * @library /testlibrary /test/lib /
  * @modules java.base/jdk.internal.misc
  *          java.compiler
  *          java.management
  *          jdk.jvmstat/sun.jvmstat.monitor
- * @build TestCodeHeapSizeOptions jdk.test.lib.* codeheapsize.*
- *        common.*
- * @run main/timeout=240 codeheapsize.TestCodeHeapSizeOptions
+ *
+ * @build compiler.codecache.cli.codeheapsize.TestCodeHeapSizeOptions jdk.test.lib.*
+ * @run driver/timeout=240 compiler.codecache.cli.codeheapsize.TestCodeHeapSizeOptions
  */
+
+package compiler.codecache.cli.codeheapsize;
+
+import compiler.codecache.cli.common.CodeCacheCLITestBase;
+import compiler.codecache.cli.common.CodeCacheCLITestCase;
+import jdk.test.lib.Platform;
+import sun.hotspot.code.BlobType;
+
+import java.util.EnumSet;
+
 public class TestCodeHeapSizeOptions extends CodeCacheCLITestBase {
     private static final CodeCacheCLITestCase JVM_STARTUP
             = new CodeCacheCLITestCase(new CodeCacheCLITestCase.Description(
diff --git a/hotspot/test/compiler/codecache/cli/common/CodeCacheCLITestBase.java b/hotspot/test/compiler/codecache/cli/common/CodeCacheCLITestBase.java
index d57e0f7..f1f1895 100644
--- a/hotspot/test/compiler/codecache/cli/common/CodeCacheCLITestBase.java
+++ b/hotspot/test/compiler/codecache/cli/common/CodeCacheCLITestBase.java
@@ -20,7 +20,8 @@
  * or visit www.oracle.com if you need additional information or have any
  * questions.
  */
-package common;
+
+package compiler.codecache.cli.common;
 
 /**
  * Base for code cache related command line options tests.
diff --git a/hotspot/test/compiler/codecache/cli/common/CodeCacheCLITestCase.java b/hotspot/test/compiler/codecache/cli/common/CodeCacheCLITestCase.java
index 003fdba..1c28a1f 100644
--- a/hotspot/test/compiler/codecache/cli/common/CodeCacheCLITestCase.java
+++ b/hotspot/test/compiler/codecache/cli/common/CodeCacheCLITestCase.java
@@ -20,7 +20,7 @@
  * or visit www.oracle.com if you need additional information or have any
  * questions.
  */
-package common;
+package compiler.codecache.cli.common;
 
 import jdk.test.lib.Platform;
 import jdk.test.lib.cli.CommandLineOptionTest;
diff --git a/hotspot/test/compiler/codecache/cli/common/CodeCacheInfoFormatter.java b/hotspot/test/compiler/codecache/cli/common/CodeCacheInfoFormatter.java
index 3ad16a6..9349272 100644
--- a/hotspot/test/compiler/codecache/cli/common/CodeCacheInfoFormatter.java
+++ b/hotspot/test/compiler/codecache/cli/common/CodeCacheInfoFormatter.java
@@ -20,9 +20,10 @@
  * or visit www.oracle.com if you need additional information or have any
  * questions.
  */
-package common;
+package compiler.codecache.cli.common;
 
 import sun.hotspot.code.BlobType;
+
 import java.util.Arrays;
 
 public class CodeCacheInfoFormatter {
diff --git a/hotspot/test/compiler/codecache/cli/common/CodeCacheOptions.java b/hotspot/test/compiler/codecache/cli/common/CodeCacheOptions.java
index 41025d7..d5e2f16 100644
--- a/hotspot/test/compiler/codecache/cli/common/CodeCacheOptions.java
+++ b/hotspot/test/compiler/codecache/cli/common/CodeCacheOptions.java
@@ -20,7 +20,7 @@
  * or visit www.oracle.com if you need additional information or have any
  * questions.
  */
-package common;
+package compiler.codecache.cli.common;
 
 import jdk.test.lib.cli.CommandLineOptionTest;
 import sun.hotspot.code.BlobType;
diff --git a/hotspot/test/compiler/codecache/cli/printcodecache/PrintCodeCacheRunner.java b/hotspot/test/compiler/codecache/cli/printcodecache/PrintCodeCacheRunner.java
index 5fb3ca4..4bd269a 100644
--- a/hotspot/test/compiler/codecache/cli/printcodecache/PrintCodeCacheRunner.java
+++ b/hotspot/test/compiler/codecache/cli/printcodecache/PrintCodeCacheRunner.java
@@ -20,13 +20,14 @@
  * or visit www.oracle.com if you need additional information or have any
  * questions.
  */
-package printcodecache;
 
+package compiler.codecache.cli.printcodecache;
+
+import compiler.codecache.cli.common.CodeCacheCLITestCase;
+import compiler.codecache.cli.common.CodeCacheInfoFormatter;
+import compiler.codecache.cli.common.CodeCacheOptions;
 import jdk.test.lib.ExitCode;
 import jdk.test.lib.cli.CommandLineOptionTest;
-import common.CodeCacheCLITestCase;
-import common.CodeCacheInfoFormatter;
-import common.CodeCacheOptions;
 import sun.hotspot.code.BlobType;
 
 import java.util.EnumSet;
diff --git a/hotspot/test/compiler/codecache/cli/printcodecache/TestPrintCodeCacheOption.java b/hotspot/test/compiler/codecache/cli/printcodecache/TestPrintCodeCacheOption.java
index efbf2fe..eb50d4a 100644
--- a/hotspot/test/compiler/codecache/cli/printcodecache/TestPrintCodeCacheOption.java
+++ b/hotspot/test/compiler/codecache/cli/printcodecache/TestPrintCodeCacheOption.java
@@ -20,25 +20,29 @@
  * or visit www.oracle.com if you need additional information or have any
  * questions.
  */
-package printcodecache;
 
-import common.CodeCacheCLITestBase;
-import common.CodeCacheCLITestCase;
-import sun.hotspot.code.BlobType;
-import java.util.EnumSet;
 /**
  * @test
  * @bug 8015774
  * @summary Verify that PrintCodeCache option print correct information.
- * @library /testlibrary .. /test/lib
+ * @library /testlibrary /test/lib /
  * @modules java.base/jdk.internal.misc
  *          java.compiler
  *          java.management
  *          jdk.jvmstat/sun.jvmstat.monitor
- * @build TestPrintCodeCacheOption jdk.test.lib.*
- *        printcodecache.* common.*
- * @run main/timeout=240 printcodecache.TestPrintCodeCacheOption
+ *
+ * @build jdk.test.lib.* compiler.codecache.cli.common.*
+ * @run main/timeout=240 compiler.codecache.cli.printcodecache.TestPrintCodeCacheOption
  */
+
+package compiler.codecache.cli.printcodecache;
+
+import compiler.codecache.cli.common.CodeCacheCLITestBase;
+import compiler.codecache.cli.common.CodeCacheCLITestCase;
+import sun.hotspot.code.BlobType;
+
+import java.util.EnumSet;
+
 public class TestPrintCodeCacheOption extends CodeCacheCLITestBase {
     private static final CodeCacheCLITestCase DISABLED_PRINT_CODE_CACHE
             = new CodeCacheCLITestCase(new CodeCacheCLITestCase.Description(
diff --git a/hotspot/test/compiler/codecache/dtrace/SegmentedCodeCacheDtraceTest.java b/hotspot/test/compiler/codecache/dtrace/SegmentedCodeCacheDtraceTest.java
index 57fc8e0..535adc0a 100644
--- a/hotspot/test/compiler/codecache/dtrace/SegmentedCodeCacheDtraceTest.java
+++ b/hotspot/test/compiler/codecache/dtrace/SegmentedCodeCacheDtraceTest.java
@@ -21,6 +21,24 @@
  * questions.
  */
 
+/*
+ * @test SegmentedCodeCacheDtraceTest
+ * @bug 8015774
+ * @summary testing of dtrace for segmented code cache
+ * @requires os.family=="solaris"
+ * @modules java.base/jdk.internal.misc
+ * @library /testlibrary /test/lib /
+ *
+ * @build compiler.codecache.dtrace.SegmentedCodeCacheDtraceTest
+ * @run driver ClassFileInstaller sun.hotspot.WhiteBox
+ *                                sun.hotspot.WhiteBox$WhiteBoxPermission
+ * @run main/othervm/timeout=600 -Xbootclasspath/a:.
+ *     -XX:+UnlockDiagnosticVMOptions -XX:+WhiteBoxAPI
+ *     compiler.codecache.dtrace.SegmentedCodeCacheDtraceTest
+ */
+
+package compiler.codecache.dtrace;
+
 import compiler.testlibrary.CompilerUtils;
 import jdk.test.lib.Asserts;
 import jdk.test.lib.JDKToolFinder;
@@ -28,6 +46,7 @@
 import jdk.test.lib.Utils;
 import jdk.test.lib.dtrace.DtraceResultsAnalyzer;
 import jdk.test.lib.dtrace.DtraceRunner;
+
 import java.io.IOException;
 import java.lang.reflect.Executable;
 import java.nio.file.Files;
@@ -44,20 +63,6 @@
 import java.util.regex.Pattern;
 import java.util.stream.Collectors;
 
-/*
- * @test SegmentedCodeCacheDtraceTest
- * @bug 8015774
- * @requires os.family=="solaris"
- * @modules java.base/jdk.internal.misc
- * @library /testlibrary / /test/lib
- * @build SegmentedCodeCacheDtraceTestWorker
- * @run main ClassFileInstaller sun.hotspot.WhiteBox
- *     sun.hotspot.WhiteBox$WhiteBoxPermission
- * @run main/othervm/timeout=600 -Xbootclasspath/a:. -XX:+TieredCompilation
- *     -XX:+UnlockDiagnosticVMOptions -XX:+WhiteBoxAPI
- *     SegmentedCodeCacheDtraceTest
- * @summary testing of dtrace for segmented code cache
- */
 public class SegmentedCodeCacheDtraceTest {
 
     private static final String WORKER_CLASS_NAME
diff --git a/hotspot/test/compiler/codecache/dtrace/SegmentedCodeCacheDtraceTestWorker.java b/hotspot/test/compiler/codecache/dtrace/SegmentedCodeCacheDtraceTestWorker.java
index 53422df..058c6ea 100644
--- a/hotspot/test/compiler/codecache/dtrace/SegmentedCodeCacheDtraceTestWorker.java
+++ b/hotspot/test/compiler/codecache/dtrace/SegmentedCodeCacheDtraceTestWorker.java
@@ -21,13 +21,16 @@
  * questions.
  */
 
+package compiler.codecache.dtrace;
+
 import jdk.test.lib.Utils;
+import sun.hotspot.WhiteBox;
+
 import java.lang.reflect.Executable;
 import java.util.ArrayList;
 import java.util.Arrays;
 import java.util.Collections;
 import java.util.List;
-import sun.hotspot.WhiteBox;
 
 public class SegmentedCodeCacheDtraceTestWorker {
 
diff --git a/hotspot/test/compiler/codecache/jmx/BeanTypeTest.java b/hotspot/test/compiler/codecache/jmx/BeanTypeTest.java
index f7838e5..d620e9e 100644
--- a/hotspot/test/compiler/codecache/jmx/BeanTypeTest.java
+++ b/hotspot/test/compiler/codecache/jmx/BeanTypeTest.java
@@ -21,24 +21,33 @@
  * questions.
  */
 
-import jdk.test.lib.Asserts;
-import java.lang.management.MemoryType;
-import sun.hotspot.code.BlobType;
-
 /**
  * @test BeanTypeTest
- * @library /testlibrary /test/lib
- * @modules java.base/jdk.internal.misc
- * @modules java.management
- * @build BeanTypeTest
- * @run main ClassFileInstaller sun.hotspot.WhiteBox
- *     sun.hotspot.WhiteBox$WhiteBoxPermission
- * @run main/othervm -Xbootclasspath/a:. -XX:+UnlockDiagnosticVMOptions
- *     -XX:+WhiteBoxAPI -XX:+SegmentedCodeCache BeanTypeTest
- * @run main/othervm -Xbootclasspath/a:. -XX:+UnlockDiagnosticVMOptions
- *     -XX:+WhiteBoxAPI -XX:-SegmentedCodeCache BeanTypeTest
  * @summary verify types of code cache memory pool bean
+ * @modules java.base/jdk.internal.misc
+ *          java.management
+ * @library /testlibrary /test/lib
+ *
+ * @build compiler.codecache.jmx.BeanTypeTest
+ * @run driver ClassFileInstaller sun.hotspot.WhiteBox
+ *                                sun.hotspot.WhiteBox$WhiteBoxPermission
+ * @run main/othervm -Xbootclasspath/a:. -XX:+UnlockDiagnosticVMOptions
+ *     -XX:+WhiteBoxAPI
+ *     -XX:+SegmentedCodeCache
+ *     compiler.codecache.jmx.BeanTypeTest
+ * @run main/othervm -Xbootclasspath/a:. -XX:+UnlockDiagnosticVMOptions
+ *     -XX:+WhiteBoxAPI
+ *     -XX:-SegmentedCodeCache
+ *     compiler.codecache.jmx.BeanTypeTest
  */
+
+package compiler.codecache.jmx;
+
+import jdk.test.lib.Asserts;
+import sun.hotspot.code.BlobType;
+
+import java.lang.management.MemoryType;
+
 public class BeanTypeTest {
 
     public static void main(String args[]) {
diff --git a/hotspot/test/compiler/codecache/jmx/CodeCacheUtils.java b/hotspot/test/compiler/codecache/jmx/CodeCacheUtils.java
index 0adab36..31646f9 100644
--- a/hotspot/test/compiler/codecache/jmx/CodeCacheUtils.java
+++ b/hotspot/test/compiler/codecache/jmx/CodeCacheUtils.java
@@ -21,14 +21,17 @@
  * questions.
  */
 
+package compiler.codecache.jmx;
+
 import jdk.test.lib.Asserts;
 import jdk.test.lib.Utils;
-import java.lang.management.MemoryPoolMXBean;
-import javax.management.Notification;
 import sun.hotspot.WhiteBox;
 import sun.hotspot.code.BlobType;
 import sun.hotspot.code.CodeBlob;
 
+import javax.management.Notification;
+import java.lang.management.MemoryPoolMXBean;
+
 public final class CodeCacheUtils {
 
     /**
diff --git a/hotspot/test/compiler/codecache/jmx/CodeHeapBeanPresenceTest.java b/hotspot/test/compiler/codecache/jmx/CodeHeapBeanPresenceTest.java
index 6f99c25..ccf6927 100644
--- a/hotspot/test/compiler/codecache/jmx/CodeHeapBeanPresenceTest.java
+++ b/hotspot/test/compiler/codecache/jmx/CodeHeapBeanPresenceTest.java
@@ -21,24 +21,33 @@
  * questions.
  */
 
-import jdk.test.lib.Asserts;
-import java.util.EnumSet;
-import sun.hotspot.code.BlobType;
-
 /**
  * @test CodeHeapBeanPresenceTest
- * @library /testlibrary /test/lib
- * @modules java.base/jdk.internal.misc
- * @modules java.management
- * @build CodeHeapBeanPresenceTest
- * @run main ClassFileInstaller sun.hotspot.WhiteBox
- *     sun.hotspot.WhiteBox$WhiteBoxPermission
- * @run main/othervm -Xbootclasspath/a:. -XX:+UnlockDiagnosticVMOptions
- *     -XX:+WhiteBoxAPI -XX:-SegmentedCodeCache CodeHeapBeanPresenceTest
- * @run main/othervm -Xbootclasspath/a:. -XX:+UnlockDiagnosticVMOptions
- *     -XX:+WhiteBoxAPI -XX:+SegmentedCodeCache CodeHeapBeanPresenceTest
  * @summary verify CodeHeap bean presence
+ * @modules java.base/jdk.internal.misc
+ *          java.management
+ * @library /testlibrary /test/lib
+ *
+ * @build compiler.codecache.jmx.CodeHeapBeanPresenceTest
+ * @run driver ClassFileInstaller sun.hotspot.WhiteBox
+ *                                sun.hotspot.WhiteBox$WhiteBoxPermission
+ * @run main/othervm -Xbootclasspath/a:. -XX:+UnlockDiagnosticVMOptions
+ *     -XX:+WhiteBoxAPI
+ *     -XX:-SegmentedCodeCache
+ *     compiler.codecache.jmx.CodeHeapBeanPresenceTest
+ * @run main/othervm -Xbootclasspath/a:. -XX:+UnlockDiagnosticVMOptions
+ *     -XX:+WhiteBoxAPI
+ *     -XX:+SegmentedCodeCache
+ *     compiler.codecache.jmx.CodeHeapBeanPresenceTest
  */
+
+package compiler.codecache.jmx;
+
+import jdk.test.lib.Asserts;
+import sun.hotspot.code.BlobType;
+
+import java.util.EnumSet;
+
 public class CodeHeapBeanPresenceTest {
 
     public static void main(String args[]) {
diff --git a/hotspot/test/compiler/codecache/jmx/GetUsageTest.java b/hotspot/test/compiler/codecache/jmx/GetUsageTest.java
index c4fdc5b..01f247c 100644
--- a/hotspot/test/compiler/codecache/jmx/GetUsageTest.java
+++ b/hotspot/test/compiler/codecache/jmx/GetUsageTest.java
@@ -21,25 +21,37 @@
  * questions.
  */
 
+/*
+ * @test GetUsageTest
+ * @summary testing of getUsage() for segmented code cache
+ * @modules java.base/jdk.internal.misc
+ *          java.management
+ * @library /testlibrary /test/lib /
+ *
+ * @build compiler.codecache.jmx.GetUsageTest
+ * @run driver ClassFileInstaller sun.hotspot.WhiteBox
+ *                                sun.hotspot.WhiteBox$WhiteBoxPermission
+ * @run main/othervm -Xbootclasspath/a:. -XX:+UnlockDiagnosticVMOptions
+ *     -XX:+WhiteBoxAPI -XX:CompileCommand=compileonly,null::*
+ *     -XX:-UseCodeCacheFlushing -XX:-MethodFlushing
+ *     -XX:+SegmentedCodeCache
+ *     compiler.codecache.jmx.GetUsageTest
+ * @run main/othervm -Xbootclasspath/a:. -XX:+UnlockDiagnosticVMOptions
+ *     -XX:+WhiteBoxAPI -XX:CompileCommand=compileonly,null::*
+ *     -XX:-UseCodeCacheFlushing -XX:-MethodFlushing
+ *     -XX:-SegmentedCodeCache
+ *     compiler.codecache.jmx.GetUsageTest
+ */
+
+package compiler.codecache.jmx;
+
 import jdk.test.lib.Asserts;
+import sun.hotspot.code.BlobType;
+
 import java.lang.management.MemoryPoolMXBean;
 import java.util.HashMap;
 import java.util.Map;
-import sun.hotspot.code.BlobType;
 
-/*
- * @test GetUsageTest
- * @library /testlibrary /test/lib
- * @modules java.base/jdk.internal.misc
- *          java.management
- * @build GetUsageTest
- * @run main ClassFileInstaller sun.hotspot.WhiteBox
- *     sun.hotspot.WhiteBox$WhiteBoxPermission
- * @run main/othervm -Xbootclasspath/a:. -XX:CompileCommand=compileonly,null::*
- *     -XX:-UseCodeCacheFlushing -XX:-MethodFlushing -XX:+SegmentedCodeCache
- *     -XX:+UnlockDiagnosticVMOptions -XX:+WhiteBoxAPI GetUsageTest
- * @summary testing of getUsage() for segmented code cache
- */
 public class GetUsageTest {
 
     private final BlobType btype;
diff --git a/hotspot/test/compiler/codecache/jmx/InitialAndMaxUsageTest.java b/hotspot/test/compiler/codecache/jmx/InitialAndMaxUsageTest.java
index f695234..ea17ba2 100644
--- a/hotspot/test/compiler/codecache/jmx/InitialAndMaxUsageTest.java
+++ b/hotspot/test/compiler/codecache/jmx/InitialAndMaxUsageTest.java
@@ -21,26 +21,32 @@
  * questions.
  */
 
+/*
+ * @test InitialAndMaxUsageTest
+ * @summary testing of initial and max usage
+ * @modules java.base/jdk.internal.misc
+ *          java.management
+ * @library /testlibrary /test/lib /
+ *
+ * @build compiler.codecache.jmx.InitialAndMaxUsageTest
+ * @run driver ClassFileInstaller sun.hotspot.WhiteBox
+ *                                sun.hotspot.WhiteBox$WhiteBoxPermission
+ * @run main/othervm -Xbootclasspath/a:. -XX:-UseCodeCacheFlushing
+ *     -XX:-MethodFlushing -XX:+UnlockDiagnosticVMOptions -XX:+WhiteBoxAPI
+ *     -XX:CompileCommand=compileonly,null::* -XX:-UseLargePages
+ *     -XX:+SegmentedCodeCache
+ *     compiler.codecache.jmx.InitialAndMaxUsageTest
+ */
+
+package compiler.codecache.jmx;
+
 import jdk.test.lib.Asserts;
+import sun.hotspot.code.BlobType;
+
 import java.lang.management.MemoryPoolMXBean;
 import java.util.ArrayList;
 import java.util.List;
-import sun.hotspot.code.BlobType;
 
-/*
- * @test InitialAndMaxUsageTest
- * @library /testlibrary /test/lib
- * @modules java.base/jdk.internal.misc
- *          java.management
- * @build InitialAndMaxUsageTest
- * @run main ClassFileInstaller sun.hotspot.WhiteBox
- *     sun.hotspot.WhiteBox$WhiteBoxPermission
- * @run main/othervm -Xbootclasspath/a:. -XX:-UseCodeCacheFlushing
- *     -XX:-MethodFlushing -XX:+UnlockDiagnosticVMOptions -XX:+WhiteBoxAPI
- *     -XX:+SegmentedCodeCache -XX:CompileCommand=compileonly,null::*
- *     -XX:-UseLargePages InitialAndMaxUsageTest
- * @summary testing of initial and max usage
- */
 public class InitialAndMaxUsageTest {
 
     private static final double CACHE_USAGE_COEF = 0.95d;
diff --git a/hotspot/test/compiler/codecache/jmx/ManagerNamesTest.java b/hotspot/test/compiler/codecache/jmx/ManagerNamesTest.java
index 45107f0..f8e67872 100644
--- a/hotspot/test/compiler/codecache/jmx/ManagerNamesTest.java
+++ b/hotspot/test/compiler/codecache/jmx/ManagerNamesTest.java
@@ -21,24 +21,33 @@
  * questions.
  */
 
-import jdk.test.lib.Asserts;
-import java.lang.management.MemoryPoolMXBean;
-import sun.hotspot.code.BlobType;
-
 /**
  * @test ManagerNamesTest
- * @library /testlibrary /test/lib
- * @modules java.base/jdk.internal.misc
- * @modules java.management
- * @build ManagerNamesTest
- * @run main ClassFileInstaller sun.hotspot.WhiteBox
- *     sun.hotspot.WhiteBox$WhiteBoxPermission
- * @run main/othervm -Xbootclasspath/a:. -XX:+UnlockDiagnosticVMOptions
- *     -XX:+WhiteBoxAPI -XX:+SegmentedCodeCache ManagerNamesTest
- * * @run main/othervm -Xbootclasspath/a:. -XX:+UnlockDiagnosticVMOptions
- *     -XX:+WhiteBoxAPI -XX:-SegmentedCodeCache ManagerNamesTest
  * @summary verify getMemoryManageNames calls in case of segmented code cache
+ * @modules java.base/jdk.internal.misc
+ *          java.management
+ * @library /testlibrary /test/lib
+ *
+ * @build compiler.codecache.jmx.ManagerNamesTest
+ * @run driver ClassFileInstaller sun.hotspot.WhiteBox
+ *                                sun.hotspot.WhiteBox$WhiteBoxPermission
+ * @run main/othervm -Xbootclasspath/a:. -XX:+UnlockDiagnosticVMOptions
+ *     -XX:+WhiteBoxAPI
+ *     -XX:+SegmentedCodeCache
+ *     compiler.codecache.jmx.ManagerNamesTest
+ * @run main/othervm -Xbootclasspath/a:. -XX:+UnlockDiagnosticVMOptions
+ *     -XX:+WhiteBoxAPI
+ *     -XX:-SegmentedCodeCache
+ *     compiler.codecache.jmx.ManagerNamesTest
  */
+
+package compiler.codecache.jmx;
+
+import jdk.test.lib.Asserts;
+import sun.hotspot.code.BlobType;
+
+import java.lang.management.MemoryPoolMXBean;
+
 public class ManagerNamesTest {
 
     private final MemoryPoolMXBean bean;
diff --git a/hotspot/test/compiler/codecache/jmx/MemoryPoolsPresenceTest.java b/hotspot/test/compiler/codecache/jmx/MemoryPoolsPresenceTest.java
index a3a0308..b0796cd 100644
--- a/hotspot/test/compiler/codecache/jmx/MemoryPoolsPresenceTest.java
+++ b/hotspot/test/compiler/codecache/jmx/MemoryPoolsPresenceTest.java
@@ -21,29 +21,38 @@
  * questions.
  */
 
+/**
+ * @test MemoryPoolsPresenceTest
+ * @summary verify that MemoryManagerMXBean exists for every code cache segment
+ * @modules java.base/jdk.internal.misc
+ *          java.management
+ * @library /testlibrary /test/lib
+ *
+ * @build compiler.codecache.jmx.MemoryPoolsPresenceTest
+ * @run driver ClassFileInstaller sun.hotspot.WhiteBox
+ *                                sun.hotspot.WhiteBox$WhiteBoxPermission
+ * @run main/othervm -Xbootclasspath/a:. -XX:+UnlockDiagnosticVMOptions
+ *     -XX:+WhiteBoxAPI
+ *     -XX:+SegmentedCodeCache
+ *     compiler.codecache.jmx.MemoryPoolsPresenceTest
+ * @run main/othervm -Xbootclasspath/a:. -XX:+UnlockDiagnosticVMOptions
+ *     -XX:+WhiteBoxAPI
+ *     -XX:-SegmentedCodeCache
+ *     compiler.codecache.jmx.MemoryPoolsPresenceTest
+ */
+
+package compiler.codecache.jmx;
+
 import jdk.test.lib.Asserts;
+import sun.hotspot.code.BlobType;
+
 import java.lang.management.ManagementFactory;
 import java.lang.management.MemoryManagerMXBean;
 import java.util.HashMap;
 import java.util.List;
 import java.util.Map;
 import java.util.Optional;
-import sun.hotspot.code.BlobType;
 
-/**
- * @test MemoryPoolsPresenceTest
- * @library /testlibrary /test/lib
- * @modules java.base/jdk.internal.misc
- * @modules java.management
- * @build MemoryPoolsPresenceTest
- * @run main ClassFileInstaller sun.hotspot.WhiteBox
- *     sun.hotspot.WhiteBox$WhiteBoxPermission
- * @run main/othervm -Xbootclasspath/a:. -XX:+UnlockDiagnosticVMOptions
- *     -XX:+WhiteBoxAPI -XX:+SegmentedCodeCache MemoryPoolsPresenceTest
- * @run main/othervm -Xbootclasspath/a:. -XX:+UnlockDiagnosticVMOptions
- *     -XX:+WhiteBoxAPI -XX:-SegmentedCodeCache MemoryPoolsPresenceTest
- * @summary verify that MemoryManagerMXBean exists for every code cache segment
- */
 public class MemoryPoolsPresenceTest {
 
     private static final String CC_MANAGER = "CodeCacheManager";
diff --git a/hotspot/test/compiler/codecache/jmx/PeakUsageTest.java b/hotspot/test/compiler/codecache/jmx/PeakUsageTest.java
index d00aabb..e75a362 100644
--- a/hotspot/test/compiler/codecache/jmx/PeakUsageTest.java
+++ b/hotspot/test/compiler/codecache/jmx/PeakUsageTest.java
@@ -21,28 +21,35 @@
  * questions.
  */
 
-import jdk.test.lib.Asserts;
-import java.lang.management.MemoryPoolMXBean;
-import sun.hotspot.code.BlobType;
-
 /*
  * @test PeakUsageTest
- * @ignore 8151345
- * @library /testlibrary /test/lib
+ * @library /testlibrary /test/lib /
  * @modules java.base/jdk.internal.misc
  *          java.management
- * @build PeakUsageTest
- * @run main ClassFileInstaller sun.hotspot.WhiteBox
+ *
+ * @ignore 8151345
+ * @build ompiler.codecache.jmx.PeakUsageTest
+ * @run driver ClassFileInstaller sun.hotspot.WhiteBox
  *     sun.hotspot.WhiteBox$WhiteBoxPermission
  * @run main/othervm -Xbootclasspath/a:. -XX:+UnlockDiagnosticVMOptions
- *     -XX:+WhiteBoxAPI -XX:+SegmentedCodeCache
- *     -XX:CompileCommand=compileonly,null::* PeakUsageTest
+ *     -XX:+WhiteBoxAPI -XX:CompileCommand=compileonly,null::*
+ *     -XX:+SegmentedCodeCache
+ *     compiler.codecache.jmx.PeakUsageTest
  * @run main/othervm -Xbootclasspath/a:. -XX:+UnlockDiagnosticVMOptions
- *     -XX:+WhiteBoxAPI -XX:-SegmentedCodeCache
- *     -XX:CompileCommand=compileonly,null::* PeakUsageTest
+ *     -XX:+WhiteBoxAPI -XX:CompileCommand=compileonly,null::*
+ *     -XX:-SegmentedCodeCache
+ *     compiler.codecache.jmx.PeakUsageTest
  * @summary testing of getPeakUsage() and resetPeakUsage for
  *     segmented code cache
  */
+
+package compiler.codecache.jmx;
+
+import sun.hotspot.code.BlobType;
+
+import java.lang.management.MemoryPoolMXBean;
+
+
 public class PeakUsageTest {
 
     private final BlobType btype;
diff --git a/hotspot/test/compiler/codecache/jmx/PoolsIndependenceTest.java b/hotspot/test/compiler/codecache/jmx/PoolsIndependenceTest.java
index 5b5ee81..cd61fea 100644
--- a/hotspot/test/compiler/codecache/jmx/PoolsIndependenceTest.java
+++ b/hotspot/test/compiler/codecache/jmx/PoolsIndependenceTest.java
@@ -21,33 +21,43 @@
  * questions.
  */
 
+/*
+ * @test PoolsIndependenceTest
+ * @summary testing of getUsageThreshold()
+ * @modules java.base/jdk.internal.misc
+ *          java.management
+ * @library /testlibrary /test/lib /
+ *
+ * @build compiler.codecache.jmx.PoolsIndependenceTest
+ * @run driver ClassFileInstaller sun.hotspot.WhiteBox
+ *                                sun.hotspot.WhiteBox$WhiteBoxPermission
+ * @run main/othervm -Xbootclasspath/a:. -XX:+UnlockDiagnosticVMOptions
+ *     -XX:+WhiteBoxAPI -XX:-UseCodeCacheFlushing -XX:-MethodFlushing
+ *     -XX:+SegmentedCodeCache
+ *     compiler.codecache.jmx.PoolsIndependenceTest
+ * @run main/othervm -Xbootclasspath/a:. -XX:+UnlockDiagnosticVMOptions
+ *     -XX:+WhiteBoxAPI -XX:-UseCodeCacheFlushing -XX:-MethodFlushing
+ *     -XX:-SegmentedCodeCache
+ *     compiler.codecache.jmx.PoolsIndependenceTest
+ */
+
+package compiler.codecache.jmx;
+
 import jdk.test.lib.Asserts;
 import jdk.test.lib.Utils;
+import sun.hotspot.code.BlobType;
+
+import javax.management.ListenerNotFoundException;
+import javax.management.Notification;
+import javax.management.NotificationEmitter;
+import javax.management.NotificationListener;
 import java.lang.management.ManagementFactory;
 import java.lang.management.MemoryNotificationInfo;
 import java.lang.management.MemoryPoolMXBean;
 import java.util.HashMap;
 import java.util.Map;
 import java.util.concurrent.atomic.AtomicInteger;
-import javax.management.ListenerNotFoundException;
-import javax.management.Notification;
-import javax.management.NotificationEmitter;
-import javax.management.NotificationListener;
-import sun.hotspot.code.BlobType;
 
-/*
- * @test PoolsIndependenceTest
- * @modules java.base/jdk.internal.misc
- *          java.management
- * @library /testlibrary /test/lib
- * @build PoolsIndependenceTest
- * @run main ClassFileInstaller sun.hotspot.WhiteBox
- *     sun.hotspot.WhiteBox$WhiteBoxPermission
- * @run main/othervm -Xbootclasspath/a:. -XX:-UseCodeCacheFlushing
- *     -XX:-MethodFlushing -XX:+UnlockDiagnosticVMOptions -XX:+WhiteBoxAPI
- *     -XX:+SegmentedCodeCache PoolsIndependenceTest
- * @summary testing of getUsageThreshold()
- */
 public class PoolsIndependenceTest implements NotificationListener {
 
     private final Map<String, AtomicInteger> counters;
diff --git a/hotspot/test/compiler/codecache/jmx/ThresholdNotificationsTest.java b/hotspot/test/compiler/codecache/jmx/ThresholdNotificationsTest.java
index 7fde959..86b22cd 100644
--- a/hotspot/test/compiler/codecache/jmx/ThresholdNotificationsTest.java
+++ b/hotspot/test/compiler/codecache/jmx/ThresholdNotificationsTest.java
@@ -21,31 +21,40 @@
  * questions.
  */
 
+/*
+ * @test ThresholdNotificationsTest
+ * @summary testing of getUsageThreshold()
+ * @library /testlibrary /test/lib /
+ * @modules java.base/jdk.internal.misc
+ *          java.management
+ *
+ * @build compiler.codecache.jmx.ThresholdNotificationsTest
+ * @run driver ClassFileInstaller sun.hotspot.WhiteBox
+ *                                sun.hotspot.WhiteBox$WhiteBoxPermission
+ * @run main/othervm -Xbootclasspath/a:. -XX:-UseCodeCacheFlushing
+ *     -XX:+WhiteBoxAPI -XX:-MethodFlushing -XX:CompileCommand=compileonly,null::*
+ *     -XX:+SegmentedCodeCache
+ *     compiler.codecache.jmx.ThresholdNotificationsTest
+ * @run main/othervm -Xbootclasspath/a:. -XX:-UseCodeCacheFlushing
+ *     -XX:+WhiteBoxAPI -XX:-MethodFlushing -XX:CompileCommand=compileonly,null::*
+ *     -XX:-SegmentedCodeCache
+ *     compiler.codecache.jmx.ThresholdNotificationsTest
+ */
+
+package compiler.codecache.jmx;
+
 import jdk.test.lib.Asserts;
 import jdk.test.lib.Utils;
-import java.lang.management.ManagementFactory;
-import java.lang.management.MemoryNotificationInfo;
-import java.lang.management.MemoryPoolMXBean;
+import sun.hotspot.code.BlobType;
+
 import javax.management.ListenerNotFoundException;
 import javax.management.Notification;
 import javax.management.NotificationEmitter;
 import javax.management.NotificationListener;
-import sun.hotspot.code.BlobType;
+import java.lang.management.ManagementFactory;
+import java.lang.management.MemoryNotificationInfo;
+import java.lang.management.MemoryPoolMXBean;
 
-/*
- * @test ThresholdNotificationsTest
- * @library /testlibrary /test/lib
- * @modules java.base/jdk.internal.misc
- *          java.management
- * @build ThresholdNotificationsTest
- * @run main ClassFileInstaller sun.hotspot.WhiteBox
- *     sun.hotspot.WhiteBox$WhiteBoxPermission
- * @run main/othervm -Xbootclasspath/a:. -XX:-UseCodeCacheFlushing
- *     -XX:-MethodFlushing -XX:+UnlockDiagnosticVMOptions -XX:+WhiteBoxAPI
- *     -XX:+SegmentedCodeCache -XX:CompileCommand=compileonly,null::*
- *     ThresholdNotificationsTest
- * @summary testing of getUsageThreshold()
- */
 public class ThresholdNotificationsTest implements NotificationListener {
 
     private final static long WAIT_TIME = 10000L;
@@ -80,8 +89,8 @@
     }
 
     protected void runTest() {
-        int iterationsCount =
-            Integer.getInteger("jdk.test.lib.iterations", 1);
+        int iterationsCount
+                = Integer.getInteger("jdk.test.lib.iterations", 1);
         MemoryPoolMXBean bean = btype.getMemoryPool();
         ((NotificationEmitter) ManagementFactory.getMemoryMXBean()).
                 addNotificationListener(this, null, null);
diff --git a/hotspot/test/compiler/codecache/jmx/UsageThresholdExceededSeveralTimesTest.java b/hotspot/test/compiler/codecache/jmx/UsageThresholdExceededSeveralTimesTest.java
index aa60507..e90222d 100644
--- a/hotspot/test/compiler/codecache/jmx/UsageThresholdExceededSeveralTimesTest.java
+++ b/hotspot/test/compiler/codecache/jmx/UsageThresholdExceededSeveralTimesTest.java
@@ -23,16 +23,23 @@
 
 /*
  * @test UsageThresholdExceededSeveralTimesTest
- * @library /testlibrary /test/lib
- * @modules java.base/jdk.internal.misc
- *          java.management
- * @build UsageThresholdExceededTest
- * @run main ClassFileInstaller sun.hotspot.WhiteBox
- *     sun.hotspot.WhiteBox$WhiteBoxPermission
- * @run main/othervm -Xbootclasspath/a:. -XX:-UseCodeCacheFlushing
- *     -XX:-MethodFlushing -XX:+UnlockDiagnosticVMOptions -XX:+WhiteBoxAPI
- *     -XX:+SegmentedCodeCache -XX:CompileCommand=compileonly,null::*
- *     -Djdk.test.lib.iterations=10 UsageThresholdExceededTest
  * @summary verifying that getUsageThresholdCount() returns correct value
  *     after threshold has been hit several times
+ * @library /testlibrary /test/lib /
+ * @modules java.base/jdk.internal.misc
+ *          java.management
+ *
+ * @build compiler.codecache.jmx.UsageThresholdExceededTest
+ * @run driver ClassFileInstaller sun.hotspot.WhiteBox
+ *                                sun.hotspot.WhiteBox$WhiteBoxPermission
+ * @run main/othervm -Xbootclasspath/a:. -XX:+UnlockDiagnosticVMOptions
+ *      -XX:+WhiteBoxAPI -XX:-UseCodeCacheFlushing -XX:-MethodFlushing
+ *      -XX:CompileCommand=compileonly,null::* -Djdk.test.lib.iterations=10
+ *      -XX:+SegmentedCodeCache
+ *      compiler.codecache.jmx.UsageThresholdExceededTest
+ * @run main/othervm -Xbootclasspath/a:. -XX:+UnlockDiagnosticVMOptions
+ *      -XX:+WhiteBoxAPI -XX:-UseCodeCacheFlushing -XX:-MethodFlushing
+ *      -XX:CompileCommand=compileonly,null::* -Djdk.test.lib.iterations=10
+ *      -XX:-SegmentedCodeCache
+ *      compiler.codecache.jmx.UsageThresholdExceededTest
  */
diff --git a/hotspot/test/compiler/codecache/jmx/UsageThresholdExceededTest.java b/hotspot/test/compiler/codecache/jmx/UsageThresholdExceededTest.java
index 0700875..baa2ebe 100644
--- a/hotspot/test/compiler/codecache/jmx/UsageThresholdExceededTest.java
+++ b/hotspot/test/compiler/codecache/jmx/UsageThresholdExceededTest.java
@@ -21,25 +21,35 @@
  * questions.
  */
 
-import jdk.test.lib.Asserts;
-import java.lang.management.MemoryPoolMXBean;
-import sun.hotspot.code.BlobType;
-
 /*
  * @test UsageThresholdExceededTest
- * @library /testlibrary /test/lib
- * @modules java.base/jdk.internal.misc
- *          java.management
- * @build UsageThresholdExceededTest
- * @run main ClassFileInstaller sun.hotspot.WhiteBox
- *     sun.hotspot.WhiteBox$WhiteBoxPermission
- * @run main/othervm -Xbootclasspath/a:. -XX:+UnlockDiagnosticVMOptions
- *     -XX:+WhiteBoxAPI -XX:+SegmentedCodeCache -XX:-UseCodeCacheFlushing
- *     -XX:-MethodFlushing -XX:CompileCommand=compileonly,null::*
- *     UsageThresholdExceededTest
  * @summary verifying that getUsageThresholdCount() returns correct value
  *     after threshold has been hit
+ * @library /testlibrary /test/lib /
+ * @modules java.base/jdk.internal.misc
+ *          java.management
+ *
+ * @build compiler.codecache.jmx.UsageThresholdExceededTest
+ * @run driver ClassFileInstaller sun.hotspot.WhiteBox
+ *                                sun.hotspot.WhiteBox$WhiteBoxPermission
+ * @run main/othervm -Xbootclasspath/a:. -XX:+UnlockDiagnosticVMOptions
+ *     -XX:+WhiteBoxAPI -XX:-UseCodeCacheFlushing  -XX:-MethodFlushing
+ *     -XX:CompileCommand=compileonly,null::*
+ *     -XX:+SegmentedCodeCache
+ *     compiler.codecache.jmx.UsageThresholdExceededTest
+ * @run main/othervm -Xbootclasspath/a:. -XX:+UnlockDiagnosticVMOptions
+ *     -XX:+WhiteBoxAPI -XX:-UseCodeCacheFlushing  -XX:-MethodFlushing
+ *     -XX:CompileCommand=compileonly,null::*
+ *     -XX:-SegmentedCodeCache
+ *     compiler.codecache.jmx.UsageThresholdExceededTest
  */
+
+package compiler.codecache.jmx;
+
+import sun.hotspot.code.BlobType;
+
+import java.lang.management.MemoryPoolMXBean;
+
 public class UsageThresholdExceededTest {
 
     protected final int iterations;
diff --git a/hotspot/test/compiler/codecache/jmx/UsageThresholdIncreasedTest.java b/hotspot/test/compiler/codecache/jmx/UsageThresholdIncreasedTest.java
index 8f2e6f1..2f62822 100644
--- a/hotspot/test/compiler/codecache/jmx/UsageThresholdIncreasedTest.java
+++ b/hotspot/test/compiler/codecache/jmx/UsageThresholdIncreasedTest.java
@@ -21,25 +21,35 @@
  * questions.
  */
 
-import jdk.test.lib.Asserts;
-import java.lang.management.MemoryPoolMXBean;
-import sun.hotspot.code.BlobType;
-
 /*
  * @test UsageThresholdIncreasedTest
- * @library /testlibrary /test/lib
- * @modules java.base/jdk.internal.misc
- *          java.management
- * @build UsageThresholdIncreasedTest
- * @run main ClassFileInstaller sun.hotspot.WhiteBox
- *     sun.hotspot.WhiteBox$WhiteBoxPermission
- * @run main/othervm -Xbootclasspath/a:. -XX:+UnlockDiagnosticVMOptions
- *     -XX:+WhiteBoxAPI -XX:+SegmentedCodeCache -XX:-UseCodeCacheFlushing
- *     -XX:-MethodFlushing -XX:CompileCommand=compileonly,null::*
- *     UsageThresholdIncreasedTest
  * @summary verifying that threshold hasn't been hit after allocation smaller
  *     than threshold value and that threshold value can be changed
+ * @library /testlibrary /test/lib /
+ * @modules java.base/jdk.internal.misc
+ *          java.management
+ *
+ * @run driver ClassFileInstaller sun.hotspot.WhiteBox
+ *                                sun.hotspot.WhiteBox$WhiteBoxPermission
+ * @build compiler.codecache.jmx.UsageThresholdIncreasedTest
+ * @run main/othervm -Xbootclasspath/a:. -XX:+UnlockDiagnosticVMOptions
+ *     -XX:+WhiteBoxAPI -XX:-UseCodeCacheFlushing  -XX:-MethodFlushing
+ *     -XX:CompileCommand=compileonly,null::*
+ *     -XX:-SegmentedCodeCache
+ *     compiler.codecache.jmx.UsageThresholdIncreasedTest
+ * @run main/othervm -Xbootclasspath/a:. -XX:+UnlockDiagnosticVMOptions
+ *     -XX:+WhiteBoxAPI -XX:-UseCodeCacheFlushing  -XX:-MethodFlushing
+ *     -XX:CompileCommand=compileonly,null::*
+ *     -XX:+SegmentedCodeCache
+ *     compiler.codecache.jmx.UsageThresholdIncreasedTest
  */
+
+package compiler.codecache.jmx;
+
+import sun.hotspot.code.BlobType;
+
+import java.lang.management.MemoryPoolMXBean;
+
 public class UsageThresholdIncreasedTest {
 
     private static final int ALLOCATION_STEP = 5;
diff --git a/hotspot/test/compiler/codecache/jmx/UsageThresholdNotExceededTest.java b/hotspot/test/compiler/codecache/jmx/UsageThresholdNotExceededTest.java
index 1838226..46bd21b 100644
--- a/hotspot/test/compiler/codecache/jmx/UsageThresholdNotExceededTest.java
+++ b/hotspot/test/compiler/codecache/jmx/UsageThresholdNotExceededTest.java
@@ -21,25 +21,35 @@
  * questions.
  */
 
-import jdk.test.lib.Asserts;
-import java.lang.management.MemoryPoolMXBean;
-import sun.hotspot.code.BlobType;
-
 /*
  * @test UsageThresholdNotExceededTest
- * @library /testlibrary /test/lib
- * @modules java.base/jdk.internal.misc
- *          java.management
- * @build UsageThresholdNotExceededTest
- * @run main ClassFileInstaller sun.hotspot.WhiteBox
- *     sun.hotspot.WhiteBox$WhiteBoxPermission
- * @run main/othervm -Xbootclasspath/a:. -XX:-UseCodeCacheFlushing
- *     -XX:-MethodFlushing -XX:+UnlockDiagnosticVMOptions -XX:+WhiteBoxAPI
- *     -XX:+SegmentedCodeCache -XX:CompileCommand=compileonly,null::*
- *     UsageThresholdNotExceededTest
  * @summary verifying that usage threshold not exceeded while allocating less
  *     than usage threshold
+ * @library /testlibrary /test/lib /
+ * @modules java.base/jdk.internal.misc
+ *          java.management
+ *
+ * @run driver ClassFileInstaller sun.hotspot.WhiteBox
+ *                                sun.hotspot.WhiteBox$WhiteBoxPermission
+ * @build compiler.codecache.jmx.UsageThresholdNotExceededTest
+ * @run main/othervm -Xbootclasspath/a:. -XX:+UnlockDiagnosticVMOptions
+ *     -XX:+WhiteBoxAPI -XX:-UseCodeCacheFlushing -XX:-MethodFlushing
+ *     -XX:CompileCommand=compileonly,null::*
+ *     -XX:+SegmentedCodeCache
+ *     compiler.codecache.jmx.UsageThresholdNotExceededTest
+ * @run main/othervm -Xbootclasspath/a:. -XX:+UnlockDiagnosticVMOptions
+ *     -XX:+WhiteBoxAPI -XX:-UseCodeCacheFlushing -XX:-MethodFlushing
+ *     -XX:CompileCommand=compileonly,null::*
+ *     -XX:-SegmentedCodeCache
+ *     compiler.codecache.jmx.UsageThresholdNotExceededTest
  */
+
+package compiler.codecache.jmx;
+
+import sun.hotspot.code.BlobType;
+
+import java.lang.management.MemoryPoolMXBean;
+
 public class UsageThresholdNotExceededTest {
 
     private final BlobType btype;
diff --git a/hotspot/test/compiler/codecache/stress/CodeCacheStressRunner.java b/hotspot/test/compiler/codecache/stress/CodeCacheStressRunner.java
index 7daa0a1..e3d4a9a 100644
--- a/hotspot/test/compiler/codecache/stress/CodeCacheStressRunner.java
+++ b/hotspot/test/compiler/codecache/stress/CodeCacheStressRunner.java
@@ -22,6 +22,8 @@
  *
  */
 
+package compiler.codecache.stress;
+
 import jdk.test.lib.TimeLimitedRunner;
 import jdk.test.lib.Utils;
 
diff --git a/hotspot/test/compiler/codecache/stress/Helper.java b/hotspot/test/compiler/codecache/stress/Helper.java
index 2ac95f6..6399d30 100644
--- a/hotspot/test/compiler/codecache/stress/Helper.java
+++ b/hotspot/test/compiler/codecache/stress/Helper.java
@@ -22,11 +22,7 @@
  *
  */
 
-import java.io.BufferedInputStream;
-import java.io.ByteArrayOutputStream;
-import java.io.IOException;
-import java.util.concurrent.Callable;
-import java.util.Random;
+package compiler.codecache.stress;
 
 import jdk.test.lib.Asserts;
 import jdk.test.lib.ByteCodeLoader;
@@ -34,18 +30,24 @@
 import jdk.test.lib.Utils;
 import sun.hotspot.WhiteBox;
 
+import java.io.BufferedInputStream;
+import java.io.ByteArrayOutputStream;
+import java.io.IOException;
+import java.util.Random;
+import java.util.concurrent.Callable;
+
 public final class Helper {
     public static final WhiteBox WHITE_BOX = WhiteBox.getWhiteBox();
     public static final Random RNG = Utils.getRandomInstance();
 
     private static final long THRESHOLD = WHITE_BOX.getIntxVMFlag("CompileThreshold");
-    private static final String TEST_CASE_IMPL_CLASS_NAME = "Helper$TestCaseImpl";
+    private static final String TEST_CASE_IMPL_CLASS_NAME = "compiler.codecache.stress.Helper$TestCaseImpl";
     private static byte[] CLASS_DATA;
     static {
         try {
             CLASS_DATA = loadClassData(TEST_CASE_IMPL_CLASS_NAME);
         } catch (IOException e) {
-            throw new Error("TESTBUG: cannot load class byte code", e);
+            throw new Error("TESTBUG: cannot load class byte code " + TEST_CASE_IMPL_CLASS_NAME, e);
         }
     }
 
diff --git a/hotspot/test/compiler/codecache/stress/OverloadCompileQueueTest.java b/hotspot/test/compiler/codecache/stress/OverloadCompileQueueTest.java
index e4b6018..4a93f2e 100644
--- a/hotspot/test/compiler/codecache/stress/OverloadCompileQueueTest.java
+++ b/hotspot/test/compiler/codecache/stress/OverloadCompileQueueTest.java
@@ -22,35 +22,41 @@
  *
  */
 
-import java.lang.reflect.Method;
-import java.util.stream.IntStream;
+/*
+ * @test OverloadCompileQueueTest
+ * @summary stressing code cache by overloading compile queues
+ * @library /testlibrary /test/lib /
+ * @modules java.base/jdk.internal.misc
+ *          java.management
+ *
+ * @ignore 8071905
+ * @build compiler.codecache.stress.OverloadCompileQueueTest
+ * @run driver ClassFileInstaller sun.hotspot.WhiteBox
+ *                                sun.hotspot.WhiteBox$WhiteBoxPermission
+ * @run main/othervm -Xbootclasspath/a:. -XX:+UnlockDiagnosticVMOptions
+ *                   -XX:+WhiteBoxAPI
+ *                   -XX:CompileCommand=dontinline,compiler.codecache.stress.Helper$TestCase::method
+ *                   -XX:-SegmentedCodeCache
+ *                   compiler.codecache.stress.OverloadCompileQueueTest
+ * @run main/othervm -Xbootclasspath/a:. -XX:+UnlockDiagnosticVMOptions
+ *                   -XX:+WhiteBoxAPI
+ *                   -XX:CompileCommand=dontinline,compiler.codecache.stress.Helper$TestCase::method
+ *                   -XX:+SegmentedCodeCache
+ *                   compiler.codecache.stress.OverloadCompileQueueTest
+ */
+
+package compiler.codecache.stress;
 
 import jdk.test.lib.Platform;
 
-/*
- * @test OverloadCompileQueueTest
- * @library /testlibrary /test/lib
- * @modules java.base/jdk.internal.misc
- *          java.management
- * @ignore 8071905
- * @build OverloadCompileQueueTest
- * @run main ClassFileInstaller sun.hotspot.WhiteBox
- *                              sun.hotspot.WhiteBox$WhiteBoxPermission
- * @run main/othervm -Xbootclasspath/a:. -XX:+UnlockDiagnosticVMOptions
- *                   -XX:CompileCommand=dontinline,Helper$TestCase::method
- *                   -XX:+WhiteBoxAPI -XX:-SegmentedCodeCache OverloadCompileQueueTest
- * @run main/othervm -Xbootclasspath/a:. -XX:+UnlockDiagnosticVMOptions
- *                   -XX:CompileCommand=dontinline,Helper$TestCase::method
- *                   -XX:+WhiteBoxAPI -XX:+SegmentedCodeCache OverloadCompileQueueTest
- * @summary stressing code cache by overloading compile queues
- */
+import java.lang.reflect.Method;
+import java.util.stream.IntStream;
+
 public class OverloadCompileQueueTest implements Runnable {
     private static final int MAX_SLEEP = 10000;
     private static final String METHOD_TO_ENQUEUE = "method";
     private static final int LEVEL_SIMPLE = 1;
     private static final int LEVEL_FULL_OPTIMIZATION = 4;
-    private static final boolean INTERPRETED
-            = System.getProperty("java.vm.info").startsWith("interpreted ");
     private static final boolean TIERED_COMPILATION
             = Helper.WHITE_BOX.getBooleanVMFlag("TieredCompilation");
     private static final int TIERED_STOP_AT_LEVEL
@@ -66,15 +72,13 @@
         } else if (Platform.isClient() || Platform.isMinimal()) {
             AVAILABLE_LEVELS = new int[] { LEVEL_SIMPLE };
         } else {
-            throw new Error(String.format(
-                    "TESTBUG: unknown VM: %s", System.getProperty("java.vm.name")));
+            throw new Error("TESTBUG: unknown VM: " + Platform.vmName);
         }
     }
 
     public static void main(String[] args) {
-        if (INTERPRETED) {
-            System.err.println("Test isn't applicable for interpreter. Skip test.");
-            return;
+        if (Platform.isInt()) {
+            throw new Error("TESTBUG: test can not be run in interpreter");
         }
         new CodeCacheStressRunner(new OverloadCompileQueueTest()).runTest();
     }
diff --git a/hotspot/test/compiler/codecache/stress/RandomAllocationTest.java b/hotspot/test/compiler/codecache/stress/RandomAllocationTest.java
index 3000cae..f1b8fd2 100644
--- a/hotspot/test/compiler/codecache/stress/RandomAllocationTest.java
+++ b/hotspot/test/compiler/codecache/stress/RandomAllocationTest.java
@@ -22,26 +22,34 @@
  *
  */
 
-import java.util.ArrayList;
+/*
+ * @test RandomAllocationTest
+ * @summary stressing code cache by allocating randomly sized "dummy" code blobs
+ * @library /testlibrary /test/lib /
+ * @modules java.base/jdk.internal.misc
+ *          java.management
+ *
+ * @build compiler.codecache.stress.RandomAllocationTest
+ * @run driver ClassFileInstaller sun.hotspot.WhiteBox
+ *                                sun.hotspot.WhiteBox$WhiteBoxPermission
+ * @run main/othervm -Xbootclasspath/a:. -XX:+UnlockDiagnosticVMOptions
+ *                   -XX:+WhiteBoxAPI
+ *                   -XX:CompileCommand=dontinline,compiler.codecache.stress.Helper$TestCase::method
+ *                   -XX:-SegmentedCodeCache
+ *                   compiler.codecache.stress.RandomAllocationTest
+ * @run main/othervm -Xbootclasspath/a:. -XX:+UnlockDiagnosticVMOptions
+ *                   -XX:+WhiteBoxAPI
+ *                   -XX:CompileCommand=dontinline,compiler.codecache.stress.Helper$TestCase::method
+ *                   -XX:+SegmentedCodeCache
+ *                   compiler.codecache.stress.RandomAllocationTest
+ */
+
+package compiler.codecache.stress;
 
 import sun.hotspot.code.BlobType;
 
-/*
- * @test RandomAllocationTest
- * @library /testlibrary /test/lib
- * @modules java.base/jdk.internal.misc
- *          java.management
- * @build RandomAllocationTest
- * @run main ClassFileInstaller sun.hotspot.WhiteBox
- *                              sun.hotspot.WhiteBox$WhiteBoxPermission
- * @run main/othervm -Xbootclasspath/a:. -XX:+UnlockDiagnosticVMOptions
- *                   -XX:CompileCommand=dontinline,Helper$TestCase::method
- *                   -XX:+WhiteBoxAPI -XX:-SegmentedCodeCache RandomAllocationTest
- * @run main/othervm -Xbootclasspath/a:. -XX:+UnlockDiagnosticVMOptions
- *                   -XX:CompileCommand=dontinline,Helper$TestCase::method
- *                   -XX:+WhiteBoxAPI -XX:+SegmentedCodeCache RandomAllocationTest
- * @summary stressing code cache by allocating randomly sized "dummy" code blobs
- */
+import java.util.ArrayList;
+
 public class RandomAllocationTest implements Runnable {
     private static final long CODE_CACHE_SIZE
             = Helper.WHITE_BOX.getUintxVMFlag("ReservedCodeCacheSize");
diff --git a/hotspot/test/compiler/codecache/stress/UnexpectedDeoptimizationTest.java b/hotspot/test/compiler/codecache/stress/UnexpectedDeoptimizationTest.java
index 0eb051e..c6e455d 100644
--- a/hotspot/test/compiler/codecache/stress/UnexpectedDeoptimizationTest.java
+++ b/hotspot/test/compiler/codecache/stress/UnexpectedDeoptimizationTest.java
@@ -24,22 +24,28 @@
 
 /*
  * @test UnexpectedDeoptimizationTest
- * @library /testlibrary /test/lib
+ * @summary stressing code cache by forcing unexpected deoptimizations
+ * @library /testlibrary /test/lib /
  * @modules java.base/jdk.internal.misc
  *          java.management
- * @build UnexpectedDeoptimizationTest
- * @run main ClassFileInstaller sun.hotspot.WhiteBox
- *                              sun.hotspot.WhiteBox$WhiteBoxPermission
+ *
+ * @build compiler.codecache.stress.UnexpectedDeoptimizationTest
+ * @run driver ClassFileInstaller sun.hotspot.WhiteBox
+ *                                sun.hotspot.WhiteBox$WhiteBoxPermission
  * @run main/othervm -Xbootclasspath/a:. -XX:+UnlockDiagnosticVMOptions
- *                   -XX:CompileCommand=dontinline,Helper$TestCase::method
- *                   -XX:+WhiteBoxAPI -XX:-SegmentedCodeCache -XX:-DeoptimizeRandom
- *                   UnexpectedDeoptimizationTest
+ *                   -XX:+WhiteBoxAPI -XX:-DeoptimizeRandom
+ *                   -XX:CompileCommand=dontinline,compiler.codecache.stress.Helper$TestCase::method
+ *                   -XX:-SegmentedCodeCache
+ *                   compiler.codecache.stress.UnexpectedDeoptimizationTest
  * @run main/othervm -Xbootclasspath/a:. -XX:+UnlockDiagnosticVMOptions
- *                   -XX:CompileCommand=dontinline,Helper$TestCase::method
- *                   -XX:+WhiteBoxAPI -XX:+SegmentedCodeCache -XX:-DeoptimizeRandom
- *                   UnexpectedDeoptimizationTest
- * @summary stressing code cache by forcing unexpected deoptimizations
+ *                   -XX:+WhiteBoxAPI -XX:-DeoptimizeRandom
+ *                   -XX:CompileCommand=dontinline,compiler.codecache.stress.Helper$TestCase::method
+ *                   -XX:+SegmentedCodeCache
+ *                   compiler.codecache.stress.UnexpectedDeoptimizationTest
  */
+
+package compiler.codecache.stress;
+
 public class UnexpectedDeoptimizationTest implements Runnable {
 
     public static void main(String[] args) {
diff --git a/hotspot/test/compiler/codegen/6431242/Test.java b/hotspot/test/compiler/codegen/6431242/Test.java
deleted file mode 100644
index 603a1e5..0000000
--- a/hotspot/test/compiler/codegen/6431242/Test.java
+++ /dev/null
@@ -1,176 +0,0 @@
-/*
- * Copyright (c) 2006, 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.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- *
- */
-
-/*
- * @test
- * @bug 6431242
- * @run main Test
- */
-
-public class Test{
-
-  int    _len      = 8;
-  int[]  _arr_i    = new int[_len];
-  long[] _arr_l    = new long[_len];
-
-  int[]  _arr_i_cp = new int [_len];
-  long[] _arr_l_cp = new long [_len];
-
-  int _k     = 0x12345678;
-  int _j     = 0;
-  int _ir    = 0x78563412;
-  int _ir1   = 0x78563413;
-  int _ir2   = 0x79563412;
-
-  long _m    = 0x123456789abcdef0L;
-  long _l    = 0L;
-  long _lr   = 0xf0debc9a78563412L;
-  long _lr1  = 0xf0debc9a78563413L;
-  long _lr2  = 0xf1debc9a78563412L;
-
-  void init() {
-    for (int i=0; i<_arr_i.length; i++) {
-      _arr_i[i] = _k;
-      _arr_l[i] = _m;
-    }
-  }
-
-  public int test_int_reversed(int i) {
-    return Integer.reverseBytes(i);
-  }
-
-  public long test_long_reversed(long i) {
-    return Long.reverseBytes(i);
-  }
-
-  public void test_copy_ints(int[] dst, int[] src) {
-    for(int i=0; i<src.length; i++) {
-      dst[i] = Integer.reverseBytes(src[i]);
-    }
-  }
-
-  public void test_copy_ints_reversed(int[] dst, int[] src) {
-    for (int i=0; i<src.length; i++) {
-      dst[i] = 1 + Integer.reverseBytes(src[i]);
-    }
-  }
-
-  public void test_copy_ints_store_reversed(int[] dst, int[] src) {
-    for(int i=0; i<src.length; i++) {
-      dst[i] = Integer.reverseBytes(1 + src[i]);
-    }
-  }
-
-  public void test_copy_longs(long[] dst, long[] src) {
-    for(int i=0; i<src.length; i++) {
-      dst[i] = Long.reverseBytes(src[i]);
-    }
-  }
-
-  public void test_copy_longs_reversed(long[] dst, long[] src) {
-    for (int i=0; i<src.length; i++) {
-      dst[i] = 1 + Long.reverseBytes(src[i]);
-    }
-  }
-
-  public void test_copy_longs_store_reversed(long[] dst, long[] src) {
-    for(int i=0; i<src.length; i++) {
-      dst[i] = Long.reverseBytes(1 + src[i]);
-    }
-  }
-
-  public void test() throws Exception {
-    int up_limit=90000;
-
-
-    //test single
-
-    for (int loop=0; loop<up_limit; loop++) {
-      _j = test_int_reversed(_k);
-      if (_j != _ir ) {
-        throw new Exception("Interger.reverseBytes failed " + _j + " iter " + loop);
-      }
-      _l = test_long_reversed(_m);
-      if (_l != _lr ) {
-        throw new Exception("Long.reverseBytes failed " + _l + " iter " + loop);
-      }
-    }
-
-    // test scalar load/store
-    for (int loop=0; loop<up_limit; loop++) {
-
-      test_copy_ints(_arr_i_cp, _arr_i);
-      for (int j=0; j< _arr_i.length; j++) {
-        if (_arr_i_cp[j] != _ir) {
-          throw new Exception("Interger.reverseBytes failed test_copy_ints iter " + loop);
-        }
-      }
-
-      test_copy_ints_reversed(_arr_i_cp, _arr_i);
-      for (int j=0; j< _arr_i.length; j++) {
-        if (_arr_i_cp[j] != _ir1) {
-          throw new Exception("Interger.reverseBytes failed test_copy_ints_reversed iter " + loop);
-        }
-      }
-      test_copy_ints_store_reversed(_arr_i_cp, _arr_i);
-      for (int j=0; j< _arr_i.length; j++) {
-        if (_arr_i_cp[j] != _ir2) {
-          throw new Exception("Interger.reverseBytes failed test_copy_ints_store_reversed iter " + loop);
-        }
-      }
-
-      test_copy_longs(_arr_l_cp, _arr_l);
-      for (int j=0; j< _arr_i.length; j++) {
-        if (_arr_l_cp[j] != _lr) {
-          throw new Exception("Long.reverseBytes failed test_copy_longs iter " + loop);
-        }
-      }
-      test_copy_longs_reversed(_arr_l_cp, _arr_l);
-      for (int j=0; j< _arr_i.length; j++) {
-        if (_arr_l_cp[j] != _lr1) {
-          throw new Exception("Long.reverseBytes failed test_copy_longs_reversed iter " + loop);
-        }
-      }
-      test_copy_longs_store_reversed(_arr_l_cp, _arr_l);
-      for (int j=0; j< _arr_i.length; j++) {
-        if (_arr_l_cp[j] != _lr2) {
-          throw new Exception("Long.reverseBytes failed test_copy_longs_store_reversed iter " + loop);
-        }
-      }
-
-    }
-  }
-
-  public static void main(String args[]) {
-    try {
-      Test t = new Test();
-      t.init();
-      t.test();
-      System.out.println("Passed");
-    }catch (Exception e) {
-      e.printStackTrace();
-      System.out.println("Failed");
-    }
-  }
-}
diff --git a/hotspot/test/compiler/codegen/7184394/TestAESBase.java b/hotspot/test/compiler/codegen/7184394/TestAESBase.java
deleted file mode 100644
index 6fa53c0..0000000
--- a/hotspot/test/compiler/codegen/7184394/TestAESBase.java
+++ /dev/null
@@ -1,220 +0,0 @@
-/*
- * Copyright (c) 2012, 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.
- *
- * 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.
- *
- */
-
-/**
- * @author Tom Deneau
- */
-
-import jdk.test.lib.Utils;
-import java.security.AlgorithmParameters;
-import java.util.Random;
-import javax.crypto.Cipher;
-import javax.crypto.SecretKey;
-import javax.crypto.spec.GCMParameterSpec;
-import javax.crypto.spec.IvParameterSpec;
-import javax.crypto.spec.SecretKeySpec;
-
-abstract public class TestAESBase {
-  int msgSize = Integer.getInteger("msgSize", 646);
-  boolean checkOutput = Boolean.getBoolean("checkOutput");
-  boolean noReinit = Boolean.getBoolean("noReinit");
-  boolean testingMisalignment;
-  private static final int ALIGN = 8;
-  int encInputOffset = Integer.getInteger("encInputOffset", 0) % ALIGN;
-  int encOutputOffset = Integer.getInteger("encOutputOffset", 0) % ALIGN;
-  int decOutputOffset = Integer.getInteger("decOutputOffset", 0) % ALIGN;
-  int lastChunkSize = Integer.getInteger("lastChunkSize", 32);
-  int keySize = Integer.getInteger("keySize", 128);
-  int inputLength;
-  int encodeLength;
-  int decodeLength;
-  int decodeMsgSize;
-  String algorithm = System.getProperty("algorithm", "AES");
-  String mode = System.getProperty("mode", "CBC");
-  String paddingStr = System.getProperty("paddingStr", "PKCS5Padding");
-  byte[] input;
-  byte[] encode;
-  byte[] expectedEncode;
-  byte[] decode;
-  byte[] expectedDecode;
-  final Random random = Utils.getRandomInstance();
-  Cipher cipher;
-  Cipher dCipher;
-  AlgorithmParameters algParams = null;
-  SecretKey key;
-  GCMParameterSpec gcm_spec;
-  byte[] aad = { 0x11, 0x22, 0x33, 0x44, 0x55 };
-  int tlen = 12;
-  byte[] iv = new byte[16];
-
-  static int numThreads = 0;
-  int  threadId;
-  static synchronized int getThreadId() {
-    int id = numThreads;
-    numThreads++;
-    return id;
-  }
-
-  abstract public void run();
-
-  public void prepare() {
-    try {
-      System.out.println("\nalgorithm=" + algorithm + ", mode=" + mode + ", paddingStr=" + paddingStr +
-              ", msgSize=" + msgSize + ", keySize=" + keySize + ", noReinit=" + noReinit +
-              ", checkOutput=" + checkOutput + ", encInputOffset=" + encInputOffset + ", encOutputOffset=" +
-              encOutputOffset + ", decOutputOffset=" + decOutputOffset + ", lastChunkSize=" +lastChunkSize );
-
-      if (encInputOffset % ALIGN != 0 || encOutputOffset % ALIGN != 0 || decOutputOffset % ALIGN !=0 )
-        testingMisalignment = true;
-
-      int keyLenBytes = (keySize == 0 ? 16 : keySize/8);
-      byte keyBytes[] = new byte[keyLenBytes];
-      if (keySize == 128)
-        keyBytes = new byte[] {-8, -7, -6, -5, -4, -3, -2, -1, 0, 1, 2, 3, 4, 5, 6, 7};
-      else
-        random.nextBytes(keyBytes);
-
-      key = new SecretKeySpec(keyBytes, algorithm);
-      if (threadId == 0) {
-        System.out.println("Algorithm: " + key.getAlgorithm() + "("
-                           + key.getEncoded().length * 8 + "bit)");
-      }
-
-      cipher = Cipher.getInstance(algorithm + "/" + mode + "/" + paddingStr, "SunJCE");
-      dCipher = Cipher.getInstance(algorithm + "/" + mode + "/" + paddingStr, "SunJCE");
-
-      // CBC or CTR init
-      if (mode.equals("CBC") || mode.equals("CTR")) {
-        IvParameterSpec initVector = new IvParameterSpec(iv);
-        cipher.init(Cipher.ENCRYPT_MODE, key, initVector);
-        algParams = cipher.getParameters();
-        dCipher.init(Cipher.DECRYPT_MODE, key, initVector);
-
-      // GCM init
-      } else if (mode.equals("GCM")) {
-        gcm_init(true);
-        gcm_init(false);
-
-      // ECB init
-      } else {
-        cipher.init(Cipher.ENCRYPT_MODE, key, algParams);
-        dCipher.init(Cipher.DECRYPT_MODE, key, algParams);
-      }
-
-      if (threadId == 0) {
-        childShowCipher();
-      }
-
-      inputLength = msgSize + encInputOffset;
-      if (testingMisalignment) {
-        encodeLength = cipher.getOutputSize(msgSize - lastChunkSize) + encOutputOffset;
-        encodeLength += cipher.getOutputSize(lastChunkSize);
-        decodeLength = dCipher.getOutputSize(encodeLength - lastChunkSize) + decOutputOffset;
-        decodeLength += dCipher.getOutputSize(lastChunkSize);
-      } else {
-        encodeLength = cipher.getOutputSize(msgSize) + encOutputOffset;
-        decodeLength = dCipher.getOutputSize(encodeLength) + decOutputOffset;
-      }
-
-      input = new byte[inputLength];
-      for (int i=encInputOffset, j=0; i<inputLength; i++, j++) {
-        input[i] = (byte) (j & 0xff);
-      }
-
-      // do one encode and decode in preparation
-      encode = new byte[encodeLength];
-      decode = new byte[decodeLength];
-      if (testingMisalignment) {
-        decodeMsgSize = cipher.update(input, encInputOffset, (msgSize - lastChunkSize), encode, encOutputOffset);
-        decodeMsgSize += cipher.doFinal(input, (encInputOffset + msgSize - lastChunkSize), lastChunkSize, encode, (encOutputOffset + decodeMsgSize));
-
-        int tempSize = dCipher.update(encode, encOutputOffset, (decodeMsgSize - lastChunkSize), decode, decOutputOffset);
-        dCipher.doFinal(encode, (encOutputOffset + decodeMsgSize - lastChunkSize), lastChunkSize, decode, (decOutputOffset + tempSize));
-      } else {
-        decodeMsgSize = cipher.doFinal(input, encInputOffset, msgSize, encode, encOutputOffset);
-        dCipher.doFinal(encode, encOutputOffset, decodeMsgSize, decode, decOutputOffset);
-      }
-      if (checkOutput) {
-        expectedEncode = (byte[]) encode.clone();
-        expectedDecode = (byte[]) decode.clone();
-        showArray(key.getEncoded()  ,  "key:    ");
-        showArray(input,  "input:  ");
-        showArray(encode, "encode: ");
-        showArray(decode, "decode: ");
-      }
-    }
-    catch (Exception e) {
-      e.printStackTrace();
-      System.exit(1);
-    }
-  }
-
-  void showArray(byte b[], String name) {
-    System.out.format("%s [%d]: ", name, b.length);
-    for (int i=0; i<Math.min(b.length, 32); i++) {
-      System.out.format("%02x ", b[i] & 0xff);
-    }
-    System.out.println();
-  }
-
-  void compareArrays(byte b[], byte exp[]) {
-    if (b.length != exp.length) {
-      System.out.format("different lengths for actual and expected output arrays\n");
-      showArray(b, "test: ");
-      showArray(exp, "exp : ");
-      System.exit(1);
-    }
-    for (int i=0; i< exp.length; i++) {
-      if (b[i] != exp[i]) {
-        System.out.format("output error at index %d: got %02x, expected %02x\n", i, b[i] & 0xff, exp[i] & 0xff);
-        showArray(b, "test: ");
-        showArray(exp, "exp : ");
-        System.exit(1);
-      }
-    }
-  }
-
-
-  void showCipher(Cipher c, String kind) {
-    System.out.println(kind + " cipher provider: " + cipher.getProvider());
-    System.out.println(kind + " cipher algorithm: " + cipher.getAlgorithm());
-  }
-
-  abstract void childShowCipher();
-
-  void gcm_init(boolean encrypt) throws Exception {
-    gcm_spec = new GCMParameterSpec(tlen * 8, iv);
-    if (encrypt) {
-      // Get a new instance everytime because of reuse IV restrictions
-      cipher = Cipher.getInstance(algorithm + "/" + mode + "/" + paddingStr, "SunJCE");
-      cipher.init(Cipher.ENCRYPT_MODE, key, gcm_spec);
-      cipher.updateAAD(aad);
-    } else {
-      dCipher.init(Cipher.DECRYPT_MODE, key, gcm_spec);
-      dCipher.updateAAD(aad);
-
-
-    }
-  }
-}
diff --git a/hotspot/test/compiler/codegen/7184394/TestAESDecode.java b/hotspot/test/compiler/codegen/7184394/TestAESDecode.java
deleted file mode 100644
index e90ef76..0000000
--- a/hotspot/test/compiler/codegen/7184394/TestAESDecode.java
+++ /dev/null
@@ -1,62 +0,0 @@
-/*
- * Copyright (c) 2012, 2014, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * 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.
- *
- */
-
-/**
- * @author Tom Deneau
- */
-
-import javax.crypto.Cipher;
-
-public class TestAESDecode extends TestAESBase {
-  @Override
-  public void run() {
-    try {
-      if (mode.equals("GCM")) {
-        gcm_init(false);
-      } else if (!noReinit) {
-        dCipher.init(Cipher.DECRYPT_MODE, key, algParams);
-      }
-      decode = new byte[decodeLength];
-      if (testingMisalignment) {
-        int tempSize = dCipher.update(encode, encOutputOffset, (decodeMsgSize - lastChunkSize), decode, decOutputOffset);
-        dCipher.doFinal(encode, (encOutputOffset + decodeMsgSize - lastChunkSize), lastChunkSize, decode, (decOutputOffset + tempSize));
-      } else {
-        dCipher.doFinal(encode, encOutputOffset, decodeMsgSize, decode, decOutputOffset);
-      }
-      if (checkOutput) {
-        compareArrays(decode, expectedDecode);
-      }
-    }
-    catch (Exception e) {
-      e.printStackTrace();
-      System.exit(1);
-    }
-  }
-
-  @Override
-  void childShowCipher() {
-    showCipher(dCipher, "Decryption");
-  }
-
-}
diff --git a/hotspot/test/compiler/codegen/7184394/TestAESEncode.java b/hotspot/test/compiler/codegen/7184394/TestAESEncode.java
deleted file mode 100644
index cbfb817..0000000
--- a/hotspot/test/compiler/codegen/7184394/TestAESEncode.java
+++ /dev/null
@@ -1,62 +0,0 @@
-/*
- * Copyright (c) 2012, 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.
- *
- * 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.
- *
- */
-
-/**
- * @author Tom Deneau
- */
-
-import javax.crypto.Cipher;
-
-public class TestAESEncode extends TestAESBase {
-  @Override
-  public void run() {
-    try {
-      if (mode.equals("GCM")) {
-        gcm_init(true);
-      } else if (!noReinit) {
-        cipher.init(Cipher.ENCRYPT_MODE, key, algParams);
-      }
-      encode = new byte[encodeLength];
-      if (testingMisalignment) {
-        int tempSize = cipher.update(input, encInputOffset, (msgSize - lastChunkSize), encode, encOutputOffset);
-        cipher.doFinal(input, (encInputOffset + msgSize - lastChunkSize), lastChunkSize, encode, (encOutputOffset + tempSize));
-      } else {
-        cipher.doFinal(input, encInputOffset, msgSize, encode, encOutputOffset);
-      }
-      if (checkOutput) {
-        compareArrays(encode, expectedEncode);
-      }
-    }
-    catch (Exception e) {
-      e.printStackTrace();
-      System.exit(1);
-    }
-  }
-
-  @Override
-  void childShowCipher() {
-    showCipher(cipher, "Encryption");
-  }
-
-}
diff --git a/hotspot/test/compiler/codegen/7184394/TestAESMain.java b/hotspot/test/compiler/codegen/7184394/TestAESMain.java
deleted file mode 100644
index 23a04c2..0000000
--- a/hotspot/test/compiler/codegen/7184394/TestAESMain.java
+++ /dev/null
@@ -1,100 +0,0 @@
-/*
- * Copyright (c) 2012, 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.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- *
- */
-
-/**
- * @test
- * @bug 7184394
- * @summary add intrinsics to use AES instructions
- * @library /testlibrary
- *
- * @modules java.base/jdk.internal.misc
- *          java.management
- * @run main/othervm/timeout=600 -Xbatch -DcheckOutput=true -Dmode=CBC TestAESMain
- * @run main/othervm/timeout=600 -Xbatch -DcheckOutput=true -Dmode=CBC -DencInputOffset=1 TestAESMain
- * @run main/othervm/timeout=600 -Xbatch -DcheckOutput=true -Dmode=CBC -DencOutputOffset=1 TestAESMain
- * @run main/othervm/timeout=600 -Xbatch -DcheckOutput=true -Dmode=CBC -DdecOutputOffset=1 TestAESMain
- * @run main/othervm/timeout=600 -Xbatch -DcheckOutput=true -Dmode=CBC -DencInputOffset=1 -DencOutputOffset=1 TestAESMain
- * @run main/othervm/timeout=600 -Xbatch -DcheckOutput=true -Dmode=CBC -DencInputOffset=1 -DencOutputOffset=1 -DdecOutputOffset=1 TestAESMain
- * @run main/othervm/timeout=600 -Xbatch -DcheckOutput=true -Dmode=CBC -DencInputOffset=1 -DencOutputOffset=1 -DdecOutputOffset=1 -DpaddingStr=NoPadding -DmsgSize=640 TestAESMain
- * @run main/othervm/timeout=600 -Xbatch -DcheckOutput=true -Dmode=ECB TestAESMain
- * @run main/othervm/timeout=600 -Xbatch -DcheckOutput=true -Dmode=ECB -DencInputOffset=1 TestAESMain
- * @run main/othervm/timeout=600 -Xbatch -DcheckOutput=true -Dmode=ECB -DencOutputOffset=1 TestAESMain
- * @run main/othervm/timeout=600 -Xbatch -DcheckOutput=true -Dmode=ECB -DdecOutputOffset=1 TestAESMain
- * @run main/othervm/timeout=600 -Xbatch -DcheckOutput=true -Dmode=ECB -DencInputOffset=1 -DencOutputOffset=1 TestAESMain
- * @run main/othervm/timeout=600 -Xbatch -DcheckOutput=true -Dmode=ECB -DencInputOffset=1 -DencOutputOffset=1 -DdecOutputOffset=1 TestAESMain
- * @run main/othervm/timeout=600 -Xbatch -DcheckOutput=true -Dmode=ECB -DencInputOffset=1 -DencOutputOffset=1 -DdecOutputOffset=1 -DpaddingStr=NoPadding -DmsgSize=640 TestAESMain
- * @run main/othervm/timeout=600 -Xbatch -DcheckOutput=true -Dmode=GCM TestAESMain
- * @run main/othervm/timeout=600 -Xbatch -DcheckOutput=true -Dmode=GCM -DencInputOffset=1 TestAESMain
- * @run main/othervm/timeout=600 -Xbatch -DcheckOutput=true -Dmode=GCM -DencOutputOffset=1 TestAESMain
- * @run main/othervm/timeout=600 -Xbatch -DcheckOutput=true -Dmode=GCM -DdecOutputOffset=1 TestAESMain
- * @run main/othervm/timeout=600 -Xbatch -DcheckOutput=true -Dmode=GCM -DencInputOffset=1 -DencOutputOffset=1 TestAESMain
- * @run main/othervm/timeout=600 -Xbatch -DcheckOutput=true -Dmode=GCM -DencInputOffset=1 -DencOutputOffset=1 -DdecOutputOffset=1 TestAESMain
- * @run main/othervm/timeout=600 -Xbatch -DcheckOutput=true -Dmode=GCM -DencInputOffset=1 -DencOutputOffset=1 -DdecOutputOffset=1 -DpaddingStr=NoPadding -DmsgSize=640 TestAESMain
- * @run main/othervm/timeout=600 -Xbatch -DcheckOutput=true -Dmode=CTR TestAESMain
- * @run main/othervm/timeout=600 -Xbatch -DcheckOutput=true -Dmode=CTR -DencInputOffset=1 TestAESMain
- * @run main/othervm/timeout=600 -Xbatch -DcheckOutput=true -Dmode=CTR -DencOutputOffset=1 TestAESMain
- * @run main/othervm/timeout=600 -Xbatch -DcheckOutput=true -Dmode=CTR -DdecOutputOffset=1 TestAESMain
- * @run main/othervm/timeout=600 -Xbatch -DcheckOutput=true -Dmode=CTR -DencInputOffset=1 -DencOutputOffset=1 TestAESMain
- * @run main/othervm/timeout=600 -Xbatch -DcheckOutput=true -Dmode=CTR -DencInputOffset=1 -DencOutputOffset=1 -DdecOutputOffset=1 TestAESMain
- * @run main/othervm/timeout=600 -Xbatch -DcheckOutput=true -Dmode=CTR -DencInputOffset=1 -DencOutputOffset=1 -DdecOutputOffset=1 -DpaddingStr=NoPadding -DmsgSize=640 TestAESMain
- *
- * @author Tom Deneau
- */
-
-public class TestAESMain {
-  public static void main(String[] args) {
-    int iters = (args.length > 0 ? Integer.valueOf(args[0]) : 1000000);
-    int warmupIters = (args.length > 1 ? Integer.valueOf(args[1]) : 20000);
-    System.out.println(iters + " iterations");
-    TestAESEncode etest = new TestAESEncode();
-    etest.prepare();
-    // warm-up
-    System.out.println("Starting encryption warm-up");
-    for (int i=0; i<warmupIters; i++) {
-      etest.run();
-    }
-    System.out.println("Finished encryption warm-up");
-    long start = System.nanoTime();
-    for (int i=0; i<iters; i++) {
-      etest.run();
-    }
-    long end = System.nanoTime();
-    System.out.println("TestAESEncode runtime was " + (double)((end - start)/1000000.0) + " ms");
-
-    TestAESDecode dtest = new TestAESDecode();
-    dtest.prepare();
-    // warm-up
-    System.out.println("Starting decryption warm-up");
-    for (int i=0; i<warmupIters; i++) {
-      dtest.run();
-    }
-    System.out.println("Finished decryption warm-up");
-    start = System.nanoTime();
-    for (int i=0; i<iters; i++) {
-      dtest.run();
-    }
-    end = System.nanoTime();
-    System.out.println("TestAESDecode runtime was " + (double)((end - start)/1000000.0) + " ms");
-  }
-}
diff --git a/hotspot/test/compiler/codegen/BMI1.java b/hotspot/test/compiler/codegen/BMI1.java
index ada9cf0..dd1a844 100644
--- a/hotspot/test/compiler/codegen/BMI1.java
+++ b/hotspot/test/compiler/codegen/BMI1.java
@@ -25,277 +25,306 @@
  * @test
  * @bug 8031321
  * @summary Support BMI1 instructions on x86/x64
- * @run main/othervm -Xbatch -XX:-TieredCompilation -XX:CompileCommand=compileonly,BMITests.* BMI1
  *
+ * @run main/othervm -Xbatch -XX:-TieredCompilation
+ *      -XX:CompileCommand=compileonly,compiler.codegen.BMI1$BMITests::*
+ *      compiler.codegen.BMI1
  */
 
-class MemI {
-  public int x;
-  public MemI(int x) { this.x = x; }
-}
-
-class MemL {
-  public long x;
-  public MemL(long x) { this.x = x; }
-}
-
-class BMITests {
-  static int andnl(int src1, int src2) {
-    return ~src1 & src2;
-  }
-  static long andnq(long src1, long src2) {
-    return ~src1 & src2;
-  }
-  static int andnl(int src1, MemI src2) {
-    return ~src1 & src2.x;
-  }
-  static long andnq(long src1, MemL src2) {
-    return ~src1 & src2.x;
-  }
-  static int blsil(int src1) {
-    return src1 & -src1;
-  }
-  static long blsiq(long src1) {
-    return src1 & -src1;
-  }
-  static int blsil(MemI src1) {
-    return src1.x & -src1.x;
-  }
-  static long blsiq(MemL src1) {
-    return src1.x & -src1.x;
-  }
-  static int blsmskl(int src1) {
-    return (src1 - 1) ^ src1;
-  }
-  static long blsmskq(long src1) {
-    return (src1 - 1) ^ src1;
-  }
-  static int blsmskl(MemI src1) {
-    return (src1.x - 1) ^ src1.x;
-  }
-  static long blsmskq(MemL src1) {
-    return (src1.x - 1) ^ src1.x;
-  }
-  static int blsrl(int src1) {
-    return (src1 - 1) & src1;
-  }
-  static long blsrq(long src1) {
-    return (src1 - 1) & src1;
-  }
-  static int blsrl(MemI src1) {
-    return (src1.x - 1) & src1.x;
-  }
-  static long blsrq(MemL src1) {
-    return (src1.x - 1) & src1.x;
-  }
-  static int lzcntl(int src1) {
-    return Integer.numberOfLeadingZeros(src1);
-  }
-  static int lzcntq(long src1) {
-    return Long.numberOfLeadingZeros(src1);
-  }
-  static int tzcntl(int src1) {
-    return Integer.numberOfTrailingZeros(src1);
-  }
-  static int tzcntq(long src1) {
-    return Long.numberOfTrailingZeros(src1);
-  }
-}
+package compiler.codegen;
 
 public class BMI1 {
-  private final static int ITERATIONS = 1000000;
+    private final static int ITERATIONS = 1000000;
 
-  public static void main(String[] args) {
-    int ix = 0x01234567;
-    int iy = 0x89abcdef;
-    MemI imy = new MemI(iy);
-    long lx = 0x0123456701234567L;
-    long ly = 0x89abcdef89abcdefL;
-    MemL lmy = new MemL(ly);
+    public static void main(String[] args) {
+        int ix = 0x01234567;
+        int iy = 0x89abcdef;
+        MemI imy = new MemI(iy);
+        long lx = 0x0123456701234567L;
+        long ly = 0x89abcdef89abcdefL;
+        MemL lmy = new MemL(ly);
 
-    { // match(Set dst (AndI (XorI src1 minus_1) src2))
-      int z = BMITests.andnl(ix, iy);
-      for (int i = 0; i < ITERATIONS; i++) {
-        int ii = BMITests.andnl(ix, iy);
-        if (ii != z) {
-          throw new Error("andnl with register failed");
+        { // match(Set dst (AndI (XorI src1 minus_1) src2))
+            int z = BMITests.andnl(ix, iy);
+            for (int i = 0; i < ITERATIONS; i++) {
+                int ii = BMITests.andnl(ix, iy);
+                if (ii != z) {
+                    throw new Error("andnl with register failed");
+                }
+            }
         }
-      }
-    }
-    { // match(Set dst (AndL (XorL src1 minus_1) src2))
-      long z = BMITests.andnq(lx, ly);
-      for (int i = 0; i < ITERATIONS; i++) {
-        long ll = BMITests.andnq(lx, ly);
-        if (ll != z) {
-          throw new Error("andnq with register failed");
+        { // match(Set dst (AndL (XorL src1 minus_1) src2))
+            long z = BMITests.andnq(lx, ly);
+            for (int i = 0; i < ITERATIONS; i++) {
+                long ll = BMITests.andnq(lx, ly);
+                if (ll != z) {
+                    throw new Error("andnq with register failed");
+                }
+            }
         }
-      }
-    }
-    { // match(Set dst (AndI (XorI src1 minus_1) (LoadI src2)))
-      int z = BMITests.andnl(ix, imy);
-      for (int i = 0; i < ITERATIONS; i++) {
-        int ii = BMITests.andnl(ix, imy);
-        if (ii != z) {
-          throw new Error("andnl with memory failed");
+        { // match(Set dst (AndI (XorI src1 minus_1) (LoadI src2)))
+            int z = BMITests.andnl(ix, imy);
+            for (int i = 0; i < ITERATIONS; i++) {
+                int ii = BMITests.andnl(ix, imy);
+                if (ii != z) {
+                    throw new Error("andnl with memory failed");
+                }
+            }
         }
-      }
-    }
-    { // match(Set dst (AndL (XorL src1 minus_1) (LoadL src2)))
-      long z = BMITests.andnq(lx, lmy);
-      for (int i = 0; i < ITERATIONS; i++) {
-        long ll = BMITests.andnq(lx, lmy);
-        if (ll != z) {
-          throw new Error("andnq with memory failed");
+        { // match(Set dst (AndL (XorL src1 minus_1) (LoadL src2)))
+            long z = BMITests.andnq(lx, lmy);
+            for (int i = 0; i < ITERATIONS; i++) {
+                long ll = BMITests.andnq(lx, lmy);
+                if (ll != z) {
+                    throw new Error("andnq with memory failed");
+                }
+            }
         }
-      }
-    }
-    { // match(Set dst (AndI (SubI imm_zero src) src))
-      int z = BMITests.blsil(ix);
-      for (int i = 0; i < ITERATIONS; i++) {
-        int ii = BMITests.blsil(ix);
-        if (ii != z) {
-          throw new Error("blsil with register failed");
+        { // match(Set dst (AndI (SubI imm_zero src) src))
+            int z = BMITests.blsil(ix);
+            for (int i = 0; i < ITERATIONS; i++) {
+                int ii = BMITests.blsil(ix);
+                if (ii != z) {
+                    throw new Error("blsil with register failed");
+                }
+            }
         }
-      }
-    }
-    { // match(Set dst (AndL (SubL imm_zero src) src))
-      long z = BMITests.blsiq(lx);
-      for (int i = 0; i < ITERATIONS; i++) {
-        long ll = BMITests.blsiq(lx);
-        if (ll != z) {
-          throw new Error("blsiq with register failed");
+        { // match(Set dst (AndL (SubL imm_zero src) src))
+            long z = BMITests.blsiq(lx);
+            for (int i = 0; i < ITERATIONS; i++) {
+                long ll = BMITests.blsiq(lx);
+                if (ll != z) {
+                    throw new Error("blsiq with register failed");
+                }
+            }
         }
-      }
-    }
-    { // match(Set dst (AndI (SubI imm_zero (LoadI src) ) (LoadI src) ))
-      int z = BMITests.blsil(imy);
-      for (int i = 0; i < ITERATIONS; i++) {
-        int ii = BMITests.blsil(imy);
-        if (ii != z) {
-          throw new Error("blsil with memory failed");
+        { // match(Set dst (AndI (SubI imm_zero (LoadI src) ) (LoadI src) ))
+            int z = BMITests.blsil(imy);
+            for (int i = 0; i < ITERATIONS; i++) {
+                int ii = BMITests.blsil(imy);
+                if (ii != z) {
+                    throw new Error("blsil with memory failed");
+                }
+            }
         }
-      }
-    }
-    { // match(Set dst (AndL (SubL imm_zero (LoadL src) ) (LoadL src) ))
-      long z = BMITests.blsiq(lmy);
-      for (int i = 0; i < ITERATIONS; i++) {
-        long ll = BMITests.blsiq(lmy);
-        if (ll != z) {
-          throw new Error("blsiq with memory failed");
+        { // match(Set dst (AndL (SubL imm_zero (LoadL src) ) (LoadL src) ))
+            long z = BMITests.blsiq(lmy);
+            for (int i = 0; i < ITERATIONS; i++) {
+                long ll = BMITests.blsiq(lmy);
+                if (ll != z) {
+                    throw new Error("blsiq with memory failed");
+                }
+            }
         }
-      }
+
+        { // match(Set dst (XorI (AddI src minus_1) src))
+            int z = BMITests.blsmskl(ix);
+            for (int i = 0; i < ITERATIONS; i++) {
+                int ii = BMITests.blsmskl(ix);
+                if (ii != z) {
+                    throw new Error("blsmskl with register failed");
+                }
+            }
+        }
+        { // match(Set dst (XorL (AddL src minus_1) src))
+            long z = BMITests.blsmskq(lx);
+            for (int i = 0; i < ITERATIONS; i++) {
+                long ll = BMITests.blsmskq(lx);
+                if (ll != z) {
+                    throw new Error("blsmskq with register failed");
+                }
+            }
+        }
+        { // match(Set dst (XorI (AddI (LoadI src) minus_1) (LoadI src) ) )
+            int z = BMITests.blsmskl(imy);
+            for (int i = 0; i < ITERATIONS; i++) {
+                int ii = BMITests.blsmskl(imy);
+                if (ii != z) {
+                    throw new Error("blsmskl with memory failed");
+                }
+            }
+        }
+        {  // match(Set dst (XorL (AddL (LoadL src) minus_1) (LoadL src) ) )
+            long z = BMITests.blsmskq(lmy);
+            for (int i = 0; i < ITERATIONS; i++) {
+                long ll = BMITests.blsmskq(lmy);
+                if (ll != z) {
+                    throw new Error("blsmskq with memory failed");
+                }
+            }
+        }
+
+        { //  match(Set dst (AndI (AddI src minus_1) src) )
+            int z = BMITests.blsrl(ix);
+            for (int i = 0; i < ITERATIONS; i++) {
+                int ii = BMITests.blsrl(ix);
+                if (ii != z) {
+                    throw new Error("blsrl with register failed");
+                }
+            }
+        }
+        { // match(Set dst (AndL (AddL src minus_1) src) )
+            long z = BMITests.blsrq(lx);
+            for (int i = 0; i < ITERATIONS; i++) {
+                long ll = BMITests.blsrq(lx);
+                if (ll != z) {
+                    throw new Error("blsrq with register failed");
+                }
+            }
+        }
+        { // match(Set dst (AndI (AddI (LoadI src) minus_1) (LoadI src) ) )
+            int z = BMITests.blsrl(imy);
+            for (int i = 0; i < ITERATIONS; i++) {
+                int ii = BMITests.blsrl(imy);
+                if (ii != z) {
+                    throw new Error("blsrl with memory failed");
+                }
+            }
+        }
+        { // match(Set dst (AndL (AddL (LoadL src) minus_1) (LoadL src)) )
+            long z = BMITests.blsrq(lmy);
+            for (int i = 0; i < ITERATIONS; i++) {
+                long ll = BMITests.blsrq(lmy);
+                if (ll != z) {
+                    throw new Error("blsrq with memory failed");
+                }
+            }
+        }
+
+        {
+            int z = BMITests.lzcntl(ix);
+            for (int i = 0; i < ITERATIONS; i++) {
+                int ii = BMITests.lzcntl(ix);
+                if (ii != z) {
+                    throw new Error("lzcntl failed");
+                }
+            }
+        }
+        {
+            int z = BMITests.lzcntq(lx);
+            for (int i = 0; i < ITERATIONS; i++) {
+                int ii = BMITests.lzcntq(lx);
+                if (ii != z) {
+                    throw new Error("lzcntq failed");
+                }
+            }
+        }
+
+        {
+            int z = BMITests.tzcntl(ix);
+            for (int i = 0; i < ITERATIONS; i++) {
+                int ii = BMITests.tzcntl(ix);
+                if (ii != z) {
+                    throw new Error("tzcntl failed");
+                }
+            }
+        }
+        {
+            int z = BMITests.tzcntq(lx);
+            for (int i = 0; i < ITERATIONS; i++) {
+                int ii = BMITests.tzcntq(lx);
+                if (ii != z) {
+                    throw new Error("tzcntq failed");
+                }
+            }
+        }
     }
 
-    { // match(Set dst (XorI (AddI src minus_1) src))
-      int z = BMITests.blsmskl(ix);
-      for (int i = 0; i < ITERATIONS; i++) {
-        int ii = BMITests.blsmskl(ix);
-        if (ii != z) {
-          throw new Error("blsmskl with register failed");
+    static class MemI {
+        public int x;
+
+        public MemI(int x) {
+            this.x = x;
         }
-      }
-    }
-    { // match(Set dst (XorL (AddL src minus_1) src))
-      long z = BMITests.blsmskq(lx);
-      for (int i = 0; i < ITERATIONS; i++) {
-        long ll = BMITests.blsmskq(lx);
-        if (ll != z) {
-          throw new Error("blsmskq with register failed");
-        }
-      }
-    }
-    { // match(Set dst (XorI (AddI (LoadI src) minus_1) (LoadI src) ) )
-      int z = BMITests.blsmskl(imy);
-      for (int i = 0; i < ITERATIONS; i++) {
-        int ii = BMITests.blsmskl(imy);
-        if (ii != z) {
-          throw new Error("blsmskl with memory failed");
-        }
-      }
-    }
-    {  // match(Set dst (XorL (AddL (LoadL src) minus_1) (LoadL src) ) )
-      long z = BMITests.blsmskq(lmy);
-      for (int i = 0; i < ITERATIONS; i++) {
-        long ll = BMITests.blsmskq(lmy);
-        if (ll != z) {
-          throw new Error("blsmskq with memory failed");
-        }
-      }
     }
 
-    { //  match(Set dst (AndI (AddI src minus_1) src) )
-      int z = BMITests.blsrl(ix);
-      for (int i = 0; i < ITERATIONS; i++) {
-        int ii = BMITests.blsrl(ix);
-        if (ii != z) {
-          throw new Error("blsrl with register failed");
+    static class MemL {
+        public long x;
+
+        public MemL(long x) {
+            this.x = x;
         }
-      }
-    }
-    { // match(Set dst (AndL (AddL src minus_1) src) )
-      long z = BMITests.blsrq(lx);
-      for (int i = 0; i < ITERATIONS; i++) {
-        long ll = BMITests.blsrq(lx);
-        if (ll != z) {
-          throw new Error("blsrq with register failed");
-        }
-      }
-    }
-    { // match(Set dst (AndI (AddI (LoadI src) minus_1) (LoadI src) ) )
-      int z = BMITests.blsrl(imy);
-      for (int i = 0; i < ITERATIONS; i++) {
-        int ii = BMITests.blsrl(imy);
-        if (ii != z) {
-          throw new Error("blsrl with memory failed");
-        }
-      }
-    }
-    { // match(Set dst (AndL (AddL (LoadL src) minus_1) (LoadL src)) )
-      long z = BMITests.blsrq(lmy);
-      for (int i = 0; i < ITERATIONS; i++) {
-        long ll = BMITests.blsrq(lmy);
-        if (ll != z) {
-          throw new Error("blsrq with memory failed");
-        }
-      }
     }
 
-    {
-      int z = BMITests.lzcntl(ix);
-      for (int i = 0; i < ITERATIONS; i++) {
-        int ii = BMITests.lzcntl(ix);
-        if (ii != z) {
-          throw new Error("lzcntl failed");
+    static class BMITests {
+        static int andnl(int src1, int src2) {
+            return ~src1 & src2;
         }
-      }
-    }
-    {
-      int z = BMITests.lzcntq(lx);
-      for (int i = 0; i < ITERATIONS; i++) {
-        int ii = BMITests.lzcntq(lx);
-        if (ii != z) {
-          throw new Error("lzcntq failed");
-        }
-      }
-    }
 
-    {
-      int z = BMITests.tzcntl(ix);
-      for (int i = 0; i < ITERATIONS; i++) {
-        int ii = BMITests.tzcntl(ix);
-        if (ii != z) {
-          throw new Error("tzcntl failed");
+        static long andnq(long src1, long src2) {
+            return ~src1 & src2;
         }
-      }
-    }
-    {
-      int z = BMITests.tzcntq(lx);
-      for (int i = 0; i < ITERATIONS; i++) {
-        int ii = BMITests.tzcntq(lx);
-        if (ii != z) {
-          throw new Error("tzcntq failed");
+
+        static int andnl(int src1, MemI src2) {
+            return ~src1 & src2.x;
         }
-      }
+
+        static long andnq(long src1, MemL src2) {
+            return ~src1 & src2.x;
+        }
+
+        static int blsil(int src1) {
+            return src1 & -src1;
+        }
+
+        static long blsiq(long src1) {
+            return src1 & -src1;
+        }
+
+        static int blsil(MemI src1) {
+            return src1.x & -src1.x;
+        }
+
+        static long blsiq(MemL src1) {
+            return src1.x & -src1.x;
+        }
+
+        static int blsmskl(int src1) {
+            return (src1 - 1) ^ src1;
+        }
+
+        static long blsmskq(long src1) {
+            return (src1 - 1) ^ src1;
+        }
+
+        static int blsmskl(MemI src1) {
+            return (src1.x - 1) ^ src1.x;
+        }
+
+        static long blsmskq(MemL src1) {
+            return (src1.x - 1) ^ src1.x;
+        }
+
+        static int blsrl(int src1) {
+            return (src1 - 1) & src1;
+        }
+
+        static long blsrq(long src1) {
+            return (src1 - 1) & src1;
+        }
+
+        static int blsrl(MemI src1) {
+            return (src1.x - 1) & src1.x;
+        }
+
+        static long blsrq(MemL src1) {
+            return (src1.x - 1) & src1.x;
+        }
+
+        static int lzcntl(int src1) {
+            return Integer.numberOfLeadingZeros(src1);
+        }
+
+        static int lzcntq(long src1) {
+            return Long.numberOfLeadingZeros(src1);
+        }
+
+        static int tzcntl(int src1) {
+            return Integer.numberOfTrailingZeros(src1);
+        }
+
+        static int tzcntq(long src1) {
+            return Long.numberOfTrailingZeros(src1);
+        }
     }
-  }
 }
diff --git a/hotspot/test/compiler/codegen/8144028/BitTests.java b/hotspot/test/compiler/codegen/BitTests.java
similarity index 80%
rename from hotspot/test/compiler/codegen/8144028/BitTests.java
rename to hotspot/test/compiler/codegen/BitTests.java
index d00b048..89397c1 100644
--- a/hotspot/test/compiler/codegen/8144028/BitTests.java
+++ b/hotspot/test/compiler/codegen/BitTests.java
@@ -25,13 +25,18 @@
  * @test
  * @bug 8144028
  * @summary Use AArch64 bit-test instructions in C2
- * @modules java.base
- * @run main/othervm -Xbatch -XX:CompileCommand=dontinline,BitTests::* -XX:-TieredCompilation BitTests
- * @run main/othervm -Xbatch -XX:+TieredCompilation -XX:TieredStopAtLevel=1 BitTests
- * @run main/othervm -Xbatch -XX:+TieredCompilation BitTests
  *
+ * @run main/othervm -Xbatch -XX:-TieredCompilation
+ *      -XX:CompileCommand=dontinline,compiler.codegen.BitTests::*
+ *      compiler.codegen.BitTests
+ * @run main/othervm -Xbatch -XX:+TieredCompilation -XX:TieredStopAtLevel=1
+ *      compiler.codegen.BitTests
+ * @run main/othervm -Xbatch -XX:+TieredCompilation
+ *      compiler.codegen.BitTests
  */
 
+package compiler.codegen;
+
 // Try to ensure that the bit test instructions TBZ/TBNZ, TST/TSTW
 // don't generate incorrect code.  We can't guarantee that C2 will use
 // bit test instructions for this test and it's not a bug if it
@@ -50,7 +55,7 @@
     }
 
     private final long testIntSignedBranch(long counter) {
-        if ((int)r.nextLong() < 0) {
+        if ((int) r.nextLong() < 0) {
             counter = increment(counter);
         }
         return counter;
@@ -64,10 +69,10 @@
     }
 
     private final long testIntBitBranch(long counter) {
-        if (((int)r.nextLong() & (1 << 27)) != 0) {
+        if (((int) r.nextLong() & (1 << 27)) != 0) {
             counter = increment(counter);
         }
-        if (((int)r.nextLong() & (1 << 27)) != 0) {
+        if (((int) r.nextLong() & (1 << 27)) != 0) {
             counter = increment(counter);
         }
         return counter;
@@ -87,11 +92,11 @@
         if (((r.nextLong() & 0x0800000000l) != 0)) {
             counter++;
         }
-       return counter;
+        return counter;
     }
 
     private final long testIntMaskBranch(long counter) {
-        if ((((int)r.nextLong() & 0x08) != 0)) {
+        if ((((int) r.nextLong() & 0x08) != 0)) {
             counter++;
         }
         return counter;
@@ -101,11 +106,11 @@
         if (((r.nextLong() & mask) != 0)) {
             counter++;
         }
-       return counter;
+        return counter;
     }
 
     private final long testIntMaskBranch(long counter, int mask) {
-        if ((((int)r.nextLong() & mask) != 0)) {
+        if ((((int) r.nextLong() & mask) != 0)) {
             counter++;
         }
         return counter;
@@ -142,23 +147,22 @@
         System.out.println("PASSED");
     }
 
-}
+    // Marsaglia's xor-shift generator, used here because it is
+    // reproducible across all Java implementations.  It is also very
+    // fast.
+    static class XorShift {
 
-// Marsaglia's xor-shift generator, used here because it is
-// reproducible across all Java implementations.  It is also very
-// fast.
-class XorShift {
+        private long y;
 
-    private long y;
+        XorShift() {
+            y = 2463534242l;
+        }
 
-    XorShift() {
-        y = 2463534242l;
-    }
+        public long nextLong() {
+            y ^= (y << 13);
+            y ^= (y >>> 17);
+            return (y ^= (y << 5));
 
-    public long nextLong() {
-        y ^= (y << 13);
-        y ^= (y >>> 17);
-        return (y ^= (y << 5));
-
+        }
     }
 }
diff --git a/hotspot/test/compiler/codegen/C1NullCheckOfNullStore.java b/hotspot/test/compiler/codegen/C1NullCheckOfNullStore.java
index 0bec2c1..67ddccc 100644
--- a/hotspot/test/compiler/codegen/C1NullCheckOfNullStore.java
+++ b/hotspot/test/compiler/codegen/C1NullCheckOfNullStore.java
@@ -25,33 +25,39 @@
  * @test
  * @bug 8039043
  * @summary Null check is placed in a wrong place when storing a null to an object field on x64 with compressed oops off
- * @run main/othervm -Xbatch -XX:+IgnoreUnrecognizedVMOptions -XX:CompileCommand=compileonly,C1NullCheckOfNullStore::test -XX:+TieredCompilation -XX:TieredStopAtLevel=1 -XX:-UseCompressedOops C1NullCheckOfNullStore
  *
+ * @run main/othervm -Xbatch -XX:+IgnoreUnrecognizedVMOptions
+ *    -XX:+TieredCompilation -XX:TieredStopAtLevel=1 -XX:-UseCompressedOops
+ *    -XX:CompileCommand=compileonly,compiler.codegen.C1NullCheckOfNullStore::test
+ *    compiler.codegen.C1NullCheckOfNullStore
  */
 
+package compiler.codegen;
+
 public class C1NullCheckOfNullStore {
-  private static class Foo {
-    Object bar;
-  }
-  static private void test(Foo x) {
-    x.bar = null;
-  }
-  static public void main(String args[]) {
-    Foo x = new Foo();
-    for (int i = 0; i < 10000; i++) {
-      test(x);
+    private static class Foo {
+        Object bar;
     }
-    boolean gotNPE = false;
-    try {
-      for (int i = 0; i < 10000; i++) {
-        test(null);
-      }
+
+    static private void test(Foo x) {
+        x.bar = null;
     }
-    catch(NullPointerException e) {
-      gotNPE = true;
+
+    static public void main(String args[]) {
+        Foo x = new Foo();
+        for (int i = 0; i < 10000; i++) {
+            test(x);
+        }
+        boolean gotNPE = false;
+        try {
+            for (int i = 0; i < 10000; i++) {
+                test(null);
+            }
+        } catch (NullPointerException e) {
+            gotNPE = true;
+        }
+        if (!gotNPE) {
+            throw new Error("Expecting a NullPointerException");
+        }
     }
-    if (!gotNPE) {
-      throw new Error("Expecting a NullPointerException");
-    }
-  }
 }
diff --git a/hotspot/test/compiler/codegen/7088419/CRCTest.java b/hotspot/test/compiler/codegen/CRCTest.java
similarity index 96%
rename from hotspot/test/compiler/codegen/7088419/CRCTest.java
rename to hotspot/test/compiler/codegen/CRCTest.java
index fa1f520..950e9ad 100644
--- a/hotspot/test/compiler/codegen/7088419/CRCTest.java
+++ b/hotspot/test/compiler/codegen/CRCTest.java
@@ -22,12 +22,15 @@
  */
 
 /*
-   @test
-   @bug 7088419
-   @run main CRCTest
-   @summary Use x86 Hardware CRC32 Instruction with java.util.zip.CRC32 and java.util.zip.Adler32
+ * @test
+ * @bug 7088419
+ * @summary Use x86 Hardware CRC32 Instruction with java.util.zip.CRC32 and java.util.zip.Adler32
+ *
+ * @run main compiler.codegen.CRCTest
  */
 
+package compiler.codegen;
+
 import java.nio.ByteBuffer;
 import java.util.zip.CRC32;
 import java.util.zip.Checksum;
diff --git a/hotspot/test/compiler/codegen/IntRotateWithImmediate.java b/hotspot/test/compiler/codegen/IntRotateWithImmediate.java
index 3da2aec..ae8ef23 100644
--- a/hotspot/test/compiler/codegen/IntRotateWithImmediate.java
+++ b/hotspot/test/compiler/codegen/IntRotateWithImmediate.java
@@ -28,51 +28,54 @@
  * @bug 8154537
  * @key regression
  * @summary Test that the rotate distance used in the rotate instruction is properly masked with 0x1f
- * @run main/othervm -Xbatch -XX:-UseOnStackReplacement IntRotateWithImmediate
+ *
+ * @run main/othervm -Xbatch -XX:-UseOnStackReplacement compiler.codegen.IntRotateWithImmediate
  * @author volker.simonis@gmail.com
  */
 
+package compiler.codegen;
+
 public class IntRotateWithImmediate {
 
-  // This is currently the same as Integer.rotateRight()
-  static int rotateRight1(int i, int distance) {
-    // On some architectures (i.e. x86_64 and ppc64) the following computation is
-    // matched in the .ad file into a single MachNode which emmits a single rotate
-    // machine instruction. It is important that the shift amount is masked to match
-    // corresponding immediate width in the native instruction. On x86_64 the rotate
-    // left instruction ('rol') encodes an 8-bit immediate while the corresponding
-    // 'rotlwi' instruction on Power only encodes a 5-bit immediate.
-    return ((i >>> distance) | (i << -distance));
-  }
-
-  static int rotateRight2(int i, int distance) {
-      return ((i >>> distance) | (i << (32-distance)));
-  }
-
-  static int compute1(int x) {
-    return rotateRight1(x, 3);
-  }
-
-  static int compute2(int x) {
-    return rotateRight2(x, 3);
-  }
-
-  public static void main(String args[]) {
-    int val = 4096;
-
-    int firstResult = compute1(val);
-
-    for (int i = 0; i < 100000; i++) {
-      int newResult = compute1(val);
-      if (firstResult != newResult) {
-        throw new InternalError(firstResult + " != " + newResult);
-      }
-      newResult = compute2(val);
-      if (firstResult != newResult) {
-        throw new InternalError(firstResult + " != " + newResult);
-      }
+    // This is currently the same as Integer.rotateRight()
+    static int rotateRight1(int i, int distance) {
+        // On some architectures (i.e. x86_64 and ppc64) the following computation is
+        // matched in the .ad file into a single MachNode which emmits a single rotate
+        // machine instruction. It is important that the shift amount is masked to match
+        // corresponding immediate width in the native instruction. On x86_64 the rotate
+        // left instruction ('rol') encodes an 8-bit immediate while the corresponding
+        // 'rotlwi' instruction on Power only encodes a 5-bit immediate.
+        return ((i >>> distance) | (i << -distance));
     }
-    System.out.println("OK");
-  }
+
+    static int rotateRight2(int i, int distance) {
+        return ((i >>> distance) | (i << (32 - distance)));
+    }
+
+    static int compute1(int x) {
+        return rotateRight1(x, 3);
+    }
+
+    static int compute2(int x) {
+        return rotateRight2(x, 3);
+    }
+
+    public static void main(String args[]) {
+        int val = 4096;
+
+        int firstResult = compute1(val);
+
+        for (int i = 0; i < 100000; i++) {
+            int newResult = compute1(val);
+            if (firstResult != newResult) {
+                throw new InternalError(firstResult + " != " + newResult);
+            }
+            newResult = compute2(val);
+            if (firstResult != newResult) {
+                throw new InternalError(firstResult + " != " + newResult);
+            }
+        }
+        System.out.println("OK");
+    }
 
 }
diff --git a/hotspot/test/compiler/codegen/LoadWithMask.java b/hotspot/test/compiler/codegen/LoadWithMask.java
index 06c4c14..bea0df8 100644
--- a/hotspot/test/compiler/codegen/LoadWithMask.java
+++ b/hotspot/test/compiler/codegen/LoadWithMask.java
@@ -25,20 +25,26 @@
  * @test
  * @bug 8032207
  * @summary Invalid node sizing for loadUS2L_immI16 and loadI2L_immI
- * @run main/othervm -Xbatch -XX:CompileCommand=compileonly,LoadWithMask.foo LoadWithMask
  *
+ * @run main/othervm -Xbatch
+ *      -XX:CompileCommand=compileonly,compiler.codegen.LoadWithMask::foo
+ *      compiler.codegen.LoadWithMask
  */
-public class LoadWithMask {
-  static int x[] = new int[1];
-  static long foo() {
-    return x[0] & 0xfff0ffff;
-  }
 
-  public static void main(String[] args) {
-    x[0] = -1;
-    long l = 0;
-    for (int i = 0; i < 100000; ++i) {
-      l = foo();
+package compiler.codegen;
+
+public class LoadWithMask {
+    static int x[] = new int[1];
+
+    static long foo() {
+        return x[0] & 0xfff0ffff;
     }
-  }
+
+    public static void main(String[] args) {
+        x[0] = -1;
+        long l = 0;
+        for (int i = 0; i < 100000; ++i) {
+            l = foo();
+        }
+    }
 }
diff --git a/hotspot/test/compiler/codegen/LoadWithMask2.java b/hotspot/test/compiler/codegen/LoadWithMask2.java
index 82c942d..840e321 100644
--- a/hotspot/test/compiler/codegen/LoadWithMask2.java
+++ b/hotspot/test/compiler/codegen/LoadWithMask2.java
@@ -25,31 +25,39 @@
  * @test
  * @bug 8031743
  * @summary loadI2L_immI broken for negative memory values
- * @run main/othervm -Xbatch -XX:CompileCommand=compileonly,*.foo* LoadWithMask2
  *
+ * @run main/othervm -Xbatch
+ *      -XX:CompileCommand=compileonly,compiler.codegen.LoadWithMask2::foo*
+ *      compiler.codegen.LoadWithMask2
  */
-public class LoadWithMask2 {
-  static int x;
-  static long foo1() {
-    return x & 0xfffffffe;
-  }
-  static long foo2() {
-    return x & 0xff000000;
-  }
-  static long foo3() {
-    return x & 0x8abcdef1;
-  }
 
-  public static void main(String[] args) {
-    x = -1;
-    long l = 0;
-    for (int i = 0; i < 100000; ++i) {
-      l = foo1() & foo2() & foo3();
+package compiler.codegen;
+
+public class LoadWithMask2 {
+    static int x;
+
+    static long foo1() {
+        return x & 0xfffffffe;
     }
-    if (l > 0) {
-      System.out.println("FAILED");
-      System.exit(97);
+
+    static long foo2() {
+        return x & 0xff000000;
     }
-    System.out.println("PASSED");
-  }
+
+    static long foo3() {
+        return x & 0x8abcdef1;
+    }
+
+    public static void main(String[] args) {
+        x = -1;
+        long l = 0;
+        for (int i = 0; i < 100000; ++i) {
+            l = foo1() & foo2() & foo3();
+        }
+        if (l > 0) {
+            System.out.println("FAILED");
+            System.exit(97);
+        }
+        System.out.println("PASSED");
+    }
 }
diff --git a/hotspot/test/compiler/codegen/6378821/Test6378821.java b/hotspot/test/compiler/codegen/Test6378821.java
similarity index 94%
rename from hotspot/test/compiler/codegen/6378821/Test6378821.java
rename to hotspot/test/compiler/codegen/Test6378821.java
index 2010d72..e8ebe5f 100644
--- a/hotspot/test/compiler/codegen/6378821/Test6378821.java
+++ b/hotspot/test/compiler/codegen/Test6378821.java
@@ -26,9 +26,13 @@
  * @bug 6378821
  * @summary where available, bitCount() should use POPC on SPARC processors and AMD+10h
  *
- * @run main/othervm -Xcomp -XX:CompileOnly=Test6378821.fcomp Test6378821
+ * @run main/othervm -Xcomp
+ *      -XX:CompileCommand=compileonly,compiler.codegen.Test6378821::fcomp
+ *      compiler.codegen.Test6378821
  */
 
+package compiler.codegen;
+
 public class Test6378821 {
     static final int[]  ia = new int[]  { 0x12345678 };
     static final long[] la = new long[] { 0x12345678abcdefL };
diff --git a/hotspot/test/compiler/codegen/Test6431242.java b/hotspot/test/compiler/codegen/Test6431242.java
new file mode 100644
index 0000000..68b92a9
--- /dev/null
+++ b/hotspot/test/compiler/codegen/Test6431242.java
@@ -0,0 +1,179 @@
+/*
+ * Copyright (c) 2006, 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.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ *
+ */
+
+/*
+ * @test
+ * @bug 6431242
+ *
+ * @run main compiler.codegen.Test6431242
+ */
+
+package compiler.codegen;
+
+public class Test6431242 {
+
+    int _len = 8;
+    int[] _arr_i = new int[_len];
+    long[] _arr_l = new long[_len];
+
+    int[] _arr_i_cp = new int[_len];
+    long[] _arr_l_cp = new long[_len];
+
+    int _k = 0x12345678;
+    int _j = 0;
+    int _ir = 0x78563412;
+    int _ir1 = 0x78563413;
+    int _ir2 = 0x79563412;
+
+    long _m = 0x123456789abcdef0L;
+    long _l = 0L;
+    long _lr = 0xf0debc9a78563412L;
+    long _lr1 = 0xf0debc9a78563413L;
+    long _lr2 = 0xf1debc9a78563412L;
+
+    void init() {
+        for (int i = 0; i < _arr_i.length; i++) {
+            _arr_i[i] = _k;
+            _arr_l[i] = _m;
+        }
+    }
+
+    public int test_int_reversed(int i) {
+        return Integer.reverseBytes(i);
+    }
+
+    public long test_long_reversed(long i) {
+        return Long.reverseBytes(i);
+    }
+
+    public void test_copy_ints(int[] dst, int[] src) {
+        for (int i = 0; i < src.length; i++) {
+            dst[i] = Integer.reverseBytes(src[i]);
+        }
+    }
+
+    public void test_copy_ints_reversed(int[] dst, int[] src) {
+        for (int i = 0; i < src.length; i++) {
+            dst[i] = 1 + Integer.reverseBytes(src[i]);
+        }
+    }
+
+    public void test_copy_ints_store_reversed(int[] dst, int[] src) {
+        for (int i = 0; i < src.length; i++) {
+            dst[i] = Integer.reverseBytes(1 + src[i]);
+        }
+    }
+
+    public void test_copy_longs(long[] dst, long[] src) {
+        for (int i = 0; i < src.length; i++) {
+            dst[i] = Long.reverseBytes(src[i]);
+        }
+    }
+
+    public void test_copy_longs_reversed(long[] dst, long[] src) {
+        for (int i = 0; i < src.length; i++) {
+            dst[i] = 1 + Long.reverseBytes(src[i]);
+        }
+    }
+
+    public void test_copy_longs_store_reversed(long[] dst, long[] src) {
+        for (int i = 0; i < src.length; i++) {
+            dst[i] = Long.reverseBytes(1 + src[i]);
+        }
+    }
+
+    public void test() throws Exception {
+        int up_limit = 90000;
+
+
+        //test single
+
+        for (int loop = 0; loop < up_limit; loop++) {
+            _j = test_int_reversed(_k);
+            if (_j != _ir) {
+                throw new Exception("Interger.reverseBytes failed " + _j + " iter " + loop);
+            }
+            _l = test_long_reversed(_m);
+            if (_l != _lr) {
+                throw new Exception("Long.reverseBytes failed " + _l + " iter " + loop);
+            }
+        }
+
+        // test scalar load/store
+        for (int loop = 0; loop < up_limit; loop++) {
+
+            test_copy_ints(_arr_i_cp, _arr_i);
+            for (int j = 0; j < _arr_i.length; j++) {
+                if (_arr_i_cp[j] != _ir) {
+                    throw new Exception("Interger.reverseBytes failed test_copy_ints iter " + loop);
+                }
+            }
+
+            test_copy_ints_reversed(_arr_i_cp, _arr_i);
+            for (int j = 0; j < _arr_i.length; j++) {
+                if (_arr_i_cp[j] != _ir1) {
+                    throw new Exception("Interger.reverseBytes failed test_copy_ints_reversed iter " + loop);
+                }
+            }
+            test_copy_ints_store_reversed(_arr_i_cp, _arr_i);
+            for (int j = 0; j < _arr_i.length; j++) {
+                if (_arr_i_cp[j] != _ir2) {
+                    throw new Exception("Interger.reverseBytes failed test_copy_ints_store_reversed iter " + loop);
+                }
+            }
+
+            test_copy_longs(_arr_l_cp, _arr_l);
+            for (int j = 0; j < _arr_i.length; j++) {
+                if (_arr_l_cp[j] != _lr) {
+                    throw new Exception("Long.reverseBytes failed test_copy_longs iter " + loop);
+                }
+            }
+            test_copy_longs_reversed(_arr_l_cp, _arr_l);
+            for (int j = 0; j < _arr_i.length; j++) {
+                if (_arr_l_cp[j] != _lr1) {
+                    throw new Exception("Long.reverseBytes failed test_copy_longs_reversed iter " + loop);
+                }
+            }
+            test_copy_longs_store_reversed(_arr_l_cp, _arr_l);
+            for (int j = 0; j < _arr_i.length; j++) {
+                if (_arr_l_cp[j] != _lr2) {
+                    throw new Exception("Long.reverseBytes failed test_copy_longs_store_reversed iter " + loop);
+                }
+            }
+
+        }
+    }
+
+    public static void main(String args[]) {
+        try {
+            Test6431242 t = new Test6431242();
+            t.init();
+            t.test();
+            System.out.println("Passed");
+        } catch (Exception e) {
+            e.printStackTrace();
+            System.out.println("Failed");
+        }
+    }
+}
diff --git a/hotspot/test/compiler/codegen/6797305/Test6797305.java b/hotspot/test/compiler/codegen/Test6797305.java
similarity index 92%
rename from hotspot/test/compiler/codegen/6797305/Test6797305.java
rename to hotspot/test/compiler/codegen/Test6797305.java
index 139c165..7c51e03 100644
--- a/hotspot/test/compiler/codegen/6797305/Test6797305.java
+++ b/hotspot/test/compiler/codegen/Test6797305.java
@@ -26,9 +26,13 @@
  * @bug 6797305
  * @summary Add LoadUB and LoadUI opcode class
  *
- * @run main/othervm -Xcomp -XX:CompileOnly=Test6797305.loadB,Test6797305.loadB2L,Test6797305.loadUB,Test6797305.loadUBmask,Test6797305.loadUB2L,Test6797305.loadS,Test6797305.loadS2L,Test6797305.loadUS,Test6797305.loadUSmask,Test6797305.loadUS2L,Test6797305.loadI,Test6797305.loadI2L,Test6797305.loadUI2L,Test6797305.loadL Test6797305
+ * @run main/othervm -Xcomp
+ *      -XX:CompileCommand=compileonly,compiler.codegen.Test6797305::load*
+ *      compiler.codegen.Test6797305
  */
 
+package compiler.codegen;
+
 public class Test6797305 {
     static final byte[]  ba = new byte[]  { -1 };
     static final short[] sa = new short[] { -1 };
diff --git a/hotspot/test/compiler/codegen/6814842/Test6814842.java b/hotspot/test/compiler/codegen/Test6814842.java
similarity index 92%
rename from hotspot/test/compiler/codegen/6814842/Test6814842.java
rename to hotspot/test/compiler/codegen/Test6814842.java
index a7c8b44..9f35df6 100644
--- a/hotspot/test/compiler/codegen/6814842/Test6814842.java
+++ b/hotspot/test/compiler/codegen/Test6814842.java
@@ -26,9 +26,13 @@
  * @bug 6814842
  * @summary Load shortening optimizations
  *
- * @run main/othervm -Xcomp -XX:CompileOnly=Test6814842.loadS2B,Test6814842.loadS2Bmask255,Test6814842.loadUS2B,Test6814842.loadUS2Bmask255,Test6814842.loadI2B,Test6814842.loadI2Bmask255,Test6814842.loadI2S,Test6814842.loadI2Smask255,Test6814842.loadI2Smask65535,Test6814842.loadI2US,Test6814842.loadI2USmask255,Test6814842.loadI2USmask65535 Test6814842
+ * @run main/othervm -Xcomp
+ *      -XX:CompileCommand=compileonly,compiler.codegen.Test6814842::load*
+ *      compiler.codegen.Test6814842
  */
 
+package compiler.codegen;
+
 public class Test6814842 {
     static final short[] sa = new short[] { (short) 0xF1F2 };
     static final char[]  ca = new char[]  { (char) 0xF3F4  };
diff --git a/hotspot/test/compiler/codegen/6823354/Test6823354.java b/hotspot/test/compiler/codegen/Test6823354.java
similarity index 92%
rename from hotspot/test/compiler/codegen/6823354/Test6823354.java
rename to hotspot/test/compiler/codegen/Test6823354.java
index 1ba60e1..7ff6f2c 100644
--- a/hotspot/test/compiler/codegen/6823354/Test6823354.java
+++ b/hotspot/test/compiler/codegen/Test6823354.java
@@ -27,9 +27,17 @@
  * @summary These methods can be instrinsified by using bit scan, bit test, and population count instructions.
  * @modules java.base/jdk.internal.misc
  * @library /testlibrary
- * @run main/othervm -Xcomp -XX:CompileOnly=Test6823354.lzcomp,Test6823354.tzcomp,.dolzcomp,.dotzcomp Test6823354
+ *
+ * @run main/othervm -Xcomp
+ *      -XX:CompileCommand=compileonly,compiler.codegen.Test6823354::lzcomp
+ *      -XX:CompileCommand=compileonly,compiler.codegen.Test6823354::tzcomp
+ *      -XX:CompileCommand=compileonly,compiler.codegen.*::dolzcomp
+ *      -XX:CompileCommand=compileonly,compiler.codegen.*::dotzcomp
+ *      compiler.codegen.Test6823354
  */
 
+package compiler.codegen;
+
 import jdk.test.lib.Utils;
 
 public class Test6823354 {
@@ -63,7 +71,7 @@
             check(x, lzcomp(x), lzint(x));
         }
 
-        String classname = "Test6823354$lzconI";
+        String classname = Test6823354.class.getName() + "$lzconI";
 
         // Test Ideal optimizations (constant values).
         for (int i = 0; i < ia.length; i++) {
@@ -91,7 +99,7 @@
             check(x, lzcomp(x), lzint(x));
         }
 
-        classname = "Test6823354$lzconL";
+        classname = Test6823354.class.getName() + "$lzconL";
 
         // Test Ideal optimizations (constant values).
         for (int i = 0; i < la.length; i++) {
@@ -120,7 +128,7 @@
             check(x, tzcomp(x), tzint(x));
         }
 
-        String classname = "Test6823354$tzconI";
+        String classname = Test6823354.class.getName() + "$tzconI";
 
         // Test Ideal optimizations (constant values).
         for (int i = 0; i < ia.length; i++) {
@@ -148,7 +156,7 @@
             check(x, tzcomp(x), tzint(x));
         }
 
-        classname = "Test6823354$tzconL";
+        classname = Test6823354.class.getName() + "$tzconL";
 
         // Test Ideal optimizations (constant values).
         for (int i = 0; i < la.length; i++) {
diff --git a/hotspot/test/compiler/codegen/6875866/Test.java b/hotspot/test/compiler/codegen/Test6875866.java
similarity index 72%
rename from hotspot/test/compiler/codegen/6875866/Test.java
rename to hotspot/test/compiler/codegen/Test6875866.java
index 8b9da1a..9c10fb2 100644
--- a/hotspot/test/compiler/codegen/6875866/Test.java
+++ b/hotspot/test/compiler/codegen/Test6875866.java
@@ -26,21 +26,24 @@
  * @bug 6875866
  * @summary Intrinsic for String.indexOf() is broken on x86 with SSE4.2
  *
- * @run main/othervm -Xcomp Test
+ * @run main/othervm -Xcomp compiler.codegen.Test6875866
  */
 
-public class Test {
 
-  static int IndexOfTest(String str) {
-    return str.indexOf("11111xx1x");
-  }
+package compiler.codegen;
 
-  public static void main(String args[]) {
-    String str = "11111xx11111xx1x";
-    int idx = IndexOfTest(str);
-    System.out.println("IndexOf = " + idx);
-    if (idx != 7) {
-      System.exit(97);
+public class Test6875866 {
+
+    static int IndexOfTest(String str) {
+        return str.indexOf("11111xx1x");
     }
-  }
+
+    public static void main(String args[]) {
+        String str = "11111xx11111xx1x";
+        int idx = IndexOfTest(str);
+        System.out.println("IndexOf = " + idx);
+        if (idx != 7) {
+            System.exit(97);
+        }
+    }
 }
diff --git a/hotspot/test/compiler/codegen/6879902/Test6879902.java b/hotspot/test/compiler/codegen/Test6879902.java
similarity index 98%
rename from hotspot/test/compiler/codegen/6879902/Test6879902.java
rename to hotspot/test/compiler/codegen/Test6879902.java
index 5e39119..4156d74 100644
--- a/hotspot/test/compiler/codegen/6879902/Test6879902.java
+++ b/hotspot/test/compiler/codegen/Test6879902.java
@@ -26,9 +26,11 @@
  * @bug 6879902
  * @summary CTW failure jdk6_18/hotspot/src/cpu/sparc/vm/assembler_sparc.hpp:845
  *
- * @run main Test6879902
+ * @run main compiler.codegen.Test6879902
  */
 
+package compiler.codegen;
+
 import java.util.Arrays;
 
 public class Test6879902 {
diff --git a/hotspot/test/compiler/codegen/6896617/Test6896617.java b/hotspot/test/compiler/codegen/Test6896617.java
similarity index 98%
rename from hotspot/test/compiler/codegen/6896617/Test6896617.java
rename to hotspot/test/compiler/codegen/Test6896617.java
index c83a22a..90e4854 100644
--- a/hotspot/test/compiler/codegen/6896617/Test6896617.java
+++ b/hotspot/test/compiler/codegen/Test6896617.java
@@ -29,11 +29,14 @@
  * @modules java.base/jdk.internal.misc
  *          java.base/sun.nio.cs
  *          java.management
- * @run main/othervm/timeout=1200 -Xbatch -Xmx256m Test6896617
  *
+ * @run main/othervm/timeout=1200 -Xbatch -Xmx256m compiler.codegen.Test6896617
  */
 
+package compiler.codegen;
+
 import jdk.test.lib.Utils;
+
 import java.nio.ByteBuffer;
 import java.nio.CharBuffer;
 import java.nio.charset.Charset;
diff --git a/hotspot/test/compiler/codegen/6909839/Test6909839.java b/hotspot/test/compiler/codegen/Test6909839.java
similarity index 98%
rename from hotspot/test/compiler/codegen/6909839/Test6909839.java
rename to hotspot/test/compiler/codegen/Test6909839.java
index 78b5ce5..daea8b7 100644
--- a/hotspot/test/compiler/codegen/6909839/Test6909839.java
+++ b/hotspot/test/compiler/codegen/Test6909839.java
@@ -27,9 +27,11 @@
  * @bug 6909839
  * @summary missing unsigned compare cases for some cmoves in sparc.ad
  *
- * @run main/othervm -XX:+AggressiveOpts -Xbatch Test6909839
+ * @run main/othervm -XX:+AggressiveOpts -Xbatch compiler.codegen.Test6909839
  */
 
+package compiler.codegen;
+
 public class Test6909839 {
     public static void main(String[] args) {
         testi();
diff --git a/hotspot/test/compiler/codegen/6935535/Test.java b/hotspot/test/compiler/codegen/Test6935535.java
similarity index 68%
rename from hotspot/test/compiler/codegen/6935535/Test.java
rename to hotspot/test/compiler/codegen/Test6935535.java
index a2576c2..815e972 100644
--- a/hotspot/test/compiler/codegen/6935535/Test.java
+++ b/hotspot/test/compiler/codegen/Test6935535.java
@@ -26,23 +26,25 @@
  * @bug 6935535
  * @summary String.indexOf() returns incorrect result on x86 with SSE4.2
  *
- * @run main/othervm -Xcomp Test
+ * @run main/othervm -Xcomp compiler.codegen.Test6935535
  */
 
-public class Test {
+package compiler.codegen;
 
-  static int IndexOfTest(String str) {
-    return str.indexOf("1111111111111xx1x");
-  }
+public class Test6935535 {
 
-  public static void main(String args[]) {
-    String str = "1111111111111xx1111111111111xx1x";
-    str = str.substring(0, 31);
-    int idx = IndexOfTest(str);
-    System.out.println("IndexOf(" + "1111111111111xx1x" + ") = " + idx + " in " + str);
-    if (idx != -1) {
-      System.exit(97);
+    static int IndexOfTest(String str) {
+        return str.indexOf("1111111111111xx1x");
     }
-  }
+
+    public static void main(String args[]) {
+        String str = "1111111111111xx1111111111111xx1x";
+        str = str.substring(0, 31);
+        int idx = IndexOfTest(str);
+        System.out.println("IndexOf(" + "1111111111111xx1x" + ") = " + idx + " in " + str);
+        if (idx != -1) {
+            System.exit(97);
+        }
+    }
 }
 
diff --git a/hotspot/test/compiler/codegen/6942326/Test.java b/hotspot/test/compiler/codegen/Test6942326.java
similarity index 95%
rename from hotspot/test/compiler/codegen/6942326/Test.java
rename to hotspot/test/compiler/codegen/Test6942326.java
index cd3d97e..08e754d 100644
--- a/hotspot/test/compiler/codegen/6942326/Test.java
+++ b/hotspot/test/compiler/codegen/Test6942326.java
@@ -27,11 +27,20 @@
  * @bug 6942326
  * @summary x86 code in string_indexof() could read beyond reserved heap space
  *
- * @run main/othervm/timeout=300 -Xmx32m -Xbatch -XX:+IgnoreUnrecognizedVMOptions -XX:CompileCommand=exclude,Test,main -XX:CompileCommand=exclude,Test,test_varsub_indexof -XX:CompileCommand=exclude,Test,test_varstr_indexof -XX:CompileCommand=exclude,Test,test_missub_indexof -XX:CompileCommand=exclude,Test,test_consub_indexof -XX:CompileCommand=exclude,Test,test_conmis_indexof -XX:CompileCommand=exclude,Test,test_subcon Test
- *
+ * @run main/othervm/timeout=300 -Xmx32m -Xbatch -XX:+IgnoreUnrecognizedVMOptions
+ *      -XX:CompileCommand=exclude,compiler.codegen.Test6942326::main
+ *      -XX:CompileCommand=exclude,compiler.codegen.Test6942326::test_varsub_indexof
+ *      -XX:CompileCommand=exclude,compiler.codegen.Test6942326::test_varstr_indexof
+ *      -XX:CompileCommand=exclude,compiler.codegen.Test6942326::test_missub_indexof
+ *      -XX:CompileCommand=exclude,compiler.codegen.Test6942326::test_consub_indexof
+ *      -XX:CompileCommand=exclude,compiler.codegen.Test6942326::test_conmis_indexof
+ *      -XX:CompileCommand=exclude,compiler.codegen.Test6942326::test_subcon
+ *      compiler.codegen.Test6942326
  */
 
-public class Test {
+package compiler.codegen;
+
+public class Test6942326 {
 
     static String[] strings = new String[1024];
     private static final int ITERATIONS = 100000;
diff --git a/hotspot/test/compiler/codegen/7009231/Test7009231.java b/hotspot/test/compiler/codegen/Test7009231.java
similarity index 96%
rename from hotspot/test/compiler/codegen/7009231/Test7009231.java
rename to hotspot/test/compiler/codegen/Test7009231.java
index 64afc66..a384d0f 100644
--- a/hotspot/test/compiler/codegen/7009231/Test7009231.java
+++ b/hotspot/test/compiler/codegen/Test7009231.java
@@ -27,13 +27,12 @@
  * @bug 7009231
  * @summary C1: Incorrect CAS code for longs on SPARC 32bit
  *
- * @run main/othervm -Xbatch Test7009231
- *
+ * @run main/othervm -Xbatch compiler.codegen.Test7009231
  */
 
-import java.util.Random;
-import java.util.concurrent.atomic.AtomicLong;
+package compiler.codegen;
 
+import java.util.concurrent.atomic.AtomicLong;
 
 public class Test7009231 {
     public static void main(String[] args) throws InterruptedException {
diff --git a/hotspot/test/compiler/codegen/7100757/Test7100757.java b/hotspot/test/compiler/codegen/Test7100757.java
similarity index 97%
rename from hotspot/test/compiler/codegen/7100757/Test7100757.java
rename to hotspot/test/compiler/codegen/Test7100757.java
index d400616..3736d85 100644
--- a/hotspot/test/compiler/codegen/7100757/Test7100757.java
+++ b/hotspot/test/compiler/codegen/Test7100757.java
@@ -29,10 +29,14 @@
  * @library /testlibrary
  * @modules java.base/jdk.internal.misc
  *          java.management
- * @run main/timeout=300 Test7100757
+ *
+ * @run main/timeout=300 compiler.codegen.Test7100757
  */
 
+package compiler.codegen;
+
 import jdk.test.lib.Utils;
+
 import java.util.BitSet;
 import java.util.Random;
 
diff --git a/hotspot/test/compiler/codegen/8005033/Test8005033.java b/hotspot/test/compiler/codegen/Test8005033.java
similarity index 91%
rename from hotspot/test/compiler/codegen/8005033/Test8005033.java
rename to hotspot/test/compiler/codegen/Test8005033.java
index 1918136..84630ad 100644
--- a/hotspot/test/compiler/codegen/8005033/Test8005033.java
+++ b/hotspot/test/compiler/codegen/Test8005033.java
@@ -25,10 +25,15 @@
  * @test
  * @bug 8005033
  * @summary On sparcv9, C2's intrinsic for Integer.bitCount(OV) returns wrong result if OV is the result of an operation with int overflow.
- * @run main/othervm -Xcomp -XX:CompileOnly=Test8005033::testBitCount Test8005033
+ *
+ * @run main/othervm -Xcomp
+ *      -XX:CompileCommand=compileony,compiler.codegen.Test8005033::testBitCount
+ *      compiler.codegen.Test8005033
  * @author Richard Reingruber richard DOT reingruber AT sap DOT com
  */
 
+package compiler.codegen;
+
 public class Test8005033 {
     public static int MINUS_ONE = -1;
 
diff --git a/hotspot/test/compiler/codegen/8011901/Test8011901.java b/hotspot/test/compiler/codegen/Test8011901.java
similarity index 95%
rename from hotspot/test/compiler/codegen/8011901/Test8011901.java
rename to hotspot/test/compiler/codegen/Test8011901.java
index 837a92c..6a865c1 100644
--- a/hotspot/test/compiler/codegen/8011901/Test8011901.java
+++ b/hotspot/test/compiler/codegen/Test8011901.java
@@ -26,13 +26,16 @@
  * @bug 8011901
  * @summary instruct xaddL_no_res shouldn't allow 64 bit constants.
  * @modules java.base/jdk.internal.misc
- * @run main/othervm -XX:-BackgroundCompilation Test8011901
  *
+ * @run main/othervm -XX:-BackgroundCompilation compiler.codegen.Test8011901
  */
 
-import java.lang.reflect.Field;
+package compiler.codegen;
+
 import jdk.internal.misc.Unsafe;
 
+import java.lang.reflect.Field;
+
 public class Test8011901 {
 
     private long ctl;
diff --git a/hotspot/test/compiler/codegen/7119644/TestBooleanVect.java b/hotspot/test/compiler/codegen/TestBooleanVect.java
similarity index 99%
rename from hotspot/test/compiler/codegen/7119644/TestBooleanVect.java
rename to hotspot/test/compiler/codegen/TestBooleanVect.java
index d4e3ad6..2b6363e 100644
--- a/hotspot/test/compiler/codegen/7119644/TestBooleanVect.java
+++ b/hotspot/test/compiler/codegen/TestBooleanVect.java
@@ -27,9 +27,13 @@
  * @bug 7119644
  * @summary Increase superword's vector size up to 256 bits
  *
- * @run main/othervm/timeout=300 -Xbatch -XX:+IgnoreUnrecognizedVMOptions -XX:-TieredCompilation -XX:-OptimizeFill TestBooleanVect
+ * @run main/othervm/timeout=300 -Xbatch -XX:+IgnoreUnrecognizedVMOptions
+ *    -XX:-TieredCompilation -XX:-OptimizeFill
+ *    compiler.codegen.TestBooleanVect
  */
 
+package compiler.codegen;
+
 public class TestBooleanVect {
   private static final int ARRLEN = 997;
   private static final int ITERS  = 11000;
diff --git a/hotspot/test/compiler/codegen/7119644/TestByteDoubleVect.java b/hotspot/test/compiler/codegen/TestByteDoubleVect.java
similarity index 99%
rename from hotspot/test/compiler/codegen/7119644/TestByteDoubleVect.java
rename to hotspot/test/compiler/codegen/TestByteDoubleVect.java
index acf71bf..e9376c1 100644
--- a/hotspot/test/compiler/codegen/7119644/TestByteDoubleVect.java
+++ b/hotspot/test/compiler/codegen/TestByteDoubleVect.java
@@ -27,9 +27,13 @@
  * @bug 7119644
  * @summary Increase superword's vector size up to 256 bits
  *
- * @run main/othervm/timeout=300 -Xbatch -XX:+IgnoreUnrecognizedVMOptions -XX:-TieredCompilation -XX:-OptimizeFill TestByteDoubleVect
+ * @run main/othervm/timeout=300 -Xbatch -XX:+IgnoreUnrecognizedVMOptions
+ *    -XX:-TieredCompilation -XX:-OptimizeFill
+ *    compiler.codegen.TestByteDoubleVect
  */
 
+package compiler.codegen;
+
 public class TestByteDoubleVect {
   private static final int ARRLEN = 997;
   private static final int ITERS  = 11000;
diff --git a/hotspot/test/compiler/codegen/7119644/TestByteFloatVect.java b/hotspot/test/compiler/codegen/TestByteFloatVect.java
similarity index 99%
rename from hotspot/test/compiler/codegen/7119644/TestByteFloatVect.java
rename to hotspot/test/compiler/codegen/TestByteFloatVect.java
index 45fe34e..d718f48 100644
--- a/hotspot/test/compiler/codegen/7119644/TestByteFloatVect.java
+++ b/hotspot/test/compiler/codegen/TestByteFloatVect.java
@@ -27,9 +27,13 @@
  * @bug 7119644
  * @summary Increase superword's vector size up to 256 bits
  *
- * @run main/othervm/timeout=300 -Xbatch -XX:+IgnoreUnrecognizedVMOptions -XX:-TieredCompilation -XX:-OptimizeFill TestByteFloatVect
+ * @run main/othervm/timeout=300 -Xbatch -XX:+IgnoreUnrecognizedVMOptions
+ *    -XX:-TieredCompilation -XX:-OptimizeFill
+ *    compiler.codegen.TestByteFloatVect
  */
 
+package compiler.codegen;
+
 public class TestByteFloatVect {
   private static final int ARRLEN = 997;
   private static final int ITERS  = 11000;
diff --git a/hotspot/test/compiler/codegen/7119644/TestByteIntVect.java b/hotspot/test/compiler/codegen/TestByteIntVect.java
similarity index 99%
rename from hotspot/test/compiler/codegen/7119644/TestByteIntVect.java
rename to hotspot/test/compiler/codegen/TestByteIntVect.java
index 8d9aa6a..2e2b8b4 100644
--- a/hotspot/test/compiler/codegen/7119644/TestByteIntVect.java
+++ b/hotspot/test/compiler/codegen/TestByteIntVect.java
@@ -27,9 +27,13 @@
  * @bug 7119644
  * @summary Increase superword's vector size up to 256 bits
  *
- * @run main/othervm/timeout=300 -Xbatch -XX:+IgnoreUnrecognizedVMOptions -XX:-TieredCompilation -XX:-OptimizeFill TestByteIntVect
+ * @run main/othervm/timeout=300 -Xbatch -XX:+IgnoreUnrecognizedVMOptions
+ *    -XX:-TieredCompilation -XX:-OptimizeFill
+ *    compiler.codegen.TestByteIntVect
  */
 
+package compiler.codegen;
+
 public class TestByteIntVect {
   private static final int ARRLEN = 997;
   private static final int ITERS  = 11000;
diff --git a/hotspot/test/compiler/codegen/7119644/TestByteLongVect.java b/hotspot/test/compiler/codegen/TestByteLongVect.java
similarity index 99%
rename from hotspot/test/compiler/codegen/7119644/TestByteLongVect.java
rename to hotspot/test/compiler/codegen/TestByteLongVect.java
index c2d4390..23a57e2 100644
--- a/hotspot/test/compiler/codegen/7119644/TestByteLongVect.java
+++ b/hotspot/test/compiler/codegen/TestByteLongVect.java
@@ -27,9 +27,13 @@
  * @bug 7119644
  * @summary Increase superword's vector size up to 256 bits
  *
- * @run main/othervm/timeout=300 -Xbatch -XX:+IgnoreUnrecognizedVMOptions -XX:-TieredCompilation -XX:-OptimizeFill TestByteLongVect
+ * @run main/othervm/timeout=300 -Xbatch -XX:+IgnoreUnrecognizedVMOptions
+ *    -XX:-TieredCompilation -XX:-OptimizeFill
+ *    compiler.codegen.TestByteLongVect
  */
 
+package compiler.codegen;
+
 public class TestByteLongVect {
   private static final int ARRLEN = 997;
   private static final int ITERS  = 11000;
diff --git a/hotspot/test/compiler/codegen/7119644/TestByteShortVect.java b/hotspot/test/compiler/codegen/TestByteShortVect.java
similarity index 99%
rename from hotspot/test/compiler/codegen/7119644/TestByteShortVect.java
rename to hotspot/test/compiler/codegen/TestByteShortVect.java
index ee1a206..0b4b4d7 100644
--- a/hotspot/test/compiler/codegen/7119644/TestByteShortVect.java
+++ b/hotspot/test/compiler/codegen/TestByteShortVect.java
@@ -27,9 +27,13 @@
  * @bug 7119644
  * @summary Increase superword's vector size up to 256 bits
  *
- * @run main/othervm/timeout=300 -Xbatch -XX:+IgnoreUnrecognizedVMOptions -XX:-TieredCompilation -XX:-OptimizeFill TestByteShortVect
+ * @run main/othervm/timeout=300 -Xbatch -XX:+IgnoreUnrecognizedVMOptions
+ *    -XX:-TieredCompilation -XX:-OptimizeFill
+ *    compiler.codegen.TestByteShortVect
  */
 
+package compiler.codegen;
+
 public class TestByteShortVect {
   private static final int ARRLEN = 997;
   private static final int ITERS  = 11000;
diff --git a/hotspot/test/compiler/codegen/7119644/TestByteVect.java b/hotspot/test/compiler/codegen/TestByteVect.java
similarity index 99%
rename from hotspot/test/compiler/codegen/7119644/TestByteVect.java
rename to hotspot/test/compiler/codegen/TestByteVect.java
index 6167678..06bc2bb 100644
--- a/hotspot/test/compiler/codegen/7119644/TestByteVect.java
+++ b/hotspot/test/compiler/codegen/TestByteVect.java
@@ -27,9 +27,13 @@
  * @bug 7119644
  * @summary Increase superword's vector size up to 256 bits
  *
- * @run main/othervm/timeout=300 -Xbatch -XX:+IgnoreUnrecognizedVMOptions -XX:-TieredCompilation -XX:-OptimizeFill TestByteVect
+ * @run main/othervm/timeout=300 -Xbatch -XX:+IgnoreUnrecognizedVMOptions
+ *    -XX:-TieredCompilation -XX:-OptimizeFill
+ *    compiler.codegen.TestByteVect
  */
 
+package compiler.codegen;
+
 public class TestByteVect {
   private static final int ARRLEN = 997;
   private static final int ITERS  = 11000;
diff --git a/hotspot/test/compiler/codegen/7119644/TestCharShortVect.java b/hotspot/test/compiler/codegen/TestCharShortVect.java
similarity index 99%
rename from hotspot/test/compiler/codegen/7119644/TestCharShortVect.java
rename to hotspot/test/compiler/codegen/TestCharShortVect.java
index 55f8e03..5ae572e 100644
--- a/hotspot/test/compiler/codegen/7119644/TestCharShortVect.java
+++ b/hotspot/test/compiler/codegen/TestCharShortVect.java
@@ -27,9 +27,13 @@
  * @bug 7119644
  * @summary Increase superword's vector size up to 256 bits
  *
- * @run main/othervm/timeout=300 -Xbatch -XX:+IgnoreUnrecognizedVMOptions -XX:-TieredCompilation -XX:-OptimizeFill TestCharShortVect
+ * @run main/othervm/timeout=300 -Xbatch -XX:+IgnoreUnrecognizedVMOptions
+ *    -XX:-TieredCompilation -XX:-OptimizeFill
+ *    compiler.codegen.TestCharShortVect
  */
 
+package compiler.codegen;
+
 public class TestCharShortVect {
   private static final int ARRLEN = 997;
   private static final int ITERS  = 11000;
diff --git a/hotspot/test/compiler/codegen/7119644/TestCharVect.java b/hotspot/test/compiler/codegen/TestCharVect.java
similarity index 99%
rename from hotspot/test/compiler/codegen/7119644/TestCharVect.java
rename to hotspot/test/compiler/codegen/TestCharVect.java
index d05ed4d..ef21a88 100644
--- a/hotspot/test/compiler/codegen/7119644/TestCharVect.java
+++ b/hotspot/test/compiler/codegen/TestCharVect.java
@@ -27,9 +27,13 @@
  * @bug 7119644
  * @summary Increase superword's vector size up to 256 bits
  *
- * @run main/othervm/timeout=300 -Xbatch -XX:+IgnoreUnrecognizedVMOptions -XX:-TieredCompilation -XX:-OptimizeFill TestCharVect
+ * @run main/othervm/timeout=300 -Xbatch -XX:+IgnoreUnrecognizedVMOptions
+ *    -XX:-TieredCompilation -XX:-OptimizeFill
+ *    compiler.codegen.TestCharVect
  */
 
+package compiler.codegen;
+
 public class TestCharVect {
   private static final int ARRLEN = 997;
   private static final int ITERS  = 11000;
diff --git a/hotspot/test/compiler/codegen/8001183/TestCharVect.java b/hotspot/test/compiler/codegen/TestCharVect2.java
similarity index 99%
rename from hotspot/test/compiler/codegen/8001183/TestCharVect.java
rename to hotspot/test/compiler/codegen/TestCharVect2.java
index a6ff1e2..748d3be 100644
--- a/hotspot/test/compiler/codegen/8001183/TestCharVect.java
+++ b/hotspot/test/compiler/codegen/TestCharVect2.java
@@ -27,10 +27,12 @@
  * @bug 8001183
  * @summary incorrect results of char vectors right shift operaiton
  *
- * @run main/othervm/timeout=400 -Xbatch -Xmx64m TestCharVect
+ * @run main/othervm/timeout=400 -Xbatch -Xmx64m compiler.codegen.TestCharVect2
  */
 
-public class TestCharVect {
+package compiler.codegen;
+
+public class TestCharVect2 {
   private static final int ARRLEN = 997;
   private static final int ITERS  = 11000;
   private static final int ADD_INIT = Character.MAX_VALUE-500;
diff --git a/hotspot/test/compiler/codegen/7119644/TestDoubleVect.java b/hotspot/test/compiler/codegen/TestDoubleVect.java
similarity index 99%
rename from hotspot/test/compiler/codegen/7119644/TestDoubleVect.java
rename to hotspot/test/compiler/codegen/TestDoubleVect.java
index 385a64d..b8772d9 100644
--- a/hotspot/test/compiler/codegen/7119644/TestDoubleVect.java
+++ b/hotspot/test/compiler/codegen/TestDoubleVect.java
@@ -27,9 +27,13 @@
  * @bug 7119644
  * @summary Increase superword's vector size up to 256 bits
  *
- * @run main/othervm/timeout=300 -Xbatch -XX:+IgnoreUnrecognizedVMOptions -XX:-TieredCompilation -XX:-OptimizeFill TestDoubleVect
+ * @run main/othervm/timeout=300 -Xbatch -XX:+IgnoreUnrecognizedVMOptions
+ *    -XX:-TieredCompilation -XX:-OptimizeFill
+ *    compiler.codegen.TestDoubleVect
  */
 
+package compiler.codegen;
+
 public class TestDoubleVect {
   private static final int ARRLEN = 997;
   private static final int ITERS  = 11000;
diff --git a/hotspot/test/compiler/codegen/7119644/TestFloatDoubleVect.java b/hotspot/test/compiler/codegen/TestFloatDoubleVect.java
similarity index 99%
rename from hotspot/test/compiler/codegen/7119644/TestFloatDoubleVect.java
rename to hotspot/test/compiler/codegen/TestFloatDoubleVect.java
index 827ecdb..d90d295 100644
--- a/hotspot/test/compiler/codegen/7119644/TestFloatDoubleVect.java
+++ b/hotspot/test/compiler/codegen/TestFloatDoubleVect.java
@@ -27,9 +27,13 @@
  * @bug 7119644
  * @summary Increase superword's vector size up to 256 bits
  *
- * @run main/othervm/timeout=300 -Xbatch -XX:+IgnoreUnrecognizedVMOptions -XX:-TieredCompilation -XX:-OptimizeFill TestFloatDoubleVect
+ * @run main/othervm/timeout=300 -Xbatch -XX:+IgnoreUnrecognizedVMOptions
+ *    -XX:-TieredCompilation -XX:-OptimizeFill
+ *    compiler.codegen.TestFloatDoubleVect
  */
 
+package compiler.codegen;
+
 public class TestFloatDoubleVect {
   private static final int ARRLEN = 997;
   private static final int ITERS  = 11000;
diff --git a/hotspot/test/compiler/codegen/7119644/TestFloatVect.java b/hotspot/test/compiler/codegen/TestFloatVect.java
similarity index 99%
rename from hotspot/test/compiler/codegen/7119644/TestFloatVect.java
rename to hotspot/test/compiler/codegen/TestFloatVect.java
index 825fffe..523761a 100644
--- a/hotspot/test/compiler/codegen/7119644/TestFloatVect.java
+++ b/hotspot/test/compiler/codegen/TestFloatVect.java
@@ -27,9 +27,13 @@
  * @bug 7119644
  * @summary Increase superword's vector size up to 256 bits
  *
- * @run main/othervm/timeout=300 -Xbatch -XX:+IgnoreUnrecognizedVMOptions -XX:-TieredCompilation -XX:-OptimizeFill TestFloatVect
+ * @run main/othervm/timeout=300 -Xbatch -XX:+IgnoreUnrecognizedVMOptions
+ *    -XX:-TieredCompilation -XX:-OptimizeFill
+ *    compiler.codegen.TestFloatVect
  */
 
+package compiler.codegen;
+
 public class TestFloatVect {
   private static final int ARRLEN = 997;
   private static final int ITERS  = 11000;
diff --git a/hotspot/test/compiler/codegen/7119644/TestIntDoubleVect.java b/hotspot/test/compiler/codegen/TestIntDoubleVect.java
similarity index 99%
rename from hotspot/test/compiler/codegen/7119644/TestIntDoubleVect.java
rename to hotspot/test/compiler/codegen/TestIntDoubleVect.java
index fc6e32d..739353d 100644
--- a/hotspot/test/compiler/codegen/7119644/TestIntDoubleVect.java
+++ b/hotspot/test/compiler/codegen/TestIntDoubleVect.java
@@ -27,9 +27,13 @@
  * @bug 7119644
  * @summary Increase superword's vector size up to 256 bits
  *
- * @run main/othervm/timeout=300 -Xbatch -XX:+IgnoreUnrecognizedVMOptions -XX:-TieredCompilation -XX:-OptimizeFill TestIntDoubleVect
+ * @run main/othervm/timeout=300 -Xbatch -XX:+IgnoreUnrecognizedVMOptions
+ *    -XX:-TieredCompilation -XX:-OptimizeFill
+ *    compiler.codegen.TestIntDoubleVect
  */
 
+package compiler.codegen;
+
 public class TestIntDoubleVect {
   private static final int ARRLEN = 997;
   private static final int ITERS  = 11000;
diff --git a/hotspot/test/compiler/codegen/7119644/TestIntFloatVect.java b/hotspot/test/compiler/codegen/TestIntFloatVect.java
similarity index 99%
rename from hotspot/test/compiler/codegen/7119644/TestIntFloatVect.java
rename to hotspot/test/compiler/codegen/TestIntFloatVect.java
index e698c89..c41d824 100644
--- a/hotspot/test/compiler/codegen/7119644/TestIntFloatVect.java
+++ b/hotspot/test/compiler/codegen/TestIntFloatVect.java
@@ -27,9 +27,13 @@
  * @bug 7119644
  * @summary Increase superword's vector size up to 256 bits
  *
- * @run main/othervm/timeout=300 -Xbatch -XX:+IgnoreUnrecognizedVMOptions -XX:-TieredCompilation -XX:-OptimizeFill TestIntFloatVect
+ * @run main/othervm/timeout=300 -Xbatch -XX:+IgnoreUnrecognizedVMOptions
+ *    -XX:-TieredCompilation -XX:-OptimizeFill
+ *    compiler.codegen.TestIntFloatVect
  */
 
+package compiler.codegen;
+
 public class TestIntFloatVect {
   private static final int ARRLEN = 997;
   private static final int ITERS  = 11000;
diff --git a/hotspot/test/compiler/codegen/7119644/TestIntLongVect.java b/hotspot/test/compiler/codegen/TestIntLongVect.java
similarity index 99%
rename from hotspot/test/compiler/codegen/7119644/TestIntLongVect.java
rename to hotspot/test/compiler/codegen/TestIntLongVect.java
index def0d9b..02c4b62 100644
--- a/hotspot/test/compiler/codegen/7119644/TestIntLongVect.java
+++ b/hotspot/test/compiler/codegen/TestIntLongVect.java
@@ -27,9 +27,13 @@
  * @bug 7119644
  * @summary Increase superword's vector size up to 256 bits
  *
- * @run main/othervm/timeout=300 -Xbatch -XX:+IgnoreUnrecognizedVMOptions -XX:-TieredCompilation -XX:-OptimizeFill TestIntLongVect
+ * @run main/othervm/timeout=300 -Xbatch -XX:+IgnoreUnrecognizedVMOptions
+ *    -XX:-TieredCompilation -XX:-OptimizeFill
+ *    compiler.codegen.TestIntLongVect
  */
 
+package compiler.codegen;
+
 public class TestIntLongVect {
   private static final int ARRLEN = 997;
   private static final int ITERS  = 11000;
diff --git a/hotspot/test/compiler/codegen/7119644/TestIntVect.java b/hotspot/test/compiler/codegen/TestIntVect.java
similarity index 99%
rename from hotspot/test/compiler/codegen/7119644/TestIntVect.java
rename to hotspot/test/compiler/codegen/TestIntVect.java
index 9d3f4e5..cb2b31b 100644
--- a/hotspot/test/compiler/codegen/7119644/TestIntVect.java
+++ b/hotspot/test/compiler/codegen/TestIntVect.java
@@ -27,9 +27,13 @@
  * @bug 7119644
  * @summary Increase superword's vector size up to 256 bits
  *
- * @run main/othervm/timeout=300 -Xbatch -XX:+IgnoreUnrecognizedVMOptions -XX:-TieredCompilation -XX:-OptimizeFill TestIntVect
+ * @run main/othervm/timeout=300 -Xbatch -XX:+IgnoreUnrecognizedVMOptions
+ *    -XX:-TieredCompilation -XX:-OptimizeFill
+ *    compiler.codegen.TestIntVect
  */
 
+package compiler.codegen;
+
 public class TestIntVect {
   private static final int ARRLEN = 997;
   private static final int ITERS  = 11000;
diff --git a/hotspot/test/compiler/codegen/7119644/TestLongDoubleVect.java b/hotspot/test/compiler/codegen/TestLongDoubleVect.java
similarity index 99%
rename from hotspot/test/compiler/codegen/7119644/TestLongDoubleVect.java
rename to hotspot/test/compiler/codegen/TestLongDoubleVect.java
index 344e3a9..c73cc98 100644
--- a/hotspot/test/compiler/codegen/7119644/TestLongDoubleVect.java
+++ b/hotspot/test/compiler/codegen/TestLongDoubleVect.java
@@ -27,9 +27,13 @@
  * @bug 7119644
  * @summary Increase superword's vector size up to 256 bits
  *
- * @run main/othervm/timeout=300 -Xbatch -XX:+IgnoreUnrecognizedVMOptions -XX:-TieredCompilation -XX:-OptimizeFill TestLongDoubleVect
+ * @run main/othervm/timeout=300 -Xbatch -XX:+IgnoreUnrecognizedVMOptions
+ *    -XX:-TieredCompilation -XX:-OptimizeFill
+ *    compiler.codegen.TestLongDoubleVect
  */
 
+package compiler.codegen;
+
 public class TestLongDoubleVect {
   private static final int ARRLEN = 997;
   private static final int ITERS  = 11000;
diff --git a/hotspot/test/compiler/codegen/7119644/TestLongFloatVect.java b/hotspot/test/compiler/codegen/TestLongFloatVect.java
similarity index 99%
rename from hotspot/test/compiler/codegen/7119644/TestLongFloatVect.java
rename to hotspot/test/compiler/codegen/TestLongFloatVect.java
index 714f6c8..ef00e6f 100644
--- a/hotspot/test/compiler/codegen/7119644/TestLongFloatVect.java
+++ b/hotspot/test/compiler/codegen/TestLongFloatVect.java
@@ -27,9 +27,13 @@
  * @bug 7119644
  * @summary Increase superword's vector size up to 256 bits
  *
- * @run main/othervm/timeout=300 -Xbatch -XX:+IgnoreUnrecognizedVMOptions -XX:-TieredCompilation -XX:-OptimizeFill TestLongFloatVect
+ * @run main/othervm/timeout=300 -Xbatch -XX:+IgnoreUnrecognizedVMOptions
+ *    -XX:-TieredCompilation -XX:-OptimizeFill
+ *    compiler.codegen.TestLongFloatVect
  */
 
+package compiler.codegen;
+
 public class TestLongFloatVect {
   private static final int ARRLEN = 997;
   private static final int ITERS  = 11000;
diff --git a/hotspot/test/compiler/codegen/7119644/TestLongVect.java b/hotspot/test/compiler/codegen/TestLongVect.java
similarity index 99%
rename from hotspot/test/compiler/codegen/7119644/TestLongVect.java
rename to hotspot/test/compiler/codegen/TestLongVect.java
index 6f0365b..d76025a 100644
--- a/hotspot/test/compiler/codegen/7119644/TestLongVect.java
+++ b/hotspot/test/compiler/codegen/TestLongVect.java
@@ -27,9 +27,13 @@
  * @bug 7119644
  * @summary Increase superword's vector size up to 256 bits
  *
- * @run main/othervm/timeout=300 -Xbatch -XX:+IgnoreUnrecognizedVMOptions -XX:-TieredCompilation -XX:-OptimizeFill TestLongVect
+ * @run main/othervm/timeout=300 -Xbatch -XX:+IgnoreUnrecognizedVMOptions
+ *    -XX:-TieredCompilation -XX:-OptimizeFill
+ *    compiler.codegen.TestLongVect
  */
 
+package compiler.codegen;
+
 public class TestLongVect {
   private static final int ARRLEN = 997;
   private static final int ITERS  = 11000;
diff --git a/hotspot/test/compiler/codegen/7119644/TestShortDoubleVect.java b/hotspot/test/compiler/codegen/TestShortDoubleVect.java
similarity index 99%
rename from hotspot/test/compiler/codegen/7119644/TestShortDoubleVect.java
rename to hotspot/test/compiler/codegen/TestShortDoubleVect.java
index c21037e..f36baa31 100644
--- a/hotspot/test/compiler/codegen/7119644/TestShortDoubleVect.java
+++ b/hotspot/test/compiler/codegen/TestShortDoubleVect.java
@@ -27,9 +27,13 @@
  * @bug 7119644
  * @summary Increase superword's vector size up to 256 bits
  *
- * @run main/othervm/timeout=300 -Xbatch -XX:+IgnoreUnrecognizedVMOptions -XX:-TieredCompilation -XX:-OptimizeFill TestShortDoubleVect
+ * @run main/othervm/timeout=300 -Xbatch -XX:+IgnoreUnrecognizedVMOptions
+ *    -XX:-TieredCompilation -XX:-OptimizeFill
+ *    compiler.codegen.TestShortDoubleVect
  */
 
+package compiler.codegen;
+
 public class TestShortDoubleVect {
   private static final int ARRLEN = 997;
   private static final int ITERS  = 11000;
diff --git a/hotspot/test/compiler/codegen/7119644/TestShortFloatVect.java b/hotspot/test/compiler/codegen/TestShortFloatVect.java
similarity index 99%
rename from hotspot/test/compiler/codegen/7119644/TestShortFloatVect.java
rename to hotspot/test/compiler/codegen/TestShortFloatVect.java
index 05b4ddd..7704a1b 100644
--- a/hotspot/test/compiler/codegen/7119644/TestShortFloatVect.java
+++ b/hotspot/test/compiler/codegen/TestShortFloatVect.java
@@ -27,9 +27,13 @@
  * @bug 7119644
  * @summary Increase superword's vector size up to 256 bits
  *
- * @run main/othervm/timeout=300 -Xbatch -XX:+IgnoreUnrecognizedVMOptions -XX:-TieredCompilation -XX:-OptimizeFill TestShortFloatVect
+ * @run main/othervm/timeout=300 -Xbatch -XX:+IgnoreUnrecognizedVMOptions
+ *    -XX:-TieredCompilation -XX:-OptimizeFill
+ *    compiler.codegen.TestShortFloatVect
  */
 
+package compiler.codegen;
+
 public class TestShortFloatVect {
   private static final int ARRLEN = 997;
   private static final int ITERS  = 11000;
diff --git a/hotspot/test/compiler/codegen/7119644/TestShortIntVect.java b/hotspot/test/compiler/codegen/TestShortIntVect.java
similarity index 99%
rename from hotspot/test/compiler/codegen/7119644/TestShortIntVect.java
rename to hotspot/test/compiler/codegen/TestShortIntVect.java
index bf18094..d979fad 100644
--- a/hotspot/test/compiler/codegen/7119644/TestShortIntVect.java
+++ b/hotspot/test/compiler/codegen/TestShortIntVect.java
@@ -27,9 +27,13 @@
  * @bug 7119644
  * @summary Increase superword's vector size up to 256 bits
  *
- * @run main/othervm/timeout=300 -Xbatch -XX:+IgnoreUnrecognizedVMOptions -XX:-TieredCompilation -XX:-OptimizeFill TestShortIntVect
+ * @run main/othervm/timeout=300 -Xbatch -XX:+IgnoreUnrecognizedVMOptions
+ *    -XX:-TieredCompilation -XX:-OptimizeFill
+ *    compiler.codegen.TestShortIntVect
  */
 
+package compiler.codegen;
+
 public class TestShortIntVect {
   private static final int ARRLEN = 997;
   private static final int ITERS  = 11000;
diff --git a/hotspot/test/compiler/codegen/7119644/TestShortLongVect.java b/hotspot/test/compiler/codegen/TestShortLongVect.java
similarity index 99%
rename from hotspot/test/compiler/codegen/7119644/TestShortLongVect.java
rename to hotspot/test/compiler/codegen/TestShortLongVect.java
index d4c121f..b6c0c79 100644
--- a/hotspot/test/compiler/codegen/7119644/TestShortLongVect.java
+++ b/hotspot/test/compiler/codegen/TestShortLongVect.java
@@ -27,9 +27,13 @@
  * @bug 7119644
  * @summary Increase superword's vector size up to 256 bits
  *
- * @run main/othervm/timeout=300 -Xbatch -XX:+IgnoreUnrecognizedVMOptions -XX:-TieredCompilation -XX:-OptimizeFill TestShortLongVect
+ * @run main/othervm/timeout=300 -Xbatch -XX:+IgnoreUnrecognizedVMOptions
+ *    -XX:-TieredCompilation -XX:-OptimizeFill
+ *    compiler.codegen.TestShortLongVect
  */
 
+package compiler.codegen;
+
 public class TestShortLongVect {
   private static final int ARRLEN = 997;
   private static final int ITERS  = 11000;
diff --git a/hotspot/test/compiler/codegen/7119644/TestShortVect.java b/hotspot/test/compiler/codegen/TestShortVect.java
similarity index 99%
rename from hotspot/test/compiler/codegen/7119644/TestShortVect.java
rename to hotspot/test/compiler/codegen/TestShortVect.java
index d458383..04b4ecb 100644
--- a/hotspot/test/compiler/codegen/7119644/TestShortVect.java
+++ b/hotspot/test/compiler/codegen/TestShortVect.java
@@ -27,9 +27,13 @@
  * @bug 7119644
  * @summary Increase superword's vector size up to 256 bits
  *
- * @run main/othervm/timeout=300 -Xbatch -XX:+IgnoreUnrecognizedVMOptions -XX:-TieredCompilation -XX:-OptimizeFill TestShortVect
+ * @run main/othervm/timeout=300 -Xbatch -XX:+IgnoreUnrecognizedVMOptions
+ *    -XX:-TieredCompilation -XX:-OptimizeFill
+ *    compiler.codegen.TestShortVect
  */
 
+package compiler.codegen;
+
 public class TestShortVect {
   private static final int ARRLEN = 997;
   private static final int ITERS  = 11000;
diff --git a/hotspot/test/compiler/codegen/aes/TestAESBase.java b/hotspot/test/compiler/codegen/aes/TestAESBase.java
new file mode 100644
index 0000000..ca2d5c9
--- /dev/null
+++ b/hotspot/test/compiler/codegen/aes/TestAESBase.java
@@ -0,0 +1,222 @@
+/*
+ * Copyright (c) 2012, 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.
+ *
+ * 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 compiler.codegen.aes;
+
+import jdk.test.lib.Utils;
+
+import javax.crypto.Cipher;
+import javax.crypto.SecretKey;
+import javax.crypto.spec.GCMParameterSpec;
+import javax.crypto.spec.IvParameterSpec;
+import javax.crypto.spec.SecretKeySpec;
+import java.security.AlgorithmParameters;
+import java.util.Random;
+
+/**
+ * @author Tom Deneau
+ */
+public abstract class TestAESBase {
+    int msgSize = Integer.getInteger("msgSize", 646);
+    boolean checkOutput = Boolean.getBoolean("checkOutput");
+    boolean noReinit = Boolean.getBoolean("noReinit");
+    boolean testingMisalignment;
+    private static final int ALIGN = 8;
+    int encInputOffset = Integer.getInteger("encInputOffset", 0) % ALIGN;
+    int encOutputOffset = Integer.getInteger("encOutputOffset", 0) % ALIGN;
+    int decOutputOffset = Integer.getInteger("decOutputOffset", 0) % ALIGN;
+    int lastChunkSize = Integer.getInteger("lastChunkSize", 32);
+    int keySize = Integer.getInteger("keySize", 128);
+    int inputLength;
+    int encodeLength;
+    int decodeLength;
+    int decodeMsgSize;
+    String algorithm = System.getProperty("algorithm", "AES");
+    String mode = System.getProperty("mode", "CBC");
+    String paddingStr = System.getProperty("paddingStr", "PKCS5Padding");
+    byte[] input;
+    byte[] encode;
+    byte[] expectedEncode;
+    byte[] decode;
+    byte[] expectedDecode;
+    final Random random = Utils.getRandomInstance();
+    Cipher cipher;
+    Cipher dCipher;
+    AlgorithmParameters algParams = null;
+    SecretKey key;
+    GCMParameterSpec gcm_spec;
+    byte[] aad = {0x11, 0x22, 0x33, 0x44, 0x55};
+    int tlen = 12;
+    byte[] iv = new byte[16];
+
+    static int numThreads = 0;
+    int threadId;
+
+    static synchronized int getThreadId() {
+        int id = numThreads;
+        numThreads++;
+        return id;
+    }
+
+    abstract public void run();
+
+    public void prepare() {
+        try {
+            System.out.println("\nalgorithm=" + algorithm + ", mode=" + mode + ", paddingStr=" + paddingStr +
+                    ", msgSize=" + msgSize + ", keySize=" + keySize + ", noReinit=" + noReinit +
+                    ", checkOutput=" + checkOutput + ", encInputOffset=" + encInputOffset + ", encOutputOffset=" +
+                    encOutputOffset + ", decOutputOffset=" + decOutputOffset + ", lastChunkSize=" + lastChunkSize);
+
+            if (encInputOffset % ALIGN != 0 || encOutputOffset % ALIGN != 0 || decOutputOffset % ALIGN != 0)
+                testingMisalignment = true;
+
+            int keyLenBytes = (keySize == 0 ? 16 : keySize / 8);
+            byte keyBytes[] = new byte[keyLenBytes];
+            if (keySize == 128)
+                keyBytes = new byte[]{-8, -7, -6, -5, -4, -3, -2, -1, 0, 1, 2, 3, 4, 5, 6, 7};
+            else
+                random.nextBytes(keyBytes);
+
+            key = new SecretKeySpec(keyBytes, algorithm);
+            if (threadId == 0) {
+                System.out.println("Algorithm: " + key.getAlgorithm() + "("
+                        + key.getEncoded().length * 8 + "bit)");
+            }
+
+            cipher = Cipher.getInstance(algorithm + "/" + mode + "/" + paddingStr, "SunJCE");
+            dCipher = Cipher.getInstance(algorithm + "/" + mode + "/" + paddingStr, "SunJCE");
+
+            // CBC or CTR init
+            if (mode.equals("CBC") || mode.equals("CTR")) {
+                IvParameterSpec initVector = new IvParameterSpec(iv);
+                cipher.init(Cipher.ENCRYPT_MODE, key, initVector);
+                algParams = cipher.getParameters();
+                dCipher.init(Cipher.DECRYPT_MODE, key, initVector);
+
+                // GCM init
+            } else if (mode.equals("GCM")) {
+                gcm_init(true);
+                gcm_init(false);
+
+                // ECB init
+            } else {
+                cipher.init(Cipher.ENCRYPT_MODE, key, algParams);
+                dCipher.init(Cipher.DECRYPT_MODE, key, algParams);
+            }
+
+            if (threadId == 0) {
+                childShowCipher();
+            }
+
+            inputLength = msgSize + encInputOffset;
+            if (testingMisalignment) {
+                encodeLength = cipher.getOutputSize(msgSize - lastChunkSize) + encOutputOffset;
+                encodeLength += cipher.getOutputSize(lastChunkSize);
+                decodeLength = dCipher.getOutputSize(encodeLength - lastChunkSize) + decOutputOffset;
+                decodeLength += dCipher.getOutputSize(lastChunkSize);
+            } else {
+                encodeLength = cipher.getOutputSize(msgSize) + encOutputOffset;
+                decodeLength = dCipher.getOutputSize(encodeLength) + decOutputOffset;
+            }
+
+            input = new byte[inputLength];
+            for (int i = encInputOffset, j = 0; i < inputLength; i++, j++) {
+                input[i] = (byte) (j & 0xff);
+            }
+
+            // do one encode and decode in preparation
+            encode = new byte[encodeLength];
+            decode = new byte[decodeLength];
+            if (testingMisalignment) {
+                decodeMsgSize = cipher.update(input, encInputOffset, (msgSize - lastChunkSize), encode, encOutputOffset);
+                decodeMsgSize += cipher.doFinal(input, (encInputOffset + msgSize - lastChunkSize), lastChunkSize, encode, (encOutputOffset + decodeMsgSize));
+
+                int tempSize = dCipher.update(encode, encOutputOffset, (decodeMsgSize - lastChunkSize), decode, decOutputOffset);
+                dCipher.doFinal(encode, (encOutputOffset + decodeMsgSize - lastChunkSize), lastChunkSize, decode, (decOutputOffset + tempSize));
+            } else {
+                decodeMsgSize = cipher.doFinal(input, encInputOffset, msgSize, encode, encOutputOffset);
+                dCipher.doFinal(encode, encOutputOffset, decodeMsgSize, decode, decOutputOffset);
+            }
+            if (checkOutput) {
+                expectedEncode = (byte[]) encode.clone();
+                expectedDecode = (byte[]) decode.clone();
+                showArray(key.getEncoded(), "key:    ");
+                showArray(input, "input:  ");
+                showArray(encode, "encode: ");
+                showArray(decode, "decode: ");
+            }
+        } catch (Exception e) {
+            e.printStackTrace();
+            System.exit(1);
+        }
+    }
+
+    void showArray(byte b[], String name) {
+        System.out.format("%s [%d]: ", name, b.length);
+        for (int i = 0; i < Math.min(b.length, 32); i++) {
+            System.out.format("%02x ", b[i] & 0xff);
+        }
+        System.out.println();
+    }
+
+    void compareArrays(byte b[], byte exp[]) {
+        if (b.length != exp.length) {
+            System.out.format("different lengths for actual and expected output arrays\n");
+            showArray(b, "test: ");
+            showArray(exp, "exp : ");
+            System.exit(1);
+        }
+        for (int i = 0; i < exp.length; i++) {
+            if (b[i] != exp[i]) {
+                System.out.format("output error at index %d: got %02x, expected %02x\n", i, b[i] & 0xff, exp[i] & 0xff);
+                showArray(b, "test: ");
+                showArray(exp, "exp : ");
+                System.exit(1);
+            }
+        }
+    }
+
+    void showCipher(Cipher c, String kind) {
+        System.out.println(kind + " cipher provider: " + cipher.getProvider());
+        System.out.println(kind + " cipher algorithm: " + cipher.getAlgorithm());
+    }
+
+    abstract void childShowCipher();
+
+    void gcm_init(boolean encrypt) throws Exception {
+        gcm_spec = new GCMParameterSpec(tlen * 8, iv);
+        if (encrypt) {
+            // Get a new instance everytime because of reuse IV restrictions
+            cipher = Cipher.getInstance(algorithm + "/" + mode + "/" + paddingStr, "SunJCE");
+            cipher.init(Cipher.ENCRYPT_MODE, key, gcm_spec);
+            cipher.updateAAD(aad);
+        } else {
+            dCipher.init(Cipher.DECRYPT_MODE, key, gcm_spec);
+            dCipher.updateAAD(aad);
+
+
+        }
+    }
+}
diff --git a/hotspot/test/compiler/codegen/aes/TestAESDecode.java b/hotspot/test/compiler/codegen/aes/TestAESDecode.java
new file mode 100644
index 0000000..b485520
--- /dev/null
+++ b/hotspot/test/compiler/codegen/aes/TestAESDecode.java
@@ -0,0 +1,60 @@
+/*
+ * Copyright (c) 2012, 2014, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * 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 compiler.codegen.aes;
+
+import javax.crypto.Cipher;
+
+/**
+ * @author Tom Deneau
+ */
+public class TestAESDecode extends TestAESBase {
+    @Override
+    public void run() {
+        try {
+            if (mode.equals("GCM")) {
+                gcm_init(false);
+            } else if (!noReinit) {
+                dCipher.init(Cipher.DECRYPT_MODE, key, algParams);
+            }
+            decode = new byte[decodeLength];
+            if (testingMisalignment) {
+                int tempSize = dCipher.update(encode, encOutputOffset, (decodeMsgSize - lastChunkSize), decode, decOutputOffset);
+                dCipher.doFinal(encode, (encOutputOffset + decodeMsgSize - lastChunkSize), lastChunkSize, decode, (decOutputOffset + tempSize));
+            } else {
+                dCipher.doFinal(encode, encOutputOffset, decodeMsgSize, decode, decOutputOffset);
+            }
+            if (checkOutput) {
+                compareArrays(decode, expectedDecode);
+            }
+        } catch (Exception e) {
+            throw new Error(e.getMessage(), e);
+        }
+    }
+
+    @Override
+    void childShowCipher() {
+        showCipher(dCipher, "Decryption");
+    }
+}
diff --git a/hotspot/test/compiler/codegen/aes/TestAESEncode.java b/hotspot/test/compiler/codegen/aes/TestAESEncode.java
new file mode 100644
index 0000000..c31da69
--- /dev/null
+++ b/hotspot/test/compiler/codegen/aes/TestAESEncode.java
@@ -0,0 +1,61 @@
+/*
+ * Copyright (c) 2012, 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.
+ *
+ * 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 compiler.codegen.aes;
+
+import javax.crypto.Cipher;
+
+/**
+ * @author Tom Deneau
+ */
+public class TestAESEncode extends TestAESBase {
+    @Override
+    public void run() {
+        try {
+            if (mode.equals("GCM")) {
+                gcm_init(true);
+            } else if (!noReinit) {
+                cipher.init(Cipher.ENCRYPT_MODE, key, algParams);
+            }
+            encode = new byte[encodeLength];
+            if (testingMisalignment) {
+                int tempSize = cipher.update(input, encInputOffset, (msgSize - lastChunkSize), encode, encOutputOffset);
+                cipher.doFinal(input, (encInputOffset + msgSize - lastChunkSize), lastChunkSize, encode, (encOutputOffset + tempSize));
+            } else {
+                cipher.doFinal(input, encInputOffset, msgSize, encode, encOutputOffset);
+            }
+            if (checkOutput) {
+                compareArrays(encode, expectedEncode);
+            }
+        } catch (Exception e) {
+            throw new Error(e.getMessage(), e);
+        }
+    }
+
+    @Override
+    void childShowCipher() {
+        showCipher(cipher, "Encryption");
+    }
+
+}
diff --git a/hotspot/test/compiler/codegen/aes/TestAESMain.java b/hotspot/test/compiler/codegen/aes/TestAESMain.java
new file mode 100644
index 0000000..679cd88
--- /dev/null
+++ b/hotspot/test/compiler/codegen/aes/TestAESMain.java
@@ -0,0 +1,133 @@
+/*
+ * Copyright (c) 2012, 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.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ *
+ */
+
+/**
+ * @test
+ * @bug 7184394
+ * @summary add intrinsics to use AES instructions
+ * @library /testlibrary /
+ * @modules java.base/jdk.internal.misc
+ *          java.management
+ *
+ * @run main/othervm/timeout=600 -Xbatch -DcheckOutput=true -Dmode=CBC
+ *      compiler.codegen.aes.TestAESMain
+ * @run main/othervm/timeout=600 -Xbatch -DcheckOutput=true -Dmode=CBC -DencInputOffset=1
+ *      compiler.codegen.aes.TestAESMain
+ * @run main/othervm/timeout=600 -Xbatch -DcheckOutput=true -Dmode=CBC -DencOutputOffset=1
+ *      compiler.codegen.aes.TestAESMain
+ * @run main/othervm/timeout=600 -Xbatch -DcheckOutput=true -Dmode=CBC -DdecOutputOffset=1
+ *      compiler.codegen.aes.TestAESMain
+ * @run main/othervm/timeout=600 -Xbatch -DcheckOutput=true -Dmode=CBC -DencInputOffset=1 -DencOutputOffset=1
+ *      compiler.codegen.aes.TestAESMain
+ * @run main/othervm/timeout=600 -Xbatch -DcheckOutput=true -Dmode=CBC -DencInputOffset=1 -DencOutputOffset=1 -DdecOutputOffset=1
+ *      compiler.codegen.aes.TestAESMain
+ * @run main/othervm/timeout=600 -Xbatch -DcheckOutput=true -Dmode=CBC -DencInputOffset=1 -DencOutputOffset=1 -DdecOutputOffset=1 -DpaddingStr=NoPadding -DmsgSize=640
+ *      compiler.codegen.aes.TestAESMain
+ *
+ * @run main/othervm/timeout=600 -Xbatch -DcheckOutput=true -Dmode=ECB
+ *      compiler.codegen.aes.TestAESMain
+ * @run main/othervm/timeout=600 -Xbatch -DcheckOutput=true -Dmode=ECB -DencInputOffset=1
+ *      compiler.codegen.aes.TestAESMain
+ * @run main/othervm/timeout=600 -Xbatch -DcheckOutput=true -Dmode=ECB -DencOutputOffset=
+ *      compiler.codegen.aes.TestAESMain
+ * @run main/othervm/timeout=600 -Xbatch -DcheckOutput=true -Dmode=ECB -DdecOutputOffset=1
+ *      compiler.codegen.aes.TestAESMain
+ * @run main/othervm/timeout=600 -Xbatch -DcheckOutput=true -Dmode=ECB -DencInputOffset=1 -DencOutputOffset=1
+ *      compiler.codegen.aes.TestAESMain
+ * @run main/othervm/timeout=600 -Xbatch -DcheckOutput=true -Dmode=ECB -DencInputOffset=1 -DencOutputOffset=1 -DdecOutputOffset=1
+ *      compiler.codegen.aes.TestAESMain
+ * @run main/othervm/timeout=600 -Xbatch -DcheckOutput=true -Dmode=ECB -DencInputOffset=1 -DencOutputOffset=1 -DdecOutputOffset=1 -DpaddingStr=NoPadding -DmsgSize=640
+ *      compiler.codegen.aes.TestAESMain
+ *
+ * @run main/othervm/timeout=600 -Xbatch -DcheckOutput=true -Dmode=GCM
+ *      compiler.codegen.aes.TestAESMain
+ * @run main/othervm/timeout=600 -Xbatch -DcheckOutput=true -Dmode=GCM -DencInputOffset=1
+ *      compiler.codegen.aes.TestAESMain
+ * @run main/othervm/timeout=600 -Xbatch -DcheckOutput=true -Dmode=GCM -DencOutputOffset=1
+ *      compiler.codegen.aes.TestAESMain
+ * @run main/othervm/timeout=600 -Xbatch -DcheckOutput=true -Dmode=GCM -DdecOutputOffset=1
+ *      compiler.codegen.aes.TestAESMain
+ * @run main/othervm/timeout=600 -Xbatch -DcheckOutput=true -Dmode=GCM -DencInputOffset=1 -DencOutputOffset=1
+ *      compiler.codegen.aes.TestAESMain
+ * @run main/othervm/timeout=600 -Xbatch -DcheckOutput=true -Dmode=GCM -DencInputOffset=1 -DencOutputOffset=1 -DdecOutputOffset=1
+ *      compiler.codegen.aes.TestAESMain
+ * @run main/othervm/timeout=600 -Xbatch -DcheckOutput=true -Dmode=GCM -DencInputOffset=1 -DencOutputOffset=1 -DdecOutputOffset=1 -DpaddingStr=NoPadding -DmsgSize=640
+ *      compiler.codegen.aes.TestAESMain
+ *
+ * @run main/othervm/timeout=600 -Xbatch -DcheckOutput=true -Dmode=CTR
+ *      compiler.codegen.aes.TestAESMain
+ * @run main/othervm/timeout=600 -Xbatch -DcheckOutput=true -Dmode=CTR -DencInputOffset=1
+ *      compiler.codegen.aes.TestAESMain
+ * @run main/othervm/timeout=600 -Xbatch -DcheckOutput=true -Dmode=CTR -DencOutputOffset=1
+ *      compiler.codegen.aes.TestAESMain
+ * @run main/othervm/timeout=600 -Xbatch -DcheckOutput=true -Dmode=CTR -DdecOutputOffset=1
+ *      compiler.codegen.aes.TestAESMain
+ * @run main/othervm/timeout=600 -Xbatch -DcheckOutput=true -Dmode=CTR -DencInputOffset=1 -DencOutputOffset=1
+ *      compiler.codegen.aes.TestAESMain
+ * @run main/othervm/timeout=600 -Xbatch -DcheckOutput=true -Dmode=CTR -DencInputOffset=1 -DencOutputOffset=1 -DdecOutputOffset=1
+ *      compiler.codegen.aes.TestAESMain
+ * @run main/othervm/timeout=600 -Xbatch -DcheckOutput=true -Dmode=CTR -DencInputOffset=1 -DencOutputOffset=1 -DdecOutputOffset=1 -DpaddingStr=NoPadding -DmsgSize=640
+ *      compiler.codegen.aes.TestAESMain
+ *
+ * @author Tom Deneau
+ */
+
+package compiler.codegen.aes;
+
+public class TestAESMain {
+    public static void main(String[] args) {
+        int iters = (args.length > 0 ? Integer.valueOf(args[0]) : 1000000);
+        int warmupIters = (args.length > 1 ? Integer.valueOf(args[1]) : 20000);
+        System.out.println(iters + " iterations");
+        TestAESEncode etest = new TestAESEncode();
+        etest.prepare();
+        // warm-up
+        System.out.println("Starting encryption warm-up");
+        for (int i = 0; i < warmupIters; i++) {
+            etest.run();
+        }
+        System.out.println("Finished encryption warm-up");
+        long start = System.nanoTime();
+        for (int i = 0; i < iters; i++) {
+            etest.run();
+        }
+        long end = System.nanoTime();
+        System.out.println("TestAESEncode runtime was " + (double) ((end - start) / 1000000.0) + " ms");
+
+        TestAESDecode dtest = new TestAESDecode();
+        dtest.prepare();
+        // warm-up
+        System.out.println("Starting decryption warm-up");
+        for (int i = 0; i < warmupIters; i++) {
+            dtest.run();
+        }
+        System.out.println("Finished decryption warm-up");
+        start = System.nanoTime();
+        for (int i = 0; i < iters; i++) {
+            dtest.run();
+        }
+        end = System.nanoTime();
+        System.out.println("TestAESDecode runtime was " + (double) ((end - start) / 1000000.0) + " ms");
+    }
+}
diff --git a/hotspot/test/compiler/compilercontrol/InlineMatcherTest.java b/hotspot/test/compiler/compilercontrol/InlineMatcherTest.java
index afba82b..a406e2e 100644
--- a/hotspot/test/compiler/compilercontrol/InlineMatcherTest.java
+++ b/hotspot/test/compiler/compilercontrol/InlineMatcherTest.java
@@ -24,18 +24,23 @@
 /*
  * @test InlineMatcherTest
  * @bug 8074095
+ * @summary Testing of compiler/InlineMatcher
  * @modules java.base/jdk.internal.misc
  * @library /testlibrary /test/lib
- * @build sun.hotspot.WhiteBox
- * @run main ClassFileInstaller sun.hotspot.WhiteBox
- *                              sun.hotspot.WhiteBox$WhiteBoxPermission
- * @run main/othervm -Xbootclasspath/a:. -XX:+UnlockDiagnosticVMOptions -XX:+WhiteBoxAPI InlineMatcherTest
- * @summary Testing of compiler/InlineMatcher
+ *
+ * @build compiler.compilercontrol.InlineMatcherTest
+ * @run driver ClassFileInstaller sun.hotspot.WhiteBox
+ *                                sun.hotspot.WhiteBox$WhiteBoxPermission
+ * @run main/othervm -Xbootclasspath/a:. -XX:+UnlockDiagnosticVMOptions -XX:+WhiteBoxAPI
+ *      compiler.compilercontrol.InlineMatcherTest
  */
 
+package compiler.compilercontrol;
+
+import sun.hotspot.WhiteBox;
+
 import java.lang.reflect.Method;
 import java.util.ArrayList;
-import sun.hotspot.WhiteBox;
 
 public class InlineMatcherTest {
 
@@ -70,17 +75,18 @@
         testCases.add(helper, "--*.*", NO_MATCH); // - is a valid part of the
                                                   // class name
 
-        testCases.add(helper, "+InlineMatcherTest.*", FORCE_INLINE);
-        testCases.add(helper, "+InlineMatcherTest.helper", FORCE_INLINE);
-        testCases.add(helper, "+InlineMatcherTest.helper()", FORCE_INLINE);
-        testCases.add(helper, "+InlineMatcherTest.helper()V", FORCE_INLINE);
-        testCases.add(helper, "+InlineMatcherTest.helper(", FORCE_INLINE);
+        String className = this.getClass().getName().replace('.', '/');
+        testCases.add(helper, "+" + className + ".*", FORCE_INLINE);
+        testCases.add(helper, "+" + className + ".helper", FORCE_INLINE);
+        testCases.add(helper, "+" + className + ".helper()", FORCE_INLINE);
+        testCases.add(helper, "+" + className + ".helper()V", FORCE_INLINE);
+        testCases.add(helper, "+" + className + ".helper(", FORCE_INLINE);
 
-        testCases.add(helper, "-InlineMatcherTest.*", DONT_INLINE);
-        testCases.add(helper, "-InlineMatcherTest.helper", DONT_INLINE);
-        testCases.add(helper, "-InlineMatcherTest.helper()", DONT_INLINE);
-        testCases.add(helper, "-InlineMatcherTest.helper()V", DONT_INLINE);
-        testCases.add(helper, "-InlineMatcherTest.helper(", DONT_INLINE);
+        testCases.add(helper, "-" + className + ".*", DONT_INLINE);
+        testCases.add(helper, "-" + className + ".helper", DONT_INLINE);
+        testCases.add(helper, "-" + className + ".helper()", DONT_INLINE);
+        testCases.add(helper, "-" + className + ".helper()V", DONT_INLINE);
+        testCases.add(helper, "-" + className + ".helper(", DONT_INLINE);
 
         testCases.add(helper, "+abc.*", NO_MATCH);
         testCases.add(helper, "+*.abc", NO_MATCH);
diff --git a/hotspot/test/compiler/compilercontrol/TestCompilerDirectivesCompatibilityBase.java b/hotspot/test/compiler/compilercontrol/TestCompilerDirectivesCompatibilityBase.java
index bd776c1..882e783 100644
--- a/hotspot/test/compiler/compilercontrol/TestCompilerDirectivesCompatibilityBase.java
+++ b/hotspot/test/compiler/compilercontrol/TestCompilerDirectivesCompatibilityBase.java
@@ -24,33 +24,35 @@
 /*
  * @test TestCompilerDirectivesCompatibilityBase
  * @bug 8137167
+ * @summary Test compiler control compatibility with compile command
  * @library /testlibrary /test/lib /
  * @modules java.base/jdk.internal.misc
  *          java.compiler
  *          java.management
+ *
  * @build jdk.test.lib.*
  *        jdk.test.lib.dcmd.*
  *        sun.hotspot.WhiteBox
  *        compiler.testlibrary.CompilerUtils
+ *        compiler.compilercontrol.TestCompilerDirectivesCompatibilityBase
  * @run driver ClassFileInstaller sun.hotspot.WhiteBox
  *                                sun.hotspot.WhiteBox$WhiteBoxPermission
- * @run testng/othervm -Xbootclasspath/a:. -Xmixed -XX:+UnlockDiagnosticVMOptions -XX:+WhiteBoxAPI TestCompilerDirectivesCompatibilityBase
- * @summary Test compiler control compatibility with compile command
+ * @run testng/othervm -Xbootclasspath/a:. -Xmixed -XX:+UnlockDiagnosticVMOptions
+ *      -XX:+WhiteBoxAPI
+ *      compiler.compilercontrol.TestCompilerDirectivesCompatibilityBase
  */
 
+package compiler.compilercontrol;
+
 import compiler.testlibrary.CompilerUtils;
 import compiler.whitebox.CompilerWhiteBoxTest;
 import jdk.test.lib.dcmd.CommandExecutor;
 import jdk.test.lib.dcmd.JMXExecutor;
 import org.testng.annotations.Test;
-import org.testng.Assert;
 import sun.hotspot.WhiteBox;
 
-import java.io.BufferedReader;
 import java.io.File;
-import java.io.StringReader;
 import java.lang.reflect.Method;
-import java.util.Objects;
 
 public class TestCompilerDirectivesCompatibilityBase {
 
diff --git a/hotspot/test/compiler/compilercontrol/TestCompilerDirectivesCompatibilityCommandOff.java b/hotspot/test/compiler/compilercontrol/TestCompilerDirectivesCompatibilityCommandOff.java
index 4b06129..9036919 100644
--- a/hotspot/test/compiler/compilercontrol/TestCompilerDirectivesCompatibilityCommandOff.java
+++ b/hotspot/test/compiler/compilercontrol/TestCompilerDirectivesCompatibilityCommandOff.java
@@ -24,35 +24,28 @@
 /*
  * @test TestCompilerDirectivesCompatibilityCommandOff
  * @bug 8137167
+ * @summary Test compiler control compatibility with compile command
  * @library /testlibrary /test/lib /
  * @modules java.base/jdk.internal.misc
  *          java.compiler
  *          java.management
+ *
  * @build jdk.test.lib.*
  *        jdk.test.lib.dcmd.*
  *        sun.hotspot.WhiteBox
  *        compiler.testlibrary.CompilerUtils
+ *        compiler.compilercontrol.TestCompilerDirectivesCompatibilityCommandOff
  * @run driver ClassFileInstaller sun.hotspot.WhiteBox
  *                                sun.hotspot.WhiteBox$WhiteBoxPermission
  * @run testng/othervm -Xbootclasspath/a:. -Xmixed -XX:+UnlockDiagnosticVMOptions
  *      -XX:-PrintAssembly -XX:CompileCommand=option,*.helper,bool,PrintAssembly,false
- *      -XX:+WhiteBoxAPI TestCompilerDirectivesCompatibilityCommandOff
- * @summary Test compiler control compatibility with compile command
+ *      -XX:+WhiteBoxAPI
+ *      compiler.compilercontrol.TestCompilerDirectivesCompatibilityCommandOff
  */
 
+package compiler.compilercontrol;
+
 import jdk.test.lib.dcmd.CommandExecutor;
-import jdk.test.lib.dcmd.JMXExecutor;
-
-import org.testng.annotations.Test;
-import org.testng.Assert;
-
-import sun.hotspot.WhiteBox;
-
-import java.io.BufferedReader;
-import java.io.File;
-import java.io.StringReader;
-import java.lang.reflect.Method;
-import java.util.Objects;
 
 public class TestCompilerDirectivesCompatibilityCommandOff extends TestCompilerDirectivesCompatibilityBase {
 
diff --git a/hotspot/test/compiler/compilercontrol/TestCompilerDirectivesCompatibilityCommandOn.java b/hotspot/test/compiler/compilercontrol/TestCompilerDirectivesCompatibilityCommandOn.java
index e9f2bf1..7336b0e 100644
--- a/hotspot/test/compiler/compilercontrol/TestCompilerDirectivesCompatibilityCommandOn.java
+++ b/hotspot/test/compiler/compilercontrol/TestCompilerDirectivesCompatibilityCommandOn.java
@@ -24,37 +24,29 @@
 /*
  * @test TestCompilerDirectivesCompatibilityCommandOn
  * @bug 8137167
+ * @summary Test compiler control compatibility with compile command
  * @library /testlibrary /test/lib /
  * @modules java.base/jdk.internal.misc
  *          java.compiler
  *          java.management
+ *
  * @build jdk.test.lib.*
  *        jdk.test.lib.dcmd.*
  *        sun.hotspot.WhiteBox
  *        compiler.testlibrary.CompilerUtils
+ *        compiler.compilercontrol.TestCompilerDirectivesCompatibilityCommandOn
  * @run driver ClassFileInstaller sun.hotspot.WhiteBox
  *                                sun.hotspot.WhiteBox$WhiteBoxPermission
  * @run testng/othervm -Xbootclasspath/a:. -Xmixed -XX:+UnlockDiagnosticVMOptions
  *      -XX:-PrintAssembly -XX:CompileCommand=print,*.* -XX:+WhiteBoxAPI
- *      TestCompilerDirectivesCompatibilityCommandOn
- * @summary Test compiler control compatibility with compile command
+ *      compiler.compilercontrol.TestCompilerDirectivesCompatibilityCommandOn
  */
 
+package compiler.compilercontrol;
+
 import jdk.test.lib.dcmd.CommandExecutor;
-import jdk.test.lib.dcmd.JMXExecutor;
 
-import org.testng.annotations.Test;
-import org.testng.Assert;
-
-import sun.hotspot.WhiteBox;
-
-import java.io.BufferedReader;
-import java.io.File;
-import java.io.StringReader;
-import java.lang.reflect.Method;
-import java.util.Objects;
-
-public class TestCompilerDirectivesCompatibilityCommandOn extends TestCompilerDirectivesCompatibilityBase{
+public class TestCompilerDirectivesCompatibilityCommandOn extends TestCompilerDirectivesCompatibilityBase {
 
     public void testCompatibility(CommandExecutor executor, int comp_level) throws Exception {
 
diff --git a/hotspot/test/compiler/compilercontrol/TestCompilerDirectivesCompatibilityFlag.java b/hotspot/test/compiler/compilercontrol/TestCompilerDirectivesCompatibilityFlag.java
index d4d3718..a827656 100644
--- a/hotspot/test/compiler/compilercontrol/TestCompilerDirectivesCompatibilityFlag.java
+++ b/hotspot/test/compiler/compilercontrol/TestCompilerDirectivesCompatibilityFlag.java
@@ -28,30 +28,23 @@
  * @modules java.base/jdk.internal.misc
  *          java.compiler
  *          java.management
+ *
  * @build jdk.test.lib.*
  *        jdk.test.lib.dcmd.*
  *        sun.hotspot.WhiteBox
  *        compiler.testlibrary.CompilerUtils
+ *        compiler.compilercontrol.TestCompilerDirectivesCompatibilityFlag
  * @run driver ClassFileInstaller sun.hotspot.WhiteBox
  *                                sun.hotspot.WhiteBox$WhiteBoxPermission
  * @run testng/othervm -Xbootclasspath/a:. -Xmixed -XX:+UnlockDiagnosticVMOptions
- *      -XX:+PrintAssembly -XX:+WhiteBoxAPI TestCompilerDirectivesCompatibilityFlag
+ *      -XX:+PrintAssembly -XX:+WhiteBoxAPI
+ *      compiler.compilercontrol.TestCompilerDirectivesCompatibilityFlag
  * @summary Test compiler control compatibility with compile command
  */
 
+package compiler.compilercontrol;
+
 import jdk.test.lib.dcmd.CommandExecutor;
-import jdk.test.lib.dcmd.JMXExecutor;
-
-import org.testng.annotations.Test;
-import org.testng.Assert;
-
-import sun.hotspot.WhiteBox;
-
-import java.io.BufferedReader;
-import java.io.File;
-import java.io.StringReader;
-import java.lang.reflect.Method;
-import java.util.Objects;
 
 public class TestCompilerDirectivesCompatibilityFlag extends TestCompilerDirectivesCompatibilityBase {
 
diff --git a/hotspot/test/compiler/compilercontrol/commandfile/CompileOnlyTest.java b/hotspot/test/compiler/compilercontrol/commandfile/CompileOnlyTest.java
index 8acac55..ae03d3f 100644
--- a/hotspot/test/compiler/compilercontrol/commandfile/CompileOnlyTest.java
+++ b/hotspot/test/compiler/compilercontrol/commandfile/CompileOnlyTest.java
@@ -26,10 +26,14 @@
  * @bug 8137167
  * @summary Tests CompileCommand=compileonly
  * @modules java.base/jdk.internal.misc
- * @library /testlibrary /test/lib ../share /
+ * @library /testlibrary /test/lib /
+ *
  * @build compiler.compilercontrol.commandfile.CompileOnlyTest
- *        pool.sub.* pool.subpack.* sun.hotspot.WhiteBox
- *        compiler.testlibrary.CompilerUtils compiler.compilercontrol.share.actions.*
+ *        compiler.compilercontrol.share.pool.sub.*
+ *        compiler.compilercontrol.share.pool.subpack.*
+ *        sun.hotspot.WhiteBox
+ *        compiler.testlibrary.CompilerUtils
+ *        compiler.compilercontrol.share.actions.*
  * @run driver ClassFileInstaller sun.hotspot.WhiteBox
  *                                sun.hotspot.WhiteBox$WhiteBoxPermission
  * @run driver compiler.compilercontrol.commandfile.CompileOnlyTest
diff --git a/hotspot/test/compiler/compilercontrol/commandfile/ExcludeTest.java b/hotspot/test/compiler/compilercontrol/commandfile/ExcludeTest.java
index 4a4bde5..0caa287 100644
--- a/hotspot/test/compiler/compilercontrol/commandfile/ExcludeTest.java
+++ b/hotspot/test/compiler/compilercontrol/commandfile/ExcludeTest.java
@@ -26,10 +26,14 @@
  * @bug 8137167
  * @summary Tests CompileCommand=exclude
  * @modules java.base/jdk.internal.misc
- * @library /testlibrary /test/lib ../share /
+ * @library /testlibrary /test/lib /
+ *
  * @build compiler.compilercontrol.commandfile.ExcludeTest
- *        pool.sub.* pool.subpack.* sun.hotspot.WhiteBox
- *        compiler.testlibrary.CompilerUtils compiler.compilercontrol.share.actions.*
+ *        compiler.compilercontrol.share.pool.sub.*
+ *        compiler.compilercontrol.share.pool.subpack.*
+ *        sun.hotspot.WhiteBox
+ *        compiler.testlibrary.CompilerUtils
+ *        compiler.compilercontrol.share.actions.*
  * @run driver ClassFileInstaller sun.hotspot.WhiteBox
  *                                sun.hotspot.WhiteBox$WhiteBoxPermission
  * @run driver compiler.compilercontrol.commandfile.ExcludeTest
diff --git a/hotspot/test/compiler/compilercontrol/commandfile/LogTest.java b/hotspot/test/compiler/compilercontrol/commandfile/LogTest.java
index 75b9e79..1d5768b 100644
--- a/hotspot/test/compiler/compilercontrol/commandfile/LogTest.java
+++ b/hotspot/test/compiler/compilercontrol/commandfile/LogTest.java
@@ -26,10 +26,14 @@
  * @bug 8137167
  * @summary Tests CompileCommand=log
  * @modules java.base/jdk.internal.misc
- * @library /testlibrary /test/lib ../share /
+ * @library /testlibrary /test/lib /
+ *
  * @build compiler.compilercontrol.commandfile.LogTest
- *        pool.sub.* pool.subpack.* sun.hotspot.WhiteBox
- *        compiler.testlibrary.CompilerUtils compiler.compilercontrol.share.actions.*
+ *        compiler.compilercontrol.share.pool.sub.*
+ *        compiler.compilercontrol.share.pool.subpack.*
+ *        sun.hotspot.WhiteBox
+ *        compiler.testlibrary.CompilerUtils
+ *        compiler.compilercontrol.share.actions.*
  * @run driver ClassFileInstaller sun.hotspot.WhiteBox
  *                                sun.hotspot.WhiteBox$WhiteBoxPermission
  * @run driver compiler.compilercontrol.commandfile.LogTest
diff --git a/hotspot/test/compiler/compilercontrol/commandfile/PrintTest.java b/hotspot/test/compiler/compilercontrol/commandfile/PrintTest.java
index ed45af6..30127ce 100644
--- a/hotspot/test/compiler/compilercontrol/commandfile/PrintTest.java
+++ b/hotspot/test/compiler/compilercontrol/commandfile/PrintTest.java
@@ -26,10 +26,14 @@
  * @bug 8137167
  * @summary Tests CompileCommand=print
  * @modules java.base/jdk.internal.misc
- * @library /testlibrary /test/lib ../share /
+ * @library /testlibrary /test/lib /
+ *
  * @build compiler.compilercontrol.commandfile.PrintTest
- *        pool.sub.* pool.subpack.* sun.hotspot.WhiteBox
- *        compiler.testlibrary.CompilerUtils compiler.compilercontrol.share.actions.*
+ *        compiler.compilercontrol.share.pool.sub.*
+ *        compiler.compilercontrol.share.pool.subpack.*
+ *        sun.hotspot.WhiteBox
+ *        compiler.testlibrary.CompilerUtils
+ *        compiler.compilercontrol.share.actions.*
  * @run driver ClassFileInstaller sun.hotspot.WhiteBox
  *                                sun.hotspot.WhiteBox$WhiteBoxPermission
  * @run driver compiler.compilercontrol.commandfile.PrintTest
diff --git a/hotspot/test/compiler/compilercontrol/commands/CompileOnlyTest.java b/hotspot/test/compiler/compilercontrol/commands/CompileOnlyTest.java
index db98ab9..49b6c48 100644
--- a/hotspot/test/compiler/compilercontrol/commands/CompileOnlyTest.java
+++ b/hotspot/test/compiler/compilercontrol/commands/CompileOnlyTest.java
@@ -26,10 +26,14 @@
  * @bug 8137167
  * @summary Tests CompileCommand=compileonly
  * @modules java.base/jdk.internal.misc
- * @library /testlibrary /test/lib ../share /
+ * @library /testlibrary /test/lib /
+ *
  * @build compiler.compilercontrol.commands.CompileOnlyTest
- *        pool.sub.* pool.subpack.* sun.hotspot.WhiteBox
- *        compiler.testlibrary.CompilerUtils compiler.compilercontrol.share.actions.*
+ *        compiler.compilercontrol.share.pool.sub.*
+ *        compiler.compilercontrol.share.pool.subpack.*
+ *        sun.hotspot.WhiteBox
+ *        compiler.testlibrary.CompilerUtils
+ *        compiler.compilercontrol.share.actions.*
  * @run driver ClassFileInstaller sun.hotspot.WhiteBox
  *                                sun.hotspot.WhiteBox$WhiteBoxPermission
  * @run driver compiler.compilercontrol.commands.CompileOnlyTest
diff --git a/hotspot/test/compiler/compilercontrol/commands/ExcludeTest.java b/hotspot/test/compiler/compilercontrol/commands/ExcludeTest.java
index 272d4654..d6b931e 100644
--- a/hotspot/test/compiler/compilercontrol/commands/ExcludeTest.java
+++ b/hotspot/test/compiler/compilercontrol/commands/ExcludeTest.java
@@ -26,10 +26,14 @@
  * @bug 8137167
  * @summary Tests CompileCommand=exclude
  * @modules java.base/jdk.internal.misc
- * @library /testlibrary /test/lib ../share /
+ * @library /testlibrary /test/lib /
+ *
  * @build compiler.compilercontrol.commands.ExcludeTest
- *        pool.sub.* pool.subpack.* sun.hotspot.WhiteBox
- *        compiler.testlibrary.CompilerUtils compiler.compilercontrol.share.actions.*
+ *        compiler.compilercontrol.share.pool.sub.*
+ *        compiler.compilercontrol.share.pool.subpack.*
+ *        sun.hotspot.WhiteBox
+ *        compiler.testlibrary.CompilerUtils
+ *        compiler.compilercontrol.share.actions.*
  * @run driver ClassFileInstaller sun.hotspot.WhiteBox
  *                                sun.hotspot.WhiteBox$WhiteBoxPermission
  * @run driver compiler.compilercontrol.commands.ExcludeTest
diff --git a/hotspot/test/compiler/compilercontrol/commands/LogTest.java b/hotspot/test/compiler/compilercontrol/commands/LogTest.java
index 01189e3..b079475 100644
--- a/hotspot/test/compiler/compilercontrol/commands/LogTest.java
+++ b/hotspot/test/compiler/compilercontrol/commands/LogTest.java
@@ -26,10 +26,14 @@
  * @bug 8137167
  * @summary Tests CompileCommand=log
  * @modules java.base/jdk.internal.misc
- * @library /testlibrary /test/lib ../share /
+ * @library /testlibrary /test/lib /
+ *
  * @build compiler.compilercontrol.commands.LogTest
- *        pool.sub.* pool.subpack.* sun.hotspot.WhiteBox
- *        compiler.testlibrary.CompilerUtils compiler.compilercontrol.share.actions.*
+ *        compiler.compilercontrol.share.pool.sub.*
+ *        compiler.compilercontrol.share.pool.subpack.*
+ *        sun.hotspot.WhiteBox
+ *        compiler.testlibrary.CompilerUtils
+ *        compiler.compilercontrol.share.actions.*
  * @run driver ClassFileInstaller sun.hotspot.WhiteBox
  *                                sun.hotspot.WhiteBox$WhiteBoxPermission
  * @run driver compiler.compilercontrol.commands.LogTest
diff --git a/hotspot/test/compiler/compilercontrol/commands/PrintTest.java b/hotspot/test/compiler/compilercontrol/commands/PrintTest.java
index f1bbe20..ca5eaa0 100644
--- a/hotspot/test/compiler/compilercontrol/commands/PrintTest.java
+++ b/hotspot/test/compiler/compilercontrol/commands/PrintTest.java
@@ -26,10 +26,14 @@
  * @bug 8137167
  * @summary Tests CompileCommand=print
  * @modules java.base/jdk.internal.misc
- * @library /testlibrary /test/lib ../share /
+ * @library /testlibrary /test/lib /
+ *
  * @build compiler.compilercontrol.commands.PrintTest
- *        pool.sub.* pool.subpack.* sun.hotspot.WhiteBox
- *        compiler.testlibrary.CompilerUtils compiler.compilercontrol.share.actions.*
+ *        compiler.compilercontrol.share.pool.sub.*
+ *        compiler.compilercontrol.share.pool.subpack.*
+ *        sun.hotspot.WhiteBox
+ *        compiler.testlibrary.CompilerUtils
+ *        compiler.compilercontrol.share.actions.*
  * @run driver ClassFileInstaller sun.hotspot.WhiteBox
  *                                sun.hotspot.WhiteBox$WhiteBoxPermission
  * @run driver compiler.compilercontrol.commands.PrintTest
diff --git a/hotspot/test/compiler/compilercontrol/directives/CompileOnlyTest.java b/hotspot/test/compiler/compilercontrol/directives/CompileOnlyTest.java
index d9e8bd8..fce5841 100644
--- a/hotspot/test/compiler/compilercontrol/directives/CompileOnlyTest.java
+++ b/hotspot/test/compiler/compilercontrol/directives/CompileOnlyTest.java
@@ -26,10 +26,14 @@
  * @bug 8137167
  * @summary Tests directives to be able to compile only specified  methods
  * @modules java.base/jdk.internal.misc
- * @library /testlibrary /test/lib ../share /
+ * @library /testlibrary /test/lib /
+ *
  * @build compiler.compilercontrol.directives.CompileOnlyTest
- *        pool.sub.* pool.subpack.* sun.hotspot.WhiteBox
- *        compiler.testlibrary.CompilerUtils compiler.compilercontrol.share.actions.*
+ *        compiler.compilercontrol.share.pool.sub.*
+ *        compiler.compilercontrol.share.pool.subpack.*
+ *        sun.hotspot.WhiteBox
+ *        compiler.testlibrary.CompilerUtils
+ *        compiler.compilercontrol.share.actions.*
  * @run driver ClassFileInstaller sun.hotspot.WhiteBox
  *                                sun.hotspot.WhiteBox$WhiteBoxPermission
  * @run driver compiler.compilercontrol.directives.CompileOnlyTest
diff --git a/hotspot/test/compiler/compilercontrol/directives/ExcludeTest.java b/hotspot/test/compiler/compilercontrol/directives/ExcludeTest.java
index 54614ab..fda9b26 100644
--- a/hotspot/test/compiler/compilercontrol/directives/ExcludeTest.java
+++ b/hotspot/test/compiler/compilercontrol/directives/ExcludeTest.java
@@ -26,10 +26,14 @@
  * @bug 8137167
  * @summary Tests directives to be able to exclude methods from compilation
  * @modules java.base/jdk.internal.misc
- * @library /testlibrary /test/lib ../share /
+ * @library /testlibrary /test/lib /
+ *
  * @build compiler.compilercontrol.directives.ExcludeTest
- *        pool.sub.* pool.subpack.* sun.hotspot.WhiteBox
- *        compiler.testlibrary.CompilerUtils compiler.compilercontrol.share.actions.*
+ *        compiler.compilercontrol.share.pool.sub.*
+ *        compiler.compilercontrol.share.pool.subpack.*
+ *        sun.hotspot.WhiteBox
+ *        compiler.testlibrary.CompilerUtils
+ *        compiler.compilercontrol.share.actions.*
  * @run driver ClassFileInstaller sun.hotspot.WhiteBox
  *                                sun.hotspot.WhiteBox$WhiteBoxPermission
  * @run driver compiler.compilercontrol.directives.ExcludeTest
diff --git a/hotspot/test/compiler/compilercontrol/directives/LogTest.java b/hotspot/test/compiler/compilercontrol/directives/LogTest.java
index 1832323..d5cef20 100644
--- a/hotspot/test/compiler/compilercontrol/directives/LogTest.java
+++ b/hotspot/test/compiler/compilercontrol/directives/LogTest.java
@@ -26,10 +26,14 @@
  * @bug 8137167
  * @summary Tests directives to be able to turn on LogCompilation
  * @modules java.base/jdk.internal.misc
- * @library /testlibrary /test/lib ../share /
+ * @library /testlibrary /test/lib /
+ *
  * @build compiler.compilercontrol.directives.LogTest
- *        pool.sub.* pool.subpack.* sun.hotspot.WhiteBox
- *        compiler.testlibrary.CompilerUtils compiler.compilercontrol.share.actions.*
+ *        compiler.compilercontrol.share.pool.sub.*
+ *        compiler.compilercontrol.share.pool.subpack.*
+ *        sun.hotspot.WhiteBox
+ *        compiler.testlibrary.CompilerUtils
+ *        compiler.compilercontrol.share.actions.*
  * @run driver ClassFileInstaller sun.hotspot.WhiteBox
  *                                sun.hotspot.WhiteBox$WhiteBoxPermission
  * @run driver compiler.compilercontrol.directives.LogTest
diff --git a/hotspot/test/compiler/compilercontrol/directives/PrintTest.java b/hotspot/test/compiler/compilercontrol/directives/PrintTest.java
index d551865..4132654 100644
--- a/hotspot/test/compiler/compilercontrol/directives/PrintTest.java
+++ b/hotspot/test/compiler/compilercontrol/directives/PrintTest.java
@@ -26,10 +26,14 @@
  * @bug 8137167
  * @summary Tests directives to be able to turn on print_assembly
  * @modules java.base/jdk.internal.misc
- * @library /testlibrary /test/lib ../share /
+ * @library /testlibrary /test/lib /
+ *
  * @build compiler.compilercontrol.directives.PrintTest
- *        pool.sub.* pool.subpack.* sun.hotspot.WhiteBox
- *        compiler.testlibrary.CompilerUtils compiler.compilercontrol.share.actions.*
+ *        compiler.compilercontrol.share.pool.sub.*
+ *        compiler.compilercontrol.share.pool.subpack.*
+ *        sun.hotspot.WhiteBox
+ *        compiler.testlibrary.CompilerUtils
+ *        compiler.compilercontrol.share.actions.*
  * @run driver ClassFileInstaller sun.hotspot.WhiteBox
  *                                sun.hotspot.WhiteBox$WhiteBoxPermission
  * @run driver compiler.compilercontrol.directives.PrintTest
diff --git a/hotspot/test/compiler/compilercontrol/jcmd/AddAndRemoveTest.java b/hotspot/test/compiler/compilercontrol/jcmd/AddAndRemoveTest.java
index 01de110..55674eb 100644
--- a/hotspot/test/compiler/compilercontrol/jcmd/AddAndRemoveTest.java
+++ b/hotspot/test/compiler/compilercontrol/jcmd/AddAndRemoveTest.java
@@ -26,10 +26,14 @@
  * @bug 8137167
  * @summary Tests directives to be able to add and remove directives
  * @modules java.base/jdk.internal.misc
- * @library /testlibrary /test/lib ../share /
+ * @library /testlibrary /test/lib /
+ *
  * @build compiler.compilercontrol.jcmd.AddAndRemoveTest
- *        pool.sub.* pool.subpack.* sun.hotspot.WhiteBox
- *        compiler.testlibrary.CompilerUtils compiler.compilercontrol.share.actions.*
+ *        compiler.compilercontrol.share.pool.sub.*
+ *        compiler.compilercontrol.share.pool.subpack.*
+ *        sun.hotspot.WhiteBox
+ *        compiler.testlibrary.CompilerUtils
+ *        compiler.compilercontrol.share.actions.*
  * @run driver ClassFileInstaller sun.hotspot.WhiteBox
  *                                sun.hotspot.WhiteBox$WhiteBoxPermission
  * @run driver compiler.compilercontrol.jcmd.AddAndRemoveTest
diff --git a/hotspot/test/compiler/compilercontrol/jcmd/AddCompileOnlyTest.java b/hotspot/test/compiler/compilercontrol/jcmd/AddCompileOnlyTest.java
index e3783b4..598a2ea 100644
--- a/hotspot/test/compiler/compilercontrol/jcmd/AddCompileOnlyTest.java
+++ b/hotspot/test/compiler/compilercontrol/jcmd/AddCompileOnlyTest.java
@@ -26,10 +26,14 @@
  * @bug 8137167
  * @summary Tests jcmd to be able to add a directive to compile only specified methods
  * @modules java.base/jdk.internal.misc
- * @library /testlibrary /test/lib ../share /
+ * @library /testlibrary /test/lib /
+ *
  * @build compiler.compilercontrol.jcmd.AddCompileOnlyTest
- *        pool.sub.* pool.subpack.* sun.hotspot.WhiteBox
- *        compiler.testlibrary.CompilerUtils compiler.compilercontrol.share.actions.*
+ *        compiler.compilercontrol.share.pool.sub.*
+ *        compiler.compilercontrol.share.pool.subpack.*
+ *        sun.hotspot.WhiteBox
+ *        compiler.testlibrary.CompilerUtils
+ *        compiler.compilercontrol.share.actions.*
  * @run driver ClassFileInstaller sun.hotspot.WhiteBox
  *                                sun.hotspot.WhiteBox$WhiteBoxPermission
  * @run driver compiler.compilercontrol.jcmd.AddCompileOnlyTest
diff --git a/hotspot/test/compiler/compilercontrol/jcmd/AddExcludeTest.java b/hotspot/test/compiler/compilercontrol/jcmd/AddExcludeTest.java
index a4d552f..c8be85d 100644
--- a/hotspot/test/compiler/compilercontrol/jcmd/AddExcludeTest.java
+++ b/hotspot/test/compiler/compilercontrol/jcmd/AddExcludeTest.java
@@ -26,10 +26,14 @@
  * @bug 8137167
  * @summary Tests jcmd to be able to add a directive to exclude only specified methods
  * @modules java.base/jdk.internal.misc
- * @library /testlibrary /test/lib ../share /
+ * @library /testlibrary /test/lib /
+ *
  * @build compiler.compilercontrol.jcmd.AddExcludeTest
- *        pool.sub.* pool.subpack.* sun.hotspot.WhiteBox
- *        compiler.testlibrary.CompilerUtils compiler.compilercontrol.share.actions.*
+ *        compiler.compilercontrol.share.pool.sub.*
+ *        compiler.compilercontrol.share.pool.subpack.*
+ *        sun.hotspot.WhiteBox
+ *        compiler.testlibrary.CompilerUtils
+ *        compiler.compilercontrol.share.actions.*
  * @run driver ClassFileInstaller sun.hotspot.WhiteBox
  *                                sun.hotspot.WhiteBox$WhiteBoxPermission
  * @run driver compiler.compilercontrol.jcmd.AddExcludeTest
diff --git a/hotspot/test/compiler/compilercontrol/jcmd/AddLogTest.java b/hotspot/test/compiler/compilercontrol/jcmd/AddLogTest.java
index acf98fa8..c4ffd00 100644
--- a/hotspot/test/compiler/compilercontrol/jcmd/AddLogTest.java
+++ b/hotspot/test/compiler/compilercontrol/jcmd/AddLogTest.java
@@ -26,10 +26,14 @@
  * @bug 8137167
  * @summary Tests jcmd to be able to add a directive to log only specified methods
  * @modules java.base/jdk.internal.misc
- * @library /testlibrary /test/lib ../share /
+ * @library /testlibrary /test/lib /
+ *
  * @build compiler.compilercontrol.jcmd.AddLogTest
- *        pool.sub.* pool.subpack.* sun.hotspot.WhiteBox
- *        compiler.testlibrary.CompilerUtils compiler.compilercontrol.share.actions.*
+ *        compiler.compilercontrol.share.pool.sub.*
+ *        compiler.compilercontrol.share.pool.subpack.*
+ *        sun.hotspot.WhiteBox
+ *        compiler.testlibrary.CompilerUtils
+ *        compiler.compilercontrol.share.actions.*
  * @run driver ClassFileInstaller sun.hotspot.WhiteBox
  *                                sun.hotspot.WhiteBox$WhiteBoxPermission
  * @run driver compiler.compilercontrol.jcmd.AddLogTest
diff --git a/hotspot/test/compiler/compilercontrol/jcmd/AddPrintAssemblyTest.java b/hotspot/test/compiler/compilercontrol/jcmd/AddPrintAssemblyTest.java
index aff3938..5d81789 100644
--- a/hotspot/test/compiler/compilercontrol/jcmd/AddPrintAssemblyTest.java
+++ b/hotspot/test/compiler/compilercontrol/jcmd/AddPrintAssemblyTest.java
@@ -27,10 +27,14 @@
  * @summary Tests jcmd to be able to add a directive to print assembly
  *          only for specified methods
  * @modules java.base/jdk.internal.misc
- * @library /testlibrary /test/lib ../share /
+ * @library /testlibrary /test/lib /
+ *
  * @build compiler.compilercontrol.jcmd.AddPrintAssemblyTest
- *        pool.sub.* pool.subpack.* sun.hotspot.WhiteBox
- *        compiler.testlibrary.CompilerUtils compiler.compilercontrol.share.actions.*
+ *        compiler.compilercontrol.share.pool.sub.*
+ *        compiler.compilercontrol.share.pool.subpack.*
+ *        sun.hotspot.WhiteBox
+ *        compiler.testlibrary.CompilerUtils
+ *        compiler.compilercontrol.share.actions.*
  * @run driver ClassFileInstaller sun.hotspot.WhiteBox
  *                                sun.hotspot.WhiteBox$WhiteBoxPermission
  * @run driver compiler.compilercontrol.jcmd.AddPrintAssemblyTest
diff --git a/hotspot/test/compiler/compilercontrol/jcmd/ClearDirectivesFileStackTest.java b/hotspot/test/compiler/compilercontrol/jcmd/ClearDirectivesFileStackTest.java
index 75c2e8a..bd01ba1 100644
--- a/hotspot/test/compiler/compilercontrol/jcmd/ClearDirectivesFileStackTest.java
+++ b/hotspot/test/compiler/compilercontrol/jcmd/ClearDirectivesFileStackTest.java
@@ -24,13 +24,17 @@
 /*
  * @test
  * @bug 8137167
- * @ignore 8140405
  * @summary Tests jcmd to be able to clear directives added via options
  * @modules java.base/jdk.internal.misc
- * @library /testlibrary /test/lib ../share /
+ * @library /testlibrary /test/lib /
+ *
+ * @ignore 8140405
  * @build compiler.compilercontrol.jcmd.ClearDirectivesFileStackTest
- *        pool.sub.* pool.subpack.* sun.hotspot.WhiteBox
- *        compiler.testlibrary.CompilerUtils compiler.compilercontrol.share.actions.*
+ *        compiler.compilercontrol.share.pool.sub.*
+ *        compiler.compilercontrol.share.pool.subpack.*
+ *        sun.hotspot.WhiteBox
+ *        compiler.testlibrary.CompilerUtils
+ *        compiler.compilercontrol.share.actions.*
  * @run driver ClassFileInstaller sun.hotspot.WhiteBox
  *                                sun.hotspot.WhiteBox$WhiteBoxPermission
  * @run driver compiler.compilercontrol.jcmd.ClearDirectivesFileStackTest
diff --git a/hotspot/test/compiler/compilercontrol/jcmd/ClearDirectivesStackTest.java b/hotspot/test/compiler/compilercontrol/jcmd/ClearDirectivesStackTest.java
index 63b467a..d8c8c81 100644
--- a/hotspot/test/compiler/compilercontrol/jcmd/ClearDirectivesStackTest.java
+++ b/hotspot/test/compiler/compilercontrol/jcmd/ClearDirectivesStackTest.java
@@ -26,10 +26,14 @@
  * @bug 8137167
  * @summary Tests clear JCMD command
  * @modules java.base/jdk.internal.misc
- * @library /testlibrary /test/lib ../share /
+ * @library /testlibrary /test/lib /
+ *
  * @build compiler.compilercontrol.jcmd.ClearDirectivesStackTest
- *        pool.sub.* pool.subpack.* sun.hotspot.WhiteBox
- *        compiler.testlibrary.CompilerUtils compiler.compilercontrol.share.actions.*
+ *        compiler.compilercontrol.share.pool.sub.*
+ *        compiler.compilercontrol.share.pool.subpack.*
+ *        sun.hotspot.WhiteBox
+ *        compiler.testlibrary.CompilerUtils
+ *        compiler.compilercontrol.share.actions.*
  * @run driver ClassFileInstaller sun.hotspot.WhiteBox
  *                                sun.hotspot.WhiteBox$WhiteBoxPermission
  * @run driver compiler.compilercontrol.jcmd.ClearDirectivesStackTest
diff --git a/hotspot/test/compiler/compilercontrol/jcmd/PrintDirectivesTest.java b/hotspot/test/compiler/compilercontrol/jcmd/PrintDirectivesTest.java
index 44c1d47..297ad1a 100644
--- a/hotspot/test/compiler/compilercontrol/jcmd/PrintDirectivesTest.java
+++ b/hotspot/test/compiler/compilercontrol/jcmd/PrintDirectivesTest.java
@@ -26,11 +26,15 @@
  * @bug 8137167
  * @summary Tests jcmd to be able to add a directive to compile only specified methods
  * @modules java.base/jdk.internal.misc
- * @library /testlibrary /test/lib ../share /
+ * @library /testlibrary /test/lib /
  * @requires vm.flavor != "minimal"
+ *
  * @build compiler.compilercontrol.jcmd.PrintDirectivesTest
- *        pool.sub.* pool.subpack.* sun.hotspot.WhiteBox
- *        compiler.testlibrary.CompilerUtils compiler.compilercontrol.share.actions.*
+ *        compiler.compilercontrol.share.pool.sub.*
+ *        compiler.compilercontrol.share.pool.subpack.*
+ *        sun.hotspot.WhiteBox
+ *        compiler.testlibrary.CompilerUtils
+ *        compiler.compilercontrol.share.actions.*
  * @run driver ClassFileInstaller sun.hotspot.WhiteBox
  *                                sun.hotspot.WhiteBox$WhiteBoxPermission
  * @run driver compiler.compilercontrol.jcmd.PrintDirectivesTest
diff --git a/hotspot/test/compiler/compilercontrol/jcmd/StressAddJcmdBase.java b/hotspot/test/compiler/compilercontrol/jcmd/StressAddJcmdBase.java
index 580d9b6..4f8dd0f 100644
--- a/hotspot/test/compiler/compilercontrol/jcmd/StressAddJcmdBase.java
+++ b/hotspot/test/compiler/compilercontrol/jcmd/StressAddJcmdBase.java
@@ -26,11 +26,11 @@
 import compiler.compilercontrol.parser.HugeDirectiveUtil;
 import compiler.compilercontrol.share.AbstractTestBase;
 import compiler.compilercontrol.share.method.MethodDescriptor;
+import compiler.compilercontrol.share.pool.PoolHelper;
 import compiler.compilercontrol.share.scenario.Executor;
 import jdk.test.lib.OutputAnalyzer;
 import jdk.test.lib.TimeLimitedRunner;
 import jdk.test.lib.Utils;
-import pool.PoolHelper;
 
 import java.util.ArrayList;
 import java.util.List;
diff --git a/hotspot/test/compiler/compilercontrol/jcmd/StressAddMultiThreadedTest.java b/hotspot/test/compiler/compilercontrol/jcmd/StressAddMultiThreadedTest.java
index 83f05f8..2fbe536 100644
--- a/hotspot/test/compiler/compilercontrol/jcmd/StressAddMultiThreadedTest.java
+++ b/hotspot/test/compiler/compilercontrol/jcmd/StressAddMultiThreadedTest.java
@@ -27,9 +27,12 @@
  * @summary Tests jcmd to be able to add a lot of huge directive files with
  *          parallel executed jcmds until timeout has reached
  * @modules java.base/jdk.internal.misc
- * @library /testlibrary /test/lib ../share /
+ * @library /testlibrary /test/lib /
+ *
  * @build compiler.compilercontrol.jcmd.StressAddMultiThreadedTest
- *        pool.sub.* pool.subpack.* sun.hotspot.WhiteBox
+ *        compiler.compilercontrol.share.pool.sub.*
+ *        compiler.compilercontrol.share.pool.subpack.*
+ *        sun.hotspot.WhiteBox
  *        compiler.testlibrary.CompilerUtils
  *        compiler.compilercontrol.share.actions.*
  * @run driver ClassFileInstaller sun.hotspot.WhiteBox
diff --git a/hotspot/test/compiler/compilercontrol/logcompilation/LogTest.java b/hotspot/test/compiler/compilercontrol/logcompilation/LogTest.java
index 68b5981..1535d3e 100644
--- a/hotspot/test/compiler/compilercontrol/logcompilation/LogTest.java
+++ b/hotspot/test/compiler/compilercontrol/logcompilation/LogTest.java
@@ -26,10 +26,14 @@
  * @bug 8137167
  * @summary Tests LogCompilation executed standalone without log commands or directives
  * @modules java.base/jdk.internal.misc
- * @library /testlibrary /test/lib ../share /
+ * @library /testlibrary /test/lib /
+ *
  * @build compiler.compilercontrol.logcompilation.LogTest
- *        pool.sub.* pool.subpack.* sun.hotspot.WhiteBox
- *        compiler.testlibrary.CompilerUtils compiler.compilercontrol.share.actions.*
+ *        compiler.compilercontrol.share.pool.sub.*
+ *        compiler.compilercontrol.share.pool.subpack.*
+ *        sun.hotspot.WhiteBox
+ *        compiler.testlibrary.CompilerUtils
+ *        compiler.compilercontrol.share.actions.*
  * @run driver ClassFileInstaller sun.hotspot.WhiteBox
  *                                sun.hotspot.WhiteBox$WhiteBoxPermission
  * @run driver compiler.compilercontrol.logcompilation.LogTest
diff --git a/hotspot/test/compiler/compilercontrol/matcher/MethodMatcherTest.java b/hotspot/test/compiler/compilercontrol/matcher/MethodMatcherTest.java
index 2c8bcb5..91c7fa7 100644
--- a/hotspot/test/compiler/compilercontrol/matcher/MethodMatcherTest.java
+++ b/hotspot/test/compiler/compilercontrol/matcher/MethodMatcherTest.java
@@ -26,7 +26,8 @@
  * @bug 8135068
  * @summary Tests CompilerCommand's method matcher
  * @modules java.base/jdk.internal.misc
- * @library /testlibrary /test/lib ../share /
+ * @library /testlibrary /test/lib /
+ *
  * @build compiler.compilercontrol.matcher.MethodMatcherTest
  * @run driver ClassFileInstaller sun.hotspot.WhiteBox
  *                                sun.hotspot.WhiteBox$WhiteBoxPermission
@@ -36,10 +37,10 @@
 
 package compiler.compilercontrol.matcher;
 
-import jdk.test.lib.Pair;
 import compiler.compilercontrol.share.method.MethodDescriptor;
 import compiler.compilercontrol.share.method.MethodGenerator;
-import pool.PoolHelper;
+import compiler.compilercontrol.share.pool.PoolHelper;
+import jdk.test.lib.Pair;
 import sun.hotspot.WhiteBox;
 
 import java.lang.reflect.Executable;
diff --git a/hotspot/test/compiler/compilercontrol/mixed/RandomCommandsTest.java b/hotspot/test/compiler/compilercontrol/mixed/RandomCommandsTest.java
index 2455766..85cb8c6 100644
--- a/hotspot/test/compiler/compilercontrol/mixed/RandomCommandsTest.java
+++ b/hotspot/test/compiler/compilercontrol/mixed/RandomCommandsTest.java
@@ -26,10 +26,14 @@
  * @bug 8137167
  * @summary Randomly generates commands with random types
  * @modules java.base/jdk.internal.misc
- * @library /testlibrary /test/lib ../share /
+ * @library /testlibrary /test/lib /
+ *
  * @build compiler.compilercontrol.mixed.RandomCommandsTest
- *        pool.sub.* pool.subpack.* sun.hotspot.WhiteBox
- *        compiler.testlibrary.CompilerUtils compiler.compilercontrol.share.actions.*
+ *        compiler.compilercontrol.share.pool.sub.*
+ *        compiler.compilercontrol.share.pool.subpack.*
+ *        sun.hotspot.WhiteBox
+ *        compiler.testlibrary.CompilerUtils
+ *        compiler.compilercontrol.share.actions.*
  * @run driver ClassFileInstaller sun.hotspot.WhiteBox
  *                                sun.hotspot.WhiteBox$WhiteBoxPermission
  * @run driver/timeout=600 compiler.compilercontrol.mixed.RandomCommandsTest
diff --git a/hotspot/test/compiler/compilercontrol/mixed/RandomValidCommandsTest.java b/hotspot/test/compiler/compilercontrol/mixed/RandomValidCommandsTest.java
index d573ed0..4b1b6f6 100644
--- a/hotspot/test/compiler/compilercontrol/mixed/RandomValidCommandsTest.java
+++ b/hotspot/test/compiler/compilercontrol/mixed/RandomValidCommandsTest.java
@@ -26,10 +26,14 @@
  * @bug 8137167
  * @summary Randomly generates valid commands with random types
  * @modules java.base/jdk.internal.misc
- * @library /testlibrary /test/lib ../share /
+ * @library /testlibrary /test/lib /
+ *
  * @build compiler.compilercontrol.mixed.RandomValidCommandsTest
- *        pool.sub.* pool.subpack.* sun.hotspot.WhiteBox
- *        compiler.testlibrary.CompilerUtils compiler.compilercontrol.share.actions.*
+ *        compiler.compilercontrol.share.pool.sub.*
+ *        compiler.compilercontrol.share.pool.subpack.*
+ *        sun.hotspot.WhiteBox
+ *        compiler.testlibrary.CompilerUtils
+ *        compiler.compilercontrol.share.actions.*
  * @run driver ClassFileInstaller sun.hotspot.WhiteBox
  *                                sun.hotspot.WhiteBox$WhiteBoxPermission
  * @run driver/timeout=600 compiler.compilercontrol.mixed.RandomValidCommandsTest
diff --git a/hotspot/test/compiler/compilercontrol/parser/DirectiveParserTest.java b/hotspot/test/compiler/compilercontrol/parser/DirectiveParserTest.java
index e4fda4a..a362e02 100644
--- a/hotspot/test/compiler/compilercontrol/parser/DirectiveParserTest.java
+++ b/hotspot/test/compiler/compilercontrol/parser/DirectiveParserTest.java
@@ -26,7 +26,8 @@
  * @bug 8137167
  * @summary Tests directive json parser
  * @modules java.base/jdk.internal.misc
- * @library /testlibrary /test/lib ../share /
+ * @library /testlibrary /test/lib /
+ *
  * @run driver compiler.compilercontrol.parser.DirectiveParserTest
  */
 
@@ -35,7 +36,6 @@
 import compiler.compilercontrol.share.JSONFile;
 import jdk.test.lib.Asserts;
 import jdk.test.lib.OutputAnalyzer;
-import jdk.test.lib.ProcessTools;
 import jdk.test.lib.Utils;
 
 public class DirectiveParserTest {
diff --git a/hotspot/test/compiler/compilercontrol/parser/DirectiveStressTest.java b/hotspot/test/compiler/compilercontrol/parser/DirectiveStressTest.java
index c99b531..fa95072 100644
--- a/hotspot/test/compiler/compilercontrol/parser/DirectiveStressTest.java
+++ b/hotspot/test/compiler/compilercontrol/parser/DirectiveStressTest.java
@@ -26,7 +26,8 @@
  * @bug 8137167
  * @summary Stress directive json parser
  * @modules java.base/jdk.internal.misc
- * @library /testlibrary /test/lib ../share /
+ * @library /testlibrary /test/lib /
+ *
  * @run driver compiler.compilercontrol.parser.DirectiveStressTest
  */
 
@@ -35,9 +36,9 @@
 import compiler.compilercontrol.share.AbstractTestBase;
 import compiler.compilercontrol.share.JSONFile;
 import compiler.compilercontrol.share.method.MethodDescriptor;
+import compiler.compilercontrol.share.pool.PoolHelper;
 import compiler.compilercontrol.share.scenario.DirectiveWriter;
 import jdk.test.lib.OutputAnalyzer;
-import pool.PoolHelper;
 
 import java.util.List;
 import java.util.stream.Collectors;
diff --git a/hotspot/test/compiler/compilercontrol/share/AbstractTestBase.java b/hotspot/test/compiler/compilercontrol/share/AbstractTestBase.java
index 04d8ada..0baf937 100644
--- a/hotspot/test/compiler/compilercontrol/share/AbstractTestBase.java
+++ b/hotspot/test/compiler/compilercontrol/share/AbstractTestBase.java
@@ -25,8 +25,8 @@
 
 import compiler.compilercontrol.share.method.MethodDescriptor;
 import compiler.compilercontrol.share.method.MethodGenerator;
+import compiler.compilercontrol.share.pool.PoolHelper;
 import jdk.test.lib.Pair;
-import pool.PoolHelper;
 
 import java.lang.reflect.Executable;
 import java.util.List;
diff --git a/hotspot/test/compiler/compilercontrol/share/actions/BaseAction.java b/hotspot/test/compiler/compilercontrol/share/actions/BaseAction.java
index 3a88286..d8a5bd1 100644
--- a/hotspot/test/compiler/compilercontrol/share/actions/BaseAction.java
+++ b/hotspot/test/compiler/compilercontrol/share/actions/BaseAction.java
@@ -23,16 +23,16 @@
 
 package compiler.compilercontrol.share.actions;
 
+import compiler.compilercontrol.share.pool.PoolHelper;
 import compiler.compilercontrol.share.scenario.State;
 import jdk.test.lib.Pair;
 import jdk.test.lib.ProcessTools;
-import pool.PoolHelper;
 
 import java.io.BufferedReader;
-import java.io.InputStreamReader;
-import java.io.PrintWriter;
-import java.io.OutputStreamWriter;
 import java.io.IOException;
+import java.io.InputStreamReader;
+import java.io.OutputStreamWriter;
+import java.io.PrintWriter;
 import java.lang.reflect.Executable;
 import java.net.InetAddress;
 import java.net.Socket;
diff --git a/hotspot/test/compiler/compilercontrol/share/actions/CompileAction.java b/hotspot/test/compiler/compilercontrol/share/actions/CompileAction.java
index 6813736..e01c533 100644
--- a/hotspot/test/compiler/compilercontrol/share/actions/CompileAction.java
+++ b/hotspot/test/compiler/compilercontrol/share/actions/CompileAction.java
@@ -23,12 +23,12 @@
 
 package compiler.compilercontrol.share.actions;
 
+import compiler.compilercontrol.share.pool.PoolHelper;
 import compiler.compilercontrol.share.scenario.State;
 import compiler.testlibrary.CompilerUtils;
 import jdk.test.lib.Asserts;
 import jdk.test.lib.Pair;
 import jdk.test.lib.Utils;
-import pool.PoolHelper;
 import sun.hotspot.WhiteBox;
 
 import java.lang.reflect.Executable;
diff --git a/hotspot/test/compiler/compilercontrol/share/method/MethodGenerator.java b/hotspot/test/compiler/compilercontrol/share/method/MethodGenerator.java
index e14d890..50f5136 100644
--- a/hotspot/test/compiler/compilercontrol/share/method/MethodGenerator.java
+++ b/hotspot/test/compiler/compilercontrol/share/method/MethodGenerator.java
@@ -25,10 +25,10 @@
 
 import compiler.compilercontrol.share.method.MethodDescriptor.PatternType;
 import compiler.compilercontrol.share.method.MethodDescriptor.Separator;
+import compiler.compilercontrol.share.pool.PoolHelper;
 import jdk.test.lib.Pair;
 import jdk.test.lib.Triple;
 import jdk.test.lib.Utils;
-import pool.PoolHelper;
 
 import java.lang.reflect.Executable;
 import java.util.ArrayList;
diff --git a/hotspot/test/compiler/compilercontrol/share/pool/MethodHolder.java b/hotspot/test/compiler/compilercontrol/share/pool/MethodHolder.java
index 26002b0..a7b367a 100644
--- a/hotspot/test/compiler/compilercontrol/share/pool/MethodHolder.java
+++ b/hotspot/test/compiler/compilercontrol/share/pool/MethodHolder.java
@@ -21,7 +21,7 @@
  * questions.
  */
 
-package pool;
+package compiler.compilercontrol.share.pool;
 
 import jdk.test.lib.Pair;
 
diff --git a/hotspot/test/compiler/compilercontrol/share/pool/PoolHelper.java b/hotspot/test/compiler/compilercontrol/share/pool/PoolHelper.java
index 10918ed..ed06e1b 100644
--- a/hotspot/test/compiler/compilercontrol/share/pool/PoolHelper.java
+++ b/hotspot/test/compiler/compilercontrol/share/pool/PoolHelper.java
@@ -21,10 +21,10 @@
  * questions.
  */
 
-package pool;
+package compiler.compilercontrol.share.pool;
 
 import jdk.test.lib.Pair;
-import pool.MethodHolder;
+
 import java.lang.reflect.Executable;
 import java.util.ArrayList;
 import java.util.List;
@@ -53,12 +53,12 @@
     static {
         METHODS = new ArrayList<>();
         List<MethodHolder> holders = new ArrayList<>();
-        holders.add(new pool.sub.Klass());
-        holders.add(new pool.sub.KlassDup());
-        holders.add(new pool.subpack.Klass());
-        holders.add(new pool.subpack.KlassDup());
-        holders.add(new pool.sub.Klass.Internal());
-        holders.add(new pool.subpack.KlassDup.Internal());
+        holders.add(new compiler.compilercontrol.share.pool.sub.Klass());
+        holders.add(new compiler.compilercontrol.share.pool.sub.KlassDup());
+        holders.add(new compiler.compilercontrol.share.pool.subpack.Klass());
+        holders.add(new compiler.compilercontrol.share.pool.subpack.KlassDup());
+        holders.add(new compiler.compilercontrol.share.pool.sub.Klass.Internal());
+        holders.add(new compiler.compilercontrol.share.pool.subpack.KlassDup.Internal());
         for (MethodHolder holder : holders) {
             METHODS.addAll(holder.getAllMethods());
         }
diff --git a/hotspot/test/compiler/compilercontrol/share/pool/SubMethodHolder.java b/hotspot/test/compiler/compilercontrol/share/pool/SubMethodHolder.java
index 7ccc739..e9f23fc 100644
--- a/hotspot/test/compiler/compilercontrol/share/pool/SubMethodHolder.java
+++ b/hotspot/test/compiler/compilercontrol/share/pool/SubMethodHolder.java
@@ -1,4 +1,4 @@
-package pool;
+package compiler.compilercontrol.share.pool;
 
 import jdk.test.lib.Pair;
 
diff --git a/hotspot/test/compiler/compilercontrol/share/pool/sub/Klass.java b/hotspot/test/compiler/compilercontrol/share/pool/sub/Klass.java
index f1a3b3e..3f39c47 100644
--- a/hotspot/test/compiler/compilercontrol/share/pool/sub/Klass.java
+++ b/hotspot/test/compiler/compilercontrol/share/pool/sub/Klass.java
@@ -21,10 +21,10 @@
  * questions.
  */
 
-package pool.sub;
+package compiler.compilercontrol.share.pool.sub;
 
-import pool.MethodHolder;
-import pool.SubMethodHolder;
+import compiler.compilercontrol.share.pool.MethodHolder;
+import compiler.compilercontrol.share.pool.SubMethodHolder;
 
 /**
  * Simple class with methods to test signatures
diff --git a/hotspot/test/compiler/compilercontrol/share/pool/sub/KlassDup.java b/hotspot/test/compiler/compilercontrol/share/pool/sub/KlassDup.java
index 6ddcdba..942c79b 100644
--- a/hotspot/test/compiler/compilercontrol/share/pool/sub/KlassDup.java
+++ b/hotspot/test/compiler/compilercontrol/share/pool/sub/KlassDup.java
@@ -21,9 +21,9 @@
  * questions.
  */
 
-package pool.sub;
+package compiler.compilercontrol.share.pool.sub;
 
-import pool.MethodHolder;
+import compiler.compilercontrol.share.pool.MethodHolder;
 
 /**
  * Simple class with methods to test signatures
diff --git a/hotspot/test/compiler/compilercontrol/share/pool/subpack/Klass.java b/hotspot/test/compiler/compilercontrol/share/pool/subpack/Klass.java
index 59506e9..48220a5 100644
--- a/hotspot/test/compiler/compilercontrol/share/pool/subpack/Klass.java
+++ b/hotspot/test/compiler/compilercontrol/share/pool/subpack/Klass.java
@@ -21,15 +21,15 @@
  * questions.
  */
 
-package pool.subpack;
+package compiler.compilercontrol.share.pool.subpack;
 
-import pool.MethodHolder;
+import compiler.compilercontrol.share.pool.MethodHolder;
 
 /**
  * Simple class with methods to test signatures
- * This is a clone of the pool.sub.Klass, but without inner class
+ * This is a clone of the c.c.s.pool.sub.Klass, but without inner class
  * This class has different package name to test prefix patterns like *Klass.
- * *Klass patern should match both pool.sub.Klass and pool.subpack.Klass
+ * *Klass patern should match both c.c.s.pool.sub.Klass and c.c.s.pool.subpack.Klass
  */
 public class Klass extends MethodHolder {
     public void method(int a, String[] ss, Integer i, byte[] bb, double[][] dd) { }
diff --git a/hotspot/test/compiler/compilercontrol/share/pool/subpack/KlassDup.java b/hotspot/test/compiler/compilercontrol/share/pool/subpack/KlassDup.java
index f5e930b..a90273a 100644
--- a/hotspot/test/compiler/compilercontrol/share/pool/subpack/KlassDup.java
+++ b/hotspot/test/compiler/compilercontrol/share/pool/subpack/KlassDup.java
@@ -21,14 +21,14 @@
  * questions.
  */
 
-package pool.subpack;
+package compiler.compilercontrol.share.pool.subpack;
 
-import pool.MethodHolder;
-import pool.SubMethodHolder;
+import compiler.compilercontrol.share.pool.MethodHolder;
+import compiler.compilercontrol.share.pool.SubMethodHolder;
 
 /**
- * This is a clone of the pool.sub.Klass used to test pattern matching
- * Full class name contains both suffix (Dup) and prefix (pool.subpack)
+ * This is a clone of the c.c.s.pool.sub.Klass used to test pattern matching
+ * Full class name contains both suffix (Dup) and prefix (c.c.s.pool.subpack)
  */
 public class KlassDup extends MethodHolder {
     public void method(int a, String[] ss, Integer i, byte[] bb, double[][] dd) { }
diff --git a/hotspot/test/compiler/compilercontrol/share/processors/LogProcessor.java b/hotspot/test/compiler/compilercontrol/share/processors/LogProcessor.java
index d921d1d..0cfc7d6 100644
--- a/hotspot/test/compiler/compilercontrol/share/processors/LogProcessor.java
+++ b/hotspot/test/compiler/compilercontrol/share/processors/LogProcessor.java
@@ -25,10 +25,10 @@
 
 import compiler.compilercontrol.share.method.MethodDescriptor;
 import compiler.compilercontrol.share.method.MethodGenerator;
+import compiler.compilercontrol.share.pool.PoolHelper;
 import compiler.compilercontrol.share.scenario.State;
 import jdk.test.lib.Asserts;
 import jdk.test.lib.OutputAnalyzer;
-import pool.PoolHelper;
 
 import java.io.File;
 import java.io.FileNotFoundException;
diff --git a/hotspot/test/compiler/compilercontrol/share/processors/PrintProcessor.java b/hotspot/test/compiler/compilercontrol/share/processors/PrintProcessor.java
index dab4349..9fa00c1 100644
--- a/hotspot/test/compiler/compilercontrol/share/processors/PrintProcessor.java
+++ b/hotspot/test/compiler/compilercontrol/share/processors/PrintProcessor.java
@@ -26,10 +26,9 @@
 import com.sun.management.HotSpotDiagnosticMXBean;
 import compiler.compilercontrol.share.method.MethodDescriptor;
 import compiler.compilercontrol.share.method.MethodGenerator;
+import compiler.compilercontrol.share.pool.PoolHelper;
 import compiler.compilercontrol.share.scenario.State;
 import jdk.test.lib.OutputAnalyzer;
-import jdk.test.lib.Pair;
-import pool.PoolHelper;
 
 import java.lang.management.ManagementFactory;
 import java.lang.reflect.Executable;
diff --git a/hotspot/test/compiler/compilercontrol/share/scenario/AbstractCommandBuilder.java b/hotspot/test/compiler/compilercontrol/share/scenario/AbstractCommandBuilder.java
index eafbefb..2173128 100644
--- a/hotspot/test/compiler/compilercontrol/share/scenario/AbstractCommandBuilder.java
+++ b/hotspot/test/compiler/compilercontrol/share/scenario/AbstractCommandBuilder.java
@@ -24,8 +24,8 @@
 package compiler.compilercontrol.share.scenario;
 
 import compiler.compilercontrol.share.method.MethodDescriptor;
+import compiler.compilercontrol.share.pool.PoolHelper;
 import jdk.test.lib.Pair;
-import pool.PoolHelper;
 
 import java.lang.reflect.Executable;
 import java.util.ArrayList;
@@ -33,7 +33,6 @@
 import java.util.HashMap;
 import java.util.List;
 import java.util.Map;
-import java.util.Optional;
 import java.util.concurrent.Callable;
 
 /**
diff --git a/hotspot/test/compiler/compilercontrol/share/scenario/Command.java b/hotspot/test/compiler/compilercontrol/share/scenario/Command.java
index c4b2193..49fdf74 100644
--- a/hotspot/test/compiler/compilercontrol/share/scenario/Command.java
+++ b/hotspot/test/compiler/compilercontrol/share/scenario/Command.java
@@ -24,6 +24,7 @@
 package compiler.compilercontrol.share.scenario;
 
 import compiler.compilercontrol.share.processors.LogProcessor;
+
 import java.util.Arrays;
 
 /**
diff --git a/hotspot/test/compiler/compilercontrol/share/scenario/DirectiveBuilder.java b/hotspot/test/compiler/compilercontrol/share/scenario/DirectiveBuilder.java
index af6c86d..124c265 100644
--- a/hotspot/test/compiler/compilercontrol/share/scenario/DirectiveBuilder.java
+++ b/hotspot/test/compiler/compilercontrol/share/scenario/DirectiveBuilder.java
@@ -26,15 +26,15 @@
 import compiler.compilercontrol.share.JSONFile;
 import compiler.compilercontrol.share.method.MethodDescriptor;
 import compiler.compilercontrol.share.method.MethodGenerator;
+import compiler.compilercontrol.share.pool.PoolHelper;
 import jdk.test.lib.Pair;
-import pool.PoolHelper;
 
 import java.lang.reflect.Executable;
-import java.util.List;
-import java.util.Map;
 import java.util.ArrayList;
 import java.util.HashMap;
 import java.util.LinkedHashMap;
+import java.util.List;
+import java.util.Map;
 import java.util.concurrent.Callable;
 import java.util.stream.Collectors;
 
diff --git a/hotspot/test/compiler/compilercontrol/share/scenario/JcmdStateBuilder.java b/hotspot/test/compiler/compilercontrol/share/scenario/JcmdStateBuilder.java
index b799174..bf12f99 100644
--- a/hotspot/test/compiler/compilercontrol/share/scenario/JcmdStateBuilder.java
+++ b/hotspot/test/compiler/compilercontrol/share/scenario/JcmdStateBuilder.java
@@ -25,7 +25,7 @@
 
 import compiler.compilercontrol.share.method.MethodDescriptor;
 import compiler.compilercontrol.share.method.MethodGenerator;
-import pool.PoolHelper;
+import compiler.compilercontrol.share.pool.PoolHelper;
 import jdk.test.lib.Pair;
 
 import java.lang.reflect.Executable;
diff --git a/hotspot/test/compiler/compilercontrol/share/scenario/Scenario.java b/hotspot/test/compiler/compilercontrol/share/scenario/Scenario.java
index a0fefab..8a1723f 100644
--- a/hotspot/test/compiler/compilercontrol/share/scenario/Scenario.java
+++ b/hotspot/test/compiler/compilercontrol/share/scenario/Scenario.java
@@ -24,6 +24,7 @@
 package compiler.compilercontrol.share.scenario;
 
 import compiler.compilercontrol.share.method.MethodDescriptor;
+import compiler.compilercontrol.share.pool.PoolHelper;
 import compiler.compilercontrol.share.processors.CommandProcessor;
 import compiler.compilercontrol.share.processors.LogProcessor;
 import compiler.compilercontrol.share.processors.PrintDirectivesProcessor;
@@ -31,7 +32,6 @@
 import jdk.test.lib.Asserts;
 import jdk.test.lib.OutputAnalyzer;
 import jdk.test.lib.Pair;
-import pool.PoolHelper;
 
 import java.lang.reflect.Executable;
 import java.util.ArrayList;
diff --git a/hotspot/test/compiler/controldependency/TestEliminatedCastPPAtPhi.java b/hotspot/test/compiler/controldependency/TestEliminatedCastPPAtPhi.java
index 9c3daaf..b3c3d03 100644
--- a/hotspot/test/compiler/controldependency/TestEliminatedCastPPAtPhi.java
+++ b/hotspot/test/compiler/controldependency/TestEliminatedCastPPAtPhi.java
@@ -27,10 +27,15 @@
  * @bug 8139771
  * @summary Eliminating CastPP nodes at Phis when they all come from a unique input may cause crash
  * @requires vm.gc=="Serial" | vm.gc=="Parallel"
- * @run main/othervm -XX:-BackgroundCompilation -XX:-UseOnStackReplacement -XX:+IgnoreUnrecognizedVMOptions -XX:+StressGCM TestEliminatedCastPPAtPhi
+ *
+ * @run main/othervm -XX:-BackgroundCompilation -XX:-UseOnStackReplacement
+ *      -XX:+UnlockDiagnosticVMOptions -XX:+IgnoreUnrecognizedVMOptions -XX:+StressGCM
+ *      compiler.controldependency.TestEliminatedCastPPAtPhi
  *
  */
 
+package compiler.controldependency;
+
 public class TestEliminatedCastPPAtPhi {
 
     static TestEliminatedCastPPAtPhi saved;
diff --git a/hotspot/test/compiler/cpuflags/AESIntrinsicsBase.java b/hotspot/test/compiler/cpuflags/AESIntrinsicsBase.java
index 7be9e43..0aa9dc3 100644
--- a/hotspot/test/compiler/cpuflags/AESIntrinsicsBase.java
+++ b/hotspot/test/compiler/cpuflags/AESIntrinsicsBase.java
@@ -21,8 +21,12 @@
  * questions.
  *
  */
+
+package compiler.cpuflags;
+
+import compiler.codegen.aes.TestAESMain;
+import compiler.cpuflags.predicate.AESSupportPredicate;
 import jdk.test.lib.cli.CommandLineOptionTest;
-import predicate.AESSupportPredicate;
 
 import java.util.Arrays;
 import java.util.function.BooleanSupplier;
@@ -45,7 +49,7 @@
     public static final String[] TEST_AES_CMD
             = {"-XX:+IgnoreUnrecognizedVMOptions", "-XX:+PrintFlagsFinal",
             "-Xbatch", "-DcheckOutput=true", "-Dmode=CBC",
-            "TestAESMain"};
+            TestAESMain.class.getName()};
 
     protected AESIntrinsicsBase(BooleanSupplier predicate) {
         super(predicate);
diff --git a/hotspot/test/compiler/cpuflags/RestoreMXCSR.java b/hotspot/test/compiler/cpuflags/RestoreMXCSR.java
index 9b75374..b0df389 100644
--- a/hotspot/test/compiler/cpuflags/RestoreMXCSR.java
+++ b/hotspot/test/compiler/cpuflags/RestoreMXCSR.java
@@ -28,16 +28,22 @@
  * @library /testlibrary
  * @modules java.base/jdk.internal.misc
  *          java.management
+ *
+ * @run driver compiler.cpuflags.RestoreMXCSR
  */
-import jdk.test.lib.*;
+
+package compiler.cpuflags;
+
+import jdk.test.lib.OutputAnalyzer;
+import jdk.test.lib.ProcessTools;
 
 public class RestoreMXCSR {
-  public static void main(String[] args) throws Exception {
-    ProcessBuilder pb;
-    OutputAnalyzer out;
+    public static void main(String[] args) throws Exception {
+        ProcessBuilder pb;
+        OutputAnalyzer out;
 
-    pb = ProcessTools.createJavaProcessBuilder("-XX:+RestoreMXCSROnJNICalls", "-version");
-    out = new OutputAnalyzer(pb.start());
-    out.shouldHaveExitValue(0);
-  }
+        pb = ProcessTools.createJavaProcessBuilder("-XX:+RestoreMXCSROnJNICalls", "-version");
+        out = new OutputAnalyzer(pb.start());
+        out.shouldHaveExitValue(0);
+    }
 }
diff --git a/hotspot/test/compiler/cpuflags/TestAESIntrinsicsOnSupportedConfig.java b/hotspot/test/compiler/cpuflags/TestAESIntrinsicsOnSupportedConfig.java
index 75c411d..c5c4db0 100644
--- a/hotspot/test/compiler/cpuflags/TestAESIntrinsicsOnSupportedConfig.java
+++ b/hotspot/test/compiler/cpuflags/TestAESIntrinsicsOnSupportedConfig.java
@@ -24,18 +24,21 @@
 
 /*
  * @test
- * @library /testlibrary /test/lib /compiler/codegen/7184394 /
+ * @library /testlibrary /test/lib /
  * @modules java.base/jdk.internal.misc
  *          java.management
  * @ignore 8146128
- * @build TestAESIntrinsicsOnSupportedConfig TestAESMain
+ * @build compiler.cpuflags.TestAESIntrinsicsOnSupportedConfig
+ *        compiler.codegen.aes.TestAESMain
  * @run driver ClassFileInstaller sun.hotspot.WhiteBox
  *                                sun.hotspot.WhiteBox$WhiteBoxPermission
  * @run main/othervm -Xbootclasspath/a:. -XX:+UnlockDiagnosticVMOptions
  *                   -XX:+WhiteBoxAPI -Xbatch
- *                   TestAESIntrinsicsOnSupportedConfig
+ *                   compiler.cpuflags.TestAESIntrinsicsOnSupportedConfig
  */
 
+package compiler.cpuflags;
+
 import jdk.test.lib.OutputAnalyzer;
 import jdk.test.lib.Platform;
 import jdk.test.lib.ProcessTools;
diff --git a/hotspot/test/compiler/cpuflags/TestAESIntrinsicsOnUnsupportedConfig.java b/hotspot/test/compiler/cpuflags/TestAESIntrinsicsOnUnsupportedConfig.java
index 9bc4662..caef413 100644
--- a/hotspot/test/compiler/cpuflags/TestAESIntrinsicsOnUnsupportedConfig.java
+++ b/hotspot/test/compiler/cpuflags/TestAESIntrinsicsOnUnsupportedConfig.java
@@ -24,19 +24,24 @@
 
 /*
  * @test
- * @library /testlibrary /test/lib /compiler/codegen/7184394 /
+ * @library /testlibrary /test/lib /
  * @modules java.base/jdk.internal.misc
  *          java.management
- * @build TestAESIntrinsicsOnUnsupportedConfig TestAESMain
+ *
+ * @build compiler.cpuflags.TestAESIntrinsicsOnUnsupportedConfig
+ *        compiler.codegen.aes.TestAESMain
  * @run driver ClassFileInstaller sun.hotspot.WhiteBox
  *                                sun.hotspot.WhiteBox$WhiteBoxPermission
  * @run main/othervm -Xbootclasspath/a:. -XX:+UnlockDiagnosticVMOptions
- *       -XX:+WhiteBoxAPI -Xbatch  TestAESIntrinsicsOnUnsupportedConfig
+ *       -XX:+WhiteBoxAPI -Xbatch
+ *       compiler.cpuflags.TestAESIntrinsicsOnUnsupportedConfig
  */
 
-import jdk.test.lib.cli.predicate.NotPredicate;
+package compiler.cpuflags;
+
 import jdk.test.lib.OutputAnalyzer;
 import jdk.test.lib.ProcessTools;
+import jdk.test.lib.cli.predicate.NotPredicate;
 
 public class TestAESIntrinsicsOnUnsupportedConfig extends AESIntrinsicsBase {
 
diff --git a/hotspot/test/compiler/cpuflags/TestSSE4Disabled.java b/hotspot/test/compiler/cpuflags/TestSSE4Disabled.java
index 2700b91..b1af812 100644
--- a/hotspot/test/compiler/cpuflags/TestSSE4Disabled.java
+++ b/hotspot/test/compiler/cpuflags/TestSSE4Disabled.java
@@ -27,8 +27,12 @@
  * @bug 8158214
  * @requires (vm.simpleArch == "x64")
  * @summary Test correct execution without SSE 4.
- * @run main/othervm -Xcomp -XX:UseSSE=3 TestSSE4Disabled
+ *
+ * @run main/othervm -Xcomp -XX:UseSSE=3 compiler.cpuflags.TestSSE4Disabled
  */
+
+package compiler.cpuflags;
+
 public class TestSSE4Disabled {
     public static void main(String args[]) {
         System.out.println("Passed");
diff --git a/hotspot/test/compiler/cpuflags/predicate/AESSupportPredicate.java b/hotspot/test/compiler/cpuflags/predicate/AESSupportPredicate.java
index 7b4f78b..3ec85e6 100644
--- a/hotspot/test/compiler/cpuflags/predicate/AESSupportPredicate.java
+++ b/hotspot/test/compiler/cpuflags/predicate/AESSupportPredicate.java
@@ -21,9 +21,10 @@
  * questions.
  *
  */
-package predicate;
+package compiler.cpuflags.predicate;
 
 import sun.hotspot.cpuinfo.CPUInfo;
+
 import java.util.function.BooleanSupplier;
 
 public class AESSupportPredicate implements BooleanSupplier {
diff --git a/hotspot/test/compiler/debug/TraceIterativeGVN.java b/hotspot/test/compiler/debug/TraceIterativeGVN.java
index 7d98dd6..1656b1b 100644
--- a/hotspot/test/compiler/debug/TraceIterativeGVN.java
+++ b/hotspot/test/compiler/debug/TraceIterativeGVN.java
@@ -25,10 +25,14 @@
 
 /*
  * @test
+ *
  * @run main/othervm -Xbatch -XX:-TieredCompilation
  *                   -XX:+IgnoreUnrecognizedVMOptions -XX:+TraceIterativeGVN
- *                   TraceIterativeGVN
+ *                   compiler.debug.TraceIterativeGVN
  */
+
+package compiler.debug;
+
 public class TraceIterativeGVN {
     public static void main(String[] args) {
         for (int i = 0; i < 100_000; i++) {
diff --git a/hotspot/test/compiler/debug/VerifyAdapterSharing.java b/hotspot/test/compiler/debug/VerifyAdapterSharing.java
index 418eed7..263f263 100644
--- a/hotspot/test/compiler/debug/VerifyAdapterSharing.java
+++ b/hotspot/test/compiler/debug/VerifyAdapterSharing.java
@@ -28,17 +28,23 @@
  * @library /testlibrary
  * @modules java.base/jdk.internal.misc
  *          java.management
+ *
+ * @run driver compiler.debug.VerifyAdapterSharing
  */
-import jdk.test.lib.*;
+
+package compiler.debug;
+
+import jdk.test.lib.OutputAnalyzer;
+import jdk.test.lib.ProcessTools;
 
 public class VerifyAdapterSharing {
-  public static void main(String[] args) throws Exception {
-    ProcessBuilder pb;
-    OutputAnalyzer out;
+    public static void main(String[] args) throws Exception {
+        ProcessBuilder pb;
+        OutputAnalyzer out;
 
-    pb = ProcessTools.createJavaProcessBuilder("-Xcomp", "-XX:+IgnoreUnrecognizedVMOptions",
-                                               "-XX:+VerifyAdapterSharing", "-version");
-    out = new OutputAnalyzer(pb.start());
-    out.shouldHaveExitValue(0);
-  }
+        pb = ProcessTools.createJavaProcessBuilder("-Xcomp", "-XX:+IgnoreUnrecognizedVMOptions",
+                "-XX:+VerifyAdapterSharing", "-version");
+        out = new OutputAnalyzer(pb.start());
+        out.shouldHaveExitValue(0);
+    }
 }
diff --git a/hotspot/test/compiler/dependencies/MonomorphicObjectCall/TestMonomorphicObjectCall.java b/hotspot/test/compiler/dependencies/MonomorphicObjectCall/TestMonomorphicObjectCall.java
index 365ca7b..0016c92 100644
--- a/hotspot/test/compiler/dependencies/MonomorphicObjectCall/TestMonomorphicObjectCall.java
+++ b/hotspot/test/compiler/dependencies/MonomorphicObjectCall/TestMonomorphicObjectCall.java
@@ -25,11 +25,17 @@
  * @test
  * @bug 8050079
  * @summary Compiles a monomorphic call to finalizeObject() on a modified java.lang.Object to test C1 CHA.
+ *
  * @build java.base/java.lang.Object
  * @run main/othervm -XX:+IgnoreUnrecognizedVMOptions -Xcomp -XX:-VerifyDependencies
- *                   -XX:TieredStopAtLevel=1 -XX:CompileOnly=TestMonomorphicObjectCall::callFinalize
- *                   -XX:CompileOnly=java.lang.Object::finalizeObject TestMonomorphicObjectCall
+ *                   -XX:TieredStopAtLevel=1
+ *                   -XX:CompileCommand=compileonly,compiler.dependencies.MonomorphicObjectCall.TestMonomorphicObjectCall::callFinalize
+ *                   -XX:CompileCommand=compileonly,java.lang.Object::finalizeObject
+ *                   compiler.dependencies.MonomorphicObjectCall.TestMonomorphicObjectCall
  */
+
+package compiler.dependencies.MonomorphicObjectCall;
+
 public class TestMonomorphicObjectCall {
 
     private static void callFinalize(Object object) throws Throwable {
diff --git a/hotspot/test/compiler/eliminateAutobox/6934604/TestByteBoxing.java b/hotspot/test/compiler/eliminateAutobox/TestByteBoxing.java
similarity index 95%
rename from hotspot/test/compiler/eliminateAutobox/6934604/TestByteBoxing.java
rename to hotspot/test/compiler/eliminateAutobox/TestByteBoxing.java
index ee5511a..1b96d7f 100644
--- a/hotspot/test/compiler/eliminateAutobox/6934604/TestByteBoxing.java
+++ b/hotspot/test/compiler/eliminateAutobox/TestByteBoxing.java
@@ -24,15 +24,23 @@
 /*
  * @test
  * @bug 6934604
- * @summary enable parts of EliminateAutoBox by default
- * @run main/othervm -Xbatch -XX:+IgnoreUnrecognizedVMOptions -XX:+EliminateAutoBox TestByteBoxing
- * @run main/othervm -Xbatch -XX:+IgnoreUnrecognizedVMOptions -XX:+EliminateAutoBox
- * -XX:CompileCommand=exclude,TestByteBoxing.dummy -XX:CompileCommand=exclude,TestByteBoxing.foo -XX:CompileCommand=exclude,TestByteBoxing.foob TestByteBoxing
- * @run main/othervm -Xbatch -XX:+IgnoreUnrecognizedVMOptions -XX:-EliminateAutoBox
- * -XX:CompileCommand=exclude,TestByteBoxing.dummy -XX:CompileCommand=exclude,TestByteBoxing.foo -XX:CompileCommand=exclude,TestByteBoxing.foob TestByteBoxing
  *
+ * @run main/othervm -Xbatch -XX:+IgnoreUnrecognizedVMOptions -XX:+EliminateAutoBox
+ *                   compiler.eliminateAutobox.TestByteBoxing
+ * @run main/othervm -Xbatch -XX:+IgnoreUnrecognizedVMOptions -XX:+EliminateAutoBox
+ *                   -XX:CompileCommand=exclude,compiler.eliminateAutobox.TestByteBoxing::dummy
+ *                   -XX:CompileCommand=exclude,compiler.eliminateAutobox.TestByteBoxing::foo
+ *                   -XX:CompileCommand=exclude,compiler.eliminateAutobox.TestByteBoxing::foob
+ *                   compiler.eliminateAutobox.TestByteBoxing
+ * @run main/othervm -Xbatch -XX:+IgnoreUnrecognizedVMOptions -XX:-EliminateAutoBox
+ *                   -XX:CompileCommand=exclude,compiler.eliminateAutobox.TestByteBoxing::dummy
+ *                   -XX:CompileCommand=exclude,compiler.eliminateAutobox.TestByteBoxing::foo
+ *                   -XX:CompileCommand=exclude,compiler.eliminateAutobox.TestByteBoxing::foob
+ *                   compiler.eliminateAutobox.TestByteBoxing
  */
 
+package compiler.eliminateAutobox;
+
 public class TestByteBoxing {
 
   static final Byte ibc = new Byte((byte)1);
diff --git a/hotspot/test/compiler/eliminateAutobox/6934604/TestDoubleBoxing.java b/hotspot/test/compiler/eliminateAutobox/TestDoubleBoxing.java
similarity index 95%
rename from hotspot/test/compiler/eliminateAutobox/6934604/TestDoubleBoxing.java
rename to hotspot/test/compiler/eliminateAutobox/TestDoubleBoxing.java
index 7b76ac9..63e027a9 100644
--- a/hotspot/test/compiler/eliminateAutobox/6934604/TestDoubleBoxing.java
+++ b/hotspot/test/compiler/eliminateAutobox/TestDoubleBoxing.java
@@ -25,14 +25,23 @@
  * @test
  * @bug 6934604
  * @summary enable parts of EliminateAutoBox by default
- * @run main/othervm -Xbatch -XX:+IgnoreUnrecognizedVMOptions -XX:+EliminateAutoBox TestDoubleBoxing
- * @run main/othervm -Xbatch -XX:+IgnoreUnrecognizedVMOptions -XX:+EliminateAutoBox
- * -XX:CompileCommand=exclude,TestDoubleBoxing.dummy -XX:CompileCommand=exclude,TestDoubleBoxing.foo -XX:CompileCommand=exclude,TestDoubleBoxing.foob TestDoubleBoxing
- * @run main/othervm -Xbatch -XX:+IgnoreUnrecognizedVMOptions -XX:-EliminateAutoBox
- * -XX:CompileCommand=exclude,TestDoubleBoxing.dummy -XX:CompileCommand=exclude,TestDoubleBoxing.foo -XX:CompileCommand=exclude,TestDoubleBoxing.foob TestDoubleBoxing
  *
+ * @run main/othervm -Xbatch -XX:+IgnoreUnrecognizedVMOptions -XX:+EliminateAutoBox
+ *                   compiler.eliminateAutobox.TestDoubleBoxing
+ * @run main/othervm -Xbatch -XX:+IgnoreUnrecognizedVMOptions -XX:+EliminateAutoBox
+ *                   -XX:CompileCommand=exclude,compiler.eliminateAutobox.TestDoubleBoxing::dummy
+ *                   -XX:CompileCommand=exclude,compiler.eliminateAutobox.TestDoubleBoxing::foo
+ *                   -XX:CompileCommand=exclude,compiler.eliminateAutobox.TestDoubleBoxing::foob
+ *                   compiler.eliminateAutobox.TestDoubleBoxing
+ * @run main/othervm -Xbatch -XX:+IgnoreUnrecognizedVMOptions -XX:-EliminateAutoBox
+ *                   -XX:CompileCommand=exclude,compiler.eliminateAutobox.TestDoubleBoxing::dummy
+ *                   -XX:CompileCommand=exclude,compiler.eliminateAutobox.TestDoubleBoxing::foo
+ *                   -XX:CompileCommand=exclude,compiler.eliminateAutobox.TestDoubleBoxing::foob
+ *                   compiler.eliminateAutobox.TestDoubleBoxing
  */
 
+package compiler.eliminateAutobox;
+
 public class TestDoubleBoxing {
 
   static final Double ibc = new Double(1.);
diff --git a/hotspot/test/compiler/eliminateAutobox/6934604/TestFloatBoxing.java b/hotspot/test/compiler/eliminateAutobox/TestFloatBoxing.java
similarity index 95%
rename from hotspot/test/compiler/eliminateAutobox/6934604/TestFloatBoxing.java
rename to hotspot/test/compiler/eliminateAutobox/TestFloatBoxing.java
index 4571673..756e990 100644
--- a/hotspot/test/compiler/eliminateAutobox/6934604/TestFloatBoxing.java
+++ b/hotspot/test/compiler/eliminateAutobox/TestFloatBoxing.java
@@ -25,14 +25,23 @@
  * @test
  * @bug 6934604
  * @summary enable parts of EliminateAutoBox by default
- * @run main/othervm -Xbatch -XX:+IgnoreUnrecognizedVMOptions -XX:+EliminateAutoBox TestFloatBoxing
- * @run main/othervm -Xbatch -XX:+IgnoreUnrecognizedVMOptions -XX:+EliminateAutoBox
- * -XX:CompileCommand=exclude,TestFloatBoxing.dummy -XX:CompileCommand=exclude,TestFloatBoxing.foo -XX:CompileCommand=exclude,TestFloatBoxing.foob TestFloatBoxing
- * @run main/othervm -Xbatch -XX:+IgnoreUnrecognizedVMOptions -XX:-EliminateAutoBox
- * -XX:CompileCommand=exclude,TestFloatBoxing.dummy -XX:CompileCommand=exclude,TestFloatBoxing.foo -XX:CompileCommand=exclude,TestFloatBoxing.foob TestFloatBoxing
  *
+ * @run main/othervm -Xbatch -XX:+IgnoreUnrecognizedVMOptions -XX:+EliminateAutoBox
+ *                   compiler.eliminateAutobox.TestFloatBoxing
+ * @run main/othervm -Xbatch -XX:+IgnoreUnrecognizedVMOptions -XX:+EliminateAutoBox
+ *                   -XX:CompileCommand=exclude,compiler.eliminateAutobox.TestFloatBoxing::dummy
+ *                   -XX:CompileCommand=exclude,compiler.eliminateAutobox.TestFloatBoxing::foo
+ *                   -XX:CompileCommand=exclude,compiler.eliminateAutobox.TestFloatBoxing::foob
+ *                   compiler.eliminateAutobox.TestFloatBoxing
+ * @run main/othervm -Xbatch -XX:+IgnoreUnrecognizedVMOptions -XX:-EliminateAutoBox
+ *                   -XX:CompileCommand=exclude,compiler.eliminateAutobox.TestFloatBoxing::dummy
+ *                   -XX:CompileCommand=exclude,compiler.eliminateAutobox.TestFloatBoxing::foo
+ *                   -XX:CompileCommand=exclude,compiler.eliminateAutobox.TestFloatBoxing::foob
+ *                   compiler.eliminateAutobox.TestFloatBoxing
  */
 
+package compiler.eliminateAutobox;
+
 public class TestFloatBoxing {
 
   static final Float ibc = new Float(1.f);
diff --git a/hotspot/test/compiler/eliminateAutobox/6934604/TestIntBoxing.java b/hotspot/test/compiler/eliminateAutobox/TestIntBoxing.java
similarity index 95%
rename from hotspot/test/compiler/eliminateAutobox/6934604/TestIntBoxing.java
rename to hotspot/test/compiler/eliminateAutobox/TestIntBoxing.java
index d1ad10b..8c2eec1 100644
--- a/hotspot/test/compiler/eliminateAutobox/6934604/TestIntBoxing.java
+++ b/hotspot/test/compiler/eliminateAutobox/TestIntBoxing.java
@@ -25,14 +25,23 @@
  * @test
  * @bug 6934604
  * @summary enable parts of EliminateAutoBox by default
- * @run main/othervm -Xbatch -XX:+IgnoreUnrecognizedVMOptions -XX:+EliminateAutoBox TestIntBoxing
- * @run main/othervm -Xbatch -XX:+IgnoreUnrecognizedVMOptions -XX:+EliminateAutoBox
- * -XX:CompileCommand=exclude,TestIntBoxing.dummy -XX:CompileCommand=exclude,TestIntBoxing.foo -XX:CompileCommand=exclude,TestIntBoxing.foob TestIntBoxing
- * @run main/othervm -Xbatch -XX:+IgnoreUnrecognizedVMOptions -XX:-EliminateAutoBox
- * -XX:CompileCommand=exclude,TestIntBoxing.dummy -XX:CompileCommand=exclude,TestIntBoxing.foo -XX:CompileCommand=exclude,TestIntBoxing.foob TestIntBoxing
  *
+ * @run main/othervm -Xbatch -XX:+IgnoreUnrecognizedVMOptions -XX:+EliminateAutoBox
+ *                   compiler.eliminateAutobox.TestIntBoxing
+ * @run main/othervm -Xbatch -XX:+IgnoreUnrecognizedVMOptions -XX:+EliminateAutoBox
+ *                   -XX:CompileCommand=exclude,compiler.eliminateAutobox.TestIntBoxing::dummy
+ *                   -XX:CompileCommand=exclude,compiler.eliminateAutobox.TestIntBoxing::foo
+ *                   -XX:CompileCommand=exclude,compiler.eliminateAutobox.TestIntBoxing::foob
+ *                   compiler.eliminateAutobox.TestIntBoxing
+ * @run main/othervm -Xbatch -XX:+IgnoreUnrecognizedVMOptions -XX:-EliminateAutoBox
+ *                   -XX:CompileCommand=exclude,compiler.eliminateAutobox.TestIntBoxing::dummy
+ *                   -XX:CompileCommand=exclude,compiler.eliminateAutobox.TestIntBoxing::foo
+ *                   -XX:CompileCommand=exclude,compiler.eliminateAutobox.TestIntBoxing::foob
+ *                   compiler.eliminateAutobox.TestIntBoxing
  */
 
+package compiler.eliminateAutobox;
+
 public class TestIntBoxing {
 
   static final Integer ibc = new Integer(1);
diff --git a/hotspot/test/compiler/eliminateAutobox/6934604/TestLongBoxing.java b/hotspot/test/compiler/eliminateAutobox/TestLongBoxing.java
similarity index 95%
rename from hotspot/test/compiler/eliminateAutobox/6934604/TestLongBoxing.java
rename to hotspot/test/compiler/eliminateAutobox/TestLongBoxing.java
index b92a01c..a354831 100644
--- a/hotspot/test/compiler/eliminateAutobox/6934604/TestLongBoxing.java
+++ b/hotspot/test/compiler/eliminateAutobox/TestLongBoxing.java
@@ -25,14 +25,23 @@
  * @test
  * @bug 6934604
  * @summary enable parts of EliminateAutoBox by default
- * @run main/othervm -Xbatch -XX:+IgnoreUnrecognizedVMOptions -XX:+EliminateAutoBox TestLongBoxing
- * @run main/othervm -Xbatch -XX:+IgnoreUnrecognizedVMOptions -XX:+EliminateAutoBox
- * -XX:CompileCommand=exclude,TestLongBoxing.dummy -XX:CompileCommand=exclude,TestLongBoxing.foo -XX:CompileCommand=exclude,TestLongBoxing.foob TestLongBoxing
- * @run main/othervm -Xbatch -XX:+IgnoreUnrecognizedVMOptions -XX:-EliminateAutoBox
- * -XX:CompileCommand=exclude,TestLongBoxing.dummy -XX:CompileCommand=exclude,TestLongBoxing.foo -XX:CompileCommand=exclude,TestLongBoxing.foob TestLongBoxing
  *
+ * @run main/othervm -Xbatch -XX:+IgnoreUnrecognizedVMOptions -XX:+EliminateAutoBox
+ *                   compiler.eliminateAutobox.TestLongBoxing
+ * @run main/othervm -Xbatch -XX:+IgnoreUnrecognizedVMOptions -XX:+EliminateAutoBox
+ *                   -XX:CompileCommand=exclude,compiler.eliminateAutobox.TestLongBoxing::dummy
+ *                   -XX:CompileCommand=exclude,compiler.eliminateAutobox.TestLongBoxing::foo
+ *                   -XX:CompileCommand=exclude,compiler.eliminateAutobox.TestLongBoxing::foob
+ *                   compiler.eliminateAutobox.TestLongBoxing
+ * @run main/othervm -Xbatch -XX:+IgnoreUnrecognizedVMOptions -XX:-EliminateAutoBox
+ *                   -XX:CompileCommand=exclude,compiler.eliminateAutobox.TestLongBoxing::dummy
+ *                   -XX:CompileCommand=exclude,compiler.eliminateAutobox.TestLongBoxing::foo
+ *                   -XX:CompileCommand=exclude,compiler.eliminateAutobox.TestLongBoxing::foob
+ *                   compiler.eliminateAutobox.TestLongBoxing
  */
 
+package compiler.eliminateAutobox;
+
 public class TestLongBoxing {
 
   static final Long ibc = new Long(1);
diff --git a/hotspot/test/compiler/eliminateAutobox/6934604/TestShortBoxing.java b/hotspot/test/compiler/eliminateAutobox/TestShortBoxing.java
similarity index 95%
rename from hotspot/test/compiler/eliminateAutobox/6934604/TestShortBoxing.java
rename to hotspot/test/compiler/eliminateAutobox/TestShortBoxing.java
index 0f065af..3db1846 100644
--- a/hotspot/test/compiler/eliminateAutobox/6934604/TestShortBoxing.java
+++ b/hotspot/test/compiler/eliminateAutobox/TestShortBoxing.java
@@ -25,14 +25,23 @@
  * @test
  * @bug 6934604
  * @summary enable parts of EliminateAutoBox by default
- * @run main/othervm -Xbatch -XX:+IgnoreUnrecognizedVMOptions -XX:+EliminateAutoBox TestShortBoxing
- * @run main/othervm -Xbatch -XX:+IgnoreUnrecognizedVMOptions -XX:+EliminateAutoBox
- * -XX:CompileCommand=exclude,TestShortBoxing.dummy -XX:CompileCommand=exclude,TestShortBoxing.foo -XX:CompileCommand=exclude,TestShortBoxing.foob TestShortBoxing
- * @run main/othervm -Xbatch -XX:+IgnoreUnrecognizedVMOptions -XX:-EliminateAutoBox
- * -XX:CompileCommand=exclude,TestShortBoxing.dummy -XX:CompileCommand=exclude,TestShortBoxing.foo -XX:CompileCommand=exclude,TestShortBoxing.foob TestShortBoxing
  *
+ * @run main/othervm -Xbatch -XX:+IgnoreUnrecognizedVMOptions -XX:+EliminateAutoBox
+ *                   compiler.eliminateAutobox.TestShortBoxing
+ * @run main/othervm -Xbatch -XX:+IgnoreUnrecognizedVMOptions -XX:+EliminateAutoBox
+ *                   -XX:CompileCommand=exclude,compiler.eliminateAutobox.TestShortBoxing::dummy
+ *                   -XX:CompileCommand=exclude,compiler.eliminateAutobox.TestShortBoxing::foo
+ *                   -XX:CompileCommand=exclude,compiler.eliminateAutobox.TestShortBoxing::foob
+ *                   compiler.eliminateAutobox.TestShortBoxing
+ * @run main/othervm -Xbatch -XX:+IgnoreUnrecognizedVMOptions -XX:-EliminateAutoBox
+ *                   -XX:CompileCommand=exclude,compiler.eliminateAutobox.TestShortBoxing::dummy
+ *                   -XX:CompileCommand=exclude,compiler.eliminateAutobox.TestShortBoxing::foo
+ *                   -XX:CompileCommand=exclude,compiler.eliminateAutobox.TestShortBoxing::foob
+ *                   compiler.eliminateAutobox.TestShortBoxing
  */
 
+package compiler.eliminateAutobox;
+
 public class TestShortBoxing {
 
   static final Short ibc = new Short((short)1);
diff --git a/hotspot/test/compiler/eliminateAutobox/UnsignedLoads.java b/hotspot/test/compiler/eliminateAutobox/UnsignedLoads.java
index 440a4b6..e5dbe6a 100644
--- a/hotspot/test/compiler/eliminateAutobox/UnsignedLoads.java
+++ b/hotspot/test/compiler/eliminateAutobox/UnsignedLoads.java
@@ -27,10 +27,14 @@
  * @test
  * @modules java.base/jdk.internal.misc
  * @library /testlibrary
+ *
  * @run main/othervm -Xbatch -XX:+IgnoreUnrecognizedVMOptions -XX:+EliminateAutoBox
  *                   -XX:CompileOnly=::valueOf,::byteValue,::shortValue,::testUnsignedByte,::testUnsignedShort
- *                   UnsignedLoads
+ *                   compiler.eliminateAutobox.UnsignedLoads
  */
+
+package compiler.eliminateAutobox;
+
 import static jdk.test.lib.Asserts.assertEQ;
 
 public class UnsignedLoads {
diff --git a/hotspot/test/compiler/escapeAnalysis/6689060/Test.java b/hotspot/test/compiler/escapeAnalysis/6689060/Test.java
deleted file mode 100644
index 46dbc7e..0000000
--- a/hotspot/test/compiler/escapeAnalysis/6689060/Test.java
+++ /dev/null
@@ -1,576 +0,0 @@
-/*
- * Copyright (c) 2008, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-
-/*
- * @test
- * @bug 6689060
- * @summary Escape Analysis does not work with Compressed Oops
- * @run main/othervm -Xbatch -XX:CompileCommand=exclude,Test.dummy -XX:+AggressiveOpts Test
- */
-
-import java.lang.reflect.Array;
-
-class Point {
-  int x;
-  int y;
-  Point next;
-  int ax[];
-  int ay[];
-  Point pax[];
-  Point pay[];
-  public Point getNext() {
-    return next;
-  }
-}
-
-public class Test {
-
-  void dummy() {
-    // Empty method to verify correctness of DebugInfo.
-    // Use -XX:CompileCommand=exclude,Test.dummy
-  }
-
-  int ival(int i) {
-    return i*2;
-  }
-
-  int test80(int y, int l, int i) {
-    Point p = new Point();
-    p.ax = new int[2];
-    p.ay = new int[2];
-    int x = 3;
-    p.ax[0] = x;
-    p.ay[1] = 3 * x + y;
-    dummy();
-    return p.ax[0] * p.ay[1];
-  }
-
-  int test81(int y, int l, int i) {
-    Point p = new Point();
-    p.ax = new int[2];
-    p.ay = new int[2];
-    int x = 3;
-    p.ax[0] = x;
-    p.ay[1] = 3 * x + y;
-    dummy();
-    return p.ax[0] * p.ay[1];
-  }
-
-
-  int test44(int y) {
-    Point p1 = new Point();
-    p1.x = ival(3);
-    dummy();
-    p1.y = 3 * p1.x + y;
-    return p1.y;
-  }
-
-  int test43(int y) {
-    Point p1 = new Point();
-    if ( (y & 1) == 1 ) {
-      p1.x = ival(3);
-    } else {
-      p1.x = ival(5);
-    }
-    dummy();
-    p1.y = 3 * p1.x + y;
-    return p1.y;
-  }
-
-  int test42(int y) {
-    Point p1 = new Point();
-    p1.x = 3;
-    for (int i = 0; i < y; i++) {
-      if ( (i & 1) == 1 ) {
-        p1.x += 4;
-      }
-    }
-    p1.y = 3 * y + p1.x;
-    return p1.y;
-  }
-
-  int test40(int y) {
-    Point p1 = new Point();
-    if ( (y & 1) == 1 ) {
-      p1.x = 3;
-    } else {
-      p1.x = 5;
-    }
-    p1.y = 3 * p1.x + y;
-    return p1.y;
-  }
-
-  int test41(int y) {
-    Point p1 = new Point();
-    if ( (y & 1) == 1 ) {
-      p1.x += 4;
-    } else {
-      p1.x += 5;
-    }
-    p1.y = 3 * p1.x + y;
-    return p1.y;
-  }
-
-  Point test00(int y) {
-    int x = 3;
-    Point p = new Point();
-    p.x = x;
-    p.y = 3 * x + y;
-    return p;
-  }
-
-  Point test01(int y) {
-    int x = 3;
-    Point p = new Point();
-    p.x = x;
-    p.y = 3 * x + y;
-    dummy();
-    return p;
-  }
-
-  Point test02(int y) {
-    int x = 3;
-    Point p1 = null;
-    for (int i = 0; i < y; i++) {
-      Point p2 = new Point();
-      p2.x = x;
-      p2.y = 3 * y + x;
-      p2.next = p1;
-      p1 = p2;
-    }
-    return p1;
-  }
-
-  Point test03(int y) {
-    int x = 3;
-    Point p1 = null;
-    for (int i = 0; i < y; i++) {
-      Point p2 = new Point();
-      p2.x = x;
-      p2.y = 3 * y + x;
-      p2.next = p1;
-      p1 = p2;
-    }
-    dummy();
-    return p1;
-  }
-
-  Point test04(int y) {
-    int x = 3;
-    Point p1 = null;
-    for (int i = 0; i < y; i++) {
-      Point p2 = new Point();
-      p2.x = x;
-      p2.y = 3 * y + x;
-      p2.next = p1;
-      dummy();
-      p1 = p2;
-    }
-    return p1;
-  }
-
-  int test05(int y) {
-    int x = 3;
-    Point p1 = new Point();
-    for (int i = 0; i < y; i++) {
-      Point p2 = new Point();
-      p2.x = x;
-      p2.y = 3 * y + x;
-      p1.next = p2;
-      p1 = p2;
-    }
-    return p1.y;
-  }
-
-  int test0(int y) {
-    int x = 3;
-    Point p = new Point();
-    p.x = x;
-    p.y = 3 * x + y;
-    dummy();
-    return p.x * p.y;
-  }
-
-  int test1(int y) {
-    Point p = new Point();
-    if ( (y & 1) == 1 ) {
-      p = new Point(); // Kill previous
-    }
-    int x = 3;
-    p.x = x;
-    p.y = 3 * x + y;
-    dummy();
-    return p.x * p.y;
-  }
-
-  int test2(int y) {
-    Point p1 = new Point();
-    Point p2 = new Point();
-    p1.x = 3;
-    p2.x = 4;
-    p1.y = 3 * p2.x + y;
-    p2.y = 3 * p1.x + y;
-    dummy();
-    return p1.y * p2.y;
-  }
-
-  int test3(int y, Point p1) {
-    Point p2 = new Point();
-    p1.x = 3;
-    p2.x = 4;
-    p1.y = 3 * p2.x + y;
-    p2.y = 3 * p1.x + y;
-    dummy();
-    return p1.y * p2.y;
-  }
-
-  int test4(int y) {
-    Point p1 = new Point();
-    Point p2 = new Point();
-    if ( (y & 1) == 1 ) {
-      p1.x = 3;
-      p2.x = 4;
-    } else {
-      p1.x = 5;
-      p2.x = 6;
-    }
-    p1.y = 3 * p2.x + y;
-    p2.y = 3 * p1.x + y;
-    dummy();
-    return p1.y * p2.y;
-  }
-
-  int test5(int y, Point p1) {
-    Point p2 = new Point();
-    if ( (y & 1) == 1 ) {
-      p1.x = 3;
-      p2.x = 4;
-    } else {
-      p1.x = 5;
-      p2.x = 6;
-    }
-    p1.y = 3 * p2.x + y;
-    p2.y = 3 * p1.x + y;
-    dummy();
-    return p1.y * p2.y;
-  }
-
-  int test6(int y) {
-    Point p1 = new Point();
-    Point p2 = new Point();
-    p1.next = p2;
-    if ( (y & 1) == 1 ) {
-      p1.x = 3;
-      p1.getNext().x = 4;
-    } else {
-      p1.x = 5;
-      p1.getNext().x = 6;
-    }
-    p1.y = 3 * p2.x + y;
-    p2.y = 3 * p1.x + y;
-    dummy();
-    return p1.y * p2.y;
-  }
-
-  int test7(int y, Point p1) {
-    Point p2 = new Point();
-    p1.next = p2;
-    if ( (y & 1) == 1 ) {
-      p1.x = 3;
-      p1.getNext().x = 4;
-    } else {
-      p1.x = 5;
-      p1.getNext().x = 6;
-    }
-    p1.y = 3 * p2.x + y;
-    p2.y = 3 * p1.x + y;
-    dummy();
-    return p1.y * p2.y;
-  }
-
-  int test8(int y, int l, int i) {
-    Point p = new Point();
-    p.ax = new int[l];
-    p.ay = new int[l];
-    int x = 3;
-    p.ax[i] = x;
-    p.ay[i] = 3 * x + y;
-    dummy();
-    return p.ax[i] * p.ay[i];
-  }
-
-  int test9(int y, int l, int i) {
-    Point p = new Point();
-    p.pax = new Point[l];
-    p.pay = new Point[l];
-    p.pax[i] = new Point();
-    p.pay[i] = new Point();
-    p.pax[i].x = 3;
-    p.pay[i].x = 4;
-    p.pax[i].y = 3 * p.pay[i].x + y;
-    p.pay[i].y = 3 * p.pax[i].x + y;
-    dummy();
-    return p.pax[i].y * p.pay[i].y;
-  }
-
-  int test10(int y, int l, int i, Class cls) {
-    Point p = new Point();
-    try {
-      p.pax = (Point[])Array.newInstance(cls, l);
-      p.pax[i] = (Point)cls.newInstance();
-    }
-    catch(java.lang.InstantiationException ex) {
-      return 0;
-    }
-    catch(java.lang.IllegalAccessException ex) {
-      return 0;
-    }
-    p.pax[i].x = 3;
-    p.pax[i].y = 3 * p.pax[i].x + y;
-    dummy();
-    return p.pax[i].x * p.pax[i].y;
-  }
-
-  int test11(int y) {
-    Point p1 = new Point();
-    Point p2 = new Point();
-    p1.next = p2;
-    if ( (y & 1) == 1 ) {
-      p1.x = 3;
-      p1.next.x = 4;
-    } else {
-      p1.x = 5;
-      p1.next.x = 6;
-    }
-    p1.y = 3 * p1.next.x + y;
-    p1.next.y = 3 * p1.x + y;
-    dummy();
-    return p1.y * p1.next.y;
-  }
-
-  int test12(int y) {
-    Point p1 = new Point();
-    p1.next = p1;
-    if ( (y & 1) == 1 ) {
-      p1.x = 3;
-      p1.next.x = 4;
-    } else {
-      p1.x = 5;
-      p1.next.x = 6;
-    }
-    p1.y = 3 * p1.next.x + y;
-    p1.next.y = 3 * p1.x + y;
-    dummy();
-    return p1.y * p1.next.y;
-  }
-
-
-  public static void main(String args[]) {
-    Test tsr    = new Test();
-    Point p     = new Point();
-    Point ptmp  = p;
-    Class cls   = Point.class;
-    int y = 0;
-    for (int i=0; i<10000; i++) {
-      ptmp.next = tsr.test00(1);
-      ptmp.next = tsr.test01(1);
-      ptmp.next = tsr.test02(1);
-      ptmp.next = tsr.test03(1);
-      ptmp.next = tsr.test04(1);
-
-      y = tsr.test05(1);
-
-      y = tsr.test80(y, 1, 0);
-      y = tsr.test81(y, 1, 0);
-
-      y = tsr.test44(y);
-      y = tsr.test43(y);
-      y = tsr.test42(y);
-      y = tsr.test40(y);
-      y = tsr.test41(y);
-
-      y = tsr.test0(y);
-      y = tsr.test1(y);
-      y = tsr.test2(y);
-      y = tsr.test3(y, p);
-      y = tsr.test4(y);
-      y = tsr.test5(y, p);
-      y = tsr.test6(y);
-      y = tsr.test7(y, p);
-      y = tsr.test8(y, 1, 0);
-      y = tsr.test9(y, 1, 0);
-      y = tsr.test10(y, 1, 0, cls);
-      y = tsr.test11(y);
-      y = tsr.test12(y);
-    }
-    for (int i=0; i<10000; i++) {
-      ptmp.next = tsr.test00(1);
-      ptmp.next = tsr.test01(1);
-      ptmp.next = tsr.test02(1);
-      ptmp.next = tsr.test03(1);
-      ptmp.next = tsr.test04(1);
-
-      y = tsr.test05(1);
-
-      y = tsr.test80(y, 1, 0);
-      y = tsr.test81(y, 1, 0);
-
-      y = tsr.test44(y);
-      y = tsr.test43(y);
-      y = tsr.test42(y);
-      y = tsr.test40(y);
-      y = tsr.test41(y);
-
-      y = tsr.test0(y);
-      y = tsr.test1(y);
-      y = tsr.test2(y);
-      y = tsr.test3(y, p);
-      y = tsr.test4(y);
-      y = tsr.test5(y, p);
-      y = tsr.test6(y);
-      y = tsr.test7(y, p);
-      y = tsr.test8(y, 1, 0);
-      y = tsr.test9(y, 1, 0);
-      y = tsr.test10(y, 1, 0, cls);
-      y = tsr.test11(y);
-      y = tsr.test12(y);
-    }
-    for (int i=0; i<10000; i++) {
-      ptmp.next = tsr.test00(1);
-      ptmp.next = tsr.test01(1);
-      ptmp.next = tsr.test02(1);
-      ptmp.next = tsr.test03(1);
-      ptmp.next = tsr.test04(1);
-
-      y = tsr.test05(1);
-
-      y = tsr.test80(y, 1, 0);
-      y = tsr.test81(y, 1, 0);
-
-      y = tsr.test44(y);
-      y = tsr.test43(y);
-      y = tsr.test42(y);
-      y = tsr.test40(y);
-      y = tsr.test41(y);
-
-      y = tsr.test0(y);
-      y = tsr.test1(y);
-      y = tsr.test2(y);
-      y = tsr.test3(y, p);
-      y = tsr.test4(y);
-      y = tsr.test5(y, p);
-      y = tsr.test6(y);
-      y = tsr.test7(y, p);
-      y = tsr.test8(y, 1, 0);
-      y = tsr.test9(y, 1, 0);
-      y = tsr.test10(y, 1, 0, cls);
-      y = tsr.test11(y);
-      y = tsr.test12(y);
-    }
-
-    int z = 0;
-    y = tsr.test80(0, 1, 0);
-    z += y;
-    System.out.println("After 'test80' y=" + y);
-    y = tsr.test81(0, 1, 0);
-    z += y;
-    System.out.println("After 'test81' y=" + y);
-
-    y = tsr.test44(0);
-    z += y;
-    System.out.println("After 'test44' y=" + y);
-    y = tsr.test43(0);
-    z += y;
-    System.out.println("After 'test43' y=" + y);
-    y = tsr.test42(0);
-    z += y;
-    System.out.println("After 'test42' y=" + y);
-    y = tsr.test40(0);
-    z += y;
-    System.out.println("After 'test40' y=" + y);
-    y = tsr.test41(0);
-    z += y;
-    System.out.println("After 'test41' y=" + y);
-
-    ptmp.next = tsr.test00(1);
-    z += y;
-    System.out.println("After 'test00' p.y=" + ptmp.next.y);
-    ptmp.next = tsr.test01(1);
-    z += y;
-    System.out.println("After 'test01' p.y=" + ptmp.next.y);
-    ptmp.next = tsr.test02(1);
-    z += y;
-    System.out.println("After 'test02' p.y=" + ptmp.next.y);
-    ptmp.next = tsr.test03(1);
-    z += y;
-    System.out.println("After 'test03' p.y=" + ptmp.next.y);
-    ptmp.next = tsr.test04(1);
-    z += y;
-    System.out.println("After 'test04' p.y=" + ptmp.next.y);
-
-    y = tsr.test05(1);
-    z += y;
-    System.out.println("After 'test05' y=" + y);
-
-    y = tsr.test0(0);
-    z += y;
-    System.out.println("After 'test0' y=" + y);
-    y = tsr.test1(0);
-    z += y;
-    System.out.println("After 'test1' y=" + y);
-    y = tsr.test2(0);
-    z += y;
-    System.out.println("After 'test2' y=" + y);
-    y = tsr.test3(0, new Point());
-    z += y;
-    System.out.println("After 'test3' y=" + y);
-    y = tsr.test4(0);
-    z += y;
-    System.out.println("After 'test4' y=" + y);
-    y = tsr.test5(0, new Point());
-    z += y;
-    System.out.println("After 'test5' y=" + y);
-    y = tsr.test6(0);
-    z += y;
-    System.out.println("After 'test6' y=" + y);
-    y = tsr.test7(0, new Point());
-    z += y;
-    System.out.println("After 'test7' y=" + y);
-    y = tsr.test8(0, 1, 0);
-    z += y;
-    System.out.println("After 'test8' y=" + y);
-    y = tsr.test9(0, 1, 0);
-    z += y;
-    System.out.println("After 'test9' y=" + y);
-    y = tsr.test10(0, 1, 0, cls);
-    z += y;
-    System.out.println("After 'test10' y=" + y);
-    y = tsr.test11(0);
-    z += y;
-    System.out.println("After 'test11' y=" + y);
-    y = tsr.test12(0);
-    z += y;
-    System.out.println("After 'test12' y=" + y);
-    System.out.println("Sum of y =" + z);
-  }
-}
diff --git a/hotspot/test/compiler/escapeAnalysis/6726999/Test.java b/hotspot/test/compiler/escapeAnalysis/6726999/Test.java
deleted file mode 100644
index db2ba6d..0000000
--- a/hotspot/test/compiler/escapeAnalysis/6726999/Test.java
+++ /dev/null
@@ -1,1419 +0,0 @@
-/*
- * Copyright (c) 2008, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- *
- */
-
-/*
- * @test
- * @bug 6726999
- * @summary nsk/stress/jck12a/jck12a010 assert(n != NULL,"Bad immediate dominator info.");
- * @run main/othervm -Xbatch -XX:CompileCommand=exclude,Test.dummy -XX:+AggressiveOpts Test
- */
-
-import java.lang.reflect.Array;
-
-class Point {
-  int x;
-  int y;
-}
-
-public class Test {
-
-  void dummy() {
-    // Empty method to verify correctness of DebugInfo.
-    // Use -XX:CompileCommand=exclude,Test.dummy
-  }
-
-  int test0_0_0(int y) {
-    int x = 3;
-    Point p = new Point();
-    dummy();
-    p.x = x;
-    p.y = 3 * x + y;
-    return p.x * p.y;
-  }
-
-  int test0_0_1(int y) {
-    int x = 3;
-    Point p = null;
-    dummy();
-    p = new Point();
-    dummy();
-    p.x = x;
-    p.y = 3 * x + y;
-    return p.x * p.y;
-  }
-
-  int test0_0_2(int y) {
-    int x = 3;
-    Point p = new Point();
-    dummy();
-    p = new Point();
-    dummy();
-    p.x = x;
-    p.y = 3 * x + y;
-    return p.x * p.y;
-  }
-
-  int test0_0_3(int y) {
-    int x = 3;
-    Point p[] = new Point[1];
-    p[0] = new Point();
-    dummy();
-    p[0].x = x;
-    p[0].y = 3 * x + y;
-    return p[0].x * p[0].y;
-  }
-
-  int test0_0_4(int y) {
-    int x = 3;
-    Point p[] = new Point[1];
-    dummy();
-    p[0] = new Point();
-    dummy();
-    p[0].x = x;
-    p[0].y = 3 * x + y;
-    return p[0].x * p[0].y;
-  }
-
-  int test0_0_5(int y) {
-    int x = 3;
-    Point p[] = new Point[1];
-    dummy();
-    p[0] = null;
-    dummy();
-    p[0] = new Point();
-    dummy();
-    p[0].x = x;
-    p[0].y = 3 * x + y;
-    return p[0].x * p[0].y;
-  }
-
-  int test0_0_6(int y) {
-    int x = 3;
-    Point p[] = new Point[1];
-    p[0] = new Point();
-    dummy();
-    p[0] = new Point();
-    dummy();
-    p[0].x = x;
-    p[0].y = 3 * x + y;
-    return p[0].x * p[0].y;
-  }
-
-  int test0_1_3(int y) {
-    int x = 3;
-    Point p1 = new Point();
-    dummy();
-    Point p[] = new Point[1];
-    p[0] = p1;
-    dummy();
-    p[0].x = x;
-    p[0].y = 3 * x + y;
-    return p[0].x * p[0].y;
-  }
-
-  int test0_1_4(int y) {
-    int x = 3;
-    Point p1 = new Point();
-    dummy();
-    Point p[] = new Point[1];
-    dummy();
-    p[0] = p1;
-    dummy();
-    p[0].x = x;
-    p[0].y = 3 * x + y;
-    return p[0].x * p[0].y;
-  }
-
-  int test0_1_5(int y) {
-    int x = 3;
-    Point p1 = new Point();
-    dummy();
-    Point p[] = new Point[1];
-    dummy();
-    p[0] = null;
-    dummy();
-    p[0] = p1;
-    dummy();
-    p[0].x = x;
-    p[0].y = 3 * x + y;
-    return p[0].x * p[0].y;
-  }
-
-  int test0_1_6(int y) {
-    int x = 3;
-    Point p1 = new Point();
-    dummy();
-    Point p2 = new Point();
-    dummy();
-    Point p[] = new Point[1];
-    p[0] = p1;
-    dummy();
-    p[0] = p2;
-    dummy();
-    p[0].x = x;
-    p[0].y = 3 * x + y;
-    return p[0].x * p[0].y;
-  }
-
-  int test1_0_0(int y) {
-    Point p = new Point();
-    if ( (y & 1) == 1 ) {
-      p = new Point();
-    }
-    int x = 3;
-    p.x = x;
-    p.y = 3 * x + y;
-    dummy();
-    return p.x * p.y;
-  }
-
-  int test1_0_1(int y) {
-    Point p = null;
-    if ( (y & 1) == 1 ) {
-      p = new Point();
-    }
-    int x = 3;
-    if ( p == null )
-      return (3 * x + y) * x;
-    p.x = x;
-    p.y = 3 * x + y;
-    dummy();
-    return p.x * p.y;
-  }
-
-  int test1_0_2(int y) {
-    Point p[] = new Point[1];
-    if ( (y & 1) == 1 ) {
-      p[0] = new Point();
-    }
-    int x = 3;
-    if ( p[0] == null )
-      return (3 * x + y) * x;
-    p[0].x = x;
-    p[0].y = 3 * x + y;
-    dummy();
-    return p[0].x * p[0].y;
-  }
-
-  int test1_0_3(int y) {
-    Point p[] = new Point[1];
-    p[0] = null;
-    if ( (y & 1) == 1 ) {
-      p[0] = new Point();
-    }
-    int x = 3;
-    if ( p[0] == null )
-      return (3 * x + y) * x;
-    p[0].x = x;
-    p[0].y = 3 * x + y;
-    dummy();
-    return p[0].x * p[0].y;
-  }
-
-  int test1_0_4(int y) {
-    Point p[] = new Point[1];
-    p[0] = new Point();
-    if ( (y & 1) == 1 ) {
-      p[0] = new Point();
-    }
-    int x = 3;
-    if ( p[0] == null )
-      return (3 * x + y) * x;
-    p[0].x = x;
-    p[0].y = 3 * x + y;
-    dummy();
-    return p[0].x * p[0].y;
-  }
-
-  int test1_0_5(int y) {
-    Point p[] = new Point[1];
-    if ( (y & 1) == 1 ) {
-      p[0] = new Point();
-    } else {
-      p[0] = null;
-    }
-    int x = 3;
-    if ( p[0] == null )
-      return (3 * x + y) * x;
-    p[0].x = x;
-    p[0].y = 3 * x + y;
-    dummy();
-    return p[0].x * p[0].y;
-  }
-
-  int test1_0_6(int y) {
-    Point p[] = new Point[1];
-    if ( (y & 1) == 1 ) {
-      p[0] = new Point();
-    } else {
-      p[0] = new Point();
-    }
-    int x = 3;
-    if ( p[0] == null )
-      return (3 * x + y) * x;
-    p[0].x = x;
-    p[0].y = 3 * x + y;
-    dummy();
-    return p[0].x * p[0].y;
-  }
-
-  int test1_1_0(int y) {
-    Point p = new Point();
-    if ( (y & 1) == 1 ) {
-      dummy();
-      p = new Point();
-      dummy();
-    }
-    int x = 3;
-    p.x = x;
-    p.y = 3 * x + y;
-    dummy();
-    return p.x * p.y;
-  }
-
-  int test1_1_1(int y) {
-    Point p = null;
-    if ( (y & 1) == 1 ) {
-      dummy();
-      p = new Point();
-      dummy();
-    }
-    int x = 3;
-    if ( p == null )
-      return (3 * x + y) * x;
-    p.x = x;
-    p.y = 3 * x + y;
-    dummy();
-    return p.x * p.y;
-  }
-
-  int test1_1_2(int y) {
-    Point p[] = new Point[1];
-    if ( (y & 1) == 1 ) {
-      dummy();
-      p[0] = new Point();
-      dummy();
-    }
-    int x = 3;
-    if ( p[0] == null )
-      return (3 * x + y) * x;
-    p[0].x = x;
-    p[0].y = 3 * x + y;
-    dummy();
-    return p[0].x * p[0].y;
-  }
-
-  int test1_1_3(int y) {
-    Point p[] = new Point[1];
-    dummy();
-    p[0] = null;
-    if ( (y & 1) == 1 ) {
-      dummy();
-      p[0] = new Point();
-      dummy();
-    }
-    int x = 3;
-    if ( p[0] == null )
-      return (3 * x + y) * x;
-    p[0].x = x;
-    p[0].y = 3 * x + y;
-    dummy();
-    return p[0].x * p[0].y;
-  }
-
-  int test1_1_4(int y) {
-    Point p[] = new Point[1];
-    dummy();
-    p[0] = new Point();
-    if ( (y & 1) == 1 ) {
-      dummy();
-      p[0] = new Point();
-      dummy();
-    }
-    int x = 3;
-    if ( p[0] == null )
-      return (3 * x + y) * x;
-    p[0].x = x;
-    p[0].y = 3 * x + y;
-    dummy();
-    return p[0].x * p[0].y;
-  }
-
-  int test1_1_5(int y) {
-    Point p[] = new Point[1];
-    if ( (y & 1) == 1 ) {
-      dummy();
-      p[0] = new Point();
-      dummy();
-    } else {
-      dummy();
-      p[0] = null;
-      dummy();
-    }
-    int x = 3;
-    if ( p[0] == null )
-      return (3 * x + y) * x;
-    p[0].x = x;
-    p[0].y = 3 * x + y;
-    dummy();
-    return p[0].x * p[0].y;
-  }
-
-  int test1_1_6(int y) {
-    Point p[] = new Point[1];
-    if ( (y & 1) == 1 ) {
-      dummy();
-      p[0] = new Point();
-      dummy();
-    } else {
-      dummy();
-      p[0] = new Point();
-      dummy();
-    }
-    int x = 3;
-    if ( p[0] == null )
-      return (3 * x + y) * x;
-    p[0].x = x;
-    p[0].y = 3 * x + y;
-    dummy();
-    return p[0].x * p[0].y;
-  }
-
-  int test1_2_0(int y) {
-    Point p1 = new Point();
-    dummy();
-    Point p = new Point();
-    if ( (y & 1) == 1 ) {
-      dummy();
-      p = p1;
-      dummy();
-    }
-    int x = 3;
-    p.x = x;
-    p.y = 3 * x + y;
-    dummy();
-    return p.x * p.y;
-  }
-
-  int test1_2_1(int y) {
-    Point p1 = new Point();
-    dummy();
-    Point p = null;
-    if ( (y & 1) == 1 ) {
-      dummy();
-      p = p1;
-      dummy();
-    }
-    int x = 3;
-    if ( p == null )
-      return (3 * x + y) * x;
-    p.x = x;
-    p.y = 3 * x + y;
-    dummy();
-    return p.x * p.y;
-  }
-
-  int test1_2_2(int y) {
-    Point p1 = new Point();
-    dummy();
-    Point p[] = new Point[1];
-    if ( (y & 1) == 1 ) {
-      dummy();
-      p[0] = p1;
-      dummy();
-    }
-    int x = 3;
-    if ( p[0] == null )
-      return (3 * x + y) * x;
-    p[0].x = x;
-    p[0].y = 3 * x + y;
-    dummy();
-    return p[0].x * p[0].y;
-  }
-
-  int test1_2_3(int y) {
-    Point p1 = new Point();
-    dummy();
-    Point p[] = new Point[1];
-    dummy();
-    p[0] = null;
-    if ( (y & 1) == 1 ) {
-      dummy();
-      p[0] = p1;
-      dummy();
-    }
-    int x = 3;
-    if ( p[0] == null )
-      return (3 * x + y) * x;
-    p[0].x = x;
-    p[0].y = 3 * x + y;
-    dummy();
-    return p[0].x * p[0].y;
-  }
-
-  int test1_2_4(int y) {
-    Point p1 = new Point();
-    dummy();
-    Point p2 = new Point();
-    dummy();
-    Point p[] = new Point[1];
-    dummy();
-    p[0] = p1;
-    if ( (y & 1) == 1 ) {
-      dummy();
-      p[0] = p2;
-      dummy();
-    }
-    int x = 3;
-    if ( p[0] == null )
-      return (3 * x + y) * x;
-    p[0].x = x;
-    p[0].y = 3 * x + y;
-    dummy();
-    return p[0].x * p[0].y;
-  }
-
-  int test1_2_5(int y) {
-    Point p1 = new Point();
-    dummy();
-    Point p[] = new Point[1];
-    if ( (y & 1) == 1 ) {
-      dummy();
-      p[0] = p1;
-      dummy();
-    } else {
-      dummy();
-      p[0] = null;
-      dummy();
-    }
-    int x = 3;
-    if ( p[0] == null )
-      return (3 * x + y) * x;
-    p[0].x = x;
-    p[0].y = 3 * x + y;
-    dummy();
-    return p[0].x * p[0].y;
-  }
-
-  int test1_2_6(int y) {
-    Point p1 = new Point();
-    dummy();
-    Point p2 = new Point();
-    dummy();
-    Point p[] = new Point[1];
-    if ( (y & 1) == 1 ) {
-      dummy();
-      p[0] = p1;
-      dummy();
-    } else {
-      dummy();
-      p[0] = p2;
-      dummy();
-    }
-    int x = 3;
-    if ( p[0] == null )
-      return (3 * x + y) * x;
-    p[0].x = x;
-    p[0].y = 3 * x + y;
-    dummy();
-    return p[0].x * p[0].y;
-  }
-
-  int test2_0_0(int y) {
-    Point p = new Point();
-    int lim = (y & 3);
-    for (int i = 0; i < lim; i++) {
-      p = new Point();
-    }
-    int x = 3;
-    p.x = x;
-    p.y = 3 * x + y;
-    dummy();
-    return p.x * p.y;
-  }
-
-  int test2_0_1(int y) {
-    Point p = null;
-    int lim = (y & 3);
-    for (int i = 0; i < lim; i++) {
-      p = new Point();
-    }
-    int x = 3;
-    if ( p == null )
-      return (3 * x + y) * x;
-    p.x = x;
-    p.y = 3 * x + y;
-    dummy();
-    return p.x * p.y;
-  }
-
-  int test2_0_2(int y) {
-    Point p[] = new Point[3];
-    int lim = (y & 3);
-    for (int i = 0; i < lim; i++) {
-      p[i] = new Point();
-    }
-    int x = 3;
-    int j = (y & 1);
-    if ( p[j] == null )
-      return (3 * x + y) * x;
-    p[j].x = x;
-    p[j].y = 3 * x + y;
-    dummy();
-    return p[j].x * p[0].y;
-  }
-
-  int test2_0_3(int y) {
-    Point p[] = new Point[3];
-    int j = (y & 1);
-    p[j] = null;
-    int lim = (y & 3);
-    for (int i = 0; i < lim; i++) {
-      p[i] = new Point();
-    }
-    int x = 3;
-    if ( p[j] == null )
-      return (3 * x + y) * x;
-    p[j].x = x;
-    p[j].y = 3 * x + y;
-    dummy();
-    return p[j].x * p[0].y;
-  }
-
-  int test2_0_4(int y) {
-    Point p[] = new Point[3];
-    int j = (y & 1);
-    p[j] = new Point();
-    int lim = (y & 3);
-    for (int i = 0; i < lim; i++) {
-      p[i] = new Point();
-    }
-    int x = 3;
-    if ( p[j] == null )
-      return (3 * x + y) * x;
-    p[j].x = x;
-    p[j].y = 3 * x + y;
-    dummy();
-    return p[j].x * p[0].y;
-  }
-
-  int test2_0_5(int y) {
-    Point p[] = new Point[3];
-    int lim = (y & 3);
-    for (int i = 0; i < lim; i++) {
-      p[i] = new Point();
-    }
-    for (int i = 0; i < lim; i++) {
-      p[i] = null;
-    }
-    int x = 3;
-    int j = (y & 1);
-    if ( p[j] == null )
-      return (3 * x + y) * x;
-    p[j].x = x;
-    p[j].y = 3 * x + y;
-    dummy();
-    return p[j].x * p[0].y;
-  }
-
-  int test2_0_6(int y) {
-    Point p[] = new Point[3];
-    int lim = (y & 3);
-    for (int i = 0; i < lim; i++) {
-      p[i] = new Point();
-    }
-    for (int i = 0; i < lim; i++) {
-      p[i] = new Point();
-    }
-    int x = 3;
-    int j = (y & 1);
-    if ( p[j] == null )
-      return (3 * x + y) * x;
-    p[j].x = x;
-    p[j].y = 3 * x + y;
-    dummy();
-    return p[j].x * p[0].y;
-  }
-
-  int test2_1_0(int y) {
-    Point p = new Point();
-    int lim = (y & 3);
-    for (int i = 0; i < lim; i++) {
-      dummy();
-      p = new Point();
-      dummy();
-    }
-    int x = 3;
-    p.x = x;
-    p.y = 3 * x + y;
-    dummy();
-    return p.x * p.y;
-  }
-
-  int test2_1_1(int y) {
-    Point p = null;
-    int lim = (y & 3);
-    for (int i = 0; i < lim; i++) {
-      dummy();
-      p = new Point();
-      dummy();
-    }
-    int x = 3;
-    if ( p == null )
-      return (3 * x + y) * x;
-    p.x = x;
-    p.y = 3 * x + y;
-    dummy();
-    return p.x * p.y;
-  }
-
-  int test2_1_2(int y) {
-    Point p[] = new Point[3];
-    int lim = (y & 3);
-    for (int i = 0; i < lim; i++) {
-      dummy();
-      p[i] = new Point();
-      dummy();
-    }
-    int x = 3;
-    int j = (y & 1);
-    if ( p[j] == null )
-      return (3 * x + y) * x;
-    p[j].x = x;
-    p[j].y = 3 * x + y;
-    dummy();
-    return p[j].x * p[0].y;
-  }
-
-  int test2_1_3(int y) {
-    Point p[] = new Point[3];
-    dummy();
-    int j = (y & 1);
-    p[j] = null;
-    int lim = (y & 3);
-    for (int i = 0; i < lim; i++) {
-      dummy();
-      p[i] = new Point();
-      dummy();
-    }
-    int x = 3;
-    if ( p[j] == null )
-      return (3 * x + y) * x;
-    p[j].x = x;
-    p[j].y = 3 * x + y;
-    dummy();
-    return p[j].x * p[0].y;
-  }
-
-  int test2_1_4(int y) {
-    Point p[] = new Point[3];
-    dummy();
-    int j = (y & 1);
-    p[j] = new Point();
-    int lim = (y & 3);
-    for (int i = 0; i < lim; i++) {
-      dummy();
-      p[i] = new Point();
-      dummy();
-    }
-    int x = 3;
-    if ( p[j] == null )
-      return (3 * x + y) * x;
-    p[j].x = x;
-    p[j].y = 3 * x + y;
-    dummy();
-    return p[j].x * p[0].y;
-  }
-
-  int test2_1_5(int y) {
-    Point p[] = new Point[3];
-    int lim = (y & 3);
-    for (int i = 0; i < lim; i++) {
-      dummy();
-      p[i] = new Point();
-      dummy();
-    }
-    for (int i = 0; i < lim; i++) {
-      dummy();
-      p[i] = null;
-      dummy();
-    }
-    int x = 3;
-    int j = (y & 1);
-    if ( p[j] == null )
-      return (3 * x + y) * x;
-    p[j].x = x;
-    p[j].y = 3 * x + y;
-    dummy();
-    return p[j].x * p[0].y;
-  }
-
-  int test2_1_6(int y) {
-    Point p[] = new Point[3];
-    int lim = (y & 3);
-    for (int i = 0; i < lim; i++) {
-      dummy();
-      p[i] = new Point();
-      dummy();
-    }
-    for (int i = 0; i < lim; i++) {
-      dummy();
-      p[i] = new Point();
-      dummy();
-    }
-    int x = 3;
-    int j = (y & 1);
-    if ( p[j] == null )
-      return (3 * x + y) * x;
-    p[j].x = x;
-    p[j].y = 3 * x + y;
-    dummy();
-    return p[j].x * p[0].y;
-  }
-
-  int test2_2_0(int y) {
-    Point p1 = new Point();
-    dummy();
-    Point p = new Point();
-    int lim = (y & 3);
-    for (int i = 0; i < lim; i++) {
-      dummy();
-      p = p1;
-      dummy();
-    }
-    int x = 3;
-    p.x = x;
-    p.y = 3 * x + y;
-    dummy();
-    return p.x * p.y;
-  }
-
-  int test2_2_1(int y) {
-    Point p1 = new Point();
-    dummy();
-    Point p = null;
-    int lim = (y & 3);
-    for (int i = 0; i < lim; i++) {
-      dummy();
-      p = p1;
-      dummy();
-    }
-    int x = 3;
-    if ( p == null )
-      return (3 * x + y) * x;
-    p.x = x;
-    p.y = 3 * x + y;
-    dummy();
-    return p.x * p.y;
-  }
-
-  int test2_2_2(int y) {
-    Point p1 = new Point();
-    dummy();
-    Point p[] = new Point[3];
-    int lim = (y & 3);
-    for (int i = 0; i < lim; i++) {
-      dummy();
-      p[i] = p1;
-      dummy();
-    }
-    int x = 3;
-    int j = (y & 1);
-    if ( p[j] == null )
-      return (3 * x + y) * x;
-    p[j].x = x;
-    p[j].y = 3 * x + y;
-    dummy();
-    return p[j].x * p[0].y;
-  }
-
-  int test2_2_3(int y) {
-    Point p1 = new Point();
-    dummy();
-    Point p[] = new Point[3];
-    dummy();
-    int j = (y & 1);
-    p[j] = null;
-    int lim = (y & 3);
-    for (int i = 0; i < lim; i++) {
-      dummy();
-      p[i] = p1;
-      dummy();
-    }
-    int x = 3;
-    if ( p[j] == null )
-      return (3 * x + y) * x;
-    p[j].x = x;
-    p[j].y = 3 * x + y;
-    dummy();
-    return p[j].x * p[0].y;
-  }
-
-  int test2_2_4(int y) {
-    Point p1 = new Point();
-    dummy();
-    Point p2 = new Point();
-    dummy();
-    Point p[] = new Point[3];
-    dummy();
-    int j = (y & 1);
-    p[j] = p1;
-    int lim = (y & 3);
-    for (int i = 0; i < lim; i++) {
-      dummy();
-      p[i] = p2;
-      dummy();
-    }
-    int x = 3;
-    if ( p[j] == null )
-      return (3 * x + y) * x;
-    p[j].x = x;
-    p[j].y = 3 * x + y;
-    dummy();
-    return p[j].x * p[0].y;
-  }
-
-  int test2_2_5(int y) {
-    Point p1 = new Point();
-    dummy();
-    Point p[] = new Point[3];
-    int lim = (y & 3);
-    for (int i = 0; i < lim; i++) {
-      dummy();
-      p[i] = p1;
-      dummy();
-    }
-    for (int i = 0; i < lim; i++) {
-      dummy();
-      p[i] = null;
-      dummy();
-    }
-    int x = 3;
-    int j = (y & 1);
-    if ( p[j] == null )
-      return (3 * x + y) * x;
-    p[j].x = x;
-    p[j].y = 3 * x + y;
-    dummy();
-    return p[j].x * p[0].y;
-  }
-
-  int test2_2_6(int y) {
-    Point p1 = new Point();
-    dummy();
-    Point p2 = new Point();
-    dummy();
-    Point p[] = new Point[3];
-    int lim = (y & 3);
-    for (int i = 0; i < lim; i++) {
-      dummy();
-      p[i] = p1;
-      dummy();
-    }
-    for (int i = 0; i < lim; i++) {
-      dummy();
-      p[i] = p2;
-      dummy();
-    }
-    int x = 3;
-    int j = (y & 1);
-    if ( p[j] == null )
-      return (3 * x + y) * x;
-    p[j].x = x;
-    p[j].y = 3 * x + y;
-    dummy();
-    return p[j].x * p[0].y;
-  }
-
-  public static void main(String args[]) {
-    Test tsr    = new Test();
-    Point p     = new Point();
-    Point ptmp  = p;
-    Class cls   = Point.class;
-    int y = 0;
-    for (int i=0; i<10000; i++) {
-      y = tsr.test0_0_0(y);
-      y = tsr.test0_0_0(y);
-      y = tsr.test0_0_1(y);
-      y = tsr.test0_0_1(y);
-      y = tsr.test0_0_2(y);
-      y = tsr.test0_0_2(y);
-      y = tsr.test0_0_3(y);
-      y = tsr.test0_0_3(y);
-      y = tsr.test0_0_4(y);
-      y = tsr.test0_0_4(y);
-      y = tsr.test0_0_5(y);
-      y = tsr.test0_0_5(y);
-      y = tsr.test0_0_6(y);
-      y = tsr.test0_0_6(y);
-
-      y = tsr.test0_1_3(y);
-      y = tsr.test0_1_3(y);
-      y = tsr.test0_1_4(y);
-      y = tsr.test0_1_4(y);
-      y = tsr.test0_1_5(y);
-      y = tsr.test0_1_5(y);
-      y = tsr.test0_1_6(y);
-      y = tsr.test0_1_6(y);
-
-      y = tsr.test1_0_0(y&~1);
-      y = tsr.test1_0_1(y&~1);
-      y = tsr.test1_0_2(y&~1);
-      y = tsr.test1_0_3(y&~1);
-      y = tsr.test1_0_4(y&~1);
-      y = tsr.test1_0_5(y&~1);
-      y = tsr.test1_0_6(y&~1);
-      y = tsr.test1_0_0((y&~1)+1);
-      y = tsr.test1_0_1((y&~1)+1);
-      y = tsr.test1_0_2((y&~1)+1);
-      y = tsr.test1_0_3((y&~1)+1);
-      y = tsr.test1_0_4((y&~1)+1);
-      y = tsr.test1_0_5((y&~1)+1);
-      y = tsr.test1_0_6((y&~1)+1);
-
-      y = tsr.test1_1_0(y&~1);
-      y = tsr.test1_1_1(y&~1);
-      y = tsr.test1_1_2(y&~1);
-      y = tsr.test1_1_3(y&~1);
-      y = tsr.test1_1_4(y&~1);
-      y = tsr.test1_1_5(y&~1);
-      y = tsr.test1_1_6(y&~1);
-      y = tsr.test1_1_0((y&~1)+1);
-      y = tsr.test1_1_1((y&~1)+1);
-      y = tsr.test1_1_2((y&~1)+1);
-      y = tsr.test1_1_3((y&~1)+1);
-      y = tsr.test1_1_4((y&~1)+1);
-      y = tsr.test1_1_5((y&~1)+1);
-      y = tsr.test1_1_6((y&~1)+1);
-
-      y = tsr.test1_2_0(y&~1);
-      y = tsr.test1_2_1(y&~1);
-      y = tsr.test1_2_2(y&~1);
-      y = tsr.test1_2_3(y&~1);
-      y = tsr.test1_2_4(y&~1);
-      y = tsr.test1_2_5(y&~1);
-      y = tsr.test1_2_6(y&~1);
-      y = tsr.test1_2_0((y&~1)+1);
-      y = tsr.test1_2_1((y&~1)+1);
-      y = tsr.test1_2_2((y&~1)+1);
-      y = tsr.test1_2_3((y&~1)+1);
-      y = tsr.test1_2_4((y&~1)+1);
-      y = tsr.test1_2_5((y&~1)+1);
-      y = tsr.test1_2_6((y&~1)+1);
-
-      y = tsr.test2_0_0(y&~3);
-      y = tsr.test2_0_1(y&~3);
-      y = tsr.test2_0_2(y&~3);
-      y = tsr.test2_0_3(y&~3);
-      y = tsr.test2_0_4(y&~3);
-      y = tsr.test2_0_5(y&~3);
-      y = tsr.test2_0_6(y&~3);
-      y = tsr.test2_0_0((y&~3)+3);
-      y = tsr.test2_0_1((y&~3)+3);
-      y = tsr.test2_0_2((y&~3)+3);
-      y = tsr.test2_0_3((y&~3)+3);
-      y = tsr.test2_0_4((y&~3)+3);
-      y = tsr.test2_0_5((y&~3)+3);
-      y = tsr.test2_0_6((y&~3)+3);
-
-      y = tsr.test2_1_0(y&~3);
-      y = tsr.test2_1_1(y&~3);
-      y = tsr.test2_1_2(y&~3);
-      y = tsr.test2_1_3(y&~3);
-      y = tsr.test2_1_4(y&~3);
-      y = tsr.test2_1_5(y&~3);
-      y = tsr.test2_1_6(y&~3);
-      y = tsr.test2_1_0((y&~3)+3);
-      y = tsr.test2_1_1((y&~3)+3);
-      y = tsr.test2_1_2((y&~3)+3);
-      y = tsr.test2_1_3((y&~3)+3);
-      y = tsr.test2_1_4((y&~3)+3);
-      y = tsr.test2_1_5((y&~3)+3);
-      y = tsr.test2_1_6((y&~3)+3);
-
-      y = tsr.test2_2_0(y&~3);
-      y = tsr.test2_2_1(y&~3);
-      y = tsr.test2_2_2(y&~3);
-      y = tsr.test2_2_3(y&~3);
-      y = tsr.test2_2_4(y&~3);
-      y = tsr.test2_2_5(y&~3);
-      y = tsr.test2_2_6(y&~3);
-      y = tsr.test2_2_0((y&~3)+3);
-      y = tsr.test2_2_1((y&~3)+3);
-      y = tsr.test2_2_2((y&~3)+3);
-      y = tsr.test2_2_3((y&~3)+3);
-      y = tsr.test2_2_4((y&~3)+3);
-      y = tsr.test2_2_5((y&~3)+3);
-      y = tsr.test2_2_6((y&~3)+3);
-
-    }
-    for (int i=0; i<10000; i++) {
-      y = tsr.test0_0_0(y);
-      y = tsr.test0_0_0(y);
-      y = tsr.test0_0_1(y);
-      y = tsr.test0_0_1(y);
-      y = tsr.test0_0_2(y);
-      y = tsr.test0_0_2(y);
-      y = tsr.test0_0_3(y);
-      y = tsr.test0_0_3(y);
-      y = tsr.test0_0_4(y);
-      y = tsr.test0_0_4(y);
-      y = tsr.test0_0_5(y);
-      y = tsr.test0_0_5(y);
-      y = tsr.test0_0_6(y);
-      y = tsr.test0_0_6(y);
-
-      y = tsr.test0_1_3(y);
-      y = tsr.test0_1_3(y);
-      y = tsr.test0_1_4(y);
-      y = tsr.test0_1_4(y);
-      y = tsr.test0_1_5(y);
-      y = tsr.test0_1_5(y);
-      y = tsr.test0_1_6(y);
-      y = tsr.test0_1_6(y);
-
-      y = tsr.test1_0_0(y&~1);
-      y = tsr.test1_0_1(y&~1);
-      y = tsr.test1_0_2(y&~1);
-      y = tsr.test1_0_3(y&~1);
-      y = tsr.test1_0_4(y&~1);
-      y = tsr.test1_0_5(y&~1);
-      y = tsr.test1_0_6(y&~1);
-      y = tsr.test1_0_0((y&~1)+1);
-      y = tsr.test1_0_1((y&~1)+1);
-      y = tsr.test1_0_2((y&~1)+1);
-      y = tsr.test1_0_3((y&~1)+1);
-      y = tsr.test1_0_4((y&~1)+1);
-      y = tsr.test1_0_5((y&~1)+1);
-      y = tsr.test1_0_6((y&~1)+1);
-
-      y = tsr.test1_1_0(y&~1);
-      y = tsr.test1_1_1(y&~1);
-      y = tsr.test1_1_2(y&~1);
-      y = tsr.test1_1_3(y&~1);
-      y = tsr.test1_1_4(y&~1);
-      y = tsr.test1_1_5(y&~1);
-      y = tsr.test1_1_6(y&~1);
-      y = tsr.test1_1_0((y&~1)+1);
-      y = tsr.test1_1_1((y&~1)+1);
-      y = tsr.test1_1_2((y&~1)+1);
-      y = tsr.test1_1_3((y&~1)+1);
-      y = tsr.test1_1_4((y&~1)+1);
-      y = tsr.test1_1_5((y&~1)+1);
-      y = tsr.test1_1_6((y&~1)+1);
-
-      y = tsr.test1_2_0(y&~1);
-      y = tsr.test1_2_1(y&~1);
-      y = tsr.test1_2_2(y&~1);
-      y = tsr.test1_2_3(y&~1);
-      y = tsr.test1_2_4(y&~1);
-      y = tsr.test1_2_5(y&~1);
-      y = tsr.test1_2_6(y&~1);
-      y = tsr.test1_2_0((y&~1)+1);
-      y = tsr.test1_2_1((y&~1)+1);
-      y = tsr.test1_2_2((y&~1)+1);
-      y = tsr.test1_2_3((y&~1)+1);
-      y = tsr.test1_2_4((y&~1)+1);
-      y = tsr.test1_2_5((y&~1)+1);
-      y = tsr.test1_2_6((y&~1)+1);
-
-      y = tsr.test2_0_0(y&~3);
-      y = tsr.test2_0_1(y&~3);
-      y = tsr.test2_0_2(y&~3);
-      y = tsr.test2_0_3(y&~3);
-      y = tsr.test2_0_4(y&~3);
-      y = tsr.test2_0_5(y&~3);
-      y = tsr.test2_0_6(y&~3);
-      y = tsr.test2_0_0((y&~3)+3);
-      y = tsr.test2_0_1((y&~3)+3);
-      y = tsr.test2_0_2((y&~3)+3);
-      y = tsr.test2_0_3((y&~3)+3);
-      y = tsr.test2_0_4((y&~3)+3);
-      y = tsr.test2_0_5((y&~3)+3);
-      y = tsr.test2_0_6((y&~3)+3);
-
-      y = tsr.test2_1_0(y&~3);
-      y = tsr.test2_1_1(y&~3);
-      y = tsr.test2_1_2(y&~3);
-      y = tsr.test2_1_3(y&~3);
-      y = tsr.test2_1_4(y&~3);
-      y = tsr.test2_1_5(y&~3);
-      y = tsr.test2_1_6(y&~3);
-      y = tsr.test2_1_0((y&~3)+3);
-      y = tsr.test2_1_1((y&~3)+3);
-      y = tsr.test2_1_2((y&~3)+3);
-      y = tsr.test2_1_3((y&~3)+3);
-      y = tsr.test2_1_4((y&~3)+3);
-      y = tsr.test2_1_5((y&~3)+3);
-      y = tsr.test2_1_6((y&~3)+3);
-
-      y = tsr.test2_2_0(y&~3);
-      y = tsr.test2_2_1(y&~3);
-      y = tsr.test2_2_2(y&~3);
-      y = tsr.test2_2_3(y&~3);
-      y = tsr.test2_2_4(y&~3);
-      y = tsr.test2_2_5(y&~3);
-      y = tsr.test2_2_6(y&~3);
-      y = tsr.test2_2_0((y&~3)+3);
-      y = tsr.test2_2_1((y&~3)+3);
-      y = tsr.test2_2_2((y&~3)+3);
-      y = tsr.test2_2_3((y&~3)+3);
-      y = tsr.test2_2_4((y&~3)+3);
-      y = tsr.test2_2_5((y&~3)+3);
-      y = tsr.test2_2_6((y&~3)+3);
-
-    }
-    for (int i=0; i<10000; i++) {
-      y = tsr.test0_0_0(y);
-      y = tsr.test0_0_0(y);
-      y = tsr.test0_0_1(y);
-      y = tsr.test0_0_1(y);
-      y = tsr.test0_0_2(y);
-      y = tsr.test0_0_2(y);
-      y = tsr.test0_0_3(y);
-      y = tsr.test0_0_3(y);
-      y = tsr.test0_0_4(y);
-      y = tsr.test0_0_4(y);
-      y = tsr.test0_0_5(y);
-      y = tsr.test0_0_5(y);
-      y = tsr.test0_0_6(y);
-      y = tsr.test0_0_6(y);
-
-      y = tsr.test0_1_3(y);
-      y = tsr.test0_1_3(y);
-      y = tsr.test0_1_4(y);
-      y = tsr.test0_1_4(y);
-      y = tsr.test0_1_5(y);
-      y = tsr.test0_1_5(y);
-      y = tsr.test0_1_6(y);
-      y = tsr.test0_1_6(y);
-
-      y = tsr.test1_0_0(y&~1);
-      y = tsr.test1_0_1(y&~1);
-      y = tsr.test1_0_2(y&~1);
-      y = tsr.test1_0_3(y&~1);
-      y = tsr.test1_0_4(y&~1);
-      y = tsr.test1_0_5(y&~1);
-      y = tsr.test1_0_6(y&~1);
-      y = tsr.test1_0_0((y&~1)+1);
-      y = tsr.test1_0_1((y&~1)+1);
-      y = tsr.test1_0_2((y&~1)+1);
-      y = tsr.test1_0_3((y&~1)+1);
-      y = tsr.test1_0_4((y&~1)+1);
-      y = tsr.test1_0_5((y&~1)+1);
-      y = tsr.test1_0_6((y&~1)+1);
-
-      y = tsr.test1_1_0(y&~1);
-      y = tsr.test1_1_1(y&~1);
-      y = tsr.test1_1_2(y&~1);
-      y = tsr.test1_1_3(y&~1);
-      y = tsr.test1_1_4(y&~1);
-      y = tsr.test1_1_5(y&~1);
-      y = tsr.test1_1_6(y&~1);
-      y = tsr.test1_1_0((y&~1)+1);
-      y = tsr.test1_1_1((y&~1)+1);
-      y = tsr.test1_1_2((y&~1)+1);
-      y = tsr.test1_1_3((y&~1)+1);
-      y = tsr.test1_1_4((y&~1)+1);
-      y = tsr.test1_1_5((y&~1)+1);
-      y = tsr.test1_1_6((y&~1)+1);
-
-      y = tsr.test1_2_0(y&~1);
-      y = tsr.test1_2_1(y&~1);
-      y = tsr.test1_2_2(y&~1);
-      y = tsr.test1_2_3(y&~1);
-      y = tsr.test1_2_4(y&~1);
-      y = tsr.test1_2_5(y&~1);
-      y = tsr.test1_2_6(y&~1);
-      y = tsr.test1_2_0((y&~1)+1);
-      y = tsr.test1_2_1((y&~1)+1);
-      y = tsr.test1_2_2((y&~1)+1);
-      y = tsr.test1_2_3((y&~1)+1);
-      y = tsr.test1_2_4((y&~1)+1);
-      y = tsr.test1_2_5((y&~1)+1);
-      y = tsr.test1_2_6((y&~1)+1);
-
-      y = tsr.test2_0_0(y&~3);
-      y = tsr.test2_0_1(y&~3);
-      y = tsr.test2_0_2(y&~3);
-      y = tsr.test2_0_3(y&~3);
-      y = tsr.test2_0_4(y&~3);
-      y = tsr.test2_0_5(y&~3);
-      y = tsr.test2_0_6(y&~3);
-      y = tsr.test2_0_0((y&~3)+3);
-      y = tsr.test2_0_1((y&~3)+3);
-      y = tsr.test2_0_2((y&~3)+3);
-      y = tsr.test2_0_3((y&~3)+3);
-      y = tsr.test2_0_4((y&~3)+3);
-      y = tsr.test2_0_5((y&~3)+3);
-      y = tsr.test2_0_6((y&~3)+3);
-
-      y = tsr.test2_1_0(y&~3);
-      y = tsr.test2_1_1(y&~3);
-      y = tsr.test2_1_2(y&~3);
-      y = tsr.test2_1_3(y&~3);
-      y = tsr.test2_1_4(y&~3);
-      y = tsr.test2_1_5(y&~3);
-      y = tsr.test2_1_6(y&~3);
-      y = tsr.test2_1_0((y&~3)+3);
-      y = tsr.test2_1_1((y&~3)+3);
-      y = tsr.test2_1_2((y&~3)+3);
-      y = tsr.test2_1_3((y&~3)+3);
-      y = tsr.test2_1_4((y&~3)+3);
-      y = tsr.test2_1_5((y&~3)+3);
-      y = tsr.test2_1_6((y&~3)+3);
-
-      y = tsr.test2_2_0(y&~3);
-      y = tsr.test2_2_1(y&~3);
-      y = tsr.test2_2_2(y&~3);
-      y = tsr.test2_2_3(y&~3);
-      y = tsr.test2_2_4(y&~3);
-      y = tsr.test2_2_5(y&~3);
-      y = tsr.test2_2_6(y&~3);
-      y = tsr.test2_2_0((y&~3)+3);
-      y = tsr.test2_2_1((y&~3)+3);
-      y = tsr.test2_2_2((y&~3)+3);
-      y = tsr.test2_2_3((y&~3)+3);
-      y = tsr.test2_2_4((y&~3)+3);
-      y = tsr.test2_2_5((y&~3)+3);
-      y = tsr.test2_2_6((y&~3)+3);
-
-    }
-
-    int z = 0;
-    y = tsr.test0_0_0(0);
-    System.out.println("After 'test0_0_0' y=" + y);
-    y = tsr.test0_0_1(0);
-    System.out.println("After 'test0_0_1' y=" + y);
-    y = tsr.test0_0_2(0);
-    System.out.println("After 'test0_0_2' y=" + y);
-    y = tsr.test0_0_3(0);
-    System.out.println("After 'test0_0_3' y=" + y);
-    y = tsr.test0_0_4(0);
-    System.out.println("After 'test0_0_4' y=" + y);
-    y = tsr.test0_0_5(0);
-    System.out.println("After 'test0_0_5' y=" + y);
-    y = tsr.test0_0_6(0);
-    System.out.println("After 'test0_0_6' y=" + y);
-    y = tsr.test0_1_3(0);
-    System.out.println("After 'test0_1_3' y=" + y);
-    y = tsr.test0_1_4(0);
-    System.out.println("After 'test0_1_4' y=" + y);
-    y = tsr.test0_1_5(0);
-    System.out.println("After 'test0_1_5' y=" + y);
-    y = tsr.test0_1_6(0);
-    System.out.println("After 'test0_1_6' y=" + y);
-
-    y = tsr.test1_0_0(0);
-    System.out.println("After 'test1_0_0' y=" + y);
-    y = tsr.test1_0_1(0);
-    System.out.println("After 'test1_0_1' y=" + y);
-    y = tsr.test1_0_2(0);
-    System.out.println("After 'test1_0_2' y=" + y);
-    y = tsr.test1_0_3(0);
-    System.out.println("After 'test1_0_3' y=" + y);
-    y = tsr.test1_0_4(0);
-    System.out.println("After 'test1_0_4' y=" + y);
-    y = tsr.test1_0_5(0);
-    System.out.println("After 'test1_0_5' y=" + y);
-    y = tsr.test1_0_6(0);
-    System.out.println("After 'test1_0_6' y=" + y);
-
-    y = tsr.test1_1_0(0);
-    System.out.println("After 'test1_1_0' y=" + y);
-    y = tsr.test1_1_1(0);
-    System.out.println("After 'test1_1_1' y=" + y);
-    y = tsr.test1_1_2(0);
-    System.out.println("After 'test1_1_2' y=" + y);
-    y = tsr.test1_1_3(0);
-    System.out.println("After 'test1_1_3' y=" + y);
-    y = tsr.test1_1_4(0);
-    System.out.println("After 'test1_1_4' y=" + y);
-    y = tsr.test1_1_5(0);
-    System.out.println("After 'test1_1_5' y=" + y);
-    y = tsr.test1_1_6(0);
-    System.out.println("After 'test1_1_6' y=" + y);
-
-    y = tsr.test1_2_0(0);
-    System.out.println("After 'test1_2_0' y=" + y);
-    y = tsr.test1_2_1(0);
-    System.out.println("After 'test1_2_1' y=" + y);
-    y = tsr.test1_2_2(0);
-    System.out.println("After 'test1_2_2' y=" + y);
-    y = tsr.test1_2_3(0);
-    System.out.println("After 'test1_2_3' y=" + y);
-    y = tsr.test1_2_4(0);
-    System.out.println("After 'test1_2_4' y=" + y);
-    y = tsr.test1_2_5(0);
-    System.out.println("After 'test1_2_5' y=" + y);
-    y = tsr.test1_2_6(0);
-    System.out.println("After 'test1_2_6' y=" + y);
-
-    y = tsr.test2_0_0(0);
-    System.out.println("After 'test2_0_0' y=" + y);
-    y = tsr.test2_0_1(0);
-    System.out.println("After 'test2_0_1' y=" + y);
-    y = tsr.test2_0_2(0);
-    System.out.println("After 'test2_0_2' y=" + y);
-    y = tsr.test2_0_3(0);
-    System.out.println("After 'test2_0_3' y=" + y);
-    y = tsr.test2_0_4(0);
-    System.out.println("After 'test2_0_4' y=" + y);
-    y = tsr.test2_0_5(0);
-    System.out.println("After 'test2_0_5' y=" + y);
-    y = tsr.test2_0_6(0);
-    System.out.println("After 'test2_0_6' y=" + y);
-
-    y = tsr.test2_1_0(0);
-    System.out.println("After 'test2_1_0' y=" + y);
-    y = tsr.test2_1_1(0);
-    System.out.println("After 'test2_1_1' y=" + y);
-    y = tsr.test2_1_2(0);
-    System.out.println("After 'test2_1_2' y=" + y);
-    y = tsr.test2_1_3(0);
-    System.out.println("After 'test2_1_3' y=" + y);
-    y = tsr.test2_1_4(0);
-    System.out.println("After 'test2_1_4' y=" + y);
-    y = tsr.test2_1_5(0);
-    System.out.println("After 'test2_1_5' y=" + y);
-    y = tsr.test2_1_6(0);
-    System.out.println("After 'test2_1_6' y=" + y);
-
-    y = tsr.test2_2_0(0);
-    System.out.println("After 'test2_2_0' y=" + y);
-    y = tsr.test2_2_1(0);
-    System.out.println("After 'test2_2_1' y=" + y);
-    y = tsr.test2_2_2(0);
-    System.out.println("After 'test2_2_2' y=" + y);
-    y = tsr.test2_2_3(0);
-    System.out.println("After 'test2_2_3' y=" + y);
-    y = tsr.test2_2_4(0);
-    System.out.println("After 'test2_2_4' y=" + y);
-    y = tsr.test2_2_5(0);
-    System.out.println("After 'test2_2_5' y=" + y);
-    y = tsr.test2_2_6(0);
-    System.out.println("After 'test2_2_6' y=" + y);
-
-  }
-}
diff --git a/hotspot/test/compiler/escapeAnalysis/6775880/Test.java b/hotspot/test/compiler/escapeAnalysis/6775880/Test.java
deleted file mode 100644
index f5a51fe..0000000
--- a/hotspot/test/compiler/escapeAnalysis/6775880/Test.java
+++ /dev/null
@@ -1,66 +0,0 @@
-/*
- * Copyright (c) 2008, 2014, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- *
- */
-
-/*
- * @test
- * @bug 6775880
- * @summary EA +DeoptimizeALot: assert(mon_info->owner()->is_locked(),"object must be locked now")
- * @run main/othervm -XX:+IgnoreUnrecognizedVMOptions -Xbatch -XX:+DoEscapeAnalysis -XX:+DeoptimizeALot -XX:CompileCommand=exclude,java.lang.AbstractStringBuilder::append Test
- */
-
-public class Test {
-
-  int cnt;
-  int b[];
-  String s;
-
-  String test() {
-    String res="";
-    for (int i=0; i < cnt; i++) {
-      if (i != 0) {
-        res = res +".";
-      }
-      res = res + b[i];
-    }
-    return res;
-  }
-
-  public static void main(String[] args) {
-    Test t = new Test();
-    t.cnt = 3;
-    t.b = new int[3];
-    t.b[0] = 0;
-    t.b[1] = 1;
-    t.b[2] = 2;
-    int j=0;
-    t.s = "";
-    for (int i=0; i<10001; i++) {
-      t.s = "c";
-      t.s = t.test();
-    }
-    System.out.println("After s=" + t.s);
-  }
-}
-
-
diff --git a/hotspot/test/compiler/escapeAnalysis/Test6689060.java b/hotspot/test/compiler/escapeAnalysis/Test6689060.java
new file mode 100644
index 0000000..98d4847
--- /dev/null
+++ b/hotspot/test/compiler/escapeAnalysis/Test6689060.java
@@ -0,0 +1,579 @@
+/*
+ * Copyright (c) 2008, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+/*
+ * @test
+ * @bug 6689060
+ * @summary Escape Analysis does not work with Compressed Oops
+ *
+ * @run main/othervm -Xbatch -XX:+AggressiveOpts
+ *      -XX:CompileCommand=exclude,compiler.escapeAnalysis.Test6689060::dummy
+ *      compiler.escapeAnalysis.Test6689060
+ */
+
+package compiler.escapeAnalysis;
+
+import java.lang.reflect.Array;
+
+public class Test6689060 {
+    static class Point {
+        int x;
+        int y;
+        Point next;
+        int ax[];
+        int ay[];
+        Point pax[];
+        Point pay[];
+
+        public Point getNext() {
+            return next;
+        }
+    }
+
+    void dummy() {
+        // Empty method to verify correctness of DebugInfo.
+        // Use -XX:CompileCommand=exclude,Test.dummy
+    }
+
+    int ival(int i) {
+        return i * 2;
+    }
+
+    int test80(int y, int l, int i) {
+        Point p = new Point();
+        p.ax = new int[2];
+        p.ay = new int[2];
+        int x = 3;
+        p.ax[0] = x;
+        p.ay[1] = 3 * x + y;
+        dummy();
+        return p.ax[0] * p.ay[1];
+    }
+
+    int test81(int y, int l, int i) {
+        Point p = new Point();
+        p.ax = new int[2];
+        p.ay = new int[2];
+        int x = 3;
+        p.ax[0] = x;
+        p.ay[1] = 3 * x + y;
+        dummy();
+        return p.ax[0] * p.ay[1];
+    }
+
+
+    int test44(int y) {
+        Point p1 = new Point();
+        p1.x = ival(3);
+        dummy();
+        p1.y = 3 * p1.x + y;
+        return p1.y;
+    }
+
+    int test43(int y) {
+        Point p1 = new Point();
+        if ((y & 1) == 1) {
+            p1.x = ival(3);
+        } else {
+            p1.x = ival(5);
+        }
+        dummy();
+        p1.y = 3 * p1.x + y;
+        return p1.y;
+    }
+
+    int test42(int y) {
+        Point p1 = new Point();
+        p1.x = 3;
+        for (int i = 0; i < y; i++) {
+            if ((i & 1) == 1) {
+                p1.x += 4;
+            }
+        }
+        p1.y = 3 * y + p1.x;
+        return p1.y;
+    }
+
+    int test40(int y) {
+        Point p1 = new Point();
+        if ((y & 1) == 1) {
+            p1.x = 3;
+        } else {
+            p1.x = 5;
+        }
+        p1.y = 3 * p1.x + y;
+        return p1.y;
+    }
+
+    int test41(int y) {
+        Point p1 = new Point();
+        if ((y & 1) == 1) {
+            p1.x += 4;
+        } else {
+            p1.x += 5;
+        }
+        p1.y = 3 * p1.x + y;
+        return p1.y;
+    }
+
+    Point test00(int y) {
+        int x = 3;
+        Point p = new Point();
+        p.x = x;
+        p.y = 3 * x + y;
+        return p;
+    }
+
+    Point test01(int y) {
+        int x = 3;
+        Point p = new Point();
+        p.x = x;
+        p.y = 3 * x + y;
+        dummy();
+        return p;
+    }
+
+    Point test02(int y) {
+        int x = 3;
+        Point p1 = null;
+        for (int i = 0; i < y; i++) {
+            Point p2 = new Point();
+            p2.x = x;
+            p2.y = 3 * y + x;
+            p2.next = p1;
+            p1 = p2;
+        }
+        return p1;
+    }
+
+    Point test03(int y) {
+        int x = 3;
+        Point p1 = null;
+        for (int i = 0; i < y; i++) {
+            Point p2 = new Point();
+            p2.x = x;
+            p2.y = 3 * y + x;
+            p2.next = p1;
+            p1 = p2;
+        }
+        dummy();
+        return p1;
+    }
+
+    Point test04(int y) {
+        int x = 3;
+        Point p1 = null;
+        for (int i = 0; i < y; i++) {
+            Point p2 = new Point();
+            p2.x = x;
+            p2.y = 3 * y + x;
+            p2.next = p1;
+            dummy();
+            p1 = p2;
+        }
+        return p1;
+    }
+
+    int test05(int y) {
+        int x = 3;
+        Point p1 = new Point();
+        for (int i = 0; i < y; i++) {
+            Point p2 = new Point();
+            p2.x = x;
+            p2.y = 3 * y + x;
+            p1.next = p2;
+            p1 = p2;
+        }
+        return p1.y;
+    }
+
+    int test0(int y) {
+        int x = 3;
+        Point p = new Point();
+        p.x = x;
+        p.y = 3 * x + y;
+        dummy();
+        return p.x * p.y;
+    }
+
+    int test1(int y) {
+        Point p = new Point();
+        if ((y & 1) == 1) {
+            p = new Point(); // Kill previous
+        }
+        int x = 3;
+        p.x = x;
+        p.y = 3 * x + y;
+        dummy();
+        return p.x * p.y;
+    }
+
+    int test2(int y) {
+        Point p1 = new Point();
+        Point p2 = new Point();
+        p1.x = 3;
+        p2.x = 4;
+        p1.y = 3 * p2.x + y;
+        p2.y = 3 * p1.x + y;
+        dummy();
+        return p1.y * p2.y;
+    }
+
+    int test3(int y, Point p1) {
+        Point p2 = new Point();
+        p1.x = 3;
+        p2.x = 4;
+        p1.y = 3 * p2.x + y;
+        p2.y = 3 * p1.x + y;
+        dummy();
+        return p1.y * p2.y;
+    }
+
+    int test4(int y) {
+        Point p1 = new Point();
+        Point p2 = new Point();
+        if ((y & 1) == 1) {
+            p1.x = 3;
+            p2.x = 4;
+        } else {
+            p1.x = 5;
+            p2.x = 6;
+        }
+        p1.y = 3 * p2.x + y;
+        p2.y = 3 * p1.x + y;
+        dummy();
+        return p1.y * p2.y;
+    }
+
+    int test5(int y, Point p1) {
+        Point p2 = new Point();
+        if ((y & 1) == 1) {
+            p1.x = 3;
+            p2.x = 4;
+        } else {
+            p1.x = 5;
+            p2.x = 6;
+        }
+        p1.y = 3 * p2.x + y;
+        p2.y = 3 * p1.x + y;
+        dummy();
+        return p1.y * p2.y;
+    }
+
+    int test6(int y) {
+        Point p1 = new Point();
+        Point p2 = new Point();
+        p1.next = p2;
+        if ((y & 1) == 1) {
+            p1.x = 3;
+            p1.getNext().x = 4;
+        } else {
+            p1.x = 5;
+            p1.getNext().x = 6;
+        }
+        p1.y = 3 * p2.x + y;
+        p2.y = 3 * p1.x + y;
+        dummy();
+        return p1.y * p2.y;
+    }
+
+    int test7(int y, Point p1) {
+        Point p2 = new Point();
+        p1.next = p2;
+        if ((y & 1) == 1) {
+            p1.x = 3;
+            p1.getNext().x = 4;
+        } else {
+            p1.x = 5;
+            p1.getNext().x = 6;
+        }
+        p1.y = 3 * p2.x + y;
+        p2.y = 3 * p1.x + y;
+        dummy();
+        return p1.y * p2.y;
+    }
+
+    int test8(int y, int l, int i) {
+        Point p = new Point();
+        p.ax = new int[l];
+        p.ay = new int[l];
+        int x = 3;
+        p.ax[i] = x;
+        p.ay[i] = 3 * x + y;
+        dummy();
+        return p.ax[i] * p.ay[i];
+    }
+
+    int test9(int y, int l, int i) {
+        Point p = new Point();
+        p.pax = new Point[l];
+        p.pay = new Point[l];
+        p.pax[i] = new Point();
+        p.pay[i] = new Point();
+        p.pax[i].x = 3;
+        p.pay[i].x = 4;
+        p.pax[i].y = 3 * p.pay[i].x + y;
+        p.pay[i].y = 3 * p.pax[i].x + y;
+        dummy();
+        return p.pax[i].y * p.pay[i].y;
+    }
+
+    int test10(int y, int l, int i, Class cls) {
+        Point p = new Point();
+        try {
+            p.pax = (Point[]) Array.newInstance(cls, l);
+            p.pax[i] = (Point) cls.newInstance();
+        } catch (java.lang.InstantiationException ex) {
+            return 0;
+        } catch (java.lang.IllegalAccessException ex) {
+            return 0;
+        }
+        p.pax[i].x = 3;
+        p.pax[i].y = 3 * p.pax[i].x + y;
+        dummy();
+        return p.pax[i].x * p.pax[i].y;
+    }
+
+    int test11(int y) {
+        Point p1 = new Point();
+        Point p2 = new Point();
+        p1.next = p2;
+        if ((y & 1) == 1) {
+            p1.x = 3;
+            p1.next.x = 4;
+        } else {
+            p1.x = 5;
+            p1.next.x = 6;
+        }
+        p1.y = 3 * p1.next.x + y;
+        p1.next.y = 3 * p1.x + y;
+        dummy();
+        return p1.y * p1.next.y;
+    }
+
+    int test12(int y) {
+        Point p1 = new Point();
+        p1.next = p1;
+        if ((y & 1) == 1) {
+            p1.x = 3;
+            p1.next.x = 4;
+        } else {
+            p1.x = 5;
+            p1.next.x = 6;
+        }
+        p1.y = 3 * p1.next.x + y;
+        p1.next.y = 3 * p1.x + y;
+        dummy();
+        return p1.y * p1.next.y;
+    }
+
+
+    public static void main(String args[]) {
+        Test6689060 tsr = new Test6689060();
+        Point p = new Point();
+        Point ptmp = p;
+        Class cls = Point.class;
+        int y = 0;
+        for (int i = 0; i < 10000; i++) {
+            ptmp.next = tsr.test00(1);
+            ptmp.next = tsr.test01(1);
+            ptmp.next = tsr.test02(1);
+            ptmp.next = tsr.test03(1);
+            ptmp.next = tsr.test04(1);
+
+            y = tsr.test05(1);
+
+            y = tsr.test80(y, 1, 0);
+            y = tsr.test81(y, 1, 0);
+
+            y = tsr.test44(y);
+            y = tsr.test43(y);
+            y = tsr.test42(y);
+            y = tsr.test40(y);
+            y = tsr.test41(y);
+
+            y = tsr.test0(y);
+            y = tsr.test1(y);
+            y = tsr.test2(y);
+            y = tsr.test3(y, p);
+            y = tsr.test4(y);
+            y = tsr.test5(y, p);
+            y = tsr.test6(y);
+            y = tsr.test7(y, p);
+            y = tsr.test8(y, 1, 0);
+            y = tsr.test9(y, 1, 0);
+            y = tsr.test10(y, 1, 0, cls);
+            y = tsr.test11(y);
+            y = tsr.test12(y);
+        }
+        for (int i = 0; i < 10000; i++) {
+            ptmp.next = tsr.test00(1);
+            ptmp.next = tsr.test01(1);
+            ptmp.next = tsr.test02(1);
+            ptmp.next = tsr.test03(1);
+            ptmp.next = tsr.test04(1);
+
+            y = tsr.test05(1);
+
+            y = tsr.test80(y, 1, 0);
+            y = tsr.test81(y, 1, 0);
+
+            y = tsr.test44(y);
+            y = tsr.test43(y);
+            y = tsr.test42(y);
+            y = tsr.test40(y);
+            y = tsr.test41(y);
+
+            y = tsr.test0(y);
+            y = tsr.test1(y);
+            y = tsr.test2(y);
+            y = tsr.test3(y, p);
+            y = tsr.test4(y);
+            y = tsr.test5(y, p);
+            y = tsr.test6(y);
+            y = tsr.test7(y, p);
+            y = tsr.test8(y, 1, 0);
+            y = tsr.test9(y, 1, 0);
+            y = tsr.test10(y, 1, 0, cls);
+            y = tsr.test11(y);
+            y = tsr.test12(y);
+        }
+        for (int i = 0; i < 10000; i++) {
+            ptmp.next = tsr.test00(1);
+            ptmp.next = tsr.test01(1);
+            ptmp.next = tsr.test02(1);
+            ptmp.next = tsr.test03(1);
+            ptmp.next = tsr.test04(1);
+
+            y = tsr.test05(1);
+
+            y = tsr.test80(y, 1, 0);
+            y = tsr.test81(y, 1, 0);
+
+            y = tsr.test44(y);
+            y = tsr.test43(y);
+            y = tsr.test42(y);
+            y = tsr.test40(y);
+            y = tsr.test41(y);
+
+            y = tsr.test0(y);
+            y = tsr.test1(y);
+            y = tsr.test2(y);
+            y = tsr.test3(y, p);
+            y = tsr.test4(y);
+            y = tsr.test5(y, p);
+            y = tsr.test6(y);
+            y = tsr.test7(y, p);
+            y = tsr.test8(y, 1, 0);
+            y = tsr.test9(y, 1, 0);
+            y = tsr.test10(y, 1, 0, cls);
+            y = tsr.test11(y);
+            y = tsr.test12(y);
+        }
+
+        int z = 0;
+        y = tsr.test80(0, 1, 0);
+        z += y;
+        System.out.println("After 'test80' y=" + y);
+        y = tsr.test81(0, 1, 0);
+        z += y;
+        System.out.println("After 'test81' y=" + y);
+
+        y = tsr.test44(0);
+        z += y;
+        System.out.println("After 'test44' y=" + y);
+        y = tsr.test43(0);
+        z += y;
+        System.out.println("After 'test43' y=" + y);
+        y = tsr.test42(0);
+        z += y;
+        System.out.println("After 'test42' y=" + y);
+        y = tsr.test40(0);
+        z += y;
+        System.out.println("After 'test40' y=" + y);
+        y = tsr.test41(0);
+        z += y;
+        System.out.println("After 'test41' y=" + y);
+
+        ptmp.next = tsr.test00(1);
+        z += y;
+        System.out.println("After 'test00' p.y=" + ptmp.next.y);
+        ptmp.next = tsr.test01(1);
+        z += y;
+        System.out.println("After 'test01' p.y=" + ptmp.next.y);
+        ptmp.next = tsr.test02(1);
+        z += y;
+        System.out.println("After 'test02' p.y=" + ptmp.next.y);
+        ptmp.next = tsr.test03(1);
+        z += y;
+        System.out.println("After 'test03' p.y=" + ptmp.next.y);
+        ptmp.next = tsr.test04(1);
+        z += y;
+        System.out.println("After 'test04' p.y=" + ptmp.next.y);
+
+        y = tsr.test05(1);
+        z += y;
+        System.out.println("After 'test05' y=" + y);
+
+        y = tsr.test0(0);
+        z += y;
+        System.out.println("After 'test0' y=" + y);
+        y = tsr.test1(0);
+        z += y;
+        System.out.println("After 'test1' y=" + y);
+        y = tsr.test2(0);
+        z += y;
+        System.out.println("After 'test2' y=" + y);
+        y = tsr.test3(0, new Point());
+        z += y;
+        System.out.println("After 'test3' y=" + y);
+        y = tsr.test4(0);
+        z += y;
+        System.out.println("After 'test4' y=" + y);
+        y = tsr.test5(0, new Point());
+        z += y;
+        System.out.println("After 'test5' y=" + y);
+        y = tsr.test6(0);
+        z += y;
+        System.out.println("After 'test6' y=" + y);
+        y = tsr.test7(0, new Point());
+        z += y;
+        System.out.println("After 'test7' y=" + y);
+        y = tsr.test8(0, 1, 0);
+        z += y;
+        System.out.println("After 'test8' y=" + y);
+        y = tsr.test9(0, 1, 0);
+        z += y;
+        System.out.println("After 'test9' y=" + y);
+        y = tsr.test10(0, 1, 0, cls);
+        z += y;
+        System.out.println("After 'test10' y=" + y);
+        y = tsr.test11(0);
+        z += y;
+        System.out.println("After 'test11' y=" + y);
+        y = tsr.test12(0);
+        z += y;
+        System.out.println("After 'test12' y=" + y);
+        System.out.println("Sum of y =" + z);
+    }
+}
diff --git a/hotspot/test/compiler/escapeAnalysis/Test6726999.java b/hotspot/test/compiler/escapeAnalysis/Test6726999.java
new file mode 100644
index 0000000..becc1d8
--- /dev/null
+++ b/hotspot/test/compiler/escapeAnalysis/Test6726999.java
@@ -0,0 +1,1421 @@
+/*
+ * Copyright (c) 2008, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ *
+ */
+
+/*
+ * @test
+ * @bug 6726999
+ * @summary nsk/stress/jck12a/jck12a010 assert(n != NULL,"Bad immediate dominator info.");
+ *
+ * @run main/othervm -Xbatch -XX:+AggressiveOpts
+ *      -XX:CompileCommand=exclude,compiler.escapeAnalysis.Test6726999::dummy
+ *      compiler.escapeAnalysis.Test6726999
+ */
+
+package compiler.escapeAnalysis;
+
+public class Test6726999 {
+    static class Point {
+        int x;
+        int y;
+    }
+
+    void dummy() {
+        // Empty method to verify correctness of DebugInfo.
+        // Use -XX:CompileCommand=exclude,Test.dummy
+    }
+
+    int test0_0_0(int y) {
+        int x = 3;
+        Point p = new Point();
+        dummy();
+        p.x = x;
+        p.y = 3 * x + y;
+        return p.x * p.y;
+    }
+
+    int test0_0_1(int y) {
+        int x = 3;
+        Point p = null;
+        dummy();
+        p = new Point();
+        dummy();
+        p.x = x;
+        p.y = 3 * x + y;
+        return p.x * p.y;
+    }
+
+    int test0_0_2(int y) {
+        int x = 3;
+        Point p = new Point();
+        dummy();
+        p = new Point();
+        dummy();
+        p.x = x;
+        p.y = 3 * x + y;
+        return p.x * p.y;
+    }
+
+    int test0_0_3(int y) {
+        int x = 3;
+        Point p[] = new Point[1];
+        p[0] = new Point();
+        dummy();
+        p[0].x = x;
+        p[0].y = 3 * x + y;
+        return p[0].x * p[0].y;
+    }
+
+    int test0_0_4(int y) {
+        int x = 3;
+        Point p[] = new Point[1];
+        dummy();
+        p[0] = new Point();
+        dummy();
+        p[0].x = x;
+        p[0].y = 3 * x + y;
+        return p[0].x * p[0].y;
+    }
+
+    int test0_0_5(int y) {
+        int x = 3;
+        Point p[] = new Point[1];
+        dummy();
+        p[0] = null;
+        dummy();
+        p[0] = new Point();
+        dummy();
+        p[0].x = x;
+        p[0].y = 3 * x + y;
+        return p[0].x * p[0].y;
+    }
+
+    int test0_0_6(int y) {
+        int x = 3;
+        Point p[] = new Point[1];
+        p[0] = new Point();
+        dummy();
+        p[0] = new Point();
+        dummy();
+        p[0].x = x;
+        p[0].y = 3 * x + y;
+        return p[0].x * p[0].y;
+    }
+
+    int test0_1_3(int y) {
+        int x = 3;
+        Point p1 = new Point();
+        dummy();
+        Point p[] = new Point[1];
+        p[0] = p1;
+        dummy();
+        p[0].x = x;
+        p[0].y = 3 * x + y;
+        return p[0].x * p[0].y;
+    }
+
+    int test0_1_4(int y) {
+        int x = 3;
+        Point p1 = new Point();
+        dummy();
+        Point p[] = new Point[1];
+        dummy();
+        p[0] = p1;
+        dummy();
+        p[0].x = x;
+        p[0].y = 3 * x + y;
+        return p[0].x * p[0].y;
+    }
+
+    int test0_1_5(int y) {
+        int x = 3;
+        Point p1 = new Point();
+        dummy();
+        Point p[] = new Point[1];
+        dummy();
+        p[0] = null;
+        dummy();
+        p[0] = p1;
+        dummy();
+        p[0].x = x;
+        p[0].y = 3 * x + y;
+        return p[0].x * p[0].y;
+    }
+
+    int test0_1_6(int y) {
+        int x = 3;
+        Point p1 = new Point();
+        dummy();
+        Point p2 = new Point();
+        dummy();
+        Point p[] = new Point[1];
+        p[0] = p1;
+        dummy();
+        p[0] = p2;
+        dummy();
+        p[0].x = x;
+        p[0].y = 3 * x + y;
+        return p[0].x * p[0].y;
+    }
+
+    int test1_0_0(int y) {
+        Point p = new Point();
+        if ((y & 1) == 1) {
+            p = new Point();
+        }
+        int x = 3;
+        p.x = x;
+        p.y = 3 * x + y;
+        dummy();
+        return p.x * p.y;
+    }
+
+    int test1_0_1(int y) {
+        Point p = null;
+        if ((y & 1) == 1) {
+            p = new Point();
+        }
+        int x = 3;
+        if (p == null)
+            return (3 * x + y) * x;
+        p.x = x;
+        p.y = 3 * x + y;
+        dummy();
+        return p.x * p.y;
+    }
+
+    int test1_0_2(int y) {
+        Point p[] = new Point[1];
+        if ((y & 1) == 1) {
+            p[0] = new Point();
+        }
+        int x = 3;
+        if (p[0] == null)
+            return (3 * x + y) * x;
+        p[0].x = x;
+        p[0].y = 3 * x + y;
+        dummy();
+        return p[0].x * p[0].y;
+    }
+
+    int test1_0_3(int y) {
+        Point p[] = new Point[1];
+        p[0] = null;
+        if ((y & 1) == 1) {
+            p[0] = new Point();
+        }
+        int x = 3;
+        if (p[0] == null)
+            return (3 * x + y) * x;
+        p[0].x = x;
+        p[0].y = 3 * x + y;
+        dummy();
+        return p[0].x * p[0].y;
+    }
+
+    int test1_0_4(int y) {
+        Point p[] = new Point[1];
+        p[0] = new Point();
+        if ((y & 1) == 1) {
+            p[0] = new Point();
+        }
+        int x = 3;
+        if (p[0] == null)
+            return (3 * x + y) * x;
+        p[0].x = x;
+        p[0].y = 3 * x + y;
+        dummy();
+        return p[0].x * p[0].y;
+    }
+
+    int test1_0_5(int y) {
+        Point p[] = new Point[1];
+        if ((y & 1) == 1) {
+            p[0] = new Point();
+        } else {
+            p[0] = null;
+        }
+        int x = 3;
+        if (p[0] == null)
+            return (3 * x + y) * x;
+        p[0].x = x;
+        p[0].y = 3 * x + y;
+        dummy();
+        return p[0].x * p[0].y;
+    }
+
+    int test1_0_6(int y) {
+        Point p[] = new Point[1];
+        if ((y & 1) == 1) {
+            p[0] = new Point();
+        } else {
+            p[0] = new Point();
+        }
+        int x = 3;
+        if (p[0] == null)
+            return (3 * x + y) * x;
+        p[0].x = x;
+        p[0].y = 3 * x + y;
+        dummy();
+        return p[0].x * p[0].y;
+    }
+
+    int test1_1_0(int y) {
+        Point p = new Point();
+        if ((y & 1) == 1) {
+            dummy();
+            p = new Point();
+            dummy();
+        }
+        int x = 3;
+        p.x = x;
+        p.y = 3 * x + y;
+        dummy();
+        return p.x * p.y;
+    }
+
+    int test1_1_1(int y) {
+        Point p = null;
+        if ((y & 1) == 1) {
+            dummy();
+            p = new Point();
+            dummy();
+        }
+        int x = 3;
+        if (p == null)
+            return (3 * x + y) * x;
+        p.x = x;
+        p.y = 3 * x + y;
+        dummy();
+        return p.x * p.y;
+    }
+
+    int test1_1_2(int y) {
+        Point p[] = new Point[1];
+        if ((y & 1) == 1) {
+            dummy();
+            p[0] = new Point();
+            dummy();
+        }
+        int x = 3;
+        if (p[0] == null)
+            return (3 * x + y) * x;
+        p[0].x = x;
+        p[0].y = 3 * x + y;
+        dummy();
+        return p[0].x * p[0].y;
+    }
+
+    int test1_1_3(int y) {
+        Point p[] = new Point[1];
+        dummy();
+        p[0] = null;
+        if ((y & 1) == 1) {
+            dummy();
+            p[0] = new Point();
+            dummy();
+        }
+        int x = 3;
+        if (p[0] == null)
+            return (3 * x + y) * x;
+        p[0].x = x;
+        p[0].y = 3 * x + y;
+        dummy();
+        return p[0].x * p[0].y;
+    }
+
+    int test1_1_4(int y) {
+        Point p[] = new Point[1];
+        dummy();
+        p[0] = new Point();
+        if ((y & 1) == 1) {
+            dummy();
+            p[0] = new Point();
+            dummy();
+        }
+        int x = 3;
+        if (p[0] == null)
+            return (3 * x + y) * x;
+        p[0].x = x;
+        p[0].y = 3 * x + y;
+        dummy();
+        return p[0].x * p[0].y;
+    }
+
+    int test1_1_5(int y) {
+        Point p[] = new Point[1];
+        if ((y & 1) == 1) {
+            dummy();
+            p[0] = new Point();
+            dummy();
+        } else {
+            dummy();
+            p[0] = null;
+            dummy();
+        }
+        int x = 3;
+        if (p[0] == null)
+            return (3 * x + y) * x;
+        p[0].x = x;
+        p[0].y = 3 * x + y;
+        dummy();
+        return p[0].x * p[0].y;
+    }
+
+    int test1_1_6(int y) {
+        Point p[] = new Point[1];
+        if ((y & 1) == 1) {
+            dummy();
+            p[0] = new Point();
+            dummy();
+        } else {
+            dummy();
+            p[0] = new Point();
+            dummy();
+        }
+        int x = 3;
+        if (p[0] == null)
+            return (3 * x + y) * x;
+        p[0].x = x;
+        p[0].y = 3 * x + y;
+        dummy();
+        return p[0].x * p[0].y;
+    }
+
+    int test1_2_0(int y) {
+        Point p1 = new Point();
+        dummy();
+        Point p = new Point();
+        if ((y & 1) == 1) {
+            dummy();
+            p = p1;
+            dummy();
+        }
+        int x = 3;
+        p.x = x;
+        p.y = 3 * x + y;
+        dummy();
+        return p.x * p.y;
+    }
+
+    int test1_2_1(int y) {
+        Point p1 = new Point();
+        dummy();
+        Point p = null;
+        if ((y & 1) == 1) {
+            dummy();
+            p = p1;
+            dummy();
+        }
+        int x = 3;
+        if (p == null)
+            return (3 * x + y) * x;
+        p.x = x;
+        p.y = 3 * x + y;
+        dummy();
+        return p.x * p.y;
+    }
+
+    int test1_2_2(int y) {
+        Point p1 = new Point();
+        dummy();
+        Point p[] = new Point[1];
+        if ((y & 1) == 1) {
+            dummy();
+            p[0] = p1;
+            dummy();
+        }
+        int x = 3;
+        if (p[0] == null)
+            return (3 * x + y) * x;
+        p[0].x = x;
+        p[0].y = 3 * x + y;
+        dummy();
+        return p[0].x * p[0].y;
+    }
+
+    int test1_2_3(int y) {
+        Point p1 = new Point();
+        dummy();
+        Point p[] = new Point[1];
+        dummy();
+        p[0] = null;
+        if ((y & 1) == 1) {
+            dummy();
+            p[0] = p1;
+            dummy();
+        }
+        int x = 3;
+        if (p[0] == null)
+            return (3 * x + y) * x;
+        p[0].x = x;
+        p[0].y = 3 * x + y;
+        dummy();
+        return p[0].x * p[0].y;
+    }
+
+    int test1_2_4(int y) {
+        Point p1 = new Point();
+        dummy();
+        Point p2 = new Point();
+        dummy();
+        Point p[] = new Point[1];
+        dummy();
+        p[0] = p1;
+        if ((y & 1) == 1) {
+            dummy();
+            p[0] = p2;
+            dummy();
+        }
+        int x = 3;
+        if (p[0] == null)
+            return (3 * x + y) * x;
+        p[0].x = x;
+        p[0].y = 3 * x + y;
+        dummy();
+        return p[0].x * p[0].y;
+    }
+
+    int test1_2_5(int y) {
+        Point p1 = new Point();
+        dummy();
+        Point p[] = new Point[1];
+        if ((y & 1) == 1) {
+            dummy();
+            p[0] = p1;
+            dummy();
+        } else {
+            dummy();
+            p[0] = null;
+            dummy();
+        }
+        int x = 3;
+        if (p[0] == null)
+            return (3 * x + y) * x;
+        p[0].x = x;
+        p[0].y = 3 * x + y;
+        dummy();
+        return p[0].x * p[0].y;
+    }
+
+    int test1_2_6(int y) {
+        Point p1 = new Point();
+        dummy();
+        Point p2 = new Point();
+        dummy();
+        Point p[] = new Point[1];
+        if ((y & 1) == 1) {
+            dummy();
+            p[0] = p1;
+            dummy();
+        } else {
+            dummy();
+            p[0] = p2;
+            dummy();
+        }
+        int x = 3;
+        if (p[0] == null)
+            return (3 * x + y) * x;
+        p[0].x = x;
+        p[0].y = 3 * x + y;
+        dummy();
+        return p[0].x * p[0].y;
+    }
+
+    int test2_0_0(int y) {
+        Point p = new Point();
+        int lim = (y & 3);
+        for (int i = 0; i < lim; i++) {
+            p = new Point();
+        }
+        int x = 3;
+        p.x = x;
+        p.y = 3 * x + y;
+        dummy();
+        return p.x * p.y;
+    }
+
+    int test2_0_1(int y) {
+        Point p = null;
+        int lim = (y & 3);
+        for (int i = 0; i < lim; i++) {
+            p = new Point();
+        }
+        int x = 3;
+        if (p == null)
+            return (3 * x + y) * x;
+        p.x = x;
+        p.y = 3 * x + y;
+        dummy();
+        return p.x * p.y;
+    }
+
+    int test2_0_2(int y) {
+        Point p[] = new Point[3];
+        int lim = (y & 3);
+        for (int i = 0; i < lim; i++) {
+            p[i] = new Point();
+        }
+        int x = 3;
+        int j = (y & 1);
+        if (p[j] == null)
+            return (3 * x + y) * x;
+        p[j].x = x;
+        p[j].y = 3 * x + y;
+        dummy();
+        return p[j].x * p[0].y;
+    }
+
+    int test2_0_3(int y) {
+        Point p[] = new Point[3];
+        int j = (y & 1);
+        p[j] = null;
+        int lim = (y & 3);
+        for (int i = 0; i < lim; i++) {
+            p[i] = new Point();
+        }
+        int x = 3;
+        if (p[j] == null)
+            return (3 * x + y) * x;
+        p[j].x = x;
+        p[j].y = 3 * x + y;
+        dummy();
+        return p[j].x * p[0].y;
+    }
+
+    int test2_0_4(int y) {
+        Point p[] = new Point[3];
+        int j = (y & 1);
+        p[j] = new Point();
+        int lim = (y & 3);
+        for (int i = 0; i < lim; i++) {
+            p[i] = new Point();
+        }
+        int x = 3;
+        if (p[j] == null)
+            return (3 * x + y) * x;
+        p[j].x = x;
+        p[j].y = 3 * x + y;
+        dummy();
+        return p[j].x * p[0].y;
+    }
+
+    int test2_0_5(int y) {
+        Point p[] = new Point[3];
+        int lim = (y & 3);
+        for (int i = 0; i < lim; i++) {
+            p[i] = new Point();
+        }
+        for (int i = 0; i < lim; i++) {
+            p[i] = null;
+        }
+        int x = 3;
+        int j = (y & 1);
+        if (p[j] == null)
+            return (3 * x + y) * x;
+        p[j].x = x;
+        p[j].y = 3 * x + y;
+        dummy();
+        return p[j].x * p[0].y;
+    }
+
+    int test2_0_6(int y) {
+        Point p[] = new Point[3];
+        int lim = (y & 3);
+        for (int i = 0; i < lim; i++) {
+            p[i] = new Point();
+        }
+        for (int i = 0; i < lim; i++) {
+            p[i] = new Point();
+        }
+        int x = 3;
+        int j = (y & 1);
+        if (p[j] == null)
+            return (3 * x + y) * x;
+        p[j].x = x;
+        p[j].y = 3 * x + y;
+        dummy();
+        return p[j].x * p[0].y;
+    }
+
+    int test2_1_0(int y) {
+        Point p = new Point();
+        int lim = (y & 3);
+        for (int i = 0; i < lim; i++) {
+            dummy();
+            p = new Point();
+            dummy();
+        }
+        int x = 3;
+        p.x = x;
+        p.y = 3 * x + y;
+        dummy();
+        return p.x * p.y;
+    }
+
+    int test2_1_1(int y) {
+        Point p = null;
+        int lim = (y & 3);
+        for (int i = 0; i < lim; i++) {
+            dummy();
+            p = new Point();
+            dummy();
+        }
+        int x = 3;
+        if (p == null)
+            return (3 * x + y) * x;
+        p.x = x;
+        p.y = 3 * x + y;
+        dummy();
+        return p.x * p.y;
+    }
+
+    int test2_1_2(int y) {
+        Point p[] = new Point[3];
+        int lim = (y & 3);
+        for (int i = 0; i < lim; i++) {
+            dummy();
+            p[i] = new Point();
+            dummy();
+        }
+        int x = 3;
+        int j = (y & 1);
+        if (p[j] == null)
+            return (3 * x + y) * x;
+        p[j].x = x;
+        p[j].y = 3 * x + y;
+        dummy();
+        return p[j].x * p[0].y;
+    }
+
+    int test2_1_3(int y) {
+        Point p[] = new Point[3];
+        dummy();
+        int j = (y & 1);
+        p[j] = null;
+        int lim = (y & 3);
+        for (int i = 0; i < lim; i++) {
+            dummy();
+            p[i] = new Point();
+            dummy();
+        }
+        int x = 3;
+        if (p[j] == null)
+            return (3 * x + y) * x;
+        p[j].x = x;
+        p[j].y = 3 * x + y;
+        dummy();
+        return p[j].x * p[0].y;
+    }
+
+    int test2_1_4(int y) {
+        Point p[] = new Point[3];
+        dummy();
+        int j = (y & 1);
+        p[j] = new Point();
+        int lim = (y & 3);
+        for (int i = 0; i < lim; i++) {
+            dummy();
+            p[i] = new Point();
+            dummy();
+        }
+        int x = 3;
+        if (p[j] == null)
+            return (3 * x + y) * x;
+        p[j].x = x;
+        p[j].y = 3 * x + y;
+        dummy();
+        return p[j].x * p[0].y;
+    }
+
+    int test2_1_5(int y) {
+        Point p[] = new Point[3];
+        int lim = (y & 3);
+        for (int i = 0; i < lim; i++) {
+            dummy();
+            p[i] = new Point();
+            dummy();
+        }
+        for (int i = 0; i < lim; i++) {
+            dummy();
+            p[i] = null;
+            dummy();
+        }
+        int x = 3;
+        int j = (y & 1);
+        if (p[j] == null)
+            return (3 * x + y) * x;
+        p[j].x = x;
+        p[j].y = 3 * x + y;
+        dummy();
+        return p[j].x * p[0].y;
+    }
+
+    int test2_1_6(int y) {
+        Point p[] = new Point[3];
+        int lim = (y & 3);
+        for (int i = 0; i < lim; i++) {
+            dummy();
+            p[i] = new Point();
+            dummy();
+        }
+        for (int i = 0; i < lim; i++) {
+            dummy();
+            p[i] = new Point();
+            dummy();
+        }
+        int x = 3;
+        int j = (y & 1);
+        if (p[j] == null)
+            return (3 * x + y) * x;
+        p[j].x = x;
+        p[j].y = 3 * x + y;
+        dummy();
+        return p[j].x * p[0].y;
+    }
+
+    int test2_2_0(int y) {
+        Point p1 = new Point();
+        dummy();
+        Point p = new Point();
+        int lim = (y & 3);
+        for (int i = 0; i < lim; i++) {
+            dummy();
+            p = p1;
+            dummy();
+        }
+        int x = 3;
+        p.x = x;
+        p.y = 3 * x + y;
+        dummy();
+        return p.x * p.y;
+    }
+
+    int test2_2_1(int y) {
+        Point p1 = new Point();
+        dummy();
+        Point p = null;
+        int lim = (y & 3);
+        for (int i = 0; i < lim; i++) {
+            dummy();
+            p = p1;
+            dummy();
+        }
+        int x = 3;
+        if (p == null)
+            return (3 * x + y) * x;
+        p.x = x;
+        p.y = 3 * x + y;
+        dummy();
+        return p.x * p.y;
+    }
+
+    int test2_2_2(int y) {
+        Point p1 = new Point();
+        dummy();
+        Point p[] = new Point[3];
+        int lim = (y & 3);
+        for (int i = 0; i < lim; i++) {
+            dummy();
+            p[i] = p1;
+            dummy();
+        }
+        int x = 3;
+        int j = (y & 1);
+        if (p[j] == null)
+            return (3 * x + y) * x;
+        p[j].x = x;
+        p[j].y = 3 * x + y;
+        dummy();
+        return p[j].x * p[0].y;
+    }
+
+    int test2_2_3(int y) {
+        Point p1 = new Point();
+        dummy();
+        Point p[] = new Point[3];
+        dummy();
+        int j = (y & 1);
+        p[j] = null;
+        int lim = (y & 3);
+        for (int i = 0; i < lim; i++) {
+            dummy();
+            p[i] = p1;
+            dummy();
+        }
+        int x = 3;
+        if (p[j] == null)
+            return (3 * x + y) * x;
+        p[j].x = x;
+        p[j].y = 3 * x + y;
+        dummy();
+        return p[j].x * p[0].y;
+    }
+
+    int test2_2_4(int y) {
+        Point p1 = new Point();
+        dummy();
+        Point p2 = new Point();
+        dummy();
+        Point p[] = new Point[3];
+        dummy();
+        int j = (y & 1);
+        p[j] = p1;
+        int lim = (y & 3);
+        for (int i = 0; i < lim; i++) {
+            dummy();
+            p[i] = p2;
+            dummy();
+        }
+        int x = 3;
+        if (p[j] == null)
+            return (3 * x + y) * x;
+        p[j].x = x;
+        p[j].y = 3 * x + y;
+        dummy();
+        return p[j].x * p[0].y;
+    }
+
+    int test2_2_5(int y) {
+        Point p1 = new Point();
+        dummy();
+        Point p[] = new Point[3];
+        int lim = (y & 3);
+        for (int i = 0; i < lim; i++) {
+            dummy();
+            p[i] = p1;
+            dummy();
+        }
+        for (int i = 0; i < lim; i++) {
+            dummy();
+            p[i] = null;
+            dummy();
+        }
+        int x = 3;
+        int j = (y & 1);
+        if (p[j] == null)
+            return (3 * x + y) * x;
+        p[j].x = x;
+        p[j].y = 3 * x + y;
+        dummy();
+        return p[j].x * p[0].y;
+    }
+
+    int test2_2_6(int y) {
+        Point p1 = new Point();
+        dummy();
+        Point p2 = new Point();
+        dummy();
+        Point p[] = new Point[3];
+        int lim = (y & 3);
+        for (int i = 0; i < lim; i++) {
+            dummy();
+            p[i] = p1;
+            dummy();
+        }
+        for (int i = 0; i < lim; i++) {
+            dummy();
+            p[i] = p2;
+            dummy();
+        }
+        int x = 3;
+        int j = (y & 1);
+        if (p[j] == null)
+            return (3 * x + y) * x;
+        p[j].x = x;
+        p[j].y = 3 * x + y;
+        dummy();
+        return p[j].x * p[0].y;
+    }
+
+    public static void main(String args[]) {
+        Test6726999 tsr = new Test6726999();
+        Point p = new Point();
+        Point ptmp = p;
+        Class cls = Point.class;
+        int y = 0;
+        for (int i = 0; i < 10000; i++) {
+            y = tsr.test0_0_0(y);
+            y = tsr.test0_0_0(y);
+            y = tsr.test0_0_1(y);
+            y = tsr.test0_0_1(y);
+            y = tsr.test0_0_2(y);
+            y = tsr.test0_0_2(y);
+            y = tsr.test0_0_3(y);
+            y = tsr.test0_0_3(y);
+            y = tsr.test0_0_4(y);
+            y = tsr.test0_0_4(y);
+            y = tsr.test0_0_5(y);
+            y = tsr.test0_0_5(y);
+            y = tsr.test0_0_6(y);
+            y = tsr.test0_0_6(y);
+
+            y = tsr.test0_1_3(y);
+            y = tsr.test0_1_3(y);
+            y = tsr.test0_1_4(y);
+            y = tsr.test0_1_4(y);
+            y = tsr.test0_1_5(y);
+            y = tsr.test0_1_5(y);
+            y = tsr.test0_1_6(y);
+            y = tsr.test0_1_6(y);
+
+            y = tsr.test1_0_0(y & ~1);
+            y = tsr.test1_0_1(y & ~1);
+            y = tsr.test1_0_2(y & ~1);
+            y = tsr.test1_0_3(y & ~1);
+            y = tsr.test1_0_4(y & ~1);
+            y = tsr.test1_0_5(y & ~1);
+            y = tsr.test1_0_6(y & ~1);
+            y = tsr.test1_0_0((y & ~1) + 1);
+            y = tsr.test1_0_1((y & ~1) + 1);
+            y = tsr.test1_0_2((y & ~1) + 1);
+            y = tsr.test1_0_3((y & ~1) + 1);
+            y = tsr.test1_0_4((y & ~1) + 1);
+            y = tsr.test1_0_5((y & ~1) + 1);
+            y = tsr.test1_0_6((y & ~1) + 1);
+
+            y = tsr.test1_1_0(y & ~1);
+            y = tsr.test1_1_1(y & ~1);
+            y = tsr.test1_1_2(y & ~1);
+            y = tsr.test1_1_3(y & ~1);
+            y = tsr.test1_1_4(y & ~1);
+            y = tsr.test1_1_5(y & ~1);
+            y = tsr.test1_1_6(y & ~1);
+            y = tsr.test1_1_0((y & ~1) + 1);
+            y = tsr.test1_1_1((y & ~1) + 1);
+            y = tsr.test1_1_2((y & ~1) + 1);
+            y = tsr.test1_1_3((y & ~1) + 1);
+            y = tsr.test1_1_4((y & ~1) + 1);
+            y = tsr.test1_1_5((y & ~1) + 1);
+            y = tsr.test1_1_6((y & ~1) + 1);
+
+            y = tsr.test1_2_0(y & ~1);
+            y = tsr.test1_2_1(y & ~1);
+            y = tsr.test1_2_2(y & ~1);
+            y = tsr.test1_2_3(y & ~1);
+            y = tsr.test1_2_4(y & ~1);
+            y = tsr.test1_2_5(y & ~1);
+            y = tsr.test1_2_6(y & ~1);
+            y = tsr.test1_2_0((y & ~1) + 1);
+            y = tsr.test1_2_1((y & ~1) + 1);
+            y = tsr.test1_2_2((y & ~1) + 1);
+            y = tsr.test1_2_3((y & ~1) + 1);
+            y = tsr.test1_2_4((y & ~1) + 1);
+            y = tsr.test1_2_5((y & ~1) + 1);
+            y = tsr.test1_2_6((y & ~1) + 1);
+
+            y = tsr.test2_0_0(y & ~3);
+            y = tsr.test2_0_1(y & ~3);
+            y = tsr.test2_0_2(y & ~3);
+            y = tsr.test2_0_3(y & ~3);
+            y = tsr.test2_0_4(y & ~3);
+            y = tsr.test2_0_5(y & ~3);
+            y = tsr.test2_0_6(y & ~3);
+            y = tsr.test2_0_0((y & ~3) + 3);
+            y = tsr.test2_0_1((y & ~3) + 3);
+            y = tsr.test2_0_2((y & ~3) + 3);
+            y = tsr.test2_0_3((y & ~3) + 3);
+            y = tsr.test2_0_4((y & ~3) + 3);
+            y = tsr.test2_0_5((y & ~3) + 3);
+            y = tsr.test2_0_6((y & ~3) + 3);
+
+            y = tsr.test2_1_0(y & ~3);
+            y = tsr.test2_1_1(y & ~3);
+            y = tsr.test2_1_2(y & ~3);
+            y = tsr.test2_1_3(y & ~3);
+            y = tsr.test2_1_4(y & ~3);
+            y = tsr.test2_1_5(y & ~3);
+            y = tsr.test2_1_6(y & ~3);
+            y = tsr.test2_1_0((y & ~3) + 3);
+            y = tsr.test2_1_1((y & ~3) + 3);
+            y = tsr.test2_1_2((y & ~3) + 3);
+            y = tsr.test2_1_3((y & ~3) + 3);
+            y = tsr.test2_1_4((y & ~3) + 3);
+            y = tsr.test2_1_5((y & ~3) + 3);
+            y = tsr.test2_1_6((y & ~3) + 3);
+
+            y = tsr.test2_2_0(y & ~3);
+            y = tsr.test2_2_1(y & ~3);
+            y = tsr.test2_2_2(y & ~3);
+            y = tsr.test2_2_3(y & ~3);
+            y = tsr.test2_2_4(y & ~3);
+            y = tsr.test2_2_5(y & ~3);
+            y = tsr.test2_2_6(y & ~3);
+            y = tsr.test2_2_0((y & ~3) + 3);
+            y = tsr.test2_2_1((y & ~3) + 3);
+            y = tsr.test2_2_2((y & ~3) + 3);
+            y = tsr.test2_2_3((y & ~3) + 3);
+            y = tsr.test2_2_4((y & ~3) + 3);
+            y = tsr.test2_2_5((y & ~3) + 3);
+            y = tsr.test2_2_6((y & ~3) + 3);
+
+        }
+        for (int i = 0; i < 10000; i++) {
+            y = tsr.test0_0_0(y);
+            y = tsr.test0_0_0(y);
+            y = tsr.test0_0_1(y);
+            y = tsr.test0_0_1(y);
+            y = tsr.test0_0_2(y);
+            y = tsr.test0_0_2(y);
+            y = tsr.test0_0_3(y);
+            y = tsr.test0_0_3(y);
+            y = tsr.test0_0_4(y);
+            y = tsr.test0_0_4(y);
+            y = tsr.test0_0_5(y);
+            y = tsr.test0_0_5(y);
+            y = tsr.test0_0_6(y);
+            y = tsr.test0_0_6(y);
+
+            y = tsr.test0_1_3(y);
+            y = tsr.test0_1_3(y);
+            y = tsr.test0_1_4(y);
+            y = tsr.test0_1_4(y);
+            y = tsr.test0_1_5(y);
+            y = tsr.test0_1_5(y);
+            y = tsr.test0_1_6(y);
+            y = tsr.test0_1_6(y);
+
+            y = tsr.test1_0_0(y & ~1);
+            y = tsr.test1_0_1(y & ~1);
+            y = tsr.test1_0_2(y & ~1);
+            y = tsr.test1_0_3(y & ~1);
+            y = tsr.test1_0_4(y & ~1);
+            y = tsr.test1_0_5(y & ~1);
+            y = tsr.test1_0_6(y & ~1);
+            y = tsr.test1_0_0((y & ~1) + 1);
+            y = tsr.test1_0_1((y & ~1) + 1);
+            y = tsr.test1_0_2((y & ~1) + 1);
+            y = tsr.test1_0_3((y & ~1) + 1);
+            y = tsr.test1_0_4((y & ~1) + 1);
+            y = tsr.test1_0_5((y & ~1) + 1);
+            y = tsr.test1_0_6((y & ~1) + 1);
+
+            y = tsr.test1_1_0(y & ~1);
+            y = tsr.test1_1_1(y & ~1);
+            y = tsr.test1_1_2(y & ~1);
+            y = tsr.test1_1_3(y & ~1);
+            y = tsr.test1_1_4(y & ~1);
+            y = tsr.test1_1_5(y & ~1);
+            y = tsr.test1_1_6(y & ~1);
+            y = tsr.test1_1_0((y & ~1) + 1);
+            y = tsr.test1_1_1((y & ~1) + 1);
+            y = tsr.test1_1_2((y & ~1) + 1);
+            y = tsr.test1_1_3((y & ~1) + 1);
+            y = tsr.test1_1_4((y & ~1) + 1);
+            y = tsr.test1_1_5((y & ~1) + 1);
+            y = tsr.test1_1_6((y & ~1) + 1);
+
+            y = tsr.test1_2_0(y & ~1);
+            y = tsr.test1_2_1(y & ~1);
+            y = tsr.test1_2_2(y & ~1);
+            y = tsr.test1_2_3(y & ~1);
+            y = tsr.test1_2_4(y & ~1);
+            y = tsr.test1_2_5(y & ~1);
+            y = tsr.test1_2_6(y & ~1);
+            y = tsr.test1_2_0((y & ~1) + 1);
+            y = tsr.test1_2_1((y & ~1) + 1);
+            y = tsr.test1_2_2((y & ~1) + 1);
+            y = tsr.test1_2_3((y & ~1) + 1);
+            y = tsr.test1_2_4((y & ~1) + 1);
+            y = tsr.test1_2_5((y & ~1) + 1);
+            y = tsr.test1_2_6((y & ~1) + 1);
+
+            y = tsr.test2_0_0(y & ~3);
+            y = tsr.test2_0_1(y & ~3);
+            y = tsr.test2_0_2(y & ~3);
+            y = tsr.test2_0_3(y & ~3);
+            y = tsr.test2_0_4(y & ~3);
+            y = tsr.test2_0_5(y & ~3);
+            y = tsr.test2_0_6(y & ~3);
+            y = tsr.test2_0_0((y & ~3) + 3);
+            y = tsr.test2_0_1((y & ~3) + 3);
+            y = tsr.test2_0_2((y & ~3) + 3);
+            y = tsr.test2_0_3((y & ~3) + 3);
+            y = tsr.test2_0_4((y & ~3) + 3);
+            y = tsr.test2_0_5((y & ~3) + 3);
+            y = tsr.test2_0_6((y & ~3) + 3);
+
+            y = tsr.test2_1_0(y & ~3);
+            y = tsr.test2_1_1(y & ~3);
+            y = tsr.test2_1_2(y & ~3);
+            y = tsr.test2_1_3(y & ~3);
+            y = tsr.test2_1_4(y & ~3);
+            y = tsr.test2_1_5(y & ~3);
+            y = tsr.test2_1_6(y & ~3);
+            y = tsr.test2_1_0((y & ~3) + 3);
+            y = tsr.test2_1_1((y & ~3) + 3);
+            y = tsr.test2_1_2((y & ~3) + 3);
+            y = tsr.test2_1_3((y & ~3) + 3);
+            y = tsr.test2_1_4((y & ~3) + 3);
+            y = tsr.test2_1_5((y & ~3) + 3);
+            y = tsr.test2_1_6((y & ~3) + 3);
+
+            y = tsr.test2_2_0(y & ~3);
+            y = tsr.test2_2_1(y & ~3);
+            y = tsr.test2_2_2(y & ~3);
+            y = tsr.test2_2_3(y & ~3);
+            y = tsr.test2_2_4(y & ~3);
+            y = tsr.test2_2_5(y & ~3);
+            y = tsr.test2_2_6(y & ~3);
+            y = tsr.test2_2_0((y & ~3) + 3);
+            y = tsr.test2_2_1((y & ~3) + 3);
+            y = tsr.test2_2_2((y & ~3) + 3);
+            y = tsr.test2_2_3((y & ~3) + 3);
+            y = tsr.test2_2_4((y & ~3) + 3);
+            y = tsr.test2_2_5((y & ~3) + 3);
+            y = tsr.test2_2_6((y & ~3) + 3);
+
+        }
+        for (int i = 0; i < 10000; i++) {
+            y = tsr.test0_0_0(y);
+            y = tsr.test0_0_0(y);
+            y = tsr.test0_0_1(y);
+            y = tsr.test0_0_1(y);
+            y = tsr.test0_0_2(y);
+            y = tsr.test0_0_2(y);
+            y = tsr.test0_0_3(y);
+            y = tsr.test0_0_3(y);
+            y = tsr.test0_0_4(y);
+            y = tsr.test0_0_4(y);
+            y = tsr.test0_0_5(y);
+            y = tsr.test0_0_5(y);
+            y = tsr.test0_0_6(y);
+            y = tsr.test0_0_6(y);
+
+            y = tsr.test0_1_3(y);
+            y = tsr.test0_1_3(y);
+            y = tsr.test0_1_4(y);
+            y = tsr.test0_1_4(y);
+            y = tsr.test0_1_5(y);
+            y = tsr.test0_1_5(y);
+            y = tsr.test0_1_6(y);
+            y = tsr.test0_1_6(y);
+
+            y = tsr.test1_0_0(y & ~1);
+            y = tsr.test1_0_1(y & ~1);
+            y = tsr.test1_0_2(y & ~1);
+            y = tsr.test1_0_3(y & ~1);
+            y = tsr.test1_0_4(y & ~1);
+            y = tsr.test1_0_5(y & ~1);
+            y = tsr.test1_0_6(y & ~1);
+            y = tsr.test1_0_0((y & ~1) + 1);
+            y = tsr.test1_0_1((y & ~1) + 1);
+            y = tsr.test1_0_2((y & ~1) + 1);
+            y = tsr.test1_0_3((y & ~1) + 1);
+            y = tsr.test1_0_4((y & ~1) + 1);
+            y = tsr.test1_0_5((y & ~1) + 1);
+            y = tsr.test1_0_6((y & ~1) + 1);
+
+            y = tsr.test1_1_0(y & ~1);
+            y = tsr.test1_1_1(y & ~1);
+            y = tsr.test1_1_2(y & ~1);
+            y = tsr.test1_1_3(y & ~1);
+            y = tsr.test1_1_4(y & ~1);
+            y = tsr.test1_1_5(y & ~1);
+            y = tsr.test1_1_6(y & ~1);
+            y = tsr.test1_1_0((y & ~1) + 1);
+            y = tsr.test1_1_1((y & ~1) + 1);
+            y = tsr.test1_1_2((y & ~1) + 1);
+            y = tsr.test1_1_3((y & ~1) + 1);
+            y = tsr.test1_1_4((y & ~1) + 1);
+            y = tsr.test1_1_5((y & ~1) + 1);
+            y = tsr.test1_1_6((y & ~1) + 1);
+
+            y = tsr.test1_2_0(y & ~1);
+            y = tsr.test1_2_1(y & ~1);
+            y = tsr.test1_2_2(y & ~1);
+            y = tsr.test1_2_3(y & ~1);
+            y = tsr.test1_2_4(y & ~1);
+            y = tsr.test1_2_5(y & ~1);
+            y = tsr.test1_2_6(y & ~1);
+            y = tsr.test1_2_0((y & ~1) + 1);
+            y = tsr.test1_2_1((y & ~1) + 1);
+            y = tsr.test1_2_2((y & ~1) + 1);
+            y = tsr.test1_2_3((y & ~1) + 1);
+            y = tsr.test1_2_4((y & ~1) + 1);
+            y = tsr.test1_2_5((y & ~1) + 1);
+            y = tsr.test1_2_6((y & ~1) + 1);
+
+            y = tsr.test2_0_0(y & ~3);
+            y = tsr.test2_0_1(y & ~3);
+            y = tsr.test2_0_2(y & ~3);
+            y = tsr.test2_0_3(y & ~3);
+            y = tsr.test2_0_4(y & ~3);
+            y = tsr.test2_0_5(y & ~3);
+            y = tsr.test2_0_6(y & ~3);
+            y = tsr.test2_0_0((y & ~3) + 3);
+            y = tsr.test2_0_1((y & ~3) + 3);
+            y = tsr.test2_0_2((y & ~3) + 3);
+            y = tsr.test2_0_3((y & ~3) + 3);
+            y = tsr.test2_0_4((y & ~3) + 3);
+            y = tsr.test2_0_5((y & ~3) + 3);
+            y = tsr.test2_0_6((y & ~3) + 3);
+
+            y = tsr.test2_1_0(y & ~3);
+            y = tsr.test2_1_1(y & ~3);
+            y = tsr.test2_1_2(y & ~3);
+            y = tsr.test2_1_3(y & ~3);
+            y = tsr.test2_1_4(y & ~3);
+            y = tsr.test2_1_5(y & ~3);
+            y = tsr.test2_1_6(y & ~3);
+            y = tsr.test2_1_0((y & ~3) + 3);
+            y = tsr.test2_1_1((y & ~3) + 3);
+            y = tsr.test2_1_2((y & ~3) + 3);
+            y = tsr.test2_1_3((y & ~3) + 3);
+            y = tsr.test2_1_4((y & ~3) + 3);
+            y = tsr.test2_1_5((y & ~3) + 3);
+            y = tsr.test2_1_6((y & ~3) + 3);
+
+            y = tsr.test2_2_0(y & ~3);
+            y = tsr.test2_2_1(y & ~3);
+            y = tsr.test2_2_2(y & ~3);
+            y = tsr.test2_2_3(y & ~3);
+            y = tsr.test2_2_4(y & ~3);
+            y = tsr.test2_2_5(y & ~3);
+            y = tsr.test2_2_6(y & ~3);
+            y = tsr.test2_2_0((y & ~3) + 3);
+            y = tsr.test2_2_1((y & ~3) + 3);
+            y = tsr.test2_2_2((y & ~3) + 3);
+            y = tsr.test2_2_3((y & ~3) + 3);
+            y = tsr.test2_2_4((y & ~3) + 3);
+            y = tsr.test2_2_5((y & ~3) + 3);
+            y = tsr.test2_2_6((y & ~3) + 3);
+
+        }
+
+        int z = 0;
+        y = tsr.test0_0_0(0);
+        System.out.println("After 'test0_0_0' y=" + y);
+        y = tsr.test0_0_1(0);
+        System.out.println("After 'test0_0_1' y=" + y);
+        y = tsr.test0_0_2(0);
+        System.out.println("After 'test0_0_2' y=" + y);
+        y = tsr.test0_0_3(0);
+        System.out.println("After 'test0_0_3' y=" + y);
+        y = tsr.test0_0_4(0);
+        System.out.println("After 'test0_0_4' y=" + y);
+        y = tsr.test0_0_5(0);
+        System.out.println("After 'test0_0_5' y=" + y);
+        y = tsr.test0_0_6(0);
+        System.out.println("After 'test0_0_6' y=" + y);
+        y = tsr.test0_1_3(0);
+        System.out.println("After 'test0_1_3' y=" + y);
+        y = tsr.test0_1_4(0);
+        System.out.println("After 'test0_1_4' y=" + y);
+        y = tsr.test0_1_5(0);
+        System.out.println("After 'test0_1_5' y=" + y);
+        y = tsr.test0_1_6(0);
+        System.out.println("After 'test0_1_6' y=" + y);
+
+        y = tsr.test1_0_0(0);
+        System.out.println("After 'test1_0_0' y=" + y);
+        y = tsr.test1_0_1(0);
+        System.out.println("After 'test1_0_1' y=" + y);
+        y = tsr.test1_0_2(0);
+        System.out.println("After 'test1_0_2' y=" + y);
+        y = tsr.test1_0_3(0);
+        System.out.println("After 'test1_0_3' y=" + y);
+        y = tsr.test1_0_4(0);
+        System.out.println("After 'test1_0_4' y=" + y);
+        y = tsr.test1_0_5(0);
+        System.out.println("After 'test1_0_5' y=" + y);
+        y = tsr.test1_0_6(0);
+        System.out.println("After 'test1_0_6' y=" + y);
+
+        y = tsr.test1_1_0(0);
+        System.out.println("After 'test1_1_0' y=" + y);
+        y = tsr.test1_1_1(0);
+        System.out.println("After 'test1_1_1' y=" + y);
+        y = tsr.test1_1_2(0);
+        System.out.println("After 'test1_1_2' y=" + y);
+        y = tsr.test1_1_3(0);
+        System.out.println("After 'test1_1_3' y=" + y);
+        y = tsr.test1_1_4(0);
+        System.out.println("After 'test1_1_4' y=" + y);
+        y = tsr.test1_1_5(0);
+        System.out.println("After 'test1_1_5' y=" + y);
+        y = tsr.test1_1_6(0);
+        System.out.println("After 'test1_1_6' y=" + y);
+
+        y = tsr.test1_2_0(0);
+        System.out.println("After 'test1_2_0' y=" + y);
+        y = tsr.test1_2_1(0);
+        System.out.println("After 'test1_2_1' y=" + y);
+        y = tsr.test1_2_2(0);
+        System.out.println("After 'test1_2_2' y=" + y);
+        y = tsr.test1_2_3(0);
+        System.out.println("After 'test1_2_3' y=" + y);
+        y = tsr.test1_2_4(0);
+        System.out.println("After 'test1_2_4' y=" + y);
+        y = tsr.test1_2_5(0);
+        System.out.println("After 'test1_2_5' y=" + y);
+        y = tsr.test1_2_6(0);
+        System.out.println("After 'test1_2_6' y=" + y);
+
+        y = tsr.test2_0_0(0);
+        System.out.println("After 'test2_0_0' y=" + y);
+        y = tsr.test2_0_1(0);
+        System.out.println("After 'test2_0_1' y=" + y);
+        y = tsr.test2_0_2(0);
+        System.out.println("After 'test2_0_2' y=" + y);
+        y = tsr.test2_0_3(0);
+        System.out.println("After 'test2_0_3' y=" + y);
+        y = tsr.test2_0_4(0);
+        System.out.println("After 'test2_0_4' y=" + y);
+        y = tsr.test2_0_5(0);
+        System.out.println("After 'test2_0_5' y=" + y);
+        y = tsr.test2_0_6(0);
+        System.out.println("After 'test2_0_6' y=" + y);
+
+        y = tsr.test2_1_0(0);
+        System.out.println("After 'test2_1_0' y=" + y);
+        y = tsr.test2_1_1(0);
+        System.out.println("After 'test2_1_1' y=" + y);
+        y = tsr.test2_1_2(0);
+        System.out.println("After 'test2_1_2' y=" + y);
+        y = tsr.test2_1_3(0);
+        System.out.println("After 'test2_1_3' y=" + y);
+        y = tsr.test2_1_4(0);
+        System.out.println("After 'test2_1_4' y=" + y);
+        y = tsr.test2_1_5(0);
+        System.out.println("After 'test2_1_5' y=" + y);
+        y = tsr.test2_1_6(0);
+        System.out.println("After 'test2_1_6' y=" + y);
+
+        y = tsr.test2_2_0(0);
+        System.out.println("After 'test2_2_0' y=" + y);
+        y = tsr.test2_2_1(0);
+        System.out.println("After 'test2_2_1' y=" + y);
+        y = tsr.test2_2_2(0);
+        System.out.println("After 'test2_2_2' y=" + y);
+        y = tsr.test2_2_3(0);
+        System.out.println("After 'test2_2_3' y=" + y);
+        y = tsr.test2_2_4(0);
+        System.out.println("After 'test2_2_4' y=" + y);
+        y = tsr.test2_2_5(0);
+        System.out.println("After 'test2_2_5' y=" + y);
+        y = tsr.test2_2_6(0);
+        System.out.println("After 'test2_2_6' y=" + y);
+
+    }
+}
diff --git a/hotspot/test/compiler/escapeAnalysis/Test6775880.java b/hotspot/test/compiler/escapeAnalysis/Test6775880.java
new file mode 100644
index 0000000..31e0afa
--- /dev/null
+++ b/hotspot/test/compiler/escapeAnalysis/Test6775880.java
@@ -0,0 +1,71 @@
+/*
+ * Copyright (c) 2008, 2014, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ *
+ */
+
+/*
+ * @test
+ * @bug 6775880
+ * @summary EA +DeoptimizeALot: assert(mon_info->owner()->is_locked(),"object must be locked now")
+ *
+ * @run main/othervm -XX:+IgnoreUnrecognizedVMOptions -Xbatch -XX:+DoEscapeAnalysis -XX:+DeoptimizeALot
+ *    -XX:CompileCommand=exclude,java.lang.AbstractStringBuilder::append
+ *    compiler.escapeAnalysis.Test6775880
+ */
+
+package compiler.escapeAnalysis;
+
+public class Test6775880 {
+
+    int cnt;
+    int b[];
+    String s;
+
+    String test() {
+        String res = "";
+        for (int i = 0; i < cnt; i++) {
+            if (i != 0) {
+                res = res + ".";
+            }
+            res = res + b[i];
+        }
+        return res;
+    }
+
+    public static void main(String[] args) {
+        Test6775880 t = new Test6775880();
+        t.cnt = 3;
+        t.b = new int[3];
+        t.b[0] = 0;
+        t.b[1] = 1;
+        t.b[2] = 2;
+        int j = 0;
+        t.s = "";
+        for (int i = 0; i < 10001; i++) {
+            t.s = "c";
+            t.s = t.test();
+        }
+        System.out.println("After s=" + t.s);
+    }
+}
+
+
diff --git a/hotspot/test/compiler/escapeAnalysis/6895383/Test.java b/hotspot/test/compiler/escapeAnalysis/Test6895383.java
similarity index 86%
rename from hotspot/test/compiler/escapeAnalysis/6895383/Test.java
rename to hotspot/test/compiler/escapeAnalysis/Test6895383.java
index a1a20e9..24462a6 100644
--- a/hotspot/test/compiler/escapeAnalysis/6895383/Test.java
+++ b/hotspot/test/compiler/escapeAnalysis/Test6895383.java
@@ -27,15 +27,17 @@
  * @bug 6895383
  * @summary JCK test throws NPE for method compiled with Escape Analysis
  *
- * @run main/othervm -Xcomp Test
+ * @run main/othervm -Xcomp compiler.escapeAnalysis.Test6895383
  */
 
-import java.util.*;
-import java.util.concurrent.*;
+package compiler.escapeAnalysis;
 
-public class Test {
+import java.util.LinkedList;
+import java.util.concurrent.CopyOnWriteArrayList;
+
+public class Test6895383 {
     public static void main(String argv[]) {
-        Test test = new Test();
+        Test6895383 test = new Test6895383();
         test.testRemove1_IndexOutOfBounds();
         test.testAddAll1_IndexOutOfBoundsException();
     }
diff --git a/hotspot/test/compiler/escapeAnalysis/6896727/Test.java b/hotspot/test/compiler/escapeAnalysis/Test6896727.java
similarity index 92%
rename from hotspot/test/compiler/escapeAnalysis/6896727/Test.java
rename to hotspot/test/compiler/escapeAnalysis/Test6896727.java
index c2eb93b..042ab2a 100644
--- a/hotspot/test/compiler/escapeAnalysis/6896727/Test.java
+++ b/hotspot/test/compiler/escapeAnalysis/Test6896727.java
@@ -26,10 +26,14 @@
  * @test
  * @bug 6896727
  * @summary nsk/logging/LoggingPermission/LoggingPermission/logperm002 fails with G1, EscapeAnalisys w/o COOPs
- * @run main/othervm -XX:+IgnoreUnrecognizedVMOptions -Xcomp -XX:+DoEscapeAnalysis Test
+ *
+ * @run main/othervm -XX:+IgnoreUnrecognizedVMOptions -Xcomp -XX:+DoEscapeAnalysis
+ *      compiler.escapeAnalysis.Test6896727
  */
 
-public class Test {
+package compiler.escapeAnalysis;
+
+public class Test6896727 {
 
     final static String testString = "abracadabra";
     public static void main(String args[]) {
diff --git a/hotspot/test/compiler/escapeAnalysis/Test8020215.java b/hotspot/test/compiler/escapeAnalysis/Test8020215.java
index 11e9786..3c60922 100644
--- a/hotspot/test/compiler/escapeAnalysis/Test8020215.java
+++ b/hotspot/test/compiler/escapeAnalysis/Test8020215.java
@@ -25,9 +25,12 @@
  * @test
  * @bug 8020215
  * @summary Different execution plan when using JIT vs interpreter
- * @run main Test8020215
+ *
+ * @run main compiler.escapeAnalysis.Test8020215
  */
 
+package compiler.escapeAnalysis;
+
 import java.util.ArrayList;
 import java.util.List;
 
diff --git a/hotspot/test/compiler/escapeAnalysis/TestAllocatedEscapesPtrComparison.java b/hotspot/test/compiler/escapeAnalysis/TestAllocatedEscapesPtrComparison.java
index 04dea1e..0d2fd47 100644
--- a/hotspot/test/compiler/escapeAnalysis/TestAllocatedEscapesPtrComparison.java
+++ b/hotspot/test/compiler/escapeAnalysis/TestAllocatedEscapesPtrComparison.java
@@ -24,11 +24,16 @@
 /*
  * @test
  * @bug 8043354
- * @summary  bcEscapeAnalyzer allocated_escapes not conservative enough
- * @run main/othervm -XX:CompileOnly=.visitAndPop TestAllocatedEscapesPtrComparison
+ * @summary bcEscapeAnalyzer allocated_escapes not conservative enough
+ *
+ * @run main/othervm
+ *      -XX:CompileCommand=compileonly,compiler.escapeAnalysis.TestAllocatedEscapesPtrComparison::visitAndPop
+ *      compiler.escapeAnalysis.TestAllocatedEscapesPtrComparison
  * @author Chuck Rasbold rasbold@google.com
  */
 
+package compiler.escapeAnalysis;
+
 /*
  * Test always passes with -XX:-OptmimizePtrCompare
  */
diff --git a/hotspot/test/compiler/escapeAnalysis/TestEABadMergeMem.java b/hotspot/test/compiler/escapeAnalysis/TestEABadMergeMem.java
index 236cbe7..e578ff9 100644
--- a/hotspot/test/compiler/escapeAnalysis/TestEABadMergeMem.java
+++ b/hotspot/test/compiler/escapeAnalysis/TestEABadMergeMem.java
@@ -25,10 +25,14 @@
  * @test
  * @bug 8134031
  * @summary Bad rewiring of memory edges when we split unique types during EA
- * @run main/othervm -XX:-BackgroundCompilation -XX:-UseOnStackReplacement -XX:CompileCommand=dontinline,TestEABadMergeMem::m_notinlined TestEABadMergeMem
  *
+ * @run main/othervm -XX:-BackgroundCompilation -XX:-UseOnStackReplacement
+ *      -XX:CompileCommand=dontinline,compiler.escapeAnalysis.TestEABadMergeMem::m_notinlined
+ *      compiler.escapeAnalysis.TestEABadMergeMem
  */
 
+package compiler.escapeAnalysis;
+
 public class TestEABadMergeMem {
 
     static class Box {
diff --git a/hotspot/test/compiler/escapeAnalysis/TestEscapeThroughInvoke.java b/hotspot/test/compiler/escapeAnalysis/TestEscapeThroughInvoke.java
index 7eac5e0..50c7b8c 100644
--- a/hotspot/test/compiler/escapeAnalysis/TestEscapeThroughInvoke.java
+++ b/hotspot/test/compiler/escapeAnalysis/TestEscapeThroughInvoke.java
@@ -25,8 +25,14 @@
  * @test
  * @bug 8073956
  * @summary Tests C2 EA with allocated object escaping through a call.
- * @run main/othervm -XX:CompileCommand=dontinline,TestEscapeThroughInvoke::create TestEscapeThroughInvoke
+ *
+ * @run main/othervm
+ *      -XX:CompileCommand=dontinline,compiler.escapeAnalysis.TestEscapeThroughInvoke::create
+ *      compiler.escapeAnalysis.TestEscapeThroughInvoke
  */
+
+package compiler.escapeAnalysis;
+
 public class TestEscapeThroughInvoke {
     private A a;
 
@@ -55,20 +61,21 @@
         result.saveInto(a, dummy); // result escapes into 'a' here
         return result;
     }
-}
 
-class A {
-    private A saved;
+    static class A {
+        private A saved;
 
-    public A(Integer dummy) { }
+        public A(Integer dummy) {
+        }
 
-    public void saveInto(A other, Integer dummy) {
-        other.saved = this;
-    }
+        public void saveInto(A other, Integer dummy) {
+            other.saved = this;
+        }
 
-    public void check(A other) {
-        if (this.saved != other) {
-            throw new RuntimeException("TEST FAILED: Objects not equal.");
+        public void check(A other) {
+            if (this.saved != other) {
+                throw new RuntimeException("TEST FAILED: Objects not equal.");
+            }
         }
     }
 }
diff --git a/hotspot/test/compiler/escapeAnalysis/TestUnsafePutAddressNullObjMustNotEscape.java b/hotspot/test/compiler/escapeAnalysis/TestUnsafePutAddressNullObjMustNotEscape.java
index 73ca08f..2701512 100644
--- a/hotspot/test/compiler/escapeAnalysis/TestUnsafePutAddressNullObjMustNotEscape.java
+++ b/hotspot/test/compiler/escapeAnalysis/TestUnsafePutAddressNullObjMustNotEscape.java
@@ -26,13 +26,20 @@
  * @bug 8038048
  * @summary assert(null_obj->escape_state() == PointsToNode::NoEscape,etc)
  * @modules java.base/jdk.internal.misc
- * @run main/othervm -XX:+IgnoreUnrecognizedVMOptions -XX:+DoEscapeAnalysis -XX:-TieredCompilation -Xbatch TestUnsafePutAddressNullObjMustNotEscape
+ *
+ * @run main/othervm -XX:+IgnoreUnrecognizedVMOptions -XX:+DoEscapeAnalysis
+ *      -XX:-TieredCompilation -Xbatch
+ *      compiler.escapeAnalysis.TestUnsafePutAddressNullObjMustNotEscape
+ *
  * @author Richard Reingruber richard DOT reingruber AT sap DOT com
  */
 
-import java.lang.reflect.Field;
+package compiler.escapeAnalysis;
+
 import jdk.internal.misc.Unsafe;
 
+import java.lang.reflect.Field;
+
 public class TestUnsafePutAddressNullObjMustNotEscape {
 
     public static Unsafe usafe;
diff --git a/hotspot/test/compiler/escapeAnalysis/6716441/Tester.java b/hotspot/test/compiler/escapeAnalysis/cr6716441/Tester.java
similarity index 99%
rename from hotspot/test/compiler/escapeAnalysis/6716441/Tester.java
rename to hotspot/test/compiler/escapeAnalysis/cr6716441/Tester.java
index 9e26607..15f4a06 100644
--- a/hotspot/test/compiler/escapeAnalysis/6716441/Tester.java
+++ b/hotspot/test/compiler/escapeAnalysis/cr6716441/Tester.java
@@ -25,11 +25,15 @@
  * @test
  * @bug 6716441
  * @summary error in meet with +DoEscapeAnalysis
- * @run main/othervm -Xcomp -XX:+AggressiveOpts Tester
+ *
+ * @run main/othervm -Xcomp -XX:+AggressiveOpts
+ *      compiler.escapeAnalysis.cr6716441.Tester
  */
 
 /* Complexity upper bound: 70070 ops */
 
+package compiler.escapeAnalysis.cr6716441;
+
 class Tester_Class_0 {
     Object var_1;
 
diff --git a/hotspot/test/compiler/escapeAnalysis/6795161/Test.java b/hotspot/test/compiler/escapeAnalysis/cr6795161/Test.java
similarity index 90%
rename from hotspot/test/compiler/escapeAnalysis/6795161/Test.java
rename to hotspot/test/compiler/escapeAnalysis/cr6795161/Test.java
index 598e54a..8c5bbd4 100644
--- a/hotspot/test/compiler/escapeAnalysis/6795161/Test.java
+++ b/hotspot/test/compiler/escapeAnalysis/cr6795161/Test.java
@@ -26,9 +26,14 @@
  * @test
  * @bug 6795161
  * @summary Escape analysis leads to data corruption
- * @run main/othervm -XX:+IgnoreUnrecognizedVMOptions -Xcomp -XX:CompileOnly=Test -XX:+DoEscapeAnalysis Test
+ *
+ * @run main/othervm -XX:+IgnoreUnrecognizedVMOptions -Xcomp -XX:+DoEscapeAnalysis
+ *      -XX:CompileCommand=compileonly,compiler.escapeAnalysis.cr6795161.Test::*
+ *      compiler.escapeAnalysis.cr6795161.Test
  */
 
+package compiler.escapeAnalysis.cr6795161;
+
 class Test_Class_1 {
     static String var_1;
 
diff --git a/hotspot/test/compiler/exceptions/CatchInlineExceptions.java b/hotspot/test/compiler/exceptions/CatchInlineExceptions.java
index 64e986f..80bad92 100644
--- a/hotspot/test/compiler/exceptions/CatchInlineExceptions.java
+++ b/hotspot/test/compiler/exceptions/CatchInlineExceptions.java
@@ -25,13 +25,15 @@
  * @test
  * @bug 8059299
  * @summary assert(adr_type != NULL) failed: expecting TypeKlassPtr
- * @run main/othervm -Xbatch CatchInlineExceptions
+ *
+ * @run main/othervm -Xbatch compiler.exceptions.CatchInlineExceptions
  */
 
-class Exception1 extends Exception {};
-class Exception2 extends Exception {};
+package compiler.exceptions;
 
 public class CatchInlineExceptions {
+    static class Exception1 extends Exception {};
+    static class Exception2 extends Exception {};
     private static int counter0;
     private static int counter1;
     private static int counter2;
diff --git a/hotspot/test/compiler/exceptions/SumTest.java b/hotspot/test/compiler/exceptions/SumTest.java
index d4555aa..dce72a8 100644
--- a/hotspot/test/compiler/exceptions/SumTest.java
+++ b/hotspot/test/compiler/exceptions/SumTest.java
@@ -25,9 +25,12 @@
  * @test
  * @bug 8066900
  * @summary FP registers are not properly restored by C1 when handling exceptions
- * @run main/othervm -Xbatch SumTest
  *
+ * @run main/othervm -Xbatch compiler.exceptions.SumTest
  */
+
+package compiler.exceptions;
+
 public class SumTest {
     private static class Sum {
 
diff --git a/hotspot/test/compiler/exceptions/TestRecursiveReplacedException.java b/hotspot/test/compiler/exceptions/TestRecursiveReplacedException.java
index 950ed18..84e766a 100644
--- a/hotspot/test/compiler/exceptions/TestRecursiveReplacedException.java
+++ b/hotspot/test/compiler/exceptions/TestRecursiveReplacedException.java
@@ -25,10 +25,14 @@
  * @test
  * @bug 8054224
  * @summary Recursive method compiled by C1 is unable to catch StackOverflowError
- * @run main/othervm -Xcomp -XX:CompileOnly=Test.run -XX:+TieredCompilation -XX:TieredStopAtLevel=2 -Xss512K TestRecursiveReplacedException
  *
+ * @run main/othervm -Xcomp -XX:+TieredCompilation -XX:TieredStopAtLevel=2 -Xss512K
+ *      -XX:CompileCommand=compileonly,compiler.exceptions.TestRecursiveReplacedException::run
+ *      compiler.exceptions.TestRecursiveReplacedException
  */
 
+package compiler.exceptions;
+
 public class TestRecursiveReplacedException {
 
     public static void main(String args[]) {
diff --git a/hotspot/test/compiler/floatingpoint/ModNaN.java b/hotspot/test/compiler/floatingpoint/ModNaN.java
index ed38714..a1bdcdc 100644
--- a/hotspot/test/compiler/floatingpoint/ModNaN.java
+++ b/hotspot/test/compiler/floatingpoint/ModNaN.java
@@ -24,10 +24,14 @@
 /**
  * @test
  * @bug 8015396
- * @ignore 8145543
  * @summary double a%b returns NaN for some (a,b) (|a| < inf, |b|>0) (on Core i7 980X)
- * @run main ModNaN
+ *
+ * @ignore 8145543
+ * @run main compiler.floatingpoint.ModNaN
  */
+
+package compiler.floatingpoint;
+
 public class ModNaN {
     /* This bug was seen in the field for a particular version of the VM,
      * but never reproduced internally, and the reason was never known,
diff --git a/hotspot/test/compiler/floatingpoint/NaNTest.java b/hotspot/test/compiler/floatingpoint/NaNTest.java
index 04549b4..058c4fb 100644
--- a/hotspot/test/compiler/floatingpoint/NaNTest.java
+++ b/hotspot/test/compiler/floatingpoint/NaNTest.java
@@ -24,8 +24,12 @@
  * @test
  * @bug 8076373
  * @summary Verify if signaling NaNs are preserved.
- * @run main NaNTest
+ *
+ * @run main compiler.floatingpoint.NaNTest
  */
+
+package compiler.floatingpoint;
+
 public class NaNTest {
     static void testFloat() {
         int originalValue = 0x7f800001;
diff --git a/hotspot/test/compiler/floatingpoint/Test15FloatJNIArgs.java b/hotspot/test/compiler/floatingpoint/Test15FloatJNIArgs.java
index 9cb9243..7b4b51a 100644
--- a/hotspot/test/compiler/floatingpoint/Test15FloatJNIArgs.java
+++ b/hotspot/test/compiler/floatingpoint/Test15FloatJNIArgs.java
@@ -25,11 +25,14 @@
  * @bug 8139258
  * @summary Regression test for 8139258 which failed to properly pass float args
  *          to a jni function on ppc64le.
- * @run main/othervm/native -Xint Test15FloatJNIArgs
- * @run main/othervm/native -XX:+TieredCompilation -Xcomp Test15FloatJNIArgs
- * @run main/othervm/native -XX:-TieredCompilation -Xcomp Test15FloatJNIArgs
+ *
+ * @run main/othervm/native -Xint compiler.floatingpoint.Test15FloatJNIArgs
+ * @run main/othervm/native -XX:+TieredCompilation -Xcomp compiler.floatingpoint.Test15FloatJNIArgs
+ * @run main/othervm/native -XX:-TieredCompilation -Xcomp compiler.floatingpoint.Test15FloatJNIArgs
  */
 
+package compiler.floatingpoint;
+
 public class Test15FloatJNIArgs {
     static {
         try {
diff --git a/hotspot/test/compiler/floatingpoint/TestPow2.java b/hotspot/test/compiler/floatingpoint/TestPow2.java
index 01b094e..28e4f4c 100644
--- a/hotspot/test/compiler/floatingpoint/TestPow2.java
+++ b/hotspot/test/compiler/floatingpoint/TestPow2.java
@@ -27,18 +27,22 @@
  * @summary X^2 special case for C2 yields different result than interpreter
  * @library /testlibrary /test/lib /
  * @modules java.base/jdk.internal.misc
- * @modules java.management
- * @build TestPow2
+ *          java.management
+ *
+ * @build compiler.floatingpoint.TestPow2
  * @run driver ClassFileInstaller sun.hotspot.WhiteBox
  *                                sun.hotspot.WhiteBox$WhiteBoxPermission
  * @run main/othervm -Xbootclasspath/a:. -XX:+UnlockDiagnosticVMOptions -XX:+WhiteBoxAPI
- *                   -XX:-BackgroundCompilation -XX:-UseOnStackReplacement TestPow2
- *
+ *                   -XX:-BackgroundCompilation -XX:-UseOnStackReplacement
+ *                   compiler.floatingpoint.TestPow2
  */
 
-import java.lang.reflect.*;
-import sun.hotspot.WhiteBox;
+package compiler.floatingpoint;
+
 import compiler.whitebox.CompilerWhiteBoxTest;
+import sun.hotspot.WhiteBox;
+
+import java.lang.reflect.Method;
 
 public class TestPow2 {
 
diff --git a/hotspot/test/compiler/floatingpoint/libTest15FloatJNIArgs.c b/hotspot/test/compiler/floatingpoint/libTest15FloatJNIArgs.c
index e316279..c18c53c 100644
--- a/hotspot/test/compiler/floatingpoint/libTest15FloatJNIArgs.c
+++ b/hotspot/test/compiler/floatingpoint/libTest15FloatJNIArgs.c
@@ -27,7 +27,7 @@
 extern "C" {
 #endif
 
-JNIEXPORT jfloat JNICALL Java_Test15FloatJNIArgs_add15floats
+JNIEXPORT jfloat JNICALL Java_compiler_floatingpoint_Test15FloatJNIArgs_add15floats
   (JNIEnv *env, jclass cls,
    jfloat  f1, jfloat  f2, jfloat  f3, jfloat  f4,
    jfloat  f5, jfloat  f6, jfloat  f7, jfloat  f8,
diff --git a/hotspot/test/compiler/gcbarriers/G1CrashTest.java b/hotspot/test/compiler/gcbarriers/G1CrashTest.java
index e8c6f01..e98e3cf 100644
--- a/hotspot/test/compiler/gcbarriers/G1CrashTest.java
+++ b/hotspot/test/compiler/gcbarriers/G1CrashTest.java
@@ -27,11 +27,14 @@
  * @bug 8023472
  * @summary C2 optimization breaks with G1
  *
- * @run main/othervm -Xbatch -XX:+IgnoreUnrecognizedVMOptions -XX:-TieredCompilation -Dcount=100000 G1CrashTest
+ * @run main/othervm -Xbatch -XX:+IgnoreUnrecognizedVMOptions -XX:-TieredCompilation
+ *      -Dcount=100000 compiler.gcbarriers.G1CrashTest
  *
  * @author pbiswal@palantir.com
  */
 
+package compiler.gcbarriers;
+
 public class G1CrashTest {
     static Object[] set = new Object[11];
 
diff --git a/hotspot/test/compiler/gcbarriers/PreserveFPRegistersTest.java b/hotspot/test/compiler/gcbarriers/PreserveFPRegistersTest.java
index cf63431..483f99d 100644
--- a/hotspot/test/compiler/gcbarriers/PreserveFPRegistersTest.java
+++ b/hotspot/test/compiler/gcbarriers/PreserveFPRegistersTest.java
@@ -25,15 +25,25 @@
 /**
  * @test
  * @bug 8148175
- * @ignore 8153194
- * @run main/othervm/timeout=300 -Xbatch -Xmx128m PreserveFPRegistersTest
+ * @requires vm.gc=="G1" | vm.gc=="null"
+ * @library /testlibrary /test/lib
+ * @run main/bootclasspath/othervm -Xbatch -XX:+UnlockDiagnosticVMOptions
+ *      -XX:+WhiteBoxAPI -Xmx300m -XX:+UseG1GC
+ *      compiler.gcbarriers.PreserveFPRegistersTest
  */
+
+package compiler.gcbarriers;
+
+import sun.hotspot.WhiteBox;
+
 public class PreserveFPRegistersTest {
 
     public static void main(String... args) throws InterruptedException {
         new PreserveFPRegistersTest().go();
     }
 
+    private static WhiteBox wb = WhiteBox.getWhiteBox();
+
     public final Object[][] storage;
 
     /**
@@ -52,18 +62,32 @@
     public final int regionCount;
 
     PreserveFPRegistersTest() {
-        long regionSize = 1_000_000; //WB.g1RegionSize();
-
+        long regionSize = wb.g1RegionSize();
         Runtime rt = Runtime.getRuntime();
         long used = rt.totalMemory() - rt.freeMemory();
         long totalFree = rt.maxMemory() - used;
         regionCount = (int) ( (totalFree / regionSize) * 0.9);
-        int refSize = 4;
-
+        int refSize = wb.getHeapOopSize();
         N = (int) ((regionSize / K ) / refSize) - 5;
-        storage = new Object[regionCount * K][];
-        for (int i = 0; i < storage.length; i++) {
-            storage[i] = new Object[N];
+
+        System.out.println("%% Memory");
+        System.out.println("%%   used          :        " + used / 1024 + "M");
+        System.out.println("%%   available     :        " + totalFree / 1024 + "M");
+        System.out.println("%%   G1 Region Size:        " + regionSize / 1024 + "M");
+        System.out.println("%%   region count  :        " + regionCount);
+
+        System.out.println("%% Objects storage");
+        System.out.println("%%   N (array length)      : " + N);
+        System.out.println("%%   K (objects in regions): " + K);
+        System.out.println("%%   Reference size        : " + refSize);
+
+        try {
+            storage = new Object[regionCount * K][];
+            for (int i = 0; i < storage.length; i++) {
+                storage[i] = new Object[N];
+            }
+        } catch(OutOfMemoryError e) {
+            throw new AssertionError("Test Failed with unexpected OutOfMemoryError exception");
         }
     }
 
diff --git a/hotspot/test/compiler/inlining/DefaultAndConcreteMethodsCHA.java b/hotspot/test/compiler/inlining/DefaultAndConcreteMethodsCHA.java
index 821ac79..ba888ab 100644
--- a/hotspot/test/compiler/inlining/DefaultAndConcreteMethodsCHA.java
+++ b/hotspot/test/compiler/inlining/DefaultAndConcreteMethodsCHA.java
@@ -26,18 +26,21 @@
  * @bug 8031695
  * @summary CHA ignores default methods during analysis leading to incorrect code generation
  *
- * @run main/othervm -Xbatch DefaultAndConcreteMethodsCHA
+ * @run main/othervm -Xbatch compiler.inlining.DefaultAndConcreteMethodsCHA
  */
-interface I {
-    default int m() { return 0; }
-}
 
-class A implements I {}
-
-class C extends A { }
-class D extends A { public int m() { return 1; } }
+package compiler.inlining;
 
 public class DefaultAndConcreteMethodsCHA {
+    interface I {
+        default int m() { return 0; }
+    }
+
+    static class A implements I {}
+
+    static class C extends A { }
+    static class D extends A { public int m() { return 1; } }
+
     public static int test(A obj) {
         return obj.m();
     }
diff --git a/hotspot/test/compiler/inlining/DefaultMethodsDependencies.java b/hotspot/test/compiler/inlining/DefaultMethodsDependencies.java
index 5bdc60f..0402034 100644
--- a/hotspot/test/compiler/inlining/DefaultMethodsDependencies.java
+++ b/hotspot/test/compiler/inlining/DefaultMethodsDependencies.java
@@ -25,10 +25,15 @@
  * @test
  * @bug 8069263
  * @summary Deoptimization between array allocation and arraycopy may result in non initialized array
- * @run main/othervm -XX:-BackgroundCompilation -XX:CompileOnly=DefaultMethodsDependencies::test -XX:CompileOnly=DefaultMethodsDependencies$I2::m1 DefaultMethodsDependencies
  *
+ * @run main/othervm -XX:-BackgroundCompilation
+ *      -XX:CompileCommand=compileonly,compiler.inlining.DefaultMethodsDependencies::test
+ *      -XX:CompileCommand=compileonly,compiler.inlining.DefaultMethodsDependencies$I2::m1
+ *      compiler.inlining.DefaultMethodsDependencies
  */
 
+package compiler.inlining;
+
 public class DefaultMethodsDependencies {
 
     interface I1 {
diff --git a/hotspot/test/compiler/inlining/InlineAccessors.java b/hotspot/test/compiler/inlining/InlineAccessors.java
index 387a513..10d9f8e 100644
--- a/hotspot/test/compiler/inlining/InlineAccessors.java
+++ b/hotspot/test/compiler/inlining/InlineAccessors.java
@@ -27,11 +27,14 @@
  * @summary Method::is_accessor should cover getters and setters for all types
  * @modules java.base/jdk.internal.misc
  * @library /testlibrary
- * @run main/othervm InlineAccessors
+ *
+ * @run driver compiler.inlining.InlineAccessors
  */
-import java.lang.invoke.*;
-import jdk.test.lib.*;
-import static jdk.test.lib.Asserts.*;
+
+package compiler.inlining;
+
+import jdk.test.lib.OutputAnalyzer;
+import jdk.test.lib.ProcessTools;
 
 public class InlineAccessors {
     public static void main(String[] args) throws Exception {
@@ -42,7 +45,7 @@
                 "-XX:+IgnoreUnrecognizedVMOptions", "-showversion",
                 "-server", "-XX:-TieredCompilation", "-Xbatch", "-Xcomp",
                 "-XX:+PrintCompilation", "-XX:+UnlockDiagnosticVMOptions", "-XX:+PrintInlining",
-                    "InlineAccessors$Launcher");
+                    Launcher.class.getName());
 
         OutputAnalyzer analyzer = new OutputAnalyzer(pb.start());
 
diff --git a/hotspot/test/compiler/inlining/InlineDefaultMethod.java b/hotspot/test/compiler/inlining/InlineDefaultMethod.java
index 609eaf2..7a6899a 100644
--- a/hotspot/test/compiler/inlining/InlineDefaultMethod.java
+++ b/hotspot/test/compiler/inlining/InlineDefaultMethod.java
@@ -25,29 +25,32 @@
  * @test
  * @bug 8026735
  * @summary CHA in C1 should make correct decisions about default methods
- * @run main/othervm -Xcomp -XX:CompileOnly=InlineDefaultMethod::test -XX:TieredStopAtLevel=1 InlineDefaultMethod
+ *
+ * @run main/othervm -Xcomp -XX:TieredStopAtLevel=1
+ *      -XX:CompileCommand=compileonly,compiler.inlining.InlineDefaultMethod::test
+ *      compiler.inlining.InlineDefaultMethod
  */
 
-
-interface InterfaceWithDefaultMethod0 {
-    default public int defaultMethod() {
-        return 1;
-    }
-}
-
-interface InterfaceWithDefaultMethod1 extends InterfaceWithDefaultMethod0 { }
-
-abstract class Subtype implements InterfaceWithDefaultMethod1 { }
-
-class Decoy extends Subtype {
-    public int defaultMethod() {
-        return 2;
-    }
-}
-
-class Instance extends Subtype { }
-
+package compiler.inlining;
 public class InlineDefaultMethod {
+    interface InterfaceWithDefaultMethod0 {
+        default public int defaultMethod() {
+            return 1;
+        }
+    }
+
+    interface InterfaceWithDefaultMethod1 extends InterfaceWithDefaultMethod0 { }
+
+    static abstract class Subtype implements InterfaceWithDefaultMethod1 { }
+
+    static class Decoy extends Subtype {
+        public int defaultMethod() {
+            return 2;
+        }
+    }
+
+    static class Instance extends Subtype { }
+
     public static int test(InterfaceWithDefaultMethod1 x) {
         return x.defaultMethod();
     }
diff --git a/hotspot/test/compiler/inlining/InlineDefaultMethod1.java b/hotspot/test/compiler/inlining/InlineDefaultMethod1.java
index d0cadb8..7a97e82 100644
--- a/hotspot/test/compiler/inlining/InlineDefaultMethod1.java
+++ b/hotspot/test/compiler/inlining/InlineDefaultMethod1.java
@@ -25,25 +25,32 @@
  * @test
  * @bug 8036100
  * @summary Default method returns true for a while, and then returns false
- * @run main/othervm -Xcomp -XX:CompileOnly=InlineDefaultMethod1::test
- *                   -XX:CompileOnly=I1::m -XX:CompileOnly=I2::m
- *                   InlineDefaultMethod1
+ *
+ * @run main/othervm -Xcomp
+ *      -XX:CompileCommand=compileonly,compiler.inlining.InlineDefaultMethod1::test
+ *      -XX:CompileCommand=compileonly,compiler.inlining.InlineDefaultMethod1$I1::m
+ *      -XX:CompileCommand=compileonly,compiler.inlining.InlineDefaultMethod1$I2::m
+ *      compiler.inlining.InlineDefaultMethod1
  */
-interface I1 {
-    default public int m() { return 0; }
-}
 
-interface I2 extends I1 {
-    default public int m() { return 1; }
-}
-
-abstract class A implements I1 {
-}
-
-class B extends A implements I2 {
-}
+package compiler.inlining;
 
 public class InlineDefaultMethod1 {
+    interface I1 {
+        default public int m() { return 0; }
+    }
+
+    interface I2 extends I1 {
+        default public int m() { return 1; }
+    }
+
+    static abstract class A implements I1 {
+    }
+
+    static class B extends A implements I2 {
+    }
+
+
     public static void test(A obj) {
         int id = obj.m();
         if (id != 1) {
diff --git a/hotspot/test/compiler/integerArithmetic/TestIntegerComparison.java b/hotspot/test/compiler/integerArithmetic/TestIntegerComparison.java
index b38da49..8e16997 100644
--- a/hotspot/test/compiler/integerArithmetic/TestIntegerComparison.java
+++ b/hotspot/test/compiler/integerArithmetic/TestIntegerComparison.java
@@ -24,34 +24,42 @@
 /*
  * @test TestIntegerComparison
  * @bug 8043284 8042786
- * @summary "Tests optimizations of signed and unsigned integer comparison."
- * @run main/othervm -Xcomp -XX:CompileOnly=TestIntegerComparison::testSigned,TestIntegerComparison::testUnsigned TestIntegerComparison
+ * @summary Tests optimizations of signed and unsigned integer comparison.
+ *
+ * @run main/othervm -Xcomp
+ *      -XX:CompileCommand=compileonly,compiler.integerArithmetic.TestIntegerComparison::testSigned
+ *      -XX:CompileCommand=compileonly,compiler.integerArithmetic.TestIntegerComparison::testUnsigned
+ *      compiler.integerArithmetic.TestIntegerComparison
  */
-public class TestIntegerComparison {
-  /**
-   * Tests optimization of signed integer comparison (see BoolNode::Ideal).
-   * The body of the if statement is unreachable and should not be compiled.
-   * @param c Character (value in the integer range [0, 65535])
-   */
-  public static void testSigned(char c) {
-    // The following addition may overflow. The result is in one
-    // of the two ranges [IntMax] and [IntMin, IntMin + CharMax - 1].
-    int result = c + Integer.MAX_VALUE;
-    // CmpINode has to consider both result ranges instead of only
-    // the general [IntMin, IntMax] range to be able to prove that
-    // result is always unequal to CharMax.
-    if (result == Character.MAX_VALUE) {
-      // Unreachable
-      throw new RuntimeException("Should not reach here!");
-    }
-  }
+package compiler.integerArithmetic;
 
-  /**
-   * Tests optimization of unsigned integer comparison (see CmpUNode::Value).
-   * The body of the if statement is unreachable and should not be compiled.
-   * @param c Character (value in the integer range [0, 65535])
-   */
-  public static void testUnsigned(char c) {
+public class TestIntegerComparison {
+    /**
+     * Tests optimization of signed integer comparison (see BoolNode::Ideal).
+     * The body of the if statement is unreachable and should not be compiled.
+     *
+     * @param c Character (value in the integer range [0, 65535])
+     */
+    public static void testSigned(char c) {
+        // The following addition may overflow. The result is in one
+        // of the two ranges [IntMax] and [IntMin, IntMin + CharMax - 1].
+        int result = c + Integer.MAX_VALUE;
+        // CmpINode has to consider both result ranges instead of only
+        // the general [IntMin, IntMax] range to be able to prove that
+        // result is always unequal to CharMax.
+        if (result == Character.MAX_VALUE) {
+            // Unreachable
+            throw new RuntimeException("Should not reach here!");
+        }
+    }
+
+    /**
+     * Tests optimization of unsigned integer comparison (see CmpUNode::Value).
+     * The body of the if statement is unreachable and should not be compiled.
+     *
+     * @param c Character (value in the integer range [0, 65535])
+     */
+    public static void testUnsigned(char c) {
     /*
      * The following if statement consisting of two CmpIs is replaced
      * by a CmpU during optimization (see 'IfNode::fold_compares').
@@ -72,21 +80,21 @@
      * that due to the overflow the signed comparison result < 98 is
      * always false.
      */
-    int result = c - (Character.MAX_VALUE - Integer.MIN_VALUE) + 2;
-    if (1 < result && result < 100) {
-      // Unreachable
-      throw new RuntimeException("Should not reach here!");
+        int result = c - (Character.MAX_VALUE - Integer.MIN_VALUE) + 2;
+        if (1 < result && result < 100) {
+            // Unreachable
+            throw new RuntimeException("Should not reach here!");
+        }
     }
-  }
 
-  /**
-   * Tests optimizations of signed and unsigned integer comparison.
-   */
-  public static void main(String[] args) {
-    // We use characters to get a limited integer range for free
-    for (int i = Character.MIN_VALUE; i <= Character.MAX_VALUE; ++i) {
-      testSigned((char) i);
-      testUnsigned((char) i);
+    /**
+     * Tests optimizations of signed and unsigned integer comparison.
+     */
+    public static void main(String[] args) {
+        // We use characters to get a limited integer range for free
+        for (int i = Character.MIN_VALUE; i <= Character.MAX_VALUE; ++i) {
+            testSigned((char) i);
+            testUnsigned((char) i);
+        }
     }
-  }
 }
diff --git a/hotspot/test/compiler/interpreter/DisableOSRTest.java b/hotspot/test/compiler/interpreter/DisableOSRTest.java
new file mode 100644
index 0000000..8bdd1ce
--- /dev/null
+++ b/hotspot/test/compiler/interpreter/DisableOSRTest.java
@@ -0,0 +1,68 @@
+/*
+ * Copyright (c) 2016 SAP SE. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+/*
+ * @test
+ * @bug 8159620
+ * @summary testing that -XX:-UseOnStackReplacement works with both -XX:(+/-)TieredCompilation
+ * @modules java.base/jdk.internal.misc
+ * @library /testlibrary /test/lib /
+ *
+ * @build sun.hotspot.WhiteBox
+ * @run driver ClassFileInstaller sun.hotspot.WhiteBox
+ *                              sun.hotspot.WhiteBox$WhiteBoxPermission
+ * @run main/othervm -Xbootclasspath/a:. -XX:+UnlockDiagnosticVMOptions -XX:+WhiteBoxAPI -XX:+PrintCompilation
+ *                   -XX:-BackgroundCompilation -XX:-TieredCompilation -XX:-UseOnStackReplacement
+ *                   compiler.interpreter.DisableOSRTest
+ * @run main/othervm -Xbootclasspath/a:. -XX:+UnlockDiagnosticVMOptions -XX:+WhiteBoxAPI -XX:+PrintCompilation
+ *                   -XX:-BackgroundCompilation -XX:+TieredCompilation -XX:-UseOnStackReplacement
+ *                   compiler.interpreter.DisableOSRTest
+ */
+
+package compiler.interpreter;
+
+import sun.hotspot.WhiteBox;
+
+import java.lang.reflect.Method;
+import java.util.Random;
+
+public class DisableOSRTest {
+    private static final WhiteBox WB = WhiteBox.getWhiteBox();
+    private static final Random RANDOM = new Random();
+
+    public static int foo() {
+        return RANDOM.nextInt();
+    }
+
+    public static void main(String[] args) throws Exception {
+        Method m = DisableOSRTest.class.getMethod("main", String[].class);
+
+        for (int i = 0; i < 100_000; i++) {
+            foo();
+        }
+
+        if (WB.isMethodCompiled(m, true /* isOsr */)) {
+            throw new RuntimeException("\"" + m + "\" shouldn't be OSR compiled if running with -XX:-UseOnStackReplacement!");
+        }
+    }
+}
diff --git a/hotspot/test/compiler/interpreter/6539464/Test.java b/hotspot/test/compiler/interpreter/Test6539464.java
similarity index 88%
rename from hotspot/test/compiler/interpreter/6539464/Test.java
rename to hotspot/test/compiler/interpreter/Test6539464.java
index 6a33dfd..baf0e06 100644
--- a/hotspot/test/compiler/interpreter/6539464/Test.java
+++ b/hotspot/test/compiler/interpreter/Test6539464.java
@@ -26,10 +26,14 @@
  * @bug 6539464
  * @summary Math.log() produces inconsistent results between successive runs.
  *
- * @run main/othervm -Xcomp -XX:CompileOnly=Test.main Test
+ * @run main/othervm -Xcomp
+ *      -XX:CompileCommand=compileonly,compiler.interpreter.Test6539464::main
+ *      compiler.interpreter.Test6539464
  */
 
-public class Test {
+package compiler.interpreter;
+
+public class Test6539464 {
     static double log_value = 17197;
     static double log_result = Math.log(log_value);
 
diff --git a/hotspot/test/compiler/interpreter/6833129/Test.java b/hotspot/test/compiler/interpreter/Test6833129.java
similarity index 94%
rename from hotspot/test/compiler/interpreter/6833129/Test.java
rename to hotspot/test/compiler/interpreter/Test6833129.java
index 0283d7b..e887c2d 100644
--- a/hotspot/test/compiler/interpreter/6833129/Test.java
+++ b/hotspot/test/compiler/interpreter/Test6833129.java
@@ -25,10 +25,13 @@
  * @test
  * @bug 6833129
  * @summary Object.clone() and Arrays.copyOf ignore coping with -XX:+DeoptimizeALot
- * @run main/othervm -Xbatch -XX:+IgnoreUnrecognizedVMOptions -XX:+DeoptimizeALot Test
+ * @run main/othervm -Xbatch -XX:+IgnoreUnrecognizedVMOptions -XX:+DeoptimizeALot
+ *      compiler.interpreter.Test6833129
  */
 
-public class Test{
+package compiler.interpreter;
+
+public class Test6833129 {
     public static void init(int src[]) {
         for (int i =0; i<src.length; i++) {
             src[i] =  i;
diff --git a/hotspot/test/compiler/interpreter/7116216/LargeFrame.java b/hotspot/test/compiler/interpreter/cr7116216/LargeFrame.java
similarity index 99%
rename from hotspot/test/compiler/interpreter/7116216/LargeFrame.java
rename to hotspot/test/compiler/interpreter/cr7116216/LargeFrame.java
index eb39b06..8be37c5 100644
--- a/hotspot/test/compiler/interpreter/7116216/LargeFrame.java
+++ b/hotspot/test/compiler/interpreter/cr7116216/LargeFrame.java
@@ -22,6 +22,8 @@
  *
  */
 
+package compiler.interpreter.cr7116216;
+
 public class LargeFrame {
 
     public static void method_with_many_locals(Object r1, int r2, int r3, int r4, int r5, int r6, int r7, Object r8) {
diff --git a/hotspot/test/compiler/interpreter/7116216/StackOverflow.java b/hotspot/test/compiler/interpreter/cr7116216/StackOverflow.java
similarity index 94%
rename from hotspot/test/compiler/interpreter/7116216/StackOverflow.java
rename to hotspot/test/compiler/interpreter/cr7116216/StackOverflow.java
index 934eb59..975b1f2 100644
--- a/hotspot/test/compiler/interpreter/7116216/StackOverflow.java
+++ b/hotspot/test/compiler/interpreter/cr7116216/StackOverflow.java
@@ -26,10 +26,12 @@
  * @test
  * @bug 7116216
  * @summary The vm crashes when GC happens during throwing a StackOverflow exception
- *
- * @run main/othervm -Xcomp -Xbatch StackOverflow
+ * @library /
+ * @run main/othervm -Xcomp -Xbatch compiler.interpreter.cr7116216.StackOverflow
  */
 
+package compiler.interpreter.cr7116216;
+
 public class StackOverflow {
     static String stackOverflow_largeFrame_liveOopForGC;
 
diff --git a/hotspot/test/compiler/intrinsics/IntrinsicAvailableTest.java b/hotspot/test/compiler/intrinsics/IntrinsicAvailableTest.java
index 42ddab0..dd55d54 100644
--- a/hotspot/test/compiler/intrinsics/IntrinsicAvailableTest.java
+++ b/hotspot/test/compiler/intrinsics/IntrinsicAvailableTest.java
@@ -26,34 +26,35 @@
  * @bug 8130832
  * @modules java.base/jdk.internal.misc
  * @library /testlibrary /test/lib /
- * @build IntrinsicAvailableTest
+ *
+ * @build compiler.intrinsics.IntrinsicAvailableTest
  * @run driver ClassFileInstaller sun.hotspot.WhiteBox
  *                                sun.hotspot.WhiteBox$WhiteBoxPermission
  * @run main/othervm -Xbootclasspath/a:.
  *                   -XX:+UnlockDiagnosticVMOptions
  *                   -XX:+WhiteBoxAPI
  *                   -XX:+UseCRC32Intrinsics
- *                   IntrinsicAvailableTest
+ *                   compiler.intrinsics.IntrinsicAvailableTest
  * @run main/othervm -Xbootclasspath/a:.
  *                   -XX:+UnlockDiagnosticVMOptions
  *                   -XX:+WhiteBoxAPI
  *                   -XX:-UseCRC32Intrinsics
- *                   IntrinsicAvailableTest
+ *                   compiler.intrinsics.IntrinsicAvailableTest
  */
 
+
+package compiler.intrinsics;
+
+import compiler.whitebox.CompilerWhiteBoxTest;
+import jdk.test.lib.Platform;
+
 import java.lang.reflect.Executable;
 import java.util.concurrent.Callable;
-import java.util.Objects;
-
-import jdk.test.lib.*;
-import compiler.whitebox.CompilerWhiteBoxTest;
 
 public class IntrinsicAvailableTest extends CompilerWhiteBoxTest {
-    protected String VMName;
 
     public IntrinsicAvailableTest(IntrinsicAvailableTestTestCase testCase) {
         super(testCase);
-        VMName = System.getProperty("java.vm.name");
     }
 
     public static class IntrinsicAvailableTestTestCase implements TestCase {
diff --git a/hotspot/test/compiler/intrinsics/IntrinsicDisabledTest.java b/hotspot/test/compiler/intrinsics/IntrinsicDisabledTest.java
index 638301a..7cbe3cb 100644
--- a/hotspot/test/compiler/intrinsics/IntrinsicDisabledTest.java
+++ b/hotspot/test/compiler/intrinsics/IntrinsicDisabledTest.java
@@ -26,9 +26,10 @@
  * @bug 8138651
  * @modules java.base/jdk.internal.misc
  * @library /testlibrary /test/lib
- * @build IntrinsicDisabledTest
- * @run main ClassFileInstaller sun.hotspot.WhiteBox
- *                              sun.hotspot.WhiteBox$WhiteBoxPermission
+ *
+ * @build compiler.intrinsics.IntrinsicDisabledTest
+ * @run driver ClassFileInstaller sun.hotspot.WhiteBox
+ *                                sun.hotspot.WhiteBox$WhiteBoxPermission
  * @run main/othervm -Xbootclasspath/a:.
  *                   -XX:+UnlockDiagnosticVMOptions
  *                   -XX:+WhiteBoxAPI
@@ -36,16 +37,17 @@
  *                   -XX:DisableIntrinsic=_putIntVolatile
  *                   -XX:CompileCommand=option,jdk.internal.misc.Unsafe::putChar,ccstrlist,DisableIntrinsic,_getCharVolatile,_getInt
  *                   -XX:CompileCommand=option,jdk.internal.misc.Unsafe::putCharVolatile,ccstrlist,DisableIntrinsic,_getIntVolatile
- *                   IntrinsicDisabledTest
+ *                   compiler.intrinsics.IntrinsicDisabledTest
  */
 
+package compiler.intrinsics;
+
+import jdk.test.lib.Platform;
+import sun.hotspot.WhiteBox;
+
 import java.lang.reflect.Executable;
 import java.util.Objects;
 
-import sun.hotspot.WhiteBox;
-
-import jdk.test.lib.Platform;
-
 public class IntrinsicDisabledTest {
 
     private static final WhiteBox wb = WhiteBox.getWhiteBox();
diff --git a/hotspot/test/compiler/intrinsics/6982370/Test6982370.java b/hotspot/test/compiler/intrinsics/Test6982370.java
similarity index 97%
rename from hotspot/test/compiler/intrinsics/6982370/Test6982370.java
rename to hotspot/test/compiler/intrinsics/Test6982370.java
index a3264ab..9c1a59e 100644
--- a/hotspot/test/compiler/intrinsics/6982370/Test6982370.java
+++ b/hotspot/test/compiler/intrinsics/Test6982370.java
@@ -27,9 +27,12 @@
  * @bug 6982370
  * @summary SIGBUS in jbyte_fill
  *
- * @run main/othervm -XX:+IgnoreUnrecognizedVMOptions -XX:+OptimizeFill -Xbatch Test6982370
+ * @run main/othervm -XX:+IgnoreUnrecognizedVMOptions -XX:+OptimizeFill -Xbatch
+ *      compiler.intrinsics.Test6982370
  */
 
+package compiler.intrinsics;
+
 import java.util.Arrays;
 
 /**
diff --git a/hotspot/test/compiler/intrinsics/8005419/Test8005419.java b/hotspot/test/compiler/intrinsics/Test8005419.java
similarity index 97%
rename from hotspot/test/compiler/intrinsics/8005419/Test8005419.java
rename to hotspot/test/compiler/intrinsics/Test8005419.java
index 201153e..4fc5dc9 100644
--- a/hotspot/test/compiler/intrinsics/8005419/Test8005419.java
+++ b/hotspot/test/compiler/intrinsics/Test8005419.java
@@ -25,10 +25,12 @@
  * @test
  * @bug 8005419
  * @summary Improve intrinsics code performance on x86 by using AVX2
- * @run main/othervm -Xbatch -Xmx64m Test8005419
  *
+ * @run main/othervm -Xbatch -Xmx64m compiler.intrinsics.Test8005419
  */
 
+package compiler.intrinsics;
+
 public class Test8005419 {
     public static int SIZE = 64;
 
diff --git a/hotspot/test/compiler/intrinsics/montgomerymultiply/MontgomeryMultiplyTest.java b/hotspot/test/compiler/intrinsics/bigInteger/MontgomeryMultiplyTest.java
similarity index 88%
rename from hotspot/test/compiler/intrinsics/montgomerymultiply/MontgomeryMultiplyTest.java
rename to hotspot/test/compiler/intrinsics/bigInteger/MontgomeryMultiplyTest.java
index cd8445b..01f3ce7 100644
--- a/hotspot/test/compiler/intrinsics/montgomerymultiply/MontgomeryMultiplyTest.java
+++ b/hotspot/test/compiler/intrinsics/bigInteger/MontgomeryMultiplyTest.java
@@ -1,31 +1,49 @@
-//
-// Copyright (c) 2000, 2015, Oracle and/or its affiliates. All rights reserved.
-// Copyright (c) 2015, Red Hat Inc. 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.
-//
-//
+/*
+ * Copyright (c) 2000, 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2015, Red Hat Inc. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+/**
+ * @test
+ * @bug 8130150 8131779 8139907
+ * @summary Verify that the Montgomery multiply and square intrinsic works and correctly checks their arguments.
+ * @requires vm.flavor == "server"
+ * @modules java.base/jdk.internal.misc
+ * @library /testlibrary /test/lib
+ *
+ * @build compiler.intrinsics.bigInteger.MontgomeryMultiplyTest
+ * @run driver ClassFileInstaller sun.hotspot.WhiteBox
+ *                                sun.hotspot.WhiteBox$WhiteBoxPermission
+ * @run main/othervm -Xbootclasspath/a:. -XX:+UnlockDiagnosticVMOptions -XX:+WhiteBoxAPI
+ *      compiler.intrinsics.bigInteger.MontgomeryMultiplyTest
+ */
+
+package compiler.intrinsics.bigInteger;
+
+import jdk.test.lib.Platform;
+import sun.hotspot.WhiteBox;
 
 import java.lang.invoke.MethodHandle;
 import java.lang.invoke.MethodHandles;
-import java.lang.invoke.MethodType;
 import java.lang.reflect.Constructor;
 import java.lang.reflect.Executable;
 import java.lang.reflect.Field;
@@ -34,23 +52,6 @@
 import java.util.Arrays;
 import java.util.Random;
 
-import sun.hotspot.WhiteBox;
-
-import jdk.test.lib.Platform;
-
-/**
- * @test
- * @bug 8130150 8131779 8139907
- * @summary Verify that the Montgomery multiply and square intrinsic works and correctly checks their arguments.
- * @modules java.base/jdk.internal.misc
- * @library /testlibrary /test/lib
- * @library /testlibrary
- * @build MontgomeryMultiplyTest
- * @run main ClassFileInstaller sun.hotspot.WhiteBox
- *                              sun.hotspot.WhiteBox$WhiteBoxPermission
- * @run main/othervm -Xbootclasspath/a:. -XX:+UnlockDiagnosticVMOptions -XX:+WhiteBoxAPI MontgomeryMultiplyTest
- */
-
 public class MontgomeryMultiplyTest {
 
     private static final WhiteBox wb = WhiteBox.getWhiteBox();
@@ -314,9 +315,11 @@
     }
 
     public static void main(String args[]) {
-        if (Platform.isServer() &&
-            wb.isIntrinsicAvailable(getExecutable(true), COMP_LEVEL_FULL_OPTIMIZATION) &&
-            wb.isIntrinsicAvailable(getExecutable(false), COMP_LEVEL_FULL_OPTIMIZATION)) {
+        if (!Platform.isServer()) {
+            throw new Error("TESTBUG: Not server VM");
+        }
+        if (wb.isIntrinsicAvailable(getExecutable(true), COMP_LEVEL_FULL_OPTIMIZATION) &&
+                wb.isIntrinsicAvailable(getExecutable(false), COMP_LEVEL_FULL_OPTIMIZATION)) {
             try {
                 new MontgomeryMultiplyTest().testMontgomeryMultiplyChecks();
                 new MontgomeryMultiplyTest().testResultValues();
diff --git a/hotspot/test/compiler/intrinsics/muladd/TestMulAdd.java b/hotspot/test/compiler/intrinsics/bigInteger/TestMulAdd.java
similarity index 91%
rename from hotspot/test/compiler/intrinsics/muladd/TestMulAdd.java
rename to hotspot/test/compiler/intrinsics/bigInteger/TestMulAdd.java
index 4b310e9..0bc6a80 100644
--- a/hotspot/test/compiler/intrinsics/muladd/TestMulAdd.java
+++ b/hotspot/test/compiler/intrinsics/bigInteger/TestMulAdd.java
@@ -29,8 +29,8 @@
  *
  * @run main/othervm/timeout=600 -XX:-TieredCompilation -Xbatch
  *      -XX:+IgnoreUnrecognizedVMOptions -XX:+UnlockDiagnosticVMOptions -XX:-UseSquareToLenIntrinsic -XX:-UseMultiplyToLenIntrinsic
- *      -XX:CompileCommand=dontinline,TestMulAdd::main
- *      -XX:CompileCommand=option,TestMulAdd::base_multiply,ccstr,DisableIntrinsic,_mulAdd
+ *      -XX:CompileCommand=dontinline,compiler.intrinsics.bigInteger.TestMulAdd::main
+ *      -XX:CompileCommand=option,compiler.intrinsics.bigInteger.TestMulAdd::base_multiply,ccstr,DisableIntrinsic,_mulAdd
  *      -XX:CompileCommand=option,java.math.BigInteger::multiply,ccstr,DisableIntrinsic,_mulAdd
  *      -XX:CompileCommand=option,java.math.BigInteger::square,ccstr,DisableIntrinsic,_mulAdd
  *      -XX:CompileCommand=option,java.math.BigInteger::squareToLen,ccstr,DisableIntrinsic,_mulAdd
@@ -38,11 +38,14 @@
  *      -XX:CompileCommand=inline,java.math.BigInteger::multiply
  *      -XX:CompileCommand=inline,java.math.BigInteger::square
  *      -XX:CompileCommand=inline,java.math.BigInteger::squareToLen
- *      -XX:CompileCommand=inline,java.math.BigInteger::mulAdd TestMulAdd
+ *      -XX:CompileCommand=inline,java.math.BigInteger::mulAdd
+ *      compiler.intrinsics.bigInteger.TestMulAdd
  */
 
+package compiler.intrinsics.bigInteger;
+
+import java.math.BigInteger;
 import java.util.Random;
-import java.math.*;
 
 public class TestMulAdd {
 
diff --git a/hotspot/test/compiler/intrinsics/multiplytolen/TestMultiplyToLen.java b/hotspot/test/compiler/intrinsics/bigInteger/TestMultiplyToLen.java
similarity index 92%
rename from hotspot/test/compiler/intrinsics/multiplytolen/TestMultiplyToLen.java
rename to hotspot/test/compiler/intrinsics/bigInteger/TestMultiplyToLen.java
index a3b4bac..54963f5 100644
--- a/hotspot/test/compiler/intrinsics/multiplytolen/TestMultiplyToLen.java
+++ b/hotspot/test/compiler/intrinsics/bigInteger/TestMultiplyToLen.java
@@ -28,15 +28,18 @@
  * @summary Add C2 x86 intrinsic for BigInteger::multiplyToLen() method
  *
  * @run main/othervm/timeout=600 -XX:-TieredCompilation -Xbatch
- *      -XX:CompileCommand=exclude,TestMultiplyToLen::main
- *      -XX:CompileCommand=option,TestMultiplyToLen::base_multiply,ccstr,DisableIntrinsic,_multiplyToLen
+ *      -XX:CompileCommand=exclude,compiler.intrinsics.bigInteger.TestMultiplyToLen::main
+ *      -XX:CompileCommand=option,compiler.intrinsics.bigInteger.TestMultiplyToLen::base_multiply,ccstr,DisableIntrinsic,_multiplyToLen
  *      -XX:CompileCommand=option,java.math.BigInteger::multiply,ccstr,DisableIntrinsic,_multiplyToLen
- *      -XX:CompileCommand=inline,java.math.BigInteger::multiply TestMultiplyToLen
+ *      -XX:CompileCommand=inline,java.math.BigInteger::multiply
+ *      compiler.intrinsics.bigInteger.TestMultiplyToLen
  */
 
+package compiler.intrinsics.bigInteger;
+
+import java.math.BigInteger;
 import java.util.Arrays;
 import java.util.Random;
-import java.math.*;
 
 public class TestMultiplyToLen {
 
diff --git a/hotspot/test/compiler/intrinsics/multiplytolen/TestMultiplyToLenReturnProfile.java b/hotspot/test/compiler/intrinsics/bigInteger/TestMultiplyToLenReturnProfile.java
similarity index 89%
rename from hotspot/test/compiler/intrinsics/multiplytolen/TestMultiplyToLenReturnProfile.java
rename to hotspot/test/compiler/intrinsics/bigInteger/TestMultiplyToLenReturnProfile.java
index 555bead..693cfe5 100644
--- a/hotspot/test/compiler/intrinsics/multiplytolen/TestMultiplyToLenReturnProfile.java
+++ b/hotspot/test/compiler/intrinsics/bigInteger/TestMultiplyToLenReturnProfile.java
@@ -26,12 +26,15 @@
  * @test
  * @bug 8057758
  * @summary MultiplyToLen sets its return type to have a bottom offset which confuses code generation
- * @run main/othervm -XX:-TieredCompilation -XX:-BackgroundCompilation -XX:-UseOnStackReplacement -XX:TypeProfileLevel=222 TestMultiplyToLenReturnProfile
  *
+ * @run main/othervm -XX:-TieredCompilation -XX:-BackgroundCompilation -XX:-UseOnStackReplacement
+ *      -XX:TypeProfileLevel=222
+ *      compiler.intrinsics.bigInteger.TestMultiplyToLenReturnProfile
  */
 
+package compiler.intrinsics.bigInteger;
 
-import java.math.*;
+import java.math.BigInteger;
 
 public class TestMultiplyToLenReturnProfile {
 
diff --git a/hotspot/test/compiler/intrinsics/squaretolen/TestSquareToLen.java b/hotspot/test/compiler/intrinsics/bigInteger/TestSquareToLen.java
similarity index 91%
rename from hotspot/test/compiler/intrinsics/squaretolen/TestSquareToLen.java
rename to hotspot/test/compiler/intrinsics/bigInteger/TestSquareToLen.java
index 79ebbe3..049e0af 100644
--- a/hotspot/test/compiler/intrinsics/squaretolen/TestSquareToLen.java
+++ b/hotspot/test/compiler/intrinsics/bigInteger/TestSquareToLen.java
@@ -28,18 +28,21 @@
  * @summary Add C2 x86 intrinsic for BigInteger::squareToLen() method
  *
  * @run main/othervm/timeout=600 -XX:-TieredCompilation -Xbatch
- *      -XX:CompileCommand=exclude,TestSquareToLen::main
- *      -XX:CompileCommand=option,TestSquareToLen::base_multiply,ccstr,DisableIntrinsic,_squareToLen
+ *      -XX:CompileCommand=exclude,compiler.intrinsics.bigInteger.TestSquareToLen::main
+ *      -XX:CompileCommand=option,compiler.intrinsics.bigInteger.TestSquareToLen::base_multiply,ccstr,DisableIntrinsic,_squareToLen
  *      -XX:CompileCommand=option,java.math.BigInteger::multiply,ccstr,DisableIntrinsic,_squareToLen
  *      -XX:CompileCommand=option,java.math.BigInteger::square,ccstr,DisableIntrinsic,_squareToLen
  *      -XX:CompileCommand=option,java.math.BigInteger::squareToLen,ccstr,DisableIntrinsic,_squareToLen
  *      -XX:CompileCommand=inline,java.math.BigInteger::multiply
  *      -XX:CompileCommand=inline,java.math.BigInteger::square
- *      -XX:CompileCommand=inline,java.math.BigInteger::squareToLen TestSquareToLen
+ *      -XX:CompileCommand=inline,java.math.BigInteger::squareToLen
+ *      compiler.intrinsics.bigInteger.TestSquareToLen
  */
 
+package compiler.intrinsics.bigInteger;
+
+import java.math.BigInteger;
 import java.util.Random;
-import java.math.*;
 
 public class TestSquareToLen {
 
diff --git a/hotspot/test/compiler/intrinsics/bmi/BMITestRunner.java b/hotspot/test/compiler/intrinsics/bmi/BMITestRunner.java
index defe4a2..7ca7784 100644
--- a/hotspot/test/compiler/intrinsics/bmi/BMITestRunner.java
+++ b/hotspot/test/compiler/intrinsics/bmi/BMITestRunner.java
@@ -22,10 +22,13 @@
  *
  */
 
+package compiler.intrinsics.bmi;
+
 import jdk.test.lib.Asserts;
 import jdk.test.lib.OutputAnalyzer;
 import jdk.test.lib.ProcessTools;
 import jdk.test.lib.Utils;
+
 import java.io.IOException;
 import java.nio.file.Files;
 import java.nio.file.Paths;
diff --git a/hotspot/test/compiler/intrinsics/bmi/Expr.java b/hotspot/test/compiler/intrinsics/bmi/Expr.java
index 2d4a84a..46d644e 100644
--- a/hotspot/test/compiler/intrinsics/bmi/Expr.java
+++ b/hotspot/test/compiler/intrinsics/bmi/Expr.java
@@ -22,11 +22,12 @@
  *
  */
 
+package compiler.intrinsics.bmi;
+
 /**
  * Expression that should be replaced by particular instrinsic
  * or intruction during compilation.
  */
-
 public abstract class Expr {
 
     public static class MemI {
diff --git a/hotspot/test/compiler/intrinsics/bmi/TestAndnI.java b/hotspot/test/compiler/intrinsics/bmi/TestAndnI.java
index 31df862..bb8f971 100644
--- a/hotspot/test/compiler/intrinsics/bmi/TestAndnI.java
+++ b/hotspot/test/compiler/intrinsics/bmi/TestAndnI.java
@@ -30,13 +30,17 @@
  * @library /testlibrary /test/lib
  * @modules java.base/jdk.internal.misc
  *          java.management
- * @build TestAndnI BMITestRunner Expr
- * @run main ClassFileInstaller sun.hotspot.WhiteBox
+ * @build compiler.intrinsics.bmi.TestAndnI
+ *        compiler.intrinsics.bmi.BMITestRunner
+ *        compiler.intrinsics.bmi.Expr
+ * @run driver ClassFileInstaller sun.hotspot.WhiteBox
  *                              sun.hotspot.WhiteBox$WhiteBoxPermission
  * @run main/othervm -Xbootclasspath/a:. -XX:+UnlockDiagnosticVMOptions
- *                   -XX:+WhiteBoxAPI TestAndnI
+ *                   -XX:+WhiteBoxAPI compiler.intrinsics.bmi.TestAndnI
  */
 
+package compiler.intrinsics.bmi;
+
 import sun.hotspot.cpuinfo.CPUInfo;
 
 public class TestAndnI {
diff --git a/hotspot/test/compiler/intrinsics/bmi/TestAndnL.java b/hotspot/test/compiler/intrinsics/bmi/TestAndnL.java
index 8f81d11..9409510 100644
--- a/hotspot/test/compiler/intrinsics/bmi/TestAndnL.java
+++ b/hotspot/test/compiler/intrinsics/bmi/TestAndnL.java
@@ -27,16 +27,20 @@
  * @bug 8031321
  * @summary Verify that results of computations are the same w/
  *          and w/o usage of ANDN instruction
- * @library /testlibrary /test/lib
+ * @library /testlibrary /test/lib /
  * @modules java.base/jdk.internal.misc
  *          java.management
- * @build TestAndnL BMITestRunner Expr
- * @run main ClassFileInstaller sun.hotspot.WhiteBox
- *                              sun.hotspot.WhiteBox$WhiteBoxPermission
+ *
+ * @build compiler.intrinsics.bmi.TestAndnL
+ * @run driver ClassFileInstaller sun.hotspot.WhiteBox
+ *                                sun.hotspot.WhiteBox$WhiteBoxPermission
  * @run main/othervm -Xbootclasspath/a:. -XX:+UnlockDiagnosticVMOptions
- *                   -XX:+WhiteBoxAPI TestAndnL
+ *                   -XX:+WhiteBoxAPI
+ *                   compiler.intrinsics.bmi.TestAndnL
  */
 
+package compiler.intrinsics.bmi;
+
 import sun.hotspot.cpuinfo.CPUInfo;
 
 public class TestAndnL {
diff --git a/hotspot/test/compiler/intrinsics/bmi/TestBlsiI.java b/hotspot/test/compiler/intrinsics/bmi/TestBlsiI.java
index 72d2bfa..a7bad9e 100644
--- a/hotspot/test/compiler/intrinsics/bmi/TestBlsiI.java
+++ b/hotspot/test/compiler/intrinsics/bmi/TestBlsiI.java
@@ -27,16 +27,20 @@
  * @bug 8031321
  * @summary Verify that results of computations are the same w/
  *          and w/o usage of BLSI instruction
- * @library /testlibrary /test/lib
+ * @library /testlibrary /test/lib /
  * @modules java.base/jdk.internal.misc
  *          java.management
- * @build TestBlsiI BMITestRunner Expr
- * @run main ClassFileInstaller sun.hotspot.WhiteBox
- *                              sun.hotspot.WhiteBox$WhiteBoxPermission
+ *
+ * @build compiler.intrinsics.bmi.TestBlsiI
+ * @run driver ClassFileInstaller sun.hotspot.WhiteBox
+ *                                sun.hotspot.WhiteBox$WhiteBoxPermission
  * @run main/othervm -Xbootclasspath/a:. -XX:+UnlockDiagnosticVMOptions
- *                   -XX:+WhiteBoxAPI TestBlsiI
+ *                   -XX:+WhiteBoxAPI
+ *                   compiler.intrinsics.bmi.TestBlsiI
  */
 
+package compiler.intrinsics.bmi;
+
 import sun.hotspot.cpuinfo.CPUInfo;
 
 public class TestBlsiI {
diff --git a/hotspot/test/compiler/intrinsics/bmi/TestBlsiL.java b/hotspot/test/compiler/intrinsics/bmi/TestBlsiL.java
index 8813732..90254f5 100644
--- a/hotspot/test/compiler/intrinsics/bmi/TestBlsiL.java
+++ b/hotspot/test/compiler/intrinsics/bmi/TestBlsiL.java
@@ -27,16 +27,20 @@
  * @bug 8031321
  * @summary Verify that results of computations are the same w/
  *          and w/o usage of BLSI instruction
- * @library /testlibrary /test/lib
+ * @library /testlibrary /test/lib /
  * @modules java.base/jdk.internal.misc
  *          java.management
- * @build TestBlsiL BMITestRunner Expr
- * @run main ClassFileInstaller sun.hotspot.WhiteBox
+ *
+ * @build compiler.intrinsics.bmi.TestBlsiL
+ * @run driver ClassFileInstaller sun.hotspot.WhiteBox
  *                              sun.hotspot.WhiteBox$WhiteBoxPermission
  * @run main/othervm -Xbootclasspath/a:. -XX:+UnlockDiagnosticVMOptions
- *                   -XX:+WhiteBoxAPI TestBlsiL
+ *                   -XX:+WhiteBoxAPI
+ *                   compiler.intrinsics.bmi.TestBlsiL
  */
 
+package compiler.intrinsics.bmi;
+
 import sun.hotspot.cpuinfo.CPUInfo;
 
 public class TestBlsiL {
diff --git a/hotspot/test/compiler/intrinsics/bmi/TestBlsmskI.java b/hotspot/test/compiler/intrinsics/bmi/TestBlsmskI.java
index bf6339c..818c141 100644
--- a/hotspot/test/compiler/intrinsics/bmi/TestBlsmskI.java
+++ b/hotspot/test/compiler/intrinsics/bmi/TestBlsmskI.java
@@ -27,16 +27,20 @@
  * @bug 8031321
  * @summary Verify that results of computations are the same w/
  *          and w/o usage of BLSMSK instruction
- * @library /testlibrary /test/lib
+ * @library /testlibrary /test/lib /
  * @modules java.base/jdk.internal.misc
  *          java.management
- * @build TestBlsmskI BMITestRunner Expr
- * @run main ClassFileInstaller sun.hotspot.WhiteBox
- *                              sun.hotspot.WhiteBox$WhiteBoxPermission
+ *
+ * @build compiler.intrinsics.bmi.TestBlsmskI
+ * @run driver ClassFileInstaller sun.hotspot.WhiteBox
+ *                                sun.hotspot.WhiteBox$WhiteBoxPermission
  * @run main/othervm -Xbootclasspath/a:. -XX:+UnlockDiagnosticVMOptions
- *                   -XX:+WhiteBoxAPI TestBlsmskI
+ *                   -XX:+WhiteBoxAPI
+ *                   compiler.intrinsics.bmi.TestBlsmskI
  */
 
+package compiler.intrinsics.bmi;
+
 import sun.hotspot.cpuinfo.CPUInfo;
 
 public class TestBlsmskI {
diff --git a/hotspot/test/compiler/intrinsics/bmi/TestBlsmskL.java b/hotspot/test/compiler/intrinsics/bmi/TestBlsmskL.java
index 62b799c..8c5c6b5 100644
--- a/hotspot/test/compiler/intrinsics/bmi/TestBlsmskL.java
+++ b/hotspot/test/compiler/intrinsics/bmi/TestBlsmskL.java
@@ -27,16 +27,20 @@
  * @bug 8031321
  * @summary Verify that results of computations are the same w/
  *          and w/o usage of BLSMSK instruction
- * @library /testlibrary /test/lib
+ * @library /testlibrary /test/lib /
  * @modules java.base/jdk.internal.misc
  *          java.management
- * @build TestBlsmskL BMITestRunner Expr
- * @run main ClassFileInstaller sun.hotspot.WhiteBox
- *                              sun.hotspot.WhiteBox$WhiteBoxPermission
+ *
+ * @build compiler.intrinsics.bmi.TestBlsmskL
+ * @run driver ClassFileInstaller sun.hotspot.WhiteBox
+ *                                sun.hotspot.WhiteBox$WhiteBoxPermission
  * @run main/othervm -Xbootclasspath/a:. -XX:+UnlockDiagnosticVMOptions
- *                   -XX:+WhiteBoxAPI TestBlsmskL
+ *                   -XX:+WhiteBoxAPI
+ *                   compiler.intrinsics.bmi.TestBlsmskL
  */
 
+package compiler.intrinsics.bmi;
+
 import sun.hotspot.cpuinfo.CPUInfo;
 
 public class TestBlsmskL {
diff --git a/hotspot/test/compiler/intrinsics/bmi/TestBlsrI.java b/hotspot/test/compiler/intrinsics/bmi/TestBlsrI.java
index 916cde5..1d759d6 100644
--- a/hotspot/test/compiler/intrinsics/bmi/TestBlsrI.java
+++ b/hotspot/test/compiler/intrinsics/bmi/TestBlsrI.java
@@ -27,16 +27,20 @@
  * @bug 8031321
  * @summary Verify that results of computations are the same w/
  *          and w/o usage of BLSR instruction
- * @library /testlibrary /test/lib
+ * @library /testlibrary /test/lib /
  * @modules java.base/jdk.internal.misc
  *          java.management
- * @build TestBlsrI BMITestRunner Expr
- * @run main ClassFileInstaller sun.hotspot.WhiteBox
- *                              sun.hotspot.WhiteBox$WhiteBoxPermission
+ *
+ * @build compiler.intrinsics.bmi.TestBlsrI
+ * @run driver ClassFileInstaller sun.hotspot.WhiteBox
+ *                                sun.hotspot.WhiteBox$WhiteBoxPermission
  * @run main/othervm -Xbootclasspath/a:. -XX:+UnlockDiagnosticVMOptions
- *                   -XX:+WhiteBoxAPI TestBlsrI
+ *                   -XX:+WhiteBoxAPI
+ *                   compiler.intrinsics.bmi.TestBlsrI
  */
 
+package compiler.intrinsics.bmi;
+
 import sun.hotspot.cpuinfo.CPUInfo;
 
 public class TestBlsrI {
diff --git a/hotspot/test/compiler/intrinsics/bmi/TestBlsrL.java b/hotspot/test/compiler/intrinsics/bmi/TestBlsrL.java
index cbc4eec..f299a77 100644
--- a/hotspot/test/compiler/intrinsics/bmi/TestBlsrL.java
+++ b/hotspot/test/compiler/intrinsics/bmi/TestBlsrL.java
@@ -27,16 +27,20 @@
  * @bug 8031321
  * @summary Verify that results of computations are the same w/
  *          and w/o usage of BLSR instruction
- * @library /testlibrary /test/lib
+ * @library /testlibrary /test/lib /
  * @modules java.base/jdk.internal.misc
  *          java.management
- * @build TestBlsrL BMITestRunner Expr
- * @run main ClassFileInstaller sun.hotspot.WhiteBox
- *                              sun.hotspot.WhiteBox$WhiteBoxPermission
+ *
+ * @build compiler.intrinsics.bmi.TestBlsrL
+ * @run driver ClassFileInstaller sun.hotspot.WhiteBox
+ *                                sun.hotspot.WhiteBox$WhiteBoxPermission
  * @run main/othervm -Xbootclasspath/a:. -XX:+UnlockDiagnosticVMOptions
- *                   -XX:+WhiteBoxAPI TestBlsrL
+ *                   -XX:+WhiteBoxAPI
+ *                   compiler.intrinsics.bmi.TestBlsrL
  */
 
+package compiler.intrinsics.bmi;
+
 import sun.hotspot.cpuinfo.CPUInfo;
 
 public class TestBlsrL {
diff --git a/hotspot/test/compiler/intrinsics/bmi/TestLzcntI.java b/hotspot/test/compiler/intrinsics/bmi/TestLzcntI.java
index 613f1db..31ac4ea 100644
--- a/hotspot/test/compiler/intrinsics/bmi/TestLzcntI.java
+++ b/hotspot/test/compiler/intrinsics/bmi/TestLzcntI.java
@@ -27,16 +27,20 @@
  * @bug 8031321
  * @summary Verify that results of computations are the same w/
  *          and w/o usage of intrinsic
- * @library /testlibrary /test/lib
+ * @library /testlibrary /test/lib /
  * @modules java.base/jdk.internal.misc
  *          java.management
- * @build TestLzcntI BMITestRunner Expr
- * @run main ClassFileInstaller sun.hotspot.WhiteBox
- *                              sun.hotspot.WhiteBox$WhiteBoxPermission
+ *
+ * @build compiler.intrinsics.bmi.TestLzcntI
+ * @run driver ClassFileInstaller sun.hotspot.WhiteBox
+ *                                sun.hotspot.WhiteBox$WhiteBoxPermission
  * @run main/othervm -Xbootclasspath/a:. -XX:+UnlockDiagnosticVMOptions
- *                   -XX:+WhiteBoxAPI TestLzcntI
+ *                   -XX:+WhiteBoxAPI
+ *                   compiler.intrinsics.bmi.TestLzcntI
  */
 
+package compiler.intrinsics.bmi;
+
 import sun.hotspot.cpuinfo.CPUInfo;
 
 public class TestLzcntI {
diff --git a/hotspot/test/compiler/intrinsics/bmi/TestLzcntL.java b/hotspot/test/compiler/intrinsics/bmi/TestLzcntL.java
index 1e15c48..f27f845 100644
--- a/hotspot/test/compiler/intrinsics/bmi/TestLzcntL.java
+++ b/hotspot/test/compiler/intrinsics/bmi/TestLzcntL.java
@@ -27,16 +27,20 @@
  * @bug 8031321
  * @summary Verify that results of computations are the same w/
  *          and w/o usage of intrinsic
- * @library /testlibrary /test/lib
+ * @library /testlibrary /test/lib /
  * @modules java.base/jdk.internal.misc
  *          java.management
- * @build TestLzcntL BMITestRunner Expr
- * @run main ClassFileInstaller sun.hotspot.WhiteBox
- *                              sun.hotspot.WhiteBox$WhiteBoxPermission
+ *
+ * @build compiler.intrinsics.bmi.TestLzcntL
+ * @run driver ClassFileInstaller sun.hotspot.WhiteBox
+ *                                sun.hotspot.WhiteBox$WhiteBoxPermission
  * @run main/othervm -Xbootclasspath/a:. -XX:+UnlockDiagnosticVMOptions
- *                   -XX:+WhiteBoxAPI TestLzcntL
+ *                   -XX:+WhiteBoxAPI
+ *                   compiler.intrinsics.bmi.TestLzcntL
  */
 
+package compiler.intrinsics.bmi;
+
 import sun.hotspot.cpuinfo.CPUInfo;
 
 public class TestLzcntL {
diff --git a/hotspot/test/compiler/intrinsics/bmi/TestTzcntI.java b/hotspot/test/compiler/intrinsics/bmi/TestTzcntI.java
index a051099..c75e28d 100644
--- a/hotspot/test/compiler/intrinsics/bmi/TestTzcntI.java
+++ b/hotspot/test/compiler/intrinsics/bmi/TestTzcntI.java
@@ -27,16 +27,20 @@
  * @bug 8031321
  * @summary Verify that results of computations are the same w/
  *          and w/o usage of intrinsic
- * @library /testlibrary /test/lib
+ * @library /testlibrary /test/lib /
  * @modules java.base/jdk.internal.misc
  *          java.management
- * @build TestTzcntI BMITestRunner Expr
- * @run main ClassFileInstaller sun.hotspot.WhiteBox
- *                              sun.hotspot.WhiteBox$WhiteBoxPermission
+ *
+ * @build compiler.intrinsics.bmi.TestTzcntI BMITestRunner Expr
+ * @run driver ClassFileInstaller sun.hotspot.WhiteBox
+ *                                sun.hotspot.WhiteBox$WhiteBoxPermission
  * @run main/othervm -Xbootclasspath/a:. -XX:+UnlockDiagnosticVMOptions
- *                   -XX:+WhiteBoxAPI TestTzcntI
+ *                   -XX:+WhiteBoxAPI
+ *                   compiler.intrinsics.bmi.TestTzcntI
  */
 
+package compiler.intrinsics.bmi;
+
 import sun.hotspot.cpuinfo.CPUInfo;
 
 public class TestTzcntI {
diff --git a/hotspot/test/compiler/intrinsics/bmi/TestTzcntL.java b/hotspot/test/compiler/intrinsics/bmi/TestTzcntL.java
index 788e00f..f561681 100644
--- a/hotspot/test/compiler/intrinsics/bmi/TestTzcntL.java
+++ b/hotspot/test/compiler/intrinsics/bmi/TestTzcntL.java
@@ -27,16 +27,20 @@
  * @bug 8031321
  * @summary Verify that results of computations are the same w/
  *          and w/o usage of intrinsic
- * @library /testlibrary /test/lib
+ * @library /testlibrary /test/lib /
  * @modules java.base/jdk.internal.misc
  *          java.management
- * @build TestTzcntL BMITestRunner Expr
- * @run main ClassFileInstaller sun.hotspot.WhiteBox
- *                              sun.hotspot.WhiteBox$WhiteBoxPermission
+ *
+ * @build compiler.intrinsics.bmi.TestTzcntL
+ * @run driver ClassFileInstaller sun.hotspot.WhiteBox
+ *                                sun.hotspot.WhiteBox$WhiteBoxPermission
  * @run main/othervm -Xbootclasspath/a:. -XX:+UnlockDiagnosticVMOptions
- *                   -XX:+WhiteBoxAPI TestTzcntL
+ *                   -XX:+WhiteBoxAPI
+ *                   compiler.intrinsics.bmi.TestTzcntL
  */
 
+package compiler.intrinsics.bmi;
+
 import sun.hotspot.cpuinfo.CPUInfo;
 
 public class TestTzcntL {
diff --git a/hotspot/test/compiler/intrinsics/bmi/verifycode/AndnTestI.java b/hotspot/test/compiler/intrinsics/bmi/verifycode/AndnTestI.java
index 0e224f8..ae940d7 100644
--- a/hotspot/test/compiler/intrinsics/bmi/verifycode/AndnTestI.java
+++ b/hotspot/test/compiler/intrinsics/bmi/verifycode/AndnTestI.java
@@ -24,16 +24,23 @@
 /*
  * @test
  * @bug 8031321
- * @library /testlibrary /test/lib / ..
+ * @requires vm.flavor == "server"
+ * @library /testlibrary /test/lib /
  * @modules java.base/jdk.internal.misc
  *          java.management
- * @build AndnTestI
+ *
+ * @build compiler.intrinsics.bmi.verifycode.AndnTestI
  * @run driver ClassFileInstaller sun.hotspot.WhiteBox
  *                                sun.hotspot.WhiteBox$WhiteBoxPermission
  * @run main/bootclasspath/othervm -Xbatch -XX:+UnlockDiagnosticVMOptions -XX:+WhiteBoxAPI
- *                                 -XX:+IgnoreUnrecognizedVMOptions -XX:+UseBMI1Instructions AndnTestI
+ *      -XX:+IgnoreUnrecognizedVMOptions -XX:+UseBMI1Instructions
+ *      compiler.intrinsics.bmi.verifycode.AndnTestI
  */
 
+package compiler.intrinsics.bmi.verifycode;
+
+import compiler.intrinsics.bmi.TestAndnI;
+
 import java.lang.reflect.Method;
 
 public class AndnTestI extends BmiIntrinsicBase.BmiTestCase {
diff --git a/hotspot/test/compiler/intrinsics/bmi/verifycode/AndnTestL.java b/hotspot/test/compiler/intrinsics/bmi/verifycode/AndnTestL.java
index 369c033..cf2729e 100644
--- a/hotspot/test/compiler/intrinsics/bmi/verifycode/AndnTestL.java
+++ b/hotspot/test/compiler/intrinsics/bmi/verifycode/AndnTestL.java
@@ -24,16 +24,23 @@
 /*
  * @test
  * @bug 8031321
- * @library /testlibrary /test/lib / ..
+ * @requires vm.flavor == "server"
+ * @library /testlibrary /test/lib /
  * @modules java.base/jdk.internal.misc
  *          java.management
- * @build AndnTestL
+ *
+ * @build compiler.intrinsics.bmi.verifycode.AndnTestL
  * @run driver ClassFileInstaller sun.hotspot.WhiteBox
  *                                sun.hotspot.WhiteBox$WhiteBoxPermission
  * @run main/bootclasspath/othervm -Xbatch -XX:+UnlockDiagnosticVMOptions -XX:+WhiteBoxAPI
- *                                 -XX:+IgnoreUnrecognizedVMOptions -XX:+UseBMI1Instructions AndnTestL
+ *      -XX:+IgnoreUnrecognizedVMOptions -XX:+UseBMI1Instructions
+ *      compiler.intrinsics.bmi.verifycode.AndnTestL
  */
 
+package compiler.intrinsics.bmi.verifycode;
+
+import compiler.intrinsics.bmi.TestAndnL;
+
 import java.lang.reflect.Method;
 
 public class AndnTestL extends AndnTestI {
diff --git a/hotspot/test/compiler/intrinsics/bmi/verifycode/BlsiTestI.java b/hotspot/test/compiler/intrinsics/bmi/verifycode/BlsiTestI.java
index 62860da..944d874 100644
--- a/hotspot/test/compiler/intrinsics/bmi/verifycode/BlsiTestI.java
+++ b/hotspot/test/compiler/intrinsics/bmi/verifycode/BlsiTestI.java
@@ -24,16 +24,23 @@
 /*
  * @test
  * @bug 8031321
- * @library /testlibrary /test/lib / ..
+ * @requires vm.flavor == "server"
+ * @library /testlibrary /test/lib /
  * @modules java.base/jdk.internal.misc
  *          java.management
- * @build BlsiTestI
+ *
+ * @build compiler.intrinsics.bmi.verifycode.BlsiTestI
  * @run driver ClassFileInstaller sun.hotspot.WhiteBox
  *                                sun.hotspot.WhiteBox$WhiteBoxPermission
  * @run main/othervm -Xbootclasspath/a:. -Xbatch -XX:+UnlockDiagnosticVMOptions -XX:+WhiteBoxAPI
- *                   -XX:+IgnoreUnrecognizedVMOptions -XX:+UseBMI1Instructions BlsiTestI
+ *      -XX:+IgnoreUnrecognizedVMOptions -XX:+UseBMI1Instructions
+ *      compiler.intrinsics.bmi.verifycode.BlsiTestI
  */
 
+package compiler.intrinsics.bmi.verifycode;
+
+import compiler.intrinsics.bmi.TestBlsiI;
+
 import java.lang.reflect.Method;
 
 public class BlsiTestI extends BmiIntrinsicBase.BmiTestCase {
diff --git a/hotspot/test/compiler/intrinsics/bmi/verifycode/BlsiTestL.java b/hotspot/test/compiler/intrinsics/bmi/verifycode/BlsiTestL.java
index ef665a1..5d98755 100644
--- a/hotspot/test/compiler/intrinsics/bmi/verifycode/BlsiTestL.java
+++ b/hotspot/test/compiler/intrinsics/bmi/verifycode/BlsiTestL.java
@@ -24,16 +24,23 @@
 /*
  * @test
  * @bug 8031321
- * @library /testlibrary /test/lib / ..
+ * @requires vm.flavor == "server"
+ * @library /testlibrary /test/lib /
  * @modules java.base/jdk.internal.misc
  *          java.management
- * @build BlsiTestL
+ *
+ * @build compiler.intrinsics.bmi.verifycode.BlsiTestL
  * @run driver ClassFileInstaller sun.hotspot.WhiteBox
  *                                sun.hotspot.WhiteBox$WhiteBoxPermission
  * @run main/othervm -Xbootclasspath/a:. -Xbatch -XX:+UnlockDiagnosticVMOptions -XX:+WhiteBoxAPI
- *                   -XX:+IgnoreUnrecognizedVMOptions -XX:+UseBMI1Instructions BlsiTestL
+ *      -XX:+IgnoreUnrecognizedVMOptions -XX:+UseBMI1Instructions
+ *      compiler.intrinsics.bmi.verifycode.BlsiTestL
  */
 
+package compiler.intrinsics.bmi.verifycode;
+
+import compiler.intrinsics.bmi.TestBlsiL;
+
 import java.lang.reflect.Method;
 
 public class BlsiTestL extends BlsiTestI {
diff --git a/hotspot/test/compiler/intrinsics/bmi/verifycode/BlsmskTestI.java b/hotspot/test/compiler/intrinsics/bmi/verifycode/BlsmskTestI.java
index e780495..0ed1d9d 100644
--- a/hotspot/test/compiler/intrinsics/bmi/verifycode/BlsmskTestI.java
+++ b/hotspot/test/compiler/intrinsics/bmi/verifycode/BlsmskTestI.java
@@ -24,16 +24,22 @@
 /*
  * @test
  * @bug 8031321
- * @library /testlibrary /test/lib / ..
+ * @requires vm.flavor == "server"
+ * @library /testlibrary /test/lib /
  * @modules java.base/jdk.internal.misc
  *          java.management
- * @build BlsmskTestI
+ *
+ * @build compiler.intrinsics.bmi.verifycode.BlsmskTestI
  * @run driver ClassFileInstaller sun.hotspot.WhiteBox
  *                                sun.hotspot.WhiteBox$WhiteBoxPermission
  * @run main/othervm -Xbootclasspath/a:. -Xbatch -XX:+UnlockDiagnosticVMOptions -XX:+WhiteBoxAPI
- *                   -XX:+IgnoreUnrecognizedVMOptions -XX:+UseBMI1Instructions BlsmskTestI
+ *      -XX:+IgnoreUnrecognizedVMOptions -XX:+UseBMI1Instructions
+ *      compiler.intrinsics.bmi.verifycode.BlsmskTestI
  */
 
+package compiler.intrinsics.bmi.verifycode;
+import compiler.intrinsics.bmi.TestBlsmskI;
+
 import java.lang.reflect.Method;
 
 public class BlsmskTestI extends BmiIntrinsicBase.BmiTestCase {
diff --git a/hotspot/test/compiler/intrinsics/bmi/verifycode/BlsmskTestL.java b/hotspot/test/compiler/intrinsics/bmi/verifycode/BlsmskTestL.java
index 6f43468..9554c5e 100644
--- a/hotspot/test/compiler/intrinsics/bmi/verifycode/BlsmskTestL.java
+++ b/hotspot/test/compiler/intrinsics/bmi/verifycode/BlsmskTestL.java
@@ -24,16 +24,23 @@
 /*
  * @test
  * @bug 8031321
- * @library /testlibrary /test/lib / ..
+ * @requires vm.flavor == "server"
+ * @library /testlibrary /test/lib /
  * @modules java.base/jdk.internal.misc
  *          java.management
- * @build BlsmskTestL
+ *
+ * @build compiler.intrinsics.bmi.verifycode.BlsmskTestL
  * @run driver ClassFileInstaller sun.hotspot.WhiteBox
  *                                sun.hotspot.WhiteBox$WhiteBoxPermission
  * @run main/othervm -Xbootclasspath/a:. -Xbatch -XX:+UnlockDiagnosticVMOptions -XX:+WhiteBoxAPI
- *                   -XX:+IgnoreUnrecognizedVMOptions -XX:+UseBMI1Instructions BlsmskTestL
+ *      -XX:+IgnoreUnrecognizedVMOptions -XX:+UseBMI1Instructions
+ *      compiler.intrinsics.bmi.verifycode.BlsmskTestL
  */
 
+package compiler.intrinsics.bmi.verifycode;
+
+import compiler.intrinsics.bmi.TestBlsmskL;
+
 import java.lang.reflect.Method;
 
 public class BlsmskTestL extends BlsmskTestI {
diff --git a/hotspot/test/compiler/intrinsics/bmi/verifycode/BlsrTestI.java b/hotspot/test/compiler/intrinsics/bmi/verifycode/BlsrTestI.java
index a6791b0..b11e275 100644
--- a/hotspot/test/compiler/intrinsics/bmi/verifycode/BlsrTestI.java
+++ b/hotspot/test/compiler/intrinsics/bmi/verifycode/BlsrTestI.java
@@ -24,16 +24,23 @@
 /*
  * @test
  * @bug 8031321
- * @library /testlibrary /test/lib / ..
+ * @requires vm.flavor == "server"
+ * @library /testlibrary /test/lib /
  * @modules java.base/jdk.internal.misc
  *          java.management
- * @build BlsrTestI
+ *
+ * @build compiler.intrinsics.bmi.verifycode.BlsrTestI
  * @run driver ClassFileInstaller sun.hotspot.WhiteBox
  *                                sun.hotspot.WhiteBox$WhiteBoxPermission
  * @run main/othervm -Xbootclasspath/a:. -Xbatch -XX:+UnlockDiagnosticVMOptions -XX:+WhiteBoxAPI
- *                   -XX:+IgnoreUnrecognizedVMOptions -XX:+UseBMI1Instructions BlsrTestI
+ *      -XX:+IgnoreUnrecognizedVMOptions -XX:+UseBMI1Instructions
+ *      compiler.intrinsics.bmi.verifycode.BlsrTestI
  */
 
+package compiler.intrinsics.bmi.verifycode;
+
+import compiler.intrinsics.bmi.TestBlsrI;
+
 import java.lang.reflect.Method;
 
 public class BlsrTestI extends BmiIntrinsicBase.BmiTestCase {
diff --git a/hotspot/test/compiler/intrinsics/bmi/verifycode/BlsrTestL.java b/hotspot/test/compiler/intrinsics/bmi/verifycode/BlsrTestL.java
index cd34faf..08038e1 100644
--- a/hotspot/test/compiler/intrinsics/bmi/verifycode/BlsrTestL.java
+++ b/hotspot/test/compiler/intrinsics/bmi/verifycode/BlsrTestL.java
@@ -24,16 +24,23 @@
 /*
  * @test
  * @bug 8031321
- * @library /testlibrary /test/lib / ..
+ * @requires vm.flavor == "server"
+ * @library /testlibrary /test/lib /
  * @modules java.base/jdk.internal.misc
  *          java.management
- * @build BlsrTestL
+ *
+ * @build compiler.intrinsics.bmi.verifycode.BlsrTestL
  * @run driver ClassFileInstaller sun.hotspot.WhiteBox
  *                                sun.hotspot.WhiteBox$WhiteBoxPermission
  * @run main/othervm -Xbootclasspath/a:. -Xbatch -XX:+UnlockDiagnosticVMOptions -XX:+WhiteBoxAPI
- *                   -XX:+IgnoreUnrecognizedVMOptions -XX:+UseBMI1Instructions BlsrTestL
+ *      -XX:+IgnoreUnrecognizedVMOptions -XX:+UseBMI1Instructions
+ *      compiler.intrinsics.bmi.verifycode.BlsrTestL
  */
 
+package compiler.intrinsics.bmi.verifycode;
+
+import compiler.intrinsics.bmi.TestBlsrL;
+
 import java.lang.reflect.Method;
 
 public class BlsrTestL extends BlsrTestI {
diff --git a/hotspot/test/compiler/intrinsics/bmi/verifycode/BmiIntrinsicBase.java b/hotspot/test/compiler/intrinsics/bmi/verifycode/BmiIntrinsicBase.java
index 8ecb518..a118de0 100644
--- a/hotspot/test/compiler/intrinsics/bmi/verifycode/BmiIntrinsicBase.java
+++ b/hotspot/test/compiler/intrinsics/bmi/verifycode/BmiIntrinsicBase.java
@@ -22,17 +22,21 @@
  *
  */
 
+package compiler.intrinsics.bmi.verifycode;
+
+import compiler.whitebox.CompilerWhiteBoxTest;
 import jdk.test.lib.Asserts;
 import jdk.test.lib.Platform;
 import jdk.test.lib.Utils;
 import sun.hotspot.code.NMethod;
 import sun.hotspot.cpuinfo.CPUInfo;
 
+import java.lang.invoke.MethodHandle;
+import java.lang.invoke.MethodType;
 import java.lang.reflect.Executable;
 import java.lang.reflect.Method;
 import java.util.concurrent.Callable;
 import java.util.function.Function;
-import compiler.whitebox.CompilerWhiteBoxTest;
 
 public class BmiIntrinsicBase extends CompilerWhiteBoxTest {
 
@@ -56,8 +60,11 @@
         }
 
         if (!Platform.isServer()) {
-            System.out.println("Not server VM, test SKIPPED");
-            return;
+            throw new Error("TESTBUG: Not server VM");
+        }
+
+        if (Platform.isInt()) {
+            throw new Error("TESTBUG: test can not be run in interpreter");
         }
 
         if (!CPUInfo.hasFeature(bmiTestCase.getCpuFlag())) {
@@ -72,22 +79,12 @@
 
         System.out.println(testCase.name());
 
-        switch (MODE) {
-            case "compiled mode":
-            case "mixed mode":
-                if (TIERED_COMPILATION && TIERED_STOP_AT_LEVEL != CompilerWhiteBoxTest.COMP_LEVEL_MAX) {
-                    System.out.println("TieredStopAtLevel value (" + TIERED_STOP_AT_LEVEL + ") is too low, test SKIPPED");
-                    return;
-                }
-                deoptimize();
-                compileAtLevelAndCheck(CompilerWhiteBoxTest.COMP_LEVEL_MAX);
-                break;
-            case "interpreted mode": // test is not applicable in this mode;
-                System.err.println("Warning: This test is not applicable in mode: " + MODE);
-                break;
-            default:
-                throw new AssertionError("Test bug, unknown VM mode: " + MODE);
+        if (TIERED_COMPILATION && TIERED_STOP_AT_LEVEL != CompilerWhiteBoxTest.COMP_LEVEL_MAX) {
+            System.out.println("TieredStopAtLevel value (" + TIERED_STOP_AT_LEVEL + ") is too low, test SKIPPED");
+            return;
         }
+        deoptimize();
+        compileAtLevelAndCheck(CompilerWhiteBoxTest.COMP_LEVEL_MAX);
     }
 
     protected void compileAtLevelAndCheck(int level) {
diff --git a/hotspot/test/compiler/intrinsics/bmi/verifycode/LZcntTestI.java b/hotspot/test/compiler/intrinsics/bmi/verifycode/LZcntTestI.java
index f23792a..e2ba693 100644
--- a/hotspot/test/compiler/intrinsics/bmi/verifycode/LZcntTestI.java
+++ b/hotspot/test/compiler/intrinsics/bmi/verifycode/LZcntTestI.java
@@ -24,16 +24,23 @@
 /*
  * @test
  * @bug 8031321
- * @library /testlibrary /test/lib / ..
+ * @requires vm.flavor == "server"
+ * @library /testlibrary /test/lib /
  * @modules java.base/jdk.internal.misc
  *          java.management
- * @build LZcntTestI
+ *
+ * @build compiler.intrinsics.bmi.verifycode.LZcntTestI
  * @run driver ClassFileInstaller sun.hotspot.WhiteBox
  *                                sun.hotspot.WhiteBox$WhiteBoxPermission
  * @run main/othervm -Xbootclasspath/a:. -Xbatch -XX:+UnlockDiagnosticVMOptions -XX:+WhiteBoxAPI
- *                   -XX:+IgnoreUnrecognizedVMOptions -XX:+UseCountLeadingZerosInstruction LZcntTestI
+ *      -XX:+IgnoreUnrecognizedVMOptions -XX:+UseCountLeadingZerosInstruction
+ *      compiler.intrinsics.bmi.verifycode.LZcntTestI
  */
 
+package compiler.intrinsics.bmi.verifycode;
+
+import compiler.intrinsics.bmi.TestLzcntI;
+
 import java.lang.reflect.Method;
 
 public class LZcntTestI extends BmiIntrinsicBase.BmiTestCase_x64 {
diff --git a/hotspot/test/compiler/intrinsics/bmi/verifycode/LZcntTestL.java b/hotspot/test/compiler/intrinsics/bmi/verifycode/LZcntTestL.java
index 71a0fc0..d68a32f 100644
--- a/hotspot/test/compiler/intrinsics/bmi/verifycode/LZcntTestL.java
+++ b/hotspot/test/compiler/intrinsics/bmi/verifycode/LZcntTestL.java
@@ -24,16 +24,23 @@
 /*
  * @test
  * @bug 8031321
- * @library /testlibrary /test/lib / ..
+ * @requires vm.flavor == "server"
+ * @library /testlibrary /test/lib /
  * @modules java.base/jdk.internal.misc
  *          java.management
- * @build LZcntTestL
+ *
+ * @build compiler.intrinsics.bmi.verifycode.LZcntTestL
  * @run driver ClassFileInstaller sun.hotspot.WhiteBox
  *                                sun.hotspot.WhiteBox$WhiteBoxPermission
  * @run main/othervm -Xbootclasspath/a:. -Xbatch -XX:+UnlockDiagnosticVMOptions -XX:+WhiteBoxAPI
- *                   -XX:+IgnoreUnrecognizedVMOptions -XX:+UseCountLeadingZerosInstruction LZcntTestL
+ *      -XX:+IgnoreUnrecognizedVMOptions -XX:+UseCountLeadingZerosInstruction
+ *      compiler.intrinsics.bmi.verifycode.LZcntTestL
  */
 
+package compiler.intrinsics.bmi.verifycode;
+
+import compiler.intrinsics.bmi.TestLzcntL;
+
 import java.lang.reflect.Method;
 
 public class LZcntTestL extends LZcntTestI {
diff --git a/hotspot/test/compiler/intrinsics/bmi/verifycode/TZcntTestI.java b/hotspot/test/compiler/intrinsics/bmi/verifycode/TZcntTestI.java
index 1f71f43..4ab25be 100644
--- a/hotspot/test/compiler/intrinsics/bmi/verifycode/TZcntTestI.java
+++ b/hotspot/test/compiler/intrinsics/bmi/verifycode/TZcntTestI.java
@@ -24,15 +24,21 @@
 /*
  * @test
  * @bug 8031321
- * @library /testlibrary /test/lib / ..
+ * @requires vm.flavor == "server"
+ * @library /testlibrary /test/lib /
  * @modules java.base/jdk.internal.misc
  *          java.management
- * @build TZcntTestI
+ *
+ * @build compiler.intrinsics.bmi.verifycode.TZcntTestI
  * @run driver ClassFileInstaller sun.hotspot.WhiteBox
  *                                sun.hotspot.WhiteBox$WhiteBoxPermission
  * @run main/othervm -Xbootclasspath/a:. -Xbatch -XX:+UnlockDiagnosticVMOptions -XX:+WhiteBoxAPI
- *                   -XX:+IgnoreUnrecognizedVMOptions -XX:+UseCountTrailingZerosInstruction TZcntTestI
+ *      -XX:+IgnoreUnrecognizedVMOptions -XX:+UseCountTrailingZerosInstruction
+ *      compiler.intrinsics.bmi.verifycode.TZcntTestI
  */
+package compiler.intrinsics.bmi.verifycode;
+
+import compiler.intrinsics.bmi.TestTzcntI;
 
 import java.lang.reflect.Method;
 
diff --git a/hotspot/test/compiler/intrinsics/bmi/verifycode/TZcntTestL.java b/hotspot/test/compiler/intrinsics/bmi/verifycode/TZcntTestL.java
index ca77c2a..02359f6 100644
--- a/hotspot/test/compiler/intrinsics/bmi/verifycode/TZcntTestL.java
+++ b/hotspot/test/compiler/intrinsics/bmi/verifycode/TZcntTestL.java
@@ -24,16 +24,23 @@
 /*
  * @test
  * @bug 8031321
- * @library /testlibrary /test/lib / ..
+ * @requires vm.flavor == "server"
+ * @library /testlibrary /test/lib /
  * @modules java.base/jdk.internal.misc
  *          java.management
- * @build TZcntTestL
+ *
+ * @build compiler.intrinsics.bmi.verifycode.TZcntTestL
  * @run driver ClassFileInstaller sun.hotspot.WhiteBox
  *                                sun.hotspot.WhiteBox$WhiteBoxPermission
  * @run main/othervm -Xbootclasspath/a:. -Xbatch -XX:+UnlockDiagnosticVMOptions -XX:+WhiteBoxAPI
- *                   -XX:+IgnoreUnrecognizedVMOptions -XX:+UseCountTrailingZerosInstruction TZcntTestL
+ *      -XX:+IgnoreUnrecognizedVMOptions -XX:+UseCountTrailingZerosInstruction
+ *      compiler.intrinsics.bmi.verifycode.TZcntTestL
  */
 
+package compiler.intrinsics.bmi.verifycode;
+
+import compiler.intrinsics.bmi.TestTzcntL;
+
 import java.lang.reflect.Method;
 
 public class TZcntTestL extends TZcntTestI {
diff --git a/hotspot/test/compiler/intrinsics/classcast/NullCheckDroppingsTest.java b/hotspot/test/compiler/intrinsics/klass/CastNullCheckDroppingsTest.java
similarity index 78%
rename from hotspot/test/compiler/intrinsics/classcast/NullCheckDroppingsTest.java
rename to hotspot/test/compiler/intrinsics/klass/CastNullCheckDroppingsTest.java
index 90b4fa1..cb6d70c 100644
--- a/hotspot/test/compiler/intrinsics/classcast/NullCheckDroppingsTest.java
+++ b/hotspot/test/compiler/intrinsics/klass/CastNullCheckDroppingsTest.java
@@ -24,31 +24,36 @@
 /*
  * @test NullCheckDroppingsTest
  * @bug 8054492
- * @summary "Casting can result in redundant null checks in generated code"
+ * @summary Casting can result in redundant null checks in generated code
+ * @requires vm.flavor == "server"
  * @library /testlibrary /test/lib
  * @modules java.base/jdk.internal.misc
  *          java.management
+ *
  * @build ClassFileInstaller sun.hotspot.WhiteBox jdk.test.lib.*
- * @build NullCheckDroppingsTest
- * @run main ClassFileInstaller sun.hotspot.WhiteBox
- *                              sun.hotspot.WhiteBox$WhiteBoxPermission
- * @run main ClassFileInstaller jdk.test.lib.Platform
+ * @build compiler.intrinsics.klass.CastNullCheckDroppingsTest
+ * @run driver ClassFileInstaller sun.hotspot.WhiteBox
+ *                                sun.hotspot.WhiteBox$WhiteBoxPermission
+ *                                jdk.test.lib.Platform
  * @run main/othervm -Xbootclasspath/a:. -XX:+IgnoreUnrecognizedVMOptions -XX:+UnlockDiagnosticVMOptions -XX:+WhiteBoxAPI
  *                   -Xmixed -XX:-BackgroundCompilation -XX:-TieredCompilation -XX:CompileThreshold=1000
- *                   -XX:CompileCommand=exclude,NullCheckDroppingsTest::runTest NullCheckDroppingsTest
+ *                   -XX:CompileCommand=exclude,compiler.intrinsics.klass.CastNullCheckDroppingsTest::runTest
+ *                   compiler.intrinsics.klass.CastNullCheckDroppingsTest
  */
 
+package compiler.intrinsics.klass;
+
+import jdk.test.lib.Platform;
 import sun.hotspot.WhiteBox;
 import sun.hotspot.code.NMethod;
-import jdk.test.lib.Platform;
 
-import java.lang.reflect.Method;
 import java.lang.invoke.MethodHandle;
 import java.lang.invoke.MethodHandles;
 import java.lang.invoke.MethodType;
+import java.lang.reflect.Method;
 import java.util.function.BiFunction;
 
-public class NullCheckDroppingsTest {
+public class CastNullCheckDroppingsTest {
 
     private static final WhiteBox WHITE_BOX = WhiteBox.getWhiteBox();
 
@@ -59,7 +64,7 @@
 
     static {
         try {
-            SET_SSINK = MethodHandles.lookup().findSetter(NullCheckDroppingsTest.class, "ssink", String.class);
+            SET_SSINK = MethodHandles.lookup().findSetter(CastNullCheckDroppingsTest.class, "ssink", String.class);
             MH_CAST = MethodHandles.lookup().findVirtual(Class.class,
                                                          "cast",
                                                          MethodType.methodType(Object.class, Object.class));
@@ -81,43 +86,41 @@
     int[]   asink;
 
     public static void main(String[] args) throws Exception {
-
-        // Only test C2 in Server VM
         if (!Platform.isServer()) {
-            return;
+            throw new Error("TESTBUG: Not server VM");
         }
         // Make sure background compilation is disabled
         if (WHITE_BOX.getBooleanVMFlag("BackgroundCompilation")) {
-            throw new AssertionError("Background compilation enabled");
+            throw new Error("TESTBUG: Background compilation enabled");
         }
         // Make sure Tiered compilation is disabled
         if (WHITE_BOX.getBooleanVMFlag("TieredCompilation")) {
-            throw new AssertionError("Tiered compilation enabled");
+            throw new Error("TESTBUG: Tiered compilation enabled");
         }
 
-        Method methodClassCast = NullCheckDroppingsTest.class.getDeclaredMethod("testClassCast", String.class);
-        Method methodMHCast    = NullCheckDroppingsTest.class.getDeclaredMethod("testMHCast",    String.class);
-        Method methodMHSetter  = NullCheckDroppingsTest.class.getDeclaredMethod("testMHSetter",  String.class);
-        Method methodFunction  = NullCheckDroppingsTest.class.getDeclaredMethod("testFunction",  String.class);
+        Method methodClassCast = CastNullCheckDroppingsTest.class.getDeclaredMethod("testClassCast", String.class);
+        Method methodMHCast    = CastNullCheckDroppingsTest.class.getDeclaredMethod("testMHCast",    String.class);
+        Method methodMHSetter  = CastNullCheckDroppingsTest.class.getDeclaredMethod("testMHSetter",  String.class);
+        Method methodFunction  = CastNullCheckDroppingsTest.class.getDeclaredMethod("testFunction",  String.class);
 
-        NullCheckDroppingsTest t = new NullCheckDroppingsTest();
+        CastNullCheckDroppingsTest t = new CastNullCheckDroppingsTest();
         t.runTest(methodClassCast, false);
         t.runTest(methodMHCast,    false);
         t.runTest(methodMHSetter,  false);
         t.runTest(methodFunction,  false);
 
         // Edge cases
-        Method methodClassCastNull = NullCheckDroppingsTest.class.getDeclaredMethod("testClassCastNull", String.class);
-        Method methodNullClassCast = NullCheckDroppingsTest.class.getDeclaredMethod("testNullClassCast", String.class);
-        Method methodClassCastObj  = NullCheckDroppingsTest.class.getDeclaredMethod("testClassCastObj",  Object.class);
-        Method methodObjClassCast  = NullCheckDroppingsTest.class.getDeclaredMethod("testObjClassCast",  String.class);
-        Method methodVarClassCast  = NullCheckDroppingsTest.class.getDeclaredMethod("testVarClassCast",  String.class);
-        Method methodClassCastInt  = NullCheckDroppingsTest.class.getDeclaredMethod("testClassCastInt",  Object.class);
-        Method methodIntClassCast  = NullCheckDroppingsTest.class.getDeclaredMethod("testIntClassCast",  Object.class);
-        Method methodClassCastint  = NullCheckDroppingsTest.class.getDeclaredMethod("testClassCastint",  Object.class);
-        Method methodintClassCast  = NullCheckDroppingsTest.class.getDeclaredMethod("testintClassCast",  Object.class);
-        Method methodClassCastPrim = NullCheckDroppingsTest.class.getDeclaredMethod("testClassCastPrim", Object.class);
-        Method methodPrimClassCast = NullCheckDroppingsTest.class.getDeclaredMethod("testPrimClassCast", Object.class);
+        Method methodClassCastNull = CastNullCheckDroppingsTest.class.getDeclaredMethod("testClassCastNull", String.class);
+        Method methodNullClassCast = CastNullCheckDroppingsTest.class.getDeclaredMethod("testNullClassCast", String.class);
+        Method methodClassCastObj  = CastNullCheckDroppingsTest.class.getDeclaredMethod("testClassCastObj",  Object.class);
+        Method methodObjClassCast  = CastNullCheckDroppingsTest.class.getDeclaredMethod("testObjClassCast",  String.class);
+        Method methodVarClassCast  = CastNullCheckDroppingsTest.class.getDeclaredMethod("testVarClassCast",  String.class);
+        Method methodClassCastInt  = CastNullCheckDroppingsTest.class.getDeclaredMethod("testClassCastInt",  Object.class);
+        Method methodIntClassCast  = CastNullCheckDroppingsTest.class.getDeclaredMethod("testIntClassCast",  Object.class);
+        Method methodClassCastint  = CastNullCheckDroppingsTest.class.getDeclaredMethod("testClassCastint",  Object.class);
+        Method methodintClassCast  = CastNullCheckDroppingsTest.class.getDeclaredMethod("testintClassCast",  Object.class);
+        Method methodClassCastPrim = CastNullCheckDroppingsTest.class.getDeclaredMethod("testClassCastPrim", Object.class);
+        Method methodPrimClassCast = CastNullCheckDroppingsTest.class.getDeclaredMethod("testPrimClassCast", Object.class);
 
         t.runTest(methodClassCastNull, false);
         t.runTest(methodNullClassCast, false);
diff --git a/hotspot/test/compiler/intrinsics/class/TestClassIsPrimitive.java b/hotspot/test/compiler/intrinsics/klass/TestIsPrimitive.java
similarity index 94%
rename from hotspot/test/compiler/intrinsics/class/TestClassIsPrimitive.java
rename to hotspot/test/compiler/intrinsics/klass/TestIsPrimitive.java
index 76a2812..5c6ac89 100644
--- a/hotspot/test/compiler/intrinsics/class/TestClassIsPrimitive.java
+++ b/hotspot/test/compiler/intrinsics/klass/TestIsPrimitive.java
@@ -27,15 +27,20 @@
  * @bug 8150669
  * @summary C1 intrinsic for Class.isPrimitive
  * @modules java.base/jdk.internal.misc
- * @run main/othervm -ea -Diters=200   -Xint                   TestClassIsPrimitive
- * @run main/othervm -ea -Diters=30000 -XX:TieredStopAtLevel=1 TestClassIsPrimitive
- * @run main/othervm -ea -Diters=30000 -XX:TieredStopAtLevel=4 TestClassIsPrimitive
+ *
+ * @run main/othervm -ea -Diters=200   -Xint
+ *      compiler.intrinsics.klass.TestIsPrimitive
+ * @run main/othervm -ea -Diters=30000 -XX:TieredStopAtLevel=1
+ *      compiler.intrinsics.klass.TestIsPrimitive
+ * @run main/othervm -ea -Diters=30000 -XX:TieredStopAtLevel=4
+ *      compiler.intrinsics.klass.TestIsPrimitive
  */
-import java.lang.reflect.Field;
-import java.lang.reflect.Array;
+
+package compiler.intrinsics.klass;
+
 import java.util.concurrent.Callable;
 
-public class TestClassIsPrimitive {
+public class TestIsPrimitive {
     static final int ITERS = Integer.getInteger("iters", 1);
 
     public static void main(String... args) throws Exception {
diff --git a/hotspot/test/compiler/intrinsics/mathexact/AddExactICondTest.java b/hotspot/test/compiler/intrinsics/mathexact/AddExactICondTest.java
index 8862160..db2bd17 100644
--- a/hotspot/test/compiler/intrinsics/mathexact/AddExactICondTest.java
+++ b/hotspot/test/compiler/intrinsics/mathexact/AddExactICondTest.java
@@ -25,11 +25,12 @@
  * @test
  * @bug 8024924
  * @summary Test non constant addExact
- * @compile AddExactICondTest.java
- * @run main AddExactICondTest
  *
+ * @run main compiler.intrinsics.mathexact.AddExactICondTest
  */
 
+package compiler.intrinsics.mathexact;
+
 public class AddExactICondTest {
   public static int result = 0;
 
diff --git a/hotspot/test/compiler/intrinsics/mathexact/AddExactIConstantTest.java b/hotspot/test/compiler/intrinsics/mathexact/AddExactIConstantTest.java
index 0e9b702..c8f3c1a 100644
--- a/hotspot/test/compiler/intrinsics/mathexact/AddExactIConstantTest.java
+++ b/hotspot/test/compiler/intrinsics/mathexact/AddExactIConstantTest.java
@@ -25,14 +25,15 @@
  * @test
  * @bug 8024924
  * @summary Test constant addExact
- * @library /testlibrary
+ * @library /testlibrary /
  * @modules java.base/jdk.internal.misc
  *          java.management
- * @compile AddExactIConstantTest.java Verify.java
- * @run main AddExactIConstantTest
  *
+ * @run main compiler.intrinsics.mathexact.AddExactIConstantTest
  */
 
+package compiler.intrinsics.mathexact;
+
 public class AddExactIConstantTest {
   public static void main(String[] args) {
       Verify.ConstantTest.verify(new Verify.AddExactI());
diff --git a/hotspot/test/compiler/intrinsics/mathexact/AddExactILoadTest.java b/hotspot/test/compiler/intrinsics/mathexact/AddExactILoadTest.java
index 2c353d6..517abe27 100644
--- a/hotspot/test/compiler/intrinsics/mathexact/AddExactILoadTest.java
+++ b/hotspot/test/compiler/intrinsics/mathexact/AddExactILoadTest.java
@@ -25,14 +25,15 @@
  * @test
  * @bug 8024924
  * @summary Test non constant addExact
- * @library /testlibrary
+ * @library /testlibrary /
  * @modules java.base/jdk.internal.misc
  *          java.management
- * @compile AddExactILoadTest.java Verify.java
- * @run main AddExactILoadTest
  *
+ * @run main compiler.intrinsics.mathexact.AddExactILoadTest
  */
 
+package compiler.intrinsics.mathexact;
+
 public class AddExactILoadTest {
   public static void main(String[] args) {
       Verify.LoadTest.init();
diff --git a/hotspot/test/compiler/intrinsics/mathexact/AddExactILoopDependentTest.java b/hotspot/test/compiler/intrinsics/mathexact/AddExactILoopDependentTest.java
index 4093783..a655e1e 100644
--- a/hotspot/test/compiler/intrinsics/mathexact/AddExactILoopDependentTest.java
+++ b/hotspot/test/compiler/intrinsics/mathexact/AddExactILoopDependentTest.java
@@ -25,14 +25,15 @@
  * @test
  * @bug 8024924
  * @summary Test non constant addExact
- * @library /testlibrary
+ * @library /testlibrary /
  * @modules java.base/jdk.internal.misc
  *          java.management
- * @compile AddExactILoopDependentTest.java Verify.java
- * @run main AddExactILoopDependentTest
  *
+ * @run main compiler.intrinsics.mathexact.AddExactILoopDependentTest
  */
 
+package compiler.intrinsics.mathexact;
+
 public class AddExactILoopDependentTest {
   public static void main(String[] args) {
     Verify.LoopDependentTest.verify(new Verify.AddExactI());
diff --git a/hotspot/test/compiler/intrinsics/mathexact/AddExactINonConstantTest.java b/hotspot/test/compiler/intrinsics/mathexact/AddExactINonConstantTest.java
index 64d518e..d1f0d42 100644
--- a/hotspot/test/compiler/intrinsics/mathexact/AddExactINonConstantTest.java
+++ b/hotspot/test/compiler/intrinsics/mathexact/AddExactINonConstantTest.java
@@ -25,14 +25,15 @@
  * @test
  * @bug 8024924
  * @summary Test non constant addExact
- * @library /testlibrary
+ * @library /testlibrary /
  * @modules java.base/jdk.internal.misc
  *          java.management
- * @compile AddExactINonConstantTest.java Verify.java
- * @run main AddExactINonConstantTest
  *
+ * @run main compiler.intrinsics.mathexact.AddExactINonConstantTest
  */
 
+package compiler.intrinsics.mathexact;
+
 public class AddExactINonConstantTest {
   public static void main(String[] args) {
       Verify.NonConstantTest.verify(new Verify.AddExactI());
diff --git a/hotspot/test/compiler/intrinsics/mathexact/AddExactIRepeatTest.java b/hotspot/test/compiler/intrinsics/mathexact/AddExactIRepeatTest.java
index f1fe0c6..649962d 100644
--- a/hotspot/test/compiler/intrinsics/mathexact/AddExactIRepeatTest.java
+++ b/hotspot/test/compiler/intrinsics/mathexact/AddExactIRepeatTest.java
@@ -25,15 +25,17 @@
  * @test
  * @bug 8025657
  * @summary Test repeating addExact
- * @library /testlibrary
+ * @library /testlibrary /
  * @modules java.base/jdk.internal.misc
  *          java.management
- * @compile AddExactIRepeatTest.java Verify.java
- * @run main AddExactIRepeatTest
  *
+ * @run main compiler.intrinsics.mathexact.AddExactIRepeatTest
  */
 
+package compiler.intrinsics.mathexact;
+
 import jdk.test.lib.Utils;
+
 import java.util.Random;
 
 public class AddExactIRepeatTest {
diff --git a/hotspot/test/compiler/intrinsics/mathexact/AddExactLConstantTest.java b/hotspot/test/compiler/intrinsics/mathexact/AddExactLConstantTest.java
index 8e28266..10cf900 100644
--- a/hotspot/test/compiler/intrinsics/mathexact/AddExactLConstantTest.java
+++ b/hotspot/test/compiler/intrinsics/mathexact/AddExactLConstantTest.java
@@ -25,14 +25,15 @@
  * @test
  * @bug 8026844
  * @summary Test constant addExact
- * @library /testlibrary
+ * @library /testlibrary /
  * @modules java.base/jdk.internal.misc
  *          java.management
- * @compile AddExactLConstantTest.java Verify.java
- * @run main AddExactLConstantTest
  *
+ * @run main compiler.intrinsics.mathexact.AddExactLConstantTest
  */
 
+package compiler.intrinsics.mathexact;
+
 public class AddExactLConstantTest {
     public static void main(String[] args) {
         Verify.ConstantLongTest.verify(new Verify.AddExactL());
diff --git a/hotspot/test/compiler/intrinsics/mathexact/AddExactLNonConstantTest.java b/hotspot/test/compiler/intrinsics/mathexact/AddExactLNonConstantTest.java
index 969899c..32765a5 100644
--- a/hotspot/test/compiler/intrinsics/mathexact/AddExactLNonConstantTest.java
+++ b/hotspot/test/compiler/intrinsics/mathexact/AddExactLNonConstantTest.java
@@ -25,14 +25,15 @@
  * @test
  * @bug 8026844
  * @summary Test non constant addExact
- * @library /testlibrary
+ * @library /testlibrary /
  * @modules java.base/jdk.internal.misc
  *          java.management
- * @compile AddExactLNonConstantTest.java Verify.java
- * @run main AddExactLNonConstantTest
  *
+ * @run main compiler.intrinsics.mathexact.AddExactLNonConstantTest
  */
 
+package compiler.intrinsics.mathexact;
+
 public class AddExactLNonConstantTest {
     public static void main(String[] args) {
         Verify.NonConstantLongTest.verify(new Verify.AddExactL());
diff --git a/hotspot/test/compiler/intrinsics/mathexact/CompareTest.java b/hotspot/test/compiler/intrinsics/mathexact/CompareTest.java
index f6785c0..cd9f30b 100644
--- a/hotspot/test/compiler/intrinsics/mathexact/CompareTest.java
+++ b/hotspot/test/compiler/intrinsics/mathexact/CompareTest.java
@@ -25,11 +25,13 @@
  * @test
  * @bug 8026722
  * @summary Verify that the compare after addExact is a signed compare
- * @compile CompareTest.java
- * @run main CompareTest
  *
+ * @run main compiler.intrinsics.mathexact.CompareTest
  */
 
+
+package compiler.intrinsics.mathexact;
+
 public class CompareTest {
     public static long store = 0;
     public static long addValue = 1231;
diff --git a/hotspot/test/compiler/intrinsics/mathexact/DecExactITest.java b/hotspot/test/compiler/intrinsics/mathexact/DecExactITest.java
index fd76e36..2f77174 100644
--- a/hotspot/test/compiler/intrinsics/mathexact/DecExactITest.java
+++ b/hotspot/test/compiler/intrinsics/mathexact/DecExactITest.java
@@ -25,14 +25,15 @@
  * @test
  * @bug 8026844
  * @summary Test decrementExact
- * @library /testlibrary
+ * @library /testlibrary /
  * @modules java.base/jdk.internal.misc
  *          java.management
- * @compile DecExactITest.java Verify.java
- * @run main DecExactITest
  *
+ * @run main compiler.intrinsics.mathexact.DecExactITest
  */
 
+package compiler.intrinsics.mathexact;
+
 public class DecExactITest {
     public static int[] values = {1, 1, 1, 1};
     public static int[] minvalues = {Integer.MIN_VALUE, Integer.MIN_VALUE};
diff --git a/hotspot/test/compiler/intrinsics/mathexact/DecExactLTest.java b/hotspot/test/compiler/intrinsics/mathexact/DecExactLTest.java
index 2399b9b..a24db22 100644
--- a/hotspot/test/compiler/intrinsics/mathexact/DecExactLTest.java
+++ b/hotspot/test/compiler/intrinsics/mathexact/DecExactLTest.java
@@ -25,14 +25,15 @@
  * @test
  * @bug 8026844
  * @summary Test decrementExact
- * @library /testlibrary
+ * @library /testlibrary /
  * @modules java.base/jdk.internal.misc
  *          java.management
- * @compile DecExactLTest.java Verify.java
- * @run main DecExactLTest
  *
+ * @run main compiler.intrinsics.mathexact.DecExactLTest
  */
 
+package compiler.intrinsics.mathexact;
+
 public class DecExactLTest {
     public static long[] values = {1, 1, 1, 1};
     public static long[] minvalues = {Long.MIN_VALUE, Long.MIN_VALUE};
diff --git a/hotspot/test/compiler/intrinsics/mathexact/GVNTest.java b/hotspot/test/compiler/intrinsics/mathexact/GVNTest.java
index 23fba15..99cebc2 100644
--- a/hotspot/test/compiler/intrinsics/mathexact/GVNTest.java
+++ b/hotspot/test/compiler/intrinsics/mathexact/GVNTest.java
@@ -25,11 +25,12 @@
  * @test
  * @bug 8028207
  * @summary Verify that GVN doesn't mess up the two addExacts
- * @compile GVNTest.java
- * @run main GVNTest
  *
+ * @run main compiler.intrinsics.mathexact.GVNTest
  */
 
+package compiler.intrinsics.mathexact;
+
 public class GVNTest {
   public static int result = 0;
   public static int value = 93;
diff --git a/hotspot/test/compiler/intrinsics/mathexact/IncExactITest.java b/hotspot/test/compiler/intrinsics/mathexact/IncExactITest.java
index d4f5a80..8d38cf4 100644
--- a/hotspot/test/compiler/intrinsics/mathexact/IncExactITest.java
+++ b/hotspot/test/compiler/intrinsics/mathexact/IncExactITest.java
@@ -25,14 +25,15 @@
  * @test
  * @bug 8026844
  * @summary Test incrementExact
- * @library /testlibrary
+ * @library /testlibrary /
  * @modules java.base/jdk.internal.misc
  *          java.management
- * @compile IncExactITest.java Verify.java
- * @run main IncExactITest
+ *
+ * @run main compiler.intrinsics.mathexact.IncExactITest
  *
  */
 
+package compiler.intrinsics.mathexact;
 
 public class IncExactITest {
     public static int[] values = {1, 1, 1, 1};
diff --git a/hotspot/test/compiler/intrinsics/mathexact/IncExactLTest.java b/hotspot/test/compiler/intrinsics/mathexact/IncExactLTest.java
index a4b456f..3634764 100644
--- a/hotspot/test/compiler/intrinsics/mathexact/IncExactLTest.java
+++ b/hotspot/test/compiler/intrinsics/mathexact/IncExactLTest.java
@@ -25,14 +25,15 @@
  * @test
  * @bug 8026844
  * @summary Test incrementExact
- * @library /testlibrary
+ * @library /testlibrary /
  * @modules java.base/jdk.internal.misc
  *          java.management
- * @compile IncExactLTest.java Verify.java
- * @run main IncExactLTest
  *
+ * @run main compiler.intrinsics.mathexact.IncExactLTest
  */
 
+package compiler.intrinsics.mathexact;
+
 public class IncExactLTest {
     public static long[] values = {1, 1, 1, 1};
     public static void main(String[] args) {
diff --git a/hotspot/test/compiler/intrinsics/mathexact/MulExactICondTest.java b/hotspot/test/compiler/intrinsics/mathexact/MulExactICondTest.java
index 5f3e1e6..d2da958 100644
--- a/hotspot/test/compiler/intrinsics/mathexact/MulExactICondTest.java
+++ b/hotspot/test/compiler/intrinsics/mathexact/MulExactICondTest.java
@@ -25,11 +25,12 @@
  * @test
  * @bug 8026844
  * @summary Test multiplyExact as condition
- * @compile MulExactICondTest.java
- * @run main MulExactICondTest
  *
+ * @run main compiler.intrinsics.mathexact.MulExactICondTest
  */
 
+package compiler.intrinsics.mathexact;
+
 public class MulExactICondTest {
     public static int result = 0;
 
diff --git a/hotspot/test/compiler/intrinsics/mathexact/MulExactIConstantTest.java b/hotspot/test/compiler/intrinsics/mathexact/MulExactIConstantTest.java
index 9b0ef70..d30cb0d 100644
--- a/hotspot/test/compiler/intrinsics/mathexact/MulExactIConstantTest.java
+++ b/hotspot/test/compiler/intrinsics/mathexact/MulExactIConstantTest.java
@@ -25,14 +25,15 @@
  * @test
  * @bug 8026844
  * @summary Test constant multiplyExact
- * @library /testlibrary
+ * @library /testlibrary /
  * @modules java.base/jdk.internal.misc
  *          java.management
- * @compile MulExactIConstantTest.java Verify.java
- * @run main MulExactIConstantTest
  *
+ * @run main compiler.intrinsics.mathexact.MulExactIConstantTest
  */
 
+package compiler.intrinsics.mathexact;
+
 public class MulExactIConstantTest {
     public static void main(String[] args) {
         Verify.ConstantTest.verify(new Verify.MulExactI());
diff --git a/hotspot/test/compiler/intrinsics/mathexact/MulExactILoadTest.java b/hotspot/test/compiler/intrinsics/mathexact/MulExactILoadTest.java
index 5b24bb6..7db6a1d 100644
--- a/hotspot/test/compiler/intrinsics/mathexact/MulExactILoadTest.java
+++ b/hotspot/test/compiler/intrinsics/mathexact/MulExactILoadTest.java
@@ -25,14 +25,15 @@
  * @test
  * @bug 8026844
  * @summary Test multiplyExact
- * @library /testlibrary
+ * @library /testlibrary /
  * @modules java.base/jdk.internal.misc
  *          java.management
- * @compile MulExactILoadTest.java Verify.java
- * @run main MulExactILoadTest
  *
+ * @run main compiler.intrinsics.mathexact.MulExactILoadTest
  */
 
+package compiler.intrinsics.mathexact;
+
 public class MulExactILoadTest {
     public static void main(String[] args) {
         Verify.LoadTest.init();
diff --git a/hotspot/test/compiler/intrinsics/mathexact/MulExactILoopDependentTest.java b/hotspot/test/compiler/intrinsics/mathexact/MulExactILoopDependentTest.java
index c37ee65..086b530 100644
--- a/hotspot/test/compiler/intrinsics/mathexact/MulExactILoopDependentTest.java
+++ b/hotspot/test/compiler/intrinsics/mathexact/MulExactILoopDependentTest.java
@@ -25,13 +25,15 @@
  * @test
  * @bug 8026844
  * @summary Test loop dependent multiplyExact
- * @library /testlibrary
+ * @library /testlibrary /
  * @modules java.base/jdk.internal.misc
  *          java.management
- * @compile MulExactILoopDependentTest.java Verify.java
- * @run main MulExactILoopDependentTest
  *
+ * @run main compiler.intrinsics.mathexact.MulExactILoopDependentTest
  */
+
+package compiler.intrinsics.mathexact;
+
 public class MulExactILoopDependentTest {
     public static void main(String[] args) {
         Verify.LoopDependentTest.verify(new Verify.MulExactI());
diff --git a/hotspot/test/compiler/intrinsics/mathexact/MulExactINonConstantTest.java b/hotspot/test/compiler/intrinsics/mathexact/MulExactINonConstantTest.java
index ed0e4f9..2ef12ea 100644
--- a/hotspot/test/compiler/intrinsics/mathexact/MulExactINonConstantTest.java
+++ b/hotspot/test/compiler/intrinsics/mathexact/MulExactINonConstantTest.java
@@ -25,14 +25,15 @@
  * @test
  * @bug 8026844
  * @summary Test non constant multiplyExact
- * @library /testlibrary
+ * @library /testlibrary /
  * @modules java.base/jdk.internal.misc
  *          java.management
- * @compile MulExactINonConstantTest.java Verify.java
- * @run main MulExactINonConstantTest
  *
+ * @run main compiler.intrinsics.mathexact.MulExactINonConstantTest
  */
 
+package compiler.intrinsics.mathexact;
+
 public class MulExactINonConstantTest {
     public static void main(String[] args) {
         Verify.NonConstantTest.verify(new Verify.MulExactI());
diff --git a/hotspot/test/compiler/intrinsics/mathexact/MulExactIRepeatTest.java b/hotspot/test/compiler/intrinsics/mathexact/MulExactIRepeatTest.java
index d404cac..f1174d7 100644
--- a/hotspot/test/compiler/intrinsics/mathexact/MulExactIRepeatTest.java
+++ b/hotspot/test/compiler/intrinsics/mathexact/MulExactIRepeatTest.java
@@ -25,15 +25,17 @@
  * @test
  * @bug 8026844
  * @summary Test repeating multiplyExact
- * @library /testlibrary
+ * @library /testlibrary /
  * @modules java.base/jdk.internal.misc
  *          java.management
- * @compile MulExactIRepeatTest.java Verify.java
- * @run main MulExactIRepeatTest
  *
+ * @run main compiler.intrinsics.mathexact.MulExactIRepeatTest
  */
 
+package compiler.intrinsics.mathexact;
+
 import jdk.test.lib.Utils;
+
 import java.util.Random;
 
 public class MulExactIRepeatTest {
diff --git a/hotspot/test/compiler/intrinsics/mathexact/MulExactLConstantTest.java b/hotspot/test/compiler/intrinsics/mathexact/MulExactLConstantTest.java
index f45f31d..b340670 100644
--- a/hotspot/test/compiler/intrinsics/mathexact/MulExactLConstantTest.java
+++ b/hotspot/test/compiler/intrinsics/mathexact/MulExactLConstantTest.java
@@ -25,14 +25,15 @@
  * @test
  * @bug 8026844
  * @summary Test constant mulExact
- * @library /testlibrary
+ * @library /testlibrary /
  * @modules java.base/jdk.internal.misc
  *          java.management
- * @compile MulExactLConstantTest.java Verify.java
- * @run main MulExactLConstantTest
  *
+ * @run main compiler.intrinsics.mathexact.MulExactLConstantTest
  */
 
+package compiler.intrinsics.mathexact;
+
 public class MulExactLConstantTest {
     public static void main(String[] args) {
         Verify.ConstantLongTest.verify(new Verify.MulExactL());
diff --git a/hotspot/test/compiler/intrinsics/mathexact/MulExactLNonConstantTest.java b/hotspot/test/compiler/intrinsics/mathexact/MulExactLNonConstantTest.java
index 4dee223..ef6acae 100644
--- a/hotspot/test/compiler/intrinsics/mathexact/MulExactLNonConstantTest.java
+++ b/hotspot/test/compiler/intrinsics/mathexact/MulExactLNonConstantTest.java
@@ -25,14 +25,15 @@
  * @test
  * @bug 8026844
  * @summary Test non constant mulExact
- * @library /testlibrary
+ * @library /testlibrary /
  * @modules java.base/jdk.internal.misc
  *          java.management
- * @compile MulExactLNonConstantTest.java Verify.java
- * @run main MulExactLNonConstantTest
  *
+ * @run main compiler.intrinsics.mathexact.MulExactLNonConstantTest
  */
 
+package compiler.intrinsics.mathexact;
+
 public class MulExactLNonConstantTest {
     public static void main(String[] args) {
         Verify.NonConstantLongTest.verify(new Verify.MulExactL());
diff --git a/hotspot/test/compiler/intrinsics/mathexact/NegExactIConstantTest.java b/hotspot/test/compiler/intrinsics/mathexact/NegExactIConstantTest.java
index fc285e1..85ef97a 100644
--- a/hotspot/test/compiler/intrinsics/mathexact/NegExactIConstantTest.java
+++ b/hotspot/test/compiler/intrinsics/mathexact/NegExactIConstantTest.java
@@ -25,14 +25,15 @@
  * @test
  * @bug 8026844
  * @summary Test constant negExact
- * @library /testlibrary
+ * @library /testlibrary /
  * @modules java.base/jdk.internal.misc
  *          java.management
- * @compile NegExactIConstantTest.java Verify.java
- * @run main NegExactIConstantTest
  *
+ * @run main compiler.intrinsics.mathexact.NegExactIConstantTest
  */
 
+package compiler.intrinsics.mathexact;
+
 public class NegExactIConstantTest {
     public static void main(String[] args) {
         Verify.ConstantTest.verify(new Verify.UnaryToBinary(new Verify.NegExactI()));
diff --git a/hotspot/test/compiler/intrinsics/mathexact/NegExactILoadTest.java b/hotspot/test/compiler/intrinsics/mathexact/NegExactILoadTest.java
index 74aeb86..9b00f83 100644
--- a/hotspot/test/compiler/intrinsics/mathexact/NegExactILoadTest.java
+++ b/hotspot/test/compiler/intrinsics/mathexact/NegExactILoadTest.java
@@ -25,14 +25,15 @@
  * @test
  * @bug 8026844
  * @summary Test negExact
- * @library /testlibrary
+ * @library /testlibrary /
  * @modules java.base/jdk.internal.misc
  *          java.management
- * @compile NegExactILoadTest.java Verify.java
- * @run main NegExactILoadTest
  *
+ * @run main compiler.intrinsics.mathexact.NegExactILoadTest
  */
 
+package compiler.intrinsics.mathexact;
+
 public class NegExactILoadTest {
     public static void main(String[] args) {
       Verify.LoadTest.init();
diff --git a/hotspot/test/compiler/intrinsics/mathexact/NegExactILoopDependentTest.java b/hotspot/test/compiler/intrinsics/mathexact/NegExactILoopDependentTest.java
index 1d7a1e3..48b02c0 100644
--- a/hotspot/test/compiler/intrinsics/mathexact/NegExactILoopDependentTest.java
+++ b/hotspot/test/compiler/intrinsics/mathexact/NegExactILoopDependentTest.java
@@ -25,13 +25,15 @@
  * @test
  * @bug 8026844
  * @summary Test negExact loop dependent
- * @library /testlibrary
+ * @library /testlibrary /
  * @modules java.base/jdk.internal.misc
  *          java.management
- * @compile NegExactILoopDependentTest.java Verify.java
- * @run main NegExactILoopDependentTest
  *
+ * @run main compiler.intrinsics.mathexact.NegExactILoopDependentTest
  */
+
+package compiler.intrinsics.mathexact;
+
 public class NegExactILoopDependentTest {
     public static void main(String[] args) {
         Verify.LoopDependentTest.verify(new Verify.UnaryToBinary(new Verify.NegExactI()));
diff --git a/hotspot/test/compiler/intrinsics/mathexact/NegExactINonConstantTest.java b/hotspot/test/compiler/intrinsics/mathexact/NegExactINonConstantTest.java
index b7f7736..34a20d6 100644
--- a/hotspot/test/compiler/intrinsics/mathexact/NegExactINonConstantTest.java
+++ b/hotspot/test/compiler/intrinsics/mathexact/NegExactINonConstantTest.java
@@ -25,14 +25,15 @@
  * @test
  * @bug 8026844
  * @summary Test non constant negExact
- * @library /testlibrary
+ * @library /testlibrary /
  * @modules java.base/jdk.internal.misc
  *          java.management
- * @compile NegExactINonConstantTest.java Verify.java
- * @run main NegExactINonConstantTest
  *
+ * @run main compiler.intrinsics.mathexact.NegExactINonConstantTest
  */
 
+package compiler.intrinsics.mathexact;
+
 public class NegExactINonConstantTest {
     public static void main(String[] args) {
         Verify.NonConstantTest.verify(new Verify.UnaryToBinary(new Verify.NegExactI()));
diff --git a/hotspot/test/compiler/intrinsics/mathexact/NegExactLConstantTest.java b/hotspot/test/compiler/intrinsics/mathexact/NegExactLConstantTest.java
index b10da7b..b1d086a 100644
--- a/hotspot/test/compiler/intrinsics/mathexact/NegExactLConstantTest.java
+++ b/hotspot/test/compiler/intrinsics/mathexact/NegExactLConstantTest.java
@@ -25,14 +25,15 @@
  * @test
  * @bug 8026844
  * @summary Test constant negExact
- * @library /testlibrary
+ * @library /testlibrary /
  * @modules java.base/jdk.internal.misc
  *          java.management
- * @compile NegExactLConstantTest.java Verify.java
- * @run main NegExactLConstantTest
  *
+ * @run main compiler.intrinsics.mathexact.NegExactLConstantTest
  */
 
+package compiler.intrinsics.mathexact;
+
 public class NegExactLConstantTest {
     public static void main(String[] args) {
         Verify.ConstantLongTest.verify(new Verify.UnaryToBinaryLong(new Verify.NegExactL()));
diff --git a/hotspot/test/compiler/intrinsics/mathexact/NegExactLNonConstantTest.java b/hotspot/test/compiler/intrinsics/mathexact/NegExactLNonConstantTest.java
index c3ecae7..f28d298 100644
--- a/hotspot/test/compiler/intrinsics/mathexact/NegExactLNonConstantTest.java
+++ b/hotspot/test/compiler/intrinsics/mathexact/NegExactLNonConstantTest.java
@@ -25,14 +25,15 @@
  * @test
  * @bug 8026844
  * @summary Test constant negExact
- * @library /testlibrary
+ * @library /testlibrary /
  * @modules java.base/jdk.internal.misc
  *          java.management
- * @compile NegExactLNonConstantTest.java Verify.java
- * @run main NegExactLNonConstantTest
  *
+ * @run main compiler.intrinsics.mathexact.NegExactLNonConstantTest
  */
 
+package compiler.intrinsics.mathexact;
+
 public class NegExactLNonConstantTest {
     public static void main(String[] args) {
         Verify.NonConstantLongTest.verify(new Verify.UnaryToBinaryLong(new Verify.NegExactL()));
diff --git a/hotspot/test/compiler/intrinsics/mathexact/NestedMathExactTest.java b/hotspot/test/compiler/intrinsics/mathexact/NestedMathExactTest.java
index 211dc8b..0ae5396 100644
--- a/hotspot/test/compiler/intrinsics/mathexact/NestedMathExactTest.java
+++ b/hotspot/test/compiler/intrinsics/mathexact/NestedMathExactTest.java
@@ -25,11 +25,12 @@
  * @test
  * @bug 8027444
  * @summary Test nested loops
- * @compile NestedMathExactTest.java
- * @run main NestedMathExactTest
  *
+ * @run main compiler.intrinsics.mathexact.NestedMathExactTest
  */
 
+package compiler.intrinsics.mathexact;
+
 public class NestedMathExactTest {
     public static final int LIMIT = 100;
     public static int[] result = new int[LIMIT];
diff --git a/hotspot/test/compiler/intrinsics/mathexact/SplitThruPhiTest.java b/hotspot/test/compiler/intrinsics/mathexact/SplitThruPhiTest.java
index b3b0c0d..758e33a 100644
--- a/hotspot/test/compiler/intrinsics/mathexact/SplitThruPhiTest.java
+++ b/hotspot/test/compiler/intrinsics/mathexact/SplitThruPhiTest.java
@@ -25,11 +25,12 @@
  * @test
  * @bug 8028198
  * @summary Verify that split through phi does the right thing
- * @compile SplitThruPhiTest.java
- * @run main SplitThruPhiTest
  *
+ * @run main compiler.intrinsics.mathexact.SplitThruPhiTest
  */
 
+package compiler.intrinsics.mathexact;
+
 public class SplitThruPhiTest {
   public static volatile int value = 19;
   public static int store = 0;
diff --git a/hotspot/test/compiler/intrinsics/mathexact/SubExactICondTest.java b/hotspot/test/compiler/intrinsics/mathexact/SubExactICondTest.java
index 249b459..95a177f 100644
--- a/hotspot/test/compiler/intrinsics/mathexact/SubExactICondTest.java
+++ b/hotspot/test/compiler/intrinsics/mathexact/SubExactICondTest.java
@@ -25,14 +25,15 @@
  * @test
  * @bug 8026844
  * @summary Test subtractExact as condition
- * @library /testlibrary
+ * @library /testlibrary /
  * @modules java.base/jdk.internal.misc
  *          java.management
- * @compile SubExactICondTest.java Verify.java
- * @run main SubExactICondTest
  *
+ * @run main compiler.intrinsics.mathexact.SubExactICondTest
  */
 
+package compiler.intrinsics.mathexact;
+
 public class SubExactICondTest {
   public static int result = 0;
 
diff --git a/hotspot/test/compiler/intrinsics/mathexact/SubExactIConstantTest.java b/hotspot/test/compiler/intrinsics/mathexact/SubExactIConstantTest.java
index cb4cd77..bcb9a1a 100644
--- a/hotspot/test/compiler/intrinsics/mathexact/SubExactIConstantTest.java
+++ b/hotspot/test/compiler/intrinsics/mathexact/SubExactIConstantTest.java
@@ -25,14 +25,15 @@
  * @test
  * @bug 8026844
  * @summary Test constant subtractExact
- * @library /testlibrary
+ * @library /testlibrary /
  * @modules java.base/jdk.internal.misc
  *          java.management
- * @compile SubExactIConstantTest.java Verify.java
- * @run main SubExactIConstantTest
  *
+ * @run main compiler.intrinsics.mathexact.SubExactIConstantTest
  */
 
+package compiler.intrinsics.mathexact;
+
 public class SubExactIConstantTest {
   public static void main(String[] args) {
       Verify.ConstantTest.verify(new Verify.SubExactI());
diff --git a/hotspot/test/compiler/intrinsics/mathexact/SubExactILoadTest.java b/hotspot/test/compiler/intrinsics/mathexact/SubExactILoadTest.java
index e88486a..186f629 100644
--- a/hotspot/test/compiler/intrinsics/mathexact/SubExactILoadTest.java
+++ b/hotspot/test/compiler/intrinsics/mathexact/SubExactILoadTest.java
@@ -25,14 +25,15 @@
  * @test
  * @bug 8026844
  * @summary Test non constant subtractExact
- * @library /testlibrary
+ * @library /testlibrary /
  * @modules java.base/jdk.internal.misc
  *          java.management
- * @compile SubExactILoadTest.java Verify.java
- * @run main SubExactILoadTest
  *
+ * @run main compiler.intrinsics.mathexact.SubExactILoadTest
  */
 
+package compiler.intrinsics.mathexact;
+
 public class SubExactILoadTest {
   public static void main(String[] args) {
       Verify.LoadTest.init();
diff --git a/hotspot/test/compiler/intrinsics/mathexact/SubExactILoopDependentTest.java b/hotspot/test/compiler/intrinsics/mathexact/SubExactILoopDependentTest.java
index 4afec64..880425e 100644
--- a/hotspot/test/compiler/intrinsics/mathexact/SubExactILoopDependentTest.java
+++ b/hotspot/test/compiler/intrinsics/mathexact/SubExactILoopDependentTest.java
@@ -25,14 +25,15 @@
  * @test
  * @bug 8026844
  * @summary Test non constant subtractExact
- * @library /testlibrary
+ * @library /testlibrary /
  * @modules java.base/jdk.internal.misc
  *          java.management
- * @compile SubExactILoopDependentTest.java Verify.java
- * @run main SubExactILoopDependentTest
  *
+ * @run main compiler.intrinsics.mathexact.SubExactILoopDependentTest
  */
 
+package compiler.intrinsics.mathexact;
+
 public class SubExactILoopDependentTest {
   public static void main(String[] args) {
       Verify.LoopDependentTest.verify(new Verify.SubExactI());
diff --git a/hotspot/test/compiler/intrinsics/mathexact/SubExactINonConstantTest.java b/hotspot/test/compiler/intrinsics/mathexact/SubExactINonConstantTest.java
index a9c1efb..222649d 100644
--- a/hotspot/test/compiler/intrinsics/mathexact/SubExactINonConstantTest.java
+++ b/hotspot/test/compiler/intrinsics/mathexact/SubExactINonConstantTest.java
@@ -25,14 +25,15 @@
  * @test
  * @bug 8026844
  * @summary Test non constant subtractExact
- * @library /testlibrary
+ * @library /testlibrary /
  * @modules java.base/jdk.internal.misc
  *          java.management
- * @compile SubExactINonConstantTest.java Verify.java
- * @run main SubExactINonConstantTest
  *
+ * @run main compiler.intrinsics.mathexact.SubExactINonConstantTest
  */
 
+package compiler.intrinsics.mathexact;
+
 public class SubExactINonConstantTest {
     public static void main(String[] args) {
         Verify.NonConstantTest.verify(new Verify.SubExactI());
diff --git a/hotspot/test/compiler/intrinsics/mathexact/SubExactIRepeatTest.java b/hotspot/test/compiler/intrinsics/mathexact/SubExactIRepeatTest.java
index 1e13314..49631cf 100644
--- a/hotspot/test/compiler/intrinsics/mathexact/SubExactIRepeatTest.java
+++ b/hotspot/test/compiler/intrinsics/mathexact/SubExactIRepeatTest.java
@@ -25,15 +25,17 @@
  * @test
  * @bug 8026844
  * @summary Test repeating subtractExact
- * @library /testlibrary
+ * @library /testlibrary /
  * @modules java.base/jdk.internal.misc
  *          java.management
- * @compile SubExactIRepeatTest.java Verify.java
- * @run main SubExactIRepeatTest
  *
+ * @run main compiler.intrinsics.mathexact.SubExactIRepeatTest
  */
 
+package compiler.intrinsics.mathexact;
+
 import jdk.test.lib.Utils;
+
 import java.util.Random;
 
 public class SubExactIRepeatTest {
diff --git a/hotspot/test/compiler/intrinsics/mathexact/SubExactLConstantTest.java b/hotspot/test/compiler/intrinsics/mathexact/SubExactLConstantTest.java
index d973027..996dab7 100644
--- a/hotspot/test/compiler/intrinsics/mathexact/SubExactLConstantTest.java
+++ b/hotspot/test/compiler/intrinsics/mathexact/SubExactLConstantTest.java
@@ -26,14 +26,15 @@
  * @bug 8026844
  * @bug 8027353
  * @summary Test constant subtractExact
- * @library /testlibrary
+ * @library /testlibrary /
  * @modules java.base/jdk.internal.misc
  *          java.management
- * @compile SubExactLConstantTest.java Verify.java
- * @run main SubExactLConstantTest
  *
+ * @run main compiler.intrinsics.mathexact.SubExactLConstantTest
  */
 
+package compiler.intrinsics.mathexact;
+
 public class SubExactLConstantTest {
     public static void main(String[] args) {
         Verify.ConstantLongTest.verify(new Verify.SubExactL());
diff --git a/hotspot/test/compiler/intrinsics/mathexact/SubExactLNonConstantTest.java b/hotspot/test/compiler/intrinsics/mathexact/SubExactLNonConstantTest.java
index be9badc..d1d1173 100644
--- a/hotspot/test/compiler/intrinsics/mathexact/SubExactLNonConstantTest.java
+++ b/hotspot/test/compiler/intrinsics/mathexact/SubExactLNonConstantTest.java
@@ -26,14 +26,15 @@
  * @bug 8026844
  * @bug 8027353
  * @summary Test non constant subtractExact
- * @library /testlibrary
+ * @library /testlibrary /
  * @modules java.base/jdk.internal.misc
  *          java.management
- * @compile SubExactLNonConstantTest.java Verify.java
- * @run main SubExactLNonConstantTest
  *
+ * @run main compiler.intrinsics.mathexact.SubExactLNonConstantTest
  */
 
+package compiler.intrinsics.mathexact;
+
 public class SubExactLNonConstantTest {
     public static void main(String[] args) {
         Verify.NonConstantLongTest.verify(new Verify.SubExactL());
diff --git a/hotspot/test/compiler/intrinsics/mathexact/Verify.java b/hotspot/test/compiler/intrinsics/mathexact/Verify.java
index 98d3b0b..c8e0cb3 100644
--- a/hotspot/test/compiler/intrinsics/mathexact/Verify.java
+++ b/hotspot/test/compiler/intrinsics/mathexact/Verify.java
@@ -21,7 +21,10 @@
  * questions.
  */
 
+package compiler.intrinsics.mathexact;
+
 import jdk.test.lib.Utils;
+
 import java.util.Random;
 
 /**
diff --git a/hotspot/test/compiler/intrinsics/mathexact/sanity/AddExactIntTest.java b/hotspot/test/compiler/intrinsics/mathexact/sanity/AddExactIntTest.java
index b9b643d..5b701af 100644
--- a/hotspot/test/compiler/intrinsics/mathexact/sanity/AddExactIntTest.java
+++ b/hotspot/test/compiler/intrinsics/mathexact/sanity/AddExactIntTest.java
@@ -26,20 +26,25 @@
  * @library /testlibrary /test/lib /
  * @modules java.base/jdk.internal.misc
  *          java.management
- * @build AddExactIntTest
+ *
+ * @build compiler.intrinsics.mathexact.sanity.AddExactIntTest
  * @run driver ClassFileInstaller sun.hotspot.WhiteBox
  *                                sun.hotspot.WhiteBox$WhiteBoxPermission
  * @run main/othervm -Xbootclasspath/a:. -XX:+UnlockDiagnosticVMOptions
  *                   -XX:+IgnoreUnrecognizedVMOptions -XX:+WhiteBoxAPI -XX:+LogCompilation
- *                   -XX:CompileCommand=compileonly,MathIntrinsic*::execMathMethod
- *                   -XX:LogFile=hs_neg.log -XX:-UseMathExactIntrinsics AddExactIntTest
+ *                   -XX:CompileCommand=compileonly,compiler.intrinsics.mathexact.sanity.MathIntrinsic*::execMathMethod
+ *                   -XX:LogFile=hs_neg.log -XX:-UseMathExactIntrinsics
+ *                   compiler.intrinsics.mathexact.sanity.AddExactIntTest
  * @run main/othervm -Xbootclasspath/a:. -XX:+UnlockDiagnosticVMOptions
  *                   -XX:+IgnoreUnrecognizedVMOptions -XX:+WhiteBoxAPI -XX:+LogCompilation
- *                   -XX:CompileCommand=compileonly,MathIntrinsic*::execMathMethod
- *                   -XX:LogFile=hs.log -XX:+UseMathExactIntrinsics AddExactIntTest
+ *                   -XX:CompileCommand=compileonly,compiler.intrinsics.mathexact.sanity.MathIntrinsic*::execMathMethod
+ *                   -XX:LogFile=hs.log -XX:+UseMathExactIntrinsics
+ *                   compiler.intrinsics.mathexact.sanity.AddExactIntTest
  * @run driver compiler.testlibrary.intrinsics.Verifier hs_neg.log hs.log
  */
 
+package compiler.intrinsics.mathexact.sanity;
+
 public class AddExactIntTest {
 
     public static void main(String[] args) throws Exception {
diff --git a/hotspot/test/compiler/intrinsics/mathexact/sanity/AddExactLongTest.java b/hotspot/test/compiler/intrinsics/mathexact/sanity/AddExactLongTest.java
index 45f78d4..48dfddd 100644
--- a/hotspot/test/compiler/intrinsics/mathexact/sanity/AddExactLongTest.java
+++ b/hotspot/test/compiler/intrinsics/mathexact/sanity/AddExactLongTest.java
@@ -26,20 +26,25 @@
  * @library /testlibrary /test/lib /
  * @modules java.base/jdk.internal.misc
  *          java.management
- * @build AddExactLongTest
+ *
+ * @build compiler.intrinsics.mathexact.sanity.AddExactLongTest
  * @run driver ClassFileInstaller sun.hotspot.WhiteBox
  *                                sun.hotspot.WhiteBox$WhiteBoxPermission
  * @run main/othervm -Xbootclasspath/a:. -XX:+UnlockDiagnosticVMOptions
  *                   -XX:+IgnoreUnrecognizedVMOptions -XX:+WhiteBoxAPI -XX:+LogCompilation
- *                   -XX:CompileCommand=compileonly,MathIntrinsic*::execMathMethod
- *                   -XX:LogFile=hs_neg.log -XX:-UseMathExactIntrinsics AddExactLongTest
+ *                   -XX:CompileCommand=compileonly,compiler.intrinsics.mathexact.sanity.MathIntrinsic*::execMathMethod
+ *                   -XX:LogFile=hs_neg.log -XX:-UseMathExactIntrinsics
+ *                   compiler.intrinsics.mathexact.sanity.AddExactLongTest
  * @run main/othervm -Xbootclasspath/a:. -XX:+UnlockDiagnosticVMOptions
  *                   -XX:+IgnoreUnrecognizedVMOptions -XX:+WhiteBoxAPI -XX:+LogCompilation
- *                   -XX:CompileCommand=compileonly,MathIntrinsic*::execMathMethod
- *                   -XX:LogFile=hs.log -XX:+UseMathExactIntrinsics AddExactLongTest
+ *                   -XX:CompileCommand=compileonly,compiler.intrinsics.mathexact.sanity.MathIntrinsic*::execMathMethod
+ *                   -XX:LogFile=hs.log -XX:+UseMathExactIntrinsics
+ *                   compiler.intrinsics.mathexact.sanity.AddExactLongTest
  * @run driver compiler.testlibrary.intrinsics.Verifier hs_neg.log hs.log
  */
 
+package compiler.intrinsics.mathexact.sanity;
+
 public class AddExactLongTest {
 
     public static void main(String[] args) throws Exception {
diff --git a/hotspot/test/compiler/intrinsics/mathexact/sanity/DecrementExactIntTest.java b/hotspot/test/compiler/intrinsics/mathexact/sanity/DecrementExactIntTest.java
index 15f2d74..ff17806 100644
--- a/hotspot/test/compiler/intrinsics/mathexact/sanity/DecrementExactIntTest.java
+++ b/hotspot/test/compiler/intrinsics/mathexact/sanity/DecrementExactIntTest.java
@@ -26,20 +26,25 @@
  * @library /testlibrary /test/lib /
  * @modules java.base/jdk.internal.misc
  *          java.management
- * @build DecrementExactIntTest
+ *
+ * @build compiler.intrinsics.mathexact.sanity.DecrementExactIntTest
  * @run driver ClassFileInstaller sun.hotspot.WhiteBox
  *                                sun.hotspot.WhiteBox$WhiteBoxPermission
  * @run main/othervm -Xbootclasspath/a:. -XX:+UnlockDiagnosticVMOptions
  *                   -XX:+IgnoreUnrecognizedVMOptions -XX:+WhiteBoxAPI -XX:+LogCompilation
- *                   -XX:CompileCommand=compileonly,MathIntrinsic*::execMathMethod
- *                   -XX:LogFile=hs_neg.log -XX:-UseMathExactIntrinsics DecrementExactIntTest
+ *                   -XX:CompileCommand=compileonly,compiler.intrinsics.mathexact.sanity.MathIntrinsic*::execMathMethod
+ *                   -XX:LogFile=hs_neg.log -XX:-UseMathExactIntrinsics
+ *                   compiler.intrinsics.mathexact.sanity.DecrementExactIntTest
  * @run main/othervm -Xbootclasspath/a:. -XX:+UnlockDiagnosticVMOptions
  *                   -XX:+IgnoreUnrecognizedVMOptions -XX:+WhiteBoxAPI -XX:+LogCompilation
- *                   -XX:CompileCommand=compileonly,MathIntrinsic*::execMathMethod
- *                   -XX:LogFile=hs.log -XX:+UseMathExactIntrinsics DecrementExactIntTest
+ *                   -XX:CompileCommand=compileonly,compiler.intrinsics.mathexact.sanity.MathIntrinsic*::execMathMethod
+ *                   -XX:LogFile=hs.log -XX:+UseMathExactIntrinsics
+ *                   compiler.intrinsics.mathexact.sanity.DecrementExactIntTest
  * @run driver compiler.testlibrary.intrinsics.Verifier hs_neg.log hs.log
  */
 
+package compiler.intrinsics.mathexact.sanity;
+
 public class DecrementExactIntTest {
 
     public static void main(String[] args) throws Exception {
diff --git a/hotspot/test/compiler/intrinsics/mathexact/sanity/DecrementExactLongTest.java b/hotspot/test/compiler/intrinsics/mathexact/sanity/DecrementExactLongTest.java
index 97fad80..2683a59 100644
--- a/hotspot/test/compiler/intrinsics/mathexact/sanity/DecrementExactLongTest.java
+++ b/hotspot/test/compiler/intrinsics/mathexact/sanity/DecrementExactLongTest.java
@@ -26,20 +26,25 @@
  * @library /testlibrary /test/lib /
  * @modules java.base/jdk.internal.misc
  *          java.management
- * @build DecrementExactLongTest
+ *
+ * @build compiler.intrinsics.mathexact.sanity.DecrementExactLongTest
  * @run driver ClassFileInstaller sun.hotspot.WhiteBox
  *                                sun.hotspot.WhiteBox$WhiteBoxPermission
  * @run main/othervm -Xbootclasspath/a:. -XX:+UnlockDiagnosticVMOptions
  *                   -XX:+IgnoreUnrecognizedVMOptions -XX:+WhiteBoxAPI -XX:+LogCompilation
- *                   -XX:CompileCommand=compileonly,MathIntrinsic*::execMathMethod
- *                   -XX:LogFile=hs_neg.log -XX:-UseMathExactIntrinsics DecrementExactLongTest
+ *                   -XX:CompileCommand=compileonly,compiler.intrinsics.mathexact.sanity.MathIntrinsic*::execMathMethod
+ *                   -XX:LogFile=hs_neg.log -XX:-UseMathExactIntrinsics
+ *                   compiler.intrinsics.mathexact.sanity.DecrementExactLongTest
  * @run main/othervm -Xbootclasspath/a:. -XX:+UnlockDiagnosticVMOptions
  *                   -XX:+IgnoreUnrecognizedVMOptions -XX:+WhiteBoxAPI -XX:+LogCompilation
- *                   -XX:CompileCommand=compileonly,MathIntrinsic*::execMathMethod
- *                   -XX:LogFile=hs.log -XX:+UseMathExactIntrinsics DecrementExactLongTest
+ *                   -XX:CompileCommand=compileonly,compiler.intrinsics.mathexact.sanity.MathIntrinsic*::execMathMethod
+ *                   -XX:LogFile=hs.log -XX:+UseMathExactIntrinsics
+ *                   compiler.intrinsics.mathexact.sanity.DecrementExactLongTest
  * @run driver compiler.testlibrary.intrinsics.Verifier hs_neg.log hs.log
  */
 
+package compiler.intrinsics.mathexact.sanity;
+
 public class DecrementExactLongTest {
 
     public static void main(String[] args) throws Exception {
diff --git a/hotspot/test/compiler/intrinsics/mathexact/sanity/IncrementExactIntTest.java b/hotspot/test/compiler/intrinsics/mathexact/sanity/IncrementExactIntTest.java
index b1125c0..4c6569a 100644
--- a/hotspot/test/compiler/intrinsics/mathexact/sanity/IncrementExactIntTest.java
+++ b/hotspot/test/compiler/intrinsics/mathexact/sanity/IncrementExactIntTest.java
@@ -26,20 +26,25 @@
  * @library /testlibrary /test/lib /
  * @modules java.base/jdk.internal.misc
  *          java.management
- * @build IncrementExactIntTest
+ *
+ * @build compiler.intrinsics.mathexact.sanity.IncrementExactIntTest
  * @run driver ClassFileInstaller sun.hotspot.WhiteBox
  *                                sun.hotspot.WhiteBox$WhiteBoxPermission
  * @run main/othervm -Xbootclasspath/a:. -XX:+UnlockDiagnosticVMOptions
  *                   -XX:+IgnoreUnrecognizedVMOptions -XX:+WhiteBoxAPI -XX:+LogCompilation
- *                   -XX:CompileCommand=compileonly,MathIntrinsic*::execMathMethod
- *                   -XX:LogFile=hs_neg.log -XX:-UseMathExactIntrinsics IncrementExactIntTest
+ *                   -XX:CompileCommand=compileonly,compiler.intrinsics.mathexact.sanity.MathIntrinsic*::execMathMethod
+ *                   -XX:LogFile=hs_neg.log -XX:-UseMathExactIntrinsics
+ *                   compiler.intrinsics.mathexact.sanity.IncrementExactIntTest
  * @run main/othervm -Xbootclasspath/a:. -XX:+UnlockDiagnosticVMOptions
  *                   -XX:+IgnoreUnrecognizedVMOptions -XX:+WhiteBoxAPI -XX:+LogCompilation
- *                   -XX:CompileCommand=compileonly,MathIntrinsic*::execMathMethod
- *                   -XX:LogFile=hs.log -XX:+UseMathExactIntrinsics IncrementExactIntTest
+ *                   -XX:CompileCommand=compileonly,compiler.intrinsics.mathexact.sanity.MathIntrinsic*::execMathMethod
+ *                   -XX:LogFile=hs.log -XX:+UseMathExactIntrinsics
+ *                   compiler.intrinsics.mathexact.sanity.IncrementExactIntTest
  * @run driver compiler.testlibrary.intrinsics.Verifier hs_neg.log hs.log
  */
 
+package compiler.intrinsics.mathexact.sanity;
+
 public class IncrementExactIntTest {
 
     public static void main(String[] args) throws Exception {
diff --git a/hotspot/test/compiler/intrinsics/mathexact/sanity/IncrementExactLongTest.java b/hotspot/test/compiler/intrinsics/mathexact/sanity/IncrementExactLongTest.java
index 79f2497..fa67b74 100644
--- a/hotspot/test/compiler/intrinsics/mathexact/sanity/IncrementExactLongTest.java
+++ b/hotspot/test/compiler/intrinsics/mathexact/sanity/IncrementExactLongTest.java
@@ -26,20 +26,25 @@
  * @library /testlibrary /test/lib /
  * @modules java.base/jdk.internal.misc
  *          java.management
- * @build IncrementExactLongTest
+ *
+ * @build compiler.intrinsics.mathexact.sanity.IncrementExactLongTest
  * @run driver ClassFileInstaller sun.hotspot.WhiteBox
  *                                sun.hotspot.WhiteBox$WhiteBoxPermission
  * @run main/othervm -Xbootclasspath/a:. -XX:+UnlockDiagnosticVMOptions
  *                   -XX:+IgnoreUnrecognizedVMOptions -XX:+WhiteBoxAPI -XX:+LogCompilation
- *                   -XX:CompileCommand=compileonly,MathIntrinsic*::execMathMethod
- *                   -XX:LogFile=hs_neg.log -XX:-UseMathExactIntrinsics IncrementExactLongTest
+ *                   -XX:CompileCommand=compileonly,compiler.intrinsics.mathexact.sanity.MathIntrinsic*::execMathMethod
+ *                   -XX:LogFile=hs_neg.log -XX:-UseMathExactIntrinsics
+ *                   compiler.intrinsics.mathexact.sanity.IncrementExactLongTest
  * @run main/othervm -Xbootclasspath/a:. -XX:+UnlockDiagnosticVMOptions
  *                   -XX:+IgnoreUnrecognizedVMOptions -XX:+WhiteBoxAPI -XX:+LogCompilation
- *                   -XX:CompileCommand=compileonly,MathIntrinsic*::execMathMethod
- *                   -XX:LogFile=hs.log -XX:+UseMathExactIntrinsics IncrementExactLongTest
+ *                   -XX:CompileCommand=compileonly,compiler.intrinsics.mathexact.sanity.MathIntrinsic*::execMathMethod
+ *                   -XX:LogFile=hs.log -XX:+UseMathExactIntrinsics
+ *                   compiler.intrinsics.mathexact.sanity.IncrementExactLongTest
  * @run driver compiler.testlibrary.intrinsics.Verifier hs_neg.log hs.log
  */
 
+package compiler.intrinsics.mathexact.sanity;
+
 public class IncrementExactLongTest {
 
     public static void main(String[] args) throws Exception {
diff --git a/hotspot/test/compiler/intrinsics/mathexact/sanity/IntrinsicBase.java b/hotspot/test/compiler/intrinsics/mathexact/sanity/IntrinsicBase.java
index f902164..b5aeffb 100644
--- a/hotspot/test/compiler/intrinsics/mathexact/sanity/IntrinsicBase.java
+++ b/hotspot/test/compiler/intrinsics/mathexact/sanity/IntrinsicBase.java
@@ -21,22 +21,21 @@
  * questions.
  */
 
+package compiler.intrinsics.mathexact.sanity;
+
+import compiler.testlibrary.intrinsics.Verifier;
+import compiler.whitebox.CompilerWhiteBoxTest;
 import jdk.test.lib.Platform;
 
 import java.io.FileOutputStream;
 import java.lang.reflect.Executable;
 import java.util.Properties;
 
-import compiler.whitebox.CompilerWhiteBoxTest;
-import compiler.testlibrary.intrinsics.Verifier;
-
 public abstract class IntrinsicBase extends CompilerWhiteBoxTest {
-    protected String javaVmName;
     protected String useMathExactIntrinsics;
 
     protected IntrinsicBase(TestCase testCase) {
         super(testCase);
-        javaVmName = System.getProperty("java.vm.name");
         useMathExactIntrinsics = getVMOption("UseMathExactIntrinsics");
     }
 
@@ -45,39 +44,32 @@
         //java.lang.Math should be loaded to allow a compilation of the methods that use Math's method
         System.out.println("class java.lang.Math should be loaded. Proof: " + Math.class);
         printEnvironmentInfo();
+        if (Platform.isInt()) {
+            throw new Error("TESTBUG: test can not be run in interpreter");
+        }
 
         int expectedIntrinsicCount = 0;
 
-        switch (MODE) {
-            case "compiled mode":
-            case "mixed mode":
-                if (isServerVM()) {
-                    if (TIERED_COMPILATION) {
-                        int max_level = TIERED_STOP_AT_LEVEL;
-                        expectedIntrinsicCount = (max_level == COMP_LEVEL_MAX) ? 1 : 0;
-                        for (int i = CompilerWhiteBoxTest.COMP_LEVEL_SIMPLE; i <= max_level; ++i) {
-                            deoptimize();
-                            compileAtLevel(i);
-                        }
-                    } else {
-                        expectedIntrinsicCount = 1;
-                        deoptimize();
-                        compileAtLevel(CompilerWhiteBoxTest.COMP_LEVEL_MAX);
-                    }
-                } else {
+        if (Platform.isServer()) {
+            if (TIERED_COMPILATION) {
+                int max_level = TIERED_STOP_AT_LEVEL;
+                expectedIntrinsicCount = (max_level == COMP_LEVEL_MAX) ? 1 : 0;
+                for (int i = CompilerWhiteBoxTest.COMP_LEVEL_SIMPLE; i <= max_level; ++i) {
                     deoptimize();
-                    compileAtLevel(CompilerWhiteBoxTest.COMP_LEVEL_SIMPLE);
+                    compileAtLevel(i);
                 }
+            } else {
+                expectedIntrinsicCount = 1;
+                deoptimize();
+                compileAtLevel(CompilerWhiteBoxTest.COMP_LEVEL_MAX);
+            }
+        } else {
+            deoptimize();
+            compileAtLevel(CompilerWhiteBoxTest.COMP_LEVEL_SIMPLE);
+        }
 
-                if (!isIntrinsicAvailable()) {
-                    expectedIntrinsicCount = 0;
-                }
-                break;
-            case "interpreted mode": //test is not applicable in this mode;
-                System.err.println("Warning: This test is not applicable in mode: " + MODE);
-                break;
-            default:
-                throw new RuntimeException("Test bug, unknown VM mode: " + MODE);
+        if (!isIntrinsicAvailable()) {
+            expectedIntrinsicCount = 0;
         }
 
         System.out.println("Expected intrinsic count is " + expectedIntrinsicCount + " name " + getIntrinsicId());
@@ -92,9 +84,8 @@
     }
 
     protected void printEnvironmentInfo() {
-        System.out.println("java.vm.name=" + javaVmName);
         System.out.println("os.arch=" + Platform.getOsArch());
-        System.out.println("java.vm.info=" + MODE);
+        System.out.println("java.vm.info=" + Platform.vmInfo);
         System.out.println("useMathExactIntrinsics=" + useMathExactIntrinsics);
     }
 
@@ -124,10 +115,6 @@
 
     protected abstract String getIntrinsicId();
 
-    protected boolean isServerVM() {
-        return javaVmName.toLowerCase().contains("server");
-    }
-
     static class IntTest extends IntrinsicBase {
 
         protected boolean isIntrinsicAvailable; // The tested intrinsic is available on the current platform.
diff --git a/hotspot/test/compiler/intrinsics/mathexact/sanity/MathIntrinsic.java b/hotspot/test/compiler/intrinsics/mathexact/sanity/MathIntrinsic.java
index 7148a56..0174a9f 100644
--- a/hotspot/test/compiler/intrinsics/mathexact/sanity/MathIntrinsic.java
+++ b/hotspot/test/compiler/intrinsics/mathexact/sanity/MathIntrinsic.java
@@ -21,9 +21,12 @@
  * questions.
  */
 
+package compiler.intrinsics.mathexact.sanity;
+
+import compiler.whitebox.CompilerWhiteBoxTest;
+
 import java.lang.reflect.Executable;
 import java.util.concurrent.Callable;
-import compiler.whitebox.CompilerWhiteBoxTest;
 
 public class MathIntrinsic {
 
diff --git a/hotspot/test/compiler/intrinsics/mathexact/sanity/MultiplyExactIntTest.java b/hotspot/test/compiler/intrinsics/mathexact/sanity/MultiplyExactIntTest.java
index c3aec62..3883868 100644
--- a/hotspot/test/compiler/intrinsics/mathexact/sanity/MultiplyExactIntTest.java
+++ b/hotspot/test/compiler/intrinsics/mathexact/sanity/MultiplyExactIntTest.java
@@ -26,20 +26,25 @@
  * @library /testlibrary /test/lib /
  * @modules java.base/jdk.internal.misc
  *          java.management
- * @build MultiplyExactIntTest
+ *
+ * @build compiler.intrinsics.mathexact.sanity.MultiplyExactIntTest
  * @run driver ClassFileInstaller sun.hotspot.WhiteBox
  *                                sun.hotspot.WhiteBox$WhiteBoxPermission
  * @run main/othervm -Xbootclasspath/a:. -XX:+UnlockDiagnosticVMOptions
  *                   -XX:+IgnoreUnrecognizedVMOptions -XX:+WhiteBoxAPI -XX:+LogCompilation
- *                   -XX:CompileCommand=compileonly,MathIntrinsic*::execMathMethod
- *                   -XX:LogFile=hs_neg.log -XX:-UseMathExactIntrinsics MultiplyExactIntTest
+ *                   -XX:CompileCommand=compileonly,compiler.intrinsics.mathexact.sanity.MathIntrinsic*::execMathMethod
+ *                   -XX:LogFile=hs_neg.log -XX:-UseMathExactIntrinsics
+ *                   compiler.intrinsics.mathexact.sanity.MultiplyExactIntTest
  * @run main/othervm -Xbootclasspath/a:. -XX:+UnlockDiagnosticVMOptions
  *                   -XX:+IgnoreUnrecognizedVMOptions -XX:+WhiteBoxAPI -XX:+LogCompilation
- *                   -XX:CompileCommand=compileonly,MathIntrinsic*::execMathMethod
- *                   -XX:LogFile=hs.log -XX:+UseMathExactIntrinsics MultiplyExactIntTest
+ *                   -XX:CompileCommand=compileonly,compiler.intrinsics.mathexact.sanity.MathIntrinsic*::execMathMethod
+ *                   -XX:LogFile=hs.log -XX:+UseMathExactIntrinsics
+ *                   compiler.intrinsics.mathexact.sanity.MultiplyExactIntTest
  * @run driver compiler.testlibrary.intrinsics.Verifier hs_neg.log hs.log
  */
 
+package compiler.intrinsics.mathexact.sanity;
+
 public class MultiplyExactIntTest {
 
     public static void main(String[] args) throws Exception {
diff --git a/hotspot/test/compiler/intrinsics/mathexact/sanity/MultiplyExactLongTest.java b/hotspot/test/compiler/intrinsics/mathexact/sanity/MultiplyExactLongTest.java
index bc49440..5000ea8 100644
--- a/hotspot/test/compiler/intrinsics/mathexact/sanity/MultiplyExactLongTest.java
+++ b/hotspot/test/compiler/intrinsics/mathexact/sanity/MultiplyExactLongTest.java
@@ -26,20 +26,25 @@
  * @library /testlibrary /test/lib /
  * @modules java.base/jdk.internal.misc
  *          java.management
- * @build MultiplyExactLongTest
+ *
+ * @build compiler.intrinsics.mathexact.sanity.MultiplyExactLongTest
  * @run driver ClassFileInstaller sun.hotspot.WhiteBox
  *                                sun.hotspot.WhiteBox$WhiteBoxPermission
  * @run main/othervm -Xbootclasspath/a:. -XX:+UnlockDiagnosticVMOptions
  *                   -XX:+IgnoreUnrecognizedVMOptions -XX:+WhiteBoxAPI -XX:+LogCompilation
- *                   -XX:CompileCommand=compileonly,MathIntrinsic*::execMathMethod
- *                   -XX:LogFile=hs_neg.log -XX:-UseMathExactIntrinsics MultiplyExactLongTest
+ *                   -XX:CompileCommand=compileonly,compiler.intrinsics.mathexact.sanity.MathIntrinsic*::execMathMethod
+ *                   -XX:LogFile=hs_neg.log -XX:-UseMathExactIntrinsics
+ *                   compiler.intrinsics.mathexact.sanity.MultiplyExactLongTest
  * @run main/othervm -Xbootclasspath/a:. -XX:+UnlockDiagnosticVMOptions
  *                   -XX:+IgnoreUnrecognizedVMOptions -XX:+WhiteBoxAPI -XX:+LogCompilation
- *                   -XX:CompileCommand=compileonly,MathIntrinsic*::execMathMethod
- *                   -XX:LogFile=hs.log -XX:+UseMathExactIntrinsics MultiplyExactLongTest
+ *                   -XX:CompileCommand=compileonly,compiler.intrinsics.mathexact.sanity.MathIntrinsic*::execMathMethod
+ *                   -XX:LogFile=hs.log -XX:+UseMathExactIntrinsics
+ *                   compiler.intrinsics.mathexact.sanity.MultiplyExactLongTest
  * @run driver compiler.testlibrary.intrinsics.Verifier hs_neg.log hs.log
  */
 
+package compiler.intrinsics.mathexact.sanity;
+
 public class MultiplyExactLongTest {
 
     public static void main(String[] args) throws Exception {
diff --git a/hotspot/test/compiler/intrinsics/mathexact/sanity/NegateExactIntTest.java b/hotspot/test/compiler/intrinsics/mathexact/sanity/NegateExactIntTest.java
index d39d108..a67b499 100644
--- a/hotspot/test/compiler/intrinsics/mathexact/sanity/NegateExactIntTest.java
+++ b/hotspot/test/compiler/intrinsics/mathexact/sanity/NegateExactIntTest.java
@@ -26,20 +26,25 @@
  * @library /testlibrary /test/lib /
  * @modules java.base/jdk.internal.misc
  *          java.management
- * @build NegateExactIntTest
+ *
+ * @build compiler.intrinsics.mathexact.sanity.NegateExactIntTest
  * @run driver ClassFileInstaller sun.hotspot.WhiteBox
  *                                sun.hotspot.WhiteBox$WhiteBoxPermission
  * @run main/othervm -Xbootclasspath/a:. -XX:+UnlockDiagnosticVMOptions
  *                   -XX:+IgnoreUnrecognizedVMOptions -XX:+WhiteBoxAPI -XX:+LogCompilation
- *                   -XX:CompileCommand=compileonly,MathIntrinsic*::execMathMethod
- *                   -XX:LogFile=hs_neg.log -XX:-UseMathExactIntrinsics NegateExactIntTest
+ *                   -XX:CompileCommand=compileonly,compiler.intrinsics.mathexact.sanity.MathIntrinsic*::execMathMethod
+ *                   -XX:LogFile=hs_neg.log -XX:-UseMathExactIntrinsics
+ *                   compiler.intrinsics.mathexact.sanity.NegateExactIntTest
  * @run main/othervm -Xbootclasspath/a:. -XX:+UnlockDiagnosticVMOptions
  *                   -XX:+IgnoreUnrecognizedVMOptions -XX:+WhiteBoxAPI -XX:+LogCompilation
- *                   -XX:CompileCommand=compileonly,MathIntrinsic*::execMathMethod
- *                   -XX:LogFile=hs.log -XX:+UseMathExactIntrinsics NegateExactIntTest
+ *                   -XX:CompileCommand=compileonly,compiler.intrinsics.mathexact.sanity.MathIntrinsic*::execMathMethod
+ *                   -XX:LogFile=hs.log -XX:+UseMathExactIntrinsics
+ *                   compiler.intrinsics.mathexact.sanity.NegateExactIntTest
  * @run driver compiler.testlibrary.intrinsics.Verifier hs_neg.log hs.log
  */
 
+package compiler.intrinsics.mathexact.sanity;
+
 public class NegateExactIntTest {
 
     public static void main(String[] args) throws Exception {
diff --git a/hotspot/test/compiler/intrinsics/mathexact/sanity/NegateExactLongTest.java b/hotspot/test/compiler/intrinsics/mathexact/sanity/NegateExactLongTest.java
index 8ad985b..038f014 100644
--- a/hotspot/test/compiler/intrinsics/mathexact/sanity/NegateExactLongTest.java
+++ b/hotspot/test/compiler/intrinsics/mathexact/sanity/NegateExactLongTest.java
@@ -26,20 +26,25 @@
  * @library /testlibrary /test/lib /
  * @modules java.base/jdk.internal.misc
  *          java.management
- * @build NegateExactLongTest
+ *
+ * @build compiler.intrinsics.mathexact.sanity.NegateExactLongTest
  * @run driver ClassFileInstaller sun.hotspot.WhiteBox
  *                                sun.hotspot.WhiteBox$WhiteBoxPermission
  * @run main/othervm -Xbootclasspath/a:. -XX:+UnlockDiagnosticVMOptions
  *                   -XX:+IgnoreUnrecognizedVMOptions -XX:+WhiteBoxAPI -XX:+LogCompilation
- *                   -XX:CompileCommand=compileonly,MathIntrinsic*::execMathMethod
- *                   -XX:LogFile=hs_neg.log -XX:-UseMathExactIntrinsics NegateExactLongTest
+ *                   -XX:CompileCommand=compileonly,compiler.intrinsics.mathexact.sanity.MathIntrinsic*::execMathMethod
+ *                   -XX:LogFile=hs_neg.log -XX:-UseMathExactIntrinsics
+ *                   compiler.intrinsics.mathexact.sanity.NegateExactLongTest
  * @run main/othervm -Xbootclasspath/a:. -XX:+UnlockDiagnosticVMOptions
  *                   -XX:+IgnoreUnrecognizedVMOptions -XX:+WhiteBoxAPI -XX:+LogCompilation
- *                   -XX:CompileCommand=compileonly,MathIntrinsic*::execMathMethod
- *                   -XX:LogFile=hs.log -XX:+UseMathExactIntrinsics NegateExactLongTest
+ *                   -XX:CompileCommand=compileonly,compiler.intrinsics.mathexact.sanity.MathIntrinsic*::execMathMethod
+ *                   -XX:LogFile=hs.log -XX:+UseMathExactIntrinsics
+ *                   compiler.intrinsics.mathexact.sanity.NegateExactLongTest
  * @run driver compiler.testlibrary.intrinsics.Verifier hs_neg.log hs.log
  */
 
+package compiler.intrinsics.mathexact.sanity;
+
 public class NegateExactLongTest {
 
     public static void main(String[] args) throws Exception {
diff --git a/hotspot/test/compiler/intrinsics/mathexact/sanity/SubtractExactIntTest.java b/hotspot/test/compiler/intrinsics/mathexact/sanity/SubtractExactIntTest.java
index cf7f2f1..c74b7f7 100644
--- a/hotspot/test/compiler/intrinsics/mathexact/sanity/SubtractExactIntTest.java
+++ b/hotspot/test/compiler/intrinsics/mathexact/sanity/SubtractExactIntTest.java
@@ -26,20 +26,25 @@
  * @library /testlibrary /test/lib /
  * @modules java.base/jdk.internal.misc
  *          java.management
- * @build SubtractExactIntTest
+ *
+ * @build compiler.intrinsics.mathexact.sanity.SubtractExactIntTest
  * @run driver ClassFileInstaller sun.hotspot.WhiteBox
  *                                sun.hotspot.WhiteBox$WhiteBoxPermission
  * @run main/othervm -Xbootclasspath/a:. -XX:+UnlockDiagnosticVMOptions
  *                   -XX:+IgnoreUnrecognizedVMOptions -XX:+WhiteBoxAPI -XX:+LogCompilation
- *                   -XX:CompileCommand=compileonly,MathIntrinsic*::execMathMethod
- *                   -XX:LogFile=hs_neg.log -XX:-UseMathExactIntrinsics SubtractExactIntTest
+ *                   -XX:CompileCommand=compileonly,compiler.intrinsics.mathexact.sanity.MathIntrinsic*::execMathMethod
+ *                   -XX:LogFile=hs_neg.log -XX:-UseMathExactIntrinsics
+ *                   compiler.intrinsics.mathexact.sanity.SubtractExactIntTest
  * @run main/othervm -Xbootclasspath/a:. -XX:+UnlockDiagnosticVMOptions
  *                   -XX:+IgnoreUnrecognizedVMOptions -XX:+WhiteBoxAPI -XX:+LogCompilation
- *                   -XX:CompileCommand=compileonly,MathIntrinsic*::execMathMethod
- *                   -XX:LogFile=hs.log -XX:+UseMathExactIntrinsics SubtractExactIntTest
+ *                   -XX:CompileCommand=compileonly,compiler.intrinsics.mathexact.sanity.MathIntrinsic*::execMathMethod
+ *                   -XX:LogFile=hs.log -XX:+UseMathExactIntrinsics
+ *                   compiler.intrinsics.mathexact.sanity.SubtractExactIntTest
  * @run driver compiler.testlibrary.intrinsics.Verifier hs_neg.log hs.log
  */
 
+package compiler.intrinsics.mathexact.sanity;
+
 public class SubtractExactIntTest {
 
     public static void main(String[] args) throws Exception {
diff --git a/hotspot/test/compiler/intrinsics/mathexact/sanity/SubtractExactLongTest.java b/hotspot/test/compiler/intrinsics/mathexact/sanity/SubtractExactLongTest.java
index d71ee75..263059d 100644
--- a/hotspot/test/compiler/intrinsics/mathexact/sanity/SubtractExactLongTest.java
+++ b/hotspot/test/compiler/intrinsics/mathexact/sanity/SubtractExactLongTest.java
@@ -26,20 +26,24 @@
  * @library /testlibrary /test/lib /
  * @modules java.base/jdk.internal.misc
  *          java.management
- * @build SubtractExactLongTest
+ * @build compiler.intrinsics.mathexact.sanity.SubtractExactLongTest
  * @run driver ClassFileInstaller sun.hotspot.WhiteBox
  *                                sun.hotspot.WhiteBox$WhiteBoxPermission
  * @run main/othervm -Xbootclasspath/a:. -XX:+UnlockDiagnosticVMOptions
  *                   -XX:+IgnoreUnrecognizedVMOptions -XX:+WhiteBoxAPI -XX:+LogCompilation
- *                   -XX:CompileCommand=compileonly,MathIntrinsic*::execMathMethod
- *                   -XX:LogFile=hs_neg.log -XX:-UseMathExactIntrinsics SubtractExactLongTest
+ *                   -XX:CompileCommand=compileonly,compiler.intrinsics.mathexact.sanity.MathIntrinsic*::execMathMethod
+ *                   -XX:LogFile=hs_neg.log -XX:-UseMathExactIntrinsics
+ *                   compiler.intrinsics.mathexact.sanity.SubtractExactLongTest
  * @run main/othervm -Xbootclasspath/a:. -XX:+UnlockDiagnosticVMOptions
  *                   -XX:+IgnoreUnrecognizedVMOptions -XX:+WhiteBoxAPI -XX:+LogCompilation
- *                   -XX:CompileCommand=compileonly,MathIntrinsic*::execMathMethod
- *                   -XX:LogFile=hs.log -XX:+UseMathExactIntrinsics SubtractExactLongTest
+ *                   -XX:CompileCommand=compileonly,compiler.intrinsics.mathexact.sanity.MathIntrinsic*::execMathMethod
+ *                   -XX:LogFile=hs.log -XX:+UseMathExactIntrinsics
+ *                   compiler.intrinsics.mathexact.sanity.SubtractExactLongTest
  * @run driver compiler.testlibrary.intrinsics.Verifier hs_neg.log hs.log
  */
 
+package compiler.intrinsics.mathexact.sanity;
+
 public class SubtractExactLongTest {
 
     public static void main(String[] args) throws Exception {
diff --git a/hotspot/test/compiler/intrinsics/clone/TestObjectClone.java b/hotspot/test/compiler/intrinsics/object/TestClone.java
similarity index 69%
rename from hotspot/test/compiler/intrinsics/clone/TestObjectClone.java
rename to hotspot/test/compiler/intrinsics/object/TestClone.java
index 1e40e84..1e96632 100644
--- a/hotspot/test/compiler/intrinsics/clone/TestObjectClone.java
+++ b/hotspot/test/compiler/intrinsics/object/TestClone.java
@@ -28,39 +28,45 @@
  * @summary assert(ex_map->jvms()->same_calls_as(_exceptions->jvms())) failed: all collected exceptions must come from the same place
  * @modules java.base/jdk.internal.misc
  * @library /testlibrary
- * @run main/othervm -XX:-TieredCompilation -Xbatch -XX:CompileOnly=TestObjectClone::f TestObjectClone
+ *
+ * @run main/othervm -XX:-TieredCompilation -Xbatch
+ *      -XX:CompileCommand=compileonly,compiler.intrinsics.object.TestClone::f
+ *      compiler.intrinsics.object.TestClone
  */
+
+package compiler.intrinsics.object;
+
 import jdk.test.lib.Asserts;
 
-public class TestObjectClone implements Cloneable {
-    static class A extends TestObjectClone {}
-    static class B extends TestObjectClone {
+public class TestClone implements Cloneable {
+    static class A extends TestClone {}
+    static class B extends TestClone {
         public B clone() {
-            return (B)TestObjectClone.b;
+            return (B)TestClone.b;
         }
     }
-    static class C extends TestObjectClone {
+    static class C extends TestClone {
         public C clone() {
-            return (C)TestObjectClone.c;
+            return (C)TestClone.c;
         }
     }
-    static class D extends TestObjectClone {
+    static class D extends TestClone {
         public D clone() {
-            return (D)TestObjectClone.d;
+            return (D)TestClone.d;
         }
     }
-    static TestObjectClone a = new A(), b = new B(), c = new C(), d = new D();
+    static TestClone a = new A(), b = new B(), c = new C(), d = new D();
 
-    public static Object f(TestObjectClone o) throws CloneNotSupportedException {
+    public static Object f(TestClone o) throws CloneNotSupportedException {
         // Polymorphic call site: >90% Object::clone / <10% other methods
         return o.clone();
     }
 
     public static void main(String[] args) throws Exception {
-        TestObjectClone[] params1 = {a, a, a, a, a, a, a, a, a, a, a,
-                          a, a, a, a, a, a, a, a, a, a, a,
-                          a, a, a, a, a, a, a, a, a, a, a,
-                          b, c, d};
+        TestClone[] params1 = {a, a, a, a, a, a, a, a, a, a, a,
+                               a, a, a, a, a, a, a, a, a, a, a,
+                               a, a, a, a, a, a, a, a, a, a, a,
+                               b, c, d};
 
         for (int i = 0; i < 15000; i++) {
             f(params1[i % params1.length]);
diff --git a/hotspot/test/compiler/intrinsics/hashcode/TestHashCode.java b/hotspot/test/compiler/intrinsics/object/TestHashCode.java
similarity index 87%
rename from hotspot/test/compiler/intrinsics/hashcode/TestHashCode.java
rename to hotspot/test/compiler/intrinsics/object/TestHashCode.java
index f7d5450..f011ccd 100644
--- a/hotspot/test/compiler/intrinsics/hashcode/TestHashCode.java
+++ b/hotspot/test/compiler/intrinsics/object/TestHashCode.java
@@ -25,10 +25,15 @@
  * @test
  * @bug 8011646
  * @summary SEGV in compiled code with loop predication
- * @run main/othervm  -XX:-TieredCompilation -XX:CompileOnly=TestHashCode.m1,Object.hashCode TestHashCode
  *
+ * @run main/othervm  -XX:-TieredCompilation
+ *      -XX:CompileCommand=compileonly,java.lang.Object::hashCode
+ *      -XX:CompileCommand=compileonly,compiler.intrinsics.object.TestHashCode::m1
+ *      compiler.intrinsics.object.TestHashCode
  */
 
+package compiler.intrinsics.object;
+
 public class TestHashCode {
     static class A {
         int i;
diff --git a/hotspot/test/compiler/intrinsics/sha/TestSHA.java b/hotspot/test/compiler/intrinsics/sha/TestSHA.java
index 08af909..155218d 100644
--- a/hotspot/test/compiler/intrinsics/sha/TestSHA.java
+++ b/hotspot/test/compiler/intrinsics/sha/TestSHA.java
@@ -27,26 +27,58 @@
  * @bug 8035968
  * @summary C2 support for SHA on SPARC
  *
- * @run main/othervm/timeout=600 -Xbatch -Dalgorithm=SHA-1   TestSHA
- * @run main/othervm/timeout=600 -Xbatch -Dalgorithm=SHA-224 TestSHA
- * @run main/othervm/timeout=600 -Xbatch -Dalgorithm=SHA-256 TestSHA
- * @run main/othervm/timeout=600 -Xbatch -Dalgorithm=SHA-384 TestSHA
- * @run main/othervm/timeout=600 -Xbatch -Dalgorithm=SHA-512 TestSHA
+ * @run main/othervm/timeout=600 -Xbatch
+ *      -Dalgorithm=SHA-1
+ *      compiler.intrinsics.sha.TestSHA
+ * @run main/othervm/timeout=600 -Xbatch
+ *      -Dalgorithm=SHA-224
+ *      compiler.intrinsics.sha.TestSHA
+ * @run main/othervm/timeout=600 -Xbatch
+ *      -Dalgorithm=SHA-256
+ *      compiler.intrinsics.sha.TestSHA
+ * @run main/othervm/timeout=600 -Xbatch
+ *      -Dalgorithm=SHA-384
+ *      compiler.intrinsics.sha.TestSHA
+ * @run main/othervm/timeout=600 -Xbatch
+ *      -Dalgorithm=SHA-512
+ *      compiler.intrinsics.sha.TestSHA
  *
- * @run main/othervm/timeout=600 -Xbatch -Dalgorithm=SHA-1   -Doffset=1 TestSHA
- * @run main/othervm/timeout=600 -Xbatch -Dalgorithm=SHA-224 -Doffset=1 TestSHA
- * @run main/othervm/timeout=600 -Xbatch -Dalgorithm=SHA-256 -Doffset=1 TestSHA
- * @run main/othervm/timeout=600 -Xbatch -Dalgorithm=SHA-384 -Doffset=1 TestSHA
- * @run main/othervm/timeout=600 -Xbatch -Dalgorithm=SHA-512 -Doffset=1 TestSHA
+ * @run main/othervm/timeout=600 -Xbatch
+ *      -Dalgorithm=SHA-1   -Doffset=1
+ *      compiler.intrinsics.sha.TestSHA
+ * @run main/othervm/timeout=600 -Xbatch
+ *      -Dalgorithm=SHA-224 -Doffset=1
+ *      compiler.intrinsics.sha.TestSHA
+ * @run main/othervm/timeout=600 -Xbatch
+ *      -Dalgorithm=SHA-256 -Doffset=1
+ *      compiler.intrinsics.sha.TestSHA
+ * @run main/othervm/timeout=600 -Xbatch
+ *      -Dalgorithm=SHA-384 -Doffset=1
+ *      compiler.intrinsics.sha.TestSHA
+ * @run main/othervm/timeout=600 -Xbatch
+ *      -Dalgorithm=SHA-512 -Doffset=1
+ *      compiler.intrinsics.sha.TestSHA
  *
- * @run main/othervm/timeout=600 -Xbatch -Dalgorithm=SHA-1   -Dalgorithm2=SHA-256 TestSHA
- * @run main/othervm/timeout=600 -Xbatch -Dalgorithm=SHA-1   -Dalgorithm2=SHA-512 TestSHA
- * @run main/othervm/timeout=600 -Xbatch -Dalgorithm=SHA-256 -Dalgorithm2=SHA-512 TestSHA
+ * @run main/othervm/timeout=600 -Xbatch
+ *      -Dalgorithm=SHA-1   -Dalgorithm2=SHA-256
+ *      compiler.intrinsics.sha.TestSHA
+ * @run main/othervm/timeout=600 -Xbatch
+ *      -Dalgorithm=SHA-1   -Dalgorithm2=SHA-512
+ *      compiler.intrinsics.sha.TestSHA
+ * @run main/othervm/timeout=600 -Xbatch
+ *      -Dalgorithm=SHA-256 -Dalgorithm2=SHA-512
+ *      compiler.intrinsics.sha.TestSHA
  *
- * @run main/othervm/timeout=600 -Xbatch -Dalgorithm=SHA-1   -Dalgorithm2=MD5     TestSHA
- * @run main/othervm/timeout=600 -Xbatch -Dalgorithm=MD5     -Dalgorithm2=SHA-1   TestSHA
+ * @run main/othervm/timeout=600 -Xbatch
+ *      -Dalgorithm=SHA-1   -Dalgorithm2=MD5
+ *      compiler.intrinsics.sha.TestSHA
+ * @run main/othervm/timeout=600 -Xbatch
+ *      -Dalgorithm=MD5     -Dalgorithm2=SHA-1
+ *      compiler.intrinsics.sha.TestSHA
  */
 
+package compiler.intrinsics.sha;
+
 import java.security.MessageDigest;
 import java.util.Arrays;
 
@@ -70,7 +102,7 @@
         }
     }
 
-    static void testSHA(String provider, String algorithm, int msgSize,
+    public static void testSHA(String provider, String algorithm, int msgSize,
                         int offset, int iters, int warmupIters) throws Exception {
         System.out.println("provider = " + provider);
         System.out.println("algorithm = " + algorithm);
diff --git a/hotspot/test/compiler/intrinsics/sha/cli/SHAOptionsBase.java b/hotspot/test/compiler/intrinsics/sha/cli/SHAOptionsBase.java
index cb0856c..7dd2154 100644
--- a/hotspot/test/compiler/intrinsics/sha/cli/SHAOptionsBase.java
+++ b/hotspot/test/compiler/intrinsics/sha/cli/SHAOptionsBase.java
@@ -21,9 +21,11 @@
  * questions.
  */
 
+package compiler.intrinsics.sha.cli;
+
+import compiler.testlibrary.sha.predicate.IntrinsicPredicates;
 import jdk.test.lib.Platform;
 import jdk.test.lib.cli.CommandLineOptionTest;
-import compiler.testlibrary.sha.predicate.IntrinsicPredicates;
 
 import java.util.function.BooleanSupplier;
 
@@ -34,17 +36,17 @@
  * from several test cases shared among different tests.
  */
 public class SHAOptionsBase extends CommandLineOptionTest {
-    protected static final String USE_SHA_OPTION = "UseSHA";
-    protected static final String USE_SHA1_INTRINSICS_OPTION
+    public static final String USE_SHA_OPTION = "UseSHA";
+    public static final String USE_SHA1_INTRINSICS_OPTION
             = "UseSHA1Intrinsics";
-    protected static final String USE_SHA256_INTRINSICS_OPTION
+    public static final String USE_SHA256_INTRINSICS_OPTION
             = "UseSHA256Intrinsics";
-    protected static final String USE_SHA512_INTRINSICS_OPTION
+    public static final String USE_SHA512_INTRINSICS_OPTION
             = "UseSHA512Intrinsics";
 
     // Intrinsics flags are of diagnostic type
     // and must be preceded by UnlockDiagnosticVMOptions.
-    protected static final String UNLOCK_DIAGNOSTIC_VM_OPTIONS
+    public static final String UNLOCK_DIAGNOSTIC_VM_OPTIONS
             = "-XX:+UnlockDiagnosticVMOptions";
 
     // Note that strings below will be passed to
@@ -71,7 +73,7 @@
      * @return A warning message that will be printed out to VM output if CPU
      *         instructions required by the option are not supported.
      */
-    protected static String getWarningForUnsupportedCPU(String optionName) {
+    public static String getWarningForUnsupportedCPU(String optionName) {
         if (Platform.isSparc() || Platform.isAArch64() ||
             Platform.isX64() || Platform.isX86()) {
             switch (optionName) {
@@ -101,7 +103,7 @@
      * @return The predicate on availability of CPU instructions required by the
      *         option.
      */
-    protected static BooleanSupplier getPredicateForOption(String optionName) {
+    public static BooleanSupplier getPredicateForOption(String optionName) {
         switch (optionName) {
             case SHAOptionsBase.USE_SHA_OPTION:
                 return IntrinsicPredicates.ANY_SHA_INSTRUCTION_AVAILABLE;
diff --git a/hotspot/test/compiler/intrinsics/sha/cli/TestUseSHA1IntrinsicsOptionOnSupportedCPU.java b/hotspot/test/compiler/intrinsics/sha/cli/TestUseSHA1IntrinsicsOptionOnSupportedCPU.java
index 7fc3642..44fd2f3 100644
--- a/hotspot/test/compiler/intrinsics/sha/cli/TestUseSHA1IntrinsicsOptionOnSupportedCPU.java
+++ b/hotspot/test/compiler/intrinsics/sha/cli/TestUseSHA1IntrinsicsOptionOnSupportedCPU.java
@@ -28,12 +28,19 @@
  * @library /testlibrary /test/lib testcases /
  * @modules java.base/jdk.internal.misc
  *          java.management
- * @build TestUseSHA1IntrinsicsOptionOnSupportedCPU
+ *
+ * @build compiler.intrinsics.sha.cli.TestUseSHA1IntrinsicsOptionOnSupportedCPU
  * @run driver ClassFileInstaller sun.hotspot.WhiteBox
  *                                sun.hotspot.WhiteBox$WhiteBoxPermission
  * @run main/othervm -Xbootclasspath/a:. -XX:+UnlockDiagnosticVMOptions
- *                   -XX:+WhiteBoxAPI TestUseSHA1IntrinsicsOptionOnSupportedCPU
+ *                   -XX:+WhiteBoxAPI
+ *                   compiler.intrinsics.sha.cli.TestUseSHA1IntrinsicsOptionOnSupportedCPU
  */
+
+package compiler.intrinsics.sha.cli;
+
+import compiler.intrinsics.sha.cli.testcases.GenericTestCaseForSupportedCPU;
+
 public class TestUseSHA1IntrinsicsOptionOnSupportedCPU {
     public static void main(String args[]) throws Throwable {
         new SHAOptionsBase(new GenericTestCaseForSupportedCPU(
diff --git a/hotspot/test/compiler/intrinsics/sha/cli/TestUseSHA1IntrinsicsOptionOnUnsupportedCPU.java b/hotspot/test/compiler/intrinsics/sha/cli/TestUseSHA1IntrinsicsOptionOnUnsupportedCPU.java
index 34b6680..a4d7f2a 100644
--- a/hotspot/test/compiler/intrinsics/sha/cli/TestUseSHA1IntrinsicsOptionOnUnsupportedCPU.java
+++ b/hotspot/test/compiler/intrinsics/sha/cli/TestUseSHA1IntrinsicsOptionOnUnsupportedCPU.java
@@ -28,13 +28,23 @@
  * @library /testlibrary /test/lib testcases /
  * @modules java.base/jdk.internal.misc
  *          java.management
- * @build TestUseSHA1IntrinsicsOptionOnUnsupportedCPU
+ *
+ * @build compiler.intrinsics.sha.cli.TestUseSHA1IntrinsicsOptionOnUnsupportedCPU
  * @run driver ClassFileInstaller sun.hotspot.WhiteBox
  *                                sun.hotspot.WhiteBox$WhiteBoxPermission
  * @run main/othervm -Xbootclasspath/a:. -XX:+UnlockDiagnosticVMOptions
  *                   -XX:+WhiteBoxAPI
- *                   TestUseSHA1IntrinsicsOptionOnUnsupportedCPU
+ *                   compiler.intrinsics.sha.cli.TestUseSHA1IntrinsicsOptionOnUnsupportedCPU
  */
+
+package compiler.intrinsics.sha.cli;
+
+import compiler.intrinsics.sha.cli.testcases.GenericTestCaseForOtherCPU;
+import compiler.intrinsics.sha.cli.testcases.GenericTestCaseForUnsupportedAArch64CPU;
+import compiler.intrinsics.sha.cli.testcases.GenericTestCaseForUnsupportedSparcCPU;
+import compiler.intrinsics.sha.cli.testcases.GenericTestCaseForUnsupportedX86CPU;
+import compiler.intrinsics.sha.cli.testcases.UseSHAIntrinsicsSpecificTestCaseForUnsupportedCPU;
+
 public class TestUseSHA1IntrinsicsOptionOnUnsupportedCPU {
     public static void main(String args[]) throws Throwable {
         new SHAOptionsBase(
diff --git a/hotspot/test/compiler/intrinsics/sha/cli/TestUseSHA256IntrinsicsOptionOnSupportedCPU.java b/hotspot/test/compiler/intrinsics/sha/cli/TestUseSHA256IntrinsicsOptionOnSupportedCPU.java
index 4710600..33e19ec 100644
--- a/hotspot/test/compiler/intrinsics/sha/cli/TestUseSHA256IntrinsicsOptionOnSupportedCPU.java
+++ b/hotspot/test/compiler/intrinsics/sha/cli/TestUseSHA256IntrinsicsOptionOnSupportedCPU.java
@@ -28,13 +28,19 @@
  * @library /testlibrary /test/lib testcases /
  * @modules java.base/jdk.internal.misc
  *          java.management
- * @build TestUseSHA256IntrinsicsOptionOnSupportedCPU
+ *
+ * @build compiler.intrinsics.sha.cli.TestUseSHA256IntrinsicsOptionOnSupportedCPU
  * @run driver ClassFileInstaller sun.hotspot.WhiteBox
  *                                sun.hotspot.WhiteBox$WhiteBoxPermission
  * @run main/othervm -Xbootclasspath/a:. -XX:+UnlockDiagnosticVMOptions
  *                   -XX:+WhiteBoxAPI
- *                   TestUseSHA256IntrinsicsOptionOnSupportedCPU
+ *                   compiler.intrinsics.sha.cli.TestUseSHA256IntrinsicsOptionOnSupportedCPU
  */
+
+package compiler.intrinsics.sha.cli;
+
+import compiler.intrinsics.sha.cli.testcases.GenericTestCaseForSupportedCPU;
+
 public class TestUseSHA256IntrinsicsOptionOnSupportedCPU {
     public static void main(String args[]) throws Throwable {
         new SHAOptionsBase(new GenericTestCaseForSupportedCPU(
diff --git a/hotspot/test/compiler/intrinsics/sha/cli/TestUseSHA256IntrinsicsOptionOnUnsupportedCPU.java b/hotspot/test/compiler/intrinsics/sha/cli/TestUseSHA256IntrinsicsOptionOnUnsupportedCPU.java
index a23dd21..c9f5ec5 100644
--- a/hotspot/test/compiler/intrinsics/sha/cli/TestUseSHA256IntrinsicsOptionOnUnsupportedCPU.java
+++ b/hotspot/test/compiler/intrinsics/sha/cli/TestUseSHA256IntrinsicsOptionOnUnsupportedCPU.java
@@ -28,13 +28,23 @@
  * @library /testlibrary /test/lib testcases /
  * @modules java.base/jdk.internal.misc
  *          java.management
- * @build TestUseSHA256IntrinsicsOptionOnUnsupportedCPU
+ *
+ * @build compiler.intrinsics.sha.cli.TestUseSHA256IntrinsicsOptionOnUnsupportedCPU
  * @run driver ClassFileInstaller sun.hotspot.WhiteBox
  *                                sun.hotspot.WhiteBox$WhiteBoxPermission
  * @run main/othervm -Xbootclasspath/a:. -XX:+UnlockDiagnosticVMOptions
  *                   -XX:+WhiteBoxAPI
- *                   TestUseSHA256IntrinsicsOptionOnUnsupportedCPU
+ *                   compiler.intrinsics.sha.cli.TestUseSHA256IntrinsicsOptionOnUnsupportedCPU
  */
+
+package compiler.intrinsics.sha.cli;
+
+import compiler.intrinsics.sha.cli.testcases.GenericTestCaseForOtherCPU;
+import compiler.intrinsics.sha.cli.testcases.GenericTestCaseForUnsupportedAArch64CPU;
+import compiler.intrinsics.sha.cli.testcases.GenericTestCaseForUnsupportedSparcCPU;
+import compiler.intrinsics.sha.cli.testcases.GenericTestCaseForUnsupportedX86CPU;
+import compiler.intrinsics.sha.cli.testcases.UseSHAIntrinsicsSpecificTestCaseForUnsupportedCPU;
+
 public class TestUseSHA256IntrinsicsOptionOnUnsupportedCPU {
     public static void main(String args[]) throws Throwable {
         new SHAOptionsBase(
diff --git a/hotspot/test/compiler/intrinsics/sha/cli/TestUseSHA512IntrinsicsOptionOnSupportedCPU.java b/hotspot/test/compiler/intrinsics/sha/cli/TestUseSHA512IntrinsicsOptionOnSupportedCPU.java
index fb7c065..b5f2ac2 100644
--- a/hotspot/test/compiler/intrinsics/sha/cli/TestUseSHA512IntrinsicsOptionOnSupportedCPU.java
+++ b/hotspot/test/compiler/intrinsics/sha/cli/TestUseSHA512IntrinsicsOptionOnSupportedCPU.java
@@ -28,13 +28,19 @@
  * @library /testlibrary /test/lib testcases /
  * @modules java.base/jdk.internal.misc
  *          java.management
- * @build TestUseSHA512IntrinsicsOptionOnSupportedCPU
+ *
+ * @build compiler.intrinsics.sha.cli.TestUseSHA512IntrinsicsOptionOnSupportedCPU
  * @run driver ClassFileInstaller sun.hotspot.WhiteBox
  *                                sun.hotspot.WhiteBox$WhiteBoxPermission
  * @run main/othervm -Xbootclasspath/a:. -XX:+UnlockDiagnosticVMOptions
  *                   -XX:+WhiteBoxAPI
- *                   TestUseSHA512IntrinsicsOptionOnSupportedCPU
+ *                   compiler.intrinsics.sha.cli.TestUseSHA512IntrinsicsOptionOnSupportedCPU
  */
+
+package compiler.intrinsics.sha.cli;
+
+import compiler.intrinsics.sha.cli.testcases.GenericTestCaseForSupportedCPU;
+
 public class TestUseSHA512IntrinsicsOptionOnSupportedCPU {
     public static void main(String args[]) throws Throwable {
         new SHAOptionsBase(new GenericTestCaseForSupportedCPU(
diff --git a/hotspot/test/compiler/intrinsics/sha/cli/TestUseSHA512IntrinsicsOptionOnUnsupportedCPU.java b/hotspot/test/compiler/intrinsics/sha/cli/TestUseSHA512IntrinsicsOptionOnUnsupportedCPU.java
index d57c63e..26c989e 100644
--- a/hotspot/test/compiler/intrinsics/sha/cli/TestUseSHA512IntrinsicsOptionOnUnsupportedCPU.java
+++ b/hotspot/test/compiler/intrinsics/sha/cli/TestUseSHA512IntrinsicsOptionOnUnsupportedCPU.java
@@ -28,13 +28,23 @@
  * @library /testlibrary /test/lib testcases /
  * @modules java.base/jdk.internal.misc
  *          java.management
- * @build TestUseSHA512IntrinsicsOptionOnUnsupportedCPU
+ *
+ * @build compiler.intrinsics.sha.cli.TestUseSHA512IntrinsicsOptionOnUnsupportedCPU
  * @run driver ClassFileInstaller sun.hotspot.WhiteBox
  *                                sun.hotspot.WhiteBox$WhiteBoxPermission
  * @run main/othervm -Xbootclasspath/a:. -XX:+UnlockDiagnosticVMOptions
  *                   -XX:+WhiteBoxAPI
- *                   TestUseSHA512IntrinsicsOptionOnUnsupportedCPU
+ *                   compiler.intrinsics.sha.cli.TestUseSHA512IntrinsicsOptionOnUnsupportedCPU
  */
+
+package compiler.intrinsics.sha.cli;
+
+import compiler.intrinsics.sha.cli.testcases.GenericTestCaseForOtherCPU;
+import compiler.intrinsics.sha.cli.testcases.GenericTestCaseForUnsupportedAArch64CPU;
+import compiler.intrinsics.sha.cli.testcases.GenericTestCaseForUnsupportedSparcCPU;
+import compiler.intrinsics.sha.cli.testcases.GenericTestCaseForUnsupportedX86CPU;
+import compiler.intrinsics.sha.cli.testcases.UseSHAIntrinsicsSpecificTestCaseForUnsupportedCPU;
+
 public class TestUseSHA512IntrinsicsOptionOnUnsupportedCPU {
     public static void main(String args[]) throws Throwable {
         new SHAOptionsBase(
diff --git a/hotspot/test/compiler/intrinsics/sha/cli/TestUseSHAOptionOnSupportedCPU.java b/hotspot/test/compiler/intrinsics/sha/cli/TestUseSHAOptionOnSupportedCPU.java
index 5903dfb..7938712 100644
--- a/hotspot/test/compiler/intrinsics/sha/cli/TestUseSHAOptionOnSupportedCPU.java
+++ b/hotspot/test/compiler/intrinsics/sha/cli/TestUseSHAOptionOnSupportedCPU.java
@@ -28,12 +28,20 @@
  * @library /testlibrary /test/lib testcases /
  * @modules java.base/jdk.internal.misc
  *          java.management
- * @build TestUseSHAOptionOnSupportedCPU
+ *
+ * @build compiler.intrinsics.sha.cli.TestUseSHAOptionOnSupportedCPU
  * @run driver ClassFileInstaller sun.hotspot.WhiteBox
  *                                sun.hotspot.WhiteBox$WhiteBoxPermission
  * @run main/othervm -Xbootclasspath/a:. -XX:+UnlockDiagnosticVMOptions
- *                   -XX:+WhiteBoxAPI TestUseSHAOptionOnSupportedCPU
+ *                   -XX:+WhiteBoxAPI
+ *                   compiler.intrinsics.sha.cli.TestUseSHAOptionOnSupportedCPU
  */
+
+package compiler.intrinsics.sha.cli;
+
+import compiler.intrinsics.sha.cli.testcases.GenericTestCaseForSupportedCPU;
+import compiler.intrinsics.sha.cli.testcases.UseSHASpecificTestCaseForSupportedCPU;
+
 public class TestUseSHAOptionOnSupportedCPU {
     public static void main(String args[]) throws Throwable {
         new SHAOptionsBase(
diff --git a/hotspot/test/compiler/intrinsics/sha/cli/TestUseSHAOptionOnUnsupportedCPU.java b/hotspot/test/compiler/intrinsics/sha/cli/TestUseSHAOptionOnUnsupportedCPU.java
index 3fed6d2..4a5a34c 100644
--- a/hotspot/test/compiler/intrinsics/sha/cli/TestUseSHAOptionOnUnsupportedCPU.java
+++ b/hotspot/test/compiler/intrinsics/sha/cli/TestUseSHAOptionOnUnsupportedCPU.java
@@ -28,12 +28,22 @@
  * @library /testlibrary /test/lib testcases /
  * @modules java.base/jdk.internal.misc
  *          java.management
- * @build TestUseSHAOptionOnUnsupportedCPU
+ * @build compiler.intrinsics.sha.cli.TestUseSHAOptionOnUnsupportedCPU
  * @run driver ClassFileInstaller sun.hotspot.WhiteBox
  *                                sun.hotspot.WhiteBox$WhiteBoxPermission
  * @run main/othervm -Xbootclasspath/a:. -XX:+UnlockDiagnosticVMOptions
- *                   -XX:+WhiteBoxAPI TestUseSHAOptionOnUnsupportedCPU
+ *                   -XX:+WhiteBoxAPI
+ *                   compiler.intrinsics.sha.cli.TestUseSHAOptionOnUnsupportedCPU
  */
+
+package compiler.intrinsics.sha.cli;
+
+import compiler.intrinsics.sha.cli.testcases.GenericTestCaseForOtherCPU;
+import compiler.intrinsics.sha.cli.testcases.GenericTestCaseForUnsupportedAArch64CPU;
+import compiler.intrinsics.sha.cli.testcases.GenericTestCaseForUnsupportedSparcCPU;
+import compiler.intrinsics.sha.cli.testcases.GenericTestCaseForUnsupportedX86CPU;
+import compiler.intrinsics.sha.cli.testcases.UseSHASpecificTestCaseForUnsupportedCPU;
+
 public class TestUseSHAOptionOnUnsupportedCPU {
     public static void main(String args[]) throws Throwable {
         new SHAOptionsBase(
diff --git a/hotspot/test/compiler/intrinsics/sha/cli/testcases/GenericTestCaseForOtherCPU.java b/hotspot/test/compiler/intrinsics/sha/cli/testcases/GenericTestCaseForOtherCPU.java
index 09dc581..24487f8 100644
--- a/hotspot/test/compiler/intrinsics/sha/cli/testcases/GenericTestCaseForOtherCPU.java
+++ b/hotspot/test/compiler/intrinsics/sha/cli/testcases/GenericTestCaseForOtherCPU.java
@@ -21,6 +21,9 @@
  * questions.
  */
 
+package compiler.intrinsics.sha.cli.testcases;
+
+import compiler.intrinsics.sha.cli.SHAOptionsBase;
 import jdk.test.lib.ExitCode;
 import jdk.test.lib.Platform;
 import jdk.test.lib.cli.CommandLineOptionTest;
diff --git a/hotspot/test/compiler/intrinsics/sha/cli/testcases/GenericTestCaseForSupportedCPU.java b/hotspot/test/compiler/intrinsics/sha/cli/testcases/GenericTestCaseForSupportedCPU.java
index 553cfaf..de67a39 100644
--- a/hotspot/test/compiler/intrinsics/sha/cli/testcases/GenericTestCaseForSupportedCPU.java
+++ b/hotspot/test/compiler/intrinsics/sha/cli/testcases/GenericTestCaseForSupportedCPU.java
@@ -21,6 +21,9 @@
  * questions.
  */
 
+package compiler.intrinsics.sha.cli.testcases;
+
+import compiler.intrinsics.sha.cli.SHAOptionsBase;
 import jdk.test.lib.ExitCode;
 import jdk.test.lib.Platform;
 import jdk.test.lib.cli.CommandLineOptionTest;
diff --git a/hotspot/test/compiler/intrinsics/sha/cli/testcases/GenericTestCaseForUnsupportedAArch64CPU.java b/hotspot/test/compiler/intrinsics/sha/cli/testcases/GenericTestCaseForUnsupportedAArch64CPU.java
index 8fabc79..64e60e8 100644
--- a/hotspot/test/compiler/intrinsics/sha/cli/testcases/GenericTestCaseForUnsupportedAArch64CPU.java
+++ b/hotspot/test/compiler/intrinsics/sha/cli/testcases/GenericTestCaseForUnsupportedAArch64CPU.java
@@ -21,6 +21,9 @@
  * questions.
  */
 
+package compiler.intrinsics.sha.cli.testcases;
+
+import compiler.intrinsics.sha.cli.SHAOptionsBase;
 import jdk.test.lib.ExitCode;
 import jdk.test.lib.Platform;
 import jdk.test.lib.cli.CommandLineOptionTest;
diff --git a/hotspot/test/compiler/intrinsics/sha/cli/testcases/GenericTestCaseForUnsupportedSparcCPU.java b/hotspot/test/compiler/intrinsics/sha/cli/testcases/GenericTestCaseForUnsupportedSparcCPU.java
index 1254b8a..4698160 100644
--- a/hotspot/test/compiler/intrinsics/sha/cli/testcases/GenericTestCaseForUnsupportedSparcCPU.java
+++ b/hotspot/test/compiler/intrinsics/sha/cli/testcases/GenericTestCaseForUnsupportedSparcCPU.java
@@ -21,6 +21,9 @@
  * questions.
  */
 
+package compiler.intrinsics.sha.cli.testcases;
+
+import compiler.intrinsics.sha.cli.SHAOptionsBase;
 import jdk.test.lib.ExitCode;
 import jdk.test.lib.Platform;
 import jdk.test.lib.cli.CommandLineOptionTest;
diff --git a/hotspot/test/compiler/intrinsics/sha/cli/testcases/GenericTestCaseForUnsupportedX86CPU.java b/hotspot/test/compiler/intrinsics/sha/cli/testcases/GenericTestCaseForUnsupportedX86CPU.java
index 599be2c..2b90bed 100644
--- a/hotspot/test/compiler/intrinsics/sha/cli/testcases/GenericTestCaseForUnsupportedX86CPU.java
+++ b/hotspot/test/compiler/intrinsics/sha/cli/testcases/GenericTestCaseForUnsupportedX86CPU.java
@@ -21,12 +21,15 @@
  * questions.
  */
 
+package compiler.intrinsics.sha.cli.testcases;
+
+import compiler.intrinsics.sha.cli.SHAOptionsBase;
 import jdk.test.lib.ExitCode;
 import jdk.test.lib.Platform;
 import jdk.test.lib.cli.CommandLineOptionTest;
 import jdk.test.lib.cli.predicate.AndPredicate;
-import jdk.test.lib.cli.predicate.OrPredicate;
 import jdk.test.lib.cli.predicate.NotPredicate;
+import jdk.test.lib.cli.predicate.OrPredicate;
 
 /**
  * Generic test case for SHA-related options targeted to X86 CPUs that don't
diff --git a/hotspot/test/compiler/intrinsics/sha/cli/testcases/UseSHAIntrinsicsSpecificTestCaseForUnsupportedCPU.java b/hotspot/test/compiler/intrinsics/sha/cli/testcases/UseSHAIntrinsicsSpecificTestCaseForUnsupportedCPU.java
index a4dfe43..3618147 100644
--- a/hotspot/test/compiler/intrinsics/sha/cli/testcases/UseSHAIntrinsicsSpecificTestCaseForUnsupportedCPU.java
+++ b/hotspot/test/compiler/intrinsics/sha/cli/testcases/UseSHAIntrinsicsSpecificTestCaseForUnsupportedCPU.java
@@ -21,13 +21,16 @@
  * questions.
  */
 
+package compiler.intrinsics.sha.cli.testcases;
+
+import compiler.intrinsics.sha.cli.SHAOptionsBase;
+import compiler.testlibrary.sha.predicate.IntrinsicPredicates;
 import jdk.test.lib.ExitCode;
 import jdk.test.lib.Platform;
 import jdk.test.lib.cli.CommandLineOptionTest;
 import jdk.test.lib.cli.predicate.AndPredicate;
-import jdk.test.lib.cli.predicate.OrPredicate;
 import jdk.test.lib.cli.predicate.NotPredicate;
-import compiler.testlibrary.sha.predicate.IntrinsicPredicates;
+import jdk.test.lib.cli.predicate.OrPredicate;
 
 /**
  * Test case specific to UseSHA*Intrinsics options targeted to SPARC and AArch64
diff --git a/hotspot/test/compiler/intrinsics/sha/cli/testcases/UseSHASpecificTestCaseForSupportedCPU.java b/hotspot/test/compiler/intrinsics/sha/cli/testcases/UseSHASpecificTestCaseForSupportedCPU.java
index f4ed3bb..0a13cdb 100644
--- a/hotspot/test/compiler/intrinsics/sha/cli/testcases/UseSHASpecificTestCaseForSupportedCPU.java
+++ b/hotspot/test/compiler/intrinsics/sha/cli/testcases/UseSHASpecificTestCaseForSupportedCPU.java
@@ -21,13 +21,16 @@
  * questions.
  */
 
+package compiler.intrinsics.sha.cli.testcases;
+
+import compiler.intrinsics.sha.cli.SHAOptionsBase;
+import compiler.testlibrary.sha.predicate.IntrinsicPredicates;
 import jdk.test.lib.Asserts;
 import jdk.test.lib.ExitCode;
 import jdk.test.lib.Platform;
 import jdk.test.lib.cli.CommandLineOptionTest;
 import jdk.test.lib.cli.predicate.AndPredicate;
 import jdk.test.lib.cli.predicate.OrPredicate;
-import compiler.testlibrary.sha.predicate.IntrinsicPredicates;
 
 /**
  * UseSHA specific test case targeted to SPARC and AArch64 CPUs which
diff --git a/hotspot/test/compiler/intrinsics/sha/cli/testcases/UseSHASpecificTestCaseForUnsupportedCPU.java b/hotspot/test/compiler/intrinsics/sha/cli/testcases/UseSHASpecificTestCaseForUnsupportedCPU.java
index bc3068d..55e0f5b 100644
--- a/hotspot/test/compiler/intrinsics/sha/cli/testcases/UseSHASpecificTestCaseForUnsupportedCPU.java
+++ b/hotspot/test/compiler/intrinsics/sha/cli/testcases/UseSHASpecificTestCaseForUnsupportedCPU.java
@@ -21,14 +21,17 @@
  * questions.
  */
 
+package compiler.intrinsics.sha.cli.testcases;
+
+import compiler.intrinsics.sha.cli.SHAOptionsBase;
+import compiler.testlibrary.sha.predicate.IntrinsicPredicates;
 import jdk.test.lib.Asserts;
 import jdk.test.lib.ExitCode;
 import jdk.test.lib.Platform;
 import jdk.test.lib.cli.CommandLineOptionTest;
 import jdk.test.lib.cli.predicate.AndPredicate;
-import jdk.test.lib.cli.predicate.OrPredicate;
 import jdk.test.lib.cli.predicate.NotPredicate;
-import compiler.testlibrary.sha.predicate.IntrinsicPredicates;
+import jdk.test.lib.cli.predicate.OrPredicate;
 
 /**
  * UseSHA specific test case targeted to SPARC and AArch64 CPUs which don't
diff --git a/hotspot/test/compiler/intrinsics/sha/sanity/SHASanityTestBase.java b/hotspot/test/compiler/intrinsics/sha/sanity/SHASanityTestBase.java
index d60671c..c476d27 100644
--- a/hotspot/test/compiler/intrinsics/sha/sanity/SHASanityTestBase.java
+++ b/hotspot/test/compiler/intrinsics/sha/sanity/SHASanityTestBase.java
@@ -21,6 +21,10 @@
  * questions.
  */
 
+package compiler.intrinsics.sha.sanity;
+
+import compiler.intrinsics.sha.TestSHA;
+import compiler.testlibrary.intrinsics.Verifier;
 import sun.hotspot.WhiteBox;
 
 import java.io.FileOutputStream;
@@ -29,8 +33,6 @@
 import java.util.Properties;
 import java.util.function.BooleanSupplier;
 
-import compiler.testlibrary.intrinsics.Verifier;
-
 /**
  * Base class for sanity tests on SHA intrinsics support.
  */
diff --git a/hotspot/test/compiler/intrinsics/sha/sanity/TestSHA1Intrinsics.java b/hotspot/test/compiler/intrinsics/sha/sanity/TestSHA1Intrinsics.java
index 98ae9c3..71fd922 100644
--- a/hotspot/test/compiler/intrinsics/sha/sanity/TestSHA1Intrinsics.java
+++ b/hotspot/test/compiler/intrinsics/sha/sanity/TestSHA1Intrinsics.java
@@ -25,10 +25,12 @@
  * @test
  * @bug 8035968
  * @summary Verify that SHA-1 intrinsic is actually used.
- * @library /testlibrary /test/lib / ../
+ * @library /testlibrary /test/lib /
  * @modules java.base/jdk.internal.misc
  *          java.management
- * @build TestSHA compiler.testlibrary.intrinsics.Verifier TestSHA1Intrinsics
+ *
+ * @build compiler.testlibrary.intrinsics.Verifier
+ *        compiler.intrinsics.sha.sanity.TestSHA1Intrinsics
  * @run driver ClassFileInstaller sun.hotspot.WhiteBox
  *                                sun.hotspot.WhiteBox$WhiteBoxPermission
  * @run main/othervm -Xbootclasspath/a:. -XX:+UnlockDiagnosticVMOptions
@@ -38,7 +40,8 @@
  *                   -XX:CompileOnly=sun/security/provider/DigestBase
  *                   -XX:CompileOnly=sun/security/provider/SHA
  *                   -XX:+UseSHA1Intrinsics
- *                   -Dalgorithm=SHA-1 TestSHA1Intrinsics
+ *                   -Dalgorithm=SHA-1
+ *                   compiler.intrinsics.sha.sanity.TestSHA1Intrinsics
  * @run main/othervm -Xbootclasspath/a:. -XX:+UnlockDiagnosticVMOptions
  *                   -XX:+WhiteBoxAPI -Xbatch -XX:CompileThreshold=500
  *                   -XX:Tier4InvocationThreshold=500
@@ -46,11 +49,14 @@
  *                   -XX:CompileOnly=sun/security/provider/DigestBase
  *                   -XX:CompileOnly=sun/security/provider/SHA
  *                   -XX:-UseSHA1Intrinsics
- *                   -Dalgorithm=SHA-1 TestSHA1Intrinsics
+ *                   -Dalgorithm=SHA-1
+ *                   compiler.intrinsics.sha.sanity.TestSHA1Intrinsics
  * @run main/othervm -DverificationStrategy=VERIFY_INTRINSIC_USAGE
  *                   compiler.testlibrary.intrinsics.Verifier positive.log negative.log
  */
 
+package compiler.intrinsics.sha.sanity;
+
 import compiler.testlibrary.sha.predicate.IntrinsicPredicates;
 
 public class TestSHA1Intrinsics {
diff --git a/hotspot/test/compiler/intrinsics/sha/sanity/TestSHA1MultiBlockIntrinsics.java b/hotspot/test/compiler/intrinsics/sha/sanity/TestSHA1MultiBlockIntrinsics.java
index 4869303..ffc8185 100644
--- a/hotspot/test/compiler/intrinsics/sha/sanity/TestSHA1MultiBlockIntrinsics.java
+++ b/hotspot/test/compiler/intrinsics/sha/sanity/TestSHA1MultiBlockIntrinsics.java
@@ -25,10 +25,12 @@
  * @test
  * @bug 8035968
  * @summary Verify that SHA-1 multi block intrinsic is actually used.
- * @library /testlibrary /test/lib / ../
+ * @library /testlibrary /test/lib /
  * @modules java.base/jdk.internal.misc
  *          java.management
- * @build TestSHA compiler.testlibrary.intrinsics.Verifier TestSHA1MultiBlockIntrinsics
+ *
+ * @build compiler.testlibrary.intrinsics.Verifier
+ *        compiler.intrinsics.sha.sanity.TestSHA1MultiBlockIntrinsics
  * @run driver ClassFileInstaller sun.hotspot.WhiteBox
  *                                sun.hotspot.WhiteBox$WhiteBoxPermission
  * @run main/othervm -Xbootclasspath/a:. -XX:+UnlockDiagnosticVMOptions
@@ -39,7 +41,8 @@
  *                   -XX:CompileOnly=sun/security/provider/SHA
  *                   -XX:+UseSHA1Intrinsics -XX:-UseSHA256Intrinsics
  *                   -XX:-UseSHA512Intrinsics
- *                   -Dalgorithm=SHA-1 TestSHA1MultiBlockIntrinsics
+ *                   -Dalgorithm=SHA-1
+ *                   compiler.intrinsics.sha.sanity.TestSHA1MultiBlockIntrinsics
  * @run main/othervm -Xbootclasspath/a:. -XX:+UnlockDiagnosticVMOptions
  *                   -XX:+WhiteBoxAPI -Xbatch -XX:CompileThreshold=500
  *                   -XX:Tier4InvocationThreshold=500
@@ -47,19 +50,21 @@
  *                   -XX:CompileOnly=sun/security/provider/DigestBase
  *                   -XX:CompileOnly=sun/security/provider/SHA
  *                   -XX:+UseSHA1Intrinsics -Dalgorithm=SHA-1
- *                   TestSHA1MultiBlockIntrinsics
+ *                   compiler.intrinsics.sha.sanity.TestSHA1MultiBlockIntrinsics
  * @run main/othervm -Xbootclasspath/a:. -XX:+UnlockDiagnosticVMOptions
  *                   -XX:+WhiteBoxAPI -Xbatch -XX:CompileThreshold=500
  *                   -XX:Tier4InvocationThreshold=500
  *                   -XX:+LogCompilation -XX:LogFile=negative.log
  *                   -XX:CompileOnly=sun/security/provider/DigestBase
  *                   -XX:CompileOnly=sun/security/provider/SHA -XX:-UseSHA
- *                   -Dalgorithm=SHA-1 TestSHA1MultiBlockIntrinsics
+ *                   -Dalgorithm=SHA-1
+ *                   compiler.intrinsics.sha.sanity.TestSHA1MultiBlockIntrinsics
  * @run main/othervm -DverificationStrategy=VERIFY_INTRINSIC_USAGE
  *                   compiler.testlibrary.intrinsics.Verifier positive.log positive_def.log
  *                   negative.log
  */
 
+package compiler.intrinsics.sha.sanity;
 import compiler.testlibrary.sha.predicate.IntrinsicPredicates;
 
 public class TestSHA1MultiBlockIntrinsics {
diff --git a/hotspot/test/compiler/intrinsics/sha/sanity/TestSHA256Intrinsics.java b/hotspot/test/compiler/intrinsics/sha/sanity/TestSHA256Intrinsics.java
index 5137333..85aa415 100644
--- a/hotspot/test/compiler/intrinsics/sha/sanity/TestSHA256Intrinsics.java
+++ b/hotspot/test/compiler/intrinsics/sha/sanity/TestSHA256Intrinsics.java
@@ -25,10 +25,12 @@
  * @test
  * @bug 8035968
  * @summary Verify that SHA-256 intrinsic is actually used.
- * @library /testlibrary /test/lib / ../
+ * @library /testlibrary /test/lib /
  * @modules java.base/jdk.internal.misc
  *          java.management
- * @build TestSHA compiler.testlibrary.intrinsics.Verifier TestSHA256Intrinsics
+ *
+ * @build compiler.testlibrary.intrinsics.Verifier
+ *        compiler.intrinsics.sha.sanity.TestSHA256Intrinsics
  * @run driver ClassFileInstaller sun.hotspot.WhiteBox
  *                                sun.hotspot.WhiteBox$WhiteBoxPermission
  * @run main/othervm -Xbootclasspath/a:. -XX:+UnlockDiagnosticVMOptions
@@ -36,38 +38,44 @@
  *                   -XX:Tier4InvocationThreshold=500
  *                   -XX:+LogCompilation -XX:LogFile=positive_224.log
  *                   -XX:CompileOnly=sun/security/provider/DigestBase
- *                   -XX:CompileOnly=sun/security/provider/SHA
+ *                   -XX:CompileOnly=sun/security/provider/SHA2
  *                   -XX:+UseSHA256Intrinsics
- *                   -Dalgorithm=SHA-224 TestSHA256Intrinsics
+ *                   -Dalgorithm=SHA-224
+ *                   compiler.intrinsics.sha.sanity.TestSHA256Intrinsics
  * @run main/othervm -Xbootclasspath/a:. -XX:+UnlockDiagnosticVMOptions
  *                   -XX:+WhiteBoxAPI -Xbatch -XX:CompileThreshold=500
  *                   -XX:Tier4InvocationThreshold=500
  *                   -XX:+LogCompilation -XX:LogFile=negative_224.log
  *                   -XX:CompileOnly=sun/security/provider/DigestBase
- *                   -XX:CompileOnly=sun/security/provider/SHA
+ *                   -XX:CompileOnly=sun/security/provider/SHA2
  *                   -XX:-UseSHA256Intrinsics
- *                   -Dalgorithm=SHA-224 TestSHA256Intrinsics
+ *                   -Dalgorithm=SHA-224
+ *                   compiler.intrinsics.sha.sanity.TestSHA256Intrinsics
  * @run main/othervm -Xbootclasspath/a:. -XX:+UnlockDiagnosticVMOptions
  *                   -XX:+WhiteBoxAPI -Xbatch -XX:CompileThreshold=500
  *                   -XX:Tier4InvocationThreshold=500
  *                   -XX:+LogCompilation -XX:LogFile=positive_256.log
  *                   -XX:CompileOnly=sun/security/provider/DigestBase
- *                   -XX:CompileOnly=sun/security/provider/SHA
+ *                   -XX:CompileOnly=sun/security/provider/SHA2
  *                   -XX:+UseSHA256Intrinsics
- *                   -Dalgorithm=SHA-256 TestSHA256Intrinsics
+ *                   -Dalgorithm=SHA-256
+ *                   compiler.intrinsics.sha.sanity.TestSHA256Intrinsics
  * @run main/othervm -Xbootclasspath/a:. -XX:+UnlockDiagnosticVMOptions
  *                   -XX:+WhiteBoxAPI -Xbatch -XX:CompileThreshold=500
  *                   -XX:Tier4InvocationThreshold=500
  *                   -XX:+LogCompilation -XX:LogFile=negative_256.log
  *                   -XX:CompileOnly=sun/security/provider/DigestBase
- *                   -XX:CompileOnly=sun/security/provider/SHA
+ *                   -XX:CompileOnly=sun/security/provider/SHA2
  *                   -XX:-UseSHA256Intrinsics
- *                   -Dalgorithm=SHA-256 TestSHA256Intrinsics
+ *                   -Dalgorithm=SHA-256
+ *                   compiler.intrinsics.sha.sanity.TestSHA256Intrinsics
  * @run main/othervm -DverificationStrategy=VERIFY_INTRINSIC_USAGE
  *                    compiler.testlibrary.intrinsics.Verifier positive_224.log positive_256.log
  *                    negative_224.log negative_256.log
  */
 
+package compiler.intrinsics.sha.sanity;
+
 import compiler.testlibrary.sha.predicate.IntrinsicPredicates;
 
 public class TestSHA256Intrinsics {
diff --git a/hotspot/test/compiler/intrinsics/sha/sanity/TestSHA256MultiBlockIntrinsics.java b/hotspot/test/compiler/intrinsics/sha/sanity/TestSHA256MultiBlockIntrinsics.java
index 214f666..292e0d0 100644
--- a/hotspot/test/compiler/intrinsics/sha/sanity/TestSHA256MultiBlockIntrinsics.java
+++ b/hotspot/test/compiler/intrinsics/sha/sanity/TestSHA256MultiBlockIntrinsics.java
@@ -25,10 +25,12 @@
  * @test
  * @bug 8035968
  * @summary Verify that SHA-256 multi block intrinsic is actually used.
- * @library /testlibrary /test/lib / ../
+ * @library /testlibrary /test/lib /
  * @modules java.base/jdk.internal.misc
  *          java.management
- * @build TestSHA compiler.testlibrary.intrinsics.Verifier TestSHA256MultiBlockIntrinsics
+ *
+ * @build compiler.testlibrary.intrinsics.Verifier
+ *        compiler.intrinsics.sha.sanity.TestSHA256MultiBlockIntrinsics
  * @run driver ClassFileInstaller sun.hotspot.WhiteBox
  *                                sun.hotspot.WhiteBox$WhiteBoxPermission
  * @run main/othervm -Xbootclasspath/a:. -XX:+UnlockDiagnosticVMOptions
@@ -36,34 +38,37 @@
  *                   -XX:Tier4InvocationThreshold=500
  *                   -XX:+LogCompilation -XX:LogFile=positive_224.log
  *                   -XX:CompileOnly=sun/security/provider/DigestBase
- *                   -XX:CompileOnly=sun/security/provider/SHA
+ *                   -XX:CompileOnly=sun/security/provider/SHA2
  *                   -XX:+UseSHA256Intrinsics -XX:-UseSHA1Intrinsics
  *                   -XX:-UseSHA512Intrinsics
- *                   -Dalgorithm=SHA-224 TestSHA256MultiBlockIntrinsics
+ *                   -Dalgorithm=SHA-224
+ *                   compiler.intrinsics.sha.sanity.TestSHA256MultiBlockIntrinsics
  * @run main/othervm -Xbootclasspath/a:. -XX:+UnlockDiagnosticVMOptions
  *                   -XX:+WhiteBoxAPI -Xbatch -XX:CompileThreshold=500
  *                   -XX:Tier4InvocationThreshold=500
  *                   -XX:+LogCompilation -XX:LogFile=positive_224_def.log
  *                   -XX:CompileOnly=sun/security/provider/DigestBase
- *                   -XX:CompileOnly=sun/security/provider/SHA
+ *                   -XX:CompileOnly=sun/security/provider/SHA2
  *                   -XX:+UseSHA256Intrinsics -Dalgorithm=SHA-224
- *                   TestSHA256MultiBlockIntrinsics
+ *                   compiler.intrinsics.sha.sanity.TestSHA256MultiBlockIntrinsics
  * @run main/othervm -Xbootclasspath/a:. -XX:+UnlockDiagnosticVMOptions
  *                   -XX:+WhiteBoxAPI -Xbatch -XX:CompileThreshold=500
  *                   -XX:Tier4InvocationThreshold=500
  *                   -XX:+LogCompilation -XX:LogFile=negative_224.log
  *                   -XX:CompileOnly=sun/security/provider/DigestBase
- *                   -XX:CompileOnly=sun/security/provider/SHA -XX:-UseSHA
- *                   -Dalgorithm=SHA-224 TestSHA256MultiBlockIntrinsics
+ *                   -XX:CompileOnly=sun/security/provider/SHA2 -XX:-UseSHA
+ *                   -Dalgorithm=SHA-224
+ *                   compiler.intrinsics.sha.sanity.TestSHA256MultiBlockIntrinsics
  * @run main/othervm -Xbootclasspath/a:. -XX:+UnlockDiagnosticVMOptions
  *                   -XX:+WhiteBoxAPI -Xbatch -XX:CompileThreshold=500
  *                   -XX:Tier4InvocationThreshold=500
  *                   -XX:+LogCompilation -XX:LogFile=positive_256.log
  *                   -XX:CompileOnly=sun/security/provider/DigestBase
- *                   -XX:CompileOnly=sun/security/provider/SHA
+ *                   -XX:CompileOnly=sun/security/provider/SHA2
  *                   -XX:+UseSHA256Intrinsics -XX:-UseSHA1Intrinsics
  *                   -XX:-UseSHA512Intrinsics
- *                   -Dalgorithm=SHA-256 TestSHA256MultiBlockIntrinsics
+ *                   -Dalgorithm=SHA-256
+ *                   compiler.intrinsics.sha.sanity.TestSHA256MultiBlockIntrinsics
  * @run main/othervm -Xbootclasspath/a:. -XX:+UnlockDiagnosticVMOptions
  *                   -XX:+WhiteBoxAPI -Xbatch -XX:CompileThreshold=500
  *                   -XX:Tier4InvocationThreshold=500
@@ -71,20 +76,22 @@
  *                   -XX:CompileOnly=sun/security/provider/DigestBase
  *                   -XX:CompileOnly=sun/security/provider/SHA
  *                   -XX:+UseSHA256Intrinsics -Dalgorithm=SHA-256
- *                   TestSHA256MultiBlockIntrinsics
+ *                   compiler.intrinsics.sha.sanity.TestSHA256MultiBlockIntrinsics
  * @run main/othervm -Xbootclasspath/a:. -XX:+UnlockDiagnosticVMOptions
  *                   -XX:+WhiteBoxAPI -Xbatch -XX:CompileThreshold=500
  *                   -XX:Tier4InvocationThreshold=500
  *                   -XX:+LogCompilation -XX:LogFile=negative_256.log
  *                   -XX:CompileOnly=sun/security/provider/DigestBase
  *                   -XX:CompileOnly=sun/security/provider/SHA -XX:-UseSHA
- *                   -Dalgorithm=SHA-256 TestSHA256MultiBlockIntrinsics
+ *                   -Dalgorithm=SHA-256
+ *                   compiler.intrinsics.sha.sanity.TestSHA256MultiBlockIntrinsics
  * @run main/othervm -DverificationStrategy=VERIFY_INTRINSIC_USAGE
  *                   compiler.testlibrary.intrinsics.Verifier positive_224.log positive_256.log
  *                   positive_224_def.log positive_256_def.log negative_224.log
  *                   negative_256.log
  */
 
+package compiler.intrinsics.sha.sanity;
 import compiler.testlibrary.sha.predicate.IntrinsicPredicates;
 
 public class TestSHA256MultiBlockIntrinsics {
diff --git a/hotspot/test/compiler/intrinsics/sha/sanity/TestSHA512Intrinsics.java b/hotspot/test/compiler/intrinsics/sha/sanity/TestSHA512Intrinsics.java
index 5ac5fc5..de8be87 100644
--- a/hotspot/test/compiler/intrinsics/sha/sanity/TestSHA512Intrinsics.java
+++ b/hotspot/test/compiler/intrinsics/sha/sanity/TestSHA512Intrinsics.java
@@ -25,10 +25,12 @@
  * @test
  * @bug 8035968
  * @summary Verify that SHA-512 intrinsic is actually used.
- * @library /testlibrary /test/lib / ../
+ * @library /testlibrary /test/lib /
  * @modules java.base/jdk.internal.misc
  *          java.management
- * @build TestSHA compiler.testlibrary.intrinsics.Verifier TestSHA512Intrinsics
+ *
+ * @build compiler.testlibrary.intrinsics.Verifier
+ *        compiler.intrinsics.sha.sanity.TestSHA512Intrinsics
  * @run driver ClassFileInstaller sun.hotspot.WhiteBox
  *                                sun.hotspot.WhiteBox$WhiteBoxPermission
  * @run main/othervm -Xbootclasspath/a:. -XX:+UnlockDiagnosticVMOptions
@@ -36,38 +38,44 @@
  *                   -XX:Tier4InvocationThreshold=500
  *                   -XX:+LogCompilation -XX:LogFile=positive_384.log
  *                   -XX:CompileOnly=sun/security/provider/DigestBase
- *                   -XX:CompileOnly=sun/security/provider/SHA
+ *                   -XX:CompileOnly=sun/security/provider/SHA5
  *                   -XX:+UseSHA512Intrinsics
- *                   -Dalgorithm=SHA-384 TestSHA512Intrinsics
+ *                   -Dalgorithm=SHA-384
+ *                   compiler.intrinsics.sha.sanity.TestSHA512Intrinsics
  * @run main/othervm -Xbootclasspath/a:. -XX:+UnlockDiagnosticVMOptions
  *                   -XX:+WhiteBoxAPI -Xbatch -XX:CompileThreshold=500
  *                   -XX:Tier4InvocationThreshold=500
  *                   -XX:+LogCompilation -XX:LogFile=negative_384.log
  *                   -XX:CompileOnly=sun/security/provider/DigestBase
- *                   -XX:CompileOnly=sun/security/provider/SHA
+ *                   -XX:CompileOnly=sun/security/provider/SHA5
  *                   -XX:-UseSHA512Intrinsics
- *                   -Dalgorithm=SHA-384 TestSHA512Intrinsics
+ *                   -Dalgorithm=SHA-384
+ *                   compiler.intrinsics.sha.sanity.TestSHA512Intrinsics
  * @run main/othervm -Xbootclasspath/a:. -XX:+UnlockDiagnosticVMOptions
  *                   -XX:+WhiteBoxAPI -Xbatch -XX:CompileThreshold=500
  *                   -XX:Tier4InvocationThreshold=500
  *                   -XX:+LogCompilation -XX:LogFile=positive_512.log
  *                   -XX:CompileOnly=sun/security/provider/DigestBase
- *                   -XX:CompileOnly=sun/security/provider/SHA
+ *                   -XX:CompileOnly=sun/security/provider/SHA5
  *                   -XX:+UseSHA512Intrinsics
- *                   -Dalgorithm=SHA-512 TestSHA512Intrinsics
+ *                   -Dalgorithm=SHA-512
+ *                   compiler.intrinsics.sha.sanity.TestSHA512Intrinsics
  * @run main/othervm -Xbootclasspath/a:. -XX:+UnlockDiagnosticVMOptions
  *                   -XX:+WhiteBoxAPI -Xbatch -XX:CompileThreshold=500
  *                   -XX:Tier4InvocationThreshold=500
  *                   -XX:+LogCompilation -XX:LogFile=negative_512.log
  *                   -XX:CompileOnly=sun/security/provider/DigestBase
- *                   -XX:CompileOnly=sun/security/provider/SHA
+ *                   -XX:CompileOnly=sun/security/provider/SHA5
  *                   -XX:-UseSHA512Intrinsics
- *                   -Dalgorithm=SHA-512 TestSHA512Intrinsics
+ *                   -Dalgorithm=SHA-512
+ *                   compiler.intrinsics.sha.sanity.TestSHA512Intrinsics
  * @run main/othervm -DverificationStrategy=VERIFY_INTRINSIC_USAGE
  *                    compiler.testlibrary.intrinsics.Verifier positive_384.log positive_512.log
  *                    negative_384.log negative_512.log
  */
 
+package compiler.intrinsics.sha.sanity;
+
 import compiler.testlibrary.sha.predicate.IntrinsicPredicates;
 
 public class TestSHA512Intrinsics {
diff --git a/hotspot/test/compiler/intrinsics/sha/sanity/TestSHA512MultiBlockIntrinsics.java b/hotspot/test/compiler/intrinsics/sha/sanity/TestSHA512MultiBlockIntrinsics.java
index 7226483..0086412 100644
--- a/hotspot/test/compiler/intrinsics/sha/sanity/TestSHA512MultiBlockIntrinsics.java
+++ b/hotspot/test/compiler/intrinsics/sha/sanity/TestSHA512MultiBlockIntrinsics.java
@@ -25,10 +25,12 @@
  * @test
  * @bug 8035968
  * @summary Verify that SHA-512 multi block intrinsic is actually used.
- * @library /testlibrary /test/lib / ../
+ * @library /testlibrary /test/lib /
  * @modules java.base/jdk.internal.misc
  *          java.management
- * @build TestSHA compiler.testlibrary.intrinsics.Verifier TestSHA512MultiBlockIntrinsics
+ *
+ * @build compiler.testlibrary.intrinsics.Verifier
+ *        compiler.intrinsics.sha.sanity.TestSHA512MultiBlockIntrinsics
  * @run driver ClassFileInstaller sun.hotspot.WhiteBox
  *                                sun.hotspot.WhiteBox$WhiteBoxPermission
  * @run main/othervm -Xbootclasspath/a:. -XX:+UnlockDiagnosticVMOptions
@@ -36,55 +38,61 @@
  *                   -XX:Tier4InvocationThreshold=500
  *                   -XX:+LogCompilation -XX:LogFile=positive_384.log
  *                   -XX:CompileOnly=sun/security/provider/DigestBase
- *                   -XX:CompileOnly=sun/security/provider/SHA
+ *                   -XX:CompileOnly=sun/security/provider/SHA5
  *                   -XX:+UseSHA512Intrinsics -XX:-UseSHA1Intrinsics
  *                   -XX:-UseSHA256Intrinsics
- *                   -Dalgorithm=SHA-384 TestSHA512MultiBlockIntrinsics
+ *                   -Dalgorithm=SHA-384
+ *                   compiler.intrinsics.sha.sanity.TestSHA512MultiBlockIntrinsics
  * @run main/othervm -Xbootclasspath/a:. -XX:+UnlockDiagnosticVMOptions
  *                   -XX:+WhiteBoxAPI -Xbatch -XX:CompileThreshold=500
  *                   -XX:Tier4InvocationThreshold=500
  *                   -XX:+LogCompilation -XX:LogFile=positive_384_def.log
  *                   -XX:CompileOnly=sun/security/provider/DigestBase
- *                   -XX:CompileOnly=sun/security/provider/SHA
+ *                   -XX:CompileOnly=sun/security/provider/SHA5
  *                   -XX:+UseSHA512Intrinsics -Dalgorithm=SHA-384
- *                   TestSHA512MultiBlockIntrinsics
+ *                   compiler.intrinsics.sha.sanity.TestSHA512MultiBlockIntrinsics
  * @run main/othervm -Xbootclasspath/a:. -XX:+UnlockDiagnosticVMOptions
  *                   -XX:+WhiteBoxAPI -Xbatch -XX:CompileThreshold=500
  *                   -XX:Tier4InvocationThreshold=500
  *                   -XX:+LogCompilation -XX:LogFile=negative_384.log
  *                   -XX:CompileOnly=sun/security/provider/DigestBase
- *                   -XX:CompileOnly=sun/security/provider/SHA -XX:-UseSHA
- *                   -Dalgorithm=SHA-384 TestSHA1Intrinsics
+ *                   -XX:CompileOnly=sun/security/provider/SHA5 -XX:-UseSHA
+ *                   -Dalgorithm=SHA-384
+ *                   compiler.intrinsics.sha.sanity.TestSHA1Intrinsics
  * @run main/othervm -Xbootclasspath/a:. -XX:+UnlockDiagnosticVMOptions
  *                   -XX:+WhiteBoxAPI -Xbatch -XX:CompileThreshold=500
  *                   -XX:Tier4InvocationThreshold=500
  *                   -XX:+LogCompilation -XX:LogFile=positive_512.log
  *                   -XX:CompileOnly=sun/security/provider/DigestBase
- *                   -XX:CompileOnly=sun/security/provider/SHA
+ *                   -XX:CompileOnly=sun/security/provider/SHA5
  *                   -XX:+UseSHA512Intrinsics -XX:-UseSHA1Intrinsics
  *                   -XX:-UseSHA256Intrinsics
- *                   -Dalgorithm=SHA-512 TestSHA512MultiBlockIntrinsics
+ *                   -Dalgorithm=SHA-512
+ *                   compiler.intrinsics.sha.sanity.TestSHA512MultiBlockIntrinsics
  * @run main/othervm -Xbootclasspath/a:. -XX:+UnlockDiagnosticVMOptions
  *                   -XX:+WhiteBoxAPI -Xbatch -XX:CompileThreshold=500
  *                   -XX:Tier4InvocationThreshold=500
  *                   -XX:+LogCompilation -XX:LogFile=positive_512_def.log
  *                   -XX:CompileOnly=sun/security/provider/DigestBase
- *                   -XX:CompileOnly=sun/security/provider/SHA
+ *                   -XX:CompileOnly=sun/security/provider/SHA5
  *                   -XX:+UseSHA512Intrinsics -Dalgorithm=SHA-512
- *                   TestSHA512MultiBlockIntrinsics
+ *                   compiler.intrinsics.sha.sanity.TestSHA512MultiBlockIntrinsics
  * @run main/othervm -Xbootclasspath/a:. -XX:+UnlockDiagnosticVMOptions
  *                   -XX:+WhiteBoxAPI -Xbatch -XX:CompileThreshold=500
  *                   -XX:Tier4InvocationThreshold=500
  *                   -XX:+LogCompilation -XX:LogFile=negative_512.log
  *                   -XX:CompileOnly=sun/security/provider/DigestBase
- *                   -XX:CompileOnly=sun/security/provider/SHA -XX:-UseSHA
- *                   -Dalgorithm=SHA-512 TestSHA512MultiBlockIntrinsics
+ *                   -XX:CompileOnly=sun/security/provider/SHA5 -XX:-UseSHA
+ *                   -Dalgorithm=SHA-512
+ *                   compiler.intrinsics.sha.sanity.TestSHA512MultiBlockIntrinsics
  * @run main/othervm -DverificationStrategy=VERIFY_INTRINSIC_USAGE
  *                    compiler.testlibrary.intrinsics.Verifier positive_384.log positive_512.log
  *                    positive_384_def.log positive_512_def.log negative_384.log
  *                    negative_512.log
  */
 
+package compiler.intrinsics.sha.sanity;
+
 import compiler.testlibrary.sha.predicate.IntrinsicPredicates;
 
 public class TestSHA512MultiBlockIntrinsics {
diff --git a/hotspot/test/compiler/intrinsics/string/TestHasNegatives.java b/hotspot/test/compiler/intrinsics/string/TestHasNegatives.java
index 587eb0c..df75e4d 100644
--- a/hotspot/test/compiler/intrinsics/string/TestHasNegatives.java
+++ b/hotspot/test/compiler/intrinsics/string/TestHasNegatives.java
@@ -28,13 +28,13 @@
  * @bug 8054307
  * @summary Validates StringCoding.hasNegatives intrinsic with a small range of tests.
  * @library /compiler/patches
+ *
  * @build java.base/java.lang.Helper
  * @build compiler.intrinsics.string.TestHasNegatives
  * @run main compiler.intrinsics.string.TestHasNegatives
  */
-package compiler.intrinsics.string;
 
-import java.lang.Helper;
+package compiler.intrinsics.string;
 
 /*
  * @summary Validates StringCoding.hasNegatives intrinsic with a small
diff --git a/hotspot/test/compiler/intrinsics/string/TestStringConstruction.java b/hotspot/test/compiler/intrinsics/string/TestStringConstruction.java
index 20c010d..bdd0205 100644
--- a/hotspot/test/compiler/intrinsics/string/TestStringConstruction.java
+++ b/hotspot/test/compiler/intrinsics/string/TestStringConstruction.java
@@ -25,8 +25,16 @@
  * @test
  * @bug 8142303
  * @summary Tests handling of invalid array indices in C2 intrinsic if explicit range check in Java code is not inlined.
- * @run main/othervm -XX:CompileCommand=inline,java.lang.String::* -XX:CompileCommand=inline,java.lang.StringUTF16::* -XX:CompileCommand=exclude,java.lang.String::checkBoundsOffCount TestStringConstruction
+ *
+ * @run main/othervm
+ *      -XX:CompileCommand=inline,java.lang.String::*
+ *      -XX:CompileCommand=inline,java.lang.StringUTF16::*
+ *      -XX:CompileCommand=exclude,java.lang.String::checkBoundsOffCount
+ *      compiler.intrinsics.string.TestStringConstruction
  */
+
+package compiler.intrinsics.string;
+
 public class TestStringConstruction {
 
     public static void main(String[] args) {
diff --git a/hotspot/test/compiler/intrinsics/stringequals/TestStringEqualsBadLength.java b/hotspot/test/compiler/intrinsics/string/TestStringEqualsBadLength.java
similarity index 95%
rename from hotspot/test/compiler/intrinsics/stringequals/TestStringEqualsBadLength.java
rename to hotspot/test/compiler/intrinsics/string/TestStringEqualsBadLength.java
index 0de5175d2..08f9986 100644
--- a/hotspot/test/compiler/intrinsics/stringequals/TestStringEqualsBadLength.java
+++ b/hotspot/test/compiler/intrinsics/string/TestStringEqualsBadLength.java
@@ -25,10 +25,13 @@
  * @test
  * @bug 8027445
  * @summary String.equals() may be called with a length whose upper bits are not cleared
- * @run main/othervm -XX:-UseOnStackReplacement -XX:-BackgroundCompilation TestStringEqualsBadLength
  *
+ * @run main/othervm -XX:-UseOnStackReplacement -XX:-BackgroundCompilation
+ *      compiler.intrinsics.string.TestStringEqualsBadLength
  */
 
+package compiler.intrinsics.string;
+
 import java.util.Arrays;
 
 public class TestStringEqualsBadLength {
diff --git a/hotspot/test/compiler/intrinsics/string/TestStringIntrinsicMemoryFlow.java b/hotspot/test/compiler/intrinsics/string/TestStringIntrinsicMemoryFlow.java
index f3cb516..6918b52 100644
--- a/hotspot/test/compiler/intrinsics/string/TestStringIntrinsicMemoryFlow.java
+++ b/hotspot/test/compiler/intrinsics/string/TestStringIntrinsicMemoryFlow.java
@@ -21,16 +21,20 @@
  * questions.
  */
 
-import jdk.test.lib.Asserts;
-
 /*
  * @test
  * @bug 8144212
  * @summary Check for correct memory flow with the String compress/inflate intrinsics.
  * @modules java.base/jdk.internal.misc
  * @library /testlibrary
- * @run main TestStringIntrinsicMemoryFlow
+ *
+ * @run main compiler.intrinsics.string.TestStringIntrinsicMemoryFlow
  */
+
+package compiler.intrinsics.string;
+
+import jdk.test.lib.Asserts;
+
 public class TestStringIntrinsicMemoryFlow {
 
     public static void main(String[] args) {
diff --git a/hotspot/test/compiler/intrinsics/string/TestStringIntrinsicRangeChecks.java b/hotspot/test/compiler/intrinsics/string/TestStringIntrinsicRangeChecks.java
index d4e1fb0..c5ed25c 100644
--- a/hotspot/test/compiler/intrinsics/string/TestStringIntrinsicRangeChecks.java
+++ b/hotspot/test/compiler/intrinsics/string/TestStringIntrinsicRangeChecks.java
@@ -27,15 +27,16 @@
  * @test
  * @bug 8155608
  * @summary Verifies that string intrinsics throw array out of bounds exceptions.
- * @library /compiler/patches /testlibrary /test/lib /
+ * @library /compiler/patches /testlibrary /test/lib
  * @build java.base/java.lang.Helper
  * @build compiler.intrinsics.string.TestStringIntrinsicRangeChecks
- * @run main compiler.intrinsics.string.TestStringIntrinsicRangeChecks
+ * @run main/othervm -Xbatch -XX:CompileThreshold=100 -XX:-TieredCompilation compiler.intrinsics.string.TestStringIntrinsicRangeChecks
  */
 package compiler.intrinsics.string;
 
 import java.lang.Helper;
-import java.lang.reflect.*;
+import java.lang.reflect.InvocationTargetException;
+import java.lang.reflect.Method;
 
 public class TestStringIntrinsicRangeChecks {
     // Prepare test arrays
diff --git a/hotspot/test/compiler/intrinsics/string/TestStringIntrinsics.java b/hotspot/test/compiler/intrinsics/string/TestStringIntrinsics.java
index 9fe60b5..36cf682 100644
--- a/hotspot/test/compiler/intrinsics/string/TestStringIntrinsics.java
+++ b/hotspot/test/compiler/intrinsics/string/TestStringIntrinsics.java
@@ -21,16 +21,23 @@
  * questions.
  */
 
-import java.lang.annotation.*;
-import java.lang.reflect.*;
-import java.util.Arrays;
-
 /*
  * @test
  * @bug 8054307
  * @summary Tests correctness of string related intrinsics and C2 optimizations.
- * @run main/timeout=240 TestStringIntrinsics
+ *
+ * @run main/timeout=240 compiler.intrinsics.string.TestStringIntrinsics
  */
+
+package compiler.intrinsics.string;
+
+import java.lang.annotation.ElementType;
+import java.lang.annotation.Retention;
+import java.lang.annotation.RetentionPolicy;
+import java.lang.annotation.Target;
+import java.lang.reflect.Method;
+import java.util.Arrays;
+
 public class TestStringIntrinsics {
 
     public enum Operation {
diff --git a/hotspot/test/compiler/intrinsics/string/TestStringIntrinsics2.java b/hotspot/test/compiler/intrinsics/string/TestStringIntrinsics2.java
index ca8ca1c..ef3ffe1 100644
--- a/hotspot/test/compiler/intrinsics/string/TestStringIntrinsics2.java
+++ b/hotspot/test/compiler/intrinsics/string/TestStringIntrinsics2.java
@@ -28,8 +28,9 @@
  * @summary PPC64: fix string intrinsics after CompactStrings change
  * @modules java.base/jdk.internal.misc
  * @library /testlibrary /test/lib
+ *
  * @build sun.hotspot.WhiteBox
- * @run main ClassFileInstaller sun.hotspot.WhiteBox
+ * @run driver ClassFileInstaller sun.hotspot.WhiteBox
  *                              sun.hotspot.WhiteBox$WhiteBoxPermission
  *
  * @run main/othervm
@@ -39,20 +40,23 @@
  *        -XX:+WhiteBoxAPI
  *        -XX:MaxInlineSize=70
  *        -XX:MinInliningThreshold=0
- *        TestStringIntrinsics2
+ *        compiler.intrinsics.string.TestStringIntrinsics2
  */
 
+package compiler.intrinsics.string;
+
+import sun.hotspot.WhiteBox;
+
 import java.lang.annotation.ElementType;
-import java.lang.annotation.RetentionPolicy;
 import java.lang.annotation.Retention;
+import java.lang.annotation.RetentionPolicy;
 import java.lang.annotation.Target;
-import java.lang.reflect.Method;
 import java.util.Arrays;
 import java.util.function.Consumer;
-import java.util.function.Function;
 
-import static jdk.test.lib.Asserts.*;
-import sun.hotspot.WhiteBox;
+import static jdk.test.lib.Asserts.assertEquals;
+import static jdk.test.lib.Asserts.assertFalse;
+import static jdk.test.lib.Asserts.assertTrue;
 
 public class TestStringIntrinsics2 {
     // ------------------------------------------------------------------------
diff --git a/hotspot/test/compiler/intrinsics/unsafe/AllocateUninitializedArray.java b/hotspot/test/compiler/intrinsics/unsafe/AllocateUninitializedArray.java
index 404ccc6..98fd5a3 100644
--- a/hotspot/test/compiler/intrinsics/unsafe/AllocateUninitializedArray.java
+++ b/hotspot/test/compiler/intrinsics/unsafe/AllocateUninitializedArray.java
@@ -27,12 +27,19 @@
  * @bug 8150465
  * @summary Unsafe methods to produce uninitialized arrays
  * @modules java.base/jdk.internal.misc
- * @run main/othervm -ea -Diters=200   -Xint                   AllocateUninitializedArray
- * @run main/othervm -ea -Diters=30000 -XX:TieredStopAtLevel=1 AllocateUninitializedArray
- * @run main/othervm -ea -Diters=30000 -XX:TieredStopAtLevel=4 AllocateUninitializedArray
+ *
+ * @run main/othervm -ea -Diters=200   -Xint
+ *      compiler.intrinsics.unsafe.AllocateUninitializedArray
+ * @run main/othervm -ea -Diters=30000 -XX:TieredStopAtLevel=1
+ *      compiler.intrinsics.unsafe.AllocateUninitializedArray
+ * @run main/othervm -ea -Diters=30000 -XX:TieredStopAtLevel=4
+ *      compiler.intrinsics.unsafe.AllocateUninitializedArray
  */
-import java.lang.reflect.Field;
+
+package compiler.intrinsics.unsafe;
+
 import java.lang.reflect.Array;
+import java.lang.reflect.Field;
 import java.util.concurrent.Callable;
 
 public class AllocateUninitializedArray {
diff --git a/hotspot/test/compiler/intrinsics/unsafe/ByteBufferTest.java b/hotspot/test/compiler/intrinsics/unsafe/ByteBufferTest.java
new file mode 100644
index 0000000..6294e90
--- /dev/null
+++ b/hotspot/test/compiler/intrinsics/unsafe/ByteBufferTest.java
@@ -0,0 +1,750 @@
+/*
+ * Copyright (c) 2000, 2016, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2015, 2016, Red Hat Inc. 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.
+ */
+
+import jdk.test.lib.Utils;
+
+import java.nio.Buffer;
+import java.nio.BufferOverflowException;
+import java.nio.BufferUnderflowException;
+import java.nio.ByteBuffer;
+import java.nio.ByteOrder;
+import java.nio.CharBuffer;
+import java.nio.DoubleBuffer;
+import java.nio.FloatBuffer;
+import java.nio.IntBuffer;
+import java.nio.LongBuffer;
+import java.nio.ShortBuffer;
+import java.util.Arrays;
+import java.util.Random;
+
+import static java.nio.ByteOrder.BIG_ENDIAN;
+import static java.nio.ByteOrder.LITTLE_ENDIAN;
+
+// A wrapper for a ByteBuffer which maintains a backing array and a
+// position.  Whenever this wrapper is written the backing array and
+// the wrapped byte buffer are updated together, and whenever it is
+// read we check that the ByteBuffer and the backing array are identical.
+
+class MyByteBuffer {
+    final ByteBuffer buf;
+    final byte[] bytes;
+    int pos;
+    ByteOrder byteOrder = BIG_ENDIAN;
+
+    MyByteBuffer(ByteBuffer buf) {
+        this.buf = buf;
+        this.bytes = new byte[buf.capacity()];
+        pos = 0;
+    }
+
+    public final MyByteBuffer order(ByteOrder bo) {
+        byteOrder = bo;
+        buf.order(bo);
+        return this;
+    }
+
+    static MyByteBuffer allocate(int capacity) {
+        return new MyByteBuffer(ByteBuffer.allocate(capacity));
+    }
+
+    static MyByteBuffer allocateDirect(int capacity) {
+        return new MyByteBuffer(ByteBuffer.allocateDirect(capacity));
+    }
+
+    int capacity() { return bytes.length; }
+    int position() {
+        if (buf.position() != pos)
+            throw new RuntimeException();
+        return buf.position();
+    }
+
+    byte[] actualArray() {
+        buf.rewind();
+        byte[] actual = new byte[bytes.length];
+        buf.get(actual, 0, actual.length);
+        buf.rewind();
+
+        return actual;
+    }
+    byte[] expectedArray() { return bytes; }
+
+    private static byte long7(long x) { return (byte)(x >> 56); }
+    private static byte long6(long x) { return (byte)(x >> 48); }
+    private static byte long5(long x) { return (byte)(x >> 40); }
+    private static byte long4(long x) { return (byte)(x >> 32); }
+    private static byte long3(long x) { return (byte)(x >> 24); }
+    private static byte long2(long x) { return (byte)(x >> 16); }
+    private static byte long1(long x) { return (byte)(x >>  8); }
+    private static byte long0(long x) { return (byte)(x      ); }
+
+    private static byte int3(int x) { return (byte)(x >> 24); }
+    private static byte int2(int x) { return (byte)(x >> 16); }
+    private static byte int1(int x) { return (byte)(x >>  8); }
+    private static byte int0(int x) { return (byte)(x      ); }
+
+    private static byte short1(short x) { return (byte)(x >> 8); }
+    private static byte short0(short x) { return (byte)(x     ); }
+
+    byte _get(long i) { return bytes[(int)i]; }
+    void _put(long i, byte x) { bytes[(int)i] = x; }
+
+    private void putLongX(long a, long x) {
+        if (byteOrder == BIG_ENDIAN) {
+            x = Long.reverseBytes(x);
+        }
+        _put(a + 7, long7(x));
+        _put(a + 6, long6(x));
+        _put(a + 5, long5(x));
+        _put(a + 4, long4(x));
+        _put(a + 3, long3(x));
+        _put(a + 2, long2(x));
+        _put(a + 1, long1(x));
+        _put(a    , long0(x));
+    }
+
+    private void putIntX(long a, int x) {
+        if (byteOrder == BIG_ENDIAN) {
+            x = Integer.reverseBytes(x);
+        }
+        _put(a + 3, int3(x));
+        _put(a + 2, int2(x));
+        _put(a + 1, int1(x));
+        _put(a    , int0(x));
+    }
+
+    private void putShortX(int bi, short x) {
+        if (byteOrder == BIG_ENDIAN) {
+            x = Short.reverseBytes(x);
+        }
+        _put(bi    , short0(x));
+        _put(bi + 1, short1(x));
+    }
+
+    static private int makeInt(byte b3, byte b2, byte b1, byte b0) {
+        return (((b3       ) << 24) |
+                ((b2 & 0xff) << 16) |
+                ((b1 & 0xff) <<  8) |
+                ((b0 & 0xff)      ));
+    }
+    int getIntX(long a) {
+        int x = makeInt(_get(a + 3),
+                _get(a + 2),
+                _get(a + 1),
+                _get(a));
+        if (byteOrder == BIG_ENDIAN) {
+            x = Integer.reverseBytes(x);
+        }
+        return x;
+    }
+
+    static private long makeLong(byte b7, byte b6, byte b5, byte b4,
+                                 byte b3, byte b2, byte b1, byte b0)
+    {
+        return ((((long)b7       ) << 56) |
+                (((long)b6 & 0xff) << 48) |
+                (((long)b5 & 0xff) << 40) |
+                (((long)b4 & 0xff) << 32) |
+                (((long)b3 & 0xff) << 24) |
+                (((long)b2 & 0xff) << 16) |
+                (((long)b1 & 0xff) <<  8) |
+                (((long)b0 & 0xff)      ));
+    }
+
+    long getLongX(long a) {
+        long x = makeLong(_get(a + 7),
+                _get(a + 6),
+                _get(a + 5),
+                _get(a + 4),
+                _get(a + 3),
+                _get(a + 2),
+                _get(a + 1),
+                _get(a));
+        if (byteOrder == BIG_ENDIAN) {
+            x = Long.reverseBytes(x);
+        }
+        return x;
+    }
+
+    static private short makeShort(byte b1, byte b0) {
+        return (short)((b1 << 8) | (b0 & 0xff));
+    }
+
+    short getShortX(long a) {
+        short x = makeShort(_get(a + 1),
+                            _get(a    ));
+        if (byteOrder == BIG_ENDIAN) {
+            x = Short.reverseBytes(x);
+        }
+        return x;
+    }
+
+    double getDoubleX(long a) {
+        long x = getLongX(a);
+        return Double.longBitsToDouble(x);
+    }
+
+    double getFloatX(long a) {
+        int x = getIntX(a);
+        return Float.intBitsToFloat(x);
+    }
+
+    void ck(long x, long y) {
+        if (x != y) {
+            throw new RuntimeException(" x = " + Long.toHexString(x) + ", y = " + Long.toHexString(y));
+        }
+    }
+
+    void ck(double x, double y) {
+        if (x == x && y == y && x != y) {
+            ck(x, y);
+        }
+    }
+
+    // Method accessors
+
+    long getLong(int i) { ck(buf.getLong(i), getLongX(i)); return buf.getLong(i); }
+    int getInt(int i) { ck(buf.getInt(i), getIntX(i)); return buf.getInt(i); }
+    short getShort(int i) { ck(buf.getShort(i), getShortX(i)); return buf.getShort(i); }
+    char getChar(int i) { ck(buf.getChar(i), (char)getShortX(i)); return buf.getChar(i); }
+    double getDouble(int i) { ck(buf.getDouble(i), getDoubleX(i)); return buf.getDouble(i); }
+    float getFloat(int i) { ck(buf.getFloat(i), getFloatX(i)); return buf.getFloat(i); }
+
+    void putLong(int i, long x) { buf.putLong(i, x); putLongX(i, x); }
+    void putInt(int i, int x) { buf.putInt(i, x); putIntX(i, x); }
+    void putShort(int i, short x) { buf.putShort(i, x); putShortX(i, x); }
+    void putChar(int i, char x) { buf.putChar(i, x); putShortX(i, (short)x); }
+    void putDouble(int i, double x) { buf.putDouble(i, x); putLongX(i, Double.doubleToRawLongBits(x)); }
+    void putFloat(int i, float x) { buf.putFloat(i, x); putIntX(i, Float.floatToRawIntBits(x)); }
+
+    long getLong() { ck(buf.getLong(buf.position()), getLongX(pos)); long x = buf.getLong(); pos += 8; return x; }
+    int getInt() { ck(buf.getInt(buf.position()), getIntX(pos)); int x = buf.getInt(); pos += 4; return x; }
+    short getShort() { ck(buf.getShort(buf.position()), getShortX(pos)); short x = buf.getShort(); pos += 2; return x; }
+    char getChar() {  ck(buf.getChar(buf.position()), (char)getShortX(pos)); char x = buf.getChar(); pos += 2; return x; }
+    double getDouble() { ck(buf.getDouble(buf.position()), getDoubleX(pos)); double x = buf.getDouble(); pos += 8; return x; }
+    float getFloat() { ck(buf.getFloat(buf.position()), getFloatX(pos)); float x = buf.getFloat(); pos += 4; return x; }
+
+    void putLong(long x) { putLongX(pos, x); pos += 8; buf.putLong(x); }
+    void putInt(int x) { putIntX(pos, x); pos += 4; buf.putInt(x); }
+    void putShort(short x) { putShortX(pos, x); pos += 2; buf.putShort(x); }
+    void putChar(char x) { putShortX(pos, (short)x); pos += 2; buf.putChar(x); }
+    void putDouble(double x) { putLongX(pos, Double.doubleToRawLongBits(x)); pos += 8; buf.putDouble(x); }
+    void putFloat(float x) { putIntX(pos, Float.floatToRawIntBits(x)); pos += 4; buf.putFloat(x); }
+
+    // View accessors
+
+    long getLong(LongBuffer vb, int i) { ck(vb.get(i / 8), getLongX(i)); return vb.get(i / 8); }
+    int getInt(IntBuffer vb, int i) { ck(vb.get(i / 4), getIntX(i)); return vb.get(i / 4); }
+    short getShort(ShortBuffer vb, int i) { ck(vb.get(i / 2), getShortX(i)); return vb.get(i / 2); }
+    char getChar(CharBuffer vb, int i) { ck(vb.get(i / 2), (char)getShortX(i)); return vb.get(i / 2); }
+    double getDouble(DoubleBuffer vb, int i) { ck(vb.get(i / 8), getDoubleX(i)); return vb.get(i / 8); }
+    float getFloat(FloatBuffer vb, int i) { ck(vb.get(i / 4), getFloatX(i)); return vb.get(i / 4); }
+
+    void putLong(LongBuffer vb, int i, long x) { vb.put(i / 8, x); putLongX(i, x); }
+    void putInt(IntBuffer vb, int i, int x) { vb.put(i / 4, x); putIntX(i, x); }
+    void putShort(ShortBuffer vb, int i, short x) { vb.put(i / 2, x); putShortX(i, x); }
+    void putChar(CharBuffer vb, int i, char x) { vb.put(i / 2, x); putShortX(i, (short)x); }
+    void putDouble(DoubleBuffer vb, int i, double x) { vb.put(i / 8, x); putLongX(i, Double.doubleToRawLongBits(x)); }
+    void putFloat(FloatBuffer vb, int i, float x) { vb.put(i / 4, x); putIntX(i, Float.floatToRawIntBits(x)); }
+
+    long getLong(LongBuffer v) { ck(v.get(v.position()), getLongX(pos)); long x = v.get(); pos += 8; return x; }
+    int getInt(IntBuffer v) { ck(v.get(v.position()), getIntX(pos)); int x = v.get(); pos += 4; return x; }
+    short getShort(ShortBuffer v) { ck(v.get(v.position()), getShortX(pos)); short x = v.get(); pos += 2; return x; }
+    char getChar(CharBuffer v) { ck(v.get(v.position()), (char)getShortX(pos)); char x = v.get(); pos += 2; return x; }
+    double getDouble(DoubleBuffer v) { ck(v.get(v.position()), getDoubleX(pos)); double x = v.get(); pos += 8; return x; }
+    float getFloat(FloatBuffer v) { ck(v.get(v.position()), getFloatX(pos)); float x = v.get(); pos += 4; return x; }
+
+    void putLong(LongBuffer v, long x) { putLongX(pos, x); pos += 8; v.put(x); }
+    void putInt(IntBuffer v, int x) { putIntX(pos, x); pos += 4; v.put(x); }
+    void putShort(ShortBuffer v, short x) { putShortX(pos, x); pos += 2; v.put(x); }
+    void putChar(CharBuffer v, char x) { putShortX(pos, (short)x); pos += 2; v.put(x); }
+    void putDouble(DoubleBuffer v, double x) { putLongX(pos, Double.doubleToRawLongBits(x)); pos += 8; v.put(x); }
+    void putFloat(FloatBuffer v, float x) { putIntX(pos, Float.floatToRawIntBits(x)); pos += 4; v.put(x); }
+
+    void rewind() { pos = 0; buf.rewind(); }
+}
+
+public abstract class ByteBufferTest implements Runnable {
+
+    Random random = Utils.getRandomInstance();
+    MyByteBuffer data;
+
+    static int randomOffset(Random r, MyByteBuffer buf, int size) {
+        return r.nextInt(buf.capacity() - size);
+    }
+
+    static int randomAlignedOffset(Random r, MyByteBuffer buf, int unitSize) {
+        return r.nextInt(buf.capacity() / unitSize) * unitSize;
+    }
+
+    long iterations;
+
+    ByteBufferTest(long iterations, boolean direct) {
+        this.iterations = iterations;
+        data = direct
+               ? MyByteBuffer.allocateDirect(1024)
+               : MyByteBuffer.allocate(1024);
+    }
+
+    // The core of the test.  Walk over the buffer reading and writing
+    // random data, XORing it as we go.  We can detect writes in the
+    // wrong place, writes which are too long or too short, and reads
+    // or writes of the wrong data,
+    void step(Random r) {
+        stepUsingAccessors(r);
+        stepUsingViews(r);
+    }
+
+    void stepUsingAccessors(Random r) {
+        data.order((r.nextInt() & 1) != 0 ? BIG_ENDIAN : LITTLE_ENDIAN);
+
+        data.rewind();
+        while (data.position() < data.capacity())
+            data.putLong(data.getLong() ^ random.nextLong());
+
+        data.rewind();
+        while (data.position() < data.capacity())
+            data.putInt(data.getInt() ^ random.nextInt());
+
+        data.rewind();
+        while (data.position() < data.capacity())
+            data.putShort((short)(data.getShort() ^ random.nextInt()));
+
+        data.rewind();
+        while (data.position() < data.capacity())
+            data.putChar((char)(data.getChar() ^ random.nextInt()));
+
+        data.rewind();
+        while (data.position() < data.capacity())
+            data.putDouble(combine(data.getDouble(), random.nextLong()));
+
+        data.rewind();
+        while (data.position() < data.capacity())
+            data.putFloat(combine(data.getFloat(), random.nextInt()));
+
+        for (int i = 0; i < 100; i++) {
+            int offset = randomOffset(r, data, Long.BYTES);
+            data.putLong(offset, data.getLong(offset) ^ random.nextLong());
+        }
+        for (int i = 0; i < 100; i++) {
+            int offset = randomOffset(r, data, Integer.BYTES);
+            data.putInt(offset, data.getInt(offset) ^ random.nextInt());
+        }
+        for (int i = 0; i < 100; i++) {
+            int offset = randomOffset(r, data, Short.BYTES);
+            data.putShort(offset, (short)(data.getShort(offset) ^ random.nextInt()));
+        }
+        for (int i = 0; i < 100; i++) {
+            int offset = randomOffset(r, data, Character.BYTES);
+            data.putChar(offset, (char)(data.getChar(offset) ^ random.nextInt()));
+        }
+        for (int i = 0; i < 100; i++) {
+            int offset = randomOffset(r, data, Double.BYTES);
+            data.putDouble(offset, combine(data.getDouble(offset), random.nextLong()));
+        }
+        for (int i = 0; i < 100; i++) {
+            int offset = randomOffset(r, data, Float.BYTES);
+            data.putFloat(offset, combine(data.getFloat(offset), random.nextInt()));
+        }
+    }
+
+    void stepUsingViews(Random r) {
+        data.order((r.nextInt() & 1) != 0 ? BIG_ENDIAN : LITTLE_ENDIAN);
+
+        data.rewind();
+        LongBuffer lbuf = data.buf.asLongBuffer();
+        while (lbuf.position() < data.capacity() / Long.BYTES)
+            data.putLong(lbuf, data.getLong(lbuf) ^ random.nextLong());
+
+        data.rewind();
+        IntBuffer ibuf = data.buf.asIntBuffer();
+        while (ibuf.position() < data.capacity() / Integer.BYTES)
+            data.putInt(ibuf, data.getInt(ibuf) ^ random.nextInt());
+
+        data.rewind();
+        ShortBuffer sbuf = data.buf.asShortBuffer();
+        while (sbuf.position() < data.capacity() / Short.BYTES)
+            data.putShort(sbuf, (short)(data.getShort(sbuf) ^ random.nextInt()));
+
+        data.rewind();
+        CharBuffer cbuf = data.buf.asCharBuffer();
+        while (cbuf.position() < data.capacity() / Character.BYTES)
+            data.putChar(cbuf, (char)(data.getChar(cbuf) ^ random.nextInt()));
+
+        data.rewind();
+        DoubleBuffer dbuf = data.buf.asDoubleBuffer();
+        while (dbuf.position() < data.capacity() / Double.BYTES)
+            data.putDouble(dbuf, combine(data.getDouble(dbuf), random.nextLong()));
+
+        data.rewind();
+        FloatBuffer fbuf = data.buf.asFloatBuffer();
+        while (fbuf.position() < data.capacity() / Float.BYTES)
+            data.putFloat(fbuf, combine(data.getFloat(fbuf), random.nextInt()));
+
+        for (int i = 0; i < 100; i++) {
+            int offset = randomAlignedOffset(r, data, Long.BYTES);
+            data.putLong(lbuf, offset, data.getLong(lbuf, offset) ^ random.nextLong());
+        }
+        for (int i = 0; i < 100; i++) {
+            int offset = randomAlignedOffset(r, data, Integer.BYTES);
+            data.putInt(ibuf, offset, data.getInt(ibuf, offset) ^ random.nextInt());
+        }
+        for (int i = 0; i < 100; i++) {
+            int offset = randomAlignedOffset(r, data, Short.BYTES);
+            data.putShort(sbuf, offset, (short)(data.getShort(sbuf, offset) ^ random.nextInt()));
+        }
+        for (int i = 0; i < 100; i++) {
+            int offset = randomAlignedOffset(r, data, Character.BYTES);
+            data.putChar(cbuf, offset, (char)(data.getChar(cbuf, offset) ^ random.nextInt()));
+        }
+        for (int i = 0; i < 100; i++) {
+            int offset = randomAlignedOffset(r, data, Double.BYTES);
+            data.putDouble(dbuf, offset, combine(data.getDouble(dbuf, offset), random.nextLong()));
+        }
+        for (int i = 0; i < 100; i++) {
+            int offset = randomAlignedOffset(r, data, Float.BYTES);
+            data.putFloat(fbuf, offset, combine(data.getFloat(fbuf, offset), random.nextInt()));
+        }
+    }
+
+    // XOR the bit pattern of a double and a long, returning the
+    // result as a double.
+    //
+    // We convert signalling NaNs to quiet NaNs.  We need to do this
+    // because some platforms (in particular legacy 80x87) do not
+    // provide transparent conversions between integer and
+    // floating-point types even when using raw conversions but
+    // quietly convert sNaN to qNaN.  This causes spurious test
+    // failures when the template interpreter uses 80x87 and the JITs
+    // use XMM registers.
+    //
+    public double combine(double prev, long bits) {
+        bits ^= Double.doubleToRawLongBits(prev);
+        double result = Double.longBitsToDouble(bits);
+        if (Double.isNaN(result)) {
+            result = Double.longBitsToDouble(bits | 0x8000000000000l);
+        }
+        return result;
+    }
+
+    // XOR the bit pattern of a float and an int, returning the result
+    // as a float.  Convert sNaNs to qNaNs.
+    public Float combine(float prev, int bits) {
+        bits ^= Float.floatToRawIntBits(prev);
+        Float result = Float.intBitsToFloat(bits);
+        if (Float.isNaN(result)) {
+            result = Float.intBitsToFloat(bits | 0x400000);
+        }
+        return result;
+    }
+
+    enum PrimitiveType {
+        BYTE(1), CHAR(2), SHORT(2), INT(4), LONG(8), FLOAT(4), DOUBLE(8);
+
+        public final int size;
+        PrimitiveType(int size) {
+            this.size = size;
+        }
+    }
+
+    Buffer asView(ByteBuffer b, PrimitiveType t) {
+        switch (t) {
+            case BYTE: return b;
+            case CHAR: return b.asCharBuffer();
+            case SHORT: return b.asShortBuffer();
+            case INT: return b.asIntBuffer();
+            case LONG: return b.asLongBuffer();
+            case FLOAT: return b.asFloatBuffer();
+            case DOUBLE: return b.asDoubleBuffer();
+        }
+        throw new InternalError("Should not reach here");
+    }
+
+    void getOne(ByteBuffer b, PrimitiveType t) {
+        switch (t) {
+        case BYTE: b.get(); break;
+        case CHAR: b.getChar(); break;
+        case SHORT: b.getShort(); break;
+        case INT: b.getInt(); break;
+        case LONG: b.getLong(); break;
+        case FLOAT: b.getFloat(); break;
+        case DOUBLE: b.getDouble(); break;
+        }
+    }
+
+    void putOne(ByteBuffer b, PrimitiveType t) {
+        switch (t) {
+        case BYTE: b.put((byte)0); break;
+        case CHAR: b.putChar('0'); break;
+        case SHORT: b.putShort((short)0); break;
+        case INT: b.putInt(0); break;
+        case LONG: b.putLong(0); break;
+        case FLOAT: b.putFloat(0); break;
+        case DOUBLE: b.putDouble(0); break;
+        }
+    }
+
+    void asViewGetOne(ByteBuffer b, PrimitiveType t) {
+        switch (t) {
+            case BYTE: b.get(); break;
+            case CHAR: b.asCharBuffer().get(); break;
+            case SHORT: b.asShortBuffer().get(); break;
+            case INT: b.asIntBuffer().get(); break;
+            case LONG: b.asLongBuffer().get(); break;
+            case FLOAT: b.asFloatBuffer().get(); break;
+            case DOUBLE: b.asDoubleBuffer().get(); break;
+        }
+    }
+
+    void asViewPutOne(ByteBuffer b, PrimitiveType t) {
+        switch (t) {
+            case BYTE: b.put((byte)0); break;
+            case CHAR: b.asCharBuffer().put('0'); break;
+            case SHORT: b.asShortBuffer().put((short)0); break;
+            case INT: b.asIntBuffer().put(0); break;
+            case LONG: b.asLongBuffer().put(0); break;
+            case FLOAT: b.asFloatBuffer().put(0); break;
+            case DOUBLE: b.asDoubleBuffer().put(0); break;
+        }
+    }
+
+    void getOne(ByteBuffer b, PrimitiveType t, int index) {
+        switch (t) {
+        case BYTE: b.get(index); break;
+        case CHAR: b.getChar(index); break;
+        case SHORT: b.getShort(index); break;
+        case INT: b.getInt(index); break;
+        case LONG: b.getLong(index); break;
+        case FLOAT: b.getFloat(index); break;
+        case DOUBLE: b.getDouble(index); break;
+        }
+    }
+
+    void putOne(ByteBuffer b, PrimitiveType t, int index) {
+        switch (t) {
+        case BYTE: b.put(index, (byte)0); break;
+        case CHAR: b.putChar(index, '0'); break;
+        case SHORT: b.putShort(index, (short)0); break;
+        case INT: b.putInt(index, 0); break;
+        case LONG: b.putLong(index, 0); break;
+        case FLOAT: b.putFloat(index, 0); break;
+        case DOUBLE: b.putDouble(index, 0); break;
+        }
+    }
+
+    void asViewGetOne(Buffer v, PrimitiveType t, int index) {
+        switch (t) {
+            case BYTE: ((ByteBuffer) v).get(index); break;
+            case CHAR: ((CharBuffer) v).get(index); break;
+            case SHORT: ((ShortBuffer) v).get(index); break;
+            case INT: ((IntBuffer) v).get(index); break;
+            case LONG: ((LongBuffer) v).get(index); break;
+            case FLOAT: ((FloatBuffer) v).get(index); break;
+            case DOUBLE: ((DoubleBuffer) v).get(index); break;
+        }
+    }
+
+    void asViewPutOne(Buffer v, PrimitiveType t, int index) {
+        switch (t) {
+            case BYTE: ((ByteBuffer) v).put(index, (byte)0); break;
+            case CHAR: ((CharBuffer) v).put(index, '0'); break;
+            case SHORT: ((ShortBuffer) v).put(index, (short)0); break;
+            case INT: ((IntBuffer) v).put(index, 0); break;
+            case LONG: ((LongBuffer) v).put(index, 0); break;
+            case FLOAT: ((FloatBuffer) v).put(index, 0); break;
+            case DOUBLE: ((DoubleBuffer) v).put(index, 0); break;
+        }
+    }
+
+    void checkBoundaryConditions() {
+        for (int i = 0; i < 100; i++) {
+            int bufSize = random.nextInt(16);
+            ByteBuffer buf = data.buf.isDirect()
+                    ? ByteBuffer.allocateDirect(bufSize)
+                    : ByteBuffer.allocate(bufSize);
+            for (PrimitiveType t : PrimitiveType.values()) {
+                buf.rewind();
+                Buffer viewBuf = asView(buf, t);
+                for (int j = 0; j < 100; j++) {
+                    int offset = random.nextInt(32) - 8;
+                    int threw = 0;
+                    int checks = 6;
+                    try {
+                        try {
+                            buf.position(offset);
+                            getOne(buf, t);
+                        }
+                        catch (BufferUnderflowException e) {
+                            if (offset + t.size < bufSize)
+                                throw new RuntimeException
+                                        ("type = " + t + ", offset = " + offset + ", bufSize = " + bufSize, e);
+                            threw++;
+                        }
+                        catch (IllegalArgumentException e) {
+                            if (offset >= 0 && offset + t.size < bufSize)
+                                throw new RuntimeException
+                                        ("type = " + t + ", offset = " + offset + ", bufSize = " + bufSize, e);
+                            threw++;
+                        }
+
+                        try {
+                            buf.position(offset);
+                            asViewGetOne(buf, t);
+                        }
+                        catch (BufferUnderflowException e) {
+                            if (offset + t.size < bufSize)
+                                throw new RuntimeException
+                                        ("type = " + t + ", offset = " + offset + ", bufSize = " + bufSize, e);
+                            threw++;
+                        }
+                        catch (IllegalArgumentException e) {
+                            if (offset >= 0 && offset + t.size < bufSize)
+                                throw new RuntimeException
+                                        ("type = " + t + ", offset = " + offset + ", bufSize = " + bufSize, e);
+                            threw++;
+                        }
+
+                        try {
+                            buf.position(offset);
+                            putOne(buf, t);
+                        }
+                        catch (BufferOverflowException e) {
+                            if (offset + t.size < bufSize)
+                                throw new RuntimeException
+                                        ("type = " + t + ", offset = " + offset + ", bufSize = " + bufSize, e);
+                            threw++;
+                        }
+                        catch (IllegalArgumentException e) {
+                            if (offset >= 0 && offset + t.size < bufSize)
+                                throw new RuntimeException
+                                        ("type = " + t + ", offset = " + offset + ", bufSize = " + bufSize, e);
+                            threw++;
+                        }
+
+                        try {
+                            buf.position(offset);
+                            asViewPutOne(buf, t);
+                        }
+                        catch (BufferOverflowException e) {
+                            if (offset + t.size < bufSize)
+                                throw new RuntimeException
+                                        ("type = " + t + ", offset = " + offset + ", bufSize = " + bufSize, e);
+                            threw++;
+                        }
+                        catch (IllegalArgumentException e) {
+                            if (offset >= 0 && offset + t.size < bufSize)
+                                throw new RuntimeException
+                                        ("type = " + t + ", offset = " + offset + ", bufSize = " + bufSize, e);
+                            threw++;
+                        }
+
+                        try {
+                            putOne(buf, t, offset);
+                        }
+                        catch (IndexOutOfBoundsException e) {
+                            if (offset >= 0 && offset + t.size < bufSize)
+                                throw new RuntimeException
+                                        ("type = " + t + ", offset = " + offset + ", bufSize = " + bufSize, e);
+                            threw++;
+                        }
+
+                        try {
+                            getOne(buf, t, offset);
+                        }
+                        catch (IndexOutOfBoundsException e) {
+                            if (offset >= 0 && offset + t.size < bufSize)
+                                throw new RuntimeException
+                                        ("type = " + t + ", offset = " + offset + ", bufSize = " + bufSize, e);
+                            threw++;
+                        }
+
+                        // If offset is aligned access using the view
+                        if (offset % t.size == 0) {
+                            checks = 8;
+                            int viewOffset = offset / t.size;
+
+
+                            try {
+                                asViewPutOne(viewBuf, t, viewOffset);
+                            }
+                            catch (IndexOutOfBoundsException e) {
+                                if (offset >= 0 && offset + t.size < bufSize)
+                                    throw new RuntimeException
+                                            ("type = " + t + ", offset = " + offset + ", bufSize = " + bufSize, e);
+                                threw++;
+                            }
+
+                            try {
+                                asViewGetOne(viewBuf, t, viewOffset);
+                            }
+                            catch (IndexOutOfBoundsException e) {
+                                if (offset >= 0 && offset + t.size < bufSize)
+                                    throw new RuntimeException
+                                            ("type = " + t + ", offset = " + offset + ", bufSize = " + bufSize, e);
+                                threw++;
+                            }
+                        }
+
+                        if (threw == 0) {
+                            // Make sure that we should not have thrown.
+                            if (offset < 0 || offset + t.size > bufSize) {
+                                throw new RuntimeException
+                                        ("should have thrown but did not, type = " + t
+                                         + ", offset = " + offset + ", bufSize = " + bufSize);
+                            }
+                        }
+                        else if (threw != checks) {
+                            // If one of the {get,put} operations threw
+                            // due to an invalid offset then all four of
+                            // them should have thrown.
+                            throw new RuntimeException
+                                    ("should have thrown but at least one did not, type = " + t
+                                     + ", offset = " + offset + ", bufSize = " + bufSize);
+                        }
+                    }
+                    catch (Throwable th) {
+                        throw new RuntimeException
+                                ("unexpected throw: type  = " + t + ", offset = " + offset + ", bufSize = " + bufSize, th);
+
+                    }
+                }
+            }
+        }
+    }
+
+    public void run() {
+        checkBoundaryConditions();
+
+        for (int i = 0; i < data.capacity(); i += 8) {
+            data.putLong(i, random.nextLong());
+        }
+
+        for (int i = 0; i < iterations; i++) {
+            step(random);
+        }
+
+        if (!Arrays.equals(data.actualArray(), data.expectedArray())) {
+            throw new RuntimeException();
+        }
+    }
+}
diff --git a/hotspot/test/compiler/intrinsics/unsafe/DirectByteBufferTest.java b/hotspot/test/compiler/intrinsics/unsafe/DirectByteBufferTest.java
new file mode 100644
index 0000000..5c27653
--- /dev/null
+++ b/hotspot/test/compiler/intrinsics/unsafe/DirectByteBufferTest.java
@@ -0,0 +1,50 @@
+/*
+ * Copyright (c) 2016, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2016, Red Hat Inc. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+/**
+ * @test
+ * @bug 8026049 8151163
+ * @modules java.base/jdk.internal.misc
+ * @library /testlibrary
+ * @run main/othervm -XX:+UnlockDiagnosticVMOptions -XX:-UseUnalignedAccesses -Djdk.test.lib.random.seed=0 DirectByteBufferTest
+ * @run main/othervm -Djdk.test.lib.random.seed=0 DirectByteBufferTest
+ * @summary Verify that direct byte buffers are correctly accessed.
+ */
+
+public class DirectByteBufferTest extends ByteBufferTest {
+
+    public DirectByteBufferTest(long iterations, boolean direct) {
+        super(iterations, direct);
+    }
+
+    public static void main(String[] args) {
+        // The number of iterations is high to ensure that tiered
+        // compilation kicks in all the way up to C2.
+        long iterations = 100000;
+        if (args.length > 0)
+            iterations = Long.parseLong(args[0]);
+
+        new DirectByteBufferTest(iterations, true).run();
+    }
+}
diff --git a/hotspot/test/compiler/intrinsics/unsafe/HeapByteBufferTest.java b/hotspot/test/compiler/intrinsics/unsafe/HeapByteBufferTest.java
index 7c46ab1d..e09fa47 100644
--- a/hotspot/test/compiler/intrinsics/unsafe/HeapByteBufferTest.java
+++ b/hotspot/test/compiler/intrinsics/unsafe/HeapByteBufferTest.java
@@ -1,506 +1,44 @@
-//
-// Copyright (c) 2000, 2015, Oracle and/or its affiliates. All rights reserved.
-// Copyright (c) 2015, Red Hat Inc. 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.
-//
-//
-
-import java.nio.BufferOverflowException;
-import java.nio.BufferUnderflowException;
-import java.nio.ByteBuffer;
-import static java.nio.ByteOrder.BIG_ENDIAN;
-import static java.nio.ByteOrder.LITTLE_ENDIAN;
-import java.nio.ByteOrder;
-import java.util.Arrays;
-import java.util.Random;
-import jdk.test.lib.Utils;
+/*
+ * Copyright (c) 2016, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2016, Red Hat Inc. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
 
 /**
  * @test
- * @bug 8026049
+ * @bug 8026049 8151163
+ * @summary Verify that byte buffers are correctly accessed.
  * @modules java.base/jdk.internal.misc
  * @library /testlibrary
- * @run main/othervm -XX:+UnlockDiagnosticVMOptions -XX:-UseUnalignedAccesses -Djdk.test.lib.random.seed=0 HeapByteBufferTest
- * @run main/othervm -Djdk.test.lib.random.seed=0 HeapByteBufferTest
- * @summary Verify that byte buffers are correctly accessed.
+ *
+ * @run main/othervm -XX:+UnlockDiagnosticVMOptions -XX:-UseUnalignedAccesses -Djdk.test.lib.random.seed=0
+ *      HeapByteBufferTest
+ * @run main/othervm -Djdk.test.lib.random.seed=0
+ *      HeapByteBufferTest
  */
 
-// A wrapper for a ByteBuffer which maintains a backing array and a
-// position.  Whenever this wrapper is written the backing array and
-// the wrapped byte buffer are updated together, and whenever it is
-// read we check that the ByteBuffer and the backing array are identical.
+public class HeapByteBufferTest extends ByteBufferTest {
 
-class MyByteBuffer {
-    final ByteBuffer buf;
-    final byte[] bytes;
-    int pos;
-    ByteOrder byteOrder = BIG_ENDIAN;
-
-    MyByteBuffer(ByteBuffer buf, byte[] bytes) {
-        this.buf = buf;
-        this.bytes = Arrays.copyOf(bytes, bytes.length);
-        pos = 0;
-    }
-
-    public final MyByteBuffer order(ByteOrder bo) {
-        byteOrder = bo;
-        buf.order(bo);
-        return this;
-    }
-
-    static MyByteBuffer wrap(byte[] bytes) {
-        return new MyByteBuffer(ByteBuffer.wrap(bytes), bytes);
-    }
-
-    int capacity() { return bytes.length; }
-    int position() {
-        if (buf.position() != pos)
-            throw new RuntimeException();
-        return buf.position();
-    }
-
-    byte[] array() { return buf.array(); }
-    byte[] backingArray() { return bytes; }
-
-    private static byte long7(long x) { return (byte)(x >> 56); }
-    private static byte long6(long x) { return (byte)(x >> 48); }
-    private static byte long5(long x) { return (byte)(x >> 40); }
-    private static byte long4(long x) { return (byte)(x >> 32); }
-    private static byte long3(long x) { return (byte)(x >> 24); }
-    private static byte long2(long x) { return (byte)(x >> 16); }
-    private static byte long1(long x) { return (byte)(x >>  8); }
-    private static byte long0(long x) { return (byte)(x      ); }
-
-    private static byte int3(int x) { return (byte)(x >> 24); }
-    private static byte int2(int x) { return (byte)(x >> 16); }
-    private static byte int1(int x) { return (byte)(x >>  8); }
-    private static byte int0(int x) { return (byte)(x      ); }
-
-    private static byte short1(short x) { return (byte)(x >> 8); }
-    private static byte short0(short x) { return (byte)(x     ); }
-
-    byte _get(long i) { return bytes[(int)i]; }
-    void _put(long i, byte x) { bytes[(int)i] = x; }
-
-    private void putLongX(long a, long x) {
-        if (byteOrder == BIG_ENDIAN) {
-            x = Long.reverseBytes(x);
-        }
-        _put(a + 7, long7(x));
-        _put(a + 6, long6(x));
-        _put(a + 5, long5(x));
-        _put(a + 4, long4(x));
-        _put(a + 3, long3(x));
-        _put(a + 2, long2(x));
-        _put(a + 1, long1(x));
-        _put(a    , long0(x));
-    }
-
-    private void putIntX(long a, int x) {
-        if (byteOrder == BIG_ENDIAN) {
-            x = Integer.reverseBytes(x);
-        }
-        _put(a + 3, int3(x));
-        _put(a + 2, int2(x));
-        _put(a + 1, int1(x));
-        _put(a    , int0(x));
-    }
-
-    private void putShortX(int bi, short x) {
-        if (byteOrder == BIG_ENDIAN) {
-            x = Short.reverseBytes(x);
-        }
-        _put(bi    , short0(x));
-        _put(bi + 1, short1(x));
-    }
-
-    static private int makeInt(byte b3, byte b2, byte b1, byte b0) {
-        return (((b3       ) << 24) |
-                ((b2 & 0xff) << 16) |
-                ((b1 & 0xff) <<  8) |
-                ((b0 & 0xff)      ));
-    }
-    int getIntX(long a) {
-        int x = makeInt(_get(a + 3),
-                _get(a + 2),
-                _get(a + 1),
-                _get(a));
-        if (byteOrder == BIG_ENDIAN) {
-            x = Integer.reverseBytes(x);
-        }
-        return x;
-    }
-
-    static private long makeLong(byte b7, byte b6, byte b5, byte b4,
-                                 byte b3, byte b2, byte b1, byte b0)
-    {
-        return ((((long)b7       ) << 56) |
-                (((long)b6 & 0xff) << 48) |
-                (((long)b5 & 0xff) << 40) |
-                (((long)b4 & 0xff) << 32) |
-                (((long)b3 & 0xff) << 24) |
-                (((long)b2 & 0xff) << 16) |
-                (((long)b1 & 0xff) <<  8) |
-                (((long)b0 & 0xff)      ));
-    }
-
-    long getLongX(long a) {
-        long x = makeLong(_get(a + 7),
-                _get(a + 6),
-                _get(a + 5),
-                _get(a + 4),
-                _get(a + 3),
-                _get(a + 2),
-                _get(a + 1),
-                _get(a));
-        if (byteOrder == BIG_ENDIAN) {
-            x = Long.reverseBytes(x);
-        }
-        return x;
-    }
-
-    static private short makeShort(byte b1, byte b0) {
-        return (short)((b1 << 8) | (b0 & 0xff));
-    }
-
-    short getShortX(long a) {
-        short x = makeShort(_get(a + 1),
-                            _get(a    ));
-        if (byteOrder == BIG_ENDIAN) {
-            x = Short.reverseBytes(x);
-        }
-        return x;
-    }
-
-    double getDoubleX(long a) {
-        long x = getLongX(a);
-        return Double.longBitsToDouble(x);
-    }
-
-    double getFloatX(long a) {
-        int x = getIntX(a);
-        return Float.intBitsToFloat(x);
-    }
-
-    void ck(long x, long y) {
-        if (x != y) {
-            throw new RuntimeException(" x = " + Long.toHexString(x) + ", y = " + Long.toHexString(y));
-        }
-    }
-
-    void ck(double x, double y) {
-        if (x == x && y == y && x != y) {
-            ck(x, y);
-        }
-    }
-
-    long getLong(int i) { ck(buf.getLong(i), getLongX(i)); return buf.getLong(i); }
-    int getInt(int i) { ck(buf.getInt(i), getIntX(i)); return buf.getInt(i); }
-    short getShort(int i) { ck(buf.getShort(i), getShortX(i)); return buf.getShort(i); }
-    char getChar(int i) { ck(buf.getChar(i), (char)getShortX(i)); return buf.getChar(i); }
-    double getDouble(int i) { ck(buf.getDouble(i), getDoubleX(i)); return buf.getDouble(i); }
-    float getFloat(int i) { ck(buf.getFloat(i), getFloatX(i)); return buf.getFloat(i); }
-
-    void putLong(int i, long x) { buf.putLong(i, x); putLongX(i, x); }
-    void putInt(int i, int x) { buf.putInt(i, x); putIntX(i, x); }
-    void putShort(int i, short x) { buf.putShort(i, x); putShortX(i, x); }
-    void putChar(int i, char x) { buf.putChar(i, x); putShortX(i, (short)x); }
-    void putDouble(int i, double x) { buf.putDouble(i, x); putLongX(i, Double.doubleToRawLongBits(x)); }
-    void putFloat(int i, float x) { buf.putFloat(i, x); putIntX(i, Float.floatToRawIntBits(x)); }
-
-    long getLong() { ck(buf.getLong(buf.position()), getLongX(pos)); long x = buf.getLong(); pos += 8; return x; }
-    int getInt() { ck(buf.getInt(buf.position()), getIntX(pos)); int x = buf.getInt(); pos += 4; return x; }
-    short getShort() { ck(buf.getShort(buf.position()), getShortX(pos)); short x = buf.getShort(); pos += 2; return x; }
-    char getChar() {  ck(buf.getChar(buf.position()), (char)getShortX(pos)); char x = buf.getChar(); pos += 2; return x; }
-    double getDouble() { ck(buf.getDouble(buf.position()), getDoubleX(pos)); double x = buf.getDouble(); pos += 8; return x; }
-    float getFloat() { ck(buf.getFloat(buf.position()), getFloatX(pos)); float x = buf.getFloat(); pos += 4; return x; }
-
-    void putLong(long x) { putLongX(pos, x); pos += 8; buf.putLong(x); }
-    void putInt(int x) { putIntX(pos, x); pos += 4; buf.putInt(x); }
-    void putShort(short x) { putShortX(pos, x); pos += 2; buf.putShort(x); }
-    void putChar(char x) { putShortX(pos, (short)x); pos += 2; buf.putChar(x); }
-    void putDouble(double x) { putLongX(pos, Double.doubleToRawLongBits(x)); pos += 8; buf.putDouble(x); }
-    void putFloat(float x) { putIntX(pos, Float.floatToRawIntBits(x)); pos += 4; buf.putFloat(x); }
-
-    void rewind() { pos = 0; buf.rewind(); }
-}
-
-public class HeapByteBufferTest implements Runnable {
-
-    Random random = Utils.getRandomInstance();
-    MyByteBuffer data = MyByteBuffer.wrap(new byte[1024]);
-
-    int randomOffset(Random r, MyByteBuffer buf, int size) {
-        return r.nextInt(buf.capacity() - size);
-    }
-
-    long iterations;
-
-    HeapByteBufferTest(long iterations) {
-        this.iterations = iterations;
-    }
-
-    // The core of the test.  Walk over the buffer reading and writing
-    // random data, XORing it as we go.  We can detect writes in the
-    // wrong place, writes which are too long or too short, and reads
-    // or writes of the wrong data,
-    void step(Random r) {
-        data.order((r.nextInt() & 1) != 0 ? BIG_ENDIAN : LITTLE_ENDIAN);
-
-        data.rewind();
-        while (data.position() < data.capacity())
-            data.putLong(data.getLong() ^ random.nextLong());
-
-        data.rewind();
-        while (data.position() < data.capacity())
-            data.putInt(data.getInt() ^ random.nextInt());
-
-        data.rewind();
-        while (data.position() < data.capacity())
-            data.putShort((short)(data.getShort() ^ random.nextInt()));
-
-        data.rewind();
-        while (data.position() < data.capacity())
-            data.putChar((char)(data.getChar() ^ random.nextInt()));
-
-        data.rewind();
-        while (data.position() < data.capacity()) {
-            data.putDouble(combine(data.getDouble(), random.nextLong()));
-        }
-
-        data.rewind();
-        while (data.position() < data.capacity())
-            data.putFloat(combine(data.getFloat(), random.nextInt()));
-
-        for (int i = 0; i < 100; i++) {
-            int offset = randomOffset(r, data, 8);
-            data.putLong(offset, data.getLong(offset) ^ random.nextLong());
-        }
-        for (int i = 0; i < 100; i++) {
-            int offset = randomOffset(r, data, 4);
-            data.putInt(offset, data.getInt(offset) ^ random.nextInt());
-        }
-        for (int i = 0; i < 100; i++) {
-            int offset = randomOffset(r, data, 2);
-            data.putShort(offset, (short)(data.getShort(offset) ^ random.nextInt()));
-        }
-        for (int i = 0; i < 100; i++) {
-            int offset = randomOffset(r, data, 2);
-            data.putChar(offset, (char)(data.getChar(offset) ^ random.nextInt()));
-        }
-        for (int i = 0; i < 100; i++) {
-            int offset = randomOffset(r, data, 8);
-            data.putDouble(offset, combine(data.getDouble(offset), random.nextLong()));
-        }
-        for (int i = 0; i < 100; i++) {
-            int offset = randomOffset(r, data, 4);
-            data.putFloat(offset, combine(data.getFloat(offset), random.nextInt()));
-        }
-    }
-
-    // XOR the bit pattern of a double and a long, returning the
-    // result as a double.
-    //
-    // We convert signalling NaNs to quiet NaNs.  We need to do this
-    // because some platforms (in particular legacy 80x87) do not
-    // provide transparent conversions between integer and
-    // floating-point types even when using raw conversions but
-    // quietly convert sNaN to qNaN.  This causes spurious test
-    // failures when the template interpreter uses 80x87 and the JITs
-    // use XMM registers.
-    //
-    public double combine(double prev, long bits) {
-        bits ^= Double.doubleToRawLongBits(prev);
-        double result = Double.longBitsToDouble(bits);
-        if (Double.isNaN(result)) {
-            result = Double.longBitsToDouble(bits | 0x8000000000000l);
-        }
-        return result;
-    }
-
-    // XOR the bit pattern of a float and an int, returning the result
-    // as a float.  Convert sNaNs to qNaNs.
-    public Float combine(float prev, int bits) {
-        bits ^= Float.floatToRawIntBits(prev);
-        Float result = Float.intBitsToFloat(bits);
-        if (Float.isNaN(result)) {
-            result = Float.intBitsToFloat(bits | 0x400000);
-        }
-        return result;
-    }
-
-    enum PrimitiveType {
-        BYTE(1), CHAR(2), SHORT(2), INT(4), LONG(8), FLOAT(4), DOUBLE(8);
-
-        public final int size;
-        PrimitiveType(int size) {
-            this.size = size;
-        }
-    }
-
-    void getOne(ByteBuffer b, PrimitiveType t) {
-        switch (t) {
-        case BYTE: b.get(); break;
-        case CHAR: b.getChar(); break;
-        case SHORT: b.getShort(); break;
-        case INT: b.getInt(); break;
-        case LONG: b.getLong(); break;
-        case FLOAT: b.getFloat(); break;
-        case DOUBLE: b.getDouble(); break;
-        }
-    }
-
-    void putOne(ByteBuffer b, PrimitiveType t) {
-        switch (t) {
-        case BYTE: b.put((byte)0); break;
-        case CHAR: b.putChar('0'); break;
-        case SHORT: b.putShort((short)0); break;
-        case INT: b.putInt(0); break;
-        case LONG: b.putLong(0); break;
-        case FLOAT: b.putFloat(0); break;
-        case DOUBLE: b.putDouble(0); break;
-        }
-    }
-
-    void getOne(ByteBuffer b, PrimitiveType t, int index) {
-        switch (t) {
-        case BYTE: b.get(index); break;
-        case CHAR: b.getChar(index); break;
-        case SHORT: b.getShort(index); break;
-        case INT: b.getInt(index); break;
-        case LONG: b.getLong(index); break;
-        case FLOAT: b.getFloat(index); break;
-        case DOUBLE: b.getDouble(index); break;
-        }
-    }
-
-    void putOne(ByteBuffer b, PrimitiveType t, int index) {
-        switch (t) {
-        case BYTE: b.put(index, (byte)0); break;
-        case CHAR: b.putChar(index, '0'); break;
-        case SHORT: b.putShort(index, (short)0); break;
-        case INT: b.putInt(index, 0); break;
-        case LONG: b.putLong(index, 0); break;
-        case FLOAT: b.putFloat(index, 0); break;
-        case DOUBLE: b.putDouble(index, 0); break;
-        }
-    }
-
-    void checkBoundaryConditions() {
-        for (int i = 0; i < 100; i++) {
-            int bufSize = random.nextInt(16);
-            byte[] bytes = new byte[bufSize];
-            ByteBuffer buf = ByteBuffer.wrap(bytes);
-            for (int j = 0; j < 100; j++) {
-                int offset = random.nextInt(32) - 8;
-                for (PrimitiveType t : PrimitiveType.values()) {
-                    int threw = 0;
-                    try {
-                        try {
-                            buf.position(offset);
-                            getOne(buf, t);
-                        } catch (BufferUnderflowException e) {
-                            if (offset + t.size < bufSize)
-                                throw new RuntimeException
-                                    ("type = " + t + ", offset = " + offset + ", bufSize = " + bufSize, e);
-                            threw++;
-                        } catch (IllegalArgumentException e) {
-                            if (offset >= 0 && offset + t.size < bufSize)
-                                throw new RuntimeException
-                                    ("type = " + t + ", offset = " + offset + ", bufSize = " + bufSize, e);
-                            threw++;
-                        }
-
-                        try {
-                            buf.position(offset);
-                            putOne(buf, t);
-                        } catch (BufferOverflowException e) {
-                            if (offset + t.size < bufSize)
-                                throw new RuntimeException
-                                    ("type = " + t + ", offset = " + offset + ", bufSize = " + bufSize, e);
-                            threw++;
-                        } catch (IllegalArgumentException e) {
-                            if (offset >= 0 && offset + t.size < bufSize)
-                                throw new RuntimeException
-                                    ("type = " + t + ", offset = " + offset + ", bufSize = " + bufSize, e);
-                            threw++;
-                        }
-
-                        try {
-                            putOne(buf, t, offset);
-                        } catch (IndexOutOfBoundsException e) {
-                            if (offset >= 0 && offset + t.size < bufSize)
-                                throw new RuntimeException
-                                    ("type = " + t + ", offset = " + offset + ", bufSize = " + bufSize, e);
-                            threw++;
-                        }
-
-                        try {
-                            getOne(buf, t, offset);
-                        } catch (IndexOutOfBoundsException e) {
-                            if (offset >= 0 && offset + t.size < bufSize)
-                                throw new RuntimeException
-                                    ("type = " + t + ", offset = " + offset + ", bufSize = " + bufSize, e);
-                            threw++;
-                        }
-
-                        if (threw == 0) {
-                            // Make sure that we should not have thrown.
-                            if (offset < 0 || offset + t.size > bufSize) {
-                                throw new RuntimeException
-                                    ("should have thrown but did not, type = " + t
-                                     + ", offset = " + offset + ", bufSize = " + bufSize);
-                            }
-                        } else if (threw != 4) {
-                            // If one of the {get,put} operations threw
-                            // due to an invalid offset then all four of
-                            // them should have thrown.
-                            throw new RuntimeException
-                                ("should have thrown but at least one did not, type = " + t
-                                 + ", offset = " + offset + ", bufSize = " + bufSize);
-                        }
-                    } catch (Throwable th) {
-                        throw new RuntimeException
-                            ("unexpected throw: type  = " + t + ", offset = " + offset + ", bufSize = " + bufSize, th);
-
-                    }
-                }
-            }
-        }
-    }
-
-    public void run() {
-        checkBoundaryConditions();
-
-        for (int i = 0; i < data.capacity(); i += 8) {
-            data.putLong(i, random.nextLong());
-        }
-
-        for (int i = 0; i < iterations; i++) {
-            step(random);
-        }
-
-        if (!Arrays.equals(data.array(), data.backingArray())) {
-            throw new RuntimeException();
-        }
+    public HeapByteBufferTest(long iterations, boolean direct) {
+        super(iterations, direct);
     }
 
     public static void main(String[] args) {
@@ -510,6 +48,6 @@
         if (args.length > 0)
             iterations = Long.parseLong(args[0]);
 
-        new HeapByteBufferTest(iterations).run();
+        new HeapByteBufferTest(iterations, false).run();
     }
 }
diff --git a/hotspot/test/compiler/intrinsics/unsafe/TestUnsafeMismatchedArrayFieldAccess.java b/hotspot/test/compiler/intrinsics/unsafe/TestUnsafeMismatchedArrayFieldAccess.java
index 78ef24a..7830744 100644
--- a/hotspot/test/compiler/intrinsics/unsafe/TestUnsafeMismatchedArrayFieldAccess.java
+++ b/hotspot/test/compiler/intrinsics/unsafe/TestUnsafeMismatchedArrayFieldAccess.java
@@ -25,16 +25,18 @@
 /**
  * @test
  * @bug 8142386
+ * @summary Unsafe access to an array is wrongly marked as mismatched
  * @modules java.base/jdk.internal.misc
  * @library /testlibrary /test/lib
- * @summary Unsafe access to an array is wrongly marked as mismatched
- * @run main/othervm -XX:-UseOnStackReplacement -XX:-BackgroundCompilation -XX:-TieredCompilation TestUnsafeMismatchedArrayFieldAccess
  *
+ * @run main/othervm -XX:-UseOnStackReplacement -XX:-BackgroundCompilation -XX:-TieredCompilation
+ *      compiler.intrinsics.unsafe.TestUnsafeMismatchedArrayFieldAccess
  */
 
-import java.lang.reflect.*;
-import jdk.test.lib.Utils;
+package compiler.intrinsics.unsafe;
+
 import jdk.internal.misc.Unsafe;
+import jdk.test.lib.Utils;
 
 public class TestUnsafeMismatchedArrayFieldAccess {
 
diff --git a/hotspot/test/compiler/intrinsics/unsafe/TestUnsafeUnalignedMismatchedAccesses.java b/hotspot/test/compiler/intrinsics/unsafe/TestUnsafeUnalignedMismatchedAccesses.java
index d1ca58c..7fbd718 100644
--- a/hotspot/test/compiler/intrinsics/unsafe/TestUnsafeUnalignedMismatchedAccesses.java
+++ b/hotspot/test/compiler/intrinsics/unsafe/TestUnsafeUnalignedMismatchedAccesses.java
@@ -27,14 +27,20 @@
  * @bug 8136473
  * @summary Mismatched stores on same slice possible with Unsafe.Put*Unaligned methods
  * @modules java.base/jdk.internal.misc
- * @run main/othervm -XX:-UseOnStackReplacement -XX:-BackgroundCompilation TestUnsafeUnalignedMismatchedAccesses
- * @run main/othervm -XX:-UseOnStackReplacement -XX:-BackgroundCompilation -XX:+UnlockDiagnosticVMOptions -XX:-UseUnalignedAccesses TestUnsafeUnalignedMismatchedAccesses
  *
+ * @run main/othervm -XX:-UseOnStackReplacement -XX:-BackgroundCompilation
+ *      compiler.intrinsics.unsafe.TestUnsafeUnalignedMismatchedAccesses
+ * @run main/othervm -XX:-UseOnStackReplacement -XX:-BackgroundCompilation
+ *      -XX:+UnlockDiagnosticVMOptions -XX:-UseUnalignedAccesses
+ *      compiler.intrinsics.unsafe.TestUnsafeUnalignedMismatchedAccesses
  */
 
-import java.lang.reflect.*;
+package compiler.intrinsics.unsafe;
+
 import jdk.internal.misc.Unsafe;
 
+import java.lang.reflect.Field;
+
 public class TestUnsafeUnalignedMismatchedAccesses {
 
     private static final Unsafe UNSAFE;
diff --git a/hotspot/test/compiler/intrinsics/unsafe/UnsafeGetAddressTest.java b/hotspot/test/compiler/intrinsics/unsafe/UnsafeGetAddressTest.java
index 7599781..faa5a0b 100644
--- a/hotspot/test/compiler/intrinsics/unsafe/UnsafeGetAddressTest.java
+++ b/hotspot/test/compiler/intrinsics/unsafe/UnsafeGetAddressTest.java
@@ -26,12 +26,15 @@
  * @bug 6653795
  * @summary C2 intrinsic for Unsafe.getAddress performs pointer sign extension on 32-bit systems
  * @modules java.base/jdk.internal.misc
- * @run main UnsafeGetAddressTest
  *
+ * @run main compiler.intrinsics.unsafe.UnsafeGetAddressTest
  */
 
+package compiler.intrinsics.unsafe;
+
 import jdk.internal.misc.Unsafe;
-import java.lang.reflect.*;
+
+import java.lang.reflect.Field;
 
 public class UnsafeGetAddressTest {
     private static Unsafe unsafe;
diff --git a/hotspot/test/compiler/intrinsics/unsafe/UnsafeTwoCASLong.java b/hotspot/test/compiler/intrinsics/unsafe/UnsafeTwoCASLong.java
index 224d22c..458e405 100644
--- a/hotspot/test/compiler/intrinsics/unsafe/UnsafeTwoCASLong.java
+++ b/hotspot/test/compiler/intrinsics/unsafe/UnsafeTwoCASLong.java
@@ -27,9 +27,13 @@
  * @bug 8143930
  * @summary C1 LinearScan asserts when compiling two back-to-back CompareAndSwapLongs
  * @modules java.base/jdk.internal.misc
- * @run testng/othervm -Diters=200000 -XX:TieredStopAtLevel=1 UnsafeTwoCASLong
+ *
+ * @run testng/othervm -Diters=200000 -XX:TieredStopAtLevel=1
+ *      compiler.intrinsics.unsafe.UnsafeTwoCASLong
  */
 
+package compiler.intrinsics.unsafe;
+
 import org.testng.annotations.Test;
 
 import java.lang.reflect.Field;
diff --git a/hotspot/test/compiler/intrinsics/adler32/TestAdler32.java b/hotspot/test/compiler/intrinsics/zip/TestAdler32.java
similarity index 98%
rename from hotspot/test/compiler/intrinsics/adler32/TestAdler32.java
rename to hotspot/test/compiler/intrinsics/zip/TestAdler32.java
index 7607cb2..6688e96 100644
--- a/hotspot/test/compiler/intrinsics/adler32/TestAdler32.java
+++ b/hotspot/test/compiler/intrinsics/zip/TestAdler32.java
@@ -26,12 +26,14 @@
  * @bug 8132081
  * @summary C2 support for Adler32 on SPARC
  *
- * @run main/othervm/timeout=600 -Xbatch TestAdler32 -m
+ * @run main/othervm/timeout=600 -Xbatch compiler.intrinsics.zip.TestAdler32 -m
  */
 
+package compiler.intrinsics.zip;
+
 import java.nio.ByteBuffer;
-import java.util.zip.Checksum;
 import java.util.zip.Adler32;
+import java.util.zip.Checksum;
 
 public class TestAdler32 {
     public static void main(String[] args) {
diff --git a/hotspot/test/compiler/intrinsics/crc32/TestCRC32.java b/hotspot/test/compiler/intrinsics/zip/TestCRC32.java
similarity index 98%
rename from hotspot/test/compiler/intrinsics/crc32/TestCRC32.java
rename to hotspot/test/compiler/intrinsics/zip/TestCRC32.java
index f7ecc24..626f506 100644
--- a/hotspot/test/compiler/intrinsics/crc32/TestCRC32.java
+++ b/hotspot/test/compiler/intrinsics/zip/TestCRC32.java
@@ -26,12 +26,14 @@
  * @bug 8143012
  * @summary CRC32 Intrinsics support on SPARC
  *
- * @run main/othervm/timeout=720 -Xbatch TestCRC32 -m
+ * @run main/othervm/timeout=720 -Xbatch compiler.intrinsics.zip.TestCRC32 -m
  */
 
+package compiler.intrinsics.zip;
+
 import java.nio.ByteBuffer;
-import java.util.zip.Checksum;
 import java.util.zip.CRC32;
+import java.util.zip.Checksum;
 
 public class TestCRC32 {
     public static void main(String[] args) {
diff --git a/hotspot/test/compiler/intrinsics/crc32c/TestCRC32C.java b/hotspot/test/compiler/intrinsics/zip/TestCRC32C.java
similarity index 98%
rename from hotspot/test/compiler/intrinsics/crc32c/TestCRC32C.java
rename to hotspot/test/compiler/intrinsics/zip/TestCRC32C.java
index 676f541..2f280aa 100644
--- a/hotspot/test/compiler/intrinsics/crc32c/TestCRC32C.java
+++ b/hotspot/test/compiler/intrinsics/zip/TestCRC32C.java
@@ -26,12 +26,14 @@
  * @bug 8073583
  * @summary C2 support for CRC32C on SPARC
  *
- * @run main/othervm/timeout=600 -Xbatch TestCRC32C -m
+ * @run main/othervm/timeout=600 -Xbatch compiler.intrinsics.zip.TestCRC32C -m
  */
 
+package compiler.intrinsics.zip;
+
 import java.nio.ByteBuffer;
-import java.util.zip.Checksum;
 import java.util.zip.CRC32C;
+import java.util.zip.Checksum;
 
 public class TestCRC32C {
     public static void main(String[] args) {
diff --git a/hotspot/test/compiler/jsr292/CallSiteDepContextTest.java b/hotspot/test/compiler/jsr292/CallSiteDepContextTest.java
index 152b28d..80650b9 100644
--- a/hotspot/test/compiler/jsr292/CallSiteDepContextTest.java
+++ b/hotspot/test/compiler/jsr292/CallSiteDepContextTest.java
@@ -25,16 +25,23 @@
  * @test
  * @bug 8057967
  * @modules java.base/jdk.internal.misc
- * @modules java.base/jdk.internal.org.objectweb.asm
- * @library patches
+ *          java.base/jdk.internal.org.objectweb.asm
+ * @library patches /
+ *
  * @build java.base/java.lang.invoke.MethodHandleHelper
  * @run main/bootclasspath/othervm -Xbatch -XX:+IgnoreUnrecognizedVMOptions -Xlog:class+unload
  *                                 -XX:+PrintCompilation -XX:+TraceDependencies -XX:+TraceReferenceGC
- *                                 -verbose:gc compiler.jsr292.CallSiteDepContextTest
+ *                                 -verbose:gc
+ *                                 compiler.jsr292.CallSiteDepContextTest
  */
 
 package compiler.jsr292;
 
+import jdk.internal.misc.Unsafe;
+import jdk.internal.org.objectweb.asm.ClassWriter;
+import jdk.internal.org.objectweb.asm.Handle;
+import jdk.internal.org.objectweb.asm.MethodVisitor;
+
 import java.lang.invoke.CallSite;
 import java.lang.invoke.MethodHandle;
 import java.lang.invoke.MethodHandleHelper;
@@ -46,10 +53,11 @@
 import java.lang.ref.ReferenceQueue;
 import java.lang.reflect.Field;
 
-import jdk.internal.org.objectweb.asm.*;
-import jdk.internal.misc.Unsafe;
-
-import static jdk.internal.org.objectweb.asm.Opcodes.*;
+import static jdk.internal.org.objectweb.asm.Opcodes.ACC_PUBLIC;
+import static jdk.internal.org.objectweb.asm.Opcodes.ACC_STATIC;
+import static jdk.internal.org.objectweb.asm.Opcodes.ACC_SUPER;
+import static jdk.internal.org.objectweb.asm.Opcodes.H_INVOKESTATIC;
+import static jdk.internal.org.objectweb.asm.Opcodes.IRETURN;
 
 public class CallSiteDepContextTest {
     static final Unsafe               UNSAFE = Unsafe.getUnsafe();
diff --git a/hotspot/test/compiler/jsr292/ConcurrentClassLoadingTest.java b/hotspot/test/compiler/jsr292/ConcurrentClassLoadingTest.java
index cf591ff..c1f92ef 100644
--- a/hotspot/test/compiler/jsr292/ConcurrentClassLoadingTest.java
+++ b/hotspot/test/compiler/jsr292/ConcurrentClassLoadingTest.java
@@ -25,12 +25,17 @@
  * @test
  * @bug 8022595
  * @summary JSR292: deadlock during class loading of MethodHandles, MethodHandleImpl & MethodHandleNatives
- * @library /testlibrary
+ * @library /testlibrary /
  * @modules java.base/jdk.internal.misc
  *          java.management
- * @run main/othervm ConcurrentClassLoadingTest
+ *
+ * @run main/othervm compiler.jsr292.ConcurrentClassLoadingTest
  */
+
+package compiler.jsr292;
+
 import jdk.test.lib.Utils;
+
 import java.util.ArrayList;
 import java.util.Arrays;
 import java.util.List;
diff --git a/hotspot/test/compiler/jsr292/ContinuousCallSiteTargetChange.java b/hotspot/test/compiler/jsr292/ContinuousCallSiteTargetChange.java
index 3b009e9..f932b62 100644
--- a/hotspot/test/compiler/jsr292/ContinuousCallSiteTargetChange.java
+++ b/hotspot/test/compiler/jsr292/ContinuousCallSiteTargetChange.java
@@ -24,11 +24,21 @@
 /**
  * @test
  * @modules java.base/jdk.internal.misc
- * @library /testlibrary
- * @run main ContinuousCallSiteTargetChange
+ * @library /testlibrary /
+ *
+ * @run driver compiler.jsr292.ContinuousCallSiteTargetChange
  */
-import java.lang.invoke.*;
-import jdk.test.lib.*;
+
+package compiler.jsr292;
+
+import jdk.test.lib.OutputAnalyzer;
+import jdk.test.lib.ProcessTools;
+
+import java.lang.invoke.CallSite;
+import java.lang.invoke.MethodHandle;
+import java.lang.invoke.MethodHandles;
+import java.lang.invoke.MethodType;
+import java.lang.invoke.MutableCallSite;
 
 public class ContinuousCallSiteTargetChange {
     static void testServer() throws Exception {
@@ -37,7 +47,7 @@
                 "-server", "-XX:-TieredCompilation", "-Xbatch",
                 "-XX:PerBytecodeRecompilationCutoff=10", "-XX:PerMethodRecompilationCutoff=10",
                 "-XX:+PrintCompilation", "-XX:+UnlockDiagnosticVMOptions", "-XX:+PrintInlining",
-                "ContinuousCallSiteTargetChange$Test", "100");
+                Test.class.getName(), "100");
 
         OutputAnalyzer analyzer = new OutputAnalyzer(pb.start());
 
@@ -53,7 +63,7 @@
                 "-client", "-XX:+TieredCompilation", "-XX:TieredStopAtLevel=1", "-Xbatch",
                 "-XX:PerBytecodeRecompilationCutoff=10", "-XX:PerMethodRecompilationCutoff=10",
                 "-XX:+PrintCompilation", "-XX:+UnlockDiagnosticVMOptions", "-XX:+PrintInlining",
-                "ContinuousCallSiteTargetChange$Test", "100");
+                Test.class.getName(), "100");
 
         OutputAnalyzer analyzer = new OutputAnalyzer(pb.start());
 
diff --git a/hotspot/test/compiler/jsr292/CreatesInterfaceDotEqualsCallInfo.java b/hotspot/test/compiler/jsr292/CreatesInterfaceDotEqualsCallInfo.java
index 8581064..aa7102b 100644
--- a/hotspot/test/compiler/jsr292/CreatesInterfaceDotEqualsCallInfo.java
+++ b/hotspot/test/compiler/jsr292/CreatesInterfaceDotEqualsCallInfo.java
@@ -27,14 +27,17 @@
  * @bug 8026124
  * @summary Javascript file provoked assertion failure in linkResolver.cpp
  * @modules jdk.scripting.nashorn/jdk.nashorn.tools
- * @run main/othervm CreatesInterfaceDotEqualsCallInfo
+ *
+ * @run main/othervm compiler.jsr292.CreatesInterfaceDotEqualsCallInfo
  */
 
+package compiler.jsr292;
+
 public class CreatesInterfaceDotEqualsCallInfo {
-  public static void main(String[] args) throws java.io.IOException {
-    String[] jsargs = { System.getProperty("test.src", ".") +
-                        "/createsInterfaceDotEqualsCallInfo.js" };
-    jdk.nashorn.tools.Shell.main(System.in, System.out, System.err, jsargs);
-    System.out.println("PASS, did not crash running Javascript");
-  }
+    public static void main(String[] args) throws java.io.IOException {
+        String[] jsargs = {System.getProperty("test.src", ".") +
+                "/createsInterfaceDotEqualsCallInfo.js"};
+        jdk.nashorn.tools.Shell.main(System.in, System.out, System.err, jsargs);
+        System.out.println("PASS, did not crash running Javascript");
+    }
 }
diff --git a/hotspot/test/compiler/jsr292/InvokerGC.java b/hotspot/test/compiler/jsr292/InvokerGC.java
index bcd63dd..b1b1cd8 100644
--- a/hotspot/test/compiler/jsr292/InvokerGC.java
+++ b/hotspot/test/compiler/jsr292/InvokerGC.java
@@ -25,16 +25,22 @@
  * @test
  * @bug 8067247
  * @modules java.base/jdk.internal.misc
- * @library /test/lib /
+ * @library /test/lib
+ *
  * @run main/bootclasspath/othervm -Xcomp -Xbatch
- *      -XX:CompileCommand=compileonly,InvokerGC::test
  *      -XX:+UnlockDiagnosticVMOptions -XX:+WhiteBoxAPI
- *      InvokerGC
+ *      -XX:CompileCommand=compileonly,compiler.jsr292.InvokerGC::test
+ *      compiler.jsr292.InvokerGC
  */
 
-import java.lang.invoke.*;
+package compiler.jsr292;
+
 import sun.hotspot.WhiteBox;
 
+import java.lang.invoke.MethodHandle;
+import java.lang.invoke.MethodHandles;
+import java.lang.invoke.MethodType;
+
 public class InvokerGC {
     static final WhiteBox WB = WhiteBox.getWhiteBox();
 
diff --git a/hotspot/test/compiler/jsr292/LongReferenceCastingTest.java b/hotspot/test/compiler/jsr292/LongReferenceCastingTest.java
index 218b096..9512393 100644
--- a/hotspot/test/compiler/jsr292/LongReferenceCastingTest.java
+++ b/hotspot/test/compiler/jsr292/LongReferenceCastingTest.java
@@ -22,14 +22,20 @@
  *
  */
 
-import java.lang.invoke.*;
-
 /**
  * @test
  * @bug 8148752
  * @summary Test correct casting of MH arguments during inlining.
- * @run main LongReferenceCastingTest
+ *
+ * @run main compiler.jsr292.LongReferenceCastingTest
  */
+
+package compiler.jsr292;
+
+import java.lang.invoke.MethodHandle;
+import java.lang.invoke.MethodHandles;
+import java.lang.invoke.MethodType;
+
 public class LongReferenceCastingTest {
     static final String MY_STRING = "myString";
     static final MethodHandle MH;
diff --git a/hotspot/test/compiler/jsr292/MHInlineTest.java b/hotspot/test/compiler/jsr292/MHInlineTest.java
index 915c8f1..150b79e 100644
--- a/hotspot/test/compiler/jsr292/MHInlineTest.java
+++ b/hotspot/test/compiler/jsr292/MHInlineTest.java
@@ -26,21 +26,30 @@
  * @bug 8062280
  * @summary C2: inlining failure due to access checks being too strict
  * @modules java.base/jdk.internal.misc
- * @library /testlibrary
- * @run main/othervm MHInlineTest
+ * @library /testlibrary /
+ *
+ * @run main/othervm compiler.jsr292.MHInlineTest
  */
-import java.lang.invoke.*;
-import jdk.test.lib.*;
-import static jdk.test.lib.Asserts.*;
+
+package compiler.jsr292;
+
+import jdk.test.lib.OutputAnalyzer;
+import jdk.test.lib.ProcessTools;
+
+import java.lang.invoke.MethodHandle;
+import java.lang.invoke.MethodHandles;
+import java.lang.invoke.MethodType;
+
+import static jdk.test.lib.Asserts.assertEquals;
 
 public class MHInlineTest {
     public static void main(String[] args) throws Exception {
         ProcessBuilder pb = ProcessTools.createJavaProcessBuilder(
                 "-XX:+IgnoreUnrecognizedVMOptions", "-showversion",
-                "-server", "-XX:-TieredCompilation", "-Xbatch",
+                "-XX:-TieredCompilation", "-Xbatch",
                 "-XX:+PrintCompilation", "-XX:+UnlockDiagnosticVMOptions", "-XX:+PrintInlining",
-                "-XX:CompileCommand=dontinline,MHInlineTest::test*",
-                    "MHInlineTest$Launcher");
+                "-XX:CompileCommand=dontinline,compiler.jsr292.MHInlineTest::test*",
+                    Launcher.class.getName());
 
         OutputAnalyzer analyzer = new OutputAnalyzer(pb.start());
 
@@ -48,13 +57,13 @@
 
         // The test is applicable only to C2 (present in Server VM).
         if (analyzer.getStderr().contains("Server VM")) {
-            analyzer.shouldContain("MHInlineTest$B::public_x (3 bytes)   inline (hot)");
-            analyzer.shouldContain("MHInlineTest$B::protected_x (3 bytes)   inline (hot)");
-            analyzer.shouldContain("MHInlineTest$B::package_x (3 bytes)   inline (hot)");
-            analyzer.shouldContain("MHInlineTest$A::package_final_x (3 bytes)   inline (hot)");
-            analyzer.shouldContain("MHInlineTest$B::private_x (3 bytes)   inline (hot)");
-            analyzer.shouldContain("MHInlineTest$B::private_static_x (3 bytes)   inline (hot)");
-            analyzer.shouldContain("MHInlineTest$A::package_static_x (3 bytes)   inline (hot)");
+            analyzer.shouldContain("compiler.jsr292.MHInlineTest$B::public_x (3 bytes)   inline (hot)");
+            analyzer.shouldContain("compiler.jsr292.MHInlineTest$B::protected_x (3 bytes)   inline (hot)");
+            analyzer.shouldContain("compiler.jsr292.MHInlineTest$B::package_x (3 bytes)   inline (hot)");
+            analyzer.shouldContain("compiler.jsr292.MHInlineTest$A::package_final_x (3 bytes)   inline (hot)");
+            analyzer.shouldContain("compiler.jsr292.MHInlineTest$B::private_x (3 bytes)   inline (hot)");
+            analyzer.shouldContain("compiler.jsr292.MHInlineTest$B::private_static_x (3 bytes)   inline (hot)");
+            analyzer.shouldContain("compiler.jsr292.MHInlineTest$A::package_static_x (3 bytes)   inline (hot)");
         }
     }
 
diff --git a/hotspot/test/compiler/jsr292/NonInlinedCall/Agent.java b/hotspot/test/compiler/jsr292/NonInlinedCall/Agent.java
index e9f2f46..93540ea 100644
--- a/hotspot/test/compiler/jsr292/NonInlinedCall/Agent.java
+++ b/hotspot/test/compiler/jsr292/NonInlinedCall/Agent.java
@@ -23,13 +23,13 @@
 
 package compiler.jsr292.NonInlinedCall;
 
+import jdk.test.lib.JDKToolLauncher;
+import jdk.test.lib.OutputAnalyzer;
+
 import java.io.File;
 import java.io.PrintStream;
 import java.util.Arrays;
 
-import jdk.test.lib.JDKToolLauncher;
-import jdk.test.lib.OutputAnalyzer;
-
 public class Agent {
     public static void main(String[] args) throws Exception {
         String jarName = args[0];
diff --git a/hotspot/test/compiler/jsr292/NonInlinedCall/GCTest.java b/hotspot/test/compiler/jsr292/NonInlinedCall/GCTest.java
index 3a93fe7..02b06fa 100644
--- a/hotspot/test/compiler/jsr292/NonInlinedCall/GCTest.java
+++ b/hotspot/test/compiler/jsr292/NonInlinedCall/GCTest.java
@@ -26,7 +26,8 @@
  * @bug 8072008
  * @library /testlibrary /test/lib ../patches
  * @modules java.base/jdk.internal.misc
- * @modules java.base/jdk.internal.vm.annotation
+ *          java.base/jdk.internal.vm.annotation
+ *
  * @build java.base/java.lang.invoke.MethodHandleHelper
  * @build sun.hotspot.WhiteBox
  * @run main/bootclasspath/othervm -XX:+IgnoreUnrecognizedVMOptions
@@ -38,22 +39,20 @@
 
 package compiler.jsr292.NonInlinedCall;
 
+import jdk.internal.vm.annotation.DontInline;
+import jdk.internal.vm.annotation.Stable;
+import sun.hotspot.WhiteBox;
+
+import java.lang.invoke.MethodHandle;
 import java.lang.invoke.MethodHandleHelper;
 import java.lang.invoke.MethodHandleHelper.NonInlinedReinvoker;
 import java.lang.invoke.MethodHandles;
-import java.lang.invoke.MethodHandle;
-
 import java.lang.invoke.MethodType;
 import java.lang.ref.PhantomReference;
 import java.lang.ref.Reference;
 import java.lang.ref.ReferenceQueue;
 
-import jdk.internal.vm.annotation.DontInline;
-import jdk.internal.vm.annotation.Stable;
-
-import sun.hotspot.WhiteBox;
-
-import static jdk.test.lib.Asserts.*;
+import static jdk.test.lib.Asserts.assertEquals;
 
 public class GCTest {
     static final MethodHandles.Lookup LOOKUP = MethodHandleHelper.IMPL_LOOKUP;
diff --git a/hotspot/test/compiler/jsr292/NonInlinedCall/InvokeTest.java b/hotspot/test/compiler/jsr292/NonInlinedCall/InvokeTest.java
index d413d38..15ca369 100644
--- a/hotspot/test/compiler/jsr292/NonInlinedCall/InvokeTest.java
+++ b/hotspot/test/compiler/jsr292/NonInlinedCall/InvokeTest.java
@@ -26,10 +26,11 @@
  * @bug 8072008
  * @library /testlibrary /test/lib / ../patches
  * @modules java.base/jdk.internal.misc
- * @modules java.base/jdk.internal.vm.annotation
+ *          java.base/jdk.internal.vm.annotation
+ *
  * @build java.base/java.lang.invoke.MethodHandleHelper
- * @build sun.hotspot.WhiteBox
- * @build compiler.jsr292.NonInlinedCall.InvokeTest
+ *        sun.hotspot.WhiteBox
+ *        compiler.jsr292.NonInlinedCall.InvokeTest
  * @run main/bootclasspath/othervm -XX:+IgnoreUnrecognizedVMOptions
  *                                 -XX:+UnlockDiagnosticVMOptions -XX:+WhiteBoxAPI
  *                                 -Xbatch -XX:-TieredCompilation -XX:CICompilerCount=1
@@ -38,17 +39,16 @@
 
 package compiler.jsr292.NonInlinedCall;
 
+import jdk.internal.vm.annotation.DontInline;
+import sun.hotspot.WhiteBox;
+
 import java.lang.invoke.MethodHandle;
 import java.lang.invoke.MethodHandleHelper;
 import java.lang.invoke.MethodHandleHelper.NonInlinedReinvoker;
 import java.lang.invoke.MethodHandles;
 import java.lang.invoke.MethodType;
 
-import jdk.internal.vm.annotation.DontInline;
-
-import sun.hotspot.WhiteBox;
-
-import static jdk.test.lib.Asserts.*;
+import static jdk.test.lib.Asserts.assertEquals;
 
 public class InvokeTest {
     static MethodHandles.Lookup LOOKUP = MethodHandleHelper.IMPL_LOOKUP;
diff --git a/hotspot/test/compiler/jsr292/NonInlinedCall/RedefineTest.java b/hotspot/test/compiler/jsr292/NonInlinedCall/RedefineTest.java
index cb77918..dbd9f92 100644
--- a/hotspot/test/compiler/jsr292/NonInlinedCall/RedefineTest.java
+++ b/hotspot/test/compiler/jsr292/NonInlinedCall/RedefineTest.java
@@ -29,13 +29,16 @@
  *          java.base/jdk.internal.vm.annotation
  * @library /testlibrary /test/lib / ../patches
  * @requires vm.flavor != "minimal"
+ *
  * @build sun.hotspot.WhiteBox
- * @build java.base/java.lang.invoke.MethodHandleHelper
- * @build compiler.jsr292.NonInlinedCall.RedefineTest
- * @run main compiler.jsr292.NonInlinedCall.Agent agent.jar compiler.jsr292.NonInlinedCall.RedefineTest
- * @run main ClassFileInstaller sun.hotspot.WhiteBox
- *                              sun.hotspot.WhiteBox$WhiteBoxPermission
- *                              compiler.jsr292.NonInlinedCall.RedefineTest
+ *        java.base/java.lang.invoke.MethodHandleHelper
+ *        compiler.jsr292.NonInlinedCall.RedefineTest
+ * @run driver compiler.jsr292.NonInlinedCall.Agent
+ *             agent.jar
+ *             compiler.jsr292.NonInlinedCall.RedefineTest
+ * @run driver ClassFileInstaller sun.hotspot.WhiteBox
+ *                                sun.hotspot.WhiteBox$WhiteBoxPermission
+ *                                compiler.jsr292.NonInlinedCall.RedefineTest
  * @run main/bootclasspath/othervm -javaagent:agent.jar
  *                                 -XX:+IgnoreUnrecognizedVMOptions
  *                                 -XX:+UnlockDiagnosticVMOptions -XX:+WhiteBoxAPI
@@ -45,20 +48,23 @@
 
 package compiler.jsr292.NonInlinedCall;
 
+import jdk.internal.misc.Unsafe;
+import jdk.internal.org.objectweb.asm.ClassWriter;
+import jdk.internal.org.objectweb.asm.MethodVisitor;
+import jdk.internal.vm.annotation.DontInline;
 import sun.hotspot.WhiteBox;
 
 import java.lang.instrument.ClassDefinition;
 import java.lang.instrument.Instrumentation;
 import java.lang.invoke.MethodHandle;
-import java.lang.invoke.MethodHandles;
 import java.lang.invoke.MethodHandleHelper;
+import java.lang.invoke.MethodHandles;
 import java.lang.invoke.MethodType;
 
-import jdk.internal.misc.Unsafe;
-import jdk.internal.vm.annotation.DontInline;
-import jdk.internal.org.objectweb.asm.*;
-
-import static jdk.internal.org.objectweb.asm.Opcodes.*;
+import static jdk.internal.org.objectweb.asm.Opcodes.ACC_PUBLIC;
+import static jdk.internal.org.objectweb.asm.Opcodes.ACC_STATIC;
+import static jdk.internal.org.objectweb.asm.Opcodes.ACC_SUPER;
+import static jdk.internal.org.objectweb.asm.Opcodes.IRETURN;
 
 public class RedefineTest {
     static final MethodHandles.Lookup LOOKUP = MethodHandleHelper.IMPL_LOOKUP;
diff --git a/hotspot/test/compiler/jsr292/NullConstantReceiver.java b/hotspot/test/compiler/jsr292/NullConstantReceiver.java
index 067c620..42c2b87 100644
--- a/hotspot/test/compiler/jsr292/NullConstantReceiver.java
+++ b/hotspot/test/compiler/jsr292/NullConstantReceiver.java
@@ -24,9 +24,12 @@
 /**
  * @test
  * @bug 8059556
- * @run main/othervm -Xbatch NullConstantReceiver
+ *
+ * @run main/othervm -Xbatch compiler.jsr292.NullConstantReceiver
  */
 
+package compiler.jsr292;
+
 import java.lang.invoke.MethodHandle;
 import java.lang.invoke.MethodHandles;
 import java.lang.invoke.MethodType;
diff --git a/hotspot/test/compiler/jsr292/PollutedTrapCounts.java b/hotspot/test/compiler/jsr292/PollutedTrapCounts.java
index b368b2f..9090513 100644
--- a/hotspot/test/compiler/jsr292/PollutedTrapCounts.java
+++ b/hotspot/test/compiler/jsr292/PollutedTrapCounts.java
@@ -26,10 +26,18 @@
  * @bug 8074551
  * @modules java.base/jdk.internal.misc
  * @library /testlibrary
- * @run main PollutedTrapCounts
+ *
+ * @run driver compiler.jsr292.PollutedTrapCounts
  */
-import java.lang.invoke.*;
-import jdk.test.lib.*;
+
+package compiler.jsr292;
+
+import jdk.test.lib.OutputAnalyzer;
+import jdk.test.lib.ProcessTools;
+
+import java.lang.invoke.MethodHandle;
+import java.lang.invoke.MethodHandles;
+import java.lang.invoke.MethodType;
 
 public class PollutedTrapCounts {
     public static void main(String[] args) throws Exception {
@@ -38,7 +46,7 @@
                 "-XX:-TieredCompilation", "-Xbatch",
                 "-XX:PerBytecodeRecompilationCutoff=10", "-XX:PerMethodRecompilationCutoff=10",
                 "-XX:+PrintCompilation", "-XX:+UnlockDiagnosticVMOptions", "-XX:+PrintInlining",
-                    "PollutedTrapCounts$Test");
+                    Test.class.getName());
 
         OutputAnalyzer analyzer = new OutputAnalyzer(pb.start());
 
diff --git a/hotspot/test/compiler/jsr292/RedefineMethodUsedByMultipleMethodHandles.java b/hotspot/test/compiler/jsr292/RedefineMethodUsedByMultipleMethodHandles.java
index cf20e8f..a8d142e 100644
--- a/hotspot/test/compiler/jsr292/RedefineMethodUsedByMultipleMethodHandles.java
+++ b/hotspot/test/compiler/jsr292/RedefineMethodUsedByMultipleMethodHandles.java
@@ -25,27 +25,42 @@
  * @test
  * @bug 8042235
  * @summary redefining method used by multiple MethodHandles crashes VM
+ * @library /
  * @modules java.base/jdk.internal.org.objectweb.asm
  *          java.compiler
  *          java.instrument
  *          java.management
- * @compile -XDignore.symbol.file RedefineMethodUsedByMultipleMethodHandles.java
- * @run main/othervm RedefineMethodUsedByMultipleMethodHandles
+ *
+ * @run main/othervm compiler.jsr292.RedefineMethodUsedByMultipleMethodHandles
  */
 
-import java.io.*;
-import java.lang.instrument.*;
-import java.lang.invoke.*;
+package compiler.jsr292;
+
+import jdk.internal.org.objectweb.asm.ClassReader;
+import jdk.internal.org.objectweb.asm.ClassVisitor;
+import jdk.internal.org.objectweb.asm.ClassWriter;
+import jdk.internal.org.objectweb.asm.MethodVisitor;
+import jdk.internal.org.objectweb.asm.Opcodes;
+
+import javax.tools.ToolProvider;
+import java.io.FileOutputStream;
+import java.io.IOException;
+import java.io.InputStream;
+import java.lang.instrument.ClassFileTransformer;
+import java.lang.instrument.IllegalClassFormatException;
+import java.lang.instrument.Instrumentation;
+import java.lang.invoke.MethodHandle;
+import java.lang.invoke.MethodHandles;
 import java.lang.invoke.MethodHandles.Lookup;
-import java.lang.management.*;
-import java.lang.reflect.*;
-import java.nio.file.*;
-import java.security.*;
-import java.util.jar.*;
-
-import javax.tools.*;
-
-import jdk.internal.org.objectweb.asm.*;
+import java.lang.management.ManagementFactory;
+import java.lang.reflect.Method;
+import java.nio.file.Files;
+import java.nio.file.Path;
+import java.security.ProtectionDomain;
+import java.util.jar.Attributes;
+import java.util.jar.JarEntry;
+import java.util.jar.JarOutputStream;
+import java.util.jar.Manifest;
 
 public class RedefineMethodUsedByMultipleMethodHandles {
 
diff --git a/hotspot/test/compiler/jsr292/7082949/Test7082949.java b/hotspot/test/compiler/jsr292/Test7082949.java
similarity index 89%
rename from hotspot/test/compiler/jsr292/7082949/Test7082949.java
rename to hotspot/test/compiler/jsr292/Test7082949.java
index 41b7911..b699ba5 100644
--- a/hotspot/test/compiler/jsr292/7082949/Test7082949.java
+++ b/hotspot/test/compiler/jsr292/Test7082949.java
@@ -27,12 +27,15 @@
  * @bug 7082949
  * @summary JSR 292: missing ResourceMark in methodOopDesc::make_invoke_method
  *
- * @run main Test7082949
+ * @run main compiler.jsr292.Test7082949
  */
 
-import java.lang.invoke.*;
-import static java.lang.invoke.MethodHandles.*;
-import static java.lang.invoke.MethodType.*;
+package compiler.jsr292;
+
+import java.lang.invoke.MethodHandle;
+import java.lang.invoke.MethodHandles;
+
+import static java.lang.invoke.MethodType.methodType;
 
 public class Test7082949 implements Runnable {
     public static void main(String... args) throws Throwable {
diff --git a/hotspot/test/compiler/jsr292/VMAnonymousClasses.java b/hotspot/test/compiler/jsr292/VMAnonymousClasses.java
index abb9b5d..c79deeb 100644
--- a/hotspot/test/compiler/jsr292/VMAnonymousClasses.java
+++ b/hotspot/test/compiler/jsr292/VMAnonymousClasses.java
@@ -26,13 +26,16 @@
  * @bug 8058828
  * @modules java.base/jdk.internal.org.objectweb.asm
  *          java.base/jdk.internal.misc
- * @run main/bootclasspath/othervm -Xbatch VMAnonymousClasses
+ *
+ * @run main/bootclasspath/othervm -Xbatch compiler.jsr292.VMAnonymousClasses
  */
 
+package compiler.jsr292;
+
+import jdk.internal.misc.Unsafe;
 import jdk.internal.org.objectweb.asm.ClassWriter;
 import jdk.internal.org.objectweb.asm.MethodVisitor;
 import jdk.internal.org.objectweb.asm.Opcodes;
-import jdk.internal.misc.Unsafe;
 
 import java.lang.invoke.ConstantCallSite;
 import java.lang.invoke.MethodHandle;
diff --git a/hotspot/test/compiler/jsr292/6990212/Test6990212.java b/hotspot/test/compiler/jsr292/cr6990212/Test6990212.java
similarity index 90%
rename from hotspot/test/compiler/jsr292/6990212/Test6990212.java
rename to hotspot/test/compiler/jsr292/cr6990212/Test6990212.java
index bdb28c5..e9cd8c8 100644
--- a/hotspot/test/compiler/jsr292/6990212/Test6990212.java
+++ b/hotspot/test/compiler/jsr292/cr6990212/Test6990212.java
@@ -27,10 +27,14 @@
  * @bug 6990212
  * @summary JSR 292 JVMTI MethodEnter hook is not called for JSR 292 bootstrap and target methods
  *
- * @run main Test6990212
+ * @run main compiler.jsr292.cr6990212.Test6990212
  */
 
-import java.lang.invoke.*;
+package compiler.jsr292.cr6990212;
+
+import java.lang.invoke.MethodHandle;
+import java.lang.invoke.MethodHandles;
+import java.lang.invoke.MethodType;
 
 interface intf {
     public Object target();
diff --git a/hotspot/test/compiler/jsr292/methodHandleExceptions/ByteClassLoader.java b/hotspot/test/compiler/jsr292/methodHandleExceptions/ByteClassLoader.java
index 3903f6f..c9b572b 100644
--- a/hotspot/test/compiler/jsr292/methodHandleExceptions/ByteClassLoader.java
+++ b/hotspot/test/compiler/jsr292/methodHandleExceptions/ByteClassLoader.java
@@ -1,12 +1,3 @@
-import java.io.BufferedOutputStream;
-import java.io.FileNotFoundException;
-import java.io.FileOutputStream;
-import java.io.IOException;
-import java.net.URL;
-import java.net.URLClassLoader;
-import java.util.jar.JarEntry;
-import java.util.jar.JarOutputStream;
-
 /*
  * Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
@@ -31,6 +22,17 @@
  *
  */
 
+package compiler.jsr292.methodHandleExceptions;
+
+import java.io.BufferedOutputStream;
+import java.io.FileNotFoundException;
+import java.io.FileOutputStream;
+import java.io.IOException;
+import java.net.URL;
+import java.net.URLClassLoader;
+import java.util.jar.JarEntry;
+import java.util.jar.JarOutputStream;
+
 /**
  * A ByteClassLoader is used to define classes from collections of bytes, as
  * well as loading classes in the usual way. It includes options to write the
diff --git a/hotspot/test/compiler/jsr292/methodHandleExceptions/TestAMEnotNPE.java b/hotspot/test/compiler/jsr292/methodHandleExceptions/TestAMEnotNPE.java
index 93fe9bd..a00e6ab 100644
--- a/hotspot/test/compiler/jsr292/methodHandleExceptions/TestAMEnotNPE.java
+++ b/hotspot/test/compiler/jsr292/methodHandleExceptions/TestAMEnotNPE.java
@@ -21,28 +21,47 @@
  * questions.
  *
  */
-import java.lang.reflect.InvocationTargetException;
-import java.lang.reflect.Method;
-import java.util.ArrayList;
-import java.util.List;
+
+/**
+ * @test
+ * @bug 8025260 8016839
+ * @summary Ensure that AbstractMethodError and IllegalAccessError are thrown appropriately, not NullPointerException
+ * @modules java.base/jdk.internal.org.objectweb.asm
+ * @library / .
+ *
+ * @build p.*
+ * @run main/othervm compiler.jsr292.methodHandleExceptions.TestAMEnotNPE
+ * @run main/othervm -Xint compiler.jsr292.methodHandleExceptions.TestAMEnotNPE
+ * @run main/othervm -Xcomp compiler.jsr292.methodHandleExceptions.TestAMEnotNPE
+ */
+
+package compiler.jsr292.methodHandleExceptions;
+
+import p.Dok;
 import jdk.internal.org.objectweb.asm.ClassWriter;
 import jdk.internal.org.objectweb.asm.Handle;
 import jdk.internal.org.objectweb.asm.MethodVisitor;
 import jdk.internal.org.objectweb.asm.Opcodes;
-import p.Dok;
 
-/**
- * @test @bug 8025260 8016839
- * @summary Ensure that AbstractMethodError and IllegalAccessError are thrown appropriately, not NullPointerException
- *
- * @modules java.base/jdk.internal.org.objectweb.asm
- * @compile -XDignore.symbol.file TestAMEnotNPE.java ByteClassLoader.java p/C.java p/Dok.java p/E.java p/F.java p/I.java p/Tdirect.java p/Treflect.java
- *
- * @run main/othervm TestAMEnotNPE
- * @run main/othervm -Xint TestAMEnotNPE
- * @run main/othervm -Xcomp TestAMEnotNPE
- */
-public class TestAMEnotNPE implements Opcodes {
+import java.lang.reflect.InvocationTargetException;
+import java.lang.reflect.Method;
+import java.util.ArrayList;
+import java.util.List;
+
+import static jdk.internal.org.objectweb.asm.Opcodes.ACC_PRIVATE;
+import static jdk.internal.org.objectweb.asm.Opcodes.ACC_PUBLIC;
+import static jdk.internal.org.objectweb.asm.Opcodes.ACC_STATIC;
+import static jdk.internal.org.objectweb.asm.Opcodes.ACC_SUPER;
+import static jdk.internal.org.objectweb.asm.Opcodes.ALOAD;
+import static jdk.internal.org.objectweb.asm.Opcodes.ILOAD;
+import static jdk.internal.org.objectweb.asm.Opcodes.INVOKESPECIAL;
+import static jdk.internal.org.objectweb.asm.Opcodes.INVOKEVIRTUAL;
+import static jdk.internal.org.objectweb.asm.Opcodes.IRETURN;
+import static jdk.internal.org.objectweb.asm.Opcodes.LLOAD;
+import static jdk.internal.org.objectweb.asm.Opcodes.RETURN;
+import static jdk.internal.org.objectweb.asm.Opcodes.V1_8;
+
+public class TestAMEnotNPE {
 
     static boolean writeJarFiles = false;
     static boolean readJarFiles = false;
@@ -115,7 +134,7 @@
             System.out.flush();
             Thread.sleep(250); // This de-interleaves output and error in Netbeans, sigh.
             for (Throwable th : lt)
-              System.err.println(th);
+                System.err.println(th);
             throw new Error("Test failed, there were " + lt.size() + " failures listed above");
         } else {
             System.out.println("ALL PASS, HOORAY!");
@@ -191,7 +210,7 @@
      * @throws Exception
      */
     public static byte[] bytesForSomeDsubSomethingSomeAccess
-            (String d_name, String sub_what, int method_acc)
+    (String d_name, String sub_what, int method_acc)
             throws Exception {
 
         ClassWriter cw = new ClassWriter(ClassWriter.COMPUTE_FRAMES
diff --git a/hotspot/test/compiler/jsr292/methodHandleExceptions/p/C.java b/hotspot/test/compiler/jsr292/methodHandleExceptions/p/C.java
index ab0e1aa..6eddea4 100644
--- a/hotspot/test/compiler/jsr292/methodHandleExceptions/p/C.java
+++ b/hotspot/test/compiler/jsr292/methodHandleExceptions/p/C.java
@@ -30,6 +30,6 @@
  * an abstract method error if called.
  *
  */
-public abstract class C implements p.I {
+public abstract class C implements I {
        public abstract int m();
 }
diff --git a/hotspot/test/compiler/jsr292/methodHandleExceptions/p/Dok.java b/hotspot/test/compiler/jsr292/methodHandleExceptions/p/Dok.java
index f9fa4c2..9d00701 100644
--- a/hotspot/test/compiler/jsr292/methodHandleExceptions/p/Dok.java
+++ b/hotspot/test/compiler/jsr292/methodHandleExceptions/p/Dok.java
@@ -21,11 +21,12 @@
  * questions.
  *
  */
+
 package p;
 
 /**
  * Test class -- implements I, extends E, both define m, so all should be well.
  */
-public class Dok extends p.E {
+public class Dok extends E {
 
 }
diff --git a/hotspot/test/compiler/jsr292/methodHandleExceptions/p/E.java b/hotspot/test/compiler/jsr292/methodHandleExceptions/p/E.java
index 6b1f8f9..2211b6b 100644
--- a/hotspot/test/compiler/jsr292/methodHandleExceptions/p/E.java
+++ b/hotspot/test/compiler/jsr292/methodHandleExceptions/p/E.java
@@ -31,7 +31,7 @@
  * of course is NOT usually the case in this test).
  *
  */
-public abstract class E implements p.I {
+public abstract class E implements I {
        public int m() {
            return 2;
        }
diff --git a/hotspot/test/compiler/jsr292/methodHandleExceptions/p/F.java b/hotspot/test/compiler/jsr292/methodHandleExceptions/p/F.java
index 86b6c65..bd8dd1a 100644
--- a/hotspot/test/compiler/jsr292/methodHandleExceptions/p/F.java
+++ b/hotspot/test/compiler/jsr292/methodHandleExceptions/p/F.java
@@ -34,7 +34,7 @@
  * m.
  *
  */
-public abstract class F implements p.I {
+public abstract class F implements I {
        final public int m() {
            return 2;
        }
diff --git a/hotspot/test/compiler/jsr292/methodHandleExceptions/p/Tdirect.java b/hotspot/test/compiler/jsr292/methodHandleExceptions/p/Tdirect.java
index 088e1fa..2a45dee 100644
--- a/hotspot/test/compiler/jsr292/methodHandleExceptions/p/Tdirect.java
+++ b/hotspot/test/compiler/jsr292/methodHandleExceptions/p/Tdirect.java
@@ -28,7 +28,7 @@
  * Invokes I.m directly using invokeInterface bytecodes.
  */
 public class Tdirect {
-     public static int test(p.I i) {
+     public static int test(I i) {
          int accum = 0;
          for (int j = 0; j < 100000; j++) {
              accum += i.m();
@@ -36,7 +36,7 @@
         return accum;
     }
 
-     public static int test(p.I ii, byte b, char c, short s, int i, long l,
+     public static int test(I ii, byte b, char c, short s, int i, long l,
              Object o1, Object o2, Object o3, Object o4, Object o5, Object o6) {
          int accum = 0;
          for (int j = 0; j < 100000; j++) {
diff --git a/hotspot/test/compiler/jsr292/methodHandleExceptions/p/Treflect.java b/hotspot/test/compiler/jsr292/methodHandleExceptions/p/Treflect.java
index a4f754a..9468a2d 100644
--- a/hotspot/test/compiler/jsr292/methodHandleExceptions/p/Treflect.java
+++ b/hotspot/test/compiler/jsr292/methodHandleExceptions/p/Treflect.java
@@ -21,6 +21,7 @@
  * questions.
  *
  */
+
 package p;
 
 import java.lang.reflect.InvocationTargetException;
@@ -31,9 +32,9 @@
  */
 public class Treflect {
 
-    public static int test(p.I ii) throws Throwable {
+    public static int test(I ii) throws Throwable {
         int accum = 0;
-        Method m = p.I.class.getMethod("m");
+        Method m = I.class.getMethod("m");
         try {
             for (int j = 0; j < 100000; j++) {
                 Object o = m.invoke(ii);
@@ -45,10 +46,10 @@
         return accum;
     }
 
-    public static int test(p.I ii, byte b, char c, short s, int i, long l,
+    public static int test(I ii, byte b, char c, short s, int i, long l,
             Object o1, Object o2, Object o3, Object o4, Object o5, Object o6)
             throws Throwable {
-        Method m = p.I.class.getMethod("m", Byte.TYPE, Character.TYPE,
+        Method m = I.class.getMethod("m", Byte.TYPE, Character.TYPE,
                 Short.TYPE, Integer.TYPE, Long.TYPE,
                 Object.class, Object.class, Object.class,
                 Object.class, Object.class, Object.class);
diff --git a/hotspot/test/compiler/jvmci/JVM_GetJVMCIRuntimeTest.java b/hotspot/test/compiler/jvmci/JVM_GetJVMCIRuntimeTest.java
index 57eed05..28036f3 100644
--- a/hotspot/test/compiler/jvmci/JVM_GetJVMCIRuntimeTest.java
+++ b/hotspot/test/compiler/jvmci/JVM_GetJVMCIRuntimeTest.java
@@ -52,8 +52,8 @@
 
 package compiler.jvmci;
 
-import jdk.vm.ci.runtime.JVMCI;
 import jdk.test.lib.Asserts;
+import jdk.vm.ci.runtime.JVMCI;
 
 public class JVM_GetJVMCIRuntimeTest implements Runnable {
     private static final boolean IS_POSITIVE = Boolean.getBoolean(
diff --git a/hotspot/test/compiler/jvmci/SecurityRestrictionsTest.java b/hotspot/test/compiler/jvmci/SecurityRestrictionsTest.java
index 22263a7..529f7ac 100644
--- a/hotspot/test/compiler/jvmci/SecurityRestrictionsTest.java
+++ b/hotspot/test/compiler/jvmci/SecurityRestrictionsTest.java
@@ -56,14 +56,11 @@
 package compiler.jvmci;
 
 import jdk.test.lib.Utils;
-import java.lang.InternalError;
-import java.lang.reflect.Constructor;
+
 import java.security.AccessControlException;
 import java.security.Permission;
 import java.util.PropertyPermission;
 import java.util.function.Consumer;
-import java.util.logging.Level;
-import java.util.logging.Logger;
 
 public class SecurityRestrictionsTest {
 
diff --git a/hotspot/test/compiler/jvmci/common/CTVMUtilities.java b/hotspot/test/compiler/jvmci/common/CTVMUtilities.java
index 6c33016..03335f6 100644
--- a/hotspot/test/compiler/jvmci/common/CTVMUtilities.java
+++ b/hotspot/test/compiler/jvmci/common/CTVMUtilities.java
@@ -23,18 +23,6 @@
 
 package compiler.jvmci.common;
 
-import java.io.IOException;
-import java.lang.reflect.Module;
-import java.lang.reflect.Field;
-import java.lang.reflect.Executable;
-import java.lang.reflect.Constructor;
-import java.lang.reflect.Method;
-import java.lang.reflect.Modifier;
-import java.lang.reflect.Parameter;
-import java.util.HashMap;
-import java.util.Map;
-import java.util.TreeMap;
-
 import jdk.internal.org.objectweb.asm.ClassReader;
 import jdk.internal.org.objectweb.asm.ClassVisitor;
 import jdk.internal.org.objectweb.asm.ClassWriter;
@@ -47,6 +35,18 @@
 import jdk.vm.ci.hotspot.CompilerToVMHelper;
 import jdk.vm.ci.hotspot.HotSpotResolvedJavaMethod;
 
+import java.io.IOException;
+import java.lang.reflect.Constructor;
+import java.lang.reflect.Executable;
+import java.lang.reflect.Field;
+import java.lang.reflect.Method;
+import java.lang.reflect.Modifier;
+import java.lang.reflect.Module;
+import java.lang.reflect.Parameter;
+import java.util.HashMap;
+import java.util.Map;
+import java.util.TreeMap;
+
 public class CTVMUtilities {
     /*
      * A method to return HotSpotResolvedJavaMethod object using class object
diff --git a/hotspot/test/compiler/jvmci/common/JVMCIHelpers.java b/hotspot/test/compiler/jvmci/common/JVMCIHelpers.java
index 7d9abd4..47164ca 100644
--- a/hotspot/test/compiler/jvmci/common/JVMCIHelpers.java
+++ b/hotspot/test/compiler/jvmci/common/JVMCIHelpers.java
@@ -23,14 +23,12 @@
 
 package compiler.jvmci.common;
 
-import jdk.vm.ci.code.Architecture;
 import jdk.vm.ci.code.CompilationRequest;
 import jdk.vm.ci.code.CompilationRequestResult;
 import jdk.vm.ci.hotspot.services.HotSpotVMEventListener;
-import jdk.vm.ci.meta.ResolvedJavaMethod;
 import jdk.vm.ci.runtime.JVMCICompiler;
-import jdk.vm.ci.runtime.services.JVMCICompilerFactory;
 import jdk.vm.ci.runtime.JVMCIRuntime;
+import jdk.vm.ci.runtime.services.JVMCICompilerFactory;
 
 /*
  * A stub classes to be able to use jvmci
diff --git a/hotspot/test/compiler/jvmci/common/patches/jdk.vm.ci/jdk/vm/ci/hotspot/CompilerToVMHelper.java b/hotspot/test/compiler/jvmci/common/patches/jdk.vm.ci/jdk/vm/ci/hotspot/CompilerToVMHelper.java
index e35c516..f2b4092 100644
--- a/hotspot/test/compiler/jvmci/common/patches/jdk.vm.ci/jdk/vm/ci/hotspot/CompilerToVMHelper.java
+++ b/hotspot/test/compiler/jvmci/common/patches/jdk.vm.ci/jdk/vm/ci/hotspot/CompilerToVMHelper.java
@@ -28,7 +28,6 @@
 import jdk.vm.ci.code.TargetDescription;
 import jdk.vm.ci.meta.ConstantPool;
 import jdk.vm.ci.meta.ResolvedJavaMethod;
-import jdk.vm.ci.meta.SpeculationLog;
 
 /**
  * A simple "proxy" class to get test access to CompilerToVM package-private methods
diff --git a/hotspot/test/compiler/jvmci/common/testcases/TestCase.java b/hotspot/test/compiler/jvmci/common/testcases/TestCase.java
index d08fe31..af11b03 100644
--- a/hotspot/test/compiler/jvmci/common/testcases/TestCase.java
+++ b/hotspot/test/compiler/jvmci/common/testcases/TestCase.java
@@ -25,13 +25,9 @@
 package compiler.jvmci.common.testcases;
 
 import java.lang.reflect.Executable;
-import java.lang.reflect.Method;
-import java.lang.reflect.Modifier;
 import java.util.Arrays;
 import java.util.Collection;
 import java.util.HashSet;
-import java.util.List;
-import java.util.ArrayList;
 import java.util.Set;
 
 /**
diff --git a/hotspot/test/compiler/jvmci/compilerToVM/AllocateCompileIdTest.java b/hotspot/test/compiler/jvmci/compilerToVM/AllocateCompileIdTest.java
index daeaaed..e9608ee 100644
--- a/hotspot/test/compiler/jvmci/compilerToVM/AllocateCompileIdTest.java
+++ b/hotspot/test/compiler/jvmci/compilerToVM/AllocateCompileIdTest.java
@@ -32,11 +32,12 @@
  *          java.base/jdk.internal.org.objectweb.asm.tree
  *          jdk.vm.ci/jdk.vm.ci.hotspot
  *          jdk.vm.ci/jdk.vm.ci.code
+ *
  * @build jdk.vm.ci/jdk.vm.ci.hotspot.CompilerToVMHelper
  * @build compiler.jvmci.compilerToVM.AllocateCompileIdTest
  * @build sun.hotspot.WhiteBox
- * @run main ClassFileInstaller sun.hotspot.WhiteBox
- *                              sun.hotspot.WhiteBox$WhiteBoxPermission
+ * @run driver ClassFileInstaller sun.hotspot.WhiteBox
+ *                                sun.hotspot.WhiteBox$WhiteBoxPermission
  * @run main/othervm -Xbootclasspath/a:.
  *                   -XX:+UnlockDiagnosticVMOptions -XX:+WhiteBoxAPI
  *                   -XX:+UnlockExperimentalVMOptions -XX:+EnableJVMCI
@@ -47,22 +48,21 @@
 package compiler.jvmci.compilerToVM;
 
 import compiler.jvmci.common.CTVMUtilities;
+import jdk.test.lib.Asserts;
+import jdk.test.lib.Pair;
+import jdk.test.lib.Utils;
+import jdk.vm.ci.hotspot.CompilerToVMHelper;
+import jdk.vm.ci.hotspot.HotSpotResolvedJavaMethod;
+import sun.hotspot.code.NMethod;
 
 import java.lang.reflect.Executable;
 import java.lang.reflect.Method;
 import java.util.ArrayList;
-import java.util.List;
 import java.util.HashSet;
+import java.util.List;
 import java.util.stream.Collectors;
 import java.util.stream.Stream;
 
-import jdk.vm.ci.hotspot.CompilerToVMHelper;
-import jdk.vm.ci.hotspot.HotSpotResolvedJavaMethod;
-import jdk.test.lib.Asserts;
-import jdk.test.lib.Pair;
-import jdk.test.lib.Utils;
-import sun.hotspot.code.NMethod;
-
 public class AllocateCompileIdTest {
 
     private static final int SOME_REPEAT_VALUE = 5;
diff --git a/hotspot/test/compiler/jvmci/compilerToVM/CanInlineMethodTest.java b/hotspot/test/compiler/jvmci/compilerToVM/CanInlineMethodTest.java
index 7a313d4..dea8cb2 100644
--- a/hotspot/test/compiler/jvmci/compilerToVM/CanInlineMethodTest.java
+++ b/hotspot/test/compiler/jvmci/compilerToVM/CanInlineMethodTest.java
@@ -33,11 +33,12 @@
  *          java.base/jdk.internal.org.objectweb.asm.tree
  *          jdk.vm.ci/jdk.vm.ci.hotspot
  *          jdk.vm.ci/jdk.vm.ci.code
+ *
  * @build jdk.vm.ci/jdk.vm.ci.hotspot.CompilerToVMHelper
  * @build compiler.jvmci.compilerToVM.CanInlineMethodTest
  * @build sun.hotspot.WhiteBox
- * @run main ClassFileInstaller sun.hotspot.WhiteBox
- *                              sun.hotspot.WhiteBox$WhiteBoxPermission
+ * @run driver ClassFileInstaller sun.hotspot.WhiteBox
+ *                                sun.hotspot.WhiteBox$WhiteBoxPermission
  * @run main/othervm -Xbootclasspath/a:.
  *                   -XX:+UnlockDiagnosticVMOptions -XX:+WhiteBoxAPI
  *                   -XX:+UnlockExperimentalVMOptions -XX:+EnableJVMCI
@@ -47,14 +48,15 @@
 package compiler.jvmci.compilerToVM;
 
 import compiler.jvmci.common.CTVMUtilities;
+import jdk.test.lib.Asserts;
+import jdk.vm.ci.hotspot.CompilerToVMHelper;
+import jdk.vm.ci.hotspot.HotSpotResolvedJavaMethod;
+import sun.hotspot.WhiteBox;
+
 import java.lang.reflect.Executable;
 import java.util.ArrayList;
 import java.util.Arrays;
 import java.util.List;
-import jdk.vm.ci.hotspot.CompilerToVMHelper;
-import jdk.vm.ci.hotspot.HotSpotResolvedJavaMethod;
-import jdk.test.lib.Asserts;
-import sun.hotspot.WhiteBox;
 
 public class CanInlineMethodTest {
 
diff --git a/hotspot/test/compiler/jvmci/compilerToVM/CollectCountersTest.java b/hotspot/test/compiler/jvmci/compilerToVM/CollectCountersTest.java
index 8bd98dc..46beea7 100644
--- a/hotspot/test/compiler/jvmci/compilerToVM/CollectCountersTest.java
+++ b/hotspot/test/compiler/jvmci/compilerToVM/CollectCountersTest.java
@@ -45,8 +45,8 @@
 
 package compiler.jvmci.compilerToVM;
 
-import jdk.vm.ci.hotspot.CompilerToVMHelper;
 import jdk.test.lib.Asserts;
+import jdk.vm.ci.hotspot.CompilerToVMHelper;
 
 public class CollectCountersTest {
     private static final int EXPECTED = Integer.getInteger(
diff --git a/hotspot/test/compiler/jvmci/compilerToVM/CompileCodeTestCase.java b/hotspot/test/compiler/jvmci/compilerToVM/CompileCodeTestCase.java
index fa6483c..697aee2 100644
--- a/hotspot/test/compiler/jvmci/compilerToVM/CompileCodeTestCase.java
+++ b/hotspot/test/compiler/jvmci/compilerToVM/CompileCodeTestCase.java
@@ -26,13 +26,14 @@
 
 import compiler.jvmci.common.CTVMUtilities;
 import compiler.testlibrary.CompilerUtils;
+import jdk.test.lib.Pair;
 import jdk.test.lib.Utils;
 import jdk.vm.ci.code.InstalledCode;
 import sun.hotspot.WhiteBox;
 import sun.hotspot.code.NMethod;
 
-import java.lang.reflect.Executable;
 import java.lang.reflect.Constructor;
+import java.lang.reflect.Executable;
 import java.lang.reflect.InvocationTargetException;
 import java.lang.reflect.Method;
 import java.lang.reflect.Modifier;
@@ -42,7 +43,6 @@
 import java.util.HashMap;
 import java.util.List;
 import java.util.Map;
-import jdk.test.lib.Pair;
 
 /**
  * A test case for tests which require compiled code.
diff --git a/hotspot/test/compiler/jvmci/compilerToVM/ConstantPoolTestCase.java b/hotspot/test/compiler/jvmci/compilerToVM/ConstantPoolTestCase.java
index d3f8500..224ff9d 100644
--- a/hotspot/test/compiler/jvmci/compilerToVM/ConstantPoolTestCase.java
+++ b/hotspot/test/compiler/jvmci/compilerToVM/ConstantPoolTestCase.java
@@ -24,15 +24,31 @@
 
 package compiler.jvmci.compilerToVM;
 
-import java.util.HashMap;
-import java.util.Map;
+import compiler.jvmci.compilerToVM.ConstantPoolTestsHelper.DummyClasses;
+import jdk.internal.reflect.ConstantPool;
+import jdk.internal.reflect.ConstantPool.Tag;
 import jdk.vm.ci.hotspot.HotSpotResolvedObjectType;
 import jdk.vm.ci.meta.ResolvedJavaMethod;
 import sun.hotspot.WhiteBox;
-import jdk.internal.reflect.ConstantPool;
-import jdk.internal.reflect.ConstantPool.Tag;
-import compiler.jvmci.compilerToVM.ConstantPoolTestsHelper.DummyClasses;
-import static compiler.jvmci.compilerToVM.ConstantPoolTestCase.ConstantTypes.*;
+
+import java.util.HashMap;
+import java.util.Map;
+
+import static compiler.jvmci.compilerToVM.ConstantPoolTestCase.ConstantTypes.CONSTANT_CLASS;
+import static compiler.jvmci.compilerToVM.ConstantPoolTestCase.ConstantTypes.CONSTANT_DOUBLE;
+import static compiler.jvmci.compilerToVM.ConstantPoolTestCase.ConstantTypes.CONSTANT_FIELDREF;
+import static compiler.jvmci.compilerToVM.ConstantPoolTestCase.ConstantTypes.CONSTANT_FLOAT;
+import static compiler.jvmci.compilerToVM.ConstantPoolTestCase.ConstantTypes.CONSTANT_INTEGER;
+import static compiler.jvmci.compilerToVM.ConstantPoolTestCase.ConstantTypes.CONSTANT_INTERFACEMETHODREF;
+import static compiler.jvmci.compilerToVM.ConstantPoolTestCase.ConstantTypes.CONSTANT_INVALID;
+import static compiler.jvmci.compilerToVM.ConstantPoolTestCase.ConstantTypes.CONSTANT_INVOKEDYNAMIC;
+import static compiler.jvmci.compilerToVM.ConstantPoolTestCase.ConstantTypes.CONSTANT_LONG;
+import static compiler.jvmci.compilerToVM.ConstantPoolTestCase.ConstantTypes.CONSTANT_METHODHANDLE;
+import static compiler.jvmci.compilerToVM.ConstantPoolTestCase.ConstantTypes.CONSTANT_METHODREF;
+import static compiler.jvmci.compilerToVM.ConstantPoolTestCase.ConstantTypes.CONSTANT_METHODTYPE;
+import static compiler.jvmci.compilerToVM.ConstantPoolTestCase.ConstantTypes.CONSTANT_NAMEANDTYPE;
+import static compiler.jvmci.compilerToVM.ConstantPoolTestCase.ConstantTypes.CONSTANT_STRING;
+import static compiler.jvmci.compilerToVM.ConstantPoolTestCase.ConstantTypes.CONSTANT_UTF8;
 
 /**
  * Common class for jdk.vm.ci.hotspot.CompilerToVM constant pool tests
diff --git a/hotspot/test/compiler/jvmci/compilerToVM/ConstantPoolTestsHelper.java b/hotspot/test/compiler/jvmci/compilerToVM/ConstantPoolTestsHelper.java
index fc33560..f615832 100644
--- a/hotspot/test/compiler/jvmci/compilerToVM/ConstantPoolTestsHelper.java
+++ b/hotspot/test/compiler/jvmci/compilerToVM/ConstantPoolTestsHelper.java
@@ -27,19 +27,28 @@
 import compiler.jvmci.common.testcases.MultipleImplementer2;
 import compiler.jvmci.common.testcases.MultipleImplementersInterface;
 import compiler.jvmci.compilerToVM.ConstantPoolTestCase.ConstantTypes;
-import static compiler.jvmci.compilerToVM.ConstantPoolTestCase.ConstantTypes.*;
 import compiler.jvmci.compilerToVM.ConstantPoolTestCase.TestedCPEntry;
-import java.util.HashMap;
-import java.util.Map;
+import jdk.internal.misc.SharedSecrets;
+import jdk.internal.org.objectweb.asm.Opcodes;
+import jdk.internal.reflect.ConstantPool;
+import jdk.internal.reflect.ConstantPool.Tag;
 import jdk.vm.ci.meta.MetaAccessProvider;
 import jdk.vm.ci.meta.ResolvedJavaMethod;
 import jdk.vm.ci.meta.ResolvedJavaType;
 import jdk.vm.ci.runtime.JVMCI;
-import jdk.internal.misc.SharedSecrets;
-import jdk.internal.org.objectweb.asm.Opcodes;
 import sun.hotspot.WhiteBox;
-import jdk.internal.reflect.ConstantPool;
-import jdk.internal.reflect.ConstantPool.Tag;
+
+import java.util.HashMap;
+import java.util.Map;
+
+import static compiler.jvmci.compilerToVM.ConstantPoolTestCase.ConstantTypes.CONSTANT_CLASS;
+import static compiler.jvmci.compilerToVM.ConstantPoolTestCase.ConstantTypes.CONSTANT_FIELDREF;
+import static compiler.jvmci.compilerToVM.ConstantPoolTestCase.ConstantTypes.CONSTANT_INTERFACEMETHODREF;
+import static compiler.jvmci.compilerToVM.ConstantPoolTestCase.ConstantTypes.CONSTANT_INVOKEDYNAMIC;
+import static compiler.jvmci.compilerToVM.ConstantPoolTestCase.ConstantTypes.CONSTANT_METHODHANDLE;
+import static compiler.jvmci.compilerToVM.ConstantPoolTestCase.ConstantTypes.CONSTANT_METHODREF;
+import static compiler.jvmci.compilerToVM.ConstantPoolTestCase.ConstantTypes.CONSTANT_METHODTYPE;
+import static compiler.jvmci.compilerToVM.ConstantPoolTestCase.ConstantTypes.CONSTANT_STRING;
 
 /**
  * Class contains hard-coded constant pool tables for dummy classes used for
diff --git a/hotspot/test/compiler/jvmci/compilerToVM/DebugOutputTest.java b/hotspot/test/compiler/jvmci/compilerToVM/DebugOutputTest.java
index 477c912..b2477b7 100644
--- a/hotspot/test/compiler/jvmci/compilerToVM/DebugOutputTest.java
+++ b/hotspot/test/compiler/jvmci/compilerToVM/DebugOutputTest.java
@@ -38,11 +38,11 @@
 
 package compiler.jvmci.compilerToVM;
 
-import jdk.vm.ci.hotspot.CompilerToVMHelper;
-import jdk.test.lib.ProcessTools;
-import java.util.Arrays;
 import jdk.test.lib.OutputAnalyzer;
-import jdk.test.lib.Utils;
+import jdk.test.lib.ProcessTools;
+import jdk.vm.ci.hotspot.CompilerToVMHelper;
+
+import java.util.Arrays;
 
 public class DebugOutputTest {
     public static void main(String[] args) {
diff --git a/hotspot/test/compiler/jvmci/compilerToVM/DisassembleCodeBlobTest.java b/hotspot/test/compiler/jvmci/compilerToVM/DisassembleCodeBlobTest.java
index aeb384d..8bb3820 100644
--- a/hotspot/test/compiler/jvmci/compilerToVM/DisassembleCodeBlobTest.java
+++ b/hotspot/test/compiler/jvmci/compilerToVM/DisassembleCodeBlobTest.java
@@ -33,12 +33,13 @@
  *          java.base/jdk.internal.org.objectweb.asm.tree
  *          jdk.vm.ci/jdk.vm.ci.hotspot
  *          jdk.vm.ci/jdk.vm.ci.code
+ *
  * @ignore 8139700
  * @build jdk.vm.ci/jdk.vm.ci.hotspot.CompilerToVMHelper
  * @build sun.hotspot.WhiteBox
  *        compiler.jvmci.compilerToVM.DisassembleCodeBlobTest
- * @run main ClassFileInstaller sun.hotspot.WhiteBox
- *                              sun.hotspot.WhiteBox$WhiteBoxPermission
+ * @run driver ClassFileInstaller sun.hotspot.WhiteBox
+ *                                sun.hotspot.WhiteBox$WhiteBoxPermission
  * @run main/othervm -Xbootclasspath/a:.
  *                   -XX:+UnlockDiagnosticVMOptions -XX:+WhiteBoxAPI
  *                   -XX:+UnlockExperimentalVMOptions -XX:+EnableJVMCI
@@ -47,13 +48,13 @@
 
 package compiler.jvmci.compilerToVM;
 
-import jdk.vm.ci.hotspot.CompilerToVMHelper;
-import jdk.vm.ci.code.InstalledCode;
 import jdk.test.lib.Asserts;
+import jdk.test.lib.Utils;
+import jdk.vm.ci.code.InstalledCode;
+import jdk.vm.ci.hotspot.CompilerToVMHelper;
 import sun.hotspot.code.NMethod;
 
 import java.util.List;
-import jdk.test.lib.Utils;
 
 public class DisassembleCodeBlobTest {
 
diff --git a/hotspot/test/compiler/jvmci/compilerToVM/DoNotInlineOrCompileTest.java b/hotspot/test/compiler/jvmci/compilerToVM/DoNotInlineOrCompileTest.java
index a3ab66a..2390557 100644
--- a/hotspot/test/compiler/jvmci/compilerToVM/DoNotInlineOrCompileTest.java
+++ b/hotspot/test/compiler/jvmci/compilerToVM/DoNotInlineOrCompileTest.java
@@ -33,11 +33,12 @@
  *          java.base/jdk.internal.org.objectweb.asm.tree
  *          jdk.vm.ci/jdk.vm.ci.hotspot
  *          jdk.vm.ci/jdk.vm.ci.code
+ *
  * @build jdk.vm.ci/jdk.vm.ci.hotspot.CompilerToVMHelper
  * @build compiler.jvmci.compilerToVM.DoNotInlineOrCompileTest
  * @build sun.hotspot.WhiteBox
- * @run main ClassFileInstaller sun.hotspot.WhiteBox
- *                              sun.hotspot.WhiteBox$WhiteBoxPermission
+ * @run driver ClassFileInstaller sun.hotspot.WhiteBox
+ *                                sun.hotspot.WhiteBox$WhiteBoxPermission
  * @run main/othervm -Xbootclasspath/a:.
  *                   -XX:+UnlockDiagnosticVMOptions -XX:+WhiteBoxAPI
  *                   -XX:+UnlockExperimentalVMOptions -XX:+EnableJVMCI
@@ -47,14 +48,15 @@
 package compiler.jvmci.compilerToVM;
 
 import compiler.jvmci.common.CTVMUtilities;
+import jdk.test.lib.Asserts;
+import jdk.vm.ci.hotspot.CompilerToVMHelper;
+import jdk.vm.ci.hotspot.HotSpotResolvedJavaMethod;
+import sun.hotspot.WhiteBox;
+
 import java.lang.reflect.Executable;
 import java.util.ArrayList;
 import java.util.Arrays;
 import java.util.List;
-import jdk.vm.ci.hotspot.CompilerToVMHelper;
-import jdk.vm.ci.hotspot.HotSpotResolvedJavaMethod;
-import jdk.test.lib.Asserts;
-import sun.hotspot.WhiteBox;
 
 public class DoNotInlineOrCompileTest {
 
diff --git a/hotspot/test/compiler/jvmci/compilerToVM/ExecuteInstalledCodeTest.java b/hotspot/test/compiler/jvmci/compilerToVM/ExecuteInstalledCodeTest.java
index 5ea1bbd..c6a36fc 100644
--- a/hotspot/test/compiler/jvmci/compilerToVM/ExecuteInstalledCodeTest.java
+++ b/hotspot/test/compiler/jvmci/compilerToVM/ExecuteInstalledCodeTest.java
@@ -1,22 +1,17 @@
 package compiler.jvmci.compilerToVM;
 
+import jdk.test.lib.Asserts;
+import jdk.test.lib.Pair;
+import jdk.test.lib.Utils;
 import jdk.vm.ci.code.InstalledCode;
 import jdk.vm.ci.code.InvalidInstalledCodeException;
 import jdk.vm.ci.hotspot.CompilerToVMHelper;
-import jdk.test.lib.Asserts;
-import jdk.test.lib.Utils;
-import jdk.test.lib.Pair;
 import sun.hotspot.code.NMethod;
 
 import java.lang.reflect.Constructor;
-import java.lang.reflect.Executable;
-import java.lang.reflect.InvocationTargetException;
-import java.lang.reflect.Method;
 import java.lang.reflect.Modifier;
 import java.util.ArrayList;
-import java.util.HashMap;
 import java.util.List;
-import java.util.Map;
 
 /*
  * @test
@@ -33,8 +28,8 @@
  * @build jdk.vm.ci/jdk.vm.ci.hotspot.CompilerToVMHelper
  * @build compiler.jvmci.compilerToVM.ExecuteInstalledCodeTest
  * @build sun.hotspot.WhiteBox
- * @run main ClassFileInstaller sun.hotspot.WhiteBox
- *                              sun.hotspot.WhiteBox$WhiteBoxPermission
+ * @run driver ClassFileInstaller sun.hotspot.WhiteBox
+ *                                sun.hotspot.WhiteBox$WhiteBoxPermission
  * @run main/othervm -Xbootclasspath/a:.
  *                   -XX:+UnlockDiagnosticVMOptions -XX:+WhiteBoxAPI
  *                   -XX:+UnlockExperimentalVMOptions -XX:+EnableJVMCI
diff --git a/hotspot/test/compiler/jvmci/compilerToVM/FindUniqueConcreteMethodTest.java b/hotspot/test/compiler/jvmci/compilerToVM/FindUniqueConcreteMethodTest.java
index 7b23709..3c818d9 100644
--- a/hotspot/test/compiler/jvmci/compilerToVM/FindUniqueConcreteMethodTest.java
+++ b/hotspot/test/compiler/jvmci/compilerToVM/FindUniqueConcreteMethodTest.java
@@ -40,19 +40,20 @@
 
 package compiler.jvmci.compilerToVM;
 
+import compiler.jvmci.common.CTVMUtilities;
 import compiler.jvmci.common.testcases.MultipleImplementer1;
 import compiler.jvmci.common.testcases.SingleImplementer;
-import compiler.jvmci.common.testcases.SingleSubclass;
-import compiler.jvmci.common.CTVMUtilities;
 import compiler.jvmci.common.testcases.SingleImplementerInterface;
-import java.lang.reflect.Method;
-import java.util.HashSet;
-import java.util.Set;
+import compiler.jvmci.common.testcases.SingleSubclass;
+import jdk.test.lib.Asserts;
+import jdk.test.lib.Utils;
 import jdk.vm.ci.hotspot.CompilerToVMHelper;
 import jdk.vm.ci.hotspot.HotSpotResolvedJavaMethod;
 import jdk.vm.ci.hotspot.HotSpotResolvedObjectType;
-import jdk.test.lib.Asserts;
-import jdk.test.lib.Utils;
+
+import java.lang.reflect.Method;
+import java.util.HashSet;
+import java.util.Set;
 
 public class FindUniqueConcreteMethodTest {
     public static void main(String args[]) {
diff --git a/hotspot/test/compiler/jvmci/compilerToVM/GetBytecodeTest.java b/hotspot/test/compiler/jvmci/compilerToVM/GetBytecodeTest.java
index a72d0c4..6bd182b 100644
--- a/hotspot/test/compiler/jvmci/compilerToVM/GetBytecodeTest.java
+++ b/hotspot/test/compiler/jvmci/compilerToVM/GetBytecodeTest.java
@@ -43,12 +43,13 @@
 
 import compiler.jvmci.common.CTVMUtilities;
 import compiler.jvmci.common.testcases.TestCase;
-import java.lang.reflect.Executable;
-import java.lang.reflect.Modifier;
-import jdk.vm.ci.hotspot.HotSpotResolvedJavaMethod;
-import jdk.vm.ci.hotspot.CompilerToVMHelper;
 import jdk.internal.org.objectweb.asm.Opcodes;
 import jdk.test.lib.Asserts;
+import jdk.vm.ci.hotspot.CompilerToVMHelper;
+import jdk.vm.ci.hotspot.HotSpotResolvedJavaMethod;
+
+import java.lang.reflect.Executable;
+import java.lang.reflect.Modifier;
 
 public class GetBytecodeTest {
 
diff --git a/hotspot/test/compiler/jvmci/compilerToVM/GetClassInitializerTest.java b/hotspot/test/compiler/jvmci/compilerToVM/GetClassInitializerTest.java
index 2eec0da..c20b668 100644
--- a/hotspot/test/compiler/jvmci/compilerToVM/GetClassInitializerTest.java
+++ b/hotspot/test/compiler/jvmci/compilerToVM/GetClassInitializerTest.java
@@ -43,13 +43,14 @@
 import compiler.jvmci.common.testcases.MultipleImplementersInterfaceExtender;
 import compiler.jvmci.common.testcases.SingleImplementer;
 import compiler.jvmci.common.testcases.SingleImplementerInterface;
-import java.util.HashSet;
-import java.util.Set;
+import jdk.test.lib.Asserts;
+import jdk.test.lib.Utils;
 import jdk.vm.ci.hotspot.CompilerToVMHelper;
 import jdk.vm.ci.hotspot.HotSpotResolvedJavaMethod;
 import jdk.vm.ci.hotspot.HotSpotResolvedObjectType;
-import jdk.test.lib.Asserts;
-import jdk.test.lib.Utils;
+
+import java.util.HashSet;
+import java.util.Set;
 
 public class GetClassInitializerTest {
 
diff --git a/hotspot/test/compiler/jvmci/compilerToVM/GetConstantPoolTest.java b/hotspot/test/compiler/jvmci/compilerToVM/GetConstantPoolTest.java
index 00be361..ceb35fe 100644
--- a/hotspot/test/compiler/jvmci/compilerToVM/GetConstantPoolTest.java
+++ b/hotspot/test/compiler/jvmci/compilerToVM/GetConstantPoolTest.java
@@ -31,12 +31,13 @@
  * @modules java.base/jdk.internal.misc
  * @modules jdk.vm.ci/jdk.vm.ci.hotspot
  *          jdk.vm.ci/jdk.vm.ci.meta
+ *
  * @build jdk.vm.ci/jdk.vm.ci.hotspot.CompilerToVMHelper
  * @build jdk.vm.ci/jdk.vm.ci.hotspot.PublicMetaspaceWrapperObject
  * @build compiler.jvmci.compilerToVM.GetConstantPoolTest
  * @build sun.hotspot.WhiteBox
- * @run main ClassFileInstaller sun.hotspot.WhiteBox
- *                              sun.hotspot.WhiteBox$WhiteBoxPermission
+ * @run driver ClassFileInstaller sun.hotspot.WhiteBox
+ *                                sun.hotspot.WhiteBox$WhiteBoxPermission
  * @run main/othervm -Xbootclasspath/a:.
  *                   -XX:+UnlockDiagnosticVMOptions -XX:+WhiteBoxAPI
  *                   -XX:+UnlockExperimentalVMOptions -XX:+EnableJVMCI
@@ -44,15 +45,15 @@
  */
 package compiler.jvmci.compilerToVM;
 
-import java.lang.reflect.Field;
-import jdk.vm.ci.meta.ConstantPool;
+import jdk.internal.misc.Unsafe;
+import jdk.test.lib.Utils;
 import jdk.vm.ci.hotspot.CompilerToVMHelper;
 import jdk.vm.ci.hotspot.HotSpotResolvedJavaMethod;
-import jdk.vm.ci.hotspot.HotSpotResolvedObjectType;
 import jdk.vm.ci.hotspot.PublicMetaspaceWrapperObject;
-import jdk.test.lib.Utils;
+import jdk.vm.ci.meta.ConstantPool;
 import sun.hotspot.WhiteBox;
-import jdk.internal.misc.Unsafe;
+
+import java.lang.reflect.Field;
 
 /**
  * Tests for jdk.vm.ci.hotspot.CompilerToVM::getConstantPool method
diff --git a/hotspot/test/compiler/jvmci/compilerToVM/GetExceptionTableTest.java b/hotspot/test/compiler/jvmci/compilerToVM/GetExceptionTableTest.java
index 2d7d511..3e5ada1 100644
--- a/hotspot/test/compiler/jvmci/compilerToVM/GetExceptionTableTest.java
+++ b/hotspot/test/compiler/jvmci/compilerToVM/GetExceptionTableTest.java
@@ -42,14 +42,15 @@
 package compiler.jvmci.compilerToVM;
 
 import compiler.jvmci.common.CTVMUtilities;
+import jdk.test.lib.Asserts;
+import jdk.vm.ci.hotspot.CompilerToVMHelper;
+import jdk.vm.ci.hotspot.HotSpotResolvedJavaMethod;
+
 import java.io.IOException;
 import java.lang.reflect.Executable;
 import java.net.Socket;
 import java.util.HashMap;
 import java.util.Map;
-import jdk.vm.ci.hotspot.HotSpotResolvedJavaMethod;
-import jdk.vm.ci.hotspot.CompilerToVMHelper;
-import jdk.test.lib.Asserts;
 
 public class GetExceptionTableTest {
 
diff --git a/hotspot/test/compiler/jvmci/compilerToVM/GetImplementorTest.java b/hotspot/test/compiler/jvmci/compilerToVM/GetImplementorTest.java
index e907eb8..dd0841d 100644
--- a/hotspot/test/compiler/jvmci/compilerToVM/GetImplementorTest.java
+++ b/hotspot/test/compiler/jvmci/compilerToVM/GetImplementorTest.java
@@ -39,8 +39,8 @@
 
 import compiler.jvmci.common.testcases.AbstractClass;
 import compiler.jvmci.common.testcases.AbstractClassExtender;
-import compiler.jvmci.common.testcases.DoNotImplementInterface;
 import compiler.jvmci.common.testcases.DoNotExtendClass;
+import compiler.jvmci.common.testcases.DoNotImplementInterface;
 import compiler.jvmci.common.testcases.MultipleImplementer1;
 import compiler.jvmci.common.testcases.MultipleImplementer2;
 import compiler.jvmci.common.testcases.MultipleImplementersInterface;
@@ -48,13 +48,14 @@
 import compiler.jvmci.common.testcases.SingleImplementerInterface;
 import compiler.jvmci.common.testcases.SingleSubclass;
 import compiler.jvmci.common.testcases.SingleSubclassedClass;
+import jdk.test.lib.Asserts;
+import jdk.test.lib.Utils;
+import jdk.vm.ci.hotspot.CompilerToVMHelper;
+import jdk.vm.ci.hotspot.HotSpotResolvedObjectType;
+
 import java.util.HashSet;
 import java.util.Set;
 import java.util.stream.Stream;
-import jdk.vm.ci.hotspot.CompilerToVMHelper;
-import jdk.vm.ci.hotspot.HotSpotResolvedObjectType;
-import jdk.test.lib.Asserts;
-import jdk.test.lib.Utils;
 
 public class GetImplementorTest {
     public static void main(String args[]) {
diff --git a/hotspot/test/compiler/jvmci/compilerToVM/GetLineNumberTableTest.java b/hotspot/test/compiler/jvmci/compilerToVM/GetLineNumberTableTest.java
index c121881..ac99a5c 100644
--- a/hotspot/test/compiler/jvmci/compilerToVM/GetLineNumberTableTest.java
+++ b/hotspot/test/compiler/jvmci/compilerToVM/GetLineNumberTableTest.java
@@ -44,9 +44,9 @@
 
 import compiler.jvmci.common.CTVMUtilities;
 import compiler.jvmci.common.testcases.TestCase;
+import jdk.test.lib.Asserts;
 import jdk.vm.ci.hotspot.CompilerToVMHelper;
 import jdk.vm.ci.hotspot.HotSpotResolvedJavaMethod;
-import jdk.test.lib.Asserts;
 
 import java.lang.reflect.Executable;
 import java.util.Arrays;
diff --git a/hotspot/test/compiler/jvmci/compilerToVM/GetLocalVariableTableTest.java b/hotspot/test/compiler/jvmci/compilerToVM/GetLocalVariableTableTest.java
index 4fb64f7..7d3b097 100644
--- a/hotspot/test/compiler/jvmci/compilerToVM/GetLocalVariableTableTest.java
+++ b/hotspot/test/compiler/jvmci/compilerToVM/GetLocalVariableTableTest.java
@@ -47,9 +47,9 @@
 package compiler.jvmci.compilerToVM;
 
 import compiler.jvmci.common.CTVMUtilities;
-import jdk.vm.ci.hotspot.HotSpotResolvedJavaMethod;
-import jdk.vm.ci.hotspot.CompilerToVMHelper;
 import jdk.test.lib.Asserts;
+import jdk.vm.ci.hotspot.CompilerToVMHelper;
+import jdk.vm.ci.hotspot.HotSpotResolvedJavaMethod;
 
 import java.lang.reflect.Executable;
 import java.util.HashMap;
diff --git a/hotspot/test/compiler/jvmci/compilerToVM/GetMaxCallTargetOffsetTest.java b/hotspot/test/compiler/jvmci/compilerToVM/GetMaxCallTargetOffsetTest.java
index 44574b0..fcdf29e 100644
--- a/hotspot/test/compiler/jvmci/compilerToVM/GetMaxCallTargetOffsetTest.java
+++ b/hotspot/test/compiler/jvmci/compilerToVM/GetMaxCallTargetOffsetTest.java
@@ -37,8 +37,8 @@
 
 package compiler.jvmci.compilerToVM;
 
-import jdk.vm.ci.hotspot.CompilerToVMHelper;
 import jdk.test.lib.Asserts;
+import jdk.vm.ci.hotspot.CompilerToVMHelper;
 
 public class GetMaxCallTargetOffsetTest {
     public static void main(String args[]) {
diff --git a/hotspot/test/compiler/jvmci/compilerToVM/GetNextStackFrameTest.java b/hotspot/test/compiler/jvmci/compilerToVM/GetNextStackFrameTest.java
index 7809e94..b0c0d50 100644
--- a/hotspot/test/compiler/jvmci/compilerToVM/GetNextStackFrameTest.java
+++ b/hotspot/test/compiler/jvmci/compilerToVM/GetNextStackFrameTest.java
@@ -42,11 +42,12 @@
 package compiler.jvmci.compilerToVM;
 
 import compiler.jvmci.common.CTVMUtilities;
-import java.lang.reflect.Method;
+import jdk.test.lib.Asserts;
 import jdk.vm.ci.hotspot.CompilerToVMHelper;
 import jdk.vm.ci.hotspot.HotSpotStackFrameReference;
 import jdk.vm.ci.meta.ResolvedJavaMethod;
-import jdk.test.lib.Asserts;
+
+import java.lang.reflect.Method;
 
 public class GetNextStackFrameTest {
     private static final int RECURSION_AMOUNT = 3;
diff --git a/hotspot/test/compiler/jvmci/compilerToVM/GetResolvedJavaMethodAtSlotTest.java b/hotspot/test/compiler/jvmci/compilerToVM/GetResolvedJavaMethodAtSlotTest.java
index 7fc31de..c863339 100644
--- a/hotspot/test/compiler/jvmci/compilerToVM/GetResolvedJavaMethodAtSlotTest.java
+++ b/hotspot/test/compiler/jvmci/compilerToVM/GetResolvedJavaMethodAtSlotTest.java
@@ -42,9 +42,10 @@
 
 package compiler.jvmci.compilerToVM;
 
-import jdk.vm.ci.hotspot.HotSpotResolvedJavaMethod;
-import jdk.vm.ci.hotspot.CompilerToVMHelper;
 import jdk.test.lib.Asserts;
+import jdk.vm.ci.hotspot.CompilerToVMHelper;
+import jdk.vm.ci.hotspot.HotSpotResolvedJavaMethod;
+
 import java.util.HashMap;
 import java.util.Map;
 
diff --git a/hotspot/test/compiler/jvmci/compilerToVM/GetResolvedJavaMethodTest.java b/hotspot/test/compiler/jvmci/compilerToVM/GetResolvedJavaMethodTest.java
index 8353fc5..a893c71 100644
--- a/hotspot/test/compiler/jvmci/compilerToVM/GetResolvedJavaMethodTest.java
+++ b/hotspot/test/compiler/jvmci/compilerToVM/GetResolvedJavaMethodTest.java
@@ -29,12 +29,12 @@
  * @library ../common/patches
  * @modules java.base/jdk.internal.misc
  * @modules jdk.vm.ci/jdk.vm.ci.hotspot
+ *
  * @build jdk.vm.ci/jdk.vm.ci.hotspot.CompilerToVMHelper
  *        jdk.vm.ci/jdk.vm.ci.hotspot.PublicMetaspaceWrapperObject
  * @build compiler.jvmci.compilerToVM.GetResolvedJavaMethodTest
- * @run main ClassFileInstaller
- *      sun.hotspot.WhiteBox
- *      sun.hotspot.WhiteBox$WhiteBoxPermission
+ * @run driver ClassFileInstaller sun.hotspot.WhiteBox
+ *                                sun.hotspot.WhiteBox$WhiteBoxPermission
  * @run main/othervm -Xbootclasspath/a:.
  *                   -XX:+UnlockDiagnosticVMOptions -XX:+WhiteBoxAPI
  *                   -XX:+UnlockExperimentalVMOptions -XX:+EnableJVMCI
@@ -43,13 +43,13 @@
 
 package compiler.jvmci.compilerToVM;
 
+import jdk.internal.misc.Unsafe;
+import jdk.test.lib.Asserts;
+import jdk.test.lib.Utils;
 import jdk.vm.ci.hotspot.CompilerToVMHelper;
 import jdk.vm.ci.hotspot.HotSpotResolvedJavaMethod;
 import jdk.vm.ci.hotspot.PublicMetaspaceWrapperObject;
-import jdk.test.lib.Asserts;
-import jdk.test.lib.Utils;
 import sun.hotspot.WhiteBox;
-import jdk.internal.misc.Unsafe;
 
 import java.lang.reflect.Field;
 
diff --git a/hotspot/test/compiler/jvmci/compilerToVM/GetResolvedJavaTypeTest.java b/hotspot/test/compiler/jvmci/compilerToVM/GetResolvedJavaTypeTest.java
index 98b3385..2ed3686 100644
--- a/hotspot/test/compiler/jvmci/compilerToVM/GetResolvedJavaTypeTest.java
+++ b/hotspot/test/compiler/jvmci/compilerToVM/GetResolvedJavaTypeTest.java
@@ -24,20 +24,20 @@
 /*
  * @test
  * @bug 8136421
- * @ignore 8158860
  * @requires (vm.simpleArch == "x64" | vm.simpleArch == "sparcv9" | vm.simpleArch == "aarch64")
  * @library / /testlibrary /test/lib
  * @library ../common/patches
  * @modules java.base/jdk.internal.misc
  * @modules jdk.vm.ci/jdk.vm.ci.hotspot
  *          jdk.vm.ci/jdk.vm.ci.meta
+ *
+ * @ignore 8158860
  * @build jdk.vm.ci/jdk.vm.ci.hotspot.CompilerToVMHelper
  *        jdk.vm.ci/jdk.vm.ci.hotspot.PublicMetaspaceWrapperObject
  * @build compiler.jvmci.compilerToVM.GetResolvedJavaTypeTest
  * @build sun.hotspot.WhiteBox
- * @run main ClassFileInstaller
- *      sun.hotspot.WhiteBox
- *      sun.hotspot.WhiteBox$WhiteBoxPermission
+ * @run driver ClassFileInstaller sun.hotspot.WhiteBox
+ *                                sun.hotspot.WhiteBox$WhiteBoxPermission
  * @run main/othervm -Xbootclasspath/a:.
  *                   -XX:+UnlockDiagnosticVMOptions -XX:+WhiteBoxAPI
  *                   -XX:+UnlockExperimentalVMOptions -XX:+EnableJVMCI
@@ -52,16 +52,17 @@
 
 package compiler.jvmci.compilerToVM;
 
-import java.lang.reflect.Field;
-import jdk.vm.ci.meta.ConstantPool;
+import jdk.internal.misc.Unsafe;
+import jdk.test.lib.Asserts;
+import jdk.test.lib.Utils;
 import jdk.vm.ci.hotspot.CompilerToVMHelper;
 import jdk.vm.ci.hotspot.HotSpotResolvedJavaMethod;
 import jdk.vm.ci.hotspot.HotSpotResolvedObjectType;
 import jdk.vm.ci.hotspot.PublicMetaspaceWrapperObject;
-import jdk.test.lib.Asserts;
-import jdk.test.lib.Utils;
+import jdk.vm.ci.meta.ConstantPool;
 import sun.hotspot.WhiteBox;
-import jdk.internal.misc.Unsafe;
+
+import java.lang.reflect.Field;
 
 public class GetResolvedJavaTypeTest {
     private static enum TestCase {
diff --git a/hotspot/test/compiler/jvmci/compilerToVM/GetStackTraceElementTest.java b/hotspot/test/compiler/jvmci/compilerToVM/GetStackTraceElementTest.java
index da0feed..ec4458a 100644
--- a/hotspot/test/compiler/jvmci/compilerToVM/GetStackTraceElementTest.java
+++ b/hotspot/test/compiler/jvmci/compilerToVM/GetStackTraceElementTest.java
@@ -42,17 +42,17 @@
 package compiler.jvmci.compilerToVM;
 
 import compiler.jvmci.common.CTVMUtilities;
+import compiler.jvmci.common.testcases.TestCase;
+import jdk.test.lib.Asserts;
+import jdk.vm.ci.hotspot.CompilerToVMHelper;
+import jdk.vm.ci.hotspot.HotSpotResolvedJavaMethod;
+
 import java.lang.reflect.Executable;
 import java.lang.reflect.Method;
 import java.lang.reflect.Modifier;
 import java.util.HashMap;
 import java.util.Map;
 
-import compiler.jvmci.common.testcases.TestCase;
-import jdk.vm.ci.hotspot.HotSpotResolvedJavaMethod;
-import jdk.vm.ci.hotspot.CompilerToVMHelper;
-import jdk.test.lib.Asserts;
-
 public class GetStackTraceElementTest {
 
     public static void main(String[] args) {
diff --git a/hotspot/test/compiler/jvmci/compilerToVM/GetSymbolTest.java b/hotspot/test/compiler/jvmci/compilerToVM/GetSymbolTest.java
index 69a45d1..78922fa 100644
--- a/hotspot/test/compiler/jvmci/compilerToVM/GetSymbolTest.java
+++ b/hotspot/test/compiler/jvmci/compilerToVM/GetSymbolTest.java
@@ -41,9 +41,13 @@
 
 package compiler.jvmci.compilerToVM;
 
-import jdk.vm.ci.hotspot.CompilerToVMHelper;
 import compiler.jvmci.common.CTVMUtilities;
 import compiler.jvmci.common.testcases.SingleImplementer;
+import jdk.test.lib.Utils;
+import jdk.vm.ci.hotspot.CompilerToVMHelper;
+import jdk.vm.ci.hotspot.HotSpotResolvedJavaMethod;
+import jdk.vm.ci.meta.ConstantPool;
+
 import java.lang.reflect.Field;
 import java.lang.reflect.Member;
 import java.lang.reflect.Method;
@@ -52,9 +56,6 @@
 import java.util.function.Function;
 import java.util.stream.Collectors;
 import java.util.stream.Stream;
-import jdk.vm.ci.hotspot.HotSpotResolvedJavaMethod;
-import jdk.vm.ci.meta.ConstantPool;
-import jdk.test.lib.Utils;
 
 public class GetSymbolTest {
     private static final int CONSTANT_POOL_UTF8_TAG = 1; // see jvms, section 4.4
diff --git a/hotspot/test/compiler/jvmci/compilerToVM/GetVtableIndexForInterfaceTest.java b/hotspot/test/compiler/jvmci/compilerToVM/GetVtableIndexForInterfaceTest.java
index 163f6bd..a8a83d1 100644
--- a/hotspot/test/compiler/jvmci/compilerToVM/GetVtableIndexForInterfaceTest.java
+++ b/hotspot/test/compiler/jvmci/compilerToVM/GetVtableIndexForInterfaceTest.java
@@ -40,7 +40,10 @@
 
 package compiler.jvmci.compilerToVM;
 
+import compiler.jvmci.common.CTVMUtilities;
 import compiler.jvmci.common.testcases.AbstractClass;
+import compiler.jvmci.common.testcases.AnotherSingleImplementer;
+import compiler.jvmci.common.testcases.AnotherSingleImplementerInterface;
 import compiler.jvmci.common.testcases.DoNotExtendClass;
 import compiler.jvmci.common.testcases.MultipleAbstractImplementer;
 import compiler.jvmci.common.testcases.MultipleImplementersInterface;
@@ -49,18 +52,16 @@
 import compiler.jvmci.common.testcases.SingleImplementerInterface;
 import compiler.jvmci.common.testcases.SingleSubclass;
 import compiler.jvmci.common.testcases.SingleSubclassedClass;
-import compiler.jvmci.common.CTVMUtilities;
-import compiler.jvmci.common.testcases.AnotherSingleImplementer;
-import compiler.jvmci.common.testcases.AnotherSingleImplementerInterface;
+import jdk.test.lib.Asserts;
+import jdk.test.lib.Utils;
+import jdk.vm.ci.hotspot.CompilerToVMHelper;
+import jdk.vm.ci.hotspot.HotSpotResolvedJavaMethod;
+import jdk.vm.ci.hotspot.HotSpotResolvedObjectType;
+
 import java.lang.reflect.Method;
 import java.util.HashSet;
 import java.util.Set;
 import java.util.stream.Stream;
-import jdk.vm.ci.hotspot.CompilerToVMHelper;
-import jdk.vm.ci.hotspot.HotSpotResolvedJavaMethod;
-import jdk.vm.ci.hotspot.HotSpotResolvedObjectType;
-import jdk.test.lib.Asserts;
-import jdk.test.lib.Utils;
 
 public class GetVtableIndexForInterfaceTest {
     private static final int INVALID_VTABLE_INDEX = -4; // see method.hpp: VtableIndexFlag
diff --git a/hotspot/test/compiler/jvmci/compilerToVM/HasCompiledCodeForOSRTest.java b/hotspot/test/compiler/jvmci/compilerToVM/HasCompiledCodeForOSRTest.java
index 84acf8c..7349647 100644
--- a/hotspot/test/compiler/jvmci/compilerToVM/HasCompiledCodeForOSRTest.java
+++ b/hotspot/test/compiler/jvmci/compilerToVM/HasCompiledCodeForOSRTest.java
@@ -33,11 +33,12 @@
  *          java.base/jdk.internal.org.objectweb.asm.tree
  *          jdk.vm.ci/jdk.vm.ci.hotspot
  *          jdk.vm.ci/jdk.vm.ci.code
+ *
  * @build jdk.vm.ci/jdk.vm.ci.hotspot.CompilerToVMHelper
  * @build compiler.jvmci.compilerToVM.HasCompiledCodeForOSRTest
  * @build sun.hotspot.WhiteBox
- * @run main ClassFileInstaller sun.hotspot.WhiteBox
- *                              sun.hotspot.WhiteBox$WhiteBoxPermission
+ * @run driver ClassFileInstaller sun.hotspot.WhiteBox
+ *                                sun.hotspot.WhiteBox$WhiteBoxPermission
  * @run main/othervm -Xbootclasspath/a:.
  *                   -XX:+UnlockDiagnosticVMOptions -XX:+WhiteBoxAPI
  *                   -XX:+UnlockExperimentalVMOptions -XX:+EnableJVMCI
@@ -48,18 +49,17 @@
 package compiler.jvmci.compilerToVM;
 
 import compiler.jvmci.common.CTVMUtilities;
+import compiler.testlibrary.CompilerUtils;
+import jdk.test.lib.Asserts;
+import jdk.test.lib.Utils;
+import jdk.vm.ci.hotspot.CompilerToVMHelper;
+import jdk.vm.ci.hotspot.HotSpotResolvedJavaMethod;
+import sun.hotspot.code.NMethod;
 
 import java.lang.reflect.Executable;
 import java.util.ArrayList;
 import java.util.List;
 
-import compiler.testlibrary.CompilerUtils;
-import jdk.vm.ci.hotspot.HotSpotResolvedJavaMethod;
-import jdk.vm.ci.hotspot.CompilerToVMHelper;
-import jdk.test.lib.Asserts;
-import jdk.test.lib.Utils;
-import sun.hotspot.code.NMethod;
-
 public class HasCompiledCodeForOSRTest {
     public static void main(String[] args) {
         List<CompileCodeTestCase> testCases = createTestCases();
diff --git a/hotspot/test/compiler/jvmci/compilerToVM/HasFinalizableSubclassTest.java b/hotspot/test/compiler/jvmci/compilerToVM/HasFinalizableSubclassTest.java
index 2f4e921..dfb0d78 100644
--- a/hotspot/test/compiler/jvmci/compilerToVM/HasFinalizableSubclassTest.java
+++ b/hotspot/test/compiler/jvmci/compilerToVM/HasFinalizableSubclassTest.java
@@ -43,13 +43,14 @@
 import compiler.jvmci.common.testcases.MultipleImplementer1;
 import compiler.jvmci.common.testcases.MultipleImplementersInterface;
 import compiler.jvmci.common.testcases.SingleImplementerInterface;
+import jdk.test.lib.Asserts;
+import jdk.test.lib.Utils;
+import jdk.vm.ci.hotspot.CompilerToVMHelper;
+import jdk.vm.ci.hotspot.HotSpotResolvedObjectType;
+
 import java.util.HashSet;
 import java.util.Set;
 import java.util.stream.Stream;
-import jdk.vm.ci.hotspot.CompilerToVMHelper;
-import jdk.vm.ci.hotspot.HotSpotResolvedObjectType;
-import jdk.test.lib.Asserts;
-import jdk.test.lib.Utils;
 
 public class HasFinalizableSubclassTest {
     public static void main(String args[]) {
diff --git a/hotspot/test/compiler/jvmci/compilerToVM/InitializeConfigurationTest.java b/hotspot/test/compiler/jvmci/compilerToVM/InitializeConfigurationTest.java
index 3a4597d..c4626d2 100644
--- a/hotspot/test/compiler/jvmci/compilerToVM/InitializeConfigurationTest.java
+++ b/hotspot/test/compiler/jvmci/compilerToVM/InitializeConfigurationTest.java
@@ -37,19 +37,10 @@
 
 package compiler.jvmci.compilerToVM;
 
-import java.util.ArrayList;
-import java.util.Iterator;
-import java.util.List;
-import java.util.NoSuchElementException;
-import java.util.Objects;
-import java.util.function.Consumer;
-import jdk.vm.ci.hotspot.CompilerToVMHelper;
+import jdk.test.lib.Asserts;
 import jdk.vm.ci.hotspot.HotSpotJVMCIRuntime;
 import jdk.vm.ci.hotspot.HotSpotVMConfigAccess;
 import jdk.vm.ci.hotspot.HotSpotVMConfigStore;
-import jdk.test.lib.Asserts;
-import jdk.test.lib.Utils;
-import jdk.internal.misc.Unsafe;
 
 public class InitializeConfigurationTest {
     public static void main(String args[]) {
diff --git a/hotspot/test/compiler/jvmci/compilerToVM/InvalidateInstalledCodeTest.java b/hotspot/test/compiler/jvmci/compilerToVM/InvalidateInstalledCodeTest.java
index 881e339..23ff0b9 100644
--- a/hotspot/test/compiler/jvmci/compilerToVM/InvalidateInstalledCodeTest.java
+++ b/hotspot/test/compiler/jvmci/compilerToVM/InvalidateInstalledCodeTest.java
@@ -34,12 +34,13 @@
  *          jdk.vm.ci/jdk.vm.ci.hotspot
  *          jdk.vm.ci/jdk.vm.ci.code
  *          jdk.vm.ci/jdk.vm.ci.runtime
+ *
  * @ignore 8139700
  * @build jdk.vm.ci/jdk.vm.ci.hotspot.CompilerToVMHelper
  * @build compiler.jvmci.compilerToVM.InvalidateInstalledCodeTest
  * @build sun.hotspot.WhiteBox
- * @run main ClassFileInstaller sun.hotspot.WhiteBox
- *                              sun.hotspot.WhiteBox$WhiteBoxPermission
+ * @run driver ClassFileInstaller sun.hotspot.WhiteBox
+ *                                sun.hotspot.WhiteBox$WhiteBoxPermission
  * @run main/othervm -Xbootclasspath/a:.
  *                   -XX:+UnlockDiagnosticVMOptions -XX:+WhiteBoxAPI
  *                   -XX:+UnlockExperimentalVMOptions -XX:+EnableJVMCI
@@ -49,18 +50,18 @@
 package compiler.jvmci.compilerToVM;
 
 import compiler.jvmci.common.CTVMUtilities;
-import jdk.vm.ci.code.InstalledCode;
-import jdk.vm.ci.hotspot.CompilerToVMHelper;
 import jdk.test.lib.Asserts;
 import jdk.test.lib.Utils;
-import sun.hotspot.code.NMethod;
-
-import java.util.List;
 import jdk.vm.ci.code.CodeCacheProvider;
 import jdk.vm.ci.code.CompilationResult;
+import jdk.vm.ci.code.InstalledCode;
+import jdk.vm.ci.hotspot.CompilerToVMHelper;
 import jdk.vm.ci.hotspot.HotSpotCompilationRequest;
 import jdk.vm.ci.hotspot.HotSpotJVMCIRuntime;
 import jdk.vm.ci.hotspot.HotSpotResolvedJavaMethod;
+import sun.hotspot.code.NMethod;
+
+import java.util.List;
 
 public class InvalidateInstalledCodeTest {
     private static final CodeCacheProvider CACHE_PROVIDER
diff --git a/hotspot/test/compiler/jvmci/compilerToVM/IsMatureTest.java b/hotspot/test/compiler/jvmci/compilerToVM/IsMatureTest.java
index a05ee02..1855ca2 100644
--- a/hotspot/test/compiler/jvmci/compilerToVM/IsMatureTest.java
+++ b/hotspot/test/compiler/jvmci/compilerToVM/IsMatureTest.java
@@ -26,14 +26,15 @@
  * @bug 8136421
  * @requires (vm.simpleArch == "x64" | vm.simpleArch == "sparcv9" | vm.simpleArch == "aarch64")
  * @library / /testlibrary /test/lib
- * @library ../common/patches
+ *          ../common/patches
  * @modules java.base/jdk.internal.misc
- * @modules jdk.vm.ci/jdk.vm.ci.hotspot
+ *          jdk.vm.ci/jdk.vm.ci.hotspot
+ *
  * @build jdk.vm.ci/jdk.vm.ci.hotspot.CompilerToVMHelper
- * @build compiler.jvmci.compilerToVM.IsMatureTest
- * @build sun.hotspot.WhiteBox
- * @run main ClassFileInstaller sun.hotspot.WhiteBox
- *                              sun.hotspot.WhiteBox$WhiteBoxPermission
+ *        compiler.jvmci.compilerToVM.IsMatureTest
+ *        sun.hotspot.WhiteBox
+ * @run driver ClassFileInstaller sun.hotspot.WhiteBox
+ *                                sun.hotspot.WhiteBox$WhiteBoxPermission
  * @run main/othervm -Xbootclasspath/a:.
  *                   -XX:+UnlockDiagnosticVMOptions -XX:+WhiteBoxAPI
  *                   -XX:+UnlockExperimentalVMOptions -XX:+EnableJVMCI
@@ -44,16 +45,15 @@
 
 import compiler.jvmci.common.testcases.SimpleClass;
 import compiler.whitebox.CompilerWhiteBoxTest;
-import jdk.vm.ci.hotspot.CompilerToVMHelper;
 import jdk.test.lib.Asserts;
+import jdk.test.lib.Platform;
+import jdk.vm.ci.hotspot.CompilerToVMHelper;
 import sun.hotspot.WhiteBox;
 
 import java.lang.reflect.Executable;
 
 public class IsMatureTest {
     private static final WhiteBox WB = WhiteBox.getWhiteBox();
-    private static final boolean IS_XCOMP
-            = System.getProperty("java.vm.info").contains("compiled mode");
     private static final boolean TIERED
             = WB.getBooleanVMFlag("TieredCompilation");
 
@@ -82,7 +82,7 @@
                     "Multiple times invoked method should have method data");
             /* a method is not mature in Xcomp mode with tiered compilation disabled,
                see NonTieredCompPolicy::is_mature */
-            Asserts.assertEQ(isMature, !(IS_XCOMP && !TIERED),
+            Asserts.assertEQ(isMature, !(Platform.isComp() && !TIERED),
                     "Unexpected isMature state for multiple times invoked method");
         }
     }
diff --git a/hotspot/test/compiler/jvmci/compilerToVM/JVM_RegisterJVMCINatives.java b/hotspot/test/compiler/jvmci/compilerToVM/JVM_RegisterJVMCINatives.java
index 61405cb..ef32f13 100644
--- a/hotspot/test/compiler/jvmci/compilerToVM/JVM_RegisterJVMCINatives.java
+++ b/hotspot/test/compiler/jvmci/compilerToVM/JVM_RegisterJVMCINatives.java
@@ -43,8 +43,8 @@
 
 package compiler.jvmci.compilerToVM;
 
-import jdk.vm.ci.runtime.JVMCI;
 import jdk.test.lib.Asserts;
+import jdk.vm.ci.runtime.JVMCI;
 
 import java.lang.reflect.Method;
 
diff --git a/hotspot/test/compiler/jvmci/compilerToVM/LookupKlassInPoolTest.java b/hotspot/test/compiler/jvmci/compilerToVM/LookupKlassInPoolTest.java
index e7db5ed..f036f0e 100644
--- a/hotspot/test/compiler/jvmci/compilerToVM/LookupKlassInPoolTest.java
+++ b/hotspot/test/compiler/jvmci/compilerToVM/LookupKlassInPoolTest.java
@@ -36,11 +36,12 @@
  *          jdk.vm.ci/jdk.vm.ci.hotspot
  *          jdk.vm.ci/jdk.vm.ci.runtime
  *          jdk.vm.ci/jdk.vm.ci.meta
+ *
  * @build jdk.vm.ci/jdk.vm.ci.hotspot.CompilerToVMHelper
  * @build sun.hotspot.WhiteBox
  *        compiler.jvmci.compilerToVM.LookupKlassInPoolTest
- * @run main ClassFileInstaller sun.hotspot.WhiteBox
- *                              sun.hotspot.WhiteBox$WhiteBoxPermission
+ * @run driver ClassFileInstaller sun.hotspot.WhiteBox
+ *                                sun.hotspot.WhiteBox$WhiteBoxPermission
  * @run main/othervm -Xbootclasspath/a:.
  *                   -XX:+UnlockExperimentalVMOptions -XX:+EnableJVMCI
  *                   -XX:+UnlockDiagnosticVMOptions -XX:+WhiteBoxAPI
@@ -49,17 +50,19 @@
 
 package compiler.jvmci.compilerToVM;
 
-import compiler.jvmci.compilerToVM.ConstantPoolTestsHelper.DummyClasses;
 import compiler.jvmci.compilerToVM.ConstantPoolTestCase.ConstantTypes;
-import static compiler.jvmci.compilerToVM.ConstantPoolTestCase.ConstantTypes.*;
 import compiler.jvmci.compilerToVM.ConstantPoolTestCase.TestedCPEntry;
 import compiler.jvmci.compilerToVM.ConstantPoolTestCase.Validator;
-import java.util.HashMap;
-import java.util.Map;
+import compiler.jvmci.compilerToVM.ConstantPoolTestsHelper.DummyClasses;
 import jdk.vm.ci.hotspot.CompilerToVMHelper;
 import jdk.vm.ci.hotspot.HotSpotResolvedObjectType;
 import jdk.vm.ci.meta.ConstantPool;
 
+import java.util.HashMap;
+import java.util.Map;
+
+import static compiler.jvmci.compilerToVM.ConstantPoolTestCase.ConstantTypes.CONSTANT_CLASS;
+
 /**
  * Test for {@code jdk.vm.ci.hotspot.CompilerToVM.lookupKlassInPool} method
  */
diff --git a/hotspot/test/compiler/jvmci/compilerToVM/LookupKlassRefIndexInPoolTest.java b/hotspot/test/compiler/jvmci/compilerToVM/LookupKlassRefIndexInPoolTest.java
index 284a3e3..6e17296 100644
--- a/hotspot/test/compiler/jvmci/compilerToVM/LookupKlassRefIndexInPoolTest.java
+++ b/hotspot/test/compiler/jvmci/compilerToVM/LookupKlassRefIndexInPoolTest.java
@@ -35,11 +35,12 @@
  *          jdk.vm.ci/jdk.vm.ci.hotspot
  *          jdk.vm.ci/jdk.vm.ci.runtime
  *          jdk.vm.ci/jdk.vm.ci.meta
+ *
  * @build jdk.vm.ci/jdk.vm.ci.hotspot.CompilerToVMHelper
  * @build sun.hotspot.WhiteBox
  *        compiler.jvmci.compilerToVM.LookupKlassRefIndexInPoolTest
- * @run main ClassFileInstaller sun.hotspot.WhiteBox
- *                              sun.hotspot.WhiteBox$WhiteBoxPermission
+ * @run driver ClassFileInstaller sun.hotspot.WhiteBox
+ *                                sun.hotspot.WhiteBox$WhiteBoxPermission
  * @run main/othervm -Xbootclasspath/a:. -XX:+UnlockDiagnosticVMOptions
  *                   -XX:+WhiteBoxAPI -XX:+UnlockExperimentalVMOptions -XX:+EnableJVMCI
  *                   compiler.jvmci.compilerToVM.LookupKlassRefIndexInPoolTest
@@ -47,17 +48,21 @@
 
 package compiler.jvmci.compilerToVM;
 
-import compiler.jvmci.compilerToVM.ConstantPoolTestsHelper.DummyClasses;
 import compiler.jvmci.compilerToVM.ConstantPoolTestCase.ConstantTypes;
-import static compiler.jvmci.compilerToVM.ConstantPoolTestCase.ConstantTypes.*;
 import compiler.jvmci.compilerToVM.ConstantPoolTestCase.TestedCPEntry;
 import compiler.jvmci.compilerToVM.ConstantPoolTestCase.Validator;
-import java.util.HashMap;
-import java.util.Map;
+import compiler.jvmci.compilerToVM.ConstantPoolTestsHelper.DummyClasses;
 import jdk.test.lib.Asserts;
 import jdk.vm.ci.hotspot.CompilerToVMHelper;
 import jdk.vm.ci.meta.ConstantPool;
 
+import java.util.HashMap;
+import java.util.Map;
+
+import static compiler.jvmci.compilerToVM.ConstantPoolTestCase.ConstantTypes.CONSTANT_FIELDREF;
+import static compiler.jvmci.compilerToVM.ConstantPoolTestCase.ConstantTypes.CONSTANT_INTERFACEMETHODREF;
+import static compiler.jvmci.compilerToVM.ConstantPoolTestCase.ConstantTypes.CONSTANT_METHODREF;
+
 /**
  * Test for {@code jdk.vm.ci.hotspot.CompilerToVM.lookupKlassRefIndexInPool} method
  */
diff --git a/hotspot/test/compiler/jvmci/compilerToVM/LookupMethodInPoolTest.java b/hotspot/test/compiler/jvmci/compilerToVM/LookupMethodInPoolTest.java
index 6659178..4b4c498 100644
--- a/hotspot/test/compiler/jvmci/compilerToVM/LookupMethodInPoolTest.java
+++ b/hotspot/test/compiler/jvmci/compilerToVM/LookupMethodInPoolTest.java
@@ -35,11 +35,12 @@
  *          jdk.vm.ci/jdk.vm.ci.hotspot
  *          jdk.vm.ci/jdk.vm.ci.meta
  *          jdk.vm.ci/jdk.vm.ci.runtime
+ *
  * @build jdk.vm.ci/jdk.vm.ci.hotspot.CompilerToVMHelper
  * @build sun.hotspot.WhiteBox
  *        compiler.jvmci.compilerToVM.LookupMethodInPoolTest
- * @run main ClassFileInstaller sun.hotspot.WhiteBox
- *                              sun.hotspot.WhiteBox$WhiteBoxPermission
+ * @run driver ClassFileInstaller sun.hotspot.WhiteBox
+ *                                sun.hotspot.WhiteBox$WhiteBoxPermission
  * @run main/othervm -Xbootclasspath/a:. -XX:+UnlockDiagnosticVMOptions
  *                   -XX:+WhiteBoxAPI -XX:+UnlockExperimentalVMOptions -XX:+EnableJVMCI
  *                   compiler.jvmci.compilerToVM.LookupMethodInPoolTest
@@ -47,18 +48,21 @@
 
 package compiler.jvmci.compilerToVM;
 
-import compiler.jvmci.compilerToVM.ConstantPoolTestsHelper.DummyClasses;
 import compiler.jvmci.compilerToVM.ConstantPoolTestCase.ConstantTypes;
-import static compiler.jvmci.compilerToVM.ConstantPoolTestCase.ConstantTypes.*;
 import compiler.jvmci.compilerToVM.ConstantPoolTestCase.TestedCPEntry;
 import compiler.jvmci.compilerToVM.ConstantPoolTestCase.Validator;
-import java.util.HashMap;
-import java.util.Map;
+import compiler.jvmci.compilerToVM.ConstantPoolTestsHelper.DummyClasses;
 import jdk.test.lib.Asserts;
 import jdk.vm.ci.hotspot.CompilerToVMHelper;
 import jdk.vm.ci.hotspot.HotSpotResolvedJavaMethod;
 import jdk.vm.ci.meta.ConstantPool;
 
+import java.util.HashMap;
+import java.util.Map;
+
+import static compiler.jvmci.compilerToVM.ConstantPoolTestCase.ConstantTypes.CONSTANT_INTERFACEMETHODREF;
+import static compiler.jvmci.compilerToVM.ConstantPoolTestCase.ConstantTypes.CONSTANT_METHODREF;
+
 /**
  * Test for {@code jdk.vm.ci.hotspot.CompilerToVM.lookupMethodInPool} method
  */
diff --git a/hotspot/test/compiler/jvmci/compilerToVM/LookupNameAndTypeRefIndexInPoolTest.java b/hotspot/test/compiler/jvmci/compilerToVM/LookupNameAndTypeRefIndexInPoolTest.java
index 52405b0..88cc694 100644
--- a/hotspot/test/compiler/jvmci/compilerToVM/LookupNameAndTypeRefIndexInPoolTest.java
+++ b/hotspot/test/compiler/jvmci/compilerToVM/LookupNameAndTypeRefIndexInPoolTest.java
@@ -35,11 +35,12 @@
  *          jdk.vm.ci/jdk.vm.ci.hotspot
  *          jdk.vm.ci/jdk.vm.ci.runtime
  *          jdk.vm.ci/jdk.vm.ci.meta
+ *
  * @build jdk.vm.ci/jdk.vm.ci.hotspot.CompilerToVMHelper
  * @build sun.hotspot.WhiteBox
  *        compiler.jvmci.compilerToVM.LookupNameAndTypeRefIndexInPoolTest
- * @run main ClassFileInstaller sun.hotspot.WhiteBox
- *                              sun.hotspot.WhiteBox$WhiteBoxPermission
+ * @run driver ClassFileInstaller sun.hotspot.WhiteBox
+ *                                sun.hotspot.WhiteBox$WhiteBoxPermission
  * @run main/othervm -Xbootclasspath/a:. -XX:+UnlockDiagnosticVMOptions
  *                   -XX:+WhiteBoxAPI -XX:+UnlockExperimentalVMOptions -XX:+EnableJVMCI
  *                   compiler.jvmci.compilerToVM.LookupNameAndTypeRefIndexInPoolTest
@@ -47,17 +48,22 @@
 
 package compiler.jvmci.compilerToVM;
 
-import compiler.jvmci.compilerToVM.ConstantPoolTestsHelper.DummyClasses;
 import compiler.jvmci.compilerToVM.ConstantPoolTestCase.ConstantTypes;
-import static compiler.jvmci.compilerToVM.ConstantPoolTestCase.ConstantTypes.*;
 import compiler.jvmci.compilerToVM.ConstantPoolTestCase.TestedCPEntry;
 import compiler.jvmci.compilerToVM.ConstantPoolTestCase.Validator;
-import java.util.HashMap;
-import java.util.Map;
+import compiler.jvmci.compilerToVM.ConstantPoolTestsHelper.DummyClasses;
 import jdk.test.lib.Asserts;
 import jdk.vm.ci.hotspot.CompilerToVMHelper;
 import jdk.vm.ci.meta.ConstantPool;
 
+import java.util.HashMap;
+import java.util.Map;
+
+import static compiler.jvmci.compilerToVM.ConstantPoolTestCase.ConstantTypes.CONSTANT_FIELDREF;
+import static compiler.jvmci.compilerToVM.ConstantPoolTestCase.ConstantTypes.CONSTANT_INTERFACEMETHODREF;
+import static compiler.jvmci.compilerToVM.ConstantPoolTestCase.ConstantTypes.CONSTANT_INVOKEDYNAMIC;
+import static compiler.jvmci.compilerToVM.ConstantPoolTestCase.ConstantTypes.CONSTANT_METHODREF;
+
 /**
  * Test for {@code jdk.vm.ci.hotspot.CompilerToVM.lookupNameAndTypeRefIndexInPool} method
  */
diff --git a/hotspot/test/compiler/jvmci/compilerToVM/LookupNameInPoolTest.java b/hotspot/test/compiler/jvmci/compilerToVM/LookupNameInPoolTest.java
index 96d05f5..a43a453 100644
--- a/hotspot/test/compiler/jvmci/compilerToVM/LookupNameInPoolTest.java
+++ b/hotspot/test/compiler/jvmci/compilerToVM/LookupNameInPoolTest.java
@@ -35,11 +35,12 @@
  *          jdk.vm.ci/jdk.vm.ci.hotspot
  *          jdk.vm.ci/jdk.vm.ci.runtime
  *          jdk.vm.ci/jdk.vm.ci.meta
+ *
  * @build jdk.vm.ci/jdk.vm.ci.hotspot.CompilerToVMHelper
  * @build sun.hotspot.WhiteBox
  *        compiler.jvmci.compilerToVM.LookupNameInPoolTest
- * @run main ClassFileInstaller sun.hotspot.WhiteBox
- *                              sun.hotspot.WhiteBox$WhiteBoxPermission
+ * @run driver ClassFileInstaller sun.hotspot.WhiteBox
+ *                                sun.hotspot.WhiteBox$WhiteBoxPermission
  * @run main/othervm -Xbootclasspath/a:. -XX:+UnlockDiagnosticVMOptions
  *                   -XX:+WhiteBoxAPI -XX:+UnlockExperimentalVMOptions -XX:+EnableJVMCI
  *                   compiler.jvmci.compilerToVM.LookupNameInPoolTest
@@ -47,16 +48,21 @@
 
 package compiler.jvmci.compilerToVM;
 
-import compiler.jvmci.compilerToVM.ConstantPoolTestsHelper.DummyClasses;
 import compiler.jvmci.compilerToVM.ConstantPoolTestCase.ConstantTypes;
-import static compiler.jvmci.compilerToVM.ConstantPoolTestCase.ConstantTypes.*;
 import compiler.jvmci.compilerToVM.ConstantPoolTestCase.TestedCPEntry;
 import compiler.jvmci.compilerToVM.ConstantPoolTestCase.Validator;
-import java.util.HashMap;
-import java.util.Map;
+import compiler.jvmci.compilerToVM.ConstantPoolTestsHelper.DummyClasses;
+import jdk.test.lib.Asserts;
 import jdk.vm.ci.hotspot.CompilerToVMHelper;
 import jdk.vm.ci.meta.ConstantPool;
-import jdk.test.lib.Asserts;
+
+import java.util.HashMap;
+import java.util.Map;
+
+import static compiler.jvmci.compilerToVM.ConstantPoolTestCase.ConstantTypes.CONSTANT_FIELDREF;
+import static compiler.jvmci.compilerToVM.ConstantPoolTestCase.ConstantTypes.CONSTANT_INTERFACEMETHODREF;
+import static compiler.jvmci.compilerToVM.ConstantPoolTestCase.ConstantTypes.CONSTANT_INVOKEDYNAMIC;
+import static compiler.jvmci.compilerToVM.ConstantPoolTestCase.ConstantTypes.CONSTANT_METHODREF;
 
 /**
  * Test for {@code jdk.vm.ci.hotspot.CompilerToVM.lookupNameInPool} method
diff --git a/hotspot/test/compiler/jvmci/compilerToVM/LookupSignatureInPoolTest.java b/hotspot/test/compiler/jvmci/compilerToVM/LookupSignatureInPoolTest.java
index 4f67c5a..d5afc82 100644
--- a/hotspot/test/compiler/jvmci/compilerToVM/LookupSignatureInPoolTest.java
+++ b/hotspot/test/compiler/jvmci/compilerToVM/LookupSignatureInPoolTest.java
@@ -35,11 +35,12 @@
  *          jdk.vm.ci/jdk.vm.ci.hotspot
  *          jdk.vm.ci/jdk.vm.ci.runtime
  *          jdk.vm.ci/jdk.vm.ci.meta
+ *
  * @build jdk.vm.ci/jdk.vm.ci.hotspot.CompilerToVMHelper
  * @build sun.hotspot.WhiteBox
  *        compiler.jvmci.compilerToVM.LookupSignatureInPoolTest
- * @run main ClassFileInstaller sun.hotspot.WhiteBox
- *                              sun.hotspot.WhiteBox$WhiteBoxPermission
+ * @run driver ClassFileInstaller sun.hotspot.WhiteBox
+ *                                sun.hotspot.WhiteBox$WhiteBoxPermission
  * @run main/othervm -Xbootclasspath/a:. -XX:+UnlockDiagnosticVMOptions
  *                   -XX:+WhiteBoxAPI -XX:+UnlockExperimentalVMOptions -XX:+EnableJVMCI
  *                   compiler.jvmci.compilerToVM.LookupSignatureInPoolTest
@@ -47,17 +48,22 @@
 
 package compiler.jvmci.compilerToVM;
 
-import compiler.jvmci.compilerToVM.ConstantPoolTestsHelper.DummyClasses;
 import compiler.jvmci.compilerToVM.ConstantPoolTestCase.ConstantTypes;
-import static compiler.jvmci.compilerToVM.ConstantPoolTestCase.ConstantTypes.*;
 import compiler.jvmci.compilerToVM.ConstantPoolTestCase.TestedCPEntry;
 import compiler.jvmci.compilerToVM.ConstantPoolTestCase.Validator;
-import java.util.HashMap;
-import java.util.Map;
+import compiler.jvmci.compilerToVM.ConstantPoolTestsHelper.DummyClasses;
 import jdk.test.lib.Asserts;
 import jdk.vm.ci.hotspot.CompilerToVMHelper;
 import jdk.vm.ci.meta.ConstantPool;
 
+import java.util.HashMap;
+import java.util.Map;
+
+import static compiler.jvmci.compilerToVM.ConstantPoolTestCase.ConstantTypes.CONSTANT_FIELDREF;
+import static compiler.jvmci.compilerToVM.ConstantPoolTestCase.ConstantTypes.CONSTANT_INTERFACEMETHODREF;
+import static compiler.jvmci.compilerToVM.ConstantPoolTestCase.ConstantTypes.CONSTANT_INVOKEDYNAMIC;
+import static compiler.jvmci.compilerToVM.ConstantPoolTestCase.ConstantTypes.CONSTANT_METHODREF;
+
 /**
  * Test for {@code jdk.vm.ci.hotspot.CompilerToVM.lookupSignatureInPool} method
  */
diff --git a/hotspot/test/compiler/jvmci/compilerToVM/LookupTypeTest.java b/hotspot/test/compiler/jvmci/compilerToVM/LookupTypeTest.java
index 22fa694..437b561 100644
--- a/hotspot/test/compiler/jvmci/compilerToVM/LookupTypeTest.java
+++ b/hotspot/test/compiler/jvmci/compilerToVM/LookupTypeTest.java
@@ -40,12 +40,13 @@
 import compiler.jvmci.common.testcases.DoNotExtendClass;
 import compiler.jvmci.common.testcases.MultiSubclassedClass;
 import compiler.jvmci.common.testcases.SingleSubclass;
-import java.util.HashSet;
-import java.util.Set;
-import jdk.vm.ci.hotspot.CompilerToVMHelper;
-import jdk.vm.ci.hotspot.HotSpotResolvedObjectType;
 import jdk.test.lib.Asserts;
 import jdk.test.lib.Utils;
+import jdk.vm.ci.hotspot.CompilerToVMHelper;
+import jdk.vm.ci.hotspot.HotSpotResolvedObjectType;
+
+import java.util.HashSet;
+import java.util.Set;
 
 public class LookupTypeTest {
     public static void main(String args[]) {
diff --git a/hotspot/test/compiler/jvmci/compilerToVM/MaterializeVirtualObjectTest.java b/hotspot/test/compiler/jvmci/compilerToVM/MaterializeVirtualObjectTest.java
index 9ffd281..7607d39 100644
--- a/hotspot/test/compiler/jvmci/compilerToVM/MaterializeVirtualObjectTest.java
+++ b/hotspot/test/compiler/jvmci/compilerToVM/MaterializeVirtualObjectTest.java
@@ -25,6 +25,8 @@
  * @test
  * @bug 8136421
  * @requires (vm.simpleArch == "x64" | vm.simpleArch == "sparcv9" | vm.simpleArch == "aarch64")
+ *         & (vm.compMode != "Xcomp" | vm.opt.TieredCompilation == null | vm.opt.TieredCompilation == true)
+ * @summary no "-Xcomp -XX:-TieredCompilation" combination allowed until JDK-8140018 is resolved
  * @library / /testlibrary /test/lib
  * @library ../common/patches
  * @modules java.base/jdk.internal.misc
@@ -33,16 +35,17 @@
  *          jdk.vm.ci/jdk.vm.ci.hotspot
  *          jdk.vm.ci/jdk.vm.ci.code
  *          jdk.vm.ci/jdk.vm.ci.meta
+ *
  * @build jdk.vm.ci/jdk.vm.ci.hotspot.CompilerToVMHelper
  * @build compiler.jvmci.compilerToVM.MaterializeVirtualObjectTest
  * @build sun.hotspot.WhiteBox
- * @run main ClassFileInstaller sun.hotspot.WhiteBox
- *                              sun.hotspot.WhiteBox$WhiteBoxPermission
+ * @run driver ClassFileInstaller sun.hotspot.WhiteBox
+ *                                sun.hotspot.WhiteBox$WhiteBoxPermission
  * @run main/othervm -Xmixed -Xbootclasspath/a:.
  *                   -XX:+UnlockDiagnosticVMOptions -XX:+WhiteBoxAPI
  *                   -XX:+UnlockExperimentalVMOptions -XX:+EnableJVMCI
  *                   -XX:CompileCommand=exclude,*::check
- *                   -XX:+DoEscapeAnalysis
+ *                   -XX:+DoEscapeAnalysis -XX:-UseCounterDecay
  *                   -Xbatch
  *                   -Dcompiler.jvmci.compilerToVM.MaterializeVirtualObjectTest.invalidate=false
  *                   compiler.jvmci.compilerToVM.MaterializeVirtualObjectTest
@@ -50,7 +53,7 @@
  *                   -XX:+UnlockDiagnosticVMOptions -XX:+WhiteBoxAPI
  *                   -XX:+UnlockExperimentalVMOptions -XX:+EnableJVMCI
  *                   -XX:CompileCommand=exclude,*::check
- *                   -XX:+DoEscapeAnalysis
+ *                   -XX:+DoEscapeAnalysis -XX:-UseCounterDecay
  *                   -Xbatch
  *                   -Dcompiler.jvmci.compilerToVM.MaterializeVirtualObjectTest.invalidate=true
  *                   compiler.jvmci.compilerToVM.MaterializeVirtualObjectTest
@@ -58,18 +61,17 @@
 
 package compiler.jvmci.compilerToVM;
 
-import java.lang.reflect.Method;
-import jdk.vm.ci.hotspot.HotSpotStackFrameReference;
-import jdk.vm.ci.meta.ResolvedJavaMethod;
-import jdk.vm.ci.hotspot.CompilerToVMHelper;
-import jdk.test.lib.Asserts;
-
 import compiler.jvmci.common.CTVMUtilities;
 import compiler.testlibrary.CompilerUtils;
 import compiler.whitebox.CompilerWhiteBoxTest;
-
+import jdk.test.lib.Asserts;
+import jdk.vm.ci.hotspot.CompilerToVMHelper;
+import jdk.vm.ci.hotspot.HotSpotStackFrameReference;
+import jdk.vm.ci.meta.ResolvedJavaMethod;
 import sun.hotspot.WhiteBox;
 
+import java.lang.reflect.Method;
+
 public class MaterializeVirtualObjectTest {
     private static final WhiteBox WB;
     private static final Method METHOD;
diff --git a/hotspot/test/compiler/jvmci/compilerToVM/MethodIsIgnoredBySecurityStackWalkTest.java b/hotspot/test/compiler/jvmci/compilerToVM/MethodIsIgnoredBySecurityStackWalkTest.java
index cf244d1..e732faa 100644
--- a/hotspot/test/compiler/jvmci/compilerToVM/MethodIsIgnoredBySecurityStackWalkTest.java
+++ b/hotspot/test/compiler/jvmci/compilerToVM/MethodIsIgnoredBySecurityStackWalkTest.java
@@ -43,13 +43,14 @@
 package compiler.jvmci.compilerToVM;
 
 import compiler.jvmci.common.CTVMUtilities;
-import java.lang.reflect.Method;
+import jdk.test.lib.Asserts;
+import jdk.vm.ci.hotspot.CompilerToVMHelper;
+import jdk.vm.ci.hotspot.HotSpotResolvedJavaMethod;
+
 import java.lang.reflect.Executable;
+import java.lang.reflect.Method;
 import java.util.HashMap;
 import java.util.Map;
-import jdk.vm.ci.hotspot.HotSpotResolvedJavaMethod;
-import jdk.vm.ci.hotspot.CompilerToVMHelper;
-import jdk.test.lib.Asserts;
 
 public class MethodIsIgnoredBySecurityStackWalkTest {
 
diff --git a/hotspot/test/compiler/jvmci/compilerToVM/ReprofileTest.java b/hotspot/test/compiler/jvmci/compilerToVM/ReprofileTest.java
index 169dcf7..d9aa0b1 100644
--- a/hotspot/test/compiler/jvmci/compilerToVM/ReprofileTest.java
+++ b/hotspot/test/compiler/jvmci/compilerToVM/ReprofileTest.java
@@ -25,7 +25,7 @@
 /**
  * @test
  * @bug 8136421
- * @requires (vm.simpleArch == "x64" | vm.simpleArch == "sparcv9" | vm.simpleArch == "aarch64")
+ * @requires (vm.simpleArch == "x64" | vm.simpleArch == "sparcv9" | vm.simpleArch == "aarch64") & (vm.opt.TieredStopAtLevel == null | vm.opt.TieredStopAtLevel == 3)
  * @library /testlibrary /test/lib /
  * @library ../common/patches
  * @modules java.base/jdk.internal.misc
@@ -34,33 +34,32 @@
  *          jdk.vm.ci/jdk.vm.ci.hotspot
  *          jdk.vm.ci/jdk.vm.ci.code
  *          jdk.vm.ci/jdk.vm.ci.meta
- * @ignore 8157861
+ *
  * @build jdk.vm.ci/jdk.vm.ci.hotspot.CompilerToVMHelper
  * @build sun.hotspot.WhiteBox
  * @build compiler.jvmci.compilerToVM.ReprofileTest
- * @run main ClassFileInstaller
- *      sun.hotspot.WhiteBox
- *      sun.hotspot.WhiteBox$WhiteBoxPermission
+ * @run driver ClassFileInstaller sun.hotspot.WhiteBox
+ *                                sun.hotspot.WhiteBox$WhiteBoxPermission
  * @run main/othervm -Xbootclasspath/a:.
  *                   -XX:+UnlockDiagnosticVMOptions -XX:+WhiteBoxAPI
  *                   -XX:+UnlockExperimentalVMOptions -XX:+EnableJVMCI
- *                   -Xmixed
+ *                   -Xmixed -Xbatch
  *                   compiler.jvmci.compilerToVM.ReprofileTest
  */
 
 package compiler.jvmci.compilerToVM;
 
 import compiler.jvmci.common.CTVMUtilities;
+import compiler.whitebox.CompilerWhiteBoxTest;
+import jdk.test.lib.Asserts;
+import jdk.vm.ci.hotspot.CompilerToVMHelper;
+import jdk.vm.ci.hotspot.HotSpotResolvedJavaMethod;
+import jdk.vm.ci.meta.ProfilingInfo;
+
 import java.lang.reflect.Method;
 import java.util.ArrayList;
 import java.util.List;
 
-import compiler.whitebox.CompilerWhiteBoxTest;
-import jdk.vm.ci.hotspot.HotSpotResolvedJavaMethod;
-import jdk.vm.ci.hotspot.CompilerToVMHelper;
-import jdk.vm.ci.meta.ProfilingInfo;
-import jdk.test.lib.Asserts;
-
 public class ReprofileTest {
 
     public static void main(String[] args) {
diff --git a/hotspot/test/compiler/jvmci/compilerToVM/ResolveConstantInPoolTest.java b/hotspot/test/compiler/jvmci/compilerToVM/ResolveConstantInPoolTest.java
index 1e86d3e..ba23d6a 100644
--- a/hotspot/test/compiler/jvmci/compilerToVM/ResolveConstantInPoolTest.java
+++ b/hotspot/test/compiler/jvmci/compilerToVM/ResolveConstantInPoolTest.java
@@ -34,11 +34,12 @@
  *          jdk.vm.ci/jdk.vm.ci.hotspot
  *          jdk.vm.ci/jdk.vm.ci.runtime
  *          jdk.vm.ci/jdk.vm.ci.meta
+ *
  * @build jdk.vm.ci/jdk.vm.ci.hotspot.CompilerToVMHelper
  * @build sun.hotspot.WhiteBox
  *        compiler.jvmci.compilerToVM.ResolveConstantInPoolTest
- * @run main ClassFileInstaller sun.hotspot.WhiteBox
- *                              sun.hotspot.WhiteBox$WhiteBoxPermission
+ * @run driver ClassFileInstaller sun.hotspot.WhiteBox
+ *                                sun.hotspot.WhiteBox$WhiteBoxPermission
  * @run main/othervm -Xbootclasspath/a:.
  *                   -XX:+UnlockExperimentalVMOptions -XX:+EnableJVMCI
  *                   -XX:+UnlockDiagnosticVMOptions -XX:+WhiteBoxAPI
@@ -47,17 +48,20 @@
 
 package compiler.jvmci.compilerToVM;
 
-import compiler.jvmci.compilerToVM.ConstantPoolTestsHelper.DummyClasses;
 import compiler.jvmci.compilerToVM.ConstantPoolTestCase.ConstantTypes;
-import static compiler.jvmci.compilerToVM.ConstantPoolTestCase.ConstantTypes.*;
 import compiler.jvmci.compilerToVM.ConstantPoolTestCase.Validator;
+import compiler.jvmci.compilerToVM.ConstantPoolTestsHelper.DummyClasses;
+import jdk.test.lib.Asserts;
+import jdk.vm.ci.hotspot.CompilerToVMHelper;
+import jdk.vm.ci.meta.ConstantPool;
+
 import java.lang.invoke.MethodHandle;
 import java.lang.invoke.MethodType;
 import java.util.HashMap;
 import java.util.Map;
-import jdk.test.lib.Asserts;
-import jdk.vm.ci.hotspot.CompilerToVMHelper;
-import jdk.vm.ci.meta.ConstantPool;
+
+import static compiler.jvmci.compilerToVM.ConstantPoolTestCase.ConstantTypes.CONSTANT_METHODHANDLE;
+import static compiler.jvmci.compilerToVM.ConstantPoolTestCase.ConstantTypes.CONSTANT_METHODTYPE;
 
 /**
  * Test for {@code jdk.vm.ci.hotspot.CompilerToVM.resolveConstantInPool} method
diff --git a/hotspot/test/compiler/jvmci/compilerToVM/ResolveFieldInPoolTest.java b/hotspot/test/compiler/jvmci/compilerToVM/ResolveFieldInPoolTest.java
index 62a1427..6d60354 100644
--- a/hotspot/test/compiler/jvmci/compilerToVM/ResolveFieldInPoolTest.java
+++ b/hotspot/test/compiler/jvmci/compilerToVM/ResolveFieldInPoolTest.java
@@ -35,11 +35,12 @@
  *          jdk.vm.ci/jdk.vm.ci.hotspot
  *          jdk.vm.ci/jdk.vm.ci.meta
  *          jdk.vm.ci/jdk.vm.ci.runtime
+ *
  * @build jdk.vm.ci/jdk.vm.ci.hotspot.CompilerToVMHelper
  * @build sun.hotspot.WhiteBox
  *        compiler.jvmci.compilerToVM.ResolveFieldInPoolTest
- * @run main ClassFileInstaller sun.hotspot.WhiteBox
- *                              sun.hotspot.WhiteBox$WhiteBoxPermission
+ * @run driver ClassFileInstaller sun.hotspot.WhiteBox
+ *                                sun.hotspot.WhiteBox$WhiteBoxPermission
  * @run main/othervm -Xbootclasspath/a:. -XX:+UnlockDiagnosticVMOptions
  *                   -XX:+WhiteBoxAPI -XX:+UnlockExperimentalVMOptions -XX:+EnableJVMCI
  *                   compiler.jvmci.compilerToVM.ResolveFieldInPoolTest
@@ -47,21 +48,23 @@
 
 package compiler.jvmci.compilerToVM;
 
-import compiler.jvmci.compilerToVM.ConstantPoolTestsHelper.DummyClasses;
 import compiler.jvmci.compilerToVM.ConstantPoolTestCase.ConstantTypes;
-import static compiler.jvmci.compilerToVM.ConstantPoolTestCase.ConstantTypes.*;
 import compiler.jvmci.compilerToVM.ConstantPoolTestCase.TestedCPEntry;
 import compiler.jvmci.compilerToVM.ConstantPoolTestCase.Validator;
-import java.lang.reflect.Field;
-import java.util.HashMap;
-import java.util.Map;
+import compiler.jvmci.compilerToVM.ConstantPoolTestsHelper.DummyClasses;
+import jdk.internal.misc.Unsafe;
 import jdk.internal.org.objectweb.asm.Opcodes;
+import jdk.test.lib.Asserts;
+import jdk.test.lib.Utils;
 import jdk.vm.ci.hotspot.CompilerToVMHelper;
 import jdk.vm.ci.hotspot.HotSpotResolvedObjectType;
 import jdk.vm.ci.meta.ConstantPool;
-import jdk.test.lib.Asserts;
-import jdk.test.lib.Utils;
-import jdk.internal.misc.Unsafe;
+
+import java.lang.reflect.Field;
+import java.util.HashMap;
+import java.util.Map;
+
+import static compiler.jvmci.compilerToVM.ConstantPoolTestCase.ConstantTypes.CONSTANT_FIELDREF;
 
 /**
  * Test for {@code jdk.vm.ci.hotspot.CompilerToVM.resolveFieldInPool} method
diff --git a/hotspot/test/compiler/jvmci/compilerToVM/ResolveMethodTest.java b/hotspot/test/compiler/jvmci/compilerToVM/ResolveMethodTest.java
index 4ac3c87..389f558 100644
--- a/hotspot/test/compiler/jvmci/compilerToVM/ResolveMethodTest.java
+++ b/hotspot/test/compiler/jvmci/compilerToVM/ResolveMethodTest.java
@@ -40,6 +40,7 @@
 
 package compiler.jvmci.compilerToVM;
 
+import compiler.jvmci.common.CTVMUtilities;
 import compiler.jvmci.common.testcases.AbstractClass;
 import compiler.jvmci.common.testcases.AbstractClassExtender;
 import compiler.jvmci.common.testcases.MultipleImplementer1;
@@ -49,15 +50,15 @@
 import compiler.jvmci.common.testcases.SingleImplementerInterface;
 import compiler.jvmci.common.testcases.SingleSubclass;
 import compiler.jvmci.common.testcases.SingleSubclassedClass;
-import compiler.jvmci.common.CTVMUtilities;
-import java.util.HashSet;
-import java.util.Set;
+import jdk.internal.misc.Unsafe;
+import jdk.test.lib.Asserts;
+import jdk.test.lib.Utils;
 import jdk.vm.ci.hotspot.CompilerToVMHelper;
 import jdk.vm.ci.hotspot.HotSpotResolvedJavaMethod;
 import jdk.vm.ci.hotspot.HotSpotResolvedObjectType;
-import jdk.test.lib.Asserts;
-import jdk.test.lib.Utils;
-import jdk.internal.misc.Unsafe;
+
+import java.util.HashSet;
+import java.util.Set;
 
 public class ResolveMethodTest {
     private static final Unsafe UNSAFE = Utils.getUnsafe();
diff --git a/hotspot/test/compiler/jvmci/compilerToVM/ResolvePossiblyCachedConstantInPoolTest.java b/hotspot/test/compiler/jvmci/compilerToVM/ResolvePossiblyCachedConstantInPoolTest.java
index a284b5c..49a3cbd 100644
--- a/hotspot/test/compiler/jvmci/compilerToVM/ResolvePossiblyCachedConstantInPoolTest.java
+++ b/hotspot/test/compiler/jvmci/compilerToVM/ResolvePossiblyCachedConstantInPoolTest.java
@@ -35,11 +35,12 @@
  *          jdk.vm.ci/jdk.vm.ci.hotspot
  *          jdk.vm.ci/jdk.vm.ci.runtime
  *          jdk.vm.ci/jdk.vm.ci.meta
+ *
  * @build jdk.vm.ci/jdk.vm.ci.hotspot.CompilerToVMHelper
  * @build sun.hotspot.WhiteBox
  *        compiler.jvmci.compilerToVM.ResolvePossiblyCachedConstantInPoolTest
- * @run main ClassFileInstaller sun.hotspot.WhiteBox
- *                              sun.hotspot.WhiteBox$WhiteBoxPermission
+ * @run driver ClassFileInstaller sun.hotspot.WhiteBox
+ *                                sun.hotspot.WhiteBox$WhiteBoxPermission
  * @run main/othervm -Xbootclasspath/a:. -XX:+UnlockDiagnosticVMOptions
  *                   -XX:+WhiteBoxAPI -XX:+UnlockExperimentalVMOptions -XX:+EnableJVMCI
  *                   compiler.jvmci.compilerToVM.ResolvePossiblyCachedConstantInPoolTest
@@ -47,17 +48,19 @@
 
 package compiler.jvmci.compilerToVM;
 
-import compiler.jvmci.compilerToVM.ConstantPoolTestsHelper.DummyClasses;
 import compiler.jvmci.compilerToVM.ConstantPoolTestCase.ConstantTypes;
-import static compiler.jvmci.compilerToVM.ConstantPoolTestCase.ConstantTypes.*;
 import compiler.jvmci.compilerToVM.ConstantPoolTestCase.TestedCPEntry;
 import compiler.jvmci.compilerToVM.ConstantPoolTestCase.Validator;
-import java.util.HashMap;
-import java.util.Map;
+import compiler.jvmci.compilerToVM.ConstantPoolTestsHelper.DummyClasses;
 import jdk.test.lib.Asserts;
 import jdk.vm.ci.hotspot.CompilerToVMHelper;
 import jdk.vm.ci.meta.ConstantPool;
 
+import java.util.HashMap;
+import java.util.Map;
+
+import static compiler.jvmci.compilerToVM.ConstantPoolTestCase.ConstantTypes.CONSTANT_STRING;
+
 /**
  * Test for {@code jdk.vm.ci.hotspot.CompilerToVM.resolvePossiblyCachedConstantInPool} method
  */
diff --git a/hotspot/test/compiler/jvmci/compilerToVM/ResolveTypeInPoolTest.java b/hotspot/test/compiler/jvmci/compilerToVM/ResolveTypeInPoolTest.java
index 12055f5..26fc8f8 100644
--- a/hotspot/test/compiler/jvmci/compilerToVM/ResolveTypeInPoolTest.java
+++ b/hotspot/test/compiler/jvmci/compilerToVM/ResolveTypeInPoolTest.java
@@ -35,11 +35,12 @@
  *          jdk.vm.ci/jdk.vm.ci.hotspot
  *          jdk.vm.ci/jdk.vm.ci.runtime
  *          jdk.vm.ci/jdk.vm.ci.meta
+ *
  * @build jdk.vm.ci/jdk.vm.ci.hotspot.CompilerToVMHelper
  * @build sun.hotspot.WhiteBox
  *        compiler.jvmci.compilerToVM.ResolveTypeInPoolTest
- * @run main ClassFileInstaller sun.hotspot.WhiteBox
- *                              sun.hotspot.WhiteBox$WhiteBoxPermission
+ * @run driver ClassFileInstaller sun.hotspot.WhiteBox
+ *                                sun.hotspot.WhiteBox$WhiteBoxPermission
  * @run main/othervm -Xbootclasspath/a:.
  *                   -XX:+UnlockExperimentalVMOptions -XX:+EnableJVMCI
  *                   -XX:+UnlockDiagnosticVMOptions -XX:+WhiteBoxAPI
@@ -48,17 +49,19 @@
 
 package compiler.jvmci.compilerToVM;
 
-import compiler.jvmci.compilerToVM.ConstantPoolTestsHelper.DummyClasses;
 import compiler.jvmci.compilerToVM.ConstantPoolTestCase.ConstantTypes;
-import static compiler.jvmci.compilerToVM.ConstantPoolTestCase.ConstantTypes.*;
 import compiler.jvmci.compilerToVM.ConstantPoolTestCase.TestedCPEntry;
 import compiler.jvmci.compilerToVM.ConstantPoolTestCase.Validator;
-import java.util.HashMap;
-import java.util.Map;
+import compiler.jvmci.compilerToVM.ConstantPoolTestsHelper.DummyClasses;
 import jdk.vm.ci.hotspot.CompilerToVMHelper;
 import jdk.vm.ci.hotspot.HotSpotResolvedObjectType;
 import jdk.vm.ci.meta.ConstantPool;
 
+import java.util.HashMap;
+import java.util.Map;
+
+import static compiler.jvmci.compilerToVM.ConstantPoolTestCase.ConstantTypes.CONSTANT_CLASS;
+
 /**
  * Test for {@code jdk.vm.ci.hotspot.CompilerToVM.resolveTypeInPool} method
  */
diff --git a/hotspot/test/compiler/jvmci/compilerToVM/ShouldDebugNonSafepointsTest.java b/hotspot/test/compiler/jvmci/compilerToVM/ShouldDebugNonSafepointsTest.java
index 1ec2722..cbca06a 100644
--- a/hotspot/test/compiler/jvmci/compilerToVM/ShouldDebugNonSafepointsTest.java
+++ b/hotspot/test/compiler/jvmci/compilerToVM/ShouldDebugNonSafepointsTest.java
@@ -45,8 +45,8 @@
 
 package compiler.jvmci.compilerToVM;
 
-import jdk.vm.ci.hotspot.CompilerToVMHelper;
 import jdk.test.lib.Asserts;
+import jdk.vm.ci.hotspot.CompilerToVMHelper;
 
 public class ShouldDebugNonSafepointsTest {
     private static final boolean EXPECTED = Boolean.getBoolean("compiler"
diff --git a/hotspot/test/compiler/jvmci/compilerToVM/ShouldInlineMethodTest.java b/hotspot/test/compiler/jvmci/compilerToVM/ShouldInlineMethodTest.java
index ebaf429..c86ff4d 100644
--- a/hotspot/test/compiler/jvmci/compilerToVM/ShouldInlineMethodTest.java
+++ b/hotspot/test/compiler/jvmci/compilerToVM/ShouldInlineMethodTest.java
@@ -33,11 +33,12 @@
  *          java.base/jdk.internal.org.objectweb.asm.tree
  *          jdk.vm.ci/jdk.vm.ci.hotspot
  *          jdk.vm.ci/jdk.vm.ci.code
+ *
  * @build jdk.vm.ci/jdk.vm.ci.hotspot.CompilerToVMHelper
  * @build compiler.jvmci.compilerToVM.ShouldInlineMethodTest
  * @build sun.hotspot.WhiteBox
- * @run main ClassFileInstaller sun.hotspot.WhiteBox
- *                              sun.hotspot.WhiteBox$WhiteBoxPermission
+ * @run driver ClassFileInstaller sun.hotspot.WhiteBox
+ *                                sun.hotspot.WhiteBox$WhiteBoxPermission
  * @run main/othervm -Xbootclasspath/a:.
  *                   -XX:+UnlockDiagnosticVMOptions -XX:+WhiteBoxAPI
  *                   -XX:+UnlockExperimentalVMOptions -XX:+EnableJVMCI
@@ -47,14 +48,15 @@
 package compiler.jvmci.compilerToVM;
 
 import compiler.jvmci.common.CTVMUtilities;
+import jdk.test.lib.Asserts;
+import jdk.vm.ci.hotspot.CompilerToVMHelper;
+import jdk.vm.ci.hotspot.HotSpotResolvedJavaMethod;
+import sun.hotspot.WhiteBox;
+
 import java.lang.reflect.Executable;
 import java.util.ArrayList;
 import java.util.Arrays;
 import java.util.List;
-import jdk.vm.ci.hotspot.CompilerToVMHelper;
-import jdk.vm.ci.hotspot.HotSpotResolvedJavaMethod;
-import jdk.test.lib.Asserts;
-import sun.hotspot.WhiteBox;
 
 public class ShouldInlineMethodTest {
 
diff --git a/hotspot/test/compiler/jvmci/errors/CodeInstallerTest.java b/hotspot/test/compiler/jvmci/errors/CodeInstallerTest.java
index fd361bc..7e7dfcd 100644
--- a/hotspot/test/compiler/jvmci/errors/CodeInstallerTest.java
+++ b/hotspot/test/compiler/jvmci/errors/CodeInstallerTest.java
@@ -23,8 +23,6 @@
 
 package compiler.jvmci.errors;
 
-import java.lang.reflect.Method;
-
 import jdk.vm.ci.code.Architecture;
 import jdk.vm.ci.code.CodeCacheProvider;
 import jdk.vm.ci.code.Register;
@@ -41,9 +39,10 @@
 import jdk.vm.ci.meta.ResolvedJavaMethod;
 import jdk.vm.ci.runtime.JVMCI;
 import jdk.vm.ci.runtime.JVMCIBackend;
-
 import org.junit.Assert;
 
+import java.lang.reflect.Method;
+
 public class CodeInstallerTest {
 
     protected final Architecture arch;
diff --git a/hotspot/test/compiler/jvmci/errors/TestInvalidCompilationResult.java b/hotspot/test/compiler/jvmci/errors/TestInvalidCompilationResult.java
index bc2eae3..1f696df 100644
--- a/hotspot/test/compiler/jvmci/errors/TestInvalidCompilationResult.java
+++ b/hotspot/test/compiler/jvmci/errors/TestInvalidCompilationResult.java
@@ -51,7 +51,6 @@
 import jdk.vm.ci.hotspot.HotSpotConstant;
 import jdk.vm.ci.meta.Assumptions.Assumption;
 import jdk.vm.ci.meta.VMConstant;
-
 import org.junit.Test;
 
 /**
diff --git a/hotspot/test/compiler/jvmci/errors/TestInvalidDebugInfo.java b/hotspot/test/compiler/jvmci/errors/TestInvalidDebugInfo.java
index 7beb74f..e4a4d46 100644
--- a/hotspot/test/compiler/jvmci/errors/TestInvalidDebugInfo.java
+++ b/hotspot/test/compiler/jvmci/errors/TestInvalidDebugInfo.java
@@ -58,7 +58,6 @@
 import jdk.vm.ci.meta.ResolvedJavaType;
 import jdk.vm.ci.meta.Value;
 import jdk.vm.ci.meta.ValueKind;
-
 import org.junit.Test;
 
 /**
diff --git a/hotspot/test/compiler/jvmci/errors/TestInvalidOopMap.java b/hotspot/test/compiler/jvmci/errors/TestInvalidOopMap.java
index fdb056e..ad1a1d5 100644
--- a/hotspot/test/compiler/jvmci/errors/TestInvalidOopMap.java
+++ b/hotspot/test/compiler/jvmci/errors/TestInvalidOopMap.java
@@ -52,7 +52,6 @@
 import jdk.vm.ci.meta.Assumptions.Assumption;
 import jdk.vm.ci.meta.JavaKind;
 import jdk.vm.ci.meta.PlatformKind;
-
 import org.junit.Test;
 
 /**
diff --git a/hotspot/test/compiler/jvmci/events/JvmciNotifyBootstrapFinishedEventTest.java b/hotspot/test/compiler/jvmci/events/JvmciNotifyBootstrapFinishedEventTest.java
index 54d9518..bcfc52f 100644
--- a/hotspot/test/compiler/jvmci/events/JvmciNotifyBootstrapFinishedEventTest.java
+++ b/hotspot/test/compiler/jvmci/events/JvmciNotifyBootstrapFinishedEventTest.java
@@ -28,30 +28,33 @@
  * @library / /testlibrary
  * @library ../common/patches
  * @modules java.base/jdk.internal.misc
-            java.base/jdk.internal.org.objectweb.asm
+ *          java.base/jdk.internal.org.objectweb.asm
  *          java.base/jdk.internal.org.objectweb.asm.tree
  *          jdk.vm.ci/jdk.vm.ci.hotspot
  *          jdk.vm.ci/jdk.vm.ci.code
  *          jdk.vm.ci/jdk.vm.ci.meta
  *          jdk.vm.ci/jdk.vm.ci.runtime
+ *
  * @build jdk.vm.ci/jdk.vm.ci.hotspot.CompilerToVMHelper
  * @build compiler.jvmci.common.JVMCIHelpers
- *     compiler.jvmci.events.JvmciNotifyBootstrapFinishedEventTest
- * @run main jdk.test.lib.FileInstaller ../common/services/ ./META-INF/services/
- * @run main jdk.test.lib.FileInstaller ./JvmciNotifyBootstrapFinishedEventTest.config
+ *        compiler.jvmci.events.JvmciNotifyBootstrapFinishedEventTest
+ * @run driver jdk.test.lib.FileInstaller ../common/services/ ./META-INF/services/
+ * @run driver jdk.test.lib.FileInstaller ./JvmciNotifyBootstrapFinishedEventTest.config
  *     ./META-INF/services/jdk.vm.ci.hotspot.services.HotSpotVMEventListener
- * @run main ClassFileInstaller
- *     compiler.jvmci.common.JVMCIHelpers$EmptyHotspotCompiler
- *     compiler.jvmci.common.JVMCIHelpers$EmptyCompilerFactory
- *     compiler.jvmci.events.JvmciNotifyBootstrapFinishedEventTest
- *     jdk.test.lib.Asserts
- *     jdk.test.lib.Utils
- * @run main/othervm -XX:+UnlockExperimentalVMOptions -XX:+EnableJVMCI
+ * @run driver ClassFileInstaller
+ *      compiler.jvmci.common.JVMCIHelpers$EmptyHotspotCompiler
+ *      compiler.jvmci.common.JVMCIHelpers$EmptyCompilerFactory
+ *      compiler.jvmci.common.JVMCIHelpers$EmptyCompilationRequestResult
+ *      compiler.jvmci.common.JVMCIHelpers$EmptyVMEventListener
+ *      compiler.jvmci.events.JvmciNotifyBootstrapFinishedEventTest
+ *      jdk.test.lib.Asserts
+ *      jdk.test.lib.Utils
+ * @run main/othervm -XX:+UnlockExperimentalVMOptions
  *     -Djvmci.Compiler=EmptyCompiler -Xbootclasspath/a:.
  *     -XX:+UseJVMCICompiler -XX:-BootstrapJVMCI
  *     -Dcompiler.jvmci.events.JvmciNotifyBootstrapFinishedEventTest.bootstrap=false
  *     compiler.jvmci.events.JvmciNotifyBootstrapFinishedEventTest
- * @run main/othervm -XX:+UnlockExperimentalVMOptions -XX:+EnableJVMCI
+ * @run main/othervm -XX:+UnlockExperimentalVMOptions
  *     -Djvmci.Compiler=EmptyCompiler -Xbootclasspath/a:.
  *     -XX:+UseJVMCICompiler -XX:+BootstrapJVMCI
  *     -Dcompiler.jvmci.events.JvmciNotifyBootstrapFinishedEventTest.bootstrap=true
diff --git a/hotspot/test/compiler/jvmci/events/JvmciNotifyInstallEventTest.java b/hotspot/test/compiler/jvmci/events/JvmciNotifyInstallEventTest.java
index b6c47bf..6f5c83a 100644
--- a/hotspot/test/compiler/jvmci/events/JvmciNotifyInstallEventTest.java
+++ b/hotspot/test/compiler/jvmci/events/JvmciNotifyInstallEventTest.java
@@ -32,29 +32,37 @@
  *          java.base/jdk.internal.org.objectweb.asm.tree
  *          jdk.vm.ci/jdk.vm.ci.hotspot
  *          jdk.vm.ci/jdk.vm.ci.code
+ *          jdk.vm.ci/jdk.vm.ci.code.site
  *          jdk.vm.ci/jdk.vm.ci.meta
  *          jdk.vm.ci/jdk.vm.ci.runtime
- * @ignore 8144964
+ *
  * @build jdk.vm.ci/jdk.vm.ci.hotspot.CompilerToVMHelper
  * @build compiler.jvmci.common.JVMCIHelpers
  *     compiler.jvmci.events.JvmciNotifyInstallEventTest
- * @run main jdk.test.lib.FileInstaller ../common/services/ ./META-INF/services/
- * @run main jdk.test.lib.FileInstaller ./JvmciNotifyInstallEventTest.config
- *     ./META-INF/services/jdk.vm.ci.hotspot.HotSpotVMEventListener
- * @run main ClassFileInstaller
- *     compiler.jvmci.common.JVMCIHelpers$EmptyHotspotCompiler
- *     compiler.jvmci.common.JVMCIHelpers$EmptyCompilerFactory
+ * @run driver jdk.test.lib.FileInstaller ../common/services/ ./META-INF/services/
+ * @run driver jdk.test.lib.FileInstaller ./JvmciNotifyInstallEventTest.config
+ *     ./META-INF/services/jdk.vm.ci.hotspot.services.HotSpotVMEventListener
+ * @run driver ClassFileInstaller
+ *      compiler.jvmci.common.JVMCIHelpers$EmptyHotspotCompiler
+ *      compiler.jvmci.common.JVMCIHelpers$EmptyCompilerFactory
+ *      compiler.jvmci.common.JVMCIHelpers$EmptyCompilationRequestResult
+ *       compiler.jvmci.common.JVMCIHelpers$EmptyVMEventListener
+ *      compiler.jvmci.events.JvmciNotifyInstallEventTest
+ *      compiler.jvmci.common.CTVMUtilities
+ *      compiler.jvmci.common.testcases.SimpleClass
+ *      jdk.test.lib.Asserts
+ *      jdk.test.lib.Utils
+ * @run main/othervm -XX:+UnlockExperimentalVMOptions
+ *     -Xbootclasspath/a:. -Xmixed
+ *     -XX:+UseJVMCICompiler -XX:-BootstrapJVMCI
+ *     -Dcompiler.jvmci.events.JvmciNotifyInstallEventTest.failoninit=false
  *     compiler.jvmci.events.JvmciNotifyInstallEventTest
- *     compiler.jvmci.common.CTVMUtilities
- *     compiler.jvmci.common.testcases.SimpleClass
- *     jdk.test.lib.Asserts
- *     jdk.test.lib.Utils
- * @run main/othervm -XX:+UnlockExperimentalVMOptions -XX:+EnableJVMCI
+ * @run main/othervm -XX:+UnlockExperimentalVMOptions
  *     -Djvmci.compiler=EmptyCompiler -Xbootclasspath/a:. -Xmixed
  *     -XX:+UseJVMCICompiler -XX:-BootstrapJVMCI
  *     -Dcompiler.jvmci.events.JvmciNotifyInstallEventTest.failoninit=false
  *     compiler.jvmci.events.JvmciNotifyInstallEventTest
- * @run main/othervm -XX:+UnlockExperimentalVMOptions -XX:+EnableJVMCI
+ * @run main/othervm -XX:+UnlockExperimentalVMOptions
  *     -Djvmci.compiler=EmptyCompiler -Xbootclasspath/a:. -Xmixed
  *     -XX:+UseJVMCICompiler -XX:-BootstrapJVMCI -XX:JVMCINMethodSizeLimit=0
  *     -Dcompiler.jvmci.events.JvmciNotifyInstallEventTest.failoninit=false
@@ -70,22 +78,23 @@
 import compiler.jvmci.common.CTVMUtilities;
 import compiler.jvmci.common.testcases.SimpleClass;
 import jdk.test.lib.Asserts;
-import java.lang.reflect.Method;
 import jdk.test.lib.Utils;
-import jdk.vm.ci.hotspot.HotSpotVMEventListener;
 import jdk.vm.ci.code.CompiledCode;
 import jdk.vm.ci.code.InstalledCode;
 import jdk.vm.ci.code.site.DataPatch;
 import jdk.vm.ci.code.site.Site;
-import jdk.vm.ci.meta.Assumptions.Assumption;
-import jdk.vm.ci.meta.ResolvedJavaMethod;
 import jdk.vm.ci.hotspot.HotSpotCodeCacheProvider;
 import jdk.vm.ci.hotspot.HotSpotCompiledCode;
 import jdk.vm.ci.hotspot.HotSpotCompiledCode.Comment;
 import jdk.vm.ci.hotspot.HotSpotJVMCIRuntime;
 import jdk.vm.ci.hotspot.HotSpotResolvedJavaMethod;
+import jdk.vm.ci.hotspot.services.HotSpotVMEventListener;
+import jdk.vm.ci.meta.Assumptions.Assumption;
+import jdk.vm.ci.meta.ResolvedJavaMethod;
 
-public class JvmciNotifyInstallEventTest implements HotSpotVMEventListener {
+import java.lang.reflect.Method;
+
+public class JvmciNotifyInstallEventTest extends HotSpotVMEventListener {
     private static final String METHOD_NAME = "testMethod";
     private static final boolean FAIL_ON_INIT = !Boolean.getBoolean(
             "compiler.jvmci.events.JvmciNotifyInstallEventTest.failoninit");
diff --git a/hotspot/test/compiler/jvmci/events/JvmciShutdownEventTest.java b/hotspot/test/compiler/jvmci/events/JvmciShutdownEventTest.java
index 744ddc6..d01d278 100644
--- a/hotspot/test/compiler/jvmci/events/JvmciShutdownEventTest.java
+++ b/hotspot/test/compiler/jvmci/events/JvmciShutdownEventTest.java
@@ -31,21 +31,22 @@
  *          jdk.vm.ci/jdk.vm.ci.code
  *          jdk.vm.ci/jdk.vm.ci.meta
  *          jdk.vm.ci/jdk.vm.ci.runtime
+ *
  * @build compiler.jvmci.common.JVMCIHelpers
  *        compiler.jvmci.events.JvmciShutdownEventListener
  *        compiler.jvmci.events.JvmciShutdownEventTest
- * @run main jdk.test.lib.FileInstaller ../common/services/ ./META-INF/services/
- * @run main jdk.test.lib.FileInstaller ./JvmciShutdownEventTest.config
+ * @run driver jdk.test.lib.FileInstaller ../common/services/ ./META-INF/services/
+ * @run driver jdk.test.lib.FileInstaller ./JvmciShutdownEventTest.config
  *     ./META-INF/services/jdk.vm.ci.hotspot.services.HotSpotVMEventListener
- * @run main ClassFileInstaller
- *     compiler.jvmci.common.JVMCIHelpers$EmptyHotspotCompiler
- *     compiler.jvmci.common.JVMCIHelpers$EmptyCompilerFactory
- *     compiler.jvmci.events.JvmciShutdownEventListener
+ * @run driver ClassFileInstaller
+ *      compiler.jvmci.common.JVMCIHelpers$EmptyHotspotCompiler
+ *      compiler.jvmci.common.JVMCIHelpers$EmptyCompilerFactory
+ *      compiler.jvmci.common.JVMCIHelpers$EmptyCompilationRequestResult
+ *      compiler.jvmci.common.JVMCIHelpers$EmptyVMEventListener
+ *      compiler.jvmci.events.JvmciShutdownEventListener
  * @run main/othervm compiler.jvmci.events.JvmciShutdownEventTest
  */
 
- // as soon as CODETOOLS-7901589 fixed, '@run main/othervm' at L43 should be replaced w/ '@run driver'
-
 package compiler.jvmci.events;
 
 import jdk.test.lib.ExitCode;
diff --git a/hotspot/test/compiler/jvmci/jdk.vm.ci.code.test/libNativeCallTest.c b/hotspot/test/compiler/jvmci/jdk.vm.ci.code.test/libNativeCallTest.c
new file mode 100644
index 0000000..55572e6
--- /dev/null
+++ b/hotspot/test/compiler/jvmci/jdk.vm.ci.code.test/libNativeCallTest.c
@@ -0,0 +1,196 @@
+/*
+ * 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.
+ *
+ */
+
+#include <stdio.h>
+#include <stdint.h>
+
+#include "jni.h"
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+jfloat JNICALL SS(jfloat f1, jfloat f2) {
+  return f1 + f2;
+}
+
+JNIEXPORT jlong JNICALL Java_jdk_vm_ci_code_test_NativeCallTest_getFF(JNIEnv *env, jclass clazz) {
+  return (jlong)(intptr_t)SS;
+}
+
+JNIEXPORT jfloat JNICALL Java_jdk_vm_ci_code_test_NativeCallTest__1FF(JNIEnv *env, jclass clazz, jfloat a, jfloat b) {
+  return SS(a, b);
+}
+
+jfloat JNICALL SDILDS(jfloat a, jdouble b, jint c, jlong d, jdouble e, jfloat f) {
+  return (jfloat)(a + b + c + d + e + f);
+}
+
+JNIEXPORT jlong JNICALL Java_jdk_vm_ci_code_test_NativeCallTest_getSDILDS(JNIEnv *env, jclass clazz) {
+  return (jlong)(intptr_t)SDILDS;
+}
+
+JNIEXPORT jfloat JNICALL Java_jdk_vm_ci_code_test_NativeCallTest__1SDILDS(JNIEnv *env, jclass clazz,
+                                                                          jfloat a, jdouble b, jint c, jlong d, jdouble e, jfloat f) {
+  return SDILDS(a, b, c, d, e, f);
+}
+
+jfloat JNICALL F32SDILDS(jfloat f00, jfloat f01, jfloat f02, jfloat f03, jfloat f04, jfloat f05, jfloat f06, jfloat f07,
+                         jfloat f08, jfloat f09, jfloat f0a, jfloat f0b, jfloat f0c, jfloat f0d, jfloat f0e, jfloat f0f,
+                         jfloat f10, jfloat f11, jfloat f12, jfloat f13, jfloat f14, jfloat f15, jfloat f16, jfloat f17,
+                         jfloat f18, jfloat f19, jfloat f1a, jfloat f1b, jfloat f1c, jfloat f1d, jfloat f1e, jfloat f1f,
+                         jfloat a, jdouble b, jint c, jlong d, jdouble e, jfloat f) {
+  return (jfloat)(f00 + f01 + f02 + f03 + f04 + f05 + f06 + f07 +
+                  f08 + f09 + f0a + f0b + f0c + f0d + f0e + f0f +
+                  f10 + f11 + f12 + f13 + f14 + f15 + f16 + f17 +
+                  f18 + f19 + f1a + f1b + f1c + f1d + f1e + f1f +
+                  a +   b +   c +   d +   e + f);
+}
+
+JNIEXPORT jlong JNICALL Java_jdk_vm_ci_code_test_NativeCallTest_getF32SDILDS(JNIEnv *env, jclass clazz) {
+  return (jlong)(intptr_t)F32SDILDS;
+}
+
+JNIEXPORT jfloat JNICALL Java_jdk_vm_ci_code_test_NativeCallTest__1F32SDILDS(JNIEnv *env, jclass clazz,
+                                                                             jfloat f00, jfloat f01, jfloat f02, jfloat f03,
+                                                                             jfloat f04, jfloat f05, jfloat f06, jfloat f07,
+                                                                             jfloat f08, jfloat f09, jfloat f0a, jfloat f0b,
+                                                                             jfloat f0c, jfloat f0d, jfloat f0e, jfloat f0f,
+                                                                             jfloat f10, jfloat f11, jfloat f12, jfloat f13,
+                                                                             jfloat f14, jfloat f15, jfloat f16, jfloat f17,
+                                                                             jfloat f18, jfloat f19, jfloat f1a, jfloat f1b,
+                                                                             jfloat f1c, jfloat f1d, jfloat f1e, jfloat f1f,
+                                                                             jfloat a, jdouble b, jint c, jlong d, jdouble e, jfloat f) {
+  return F32SDILDS(f00, f01, f02, f03, f04, f05, f06, f07,
+                   f08, f09, f0a, f0b, f0c, f0d, f0e, f0f,
+                   f10, f11, f12, f13, f14, f15, f16, f17,
+                   f18, f19, f1a, f1b, f1c, f1d, f1e, f1f,
+                   a,   b,   c,   d,   e,   f);
+}
+
+
+jfloat JNICALL D32SDILDS(jdouble d00, jdouble d01, jdouble d02, jdouble d03, jdouble d04, jdouble d05, jdouble d06, jdouble d07,
+                         jdouble d08, jdouble d09, jdouble d0a, jdouble d0b, jdouble d0c, jdouble d0d, jdouble d0e, jdouble d0f,
+                         jdouble d10, jdouble d11, jdouble d12, jdouble d13, jdouble d14, jdouble d15, jdouble d16, jdouble d17,
+                         jdouble d18, jdouble d19, jdouble d1a, jdouble d1b, jdouble d1c, jdouble d1d, jdouble d1e, jdouble d1f,
+                         jfloat a, jdouble b, jint c, jlong d, jdouble e, jfloat f) {
+  return (jfloat)(d00 + d01 + d02 + d03 + d04 + d05 + d06 + d07 +
+                  d08 + d09 + d0a + d0b + d0c + d0d + d0e + d0f +
+                  d10 + d11 + d12 + d13 + d14 + d15 + d16 + d17 +
+                  d18 + d19 + d1a + d1b + d1c + d1d + d1e + d1f +
+                  a +   b +   c +   d +   e + f);
+}
+
+JNIEXPORT jlong JNICALL Java_jdk_vm_ci_code_test_NativeCallTest_getD32SDILDS(JNIEnv *env, jclass clazz) {
+  return (jlong)(intptr_t)D32SDILDS;
+}
+
+JNIEXPORT jfloat JNICALL Java_jdk_vm_ci_code_test_NativeCallTest__1D32SDILDS(JNIEnv *env, jclass clazz,
+                                                                             jdouble d00, jdouble d01, jdouble d02, jdouble d03,
+                                                                             jdouble d04, jdouble d05, jdouble d06, jdouble d07,
+                                                                             jdouble d08, jdouble d09, jdouble d0a, jdouble d0b,
+                                                                             jdouble d0c, jdouble d0d, jdouble d0e, jdouble d0f,
+                                                                             jdouble d10, jdouble d11, jdouble d12, jdouble d13,
+                                                                             jdouble d14, jdouble d15, jdouble d16, jdouble d17,
+                                                                             jdouble d18, jdouble d19, jdouble d1a, jdouble d1b,
+                                                                             jdouble d1c, jdouble d1d, jdouble d1e, jdouble d1f,
+                                                                             jfloat a, jdouble b, jint c, jlong d, jdouble e, jfloat f) {
+  return D32SDILDS(d00, d01, d02, d03, d04, d05, d06, d07,
+                   d08, d09, d0a, d0b, d0c, d0d, d0e, d0f,
+                   d10, d11, d12, d13, d14, d15, d16, d17,
+                   d18, d19, d1a, d1b, d1c, d1d, d1e, d1f,
+                   a,   b,   c,   d,   e,   f);
+}
+
+
+jfloat JNICALL I32SDILDS(jint i00, jint i01, jint i02, jint i03, jint i04, jint i05, jint i06, jint i07,
+                         jint i08, jint i09, jint i0a, jint i0b, jint i0c, jint i0d, jint i0e, jint i0f,
+                         jint i10, jint i11, jint i12, jint i13, jint i14, jint i15, jint i16, jint i17,
+                         jint i18, jint i19, jint i1a, jint i1b, jint i1c, jint i1d, jint i1e, jint i1f,
+                         jfloat a, jdouble b, jint c, jlong d, jdouble e, jfloat f) {
+  return (jfloat)(i00 + i01 + i02 + i03 + i04 + i05 + i06 + i07 +
+                  i08 + i09 + i0a + i0b + i0c + i0d + i0e + i0f +
+                  i10 + i11 + i12 + i13 + i14 + i15 + i16 + i17 +
+                  i18 + i19 + i1a + i1b + i1c + i1d + i1e + i1f +
+                  a +   b +   c +   d +   e + f);
+}
+
+JNIEXPORT jlong JNICALL Java_jdk_vm_ci_code_test_NativeCallTest_getI32SDILDS(JNIEnv *env, jclass clazz) {
+  return (jlong) (intptr_t) I32SDILDS;
+}
+
+JNIEXPORT jfloat JNICALL Java_jdk_vm_ci_code_test_NativeCallTest__1I32SDILDS(JNIEnv *env, jclass clazz,
+                                                                             jint i00, jint i01, jint i02, jint i03,
+                                                                             jint i04, jint i05, jint i06, jint i07,
+                                                                             jint i08, jint i09, jint i0a, jint i0b,
+                                                                             jint i0c, jint i0d, jint i0e, jint i0f,
+                                                                             jint i10, jint i11, jint i12, jint i13,
+                                                                             jint i14, jint i15, jint i16, jint i17,
+                                                                             jint i18, jint i19, jint i1a, jint i1b,
+                                                                             jint i1c, jint i1d, jint i1e, jint i1f,
+                                                                             jfloat a, jdouble b, jint c, jlong d, jdouble e, jfloat f) {
+  return I32SDILDS(i00, i01, i02, i03, i04, i05, i06, i07,
+                   i08, i09, i0a, i0b, i0c, i0d, i0e, i0f,
+                   i10, i11, i12, i13, i14, i15, i16, i17,
+                   i18, i19, i1a, i1b, i1c, i1d, i1e, i1f,
+                   a,   b,   c,   d,   e,   f);
+}
+
+jfloat JNICALL L32SDILDS(jlong l00, jlong l01, jlong l02, jlong l03, jlong l04, jlong l05, jlong l06, jlong l07,
+                         jlong l08, jlong l09, jlong l0a, jlong l0b, jlong l0c, jlong l0d, jlong l0e, jlong l0f,
+                         jlong l10, jlong l11, jlong l12, jlong l13, jlong l14, jlong l15, jlong l16, jlong l17,
+                         jlong l18, jlong l19, jlong l1a, jlong l1b, jlong l1c, jlong l1d, jlong l1e, jlong l1f,
+                         jfloat a, jdouble b, jint c, jlong d, jdouble e, jfloat f) {
+  return (jfloat)(l00 + l01 + l02 + l03 + l04 + l05 + l06 + l07 +
+                  l08 + l09 + l0a + l0b + l0c + l0d + l0e + l0f +
+                  l10 + l11 + l12 + l13 + l14 + l15 + l16 + l17 +
+                  l18 + l19 + l1a + l1b + l1c + l1d + l1e + l1f +
+                  a +   b +   c +   d +   e + f);
+}
+
+JNIEXPORT jlong JNICALL Java_jdk_vm_ci_code_test_NativeCallTest_getL32SDILDS(JNIEnv *env, jclass clazz) {
+  return (jlong)(intptr_t)L32SDILDS;
+}
+
+JNIEXPORT jfloat JNICALL Java_jdk_vm_ci_code_test_NativeCallTest__1L32SDILDS(JNIEnv *env, jclass clazz,
+                                                                               jlong l00, jlong l01, jlong l02, jlong l03,
+                                                                               jlong l04, jlong l05, jlong l06, jlong l07,
+                                                                               jlong l08, jlong l09, jlong l0a, jlong l0b,
+                                                                               jlong l0c, jlong l0d, jlong l0e, jlong l0f,
+                                                                               jlong l10, jlong l11, jlong l12, jlong l13,
+                                                                               jlong l14, jlong l15, jlong l16, jlong l17,
+                                                                               jlong l18, jlong l19, jlong l1a, jlong l1b,
+                                                                               jlong l1c, jlong l1d, jlong l1e, jlong l1f,
+                                                                               jfloat a, jdouble b, jint c, jlong d, jdouble e, jfloat f) {
+  return L32SDILDS(l00, l01, l02, l03, l04, l05, l06, l07,
+                   l08, l09, l0a, l0b, l0c, l0d, l0e, l0f,
+                   l10, l11, l12, l13, l14, l15, l16, l17,
+                   l18, l19, l1a, l1b, l1c, l1d, l1e, l1f,
+                   a,   b,   c,   d,   e,   f);
+}
+
+#ifdef __cplusplus
+}
+#endif
+
diff --git a/hotspot/test/compiler/jvmci/jdk.vm.ci.code.test/src/jdk/vm/ci/code/test/CodeInstallationTest.java b/hotspot/test/compiler/jvmci/jdk.vm.ci.code.test/src/jdk/vm/ci/code/test/CodeInstallationTest.java
index 9ae9d83..62d0e99 100644
--- a/hotspot/test/compiler/jvmci/jdk.vm.ci.code.test/src/jdk/vm/ci/code/test/CodeInstallationTest.java
+++ b/hotspot/test/compiler/jvmci/jdk.vm.ci.code.test/src/jdk/vm/ci/code/test/CodeInstallationTest.java
@@ -22,10 +22,6 @@
  */
 package jdk.vm.ci.code.test;
 
-import java.lang.reflect.Method;
-
-import org.junit.Assert;
-
 import jdk.vm.ci.amd64.AMD64;
 import jdk.vm.ci.code.Architecture;
 import jdk.vm.ci.code.CodeCacheProvider;
@@ -41,6 +37,9 @@
 import jdk.vm.ci.runtime.JVMCI;
 import jdk.vm.ci.runtime.JVMCIBackend;
 import jdk.vm.ci.sparc.SPARC;
+import org.junit.Assert;
+
+import java.lang.reflect.Method;
 
 /**
  * Base class for code installation tests.
diff --git a/hotspot/test/compiler/jvmci/jdk.vm.ci.code.test/src/jdk/vm/ci/code/test/DataPatchTest.java b/hotspot/test/compiler/jvmci/jdk.vm.ci.code.test/src/jdk/vm/ci/code/test/DataPatchTest.java
index bedb1bb..c2e3edf 100644
--- a/hotspot/test/compiler/jvmci/jdk.vm.ci.code.test/src/jdk/vm/ci/code/test/DataPatchTest.java
+++ b/hotspot/test/compiler/jvmci/jdk.vm.ci.code.test/src/jdk/vm/ci/code/test/DataPatchTest.java
@@ -38,13 +38,12 @@
 
 package jdk.vm.ci.code.test;
 
-import org.junit.Assume;
-import org.junit.Test;
-
 import jdk.vm.ci.code.Register;
 import jdk.vm.ci.code.site.DataSectionReference;
 import jdk.vm.ci.hotspot.HotSpotConstant;
 import jdk.vm.ci.meta.ResolvedJavaType;
+import org.junit.Assume;
+import org.junit.Test;
 
 /**
  * Test code installation with data patches.
diff --git a/hotspot/test/compiler/jvmci/jdk.vm.ci.code.test/src/jdk/vm/ci/code/test/DebugInfoTest.java b/hotspot/test/compiler/jvmci/jdk.vm.ci.code.test/src/jdk/vm/ci/code/test/DebugInfoTest.java
index 584249c..424c6be 100644
--- a/hotspot/test/compiler/jvmci/jdk.vm.ci.code.test/src/jdk/vm/ci/code/test/DebugInfoTest.java
+++ b/hotspot/test/compiler/jvmci/jdk.vm.ci.code.test/src/jdk/vm/ci/code/test/DebugInfoTest.java
@@ -22,8 +22,6 @@
  */
 package jdk.vm.ci.code.test;
 
-import java.lang.reflect.Method;
-
 import jdk.vm.ci.code.BytecodeFrame;
 import jdk.vm.ci.code.DebugInfo;
 import jdk.vm.ci.code.Location;
@@ -33,6 +31,8 @@
 import jdk.vm.ci.meta.JavaValue;
 import jdk.vm.ci.meta.ResolvedJavaMethod;
 
+import java.lang.reflect.Method;
+
 /**
  * Test code installation with debug information.
  */
diff --git a/hotspot/test/compiler/jvmci/jdk.vm.ci.code.test/src/jdk/vm/ci/code/test/InterpreterFrameSizeTest.java b/hotspot/test/compiler/jvmci/jdk.vm.ci.code.test/src/jdk/vm/ci/code/test/InterpreterFrameSizeTest.java
index 2425cbc..db19e22 100644
--- a/hotspot/test/compiler/jvmci/jdk.vm.ci.code.test/src/jdk/vm/ci/code/test/InterpreterFrameSizeTest.java
+++ b/hotspot/test/compiler/jvmci/jdk.vm.ci.code.test/src/jdk/vm/ci/code/test/InterpreterFrameSizeTest.java
@@ -38,14 +38,13 @@
 
 package jdk.vm.ci.code.test;
 
-import org.junit.Assert;
-import org.junit.Test;
-
 import jdk.vm.ci.code.BytecodeFrame;
 import jdk.vm.ci.hotspot.HotSpotCodeCacheProvider;
 import jdk.vm.ci.meta.JavaKind;
 import jdk.vm.ci.meta.JavaValue;
 import jdk.vm.ci.meta.ResolvedJavaMethod;
+import org.junit.Assert;
+import org.junit.Test;
 
 public class InterpreterFrameSizeTest extends CodeInstallationTest {
 
diff --git a/hotspot/test/compiler/jvmci/jdk.vm.ci.code.test/src/jdk/vm/ci/code/test/MaxOopMapStackOffsetTest.java b/hotspot/test/compiler/jvmci/jdk.vm.ci.code.test/src/jdk/vm/ci/code/test/MaxOopMapStackOffsetTest.java
index b9e5625..9caed42 100644
--- a/hotspot/test/compiler/jvmci/jdk.vm.ci.code.test/src/jdk/vm/ci/code/test/MaxOopMapStackOffsetTest.java
+++ b/hotspot/test/compiler/jvmci/jdk.vm.ci.code.test/src/jdk/vm/ci/code/test/MaxOopMapStackOffsetTest.java
@@ -39,13 +39,12 @@
 
 package jdk.vm.ci.code.test;
 
-import org.junit.Test;
-
 import jdk.vm.ci.code.Location;
 import jdk.vm.ci.code.Register;
 import jdk.vm.ci.common.JVMCIError;
 import jdk.vm.ci.meta.JavaConstant;
 import jdk.vm.ci.meta.JavaKind;
+import org.junit.Test;
 
 public class MaxOopMapStackOffsetTest extends DebugInfoTest {
 
diff --git a/hotspot/test/compiler/jvmci/jdk.vm.ci.code.test/src/jdk/vm/ci/code/test/NativeCallTest.java b/hotspot/test/compiler/jvmci/jdk.vm.ci.code.test/src/jdk/vm/ci/code/test/NativeCallTest.java
new file mode 100644
index 0000000..c7bb205
--- /dev/null
+++ b/hotspot/test/compiler/jvmci/jdk.vm.ci.code.test/src/jdk/vm/ci/code/test/NativeCallTest.java
@@ -0,0 +1,241 @@
+/*
+ * 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.
+ */
+
+/**
+ * @test
+ * @requires (os.simpleArch == "x64" | os.simpleArch == "sparcv9") & os.arch != "aarch64"
+ * @library /test/lib /testlibrary /
+ * @modules jdk.vm.ci/jdk.vm.ci.hotspot
+ *          jdk.vm.ci/jdk.vm.ci.code
+ *          jdk.vm.ci/jdk.vm.ci.code.site
+ *          jdk.vm.ci/jdk.vm.ci.meta
+ *          jdk.vm.ci/jdk.vm.ci.runtime
+ *          jdk.vm.ci/jdk.vm.ci.common
+ *          jdk.vm.ci/jdk.vm.ci.amd64
+ *          jdk.vm.ci/jdk.vm.ci.sparc
+ * @compile CodeInstallationTest.java TestHotSpotVMConfig.java NativeCallTest.java TestAssembler.java sparc/SPARCTestAssembler.java amd64/AMD64TestAssembler.java
+ * @run junit/othervm -XX:+UnlockExperimentalVMOptions -XX:+EnableJVMCI  -Xbootclasspath/a:. jdk.vm.ci.code.test.NativeCallTest
+ */
+package jdk.vm.ci.code.test;
+
+import static jdk.vm.ci.hotspot.HotSpotCallingConventionType.NativeCall;
+
+import org.junit.BeforeClass;
+import org.junit.Test;
+
+import jdk.vm.ci.code.CallingConvention;
+import jdk.vm.ci.code.RegisterValue;
+import jdk.vm.ci.meta.JavaType;
+
+public class NativeCallTest extends CodeInstallationTest {
+
+    @BeforeClass
+    public static void beforeClass() {
+        System.loadLibrary("NativeCallTest");
+    }
+
+    @Test
+    public void testFF() {
+        float a = 1.2345678f;
+        float b = 8.7654321f;
+        test("FF", getFF(), float.class, new Class<?>[]{float.class, float.class}, new Object[]{a, b});
+    }
+
+    @Test
+    public void testSDILDS() {
+        float a = 1.2345678f;
+        double b = 3.212434;
+        int c = 43921652;
+        long d = 412435326;
+        double e = .31212333;
+        float f = 8.7654321f;
+        Class<?>[] argClazz = new Class[]{float.class, double.class, int.class, long.class, double.class,
+                        float.class};
+        test("SDILDS", getSDILDS(), float.class, argClazz, new Object[]{a, b, c, d, e, f});
+    }
+
+    @Test
+    public void testF32SDILDS() {
+        int sCount = 32;
+        Object[] remainingArgs = new Object[]{ // Pairs of <Object>, <Class>
+                        1.2345678F, float.class,
+                        3.212434D, double.class,
+                        43921652, int.class,
+                        0xCAFEBABEDEADBEEFL, long.class,
+                        .31212333D, double.class,
+                        8.7654321F, float.class
+        };
+        Class<?>[] argClazz = new Class[sCount + remainingArgs.length / 2];
+        Object[] argValues = new Object[sCount + remainingArgs.length / 2];
+        for (int i = 0; i < sCount; i++) {
+            argValues[i] = (float) i;
+            argClazz[i] = float.class;
+        }
+        for (int i = 0; i < remainingArgs.length; i += 2) {
+            argValues[sCount + i / 2] = remainingArgs[i + 0];
+            argClazz[sCount + i / 2] = (Class<?>) remainingArgs[i + 1];
+        }
+        test("F32SDILDS", getF32SDILDS(), float.class, argClazz, argValues);
+    }
+
+    @Test
+    public void testI32SDILDS() {
+        int sCount = 32;
+        Object[] remainingArgs = new Object[]{ // Pairs of <Object>, <Class>
+                        1.2345678F, float.class,
+                        3.212434D, double.class,
+                        43921652, int.class,
+                        0xCAFEBABEDEADBEEFL, long.class,
+                        .31212333D, double.class,
+                        8.7654321F, float.class
+        };
+        Class<?>[] argClazz = new Class[sCount + remainingArgs.length / 2];
+        Object[] argValues = new Object[sCount + remainingArgs.length / 2];
+        for (int i = 0; i < sCount; i++) {
+            argValues[i] = i;
+            argClazz[i] = int.class;
+        }
+        for (int i = 0; i < remainingArgs.length; i += 2) {
+            argValues[sCount + i / 2] = remainingArgs[i + 0];
+            argClazz[sCount + i / 2] = (Class<?>) remainingArgs[i + 1];
+        }
+        test("I32SDILDS", getI32SDILDS(), float.class, argClazz, argValues);
+    }
+
+    public void test(String name, long addr, Class<?> returnClazz, Class<?>[] types, Object[] values) {
+        try {
+            test(asm -> {
+                JavaType[] argTypes = new JavaType[types.length];
+                int i = 0;
+                for (Class<?> clazz : types) {
+                    argTypes[i++] = metaAccess.lookupJavaType(clazz);
+                }
+                JavaType returnType = metaAccess.lookupJavaType(returnClazz);
+                CallingConvention cc = codeCache.getRegisterConfig().getCallingConvention(NativeCall, returnType, argTypes, asm.valueKindFactory);
+                asm.emitCallPrologue(cc, values);
+                asm.emitCall(addr);
+                asm.emitCallEpilogue(cc);
+                asm.emitFloatRet(((RegisterValue) cc.getReturn()).getRegister());
+            }, getMethod(name, types), values);
+        } catch (Throwable e) {
+            e.printStackTrace();
+            throw e;
+        }
+    }
+
+    public static native long getFF();
+
+    public static native float _FF(float a, float b);
+
+    public static float FF(float a, float b) {
+        return _FF(a, b);
+    }
+
+    public static native long getSDILDS();
+
+    public static native float _SDILDS(float a, double b, int c, long d, double e, float f);
+
+    public static float SDILDS(float a, double b, int c, long d, double e, float f) {
+        return _SDILDS(a, b, c, d, e, f);
+    }
+
+    public static native long getF32SDILDS();
+
+    public static native float _F32SDILDS(float f00, float f01, float f02, float f03, float f04, float f05, float f06, float f07,
+                    float f08, float f09, float f0a, float f0b, float f0c, float f0d, float f0e, float f0f,
+                    float f10, float f11, float f12, float f13, float f14, float f15, float f16, float f17,
+                    float f18, float f19, float f1a, float f1b, float f1c, float f1d, float f1e, float f1f,
+                    float a, double b, int c, long d, double e, float f);
+
+    public static float F32SDILDS(float f00, float f01, float f02, float f03, float f04, float f05, float f06, float f07,
+                    float f08, float f09, float f0a, float f0b, float f0c, float f0d, float f0e, float f0f,
+                    float f10, float f11, float f12, float f13, float f14, float f15, float f16, float f17,
+                    float f18, float f19, float f1a, float f1b, float f1c, float f1d, float f1e, float f1f,
+                    float a, double b, int c, long d, double e, float f) {
+        return _F32SDILDS(f00, f01, f02, f03, f04, f05, f06, f07,
+                        f08, f09, f0a, f0b, f0c, f0d, f0e, f0f,
+                        f10, f11, f12, f13, f14, f15, f16, f17,
+                        f18, f19, f1a, f1b, f1c, f1d, f1e, f1f,
+                        a, b, c, d, e, f);
+    }
+
+    public static native long getD32SDILDS();
+
+    public static native float _D32SDILDS(double d00, double d01, double d02, double d03, double d04, double d05, double d06, double d07,
+                    double d08, double d09, double d0a, double d0b, double d0c, double d0d, double d0e, double d0f,
+                    double d10, double d11, double d12, double d13, double d14, double d15, double d16, double d17,
+                    double d18, double d19, double d1a, double d1b, double d1c, double d1d, double d1e, double d1f,
+                    float a, double b, int c, long d, double e, float f);
+
+    public static float D32SDILDS(double d00, double d01, double d02, double d03, double d04, double d05, double d06, double d07,
+                    double d08, double d09, double d0a, double d0b, double d0c, double d0d, double d0e, double d0f,
+                    double d10, double d11, double d12, double d13, double d14, double d15, double d16, double d17,
+                    double d18, double d19, double d1a, double d1b, double d1c, double d1d, double d1e, double d1f,
+                    float a, double b, int c, long d, double e, float f) {
+        return _D32SDILDS(d00, d01, d02, d03, d04, d05, d06, d07,
+                        d08, d09, d0a, d0b, d0c, d0d, d0e, d0d,
+                        d10, d11, d12, d13, d14, d15, d16, d17,
+                        d18, d19, d1a, d1b, d1c, d1d, d1e, d1f,
+                        a, b, c, d, e, f);
+    }
+
+    public static native long getI32SDILDS();
+
+    public static native float _I32SDILDS(int i00, int i01, int i02, int i03, int i04, int i05, int i06, int i07,
+                    int i08, int i09, int i0a, int i0b, int i0c, int i0d, int i0e, int i0f,
+                    int i10, int i11, int i12, int i13, int i14, int i15, int i16, int i17,
+                    int i18, int i19, int i1a, int i1b, int i1c, int i1d, int i1e, int i1f,
+                    float a, double b, int c, long d, double e, float f);
+
+    public static float I32SDILDS(int i00, int i01, int i02, int i03, int i04, int i05, int i06, int i07,
+                    int i08, int i09, int i0a, int i0b, int i0c, int i0d, int i0e, int i0f,
+                    int i10, int i11, int i12, int i13, int i14, int i15, int i16, int i17,
+                    int i18, int i19, int i1a, int i1b, int i1c, int i1d, int i1e, int i1f,
+                    float a, double b, int c, long d, double e, float f) {
+        return _I32SDILDS(i00, i01, i02, i03, i04, i05, i06, i07,
+                        i08, i09, i0a, i0b, i0c, i0d, i0e, i0f,
+                        i10, i11, i12, i13, i14, i15, i16, i17,
+                        i18, i19, i1a, i1b, i1c, i1d, i1e, i1f,
+                        a, b, c, d, e, f);
+    }
+
+    public static native long getL32SDILDS();
+
+    public static native float _L32SDILDS(long l00, long l01, long l02, long l03, long l04, long l05, long l06, long l07,
+                    long l08, long l09, long l0a, long l0b, long l0c, long l0d, long l0e, long l0f,
+                    long l10, long l11, long l12, long l13, long l14, long l15, long l16, long l17,
+                    long l18, long l19, long l1a, long l1b, long l1c, long l1d, long l1e, long l1f,
+                    float a, double b, int c, long d, double e, float f);
+
+    public static float L32SDILDS(long l00, long l01, long l02, long l03, long l04, long l05, long l06, long l07,
+                    long l08, long l09, long l0a, long l0b, long l0c, long l0d, long l0e, long l0f,
+                    long l10, long l11, long l12, long l13, long l14, long l15, long l16, long l17,
+                    long l18, long l19, long l1a, long l1b, long l1c, long l1d, long l1e, long l1f,
+                    float a, double b, int c, long d, double e, float f) {
+        return _L32SDILDS(l00, l01, l02, l03, l04, l05, l06, l07,
+                        l08, l09, l0a, l0b, l0c, l0d, l0e, l0f,
+                        l10, l11, l12, l13, l14, l15, l16, l17,
+                        l18, l19, l1a, l1b, l1c, l1d, l1e, l1f,
+                        a, b, c, d, e, f);
+    }
+}
diff --git a/hotspot/test/compiler/jvmci/jdk.vm.ci.code.test/src/jdk/vm/ci/code/test/SimpleCodeInstallationTest.java b/hotspot/test/compiler/jvmci/jdk.vm.ci.code.test/src/jdk/vm/ci/code/test/SimpleCodeInstallationTest.java
index 57496ed..1f69fc8 100644
--- a/hotspot/test/compiler/jvmci/jdk.vm.ci.code.test/src/jdk/vm/ci/code/test/SimpleCodeInstallationTest.java
+++ b/hotspot/test/compiler/jvmci/jdk.vm.ci.code.test/src/jdk/vm/ci/code/test/SimpleCodeInstallationTest.java
@@ -38,9 +38,8 @@
 
 package jdk.vm.ci.code.test;
 
-import org.junit.Test;
-
 import jdk.vm.ci.code.Register;
+import org.junit.Test;
 
 /**
  * Test simple code installation.
diff --git a/hotspot/test/compiler/jvmci/jdk.vm.ci.code.test/src/jdk/vm/ci/code/test/SimpleDebugInfoTest.java b/hotspot/test/compiler/jvmci/jdk.vm.ci.code.test/src/jdk/vm/ci/code/test/SimpleDebugInfoTest.java
index f44c480..85c7b45 100644
--- a/hotspot/test/compiler/jvmci/jdk.vm.ci.code.test/src/jdk/vm/ci/code/test/SimpleDebugInfoTest.java
+++ b/hotspot/test/compiler/jvmci/jdk.vm.ci.code.test/src/jdk/vm/ci/code/test/SimpleDebugInfoTest.java
@@ -38,15 +38,14 @@
 
 package jdk.vm.ci.code.test;
 
-import org.junit.Assume;
-import org.junit.Test;
-
 import jdk.vm.ci.code.Register;
 import jdk.vm.ci.hotspot.HotSpotConstant;
 import jdk.vm.ci.meta.JavaConstant;
 import jdk.vm.ci.meta.JavaKind;
 import jdk.vm.ci.meta.ResolvedJavaType;
 import jdk.vm.ci.meta.Value;
+import org.junit.Assume;
+import org.junit.Test;
 
 public class SimpleDebugInfoTest extends DebugInfoTest {
 
diff --git a/hotspot/test/compiler/jvmci/jdk.vm.ci.code.test/src/jdk/vm/ci/code/test/TestAssembler.java b/hotspot/test/compiler/jvmci/jdk.vm.ci.code.test/src/jdk/vm/ci/code/test/TestAssembler.java
index 44b1d4b..016b2ee 100644
--- a/hotspot/test/compiler/jvmci/jdk.vm.ci.code.test/src/jdk/vm/ci/code/test/TestAssembler.java
+++ b/hotspot/test/compiler/jvmci/jdk.vm.ci.code.test/src/jdk/vm/ci/code/test/TestAssembler.java
@@ -23,15 +23,12 @@
 
 package jdk.vm.ci.code.test;
 
-import java.nio.ByteBuffer;
-import java.nio.ByteOrder;
-import java.util.ArrayList;
-import java.util.Arrays;
-
+import jdk.vm.ci.code.CallingConvention;
 import jdk.vm.ci.code.CodeCacheProvider;
 import jdk.vm.ci.code.DebugInfo;
 import jdk.vm.ci.code.Register;
 import jdk.vm.ci.code.StackSlot;
+import jdk.vm.ci.code.ValueKindFactory;
 import jdk.vm.ci.code.site.Call;
 import jdk.vm.ci.code.site.ConstantReference;
 import jdk.vm.ci.code.site.DataPatch;
@@ -46,13 +43,19 @@
 import jdk.vm.ci.hotspot.HotSpotCompiledNmethod;
 import jdk.vm.ci.hotspot.HotSpotConstant;
 import jdk.vm.ci.hotspot.HotSpotResolvedJavaMethod;
+import jdk.vm.ci.meta.AllocatableValue;
 import jdk.vm.ci.meta.Assumptions.Assumption;
 import jdk.vm.ci.meta.InvokeTarget;
 import jdk.vm.ci.meta.JavaKind;
 import jdk.vm.ci.meta.PlatformKind;
 import jdk.vm.ci.meta.ResolvedJavaMethod;
-import jdk.vm.ci.meta.ValueKind;
 import jdk.vm.ci.meta.VMConstant;
+import jdk.vm.ci.meta.ValueKind;
+
+import java.nio.ByteBuffer;
+import java.nio.ByteOrder;
+import java.util.ArrayList;
+import java.util.Arrays;
 
 /**
  * Simple assembler used by the code installation tests.
@@ -145,6 +148,11 @@
     public abstract StackSlot emitFloatToStack(Register a);
 
     /**
+     * Emit code to store a double-precision float from a register to a new stack slot.
+     */
+    public abstract StackSlot emitDoubleToStack(Register a);
+
+    /**
      * Emit code to store a wide pointer from a register to a new stack slot.
      */
     public abstract StackSlot emitPointerToStack(Register a);
@@ -165,6 +173,11 @@
     public abstract void emitIntRet(Register a);
 
     /**
+     * Emit code to return from a function, returning a single precision float.
+     */
+    public abstract void emitFloatRet(Register a);
+
+    /**
      * Emit code to return from a function, returning a wide oop pointer.
      */
     public abstract void emitPointerRet(Register a);
@@ -193,7 +206,13 @@
 
     private StackSlot deoptRescue;
 
-    private static class TestValueKind extends ValueKind<TestValueKind> {
+    public ValueKindFactory<TestValueKind> valueKindFactory = new ValueKindFactory<TestAssembler.TestValueKind>() {
+        public TestValueKind getValueKind(JavaKind javaKind) {
+            return (TestValueKind) TestAssembler.this.getValueKind(javaKind);
+        }
+    };
+
+    static class TestValueKind extends ValueKind<TestValueKind> {
 
         TestValueKind(PlatformKind kind) {
             super(kind);
@@ -340,6 +359,11 @@
             data.putFloat(f);
         }
 
+        public void emitDouble(double f) {
+            ensureSize(data.position() + 8);
+            data.putDouble(f);
+        }
+
         public void align(int alignment) {
             int pos = data.position();
             int misaligned = pos % alignment;
@@ -353,4 +377,27 @@
             return Arrays.copyOf(data.array(), data.position());
         }
     }
+
+    /**
+     * Loads a primitive into the Allocatable <code>av</code>. Implementors may only implement
+     * primitive types.
+     */
+    public abstract void emitLoad(AllocatableValue av, Object prim);
+
+    /**
+     * Emit a call to a fixed address <code>addr</code>
+     */
+    public abstract void emitCall(long addr);
+
+    /**
+     * Emit code which is necessary to call a method with {@link CallingConvention} <code>cc</code>
+     * and arguments <coe>prim</code>.
+     */
+    public abstract void emitCallPrologue(CallingConvention cc, Object... prim);
+
+    /**
+     * Emit code which is necessary after calling a method with CallingConvention <code>cc</code>.
+     */
+    public abstract void emitCallEpilogue(CallingConvention cc);
+
 }
diff --git a/hotspot/test/compiler/jvmci/jdk.vm.ci.code.test/src/jdk/vm/ci/code/test/VirtualObjectDebugInfoTest.java b/hotspot/test/compiler/jvmci/jdk.vm.ci.code.test/src/jdk/vm/ci/code/test/VirtualObjectDebugInfoTest.java
index d08f612..bee4f8d 100644
--- a/hotspot/test/compiler/jvmci/jdk.vm.ci.code.test/src/jdk/vm/ci/code/test/VirtualObjectDebugInfoTest.java
+++ b/hotspot/test/compiler/jvmci/jdk.vm.ci.code.test/src/jdk/vm/ci/code/test/VirtualObjectDebugInfoTest.java
@@ -38,12 +38,6 @@
 
 package jdk.vm.ci.code.test;
 
-import java.util.ArrayList;
-import java.util.Objects;
-
-import org.junit.Assert;
-import org.junit.Test;
-
 import jdk.vm.ci.code.Register;
 import jdk.vm.ci.code.VirtualObject;
 import jdk.vm.ci.hotspot.HotSpotConstant;
@@ -52,6 +46,11 @@
 import jdk.vm.ci.meta.JavaValue;
 import jdk.vm.ci.meta.ResolvedJavaField;
 import jdk.vm.ci.meta.ResolvedJavaType;
+import org.junit.Assert;
+import org.junit.Test;
+
+import java.util.ArrayList;
+import java.util.Objects;
 
 public class VirtualObjectDebugInfoTest extends DebugInfoTest {
 
diff --git a/hotspot/test/compiler/jvmci/jdk.vm.ci.code.test/src/jdk/vm/ci/code/test/amd64/AMD64TestAssembler.java b/hotspot/test/compiler/jvmci/jdk.vm.ci.code.test/src/jdk/vm/ci/code/test/amd64/AMD64TestAssembler.java
index 078af12..fd1eff6 100644
--- a/hotspot/test/compiler/jvmci/jdk.vm.ci.code.test/src/jdk/vm/ci/code/test/amd64/AMD64TestAssembler.java
+++ b/hotspot/test/compiler/jvmci/jdk.vm.ci.code.test/src/jdk/vm/ci/code/test/amd64/AMD64TestAssembler.java
@@ -23,11 +23,15 @@
 
 package jdk.vm.ci.code.test.amd64;
 
+import static jdk.vm.ci.amd64.AMD64.xmm0;
+
 import jdk.vm.ci.amd64.AMD64;
 import jdk.vm.ci.amd64.AMD64Kind;
+import jdk.vm.ci.code.CallingConvention;
 import jdk.vm.ci.code.CodeCacheProvider;
 import jdk.vm.ci.code.DebugInfo;
 import jdk.vm.ci.code.Register;
+import jdk.vm.ci.code.RegisterValue;
 import jdk.vm.ci.code.StackSlot;
 import jdk.vm.ci.code.site.ConstantReference;
 import jdk.vm.ci.code.site.DataSectionReference;
@@ -36,11 +40,15 @@
 import jdk.vm.ci.hotspot.HotSpotCallingConventionType;
 import jdk.vm.ci.hotspot.HotSpotConstant;
 import jdk.vm.ci.hotspot.HotSpotForeignCallTarget;
+import jdk.vm.ci.meta.AllocatableValue;
 import jdk.vm.ci.meta.JavaKind;
 import jdk.vm.ci.meta.VMConstant;
 
 public class AMD64TestAssembler extends TestAssembler {
 
+    private static final Register scratchRegister = AMD64.r12;
+    private static final Register doubleScratch = AMD64.xmm15;
+
     public AMD64TestAssembler(CodeCacheProvider codeCache, TestHotSpotVMConfig config) {
         super(codeCache, config, 16, 16, AMD64Kind.DWORD, AMD64.rax, AMD64.rcx, AMD64.rdi, AMD64.r8, AMD64.r9, AMD64.r10);
     }
@@ -116,6 +124,10 @@
     @Override
     public Register emitLoadInt(int c) {
         Register ret = newRegister();
+        return emitLoadInt(ret, c);
+    }
+
+    public Register emitLoadInt(Register ret, int c) {
         emitREX(false, 0, 0, ret.encoding);
         code.emitByte(0xB8 | (ret.encoding & 0x7)); // MOV r32, imm32
         code.emitInt(c);
@@ -125,6 +137,10 @@
     @Override
     public Register emitLoadLong(long c) {
         Register ret = newRegister();
+        return emitLoadLong(ret, c);
+    }
+
+    public Register emitLoadLong(Register ret, long c) {
         emitREX(true, 0, 0, ret.encoding);
         code.emitByte(0xB8 | (ret.encoding & 0x7)); // MOV r64, imm64
         code.emitLong(c);
@@ -133,12 +149,16 @@
 
     @Override
     public Register emitLoadFloat(float c) {
+        Register ret = AMD64.xmm0;
+        return emitLoadFloat(ret, c);
+    }
+
+    public Register emitLoadFloat(Register ret, float c) {
         DataSectionReference ref = new DataSectionReference();
         ref.setOffset(data.position());
         data.emitFloat(c);
 
         recordDataPatchInCode(ref);
-        Register ret = AMD64.xmm0;
         emitREX(false, ret.encoding, 0, 0);
         code.emitByte(0xF3);
         code.emitByte(0x0F);
@@ -148,6 +168,26 @@
         return ret;
     }
 
+    public Register emitLoadDouble(double c) {
+        Register ret = AMD64.xmm0;
+        return emitLoadDouble(ret, c);
+    }
+
+    public Register emitLoadDouble(Register ret, double c) {
+        DataSectionReference ref = new DataSectionReference();
+        ref.setOffset(data.position());
+        data.emitDouble(c);
+
+        recordDataPatchInCode(ref);
+        emitREX(false, ret.encoding, 0, 0);
+        code.emitByte(0xF2);
+        code.emitByte(0x0F);
+        code.emitByte(0x10);                               // MOVSD xmm1, xmm2/m32
+        code.emitByte(0x05 | ((ret.encoding & 0x7) << 3)); // xmm, [rip+offset]
+        code.emitInt(0xDEADDEAD);
+        return ret;
+    }
+
     @Override
     public Register emitLoadPointer(HotSpotConstant c) {
         recordDataPatchInCode(new ConstantReference((VMConstant) c));
@@ -189,31 +229,67 @@
         return ret;
     }
 
+    private int getAdjustedOffset(StackSlot ret) {
+        if (ret.getRawOffset() < 0) {
+            return ret.getRawOffset() + 16;
+        } else {
+            return -(frameSize - ret.getRawOffset()) + 16;
+        }
+    }
+
     @Override
     public StackSlot emitIntToStack(Register a) {
         StackSlot ret = newStackSlot(AMD64Kind.DWORD);
+        return emitIntToStack(ret, a);
+    }
+
+    public StackSlot emitIntToStack(StackSlot ret, Register a) {
         // MOV r/m32,r32
-        emitModRMMemory(false, 0x89, a.encoding, AMD64.rbp.encoding, ret.getRawOffset() + 16);
+        emitModRMMemory(false, 0x89, a.encoding, AMD64.rbp.encoding, getAdjustedOffset(ret));
         return ret;
     }
 
     @Override
     public StackSlot emitLongToStack(Register a) {
         StackSlot ret = newStackSlot(AMD64Kind.QWORD);
+        return emitLongToStack(ret, a);
+    }
+
+    public StackSlot emitLongToStack(StackSlot ret, Register a) {
         // MOV r/m64,r64
-        emitModRMMemory(true, 0x89, a.encoding, AMD64.rbp.encoding, ret.getRawOffset() + 16);
+        emitModRMMemory(true, 0x89, a.encoding, AMD64.rbp.encoding, getAdjustedOffset(ret));
         return ret;
     }
 
     @Override
     public StackSlot emitFloatToStack(Register a) {
         StackSlot ret = newStackSlot(AMD64Kind.SINGLE);
+        return emitFloatToStack(ret, a);
+    }
+
+    public StackSlot emitFloatToStack(StackSlot ret, Register a) {
         emitREX(false, a.encoding, 0, 0);
         code.emitByte(0xF3);
         code.emitByte(0x0F);
         code.emitByte(0x11);                               // MOVSS xmm2/m32, xmm1
         code.emitByte(0x85 | ((a.encoding & 0x7) << 3));   // [rbp+offset]
-        code.emitInt(ret.getRawOffset() + 16);
+        code.emitInt(getAdjustedOffset(ret));
+        return ret;
+    }
+
+    @Override
+    public StackSlot emitDoubleToStack(Register a) {
+        StackSlot ret = newStackSlot(AMD64Kind.DOUBLE);
+        return emitDoubleToStack(ret, a);
+    }
+
+    public StackSlot emitDoubleToStack(StackSlot ret, Register a) {
+        emitREX(false, a.encoding, 0, 0);
+        code.emitByte(0xF2);
+        code.emitByte(0x0F);
+        code.emitByte(0x11);                               // MOVSD xmm2/m32, xmm1
+        code.emitByte(0x85 | ((a.encoding & 0x7) << 3));   // [rbp+offset]
+        code.emitInt(getAdjustedOffset(ret));
         return ret;
     }
 
@@ -269,6 +345,14 @@
     }
 
     @Override
+    public void emitFloatRet(Register a) {
+        assert a == xmm0 : "Unimplemented move " + a;
+        emitMove(true, AMD64.rsp, AMD64.rbp);      // MOV rsp, rbp
+        code.emitByte(0x58 | AMD64.rbp.encoding);  // POP rbp
+        code.emitByte(0xC3);                       // RET
+    }
+
+    @Override
     public void emitPointerRet(Register a) {
         emitMove(true, AMD64.rax, a);              // MOV rax, ...
         emitMove(true, AMD64.rsp, AMD64.rbp);      // MOV rsp, rbp
@@ -285,4 +369,65 @@
         code.emitByte(0x25);
         code.emitInt(0);
     }
+
+    @Override
+    public void emitLoad(AllocatableValue av, Object prim) {
+        if (av instanceof RegisterValue) {
+            Register reg = ((RegisterValue) av).getRegister();
+            if (prim instanceof Float) {
+                emitLoadFloat(reg, (Float) prim);
+            } else if (prim instanceof Double) {
+                emitLoadDouble(reg, (Double) prim);
+            } else if (prim instanceof Integer) {
+                emitLoadInt(reg, (Integer) prim);
+            } else if (prim instanceof Long) {
+                emitLoadLong(reg, (Long) prim);
+            }
+        } else if (av instanceof StackSlot) {
+            StackSlot slot = (StackSlot) av;
+            if (prim instanceof Float) {
+                emitFloatToStack(slot, emitLoadFloat(doubleScratch, (Float) prim));
+            } else if (prim instanceof Double) {
+                emitDoubleToStack(slot, emitLoadDouble(doubleScratch, (Double) prim));
+            } else if (prim instanceof Integer) {
+                emitIntToStack(slot, emitLoadInt(scratchRegister, (Integer) prim));
+            } else if (prim instanceof Long) {
+                emitLongToStack(slot, emitLoadLong(scratchRegister, (Long) prim));
+            } else {
+                assert false : "Unimplemented";
+            }
+        } else {
+            throw new IllegalArgumentException("Unknown value " + av);
+        }
+    }
+
+    @Override
+    public void emitCallPrologue(CallingConvention cc, Object... prim) {
+        emitGrowStack(cc.getStackSize());
+        frameSize += cc.getStackSize();
+        AllocatableValue[] args = cc.getArguments();
+        // Do the emission in reverse, this avoids register collisons of xmm0 - which is used a
+        // scratch register when putting arguments on the stack.
+        for (int i = args.length - 1; i >= 0; i--) {
+            emitLoad(args[i], prim[i]);
+        }
+    }
+
+    @Override
+    public void emitCall(long addr) {
+        Register target = emitLoadLong(addr);
+        code.emitByte(0xFF); // CALL r/m64
+        int enc = target.encoding;
+        if (enc >= 8) {
+            code.emitByte(0x41);
+            enc -= 8;
+        }
+        code.emitByte(0xD0 | enc);
+    }
+
+    @Override
+    public void emitCallEpilogue(CallingConvention cc) {
+        emitGrowStack(-cc.getStackSize());
+        frameSize -= cc.getStackSize();
+    }
 }
diff --git a/hotspot/test/compiler/jvmci/jdk.vm.ci.code.test/src/jdk/vm/ci/code/test/sparc/SPARCTestAssembler.java b/hotspot/test/compiler/jvmci/jdk.vm.ci.code.test/src/jdk/vm/ci/code/test/sparc/SPARCTestAssembler.java
index 26826fa..0ac920a 100644
--- a/hotspot/test/compiler/jvmci/jdk.vm.ci.code.test/src/jdk/vm/ci/code/test/sparc/SPARCTestAssembler.java
+++ b/hotspot/test/compiler/jvmci/jdk.vm.ci.code.test/src/jdk/vm/ci/code/test/sparc/SPARCTestAssembler.java
@@ -23,9 +23,12 @@
 
 package jdk.vm.ci.code.test.sparc;
 
+import jdk.vm.ci.code.CallingConvention;
 import jdk.vm.ci.code.CodeCacheProvider;
 import jdk.vm.ci.code.DebugInfo;
 import jdk.vm.ci.code.Register;
+import jdk.vm.ci.code.Register.RegisterCategory;
+import jdk.vm.ci.code.RegisterValue;
 import jdk.vm.ci.code.StackSlot;
 import jdk.vm.ci.code.site.ConstantReference;
 import jdk.vm.ci.code.site.DataSectionReference;
@@ -36,6 +39,7 @@
 import jdk.vm.ci.hotspot.HotSpotConstant;
 import jdk.vm.ci.hotspot.HotSpotForeignCallTarget;
 import jdk.vm.ci.hotspot.HotSpotResolvedJavaMethod;
+import jdk.vm.ci.meta.AllocatableValue;
 import jdk.vm.ci.meta.JavaKind;
 import jdk.vm.ci.meta.VMConstant;
 import jdk.vm.ci.sparc.SPARC;
@@ -44,6 +48,9 @@
 public class SPARCTestAssembler extends TestAssembler {
 
     private static final int MASK13 = (1 << 13) - 1;
+    private static final Register scratchRegister = SPARC.g5;
+    private static final Register floatScratch = SPARC.f30;
+    private static final Register doubleScratch = SPARC.d62;
 
     public SPARCTestAssembler(CodeCacheProvider codeCache, TestHotSpotVMConfig config) {
         super(codeCache, config, 0, 16, SPARCKind.WORD, SPARC.l0, SPARC.l1, SPARC.l2, SPARC.l3, SPARC.l4, SPARC.l5, SPARC.l6, SPARC.l7);
@@ -136,7 +143,7 @@
         return ret;
     }
 
-    private void loadIntToRegister(int c, Register ret) {
+    private Register loadIntToRegister(int c, Register ret) {
         int hi = c >>> 10;
         int lo = c & ((1 << 10) - 1);
         if (hi == 0) {
@@ -147,6 +154,7 @@
                 emitOp3(0b10, ret, 0b000010, ret, lo);  // OR ret, lo, ret
             }
         }
+        return ret;
     }
 
     @Override
@@ -164,12 +172,13 @@
         emitLoadPointerToRegister(ref, ret);
     }
 
-    public void emitLoadLongToRegister(long c, Register r) {
+    public Register emitLoadLongToRegister(long c, Register r) {
         if ((c & 0xFFFF_FFFFL) == c) {
             loadIntToRegister((int) c, r);
         } else {
             loadLongToRegister(c, r);
         }
+        return r;
     }
 
     private void emitPatchableSethi(Register ret, boolean wide) {
@@ -185,16 +194,39 @@
 
     @Override
     public Register emitLoadFloat(float c) {
+        return emitLoadFloat(SPARC.f0, c);
+    }
+
+    public Register emitLoadFloat(Register reg, float c) {
+        return emitLoadFloat(reg, c, newRegister());
+    }
+
+    public Register emitLoadFloat(Register reg, float c, Register scratch) {
         DataSectionReference ref = new DataSectionReference();
         data.align(4);
         ref.setOffset(data.position());
         data.emitFloat(c);
 
-        Register ptr = newRegister();
         recordDataPatchInCode(ref);
-        emitPatchableSethi(ptr, true);
-        emitOp3(0b11, SPARC.f0, 0b100000, ptr, 0); // LDF [ptr+0], f0
-        return SPARC.f0;
+        emitPatchableSethi(scratch, true);
+        emitOp3(0b11, reg, 0b100000, scratch, 0); // LDF [scratch+0], f0
+        return reg;
+    }
+
+    public Register emitLoadDouble(Register reg, double c) {
+        return emitLoadDouble(reg, c, newRegister());
+    }
+
+    public Register emitLoadDouble(Register reg, double c, Register scratch) {
+        DataSectionReference ref = new DataSectionReference();
+        data.align(8);
+        ref.setOffset(data.position());
+        data.emitDouble(c);
+
+        recordDataPatchInCode(ref);
+        emitPatchableSethi(scratch, true);
+        emitOp3(0b11, reg, 0b100011, scratch, 0); // LDDF [ptr+0], f0
+        return reg;
     }
 
     @Override
@@ -240,24 +272,48 @@
     @Override
     public StackSlot emitIntToStack(Register a) {
         StackSlot ret = newStackSlot(SPARCKind.WORD);
-        // STW a, [fp+offset]
-        emitStore(0b000100, a, ret);
+        intToStack(a, ret);
         return ret;
     }
 
+    public void intToStack(Register a, StackSlot ret) {
+        // STW a, [(s|f)p+offset]
+        emitStore(0b000100, a, ret);
+    }
+
     @Override
     public StackSlot emitLongToStack(Register a) {
         StackSlot ret = newStackSlot(SPARCKind.XWORD);
-        // STX a, [sp+offset]
-        emitStore(0b001110, a, ret);
+        longToStack(a, ret);
         return ret;
     }
 
+    public void longToStack(Register a, StackSlot ret) {
+        // STX a, [(f|s)p+offset]
+        emitStore(0b001110, a, ret);
+    }
+
     @Override
     public StackSlot emitFloatToStack(Register a) {
         StackSlot ret = newStackSlot(SPARCKind.SINGLE);
+        floatToStack(a, ret);
+        return ret;
+    }
+
+    public void floatToStack(Register a, StackSlot ret) {
         // STF a, [fp+offset]
         emitStore(0b100100, a, ret);
+    }
+
+    @Override
+    public StackSlot emitDoubleToStack(Register a) {
+        StackSlot ret = newStackSlot(SPARCKind.DOUBLE);
+        return doubleToStack(a, ret);
+    }
+
+    public StackSlot doubleToStack(Register a, StackSlot ret) {
+        // STD a, [(s|f)p+offset]
+        emitStore(0b100111, a, ret);
         return ret;
     }
 
@@ -278,16 +334,22 @@
     }
 
     private void emitStore(int op3, Register a, StackSlot ret) {
+        Register base;
+        if (ret.getRawOffset() < 0) {
+            base = SPARC.fp;
+        } else {
+            base = SPARC.sp;
+        }
         int offset = ret.getRawOffset() + SPARC.STACK_BIAS;
         if (isSimm(offset, 13)) {
             // op3 a, [sp+offset]
-            emitOp3(0b11, a, op3, SPARC.fp, offset);
+            emitOp3(0b11, a, op3, base, offset);
         } else {
             assert a != SPARC.g3;
             Register r = SPARC.g3;
             loadLongToRegister(offset, r);
             // op3 a, [sp+g3]
-            emitOp3(0b11, a, op3, SPARC.fp, r);
+            emitOp3(0b11, a, op3, base, r);
         }
     }
 
@@ -328,6 +390,13 @@
     }
 
     @Override
+    public void emitFloatRet(Register a) {
+        assert a == SPARC.f0 : "Unimplemented";
+        emitOp3(0b10, SPARC.g0, 0b111000, SPARC.i7, 8);        // JMPL [i7+8], g0
+        emitOp3(0b10, SPARC.g0, 0b111101, SPARC.g0, SPARC.g0); // RESTORE g0, g0, g0
+    }
+
+    @Override
     public void emitPointerRet(Register a) {
         emitMove(SPARC.i0, a);
         emitOp3(0b10, SPARC.g0, 0b111000, SPARC.i7, 8);        // JMPL [i7+8], g0
@@ -349,4 +418,57 @@
         }
         return super.emitDataItem(c);
     }
+
+    @Override
+    public void emitCall(long addr) {
+        Register dst = emitLoadLong(addr);
+        emitOp3(0b10, SPARC.o7, 0b111000, dst, 0);        // JMPL [dst+0], o7
+        emitNop();
+    }
+
+    @Override
+    public void emitLoad(AllocatableValue av, Object prim) {
+        if (av instanceof RegisterValue) {
+            Register reg = ((RegisterValue) av).getRegister();
+            RegisterCategory cat = reg.getRegisterCategory();
+            if (cat.equals(SPARC.FPUs)) {
+                emitLoadFloat(reg, (Float) prim, scratchRegister);
+            } else if (cat.equals(SPARC.FPUd)) {
+                emitLoadDouble(reg, (Double) prim, scratchRegister);
+            } else if (prim instanceof Integer) {
+                loadIntToRegister((Integer) prim, reg);
+            } else if (prim instanceof Long) {
+                loadLongToRegister((Long) prim, reg);
+            }
+        } else if (av instanceof StackSlot) {
+            StackSlot slot = (StackSlot) av;
+            if (prim instanceof Float) {
+                floatToStack(emitLoadFloat(floatScratch, (Float) prim, scratchRegister), slot);
+            } else if (prim instanceof Double) {
+                doubleToStack(emitLoadDouble(doubleScratch, (Double) prim, scratchRegister), slot);
+            } else if (prim instanceof Integer) {
+                intToStack(loadIntToRegister((Integer) prim, scratchRegister), slot);
+            } else if (prim instanceof Long) {
+                longToStack(emitLoadLongToRegister((Long) prim, scratchRegister), slot);
+            }
+        } else {
+            throw new IllegalArgumentException("Unknown value " + av);
+        }
+    }
+
+    @Override
+    public void emitCallEpilogue(CallingConvention cc) {
+        // Nothing to do here.
+    }
+
+    @Override
+    public void emitCallPrologue(CallingConvention cc, Object... prim) {
+        emitGrowStack(cc.getStackSize());
+        frameSize += cc.getStackSize();
+        AllocatableValue[] args = cc.getArguments();
+        for (int i = 0; i < args.length; i++) {
+            emitLoad(args[i], prim[i]);
+        }
+    }
+
 }
diff --git a/hotspot/test/compiler/jvmci/jdk.vm.ci.hotspot.test/src/jdk/vm/ci/hotspot/test/AsJavaTypeDataProvider.java b/hotspot/test/compiler/jvmci/jdk.vm.ci.hotspot.test/src/jdk/vm/ci/hotspot/test/AsJavaTypeDataProvider.java
index 2278a18..88dd983 100644
--- a/hotspot/test/compiler/jvmci/jdk.vm.ci.hotspot.test/src/jdk/vm/ci/hotspot/test/AsJavaTypeDataProvider.java
+++ b/hotspot/test/compiler/jvmci/jdk.vm.ci.hotspot.test/src/jdk/vm/ci/hotspot/test/AsJavaTypeDataProvider.java
@@ -23,12 +23,12 @@
 
 package jdk.vm.ci.hotspot.test;
 
-import static jdk.vm.ci.hotspot.test.TestHelper.CONSTANT_REFLECTION_PROVIDER;
-import static jdk.vm.ci.hotspot.test.TestHelper.DUMMY_CLASS_INSTANCE;
-
 import jdk.vm.ci.meta.JavaConstant;
 import org.testng.annotations.DataProvider;
 
+import static jdk.vm.ci.hotspot.test.TestHelper.CONSTANT_REFLECTION_PROVIDER;
+import static jdk.vm.ci.hotspot.test.TestHelper.DUMMY_CLASS_INSTANCE;
+
 public class AsJavaTypeDataProvider {
 
     @DataProvider(name = "asJavaTypeDataProvider")
diff --git a/hotspot/test/compiler/jvmci/jdk.vm.ci.hotspot.test/src/jdk/vm/ci/hotspot/test/BoxPrimitiveDataProvider.java b/hotspot/test/compiler/jvmci/jdk.vm.ci.hotspot.test/src/jdk/vm/ci/hotspot/test/BoxPrimitiveDataProvider.java
index cb57b45..af0ce73 100644
--- a/hotspot/test/compiler/jvmci/jdk.vm.ci.hotspot.test/src/jdk/vm/ci/hotspot/test/BoxPrimitiveDataProvider.java
+++ b/hotspot/test/compiler/jvmci/jdk.vm.ci.hotspot.test/src/jdk/vm/ci/hotspot/test/BoxPrimitiveDataProvider.java
@@ -23,13 +23,14 @@
 
 package jdk.vm.ci.hotspot.test;
 
-import static jdk.vm.ci.hotspot.test.TestHelper.CONSTANT_REFLECTION_PROVIDER;
-import static jdk.vm.ci.hotspot.test.TestHelper.DUMMY_CLASS_INSTANCE;
-
-import java.util.LinkedList;
 import jdk.vm.ci.meta.JavaConstant;
 import org.testng.annotations.DataProvider;
 
+import java.util.LinkedList;
+
+import static jdk.vm.ci.hotspot.test.TestHelper.CONSTANT_REFLECTION_PROVIDER;
+import static jdk.vm.ci.hotspot.test.TestHelper.DUMMY_CLASS_INSTANCE;
+
 public class BoxPrimitiveDataProvider {
 
     @DataProvider(name = "boxPrimitiveDataProvider")
diff --git a/hotspot/test/compiler/jvmci/jdk.vm.ci.hotspot.test/src/jdk/vm/ci/hotspot/test/ConstantEqualsDataProvider.java b/hotspot/test/compiler/jvmci/jdk.vm.ci.hotspot.test/src/jdk/vm/ci/hotspot/test/ConstantEqualsDataProvider.java
index dff8c48..494f86f 100644
--- a/hotspot/test/compiler/jvmci/jdk.vm.ci.hotspot.test/src/jdk/vm/ci/hotspot/test/ConstantEqualsDataProvider.java
+++ b/hotspot/test/compiler/jvmci/jdk.vm.ci.hotspot.test/src/jdk/vm/ci/hotspot/test/ConstantEqualsDataProvider.java
@@ -23,15 +23,16 @@
 
 package jdk.vm.ci.hotspot.test;
 
-import static jdk.vm.ci.hotspot.test.TestHelper.CONSTANT_REFLECTION_PROVIDER;
-import static jdk.vm.ci.hotspot.test.TestHelper.DUMMY_CLASS_INSTANCE;
+import jdk.vm.ci.meta.Constant;
+import jdk.vm.ci.meta.JavaConstant;
+import org.testng.annotations.DataProvider;
 
 import java.util.HashMap;
 import java.util.LinkedList;
 import java.util.Objects;
-import jdk.vm.ci.meta.Constant;
-import jdk.vm.ci.meta.JavaConstant;
-import org.testng.annotations.DataProvider;
+
+import static jdk.vm.ci.hotspot.test.TestHelper.CONSTANT_REFLECTION_PROVIDER;
+import static jdk.vm.ci.hotspot.test.TestHelper.DUMMY_CLASS_INSTANCE;
 
 public class ConstantEqualsDataProvider {
     @DataProvider(name = "constantEqualsDataProvider")
diff --git a/hotspot/test/compiler/jvmci/jdk.vm.ci.hotspot.test/src/jdk/vm/ci/hotspot/test/ForStringDataProvider.java b/hotspot/test/compiler/jvmci/jdk.vm.ci.hotspot.test/src/jdk/vm/ci/hotspot/test/ForStringDataProvider.java
index 8db7185..9aa6651 100644
--- a/hotspot/test/compiler/jvmci/jdk.vm.ci.hotspot.test/src/jdk/vm/ci/hotspot/test/ForStringDataProvider.java
+++ b/hotspot/test/compiler/jvmci/jdk.vm.ci.hotspot.test/src/jdk/vm/ci/hotspot/test/ForStringDataProvider.java
@@ -23,10 +23,10 @@
 
 package jdk.vm.ci.hotspot.test;
 
-import static jdk.vm.ci.hotspot.test.TestHelper.DUMMY_CLASS_INSTANCE;
-
 import org.testng.annotations.DataProvider;
 
+import static jdk.vm.ci.hotspot.test.TestHelper.DUMMY_CLASS_INSTANCE;
+
 public class ForStringDataProvider {
     @DataProvider(name = "forStringDataProvider")
     public static Object[][] forStringDataProvider() {
diff --git a/hotspot/test/compiler/jvmci/jdk.vm.ci.hotspot.test/src/jdk/vm/ci/hotspot/test/HotSpotConstantReflectionProviderTest.java b/hotspot/test/compiler/jvmci/jdk.vm.ci.hotspot.test/src/jdk/vm/ci/hotspot/test/HotSpotConstantReflectionProviderTest.java
index 1cc6215..5c9c7c6 100644
--- a/hotspot/test/compiler/jvmci/jdk.vm.ci.hotspot.test/src/jdk/vm/ci/hotspot/test/HotSpotConstantReflectionProviderTest.java
+++ b/hotspot/test/compiler/jvmci/jdk.vm.ci.hotspot.test/src/jdk/vm/ci/hotspot/test/HotSpotConstantReflectionProviderTest.java
@@ -39,12 +39,8 @@
 
 package jdk.vm.ci.hotspot.test;
 
-import static jdk.vm.ci.hotspot.test.TestHelper.CONSTANT_REFLECTION_PROVIDER;
-
-import java.lang.reflect.Method;
-import jdk.vm.ci.hotspot.HotSpotResolvedJavaField;
-import jdk.vm.ci.meta.JavaConstant;
 import jdk.vm.ci.meta.Constant;
+import jdk.vm.ci.meta.JavaConstant;
 import jdk.vm.ci.meta.MemoryAccessProvider;
 import jdk.vm.ci.meta.MethodHandleAccessProvider;
 import jdk.vm.ci.meta.ResolvedJavaField;
@@ -52,6 +48,8 @@
 import org.testng.Assert;
 import org.testng.annotations.Test;
 
+import static jdk.vm.ci.hotspot.test.TestHelper.CONSTANT_REFLECTION_PROVIDER;
+
 public class HotSpotConstantReflectionProviderTest {
 
     @Test(dataProvider = "forObjectDataProvider", dataProviderClass = ForObjectDataProvider.class)
@@ -120,12 +118,6 @@
         Assert.assertEquals(actual, expected, "Unexpected result:");
     }
 
-    @Test(dataProvider = "isEmbeddableDataProvider", dataProviderClass = IsEmbeddableDataProvider.class)
-    public void testIsEmbeddable(JavaConstant constant, boolean expected) {
-        boolean actual = CONSTANT_REFLECTION_PROVIDER.isEmbeddable(constant);
-        Assert.assertEquals(actual, expected, "Unexpected result:");
-    }
-
     @Test
     public void testGetMemoryAccessProvider() {
         MemoryAccessProvider actual = CONSTANT_REFLECTION_PROVIDER.getMemoryAccessProvider();
diff --git a/hotspot/test/compiler/jvmci/jdk.vm.ci.hotspot.test/src/jdk/vm/ci/hotspot/test/IsEmbeddableDataProvider.java b/hotspot/test/compiler/jvmci/jdk.vm.ci.hotspot.test/src/jdk/vm/ci/hotspot/test/IsEmbeddableDataProvider.java
index 62c64a4..004f32c 100644
--- a/hotspot/test/compiler/jvmci/jdk.vm.ci.hotspot.test/src/jdk/vm/ci/hotspot/test/IsEmbeddableDataProvider.java
+++ b/hotspot/test/compiler/jvmci/jdk.vm.ci.hotspot.test/src/jdk/vm/ci/hotspot/test/IsEmbeddableDataProvider.java
@@ -23,12 +23,12 @@
 
 package jdk.vm.ci.hotspot.test;
 
-import static jdk.vm.ci.hotspot.test.TestHelper.CONSTANT_REFLECTION_PROVIDER;
-import static jdk.vm.ci.hotspot.test.TestHelper.DUMMY_CLASS_INSTANCE;
-
 import jdk.vm.ci.meta.JavaConstant;
 import org.testng.annotations.DataProvider;
 
+import static jdk.vm.ci.hotspot.test.TestHelper.CONSTANT_REFLECTION_PROVIDER;
+import static jdk.vm.ci.hotspot.test.TestHelper.DUMMY_CLASS_INSTANCE;
+
 public class IsEmbeddableDataProvider {
     @DataProvider(name = "isEmbeddableDataProvider")
     public static Object[][] isEmbeddableDataProvider() {
diff --git a/hotspot/test/compiler/jvmci/jdk.vm.ci.hotspot.test/src/jdk/vm/ci/hotspot/test/MemoryAccessProviderData.java b/hotspot/test/compiler/jvmci/jdk.vm.ci.hotspot.test/src/jdk/vm/ci/hotspot/test/MemoryAccessProviderData.java
index a880dc4..549cc7b 100644
--- a/hotspot/test/compiler/jvmci/jdk.vm.ci.hotspot.test/src/jdk/vm/ci/hotspot/test/MemoryAccessProviderData.java
+++ b/hotspot/test/compiler/jvmci/jdk.vm.ci.hotspot.test/src/jdk/vm/ci/hotspot/test/MemoryAccessProviderData.java
@@ -23,10 +23,6 @@
 
 package jdk.vm.ci.hotspot.test;
 
-import java.lang.reflect.Field;
-
-import org.testng.annotations.DataProvider;
-
 import jdk.internal.misc.Unsafe;
 import jdk.vm.ci.hotspot.HotSpotConstantReflectionProvider;
 import jdk.vm.ci.hotspot.HotSpotJVMCIRuntimeProvider;
@@ -36,6 +32,9 @@
 import jdk.vm.ci.meta.JavaConstant;
 import jdk.vm.ci.meta.JavaKind;
 import jdk.vm.ci.runtime.JVMCI;
+import org.testng.annotations.DataProvider;
+
+import java.lang.reflect.Field;
 
 public class MemoryAccessProviderData {
     private static final Unsafe UNSAFE = getUnsafe();
diff --git a/hotspot/test/compiler/jvmci/jdk.vm.ci.hotspot.test/src/jdk/vm/ci/hotspot/test/MemoryAccessProviderTest.java b/hotspot/test/compiler/jvmci/jdk.vm.ci.hotspot.test/src/jdk/vm/ci/hotspot/test/MemoryAccessProviderTest.java
index 466e4e3..03e7f68 100644
--- a/hotspot/test/compiler/jvmci/jdk.vm.ci.hotspot.test/src/jdk/vm/ci/hotspot/test/MemoryAccessProviderTest.java
+++ b/hotspot/test/compiler/jvmci/jdk.vm.ci.hotspot.test/src/jdk/vm/ci/hotspot/test/MemoryAccessProviderTest.java
@@ -38,12 +38,11 @@
 package jdk.vm.ci.hotspot.test;
 
 import jdk.vm.ci.meta.Constant;
-import org.testng.annotations.Test;
-import org.testng.Assert;
-import jdk.vm.ci.meta.JavaConstant;
 import jdk.vm.ci.meta.JavaKind;
 import jdk.vm.ci.meta.MemoryAccessProvider;
 import jdk.vm.ci.runtime.JVMCI;
+import org.testng.Assert;
+import org.testng.annotations.Test;
 
 public class MemoryAccessProviderTest {
     private static final MemoryAccessProvider PROVIDER = JVMCI.getRuntime().getHostJVMCIBackend().getConstantReflection().getMemoryAccessProvider();
diff --git a/hotspot/test/compiler/jvmci/jdk.vm.ci.hotspot.test/src/jdk/vm/ci/hotspot/test/MethodHandleAccessProviderData.java b/hotspot/test/compiler/jvmci/jdk.vm.ci.hotspot.test/src/jdk/vm/ci/hotspot/test/MethodHandleAccessProviderData.java
index 7cc4822..49f19a4 100644
--- a/hotspot/test/compiler/jvmci/jdk.vm.ci.hotspot.test/src/jdk/vm/ci/hotspot/test/MethodHandleAccessProviderData.java
+++ b/hotspot/test/compiler/jvmci/jdk.vm.ci.hotspot.test/src/jdk/vm/ci/hotspot/test/MethodHandleAccessProviderData.java
@@ -23,6 +23,13 @@
 
 package jdk.vm.ci.hotspot.test;
 
+import jdk.vm.ci.hotspot.HotSpotConstantReflectionProvider;
+import jdk.vm.ci.meta.JavaConstant;
+import jdk.vm.ci.meta.MetaAccessProvider;
+import jdk.vm.ci.meta.MethodHandleAccessProvider;
+import jdk.vm.ci.runtime.JVMCI;
+import org.testng.annotations.DataProvider;
+
 import java.io.File;
 import java.lang.invoke.MethodHandle;
 import java.lang.invoke.MethodHandles;
@@ -31,12 +38,6 @@
 import java.net.URL;
 import java.net.URLClassLoader;
 import java.nio.file.Paths;
-import jdk.vm.ci.hotspot.HotSpotConstantReflectionProvider;
-import jdk.vm.ci.meta.JavaConstant;
-import jdk.vm.ci.meta.MetaAccessProvider;
-import jdk.vm.ci.meta.MethodHandleAccessProvider;
-import jdk.vm.ci.runtime.JVMCI;
-import org.testng.annotations.DataProvider;
 
 public class MethodHandleAccessProviderData implements TestInterface {
     private static final MetaAccessProvider META_ACCESS = JVMCI.getRuntime().getHostJVMCIBackend().getMetaAccess();
diff --git a/hotspot/test/compiler/jvmci/jdk.vm.ci.hotspot.test/src/jdk/vm/ci/hotspot/test/MethodHandleAccessProviderTest.java b/hotspot/test/compiler/jvmci/jdk.vm.ci.hotspot.test/src/jdk/vm/ci/hotspot/test/MethodHandleAccessProviderTest.java
index 110615d..c94d47a 100644
--- a/hotspot/test/compiler/jvmci/jdk.vm.ci.hotspot.test/src/jdk/vm/ci/hotspot/test/MethodHandleAccessProviderTest.java
+++ b/hotspot/test/compiler/jvmci/jdk.vm.ci.hotspot.test/src/jdk/vm/ci/hotspot/test/MethodHandleAccessProviderTest.java
@@ -24,30 +24,31 @@
 /*
  * @test
  * @bug 8152343
+ * @bug 8161068
  * @requires (vm.simpleArch == "x64" | vm.simpleArch == "sparcv9" | vm.simpleArch == "aarch64")
  * @library /testlibrary /test/lib /compiler/jvmci/jdk.vm.ci.hotspot.test/src
  * @modules jdk.vm.ci/jdk.vm.ci.meta
  *          jdk.vm.ci/jdk.vm.ci.runtime
  *          jdk.vm.ci/jdk.vm.ci.hotspot
- * @ignore 8161068
  * @run testng/othervm -XX:+UnlockExperimentalVMOptions -XX:+EnableJVMCI
  *      jdk.vm.ci.hotspot.test.MethodHandleAccessProviderTest
  */
 
 package jdk.vm.ci.hotspot.test;
 
+import jdk.vm.ci.hotspot.HotSpotConstantReflectionProvider;
+import jdk.vm.ci.meta.JavaConstant;
+import jdk.vm.ci.meta.MetaAccessProvider;
+import jdk.vm.ci.meta.MethodHandleAccessProvider;
+import jdk.vm.ci.meta.MethodHandleAccessProvider.IntrinsicMethod;
+import jdk.vm.ci.meta.ResolvedJavaMethod;
+import jdk.vm.ci.runtime.JVMCI;
+import org.testng.Assert;
+import org.testng.annotations.Test;
+
 import java.lang.invoke.MethodHandle;
 import java.lang.invoke.MethodHandles;
 import java.lang.reflect.Method;
-import jdk.vm.ci.hotspot.HotSpotConstantReflectionProvider;
-import jdk.vm.ci.meta.MethodHandleAccessProvider;
-import jdk.vm.ci.meta.ResolvedJavaMethod;
-import jdk.vm.ci.runtime.JVMCI;
-import jdk.vm.ci.meta.JavaConstant;
-import jdk.vm.ci.meta.MetaAccessProvider;
-import jdk.vm.ci.meta.MethodHandleAccessProvider.IntrinsicMethod;
-import org.testng.annotations.Test;
-import org.testng.Assert;
 
 public class MethodHandleAccessProviderTest {
     private static final HotSpotConstantReflectionProvider CONSTANT_REFLECTION = (HotSpotConstantReflectionProvider) JVMCI.getRuntime().getHostJVMCIBackend().getConstantReflection();
diff --git a/hotspot/test/compiler/jvmci/jdk.vm.ci.hotspot.test/src/jdk/vm/ci/hotspot/test/ReadArrayElementDataProvider.java b/hotspot/test/compiler/jvmci/jdk.vm.ci.hotspot.test/src/jdk/vm/ci/hotspot/test/ReadArrayElementDataProvider.java
index fbaea6e..e10f711 100644
--- a/hotspot/test/compiler/jvmci/jdk.vm.ci.hotspot.test/src/jdk/vm/ci/hotspot/test/ReadArrayElementDataProvider.java
+++ b/hotspot/test/compiler/jvmci/jdk.vm.ci.hotspot.test/src/jdk/vm/ci/hotspot/test/ReadArrayElementDataProvider.java
@@ -23,18 +23,18 @@
 
 package jdk.vm.ci.hotspot.test;
 
+import jdk.vm.ci.meta.JavaConstant;
+import org.testng.annotations.DataProvider;
+
+import java.util.LinkedList;
+import java.util.stream.Stream;
+
 import static jdk.vm.ci.hotspot.test.TestHelper.ARRAYS_MAP;
 import static jdk.vm.ci.hotspot.test.TestHelper.ARRAY_ARRAYS_MAP;
 import static jdk.vm.ci.hotspot.test.TestHelper.CONSTANT_REFLECTION_PROVIDER;
 import static jdk.vm.ci.hotspot.test.TestHelper.DUMMY_CLASS_INSTANCE;
 import static jdk.vm.ci.hotspot.test.TestHelper.INSTANCE_FIELDS_MAP;
 
-import java.util.LinkedList;
-import java.util.stream.Stream;
-
-import jdk.vm.ci.meta.JavaConstant;
-import org.testng.annotations.DataProvider;
-
 public class ReadArrayElementDataProvider {
 
     @DataProvider(name = "readArrayElementDataProvider")
diff --git a/hotspot/test/compiler/jvmci/jdk.vm.ci.hotspot.test/src/jdk/vm/ci/hotspot/test/ReadArrayLengthDataProvider.java b/hotspot/test/compiler/jvmci/jdk.vm.ci.hotspot.test/src/jdk/vm/ci/hotspot/test/ReadArrayLengthDataProvider.java
index ad877ac..110c2a2 100644
--- a/hotspot/test/compiler/jvmci/jdk.vm.ci.hotspot.test/src/jdk/vm/ci/hotspot/test/ReadArrayLengthDataProvider.java
+++ b/hotspot/test/compiler/jvmci/jdk.vm.ci.hotspot.test/src/jdk/vm/ci/hotspot/test/ReadArrayLengthDataProvider.java
@@ -23,13 +23,14 @@
 
 package jdk.vm.ci.hotspot.test;
 
-import static jdk.vm.ci.hotspot.test.TestHelper.CONSTANT_REFLECTION_PROVIDER;
-import static jdk.vm.ci.hotspot.test.TestHelper.DUMMY_CLASS_INSTANCE;
+import jdk.vm.ci.meta.JavaConstant;
+import org.testng.annotations.DataProvider;
 
 import java.util.LinkedList;
 import java.util.List;
-import jdk.vm.ci.meta.JavaConstant;
-import org.testng.annotations.DataProvider;
+
+import static jdk.vm.ci.hotspot.test.TestHelper.CONSTANT_REFLECTION_PROVIDER;
+import static jdk.vm.ci.hotspot.test.TestHelper.DUMMY_CLASS_INSTANCE;
 
 public class ReadArrayLengthDataProvider {
 
diff --git a/hotspot/test/compiler/jvmci/jdk.vm.ci.hotspot.test/src/jdk/vm/ci/hotspot/test/ReadFieldValueDataProvider.java b/hotspot/test/compiler/jvmci/jdk.vm.ci.hotspot.test/src/jdk/vm/ci/hotspot/test/ReadFieldValueDataProvider.java
index a46f25c..f3758b2 100644
--- a/hotspot/test/compiler/jvmci/jdk.vm.ci.hotspot.test/src/jdk/vm/ci/hotspot/test/ReadFieldValueDataProvider.java
+++ b/hotspot/test/compiler/jvmci/jdk.vm.ci.hotspot.test/src/jdk/vm/ci/hotspot/test/ReadFieldValueDataProvider.java
@@ -23,22 +23,23 @@
 
 package jdk.vm.ci.hotspot.test;
 
+import jdk.vm.ci.meta.JavaConstant;
+import org.testng.annotations.DataProvider;
+
+import java.util.LinkedList;
+
 import static jdk.vm.ci.hotspot.test.TestHelper.ARRAYS_MAP;
 import static jdk.vm.ci.hotspot.test.TestHelper.ARRAY_ARRAYS_MAP;
 import static jdk.vm.ci.hotspot.test.TestHelper.CONSTANT_REFLECTION_PROVIDER;
 import static jdk.vm.ci.hotspot.test.TestHelper.DUMMY_CLASS_CONSTANT;
 import static jdk.vm.ci.hotspot.test.TestHelper.DUMMY_CLASS_INSTANCE;
+import static jdk.vm.ci.hotspot.test.TestHelper.INSTANCE_FIELDS_MAP;
+import static jdk.vm.ci.hotspot.test.TestHelper.INSTANCE_STABLE_FIELDS_MAP;
 import static jdk.vm.ci.hotspot.test.TestHelper.STABLE_ARRAYS_MAP;
 import static jdk.vm.ci.hotspot.test.TestHelper.STABLE_ARRAY_ARRAYS_MAP;
-import static jdk.vm.ci.hotspot.test.TestHelper.INSTANCE_STABLE_FIELDS_MAP;
-import static jdk.vm.ci.hotspot.test.TestHelper.INSTANCE_FIELDS_MAP;
 import static jdk.vm.ci.hotspot.test.TestHelper.STATIC_FIELDS_MAP;
 import static jdk.vm.ci.hotspot.test.TestHelper.STATIC_STABLE_FIELDS_MAP;
 
-import java.util.LinkedList;
-import jdk.vm.ci.meta.JavaConstant;
-import org.testng.annotations.DataProvider;
-
 public class ReadFieldValueDataProvider {
 
     @DataProvider(name = "readFieldValueDataProvider")
diff --git a/hotspot/test/compiler/jvmci/jdk.vm.ci.hotspot.test/src/jdk/vm/ci/hotspot/test/TestHelper.java b/hotspot/test/compiler/jvmci/jdk.vm.ci.hotspot.test/src/jdk/vm/ci/hotspot/test/TestHelper.java
index 96f05da..53ed106 100644
--- a/hotspot/test/compiler/jvmci/jdk.vm.ci.hotspot.test/src/jdk/vm/ci/hotspot/test/TestHelper.java
+++ b/hotspot/test/compiler/jvmci/jdk.vm.ci.hotspot.test/src/jdk/vm/ci/hotspot/test/TestHelper.java
@@ -23,15 +23,16 @@
 
 package jdk.vm.ci.hotspot.test;
 
-import java.lang.reflect.Field;
-import java.util.HashMap;
-import java.util.Map;
 import jdk.vm.ci.hotspot.HotSpotConstantReflectionProvider;
 import jdk.vm.ci.meta.JavaConstant;
 import jdk.vm.ci.meta.MetaAccessProvider;
 import jdk.vm.ci.meta.ResolvedJavaField;
 import jdk.vm.ci.runtime.JVMCI;
 
+import java.lang.reflect.Field;
+import java.util.HashMap;
+import java.util.Map;
+
 public class TestHelper {
 
     public static final DummyClass DUMMY_CLASS_INSTANCE = new DummyClass();
diff --git a/hotspot/test/compiler/jvmci/jdk.vm.ci.hotspot.test/src/jdk/vm/ci/hotspot/test/UnboxPrimitiveDataProvider.java b/hotspot/test/compiler/jvmci/jdk.vm.ci.hotspot.test/src/jdk/vm/ci/hotspot/test/UnboxPrimitiveDataProvider.java
index ed8ad67..de40dbf 100644
--- a/hotspot/test/compiler/jvmci/jdk.vm.ci.hotspot.test/src/jdk/vm/ci/hotspot/test/UnboxPrimitiveDataProvider.java
+++ b/hotspot/test/compiler/jvmci/jdk.vm.ci.hotspot.test/src/jdk/vm/ci/hotspot/test/UnboxPrimitiveDataProvider.java
@@ -23,13 +23,13 @@
 
 package jdk.vm.ci.hotspot.test;
 
-import static jdk.vm.ci.hotspot.test.TestHelper.CONSTANT_REFLECTION_PROVIDER;
-import static jdk.vm.ci.hotspot.test.TestHelper.DUMMY_CLASS_INSTANCE;
+import jdk.vm.ci.meta.JavaConstant;
+import org.testng.annotations.DataProvider;
 
 import java.util.LinkedList;
 
-import jdk.vm.ci.meta.JavaConstant;
-import org.testng.annotations.DataProvider;
+import static jdk.vm.ci.hotspot.test.TestHelper.CONSTANT_REFLECTION_PROVIDER;
+import static jdk.vm.ci.hotspot.test.TestHelper.DUMMY_CLASS_INSTANCE;
 
 public class UnboxPrimitiveDataProvider {
 
diff --git a/hotspot/test/compiler/jvmci/jdk.vm.ci.runtime.test/src/jdk/vm/ci/runtime/test/ConstantTest.java b/hotspot/test/compiler/jvmci/jdk.vm.ci.runtime.test/src/jdk/vm/ci/runtime/test/ConstantTest.java
index 7857845..f345bad 100644
--- a/hotspot/test/compiler/jvmci/jdk.vm.ci.runtime.test/src/jdk/vm/ci/runtime/test/ConstantTest.java
+++ b/hotspot/test/compiler/jvmci/jdk.vm.ci.runtime.test/src/jdk/vm/ci/runtime/test/ConstantTest.java
@@ -33,11 +33,10 @@
  */
 package jdk.vm.ci.runtime.test;
 
+import jdk.vm.ci.meta.JavaConstant;
 import org.junit.Assert;
 import org.junit.Test;
 
-import jdk.vm.ci.meta.JavaConstant;
-
 public class ConstantTest extends FieldUniverse {
 
     @Test
diff --git a/hotspot/test/compiler/jvmci/jdk.vm.ci.runtime.test/src/jdk/vm/ci/runtime/test/FieldUniverse.java b/hotspot/test/compiler/jvmci/jdk.vm.ci.runtime.test/src/jdk/vm/ci/runtime/test/FieldUniverse.java
index e8d3250..dcc380d 100644
--- a/hotspot/test/compiler/jvmci/jdk.vm.ci.runtime.test/src/jdk/vm/ci/runtime/test/FieldUniverse.java
+++ b/hotspot/test/compiler/jvmci/jdk.vm.ci.runtime.test/src/jdk/vm/ci/runtime/test/FieldUniverse.java
@@ -22,12 +22,12 @@
  */
 package jdk.vm.ci.runtime.test;
 
+import jdk.vm.ci.meta.ResolvedJavaField;
+
 import java.lang.reflect.Field;
 import java.util.HashMap;
 import java.util.Map;
 
-import jdk.vm.ci.meta.ResolvedJavaField;
-
 /**
  * Context for field related tests.
  */
diff --git a/hotspot/test/compiler/jvmci/jdk.vm.ci.runtime.test/src/jdk/vm/ci/runtime/test/MethodUniverse.java b/hotspot/test/compiler/jvmci/jdk.vm.ci.runtime.test/src/jdk/vm/ci/runtime/test/MethodUniverse.java
index 35368eb..9236658 100644
--- a/hotspot/test/compiler/jvmci/jdk.vm.ci.runtime.test/src/jdk/vm/ci/runtime/test/MethodUniverse.java
+++ b/hotspot/test/compiler/jvmci/jdk.vm.ci.runtime.test/src/jdk/vm/ci/runtime/test/MethodUniverse.java
@@ -22,13 +22,13 @@
  */
 package jdk.vm.ci.runtime.test;
 
+import jdk.vm.ci.meta.ResolvedJavaMethod;
+
 import java.lang.reflect.Constructor;
 import java.lang.reflect.Method;
 import java.util.HashMap;
 import java.util.Map;
 
-import jdk.vm.ci.meta.ResolvedJavaMethod;
-
 /**
  * Context for method related tests.
  */
diff --git a/hotspot/test/compiler/jvmci/jdk.vm.ci.runtime.test/src/jdk/vm/ci/runtime/test/NameAndSignature.java b/hotspot/test/compiler/jvmci/jdk.vm.ci.runtime.test/src/jdk/vm/ci/runtime/test/NameAndSignature.java
index 055ded6..3bd14c7 100644
--- a/hotspot/test/compiler/jvmci/jdk.vm.ci.runtime.test/src/jdk/vm/ci/runtime/test/NameAndSignature.java
+++ b/hotspot/test/compiler/jvmci/jdk.vm.ci.runtime.test/src/jdk/vm/ci/runtime/test/NameAndSignature.java
@@ -22,15 +22,15 @@
  */
 package jdk.vm.ci.runtime.test;
 
-import java.lang.reflect.Method;
-import java.util.Arrays;
-
 import jdk.vm.ci.meta.MetaAccessProvider;
 import jdk.vm.ci.meta.ResolvedJavaMethod;
 import jdk.vm.ci.meta.ResolvedJavaType;
 import jdk.vm.ci.meta.Signature;
 import jdk.vm.ci.runtime.JVMCI;
 
+import java.lang.reflect.Method;
+import java.util.Arrays;
+
 class NameAndSignature {
 
     public static final MetaAccessProvider metaAccess = JVMCI.getRuntime().getHostJVMCIBackend().getMetaAccess();
diff --git a/hotspot/test/compiler/jvmci/jdk.vm.ci.runtime.test/src/jdk/vm/ci/runtime/test/RedefineClassTest.java b/hotspot/test/compiler/jvmci/jdk.vm.ci.runtime.test/src/jdk/vm/ci/runtime/test/RedefineClassTest.java
index 0cc7a30..a93f934 100644
--- a/hotspot/test/compiler/jvmci/jdk.vm.ci.runtime.test/src/jdk/vm/ci/runtime/test/RedefineClassTest.java
+++ b/hotspot/test/compiler/jvmci/jdk.vm.ci.runtime.test/src/jdk/vm/ci/runtime/test/RedefineClassTest.java
@@ -34,8 +34,11 @@
 
 package jdk.vm.ci.runtime.test;
 
-import static org.junit.Assume.assumeTrue;
+import jdk.vm.ci.meta.ResolvedJavaMethod;
+import org.junit.Assert;
+import org.junit.Test;
 
+import javax.tools.ToolProvider;
 import java.io.FileOutputStream;
 import java.io.IOException;
 import java.io.InputStream;
@@ -53,12 +56,7 @@
 import java.util.jar.JarOutputStream;
 import java.util.jar.Manifest;
 
-import javax.tools.ToolProvider;
-
-import jdk.vm.ci.meta.ResolvedJavaMethod;
-
-import org.junit.Assert;
-import org.junit.Test;
+import static org.junit.Assume.assumeTrue;
 
 /**
  * Tests that {@link ResolvedJavaMethod}s are safe in the context of class redefinition being used
diff --git a/hotspot/test/compiler/jvmci/jdk.vm.ci.runtime.test/src/jdk/vm/ci/runtime/test/ResolvedJavaTypeResolveConcreteMethodTest.java b/hotspot/test/compiler/jvmci/jdk.vm.ci.runtime.test/src/jdk/vm/ci/runtime/test/ResolvedJavaTypeResolveConcreteMethodTest.java
index 213b7c2..21cdc85 100644
--- a/hotspot/test/compiler/jvmci/jdk.vm.ci.runtime.test/src/jdk/vm/ci/runtime/test/ResolvedJavaTypeResolveConcreteMethodTest.java
+++ b/hotspot/test/compiler/jvmci/jdk.vm.ci.runtime.test/src/jdk/vm/ci/runtime/test/ResolvedJavaTypeResolveConcreteMethodTest.java
@@ -31,15 +31,15 @@
 
 package jdk.vm.ci.runtime.test;
 
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertNull;
 import jdk.vm.ci.meta.MetaAccessProvider;
 import jdk.vm.ci.meta.ResolvedJavaMethod;
 import jdk.vm.ci.meta.ResolvedJavaType;
 import jdk.vm.ci.runtime.JVMCI;
-
 import org.junit.Test;
 
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertNull;
+
 public class ResolvedJavaTypeResolveConcreteMethodTest {
     public final MetaAccessProvider metaAccess;
 
diff --git a/hotspot/test/compiler/jvmci/jdk.vm.ci.runtime.test/src/jdk/vm/ci/runtime/test/ResolvedJavaTypeResolveMethodTest.java b/hotspot/test/compiler/jvmci/jdk.vm.ci.runtime.test/src/jdk/vm/ci/runtime/test/ResolvedJavaTypeResolveMethodTest.java
index 0d65a36..a32395c 100644
--- a/hotspot/test/compiler/jvmci/jdk.vm.ci.runtime.test/src/jdk/vm/ci/runtime/test/ResolvedJavaTypeResolveMethodTest.java
+++ b/hotspot/test/compiler/jvmci/jdk.vm.ci.runtime.test/src/jdk/vm/ci/runtime/test/ResolvedJavaTypeResolveMethodTest.java
@@ -31,15 +31,15 @@
 
 package jdk.vm.ci.runtime.test;
 
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertNull;
 import jdk.vm.ci.meta.MetaAccessProvider;
 import jdk.vm.ci.meta.ResolvedJavaMethod;
 import jdk.vm.ci.meta.ResolvedJavaType;
 import jdk.vm.ci.runtime.JVMCI;
-
 import org.junit.Test;
 
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertNull;
+
 public class ResolvedJavaTypeResolveMethodTest {
     public final MetaAccessProvider metaAccess;
 
diff --git a/hotspot/test/compiler/jvmci/jdk.vm.ci.runtime.test/src/jdk/vm/ci/runtime/test/TestConstantReflectionProvider.java b/hotspot/test/compiler/jvmci/jdk.vm.ci.runtime.test/src/jdk/vm/ci/runtime/test/TestConstantReflectionProvider.java
index ab6325e..ab66c98 100644
--- a/hotspot/test/compiler/jvmci/jdk.vm.ci.runtime.test/src/jdk/vm/ci/runtime/test/TestConstantReflectionProvider.java
+++ b/hotspot/test/compiler/jvmci/jdk.vm.ci.runtime.test/src/jdk/vm/ci/runtime/test/TestConstantReflectionProvider.java
@@ -34,21 +34,20 @@
 
 package jdk.vm.ci.runtime.test;
 
+import jdk.vm.ci.meta.ConstantReflectionProvider;
+import jdk.vm.ci.meta.JavaConstant;
+import jdk.vm.ci.meta.JavaKind;
+import org.junit.Test;
+
+import java.lang.reflect.Array;
+import java.util.List;
+
 import static org.junit.Assert.assertEquals;
 import static org.junit.Assert.assertFalse;
 import static org.junit.Assert.assertNotNull;
 import static org.junit.Assert.assertNull;
 import static org.junit.Assert.assertTrue;
 
-import java.lang.reflect.Array;
-import java.util.List;
-
-import jdk.vm.ci.meta.ConstantReflectionProvider;
-import jdk.vm.ci.meta.JavaConstant;
-import jdk.vm.ci.meta.JavaKind;
-
-import org.junit.Test;
-
 /**
  * Tests for {@link ConstantReflectionProvider}. It assumes an implementation of the interface that
  * actually returns non-null results for access operations that are possible, i.e., the tests will
diff --git a/hotspot/test/compiler/jvmci/jdk.vm.ci.runtime.test/src/jdk/vm/ci/runtime/test/TestJavaField.java b/hotspot/test/compiler/jvmci/jdk.vm.ci.runtime.test/src/jdk/vm/ci/runtime/test/TestJavaField.java
index 8359fb0..15e4959 100644
--- a/hotspot/test/compiler/jvmci/jdk.vm.ci.runtime.test/src/jdk/vm/ci/runtime/test/TestJavaField.java
+++ b/hotspot/test/compiler/jvmci/jdk.vm.ci.runtime.test/src/jdk/vm/ci/runtime/test/TestJavaField.java
@@ -34,20 +34,19 @@
 
 package jdk.vm.ci.runtime.test;
 
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertTrue;
-
-import java.lang.reflect.Field;
-import java.util.Map;
-
 import jdk.vm.ci.meta.JavaField;
 import jdk.vm.ci.meta.JavaKind;
 import jdk.vm.ci.meta.JavaType;
 import jdk.vm.ci.meta.ResolvedJavaField;
 import jdk.vm.ci.meta.ResolvedJavaType;
-
 import org.junit.Test;
 
+import java.lang.reflect.Field;
+import java.util.Map;
+
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertTrue;
+
 /**
  * Tests for {@link JavaField}.
  */
diff --git a/hotspot/test/compiler/jvmci/jdk.vm.ci.runtime.test/src/jdk/vm/ci/runtime/test/TestJavaMethod.java b/hotspot/test/compiler/jvmci/jdk.vm.ci.runtime.test/src/jdk/vm/ci/runtime/test/TestJavaMethod.java
index b143206..a7a2e74 100644
--- a/hotspot/test/compiler/jvmci/jdk.vm.ci.runtime.test/src/jdk/vm/ci/runtime/test/TestJavaMethod.java
+++ b/hotspot/test/compiler/jvmci/jdk.vm.ci.runtime.test/src/jdk/vm/ci/runtime/test/TestJavaMethod.java
@@ -34,17 +34,16 @@
 
 package jdk.vm.ci.runtime.test;
 
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertTrue;
+import jdk.vm.ci.meta.JavaMethod;
+import jdk.vm.ci.meta.ResolvedJavaMethod;
+import jdk.vm.ci.meta.ResolvedJavaType;
+import org.junit.Test;
 
 import java.lang.reflect.Method;
 import java.util.Map;
 
-import jdk.vm.ci.meta.JavaMethod;
-import jdk.vm.ci.meta.ResolvedJavaMethod;
-import jdk.vm.ci.meta.ResolvedJavaType;
-
-import org.junit.Test;
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertTrue;
 
 /**
  * Tests for {@link JavaMethod}.
diff --git a/hotspot/test/compiler/jvmci/jdk.vm.ci.runtime.test/src/jdk/vm/ci/runtime/test/TestJavaType.java b/hotspot/test/compiler/jvmci/jdk.vm.ci.runtime.test/src/jdk/vm/ci/runtime/test/TestJavaType.java
index ffcd3b4..4b38875 100644
--- a/hotspot/test/compiler/jvmci/jdk.vm.ci.runtime.test/src/jdk/vm/ci/runtime/test/TestJavaType.java
+++ b/hotspot/test/compiler/jvmci/jdk.vm.ci.runtime.test/src/jdk/vm/ci/runtime/test/TestJavaType.java
@@ -34,12 +34,12 @@
 
 package jdk.vm.ci.runtime.test;
 
-import static org.junit.Assert.assertEquals;
 import jdk.vm.ci.meta.JavaKind;
 import jdk.vm.ci.meta.JavaType;
-
 import org.junit.Test;
 
+import static org.junit.Assert.assertEquals;
+
 /**
  * Tests for {@link JavaType}.
  */
diff --git a/hotspot/test/compiler/jvmci/jdk.vm.ci.runtime.test/src/jdk/vm/ci/runtime/test/TestMetaAccessProvider.java b/hotspot/test/compiler/jvmci/jdk.vm.ci.runtime.test/src/jdk/vm/ci/runtime/test/TestMetaAccessProvider.java
index 16ca94e..cae386e 100644
--- a/hotspot/test/compiler/jvmci/jdk.vm.ci.runtime.test/src/jdk/vm/ci/runtime/test/TestMetaAccessProvider.java
+++ b/hotspot/test/compiler/jvmci/jdk.vm.ci.runtime.test/src/jdk/vm/ci/runtime/test/TestMetaAccessProvider.java
@@ -34,17 +34,8 @@
 
 package jdk.vm.ci.runtime.test;
 
-import static jdk.vm.ci.meta.MetaUtil.toInternalName;
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertNotNull;
-import static org.junit.Assert.assertNull;
-import static org.junit.Assert.assertTrue;
-
-import java.lang.reflect.Field;
-import java.lang.reflect.Method;
 import jdk.vm.ci.meta.DeoptimizationAction;
 import jdk.vm.ci.meta.DeoptimizationReason;
-
 import jdk.vm.ci.meta.JavaConstant;
 import jdk.vm.ci.meta.JavaKind;
 import jdk.vm.ci.meta.MetaAccessProvider;
@@ -52,9 +43,17 @@
 import jdk.vm.ci.meta.ResolvedJavaMethod;
 import jdk.vm.ci.meta.ResolvedJavaType;
 import jdk.vm.ci.meta.Signature;
-
 import org.junit.Test;
 
+import java.lang.reflect.Field;
+import java.lang.reflect.Method;
+
+import static jdk.vm.ci.meta.MetaUtil.toInternalName;
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertNotNull;
+import static org.junit.Assert.assertNull;
+import static org.junit.Assert.assertTrue;
+
 /**
  * Tests for {@link MetaAccessProvider}.
  */
diff --git a/hotspot/test/compiler/jvmci/jdk.vm.ci.runtime.test/src/jdk/vm/ci/runtime/test/TestResolvedJavaField.java b/hotspot/test/compiler/jvmci/jdk.vm.ci.runtime.test/src/jdk/vm/ci/runtime/test/TestResolvedJavaField.java
index 2c3a677..5085748 100644
--- a/hotspot/test/compiler/jvmci/jdk.vm.ci.runtime.test/src/jdk/vm/ci/runtime/test/TestResolvedJavaField.java
+++ b/hotspot/test/compiler/jvmci/jdk.vm.ci.runtime.test/src/jdk/vm/ci/runtime/test/TestResolvedJavaField.java
@@ -34,10 +34,9 @@
 
 package jdk.vm.ci.runtime.test;
 
-import static org.junit.Assert.assertArrayEquals;
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertFalse;
-import static org.junit.Assert.assertTrue;
+import jdk.vm.ci.meta.ResolvedJavaField;
+import jdk.vm.ci.meta.ResolvedJavaMethod;
+import org.junit.Test;
 
 import java.lang.annotation.Annotation;
 import java.lang.reflect.Field;
@@ -47,10 +46,10 @@
 import java.util.Map;
 import java.util.Set;
 
-import jdk.vm.ci.meta.ResolvedJavaField;
-import jdk.vm.ci.meta.ResolvedJavaMethod;
-
-import org.junit.Test;
+import static org.junit.Assert.assertArrayEquals;
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertFalse;
+import static org.junit.Assert.assertTrue;
 
 /**
  * Tests for {@link ResolvedJavaField}.
diff --git a/hotspot/test/compiler/jvmci/jdk.vm.ci.runtime.test/src/jdk/vm/ci/runtime/test/TestResolvedJavaMethod.java b/hotspot/test/compiler/jvmci/jdk.vm.ci.runtime.test/src/jdk/vm/ci/runtime/test/TestResolvedJavaMethod.java
index 0a58b4b..3333734 100644
--- a/hotspot/test/compiler/jvmci/jdk.vm.ci.runtime.test/src/jdk/vm/ci/runtime/test/TestResolvedJavaMethod.java
+++ b/hotspot/test/compiler/jvmci/jdk.vm.ci.runtime.test/src/jdk/vm/ci/runtime/test/TestResolvedJavaMethod.java
@@ -34,10 +34,12 @@
 
 package jdk.vm.ci.runtime.test;
 
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertFalse;
-import static org.junit.Assert.assertNotNull;
-import static org.junit.Assert.assertTrue;
+import jdk.vm.ci.meta.ConstantPool;
+import jdk.vm.ci.meta.ExceptionHandler;
+import jdk.vm.ci.meta.ResolvedJavaMethod;
+import jdk.vm.ci.meta.ResolvedJavaType;
+import org.junit.Assert;
+import org.junit.Test;
 
 import java.lang.annotation.Annotation;
 import java.lang.annotation.ElementType;
@@ -56,13 +58,10 @@
 import java.util.Map;
 import java.util.Set;
 
-import jdk.vm.ci.meta.ConstantPool;
-import jdk.vm.ci.meta.ExceptionHandler;
-import jdk.vm.ci.meta.ResolvedJavaMethod;
-import jdk.vm.ci.meta.ResolvedJavaType;
-
-import org.junit.Assert;
-import org.junit.Test;
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertFalse;
+import static org.junit.Assert.assertNotNull;
+import static org.junit.Assert.assertTrue;
 
 /**
  * Tests for {@link ResolvedJavaMethod}.
@@ -423,6 +422,25 @@
         assertFalse(ResolvedJavaMethod.isSignaturePolymorphic(metaAccess.lookupJavaType(Object.class), "toString", metaAccess));
     }
 
+    /**
+     * All public non-final methods should be available in the vtable.
+     */
+    @Test
+    public void testVirtualMethodTableAccess() {
+        for (Class<?> c : classes) {
+            if (c.isPrimitive() || c.isInterface()) {
+                continue;
+            }
+            ResolvedJavaType receiverType = metaAccess.lookupJavaType(c);
+            for (Method m : c.getMethods()) {
+                ResolvedJavaMethod method = metaAccess.lookupJavaMethod(m);
+                if (!method.isStatic() && !method.isFinal() && !method.getDeclaringClass().isLeaf() && !method.getDeclaringClass().isInterface()) {
+                    assertTrue(method + " not available in " + receiverType, method.isInVirtualMethodTable(receiverType));
+                }
+            }
+        }
+    }
+
     private Method findTestMethod(Method apiMethod) {
         String testName = apiMethod.getName() + "Test";
         for (Method m : getClass().getDeclaredMethods()) {
diff --git a/hotspot/test/compiler/jvmci/jdk.vm.ci.runtime.test/src/jdk/vm/ci/runtime/test/TestResolvedJavaType.java b/hotspot/test/compiler/jvmci/jdk.vm.ci.runtime.test/src/jdk/vm/ci/runtime/test/TestResolvedJavaType.java
index ab9e0b7..42d340f 100644
--- a/hotspot/test/compiler/jvmci/jdk.vm.ci.runtime.test/src/jdk/vm/ci/runtime/test/TestResolvedJavaType.java
+++ b/hotspot/test/compiler/jvmci/jdk.vm.ci.runtime.test/src/jdk/vm/ci/runtime/test/TestResolvedJavaType.java
@@ -37,18 +37,16 @@
 
 package jdk.vm.ci.runtime.test;
 
-import static java.lang.reflect.Modifier.isAbstract;
-import static java.lang.reflect.Modifier.isFinal;
-import static java.lang.reflect.Modifier.isPrivate;
-import static java.lang.reflect.Modifier.isProtected;
-import static java.lang.reflect.Modifier.isPublic;
-import static java.lang.reflect.Modifier.isStatic;
-import static org.junit.Assert.assertArrayEquals;
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertFalse;
-import static org.junit.Assert.assertNotNull;
-import static org.junit.Assert.assertNull;
-import static org.junit.Assert.assertTrue;
+import jdk.internal.reflect.ConstantPool;
+import jdk.vm.ci.common.JVMCIError;
+import jdk.vm.ci.meta.Assumptions.AssumptionResult;
+import jdk.vm.ci.meta.JavaConstant;
+import jdk.vm.ci.meta.JavaKind;
+import jdk.vm.ci.meta.ModifiersProvider;
+import jdk.vm.ci.meta.ResolvedJavaField;
+import jdk.vm.ci.meta.ResolvedJavaMethod;
+import jdk.vm.ci.meta.ResolvedJavaType;
+import org.junit.Test;
 
 import java.lang.annotation.Annotation;
 import java.lang.reflect.Field;
@@ -61,18 +59,18 @@
 import java.util.Map;
 import java.util.Set;
 
-import jdk.vm.ci.common.JVMCIError;
-import jdk.vm.ci.meta.Assumptions.AssumptionResult;
-import jdk.vm.ci.meta.JavaConstant;
-import jdk.vm.ci.meta.JavaKind;
-import jdk.vm.ci.meta.ModifiersProvider;
-import jdk.vm.ci.meta.ResolvedJavaField;
-import jdk.vm.ci.meta.ResolvedJavaMethod;
-import jdk.vm.ci.meta.ResolvedJavaType;
-
-import org.junit.Test;
-
-import jdk.internal.reflect.ConstantPool;
+import static java.lang.reflect.Modifier.isAbstract;
+import static java.lang.reflect.Modifier.isFinal;
+import static java.lang.reflect.Modifier.isPrivate;
+import static java.lang.reflect.Modifier.isProtected;
+import static java.lang.reflect.Modifier.isPublic;
+import static java.lang.reflect.Modifier.isStatic;
+import static org.junit.Assert.assertArrayEquals;
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertFalse;
+import static org.junit.Assert.assertNotNull;
+import static org.junit.Assert.assertNull;
+import static org.junit.Assert.assertTrue;
 
 /**
  * Tests for {@link ResolvedJavaType}.
diff --git a/hotspot/test/compiler/jvmci/jdk.vm.ci.runtime.test/src/jdk/vm/ci/runtime/test/TypeUniverse.java b/hotspot/test/compiler/jvmci/jdk.vm.ci.runtime.test/src/jdk/vm/ci/runtime/test/TypeUniverse.java
index 2aae14c..87a16d2 100644
--- a/hotspot/test/compiler/jvmci/jdk.vm.ci.runtime.test/src/jdk/vm/ci/runtime/test/TypeUniverse.java
+++ b/hotspot/test/compiler/jvmci/jdk.vm.ci.runtime.test/src/jdk/vm/ci/runtime/test/TypeUniverse.java
@@ -22,8 +22,14 @@
  */
 package jdk.vm.ci.runtime.test;
 
-import static java.lang.reflect.Modifier.isFinal;
-import static java.lang.reflect.Modifier.isStatic;
+import jdk.internal.misc.Unsafe;
+import jdk.vm.ci.meta.ConstantReflectionProvider;
+import jdk.vm.ci.meta.JavaConstant;
+import jdk.vm.ci.meta.MetaAccessProvider;
+import jdk.vm.ci.meta.ResolvedJavaField;
+import jdk.vm.ci.meta.ResolvedJavaType;
+import jdk.vm.ci.runtime.JVMCI;
+import org.junit.Test;
 
 import java.io.Serializable;
 import java.lang.reflect.Array;
@@ -47,16 +53,8 @@
 import java.util.TreeMap;
 import java.util.stream.Collectors;
 
-import jdk.vm.ci.meta.ConstantReflectionProvider;
-import jdk.vm.ci.meta.JavaConstant;
-import jdk.vm.ci.meta.MetaAccessProvider;
-import jdk.vm.ci.meta.ResolvedJavaField;
-import jdk.vm.ci.meta.ResolvedJavaType;
-import jdk.vm.ci.runtime.JVMCI;
-
-import org.junit.Test;
-
-import jdk.internal.misc.Unsafe;
+import static java.lang.reflect.Modifier.isFinal;
+import static java.lang.reflect.Modifier.isStatic;
 
 /**
  * Context for type related tests.
diff --git a/hotspot/test/compiler/jvmci/meta/StableFieldTest.java b/hotspot/test/compiler/jvmci/meta/StableFieldTest.java
index c2087a5..d06278e 100644
--- a/hotspot/test/compiler/jvmci/meta/StableFieldTest.java
+++ b/hotspot/test/compiler/jvmci/meta/StableFieldTest.java
@@ -31,18 +31,17 @@
  *          jdk.vm.ci/jdk.vm.ci.hotspot
  *          jdk.vm.ci/jdk.vm.ci.meta
  *          jdk.vm.ci/jdk.vm.ci.runtime
+ *
  * @compile StableFieldTest.java
- * @run main ClassFileInstaller compiler.jvmci.meta.StableFieldTest
+ * @run driver ClassFileInstaller compiler.jvmci.meta.StableFieldTest
  * @run main/othervm -XX:+UnlockExperimentalVMOptions -XX:+EnableJVMCI -Xbootclasspath/a:. compiler.jvmci.meta.StableFieldTest
  */
 
 package compiler.jvmci.meta;
 
-import java.lang.reflect.Field;
 import jdk.internal.vm.annotation.Stable;
 import jdk.vm.ci.hotspot.HotSpotResolvedJavaField;
 import jdk.vm.ci.meta.MetaAccessProvider;
-import jdk.vm.ci.meta.ResolvedJavaField;
 import jdk.vm.ci.runtime.JVMCI;
 
 public class StableFieldTest {
diff --git a/hotspot/test/compiler/linkage/CallSites.jasm b/hotspot/test/compiler/linkage/CallSites.jasm
index 813a9df..8bd63d1 100644
--- a/hotspot/test/compiler/linkage/CallSites.jasm
+++ b/hotspot/test/compiler/linkage/CallSites.jasm
@@ -21,34 +21,34 @@
  * questions.
  *
  */
-super class I
+super class compiler/linkage/I
 version 52:0
 {
 
 }
 
 
-super class CallSites
+super class compiler/linkage/CallSites
 version 52:0
 {
 
     // Non-existent methods.
 
     // I.m1()V vs I.m1(I)V
-    public static Method testI1:"(LI;)V"
+    public static Method testI1:"(Lcompiler/linkage/I;)V"
         stack 1 locals 1
     {
         aload_0;
-        invokeinterface InterfaceMethod I."m1":"()V", 1; // throws NSME
+        invokeinterface InterfaceMethod compiler/linkage/I."m1":"()V", 1; // throws NSME
         return;
     }
 
     // X.m1()V vs X.m1(I)V
-    public static Method testX1:"(LX;)V"
+    public static Method testX1:"(Lcompiler/linkage/X;)V"
         stack 1 locals 1
     {
         aload_0;
-        invokevirtual Method X."m1":"()V"; // throws NSME
+        invokevirtual Method compiler/linkage/X."m1":"()V"; // throws NSME
         return;
     }
 
@@ -58,7 +58,7 @@
         stack 1 locals 0
     {
         iconst_0;
-        invokestatic InterfaceMethod I."m1":"(I)V"; // throws ICCE
+        invokestatic InterfaceMethod compiler/linkage/I."m1":"(I)V"; // throws ICCE
         return;
     }
 
@@ -66,25 +66,25 @@
         stack 1 locals 0
     {
         iconst_0;
-        invokestatic Method X."m1":"(I)V"; // throws ICCE
+        invokestatic Method compiler/linkage/X."m1":"(I)V"; // throws ICCE
         return;
     }
 
     // Virtual invocation of static methods.
 
-    public static Method testI3:"(LI;)V"
+    public static Method testI3:"(Lcompiler/linkage/I;)V"
         stack 1 locals 1
     {
         aload_0;
-        invokeinterface InterfaceMethod I."s1":"()V", 1; // throws ICCE
+        invokeinterface InterfaceMethod compiler/linkage/I."s1":"()V", 1; // throws ICCE
         return;
     }
 
-    public static Method testX3:"(LX;)V"
+    public static Method testX3:"(Lcompiler/linkage/X;)V"
         stack 1 locals 1
     {
         aload_0;
-        invokevirtual Method X."s1":"()V";  // throws ICCE
+        invokevirtual Method compiler/linkage/X."s1":"()V";  // throws ICCE
         return;
     }
 
diff --git a/hotspot/test/compiler/linkage/LinkageErrors.java b/hotspot/test/compiler/linkage/LinkageErrors.java
index 0a1b2a8..0334604 100644
--- a/hotspot/test/compiler/linkage/LinkageErrors.java
+++ b/hotspot/test/compiler/linkage/LinkageErrors.java
@@ -25,10 +25,16 @@
  * @test
  * @bug 8132879
  * @compile CallSites.jasm
- * @run main/othervm -Xverify:all -Xbatch -XX:CompileCommand=dontinline,Test::test* LinkageErrors
+ * @run main/othervm -Xverify:all -Xbatch
+ *                   -XX:CompileCommand=dontinline,compiler.linkage.LinkageErrors::test*
+ *                   compiler.linkage.LinkageErrors
  */
 
-import java.lang.invoke.*;
+package compiler.linkage;
+
+import java.lang.invoke.MethodHandle;
+import java.lang.invoke.MethodHandles;
+import java.lang.invoke.MethodType;
 
 interface I {
     void m1(int i);
@@ -62,7 +68,7 @@
     }
 
     public static void main(String args[]) throws Throwable {
-        Class<?> test = Class.forName("CallSites");
+        Class<?> test = Class.forName("compiler.linkage.CallSites");
 
         // Non-existent method lookups.
         MethodHandle testI1 = L.findStatic(test, "testI1", MethodType.methodType(void.class, I.class));
diff --git a/hotspot/test/compiler/loopopts/6860469/Test.java b/hotspot/test/compiler/loopopts/6860469/Test.java
deleted file mode 100644
index 2a736d3..0000000
--- a/hotspot/test/compiler/loopopts/6860469/Test.java
+++ /dev/null
@@ -1,71 +0,0 @@
-/*
- * Copyright 2009 Google Inc.  All Rights Reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- *
- */
-
-/**
- * @test
- * @bug 6860469
- * @summary remix_address_expressions reshapes address expression with bad control
- *
- * @run main/othervm -Xcomp -XX:CompileOnly=Test.C Test
- */
-
-public class Test {
-
-  private static final int H = 16;
-  private static final int F = 9;
-
-  static int[] fl = new int[1 << F];
-
-  static int C(int ll, int f) {
-    int max = -1;
-    int min = H + 1;
-
-    if (ll != 0) {
-      if (ll < min) {
-        min = ll;
-      }
-      if (ll > max) {
-        max = ll;
-      }
-    }
-
-    if (f > max) {
-      f = max;
-    }
-    if (min > f) {
-      min = f;
-    }
-
-    for (int mc = 1 >> max - f; mc <= 0; mc++) {
-      int i = mc << (32 - f);
-      fl[i] = max;
-    }
-
-    return min;
-  }
-
-  public static void main(String argv[]) {
-    C(0, 10);
-  }
-}
diff --git a/hotspot/test/compiler/loopopts/7044738/Test7044738.java b/hotspot/test/compiler/loopopts/7044738/Test7044738.java
deleted file mode 100644
index 6b2a8d1..0000000
--- a/hotspot/test/compiler/loopopts/7044738/Test7044738.java
+++ /dev/null
@@ -1,104 +0,0 @@
-/*
- * Copyright (c) 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.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- *
- */
-
-/**
- * @test
- * @bug 7044738
- * @summary Loop unroll optimization causes incorrect result
- *
- * @run main/othervm -Xbatch Test7044738
- */
-
-public class Test7044738 {
-
-  private static final int INITSIZE = 10000;
-  public int d[] = { 1, 2, 3, 4 };
-  public int i, size;
-
-  private static int iter = 5;
-
-  boolean done() { return (--iter > 0); }
-
-  public static void main(String args[]) {
-    Test7044738 t = new Test7044738();
-    t.test();
-  }
-
-  int test() {
-
-    while (done()) {
-      size = INITSIZE;
-
-      for (i = 0; i < size; i++) {
-        d[0] = d[1]; // 2
-        d[1] = d[2]; // 3
-        d[2] = d[3]; // 4
-        d[3] = d[0]; // 2
-
-        d[0] = d[1]; // 3
-        d[1] = d[2]; // 4
-        d[2] = d[3]; // 2
-        d[3] = d[0]; // 3
-
-        d[0] = d[1]; // 4
-        d[1] = d[2]; // 2
-        d[2] = d[3]; // 3
-        d[3] = d[0]; // 4
-
-        d[0] = d[1]; // 2
-        d[1] = d[2]; // 3
-        d[2] = d[3]; // 4
-        d[3] = d[0]; // 2
-
-        d[0] = d[1]; // 3
-        d[1] = d[2]; // 4
-        d[2] = d[3]; // 2
-        d[3] = d[0]; // 3
-
-        d[0] = d[1]; // 4
-        d[1] = d[2]; // 2
-        d[2] = d[3]; // 3
-        d[3] = d[0]; // 4
-
-        d[0] = d[1]; // 2
-        d[1] = d[2]; // 3
-        d[2] = d[3]; // 4
-        d[3] = d[0]; // 2
-
-        d[0] = d[1]; // 3
-        d[1] = d[2]; // 4
-        d[2] = d[3]; // 2
-        d[3] = d[0]; // 3
-      }
-
-      // try to defeat dead code elimination
-      if (d[0] == d[1]) {
-        System.out.println("test failed: iter=" + iter + "  i=" + i + " d[] = { " + d[0] + ", " + d[1] + ", " + d[2] + ", " + d[3] + " } ");
-        System.exit(97);
-      }
-    }
-    return d[3];
-  }
-
-}
diff --git a/hotspot/test/compiler/loopopts/7052494/Test7052494.java b/hotspot/test/compiler/loopopts/7052494/Test7052494.java
deleted file mode 100644
index 62aa12f..0000000
--- a/hotspot/test/compiler/loopopts/7052494/Test7052494.java
+++ /dev/null
@@ -1,175 +0,0 @@
-/*
- * Copyright (c) 2011, 2014, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- *
- */
-
-/**
- * @test
- * @bug 7052494
- * @summary Eclipse test fails on JDK 7 b142
- *
- * @run main/othervm -Xbatch Test7052494
- */
-
-
-public class Test7052494 {
-
-  static int test1(int i, int limit) {
-    int result = 0;
-    while (i++ != 0) {
-      if (result >= limit)
-        break;
-      result = i*2;
-    }
-    return result;
-  }
-
-  static int test2(int i, int limit) {
-    int result = 0;
-    while (i-- != 0) {
-      if (result <= limit)
-        break;
-      result = i*2;
-    }
-    return result;
-  }
-
-  static void test3(int i, int limit, int arr[]) {
-    while (i++ != 0) {
-      if (arr[i-1] >= limit)
-        break;
-      arr[i] = i*2;
-    }
-  }
-
-  static void test4(int i, int limit, int arr[]) {
-    while (i-- != 0) {
-      if (arr[arr.length + i + 1] <= limit)
-        break;
-      arr[arr.length + i] = i*2;
-    }
-  }
-
-  // Empty loop rolls through MAXINT if i > 0
-
-  static final int limit5 = Integer.MIN_VALUE + 10000;
-
-  static int test5(int i) {
-    int result = 0;
-    while (i++ != limit5) {
-      result = i*2;
-    }
-    return result;
-  }
-
-  // Empty loop rolls through MININT if i < 0
-
-  static final int limit6 = Integer.MAX_VALUE - 10000;
-
-  static int test6(int i) {
-    int result = 0;
-    while (i-- != limit6) {
-      result = i*2;
-    }
-    return result;
-  }
-
-  public static void main(String [] args) {
-    boolean failed = false;
-    int[] arr = new int[8];
-    int[] ar3 = { 0, 0, 4, 6, 8, 10, 0, 0 };
-    int[] ar4 = { 0, 0, 0, -10, -8, -6, -4, 0 };
-    System.out.println("test1");
-    for (int i = 0; i < 11000; i++) {
-      int k = test1(1, 10);
-      if (k != 10) {
-        System.out.println("FAILED: " + k + " != 10");
-        failed = true;
-        break;
-      }
-    }
-    System.out.println("test2");
-    for (int i = 0; i < 11000; i++) {
-      int k = test2(-1, -10);
-      if (k != -10) {
-        System.out.println("FAILED: " + k + " != -10");
-        failed = true;
-        break;
-      }
-    }
-    System.out.println("test3");
-    for (int i = 0; i < 11000; i++) {
-      java.util.Arrays.fill(arr, 0);
-      test3(1, 10, arr);
-      if (!java.util.Arrays.equals(arr,ar3)) {
-        System.out.println("FAILED: arr = { " + arr[0] + ", "
-                                              + arr[1] + ", "
-                                              + arr[2] + ", "
-                                              + arr[3] + ", "
-                                              + arr[4] + ", "
-                                              + arr[5] + ", "
-                                              + arr[6] + ", "
-                                              + arr[7] + " }");
-        failed = true;
-        break;
-      }
-    }
-    System.out.println("test4");
-    for (int i = 0; i < 11000; i++) {
-      java.util.Arrays.fill(arr, 0);
-      test4(-1, -10, arr);
-      if (!java.util.Arrays.equals(arr,ar4)) {
-        System.out.println("FAILED: arr = { " + arr[0] + ", "
-                                              + arr[1] + ", "
-                                              + arr[2] + ", "
-                                              + arr[3] + ", "
-                                              + arr[4] + ", "
-                                              + arr[5] + ", "
-                                              + arr[6] + ", "
-                                              + arr[7] + " }");
-        failed = true;
-        break;
-      }
-    }
-    System.out.println("test5");
-    for (int i = 0; i < 11000; i++) {
-      int k = test5(limit6);
-      if (k != limit5*2) {
-        System.out.println("FAILED: " + k + " != " + limit5*2);
-        failed = true;
-        break;
-      }
-    }
-    System.out.println("test6");
-    for (int i = 0; i < 11000; i++) {
-      int k = test6(limit5);
-      if (k != limit6*2) {
-        System.out.println("FAILED: " + k + " != " + limit6*2);
-        failed = true;
-        break;
-      }
-    }
-    System.out.println("finish");
-    if (failed)
-      System.exit(97);
-  }
-}
diff --git a/hotspot/test/compiler/loopopts/BadPredicateAfterPartialPeel.java b/hotspot/test/compiler/loopopts/BadPredicateAfterPartialPeel.java
index 186f1cc..36c13ec 100644
--- a/hotspot/test/compiler/loopopts/BadPredicateAfterPartialPeel.java
+++ b/hotspot/test/compiler/loopopts/BadPredicateAfterPartialPeel.java
@@ -26,10 +26,16 @@
  * @test
  * @bug 8146792
  * @summary Predicate moved after partial peel may lead to broken graph
- * @run main/othervm -XX:-TieredCompilation -XX:-BackgroundCompilation -XX:-UseOnStackReplacement -XX:CompileOnly=BadPredicateAfterPartialPeel::m -XX:CompileCommand=dontinline,BadPredicateAfterPartialPeel::not_inlined* -XX:CompileCommand=quiet BadPredicateAfterPartialPeel
- *
+ * @run main/othervm -XX:-TieredCompilation -XX:-BackgroundCompilation
+ *      -XX:-UseOnStackReplacement
+ *      -XX:CompileCommand=compileonly,compiler.loopopts.BadPredicateAfterPartialPeel::m
+ *      -XX:CompileCommand=dontinline,compiler.loopopts.BadPredicateAfterPartialPeel::not_inlined*
+ *      -XX:CompileCommand=quiet
+ *      compiler.loopopts.BadPredicateAfterPartialPeel
  */
 
+package compiler.loopopts;
+
 public class BadPredicateAfterPartialPeel {
 
     static void not_inlined1() {}
diff --git a/hotspot/test/compiler/loopopts/ConstFPVectorization.java b/hotspot/test/compiler/loopopts/ConstFPVectorization.java
index 50cb0e6..dfb10c7 100644
--- a/hotspot/test/compiler/loopopts/ConstFPVectorization.java
+++ b/hotspot/test/compiler/loopopts/ConstFPVectorization.java
@@ -26,11 +26,12 @@
  * @test
  * @bug 8074869
  * @summary C2 code generator can replace -0.0f with +0.0f on Linux
- * @run main ConstFPVectorization 8
+ * @run main compiler.loopopts.ConstFPVectorization 8
  * @author volker.simonis@gmail.com
- *
  */
 
+package compiler.loopopts;
+
 public class ConstFPVectorization {
 
     static float[] f = new float[16];
diff --git a/hotspot/test/compiler/loopopts/CountedLoopProblem.java b/hotspot/test/compiler/loopopts/CountedLoopProblem.java
index 23cc0bb..be23ae8 100644
--- a/hotspot/test/compiler/loopopts/CountedLoopProblem.java
+++ b/hotspot/test/compiler/loopopts/CountedLoopProblem.java
@@ -26,11 +26,13 @@
  * @test
  * @bug 8072753
  * @summary Inner loop induction variable increment occurs before compare which causes integer overflow
- * @run main/othervm CountedLoopProblem
+ * @run main/othervm compiler.loopopts.CountedLoopProblem
  *
  */
 
-import java.util.*;
+package compiler.loopopts;
+
+import java.util.Random;
 
 public class CountedLoopProblem {
     public static void main(String[] args) throws Exception {
diff --git a/hotspot/test/compiler/loopopts/6659207/Test.java b/hotspot/test/compiler/loopopts/Test6659207.java
similarity index 94%
rename from hotspot/test/compiler/loopopts/6659207/Test.java
rename to hotspot/test/compiler/loopopts/Test6659207.java
index a35b1c7..1ad8576 100644
--- a/hotspot/test/compiler/loopopts/6659207/Test.java
+++ b/hotspot/test/compiler/loopopts/Test6659207.java
@@ -26,9 +26,13 @@
  * @test
  * @bug 6659207
  * @summary access violation in CompilerThread0
+ *
+ * @run main compiler.loopopts.Test6659207
  */
 
-public class Test {
+package compiler.loopopts;
+
+public class Test6659207 {
     static int[] array = new int[12];
 
     static int index(int i) {
diff --git a/hotspot/test/compiler/loopopts/6855164/Test.java b/hotspot/test/compiler/loopopts/Test6855164.java
similarity index 93%
rename from hotspot/test/compiler/loopopts/6855164/Test.java
rename to hotspot/test/compiler/loopopts/Test6855164.java
index 3743d87..7d4b54c 100644
--- a/hotspot/test/compiler/loopopts/6855164/Test.java
+++ b/hotspot/test/compiler/loopopts/Test6855164.java
@@ -25,10 +25,13 @@
  * @test
  * @bug 6855164
  * @summary SIGSEGV during compilation of method involving loop over CharSequence
- * @run main/othervm -Xbatch Test
+ *
+ * @run main/othervm -Xbatch compiler.loopopts.Test6855164
  */
 
-public class Test{
+package compiler.loopopts;
+
+public class Test6855164 {
     public static void main(String[] args) throws Exception {
         StringBuffer builder = new StringBuffer();
 
diff --git a/hotspot/test/compiler/loopopts/Test6860469.java b/hotspot/test/compiler/loopopts/Test6860469.java
new file mode 100644
index 0000000..a3b6a2d
--- /dev/null
+++ b/hotspot/test/compiler/loopopts/Test6860469.java
@@ -0,0 +1,75 @@
+/*
+ * Copyright 2009 Google Inc.  All Rights Reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ *
+ */
+
+/**
+ * @test
+ * @bug 6860469
+ * @summary remix_address_expressions reshapes address expression with bad control
+ *
+ * @run main/othervm -Xcomp
+ *      -XX:CompileCommand=compileonly,compiler.loopopts.Test6860469::C
+ *      compiler.loopopts.Test6860469
+ */
+
+package compiler.loopopts;
+
+public class Test6860469 {
+
+    private static final int H = 16;
+    private static final int F = 9;
+
+    static int[] fl = new int[1 << F];
+
+    static int C(int ll, int f) {
+        int max = -1;
+        int min = H + 1;
+
+        if (ll != 0) {
+            if (ll < min) {
+                min = ll;
+            }
+            if (ll > max) {
+                max = ll;
+            }
+        }
+
+        if (f > max) {
+            f = max;
+        }
+        if (min > f) {
+            min = f;
+        }
+
+        for (int mc = 1 >> max - f; mc <= 0; mc++) {
+            int i = mc << (32 - f);
+            fl[i] = max;
+        }
+
+        return min;
+    }
+
+    public static void main(String argv[]) {
+        C(0, 10);
+    }
+}
diff --git a/hotspot/test/compiler/loopopts/Test7044738.java b/hotspot/test/compiler/loopopts/Test7044738.java
new file mode 100644
index 0000000..b7e64d3
--- /dev/null
+++ b/hotspot/test/compiler/loopopts/Test7044738.java
@@ -0,0 +1,107 @@
+/*
+ * Copyright (c) 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.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ *
+ */
+
+/**
+ * @test
+ * @bug 7044738
+ * @summary Loop unroll optimization causes incorrect result
+ *
+ * @run main/othervm -Xbatch compiler.loopopts.Test7044738
+ */
+
+package compiler.loopopts;
+
+public class Test7044738 {
+
+    private static final int INITSIZE = 10000;
+    public int d[] = {1, 2, 3, 4};
+    public int i, size;
+
+    private static int iter = 5;
+
+    boolean done() {
+        return (--iter > 0);
+    }
+
+    public static void main(String args[]) {
+        Test7044738 t = new Test7044738();
+        t.test();
+    }
+
+    int test() {
+
+        while (done()) {
+            size = INITSIZE;
+
+            for (i = 0; i < size; i++) {
+                d[0] = d[1]; // 2
+                d[1] = d[2]; // 3
+                d[2] = d[3]; // 4
+                d[3] = d[0]; // 2
+
+                d[0] = d[1]; // 3
+                d[1] = d[2]; // 4
+                d[2] = d[3]; // 2
+                d[3] = d[0]; // 3
+
+                d[0] = d[1]; // 4
+                d[1] = d[2]; // 2
+                d[2] = d[3]; // 3
+                d[3] = d[0]; // 4
+
+                d[0] = d[1]; // 2
+                d[1] = d[2]; // 3
+                d[2] = d[3]; // 4
+                d[3] = d[0]; // 2
+
+                d[0] = d[1]; // 3
+                d[1] = d[2]; // 4
+                d[2] = d[3]; // 2
+                d[3] = d[0]; // 3
+
+                d[0] = d[1]; // 4
+                d[1] = d[2]; // 2
+                d[2] = d[3]; // 3
+                d[3] = d[0]; // 4
+
+                d[0] = d[1]; // 2
+                d[1] = d[2]; // 3
+                d[2] = d[3]; // 4
+                d[3] = d[0]; // 2
+
+                d[0] = d[1]; // 3
+                d[1] = d[2]; // 4
+                d[2] = d[3]; // 2
+                d[3] = d[0]; // 3
+            }
+
+            // try to defeat dead code elimination
+            if (d[0] == d[1]) {
+                System.out.println("test failed: iter=" + iter + "  i=" + i + " d[] = { " + d[0] + ", " + d[1] + ", " + d[2] + ", " + d[3] + " } ");
+                System.exit(97);
+            }
+        }
+        return d[3];
+    }
+}
diff --git a/hotspot/test/compiler/loopopts/Test7052494.java b/hotspot/test/compiler/loopopts/Test7052494.java
new file mode 100644
index 0000000..1729a16
--- /dev/null
+++ b/hotspot/test/compiler/loopopts/Test7052494.java
@@ -0,0 +1,177 @@
+/*
+ * Copyright (c) 2011, 2014, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ *
+ */
+
+/**
+ * @test
+ * @bug 7052494
+ * @summary Eclipse test fails on JDK 7 b142
+ *
+ * @run main/othervm -Xbatch compiler.loopopts.Test7052494
+ */
+
+package compiler.loopopts;
+
+public class Test7052494 {
+
+    static int test1(int i, int limit) {
+        int result = 0;
+        while (i++ != 0) {
+            if (result >= limit)
+                break;
+            result = i * 2;
+        }
+        return result;
+    }
+
+    static int test2(int i, int limit) {
+        int result = 0;
+        while (i-- != 0) {
+            if (result <= limit)
+                break;
+            result = i * 2;
+        }
+        return result;
+    }
+
+    static void test3(int i, int limit, int arr[]) {
+        while (i++ != 0) {
+            if (arr[i - 1] >= limit)
+                break;
+            arr[i] = i * 2;
+        }
+    }
+
+    static void test4(int i, int limit, int arr[]) {
+        while (i-- != 0) {
+            if (arr[arr.length + i + 1] <= limit)
+                break;
+            arr[arr.length + i] = i * 2;
+        }
+    }
+
+    // Empty loop rolls through MAXINT if i > 0
+
+    static final int limit5 = Integer.MIN_VALUE + 10000;
+
+    static int test5(int i) {
+        int result = 0;
+        while (i++ != limit5) {
+            result = i * 2;
+        }
+        return result;
+    }
+
+    // Empty loop rolls through MININT if i < 0
+
+    static final int limit6 = Integer.MAX_VALUE - 10000;
+
+    static int test6(int i) {
+        int result = 0;
+        while (i-- != limit6) {
+            result = i * 2;
+        }
+        return result;
+    }
+
+    public static void main(String[] args) {
+        boolean failed = false;
+        int[] arr = new int[8];
+        int[] ar3 = {0, 0, 4, 6, 8, 10, 0, 0};
+        int[] ar4 = {0, 0, 0, -10, -8, -6, -4, 0};
+        System.out.println("test1");
+        for (int i = 0; i < 11000; i++) {
+            int k = test1(1, 10);
+            if (k != 10) {
+                System.out.println("FAILED: " + k + " != 10");
+                failed = true;
+                break;
+            }
+        }
+        System.out.println("test2");
+        for (int i = 0; i < 11000; i++) {
+            int k = test2(-1, -10);
+            if (k != -10) {
+                System.out.println("FAILED: " + k + " != -10");
+                failed = true;
+                break;
+            }
+        }
+        System.out.println("test3");
+        for (int i = 0; i < 11000; i++) {
+            java.util.Arrays.fill(arr, 0);
+            test3(1, 10, arr);
+            if (!java.util.Arrays.equals(arr, ar3)) {
+                System.out.println("FAILED: arr = { " + arr[0] + ", "
+                        + arr[1] + ", "
+                        + arr[2] + ", "
+                        + arr[3] + ", "
+                        + arr[4] + ", "
+                        + arr[5] + ", "
+                        + arr[6] + ", "
+                        + arr[7] + " }");
+                failed = true;
+                break;
+            }
+        }
+        System.out.println("test4");
+        for (int i = 0; i < 11000; i++) {
+            java.util.Arrays.fill(arr, 0);
+            test4(-1, -10, arr);
+            if (!java.util.Arrays.equals(arr, ar4)) {
+                System.out.println("FAILED: arr = { " + arr[0] + ", "
+                        + arr[1] + ", "
+                        + arr[2] + ", "
+                        + arr[3] + ", "
+                        + arr[4] + ", "
+                        + arr[5] + ", "
+                        + arr[6] + ", "
+                        + arr[7] + " }");
+                failed = true;
+                break;
+            }
+        }
+        System.out.println("test5");
+        for (int i = 0; i < 11000; i++) {
+            int k = test5(limit6);
+            if (k != limit5 * 2) {
+                System.out.println("FAILED: " + k + " != " + limit5 * 2);
+                failed = true;
+                break;
+            }
+        }
+        System.out.println("test6");
+        for (int i = 0; i < 11000; i++) {
+            int k = test6(limit5);
+            if (k != limit6 * 2) {
+                System.out.println("FAILED: " + k + " != " + limit6 * 2);
+                failed = true;
+                break;
+            }
+        }
+        System.out.println("finish");
+        if (failed) {
+            System.exit(97);
+        }
+    }
+}
diff --git a/hotspot/test/compiler/loopopts/TestArraysFillDeadControl.java b/hotspot/test/compiler/loopopts/TestArraysFillDeadControl.java
index 540ba42..1f9ce25 100644
--- a/hotspot/test/compiler/loopopts/TestArraysFillDeadControl.java
+++ b/hotspot/test/compiler/loopopts/TestArraysFillDeadControl.java
@@ -26,10 +26,14 @@
  * @test
  * @bug 8147645
  * @summary Array.fill intrinsification code doesn't mark replaced control as dead
- * @run main/othervm  -XX:-TieredCompilation -XX:CompileCommand=dontinline,TestArraysFillDeadControl::dont_inline TestArraysFillDeadControl
  *
+ * @run main/othervm -XX:-TieredCompilation
+ *      -XX:CompileCommand=dontinline,compiler.loopopts.TestArraysFillDeadControl::dont_inline
+ *      compiler.loopopts.TestArraysFillDeadControl
  */
 
+package compiler.loopopts;
+
 import java.util.Arrays;
 
 public class TestArraysFillDeadControl {
diff --git a/hotspot/test/compiler/loopopts/TestCastIINoLoopLimitCheck.java b/hotspot/test/compiler/loopopts/TestCastIINoLoopLimitCheck.java
index 9dc2e14..bb0c35a 100644
--- a/hotspot/test/compiler/loopopts/TestCastIINoLoopLimitCheck.java
+++ b/hotspot/test/compiler/loopopts/TestCastIINoLoopLimitCheck.java
@@ -26,10 +26,13 @@
  * @test
  * @bug 8073184
  * @summary CastII that guards counted loops confuses range check elimination with LoopLimitCheck off
- * @run main/othervm -XX:+IgnoreUnrecognizedVMOptions -XX:CompileOnly=TestCastIINoLoopLimitCheck.m -Xcomp  TestCastIINoLoopLimitCheck
  *
+ * @run main/othervm -XX:+IgnoreUnrecognizedVMOptions -Xcomp
+ *      -XX:CompileCommand=compileonly,compiler.loopopts.TestCastIINoLoopLimitCheck::m
+ *      compiler.loopopts.TestCastIINoLoopLimitCheck
  */
 
+package compiler.loopopts;
 /*
  * The test was originally run with
  *
diff --git a/hotspot/test/compiler/c2/8007722/Test8007722.java b/hotspot/test/compiler/loopopts/TestCountedLoopSafepointBackedge.java
similarity index 60%
copy from hotspot/test/compiler/c2/8007722/Test8007722.java
copy to hotspot/test/compiler/loopopts/TestCountedLoopSafepointBackedge.java
index 2e197a4..31c32f2 100644
--- a/hotspot/test/compiler/c2/8007722/Test8007722.java
+++ b/hotspot/test/compiler/loopopts/TestCountedLoopSafepointBackedge.java
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2016, Red Hat, Inc. 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
@@ -21,36 +21,33 @@
  * questions.
  */
 
-/*
+/**
  * @test
- * @bug 8007722
- * @summary GetAndSetP's MachNode should capture bottom type
- * @run main/othervm -XX:-UseOnStackReplacement -XX:-BackgroundCompilation Test8007722
+ * @bug 8161147
+ * @requires vm.flavor == "server"
+ * @summary Safepoint on backedge breaks UseCountedLoopSafepoints
+ * @run main/othervm -XX:-BackgroundCompilation -XX:-UseOnStackReplacement -XX:+UseCountedLoopSafepoints TestCountedLoopSafepointBackedge
  *
  */
 
-import java.util.concurrent.atomic.*;
-
-public class Test8007722 {
-
-    int i;
-    static AtomicReference<Test8007722> ref;
-
-    static int test(Test8007722 new_obj) {
-        Test8007722 o = ref.getAndSet(new_obj);
-        int ret = o.i;
-        o.i = 5;
-        return ret;
+public class TestCountedLoopSafepointBackedge {
+    static void test(int[] arr, int inc) {
+        int i = 0;
+        for (;;) {
+            for (int j = 0; j < 10; j++);
+            arr[i] = i;
+            i++;
+            if (i >= 100) {
+                break;
+            }
+            for (int j = 0; j < 10; j++);
+        }
     }
 
     static public void main(String[] args) {
-        Test8007722 obj = new Test8007722();
-        ref = new AtomicReference<Test8007722>(obj);
-
+        int[] arr = new int[100];
         for (int i = 0; i < 20000; i++) {
-            test(obj);
+             test(arr, 1);
         }
-
-        System.out.println("PASSED");
     }
 }
diff --git a/hotspot/test/compiler/loopopts/TestDeadBackbranchArrayAccess.java b/hotspot/test/compiler/loopopts/TestDeadBackbranchArrayAccess.java
index f278238..e3deae8 100644
--- a/hotspot/test/compiler/loopopts/TestDeadBackbranchArrayAccess.java
+++ b/hotspot/test/compiler/loopopts/TestDeadBackbranchArrayAccess.java
@@ -26,10 +26,14 @@
  * @test
  * @bug 8054478
  * @summary dead backbranch in main loop results in erroneous array access
- * @run main/othervm -XX:CompileOnly=TestDeadBackbranchArrayAccess -Xcomp TestDeadBackbranchArrayAccess
  *
+ * @run main/othervm -Xcomp
+ *      -XX:CompileCommand=compileonly,compiler.loopopts.TestDeadBackbranchArrayAccess::*
+ *      compiler.loopopts.TestDeadBackbranchArrayAccess
  */
 
+package compiler.loopopts;
+
 public class TestDeadBackbranchArrayAccess {
     static char[] pattern0 = {0};
     static char[] pattern1 = {1};
diff --git a/hotspot/test/compiler/loopopts/TestLogSum.java b/hotspot/test/compiler/loopopts/TestLogSum.java
index a32963d..cbd13fd 100644
--- a/hotspot/test/compiler/loopopts/TestLogSum.java
+++ b/hotspot/test/compiler/loopopts/TestLogSum.java
@@ -25,14 +25,18 @@
  * @test
  * @bug 8046516
  * @summary Segmentation fault in JVM (easily reproducible)
- * @run main/othervm -XX:-TieredCompilation -Xbatch TestLogSum
+ *
+ * @run main/othervm -XX:-TieredCompilation -Xbatch compiler.loopopts.TestLogSum
  * @author jackkamm@gmail.com
  */
 
+package compiler.loopopts;
+
 import java.util.Arrays;
 import java.util.HashMap;
 import java.util.List;
 import java.util.Map;
+
 public class TestLogSum {
   public static void main(String[] args) {
     double sum;
diff --git a/hotspot/test/compiler/loopopts/TestLoopPeeling.java b/hotspot/test/compiler/loopopts/TestLoopPeeling.java
index d2d2e3d..3627ff5 100644
--- a/hotspot/test/compiler/loopopts/TestLoopPeeling.java
+++ b/hotspot/test/compiler/loopopts/TestLoopPeeling.java
@@ -25,8 +25,14 @@
  * @test
  * @bug 8078262
  * @summary Tests correct dominator information after loop peeling.
- * @run main/othervm -Xcomp -XX:CompileCommand=compileonly,TestLoopPeeling::test* TestLoopPeeling
+ *
+ * @run main/othervm -Xcomp
+ *      -XX:CompileCommand=compileonly,compiler.loopopts.TestLoopPeeling::test*
+ *      compiler.loopopts.TestLoopPeeling
  */
+
+package compiler.loopopts;
+
 public class TestLoopPeeling {
 
     public int[] array = new int[100];
diff --git a/hotspot/test/compiler/loopopts/TestMoveStoresOutOfLoops.java b/hotspot/test/compiler/loopopts/TestMoveStoresOutOfLoops.java
index af99d6b..ea70d70 100644
--- a/hotspot/test/compiler/loopopts/TestMoveStoresOutOfLoops.java
+++ b/hotspot/test/compiler/loopopts/TestMoveStoresOutOfLoops.java
@@ -26,13 +26,18 @@
  * @test
  * @bug 8080289
  * @summary Move stores out of loops if possible
- * @run main/othervm -XX:-UseOnStackReplacement -XX:-BackgroundCompilation -XX:CompileCommand=dontinline,TestMoveStoresOutOfLoops::test*  TestMoveStoresOutOfLoops
  *
+ * @run main/othervm -XX:-UseOnStackReplacement -XX:-BackgroundCompilation
+ *      -XX:CompileCommand=dontinline,compiler.loopopts.TestMoveStoresOutOfLoops::test*
+ *      compiler.loopopts.TestMoveStoresOutOfLoops
  */
 
-import java.lang.reflect.*;
-import java.util.*;
-import java.util.function.*;
+package compiler.loopopts;
+
+import java.lang.reflect.Method;
+import java.lang.reflect.Modifier;
+import java.util.HashMap;
+import java.util.function.Function;
 
 public class TestMoveStoresOutOfLoops {
 
diff --git a/hotspot/test/compiler/loopopts/TestMoveStoresOutOfLoopsStoreNoCtrl.java b/hotspot/test/compiler/loopopts/TestMoveStoresOutOfLoopsStoreNoCtrl.java
index ec9dcd5..8419ae1 100644
--- a/hotspot/test/compiler/loopopts/TestMoveStoresOutOfLoopsStoreNoCtrl.java
+++ b/hotspot/test/compiler/loopopts/TestMoveStoresOutOfLoopsStoreNoCtrl.java
@@ -25,10 +25,14 @@
  * @test
  * @bug 8134288
  * @summary Store nodes may not have a control if used to update profiling
- * @run main/othervm -XX:-ProfileInterpreter -XX:-TieredCompilation -XX:-BackgroundCompilation TestMoveStoresOutOfLoopsStoreNoCtrl
  *
+ * @run main/othervm -XX:-ProfileInterpreter -XX:-TieredCompilation
+ *                   -XX:-BackgroundCompilation
+ *                   compiler.loopopts.TestMoveStoresOutOfLoopsStoreNoCtrl
  */
 
+package compiler.loopopts;
+
 public class TestMoveStoresOutOfLoopsStoreNoCtrl {
 
     static void test(boolean flag) {
diff --git a/hotspot/test/compiler/loopopts/TestOverunrolling.java b/hotspot/test/compiler/loopopts/TestOverunrolling.java
new file mode 100644
index 0000000..0223048
--- /dev/null
+++ b/hotspot/test/compiler/loopopts/TestOverunrolling.java
@@ -0,0 +1,62 @@
+/*
+ * 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.
+ */
+
+/*
+ * @test
+ * @bug 8159016
+ * @summary Tests correct dominator information after over-unrolling a loop.
+ * @requires vm.gc == "Parallel" | vm.gc == "null"
+ *
+ * @run main/othervm -XX:+IgnoreUnrecognizedVMOptions -Xcomp -XX:-TieredCompilation
+ *                   -XX:-UseG1GC -XX:+UseParallelGC
+ *                   compiler.loopopts.TestOverunrolling
+ */
+
+package compiler.loopopts;
+
+public class TestOverunrolling {
+
+    public static Object test(int arg) {
+        Object arr[] = new Object[3];
+        int lim = (arg & 3);
+        // The pre loop is executed for one iteration, initializing p[0].
+        // The main loop is unrolled twice, initializing p[1], p[2], p[3] and p[4].
+        // The p[3] and p[4] stores are always out of bounds and removed. However,
+        // C2 is unable to remove the "over-unrolled", dead main loop. As a result,
+        // there is a control path from the main loop to the post loop without a
+        // memory path (because the last store was replaced by TOP). We crash
+        // because we use a memory edge from a non-dominating region.
+        for (int i = 0; i < lim; ++i) {
+            arr[i] = new Object();
+        }
+        // Avoid EA
+        return arr;
+    }
+
+    public static void main(String args[]) {
+        for (int i = 0; i < 42; ++i) {
+            test(i);
+        }
+    }
+}
+
diff --git a/hotspot/test/compiler/loopopts/TestPredicateLostDependency.java b/hotspot/test/compiler/loopopts/TestPredicateLostDependency.java
index a9986c2..666bc37 100644
--- a/hotspot/test/compiler/loopopts/TestPredicateLostDependency.java
+++ b/hotspot/test/compiler/loopopts/TestPredicateLostDependency.java
@@ -26,10 +26,15 @@
  * @test
  * @bug 8069191
  * @summary predicate moved out of loops and CastPP removal causes dependency to be lost
- * @run main/othervm -Xcomp -XX:CompileOnly=TestPredicateLostDependency.m1 -XX:+IgnoreUnrecognizedVMOptions -XX:+StressGCM TestPredicateLostDependency
+ *
+ * @run main/othervm -Xcomp -XX:+IgnoreUnrecognizedVMOptions -XX:+UnlockDiagnosticVMOptions -XX:+StressGCM
+ *                   -XX:CompileCommand=compileonly,compiler.loopopts.TestPredicateLostDependency::m1
+ *                   compiler.loopopts.TestPredicateLostDependency
  *
  */
 
+package compiler.loopopts;
+
 public class TestPredicateLostDependency {
     static class A {
         int i;
diff --git a/hotspot/test/compiler/loopopts/TestSplitIfBlocksDisabled.java b/hotspot/test/compiler/loopopts/TestSplitIfBlocksDisabled.java
index 63745f7..38979a3 100644
--- a/hotspot/test/compiler/loopopts/TestSplitIfBlocksDisabled.java
+++ b/hotspot/test/compiler/loopopts/TestSplitIfBlocksDisabled.java
@@ -26,8 +26,13 @@
  * @test TestSplitIfBlocksDisabled
  * @bug 8086057
  * @summary Verifies that loop optimizations work if SplitIfBlocks is disabled.
- * @run main/othervm -XX:+IgnoreUnrecognizedVMOptions -Xcomp -XX:-SplitIfBlocks TestSplitIfBlocksDisabled
+ *
+ * @run main/othervm -XX:+IgnoreUnrecognizedVMOptions -Xcomp -XX:-SplitIfBlocks
+ *                   compiler.loopopts.TestSplitIfBlocksDisabled
  */
+
+package compiler.loopopts;
+
 public class TestSplitIfBlocksDisabled {
 
     public static void main(String[] args) {
diff --git a/hotspot/test/compiler/loopopts/TestSplitIfUnswitchedLoopsEliminated.java b/hotspot/test/compiler/loopopts/TestSplitIfUnswitchedLoopsEliminated.java
index 78cda88..b278943 100644
--- a/hotspot/test/compiler/loopopts/TestSplitIfUnswitchedLoopsEliminated.java
+++ b/hotspot/test/compiler/loopopts/TestSplitIfUnswitchedLoopsEliminated.java
@@ -26,10 +26,13 @@
  * @test
  * @bug 8078426
  * @summary split if finds predicates on several incoming paths when unswitched's loops are optimized out
- * @run main/othervm -XX:+IgnoreUnrecognizedVMOptions -XX:-UseOnStackReplacement -XX:-BackgroundCompilation -XX:-UseCompressedOops TestSplitIfUnswitchedLoopsEliminated
  *
+ * @run main/othervm -XX:+IgnoreUnrecognizedVMOptions -XX:-UseOnStackReplacement
+ *                   -XX:-BackgroundCompilation -XX:-UseCompressedOops
+ *                   compiler.loopopts.TestSplitIfUnswitchedLoopsEliminated
  */
 
+package compiler.loopopts;
 
 public class TestSplitIfUnswitchedLoopsEliminated {
 
diff --git a/hotspot/test/compiler/loopopts/UseCountedLoopSafepoints.java b/hotspot/test/compiler/loopopts/UseCountedLoopSafepoints.java
index 67cd3c9..77a9445 100644
--- a/hotspot/test/compiler/loopopts/UseCountedLoopSafepoints.java
+++ b/hotspot/test/compiler/loopopts/UseCountedLoopSafepoints.java
@@ -28,14 +28,16 @@
  * @summary Test that C2 flag UseCountedLoopSafepoints ensures a safepoint is kept in a CountedLoop
  * @library /testlibrary
  * @modules java.base/jdk.internal.misc
- * @modules java.base
  * @ignore 8146096
- * @run main UseCountedLoopSafepoints
+ * @run driver compiler.loopopts.UseCountedLoopSafepoints
  */
 
-import java.util.concurrent.atomic.AtomicLong;
-import jdk.test.lib.ProcessTools;
+package compiler.loopopts;
+
 import jdk.test.lib.OutputAnalyzer;
+import jdk.test.lib.ProcessTools;
+
+import java.util.concurrent.atomic.AtomicLong;
 
 public class UseCountedLoopSafepoints {
     private static final AtomicLong _num = new AtomicLong(0);
@@ -59,7 +61,7 @@
                     "-XX:+SafepointTimeout",
                     "-XX:SafepointTimeoutDelay=2000",
                     "-XX:+UseCountedLoopSafepoints",
-                    "UseCountedLoopSafepoints",
+                    UseCountedLoopSafepoints.class.getName(),
                     "2000000000"
                     );
             OutputAnalyzer output = new OutputAnalyzer(pb.start());
diff --git a/hotspot/test/compiler/loopopts/superword/ProdRed_Double.java b/hotspot/test/compiler/loopopts/superword/ProdRed_Double.java
index 37e9fca..d225ecc 100644
--- a/hotspot/test/compiler/loopopts/superword/ProdRed_Double.java
+++ b/hotspot/test/compiler/loopopts/superword/ProdRed_Double.java
@@ -28,56 +28,85 @@
  * @summary Add C2 x86 Superword support for scalar product reduction optimizations : float test
  * @requires os.arch=="x86" | os.arch=="i386" | os.arch=="amd64" | os.arch=="x86_64" | os.arch=="aarch64"
  *
- * @run main/othervm -XX:+IgnoreUnrecognizedVMOptions -XX:+SuperWordReductions -XX:LoopUnrollLimit=250 -XX:LoopMaxUnroll=2 -XX:CompileThresholdScaling=0.1 ProdRed_Double
- * @run main/othervm -XX:+IgnoreUnrecognizedVMOptions -XX:-SuperWordReductions -XX:LoopUnrollLimit=250 -XX:LoopMaxUnroll=2 -XX:CompileThresholdScaling=0.1 ProdRed_Double
+ * @run main/othervm -XX:+IgnoreUnrecognizedVMOptions -XX:LoopUnrollLimit=250
+ *      -XX:CompileThresholdScaling=0.1
+ *      -XX:+SuperWordReductions
+ *      -XX:LoopMaxUnroll=2
+ *      compiler.loopopts.superword.ProdRed_Double
+ * @run main/othervm -XX:+IgnoreUnrecognizedVMOptions -XX:LoopUnrollLimit=250
+ *      -XX:CompileThresholdScaling=0.1
+ *      -XX:-SuperWordReductions
+ *      -XX:LoopMaxUnroll=2
+ *      compiler.loopopts.superword.ProdRed_Double
  *
- * @run main/othervm -XX:+IgnoreUnrecognizedVMOptions -XX:+SuperWordReductions -XX:LoopUnrollLimit=250 -XX:LoopMaxUnroll=4 -XX:CompileThresholdScaling=0.1 ProdRed_Double
- * @run main/othervm -XX:+IgnoreUnrecognizedVMOptions -XX:-SuperWordReductions -XX:LoopUnrollLimit=250 -XX:LoopMaxUnroll=4 -XX:CompileThresholdScaling=0.1 ProdRed_Double
+ * @run main/othervm -XX:+IgnoreUnrecognizedVMOptions -XX:LoopUnrollLimit=250
+ *      -XX:CompileThresholdScaling=0.1
+ *      -XX:+SuperWordReductions
+ *      -XX:LoopMaxUnroll=4
+ *      compiler.loopopts.superword.ProdRed_Double
+ * @run main/othervm -XX:+IgnoreUnrecognizedVMOptions -XX:LoopUnrollLimit=250
+ *      -XX:CompileThresholdScaling=0.1
+ *      -XX:-SuperWordReductions
+ *      -XX:LoopMaxUnroll=4
+ *      compiler.loopopts.superword.ProdRed_Double
  *
- * @run main/othervm -XX:+IgnoreUnrecognizedVMOptions -XX:+SuperWordReductions -XX:LoopUnrollLimit=250 -XX:LoopMaxUnroll=8 -XX:CompileThresholdScaling=0.1 ProdRed_Double
- * @run main/othervm -XX:+IgnoreUnrecognizedVMOptions -XX:-SuperWordReductions -XX:LoopUnrollLimit=250 -XX:LoopMaxUnroll=8 -XX:CompileThresholdScaling=0.1 ProdRed_Double
+ * @run main/othervm -XX:+IgnoreUnrecognizedVMOptions -XX:LoopUnrollLimit=250
+ *      -XX:CompileThresholdScaling=0.1
+ *      -XX:+SuperWordReductions
+ *      -XX:LoopMaxUnroll=8
+ *      compiler.loopopts.superword.ProdRed_Double
+ * @run main/othervm -XX:+IgnoreUnrecognizedVMOptions -XX:LoopUnrollLimit=250
+ *      -XX:CompileThresholdScaling=0.1
+ *      -XX:-SuperWordReductions
+ *      -XX:LoopMaxUnroll=8
+ *      compiler.loopopts.superword.ProdRed_Double
  *
- * @run main/othervm -XX:+IgnoreUnrecognizedVMOptions -XX:+SuperWordReductions -XX:LoopUnrollLimit=250 -XX:LoopMaxUnroll=16 -XX:CompileThresholdScaling=0.1 ProdRed_Double
- * @run main/othervm -XX:+IgnoreUnrecognizedVMOptions -XX:-SuperWordReductions -XX:LoopUnrollLimit=250 -XX:LoopMaxUnroll=16 -XX:CompileThresholdScaling=0.1 ProdRed_Double
+ * @run main/othervm -XX:+IgnoreUnrecognizedVMOptions -XX:LoopUnrollLimit=250
+ *      -XX:CompileThresholdScaling=0.1
+ *      -XX:+SuperWordReductions
+ *      -XX:LoopMaxUnroll=16
+ *      compiler.loopopts.superword.ProdRed_Double
+ * @run main/othervm -XX:+IgnoreUnrecognizedVMOptions -XX:LoopUnrollLimit=250
+ *      -XX:CompileThresholdScaling=0.1
+ *      -XX:-SuperWordReductions
+ *      -XX:LoopMaxUnroll=16
+ *      compiler.loopopts.superword.ProdRed_Double
  */
 
-public class ProdRed_Double
-{
-  public static void main(String[] args) throws Exception {
-    double[] a = new double[256*1024];
-    double[] b = new double[256*1024];
-    prodReductionInit(a,b);
-    double valid = 2000;
-    double total = 0;
-    for(int j = 0; j < 2000; j++) {
-      total = j + 1;
-      total = prodReductionImplement(a,b, total);
-    }
-    if(total == valid) {
-      System.out.println("Success");
-    } else {
-      System.out.println("Invalid sum of elements variable in total: " + total);
-      System.out.println("Expected value = " + valid);
-      throw new Exception("Failed");
-    }
-  }
+package compiler.loopopts.superword;
 
-  public static void prodReductionInit(double[] a, double[] b)
-  {
-    for(int i = 0; i < a.length; i++)
-    {
-      a[i] = i + 2;
-      b[i] = i + 1;
+public class ProdRed_Double {
+    public static void main(String[] args) throws Exception {
+        double[] a = new double[256 * 1024];
+        double[] b = new double[256 * 1024];
+        prodReductionInit(a, b);
+        double valid = 2000;
+        double total = 0;
+        for (int j = 0; j < 2000; j++) {
+            total = j + 1;
+            total = prodReductionImplement(a, b, total);
+        }
+        if (total == valid) {
+            System.out.println("Success");
+        } else {
+            System.out.println("Invalid sum of elements variable in total: " + total);
+            System.out.println("Expected value = " + valid);
+            throw new Exception("Failed");
+        }
     }
-  }
 
-  public static double prodReductionImplement(double[] a, double[] b, double total)
-  {
-    for(int i = 0; i < a.length; i++)
-    {
-      total *= a[i] - b[i];
+    public static void prodReductionInit(double[] a, double[] b) {
+        for (int i = 0; i < a.length; i++) {
+            a[i] = i + 2;
+            b[i] = i + 1;
+        }
     }
-    return total;
-  }
+
+    public static double prodReductionImplement(double[] a, double[] b, double total) {
+        for (int i = 0; i < a.length; i++) {
+            total *= a[i] - b[i];
+        }
+        return total;
+    }
 
 }
diff --git a/hotspot/test/compiler/loopopts/superword/ProdRed_Float.java b/hotspot/test/compiler/loopopts/superword/ProdRed_Float.java
index b31cf10..d6702ec 100644
--- a/hotspot/test/compiler/loopopts/superword/ProdRed_Float.java
+++ b/hotspot/test/compiler/loopopts/superword/ProdRed_Float.java
@@ -28,56 +28,85 @@
  * @summary Add C2 x86 Superword support for scalar product reduction optimizations : float test
  * @requires os.arch=="x86" | os.arch=="i386" | os.arch=="amd64" | os.arch=="x86_64" | os.arch=="aarch64"
  *
- * @run main/othervm -XX:+IgnoreUnrecognizedVMOptions -XX:+SuperWordReductions -XX:LoopUnrollLimit=250 -XX:LoopMaxUnroll=2 -XX:CompileThresholdScaling=0.1 ProdRed_Float
- * @run main/othervm -XX:+IgnoreUnrecognizedVMOptions -XX:-SuperWordReductions -XX:LoopUnrollLimit=250 -XX:LoopMaxUnroll=2 -XX:CompileThresholdScaling=0.1 ProdRed_Float
+ * @run main/othervm -XX:+IgnoreUnrecognizedVMOptions -XX:LoopUnrollLimit=250
+ *      -XX:CompileThresholdScaling=0.1
+ *      -XX:+SuperWordReductions
+ *      -XX:LoopMaxUnroll=2
+ *      compiler.loopopts.superword.ProdRed_Float
+ * @run main/othervm -XX:+IgnoreUnrecognizedVMOptions -XX:LoopUnrollLimit=250
+ *      -XX:CompileThresholdScaling=0.1
+ *      -XX:-SuperWordReductions
+ *      -XX:LoopMaxUnroll=2
+ *      compiler.loopopts.superword.ProdRed_Float
  *
- * @run main/othervm -XX:+IgnoreUnrecognizedVMOptions -XX:+SuperWordReductions -XX:LoopUnrollLimit=250 -XX:LoopMaxUnroll=4 -XX:CompileThresholdScaling=0.1 ProdRed_Float
- * @run main/othervm -XX:+IgnoreUnrecognizedVMOptions -XX:-SuperWordReductions -XX:LoopUnrollLimit=250 -XX:LoopMaxUnroll=4 -XX:CompileThresholdScaling=0.1 ProdRed_Float
+ * @run main/othervm -XX:+IgnoreUnrecognizedVMOptions -XX:LoopUnrollLimit=250
+ *      -XX:CompileThresholdScaling=0.1
+ *      -XX:+SuperWordReductions
+ *      -XX:LoopMaxUnroll=4
+ *      compiler.loopopts.superword.ProdRed_Float
+ * @run main/othervm -XX:+IgnoreUnrecognizedVMOptions -XX:LoopUnrollLimit=250
+ *      -XX:CompileThresholdScaling=0.1
+ *      -XX:-SuperWordReductions
+ *      -XX:LoopMaxUnroll=4
+ *      compiler.loopopts.superword.ProdRed_Float
  *
- * @run main/othervm -XX:+IgnoreUnrecognizedVMOptions -XX:+SuperWordReductions -XX:LoopUnrollLimit=250 -XX:LoopMaxUnroll=8 -XX:CompileThresholdScaling=0.1 ProdRed_Float
- * @run main/othervm -XX:+IgnoreUnrecognizedVMOptions -XX:-SuperWordReductions -XX:LoopUnrollLimit=250 -XX:LoopMaxUnroll=8 -XX:CompileThresholdScaling=0.1 ProdRed_Float
+ * @run main/othervm -XX:+IgnoreUnrecognizedVMOptions -XX:LoopUnrollLimit=250
+ *      -XX:CompileThresholdScaling=0.1
+ *      -XX:+SuperWordReductions
+ *      -XX:LoopMaxUnroll=8
+ *      compiler.loopopts.superword.ProdRed_Float
+ * @run main/othervm -XX:+IgnoreUnrecognizedVMOptions -XX:LoopUnrollLimit=250
+ *      -XX:CompileThresholdScaling=0.1
+ *      -XX:-SuperWordReductions
+ *      -XX:LoopMaxUnroll=8
+ *      compiler.loopopts.superword.ProdRed_Float
  *
- * @run main/othervm -XX:+IgnoreUnrecognizedVMOptions -XX:+SuperWordReductions -XX:LoopUnrollLimit=250 -XX:LoopMaxUnroll=16 -XX:CompileThresholdScaling=0.1 ProdRed_Float
- * @run main/othervm -XX:+IgnoreUnrecognizedVMOptions -XX:-SuperWordReductions -XX:LoopUnrollLimit=250 -XX:LoopMaxUnroll=16 -XX:CompileThresholdScaling=0.1 ProdRed_Float
+ * @run main/othervm -XX:+IgnoreUnrecognizedVMOptions -XX:LoopUnrollLimit=250
+ *      -XX:CompileThresholdScaling=0.1
+ *      -XX:+SuperWordReductions
+ *      -XX:LoopMaxUnroll=16
+ *      compiler.loopopts.superword.ProdRed_Float
+ * @run main/othervm -XX:+IgnoreUnrecognizedVMOptions -XX:LoopUnrollLimit=250
+ *      -XX:CompileThresholdScaling=0.1
+ *      -XX:-SuperWordReductions
+ *      -XX:LoopMaxUnroll=16
+ *      compiler.loopopts.superword.ProdRed_Float
  */
 
-public class ProdRed_Float
-{
-  public static void main(String[] args) throws Exception {
-    float[] a = new float[256*1024];
-    float[] b = new float[256*1024];
-    prodReductionInit(a,b);
-    float valid = 2000;
-    float total = 0;
-    for(int j = 0; j < 2000; j++) {
-      total = j + 1;
-      total = prodReductionImplement(a,b, total);
-    }
-    if(total == valid) {
-      System.out.println("Success");
-    } else {
-      System.out.println("Invalid sum of elements variable in total: " + total);
-      System.out.println("Expected value = " + valid);
-      throw new Exception("Failed");
-    }
-  }
+package compiler.loopopts.superword;
 
-  public static void prodReductionInit(float[] a, float[] b)
-  {
-    for(int i = 0; i < a.length; i++)
-    {
-      a[i] = i + 2;
-      b[i] = i + 1;
+public class ProdRed_Float {
+    public static void main(String[] args) throws Exception {
+        float[] a = new float[256 * 1024];
+        float[] b = new float[256 * 1024];
+        prodReductionInit(a, b);
+        float valid = 2000;
+        float total = 0;
+        for (int j = 0; j < 2000; j++) {
+            total = j + 1;
+            total = prodReductionImplement(a, b, total);
+        }
+        if (total == valid) {
+            System.out.println("Success");
+        } else {
+            System.out.println("Invalid sum of elements variable in total: " + total);
+            System.out.println("Expected value = " + valid);
+            throw new Exception("Failed");
+        }
     }
-  }
 
-  public static float prodReductionImplement(float[] a, float[] b, float total)
-  {
-    for(int i = 0; i < a.length; i++)
-    {
-      total *= a[i] - b[i];
+    public static void prodReductionInit(float[] a, float[] b) {
+        for (int i = 0; i < a.length; i++) {
+            a[i] = i + 2;
+            b[i] = i + 1;
+        }
     }
-    return total;
-  }
+
+    public static float prodReductionImplement(float[] a, float[] b, float total) {
+        for (int i = 0; i < a.length; i++) {
+            total *= a[i] - b[i];
+        }
+        return total;
+    }
 
 }
diff --git a/hotspot/test/compiler/loopopts/superword/ProdRed_Int.java b/hotspot/test/compiler/loopopts/superword/ProdRed_Int.java
index a1e8356..423cdfa 100644
--- a/hotspot/test/compiler/loopopts/superword/ProdRed_Int.java
+++ b/hotspot/test/compiler/loopopts/superword/ProdRed_Int.java
@@ -28,55 +28,84 @@
  * @summary Add C2 x86 Superword support for scalar product reduction optimizations : int test
  * @requires os.arch=="x86" | os.arch=="i386" | os.arch=="amd64" | os.arch=="x86_64" | os.arch=="aarch64"
  *
- * @run main/othervm -XX:+IgnoreUnrecognizedVMOptions -XX:+SuperWordReductions -XX:LoopUnrollLimit=250 -XX:LoopMaxUnroll=2 -XX:CompileThresholdScaling=0.1 ProdRed_Int
- * @run main/othervm -XX:+IgnoreUnrecognizedVMOptions -XX:-SuperWordReductions -XX:LoopUnrollLimit=250 -XX:LoopMaxUnroll=2 -XX:CompileThresholdScaling=0.1 ProdRed_Int
+ * @run main/othervm -XX:+IgnoreUnrecognizedVMOptions -XX:LoopUnrollLimit=250
+ *      -XX:CompileThresholdScaling=0.1
+ *      -XX:+SuperWordReductions
+ *      -XX:LoopMaxUnroll=2
+ *      compiler.loopopts.superword.ProdRed_Int
+ * @run main/othervm -XX:+IgnoreUnrecognizedVMOptions -XX:LoopUnrollLimit=250
+ *      -XX:CompileThresholdScaling=0.1
+ *      -XX:-SuperWordReductions
+ *      -XX:LoopMaxUnroll=2
+ *      compiler.loopopts.superword.ProdRed_Int
  *
- * @run main/othervm -XX:+IgnoreUnrecognizedVMOptions -XX:+SuperWordReductions -XX:LoopUnrollLimit=250 -XX:LoopMaxUnroll=4 -XX:CompileThresholdScaling=0.1 ProdRed_Int
- * @run main/othervm -XX:+IgnoreUnrecognizedVMOptions -XX:-SuperWordReductions -XX:LoopUnrollLimit=250 -XX:LoopMaxUnroll=4 -XX:CompileThresholdScaling=0.1 ProdRed_Int
+ * @run main/othervm -XX:+IgnoreUnrecognizedVMOptions -XX:LoopUnrollLimit=250
+ *      -XX:CompileThresholdScaling=0.1
+ *      -XX:+SuperWordReductions
+ *      -XX:LoopMaxUnroll=4
+ *      compiler.loopopts.superword.ProdRed_Int
+ * @run main/othervm -XX:+IgnoreUnrecognizedVMOptions -XX:LoopUnrollLimit=250
+ *      -XX:CompileThresholdScaling=0.1
+ *      -XX:-SuperWordReductions
+ *      -XX:LoopMaxUnroll=4
+ *      compiler.loopopts.superword.ProdRed_Int
  *
- * @run main/othervm -XX:+IgnoreUnrecognizedVMOptions -XX:+SuperWordReductions -XX:LoopUnrollLimit=250 -XX:LoopMaxUnroll=8 -XX:CompileThresholdScaling=0.1 ProdRed_Int
- * @run main/othervm -XX:+IgnoreUnrecognizedVMOptions -XX:-SuperWordReductions -XX:LoopUnrollLimit=250 -XX:LoopMaxUnroll=8 -XX:CompileThresholdScaling=0.1 ProdRed_Int
+ * @run main/othervm -XX:+IgnoreUnrecognizedVMOptions -XX:LoopUnrollLimit=250
+ *      -XX:CompileThresholdScaling=0.1
+ *      -XX:+SuperWordReductions
+ *      -XX:LoopMaxUnroll=8
+ *      compiler.loopopts.superword.ProdRed_Int
+ * @run main/othervm -XX:+IgnoreUnrecognizedVMOptions -XX:LoopUnrollLimit=250
+ *      -XX:CompileThresholdScaling=0.1
+ *      -XX:-SuperWordReductions
+ *      -XX:LoopMaxUnroll=8
+ *      compiler.loopopts.superword.ProdRed_Int
  *
- * @run main/othervm -XX:+IgnoreUnrecognizedVMOptions -XX:+SuperWordReductions -XX:LoopUnrollLimit=250 -XX:LoopMaxUnroll=16 -XX:CompileThresholdScaling=0.1 ProdRed_Int
- * @run main/othervm -XX:+IgnoreUnrecognizedVMOptions -XX:-SuperWordReductions -XX:LoopUnrollLimit=250 -XX:LoopMaxUnroll=16 -XX:CompileThresholdScaling=0.1 ProdRed_Int
+ * @run main/othervm -XX:+IgnoreUnrecognizedVMOptions -XX:LoopUnrollLimit=250
+ *      -XX:CompileThresholdScaling=0.1
+ *      -XX:+SuperWordReductions
+ *      -XX:LoopMaxUnroll=16
+ *      compiler.loopopts.superword.ProdRed_Int
+ * @run main/othervm -XX:+IgnoreUnrecognizedVMOptions -XX:LoopUnrollLimit=250
+ *      -XX:CompileThresholdScaling=0.1
+ *      -XX:-SuperWordReductions
+ *      -XX:LoopMaxUnroll=16
+ *      compiler.loopopts.superword.ProdRed_Int
  */
 
-public class ProdRed_Int
-{
-  public static void main(String[] args) throws Exception {
-    int[] a = new int[256*1024];
-    int[] b = new int[256*1024];
-    prodReductionInit(a,b);
-    int valid = 419430401;
-    int total = 1;
-    for(int j = 0; j < 2000; j++) {
-      total = prodReductionImplement(a,b,total);
-    }
-    if(total == valid) {
-      System.out.println("Success");
-    } else {
-      System.out.println("Invalid sum of elements variable in total: " + total);
-      System.out.println("Expected value = " + valid);
-      throw new Exception("Failed");
-    }
-  }
+package compiler.loopopts.superword;
 
-  public static void prodReductionInit(int[] a, int[] b)
-  {
-    for(int i = 0; i < a.length; i++)
-    {
-      a[i] = i + 2;
-      b[i] = i + 1;
+public class ProdRed_Int {
+    public static void main(String[] args) throws Exception {
+        int[] a = new int[256 * 1024];
+        int[] b = new int[256 * 1024];
+        prodReductionInit(a, b);
+        int valid = 419430401;
+        int total = 1;
+        for (int j = 0; j < 2000; j++) {
+            total = prodReductionImplement(a, b, total);
+        }
+        if (total == valid) {
+            System.out.println("Success");
+        } else {
+            System.out.println("Invalid sum of elements variable in total: " + total);
+            System.out.println("Expected value = " + valid);
+            throw new Exception("Failed");
+        }
     }
-  }
 
-  public static int prodReductionImplement(int[] a, int[] b, int total)
-  {
-    for(int i = 0; i < a.length; i++)
-    {
-      total *= a[i] + b[i];
+    public static void prodReductionInit(int[] a, int[] b) {
+        for (int i = 0; i < a.length; i++) {
+            a[i] = i + 2;
+            b[i] = i + 1;
+        }
     }
-    return total;
-  }
+
+    public static int prodReductionImplement(int[] a, int[] b, int total) {
+        for (int i = 0; i < a.length; i++) {
+            total *= a[i] + b[i];
+        }
+        return total;
+    }
 
 }
diff --git a/hotspot/test/compiler/loopopts/superword/ReductionPerf.java b/hotspot/test/compiler/loopopts/superword/ReductionPerf.java
index a91f70f..0496b9a 100644
--- a/hotspot/test/compiler/loopopts/superword/ReductionPerf.java
+++ b/hotspot/test/compiler/loopopts/superword/ReductionPerf.java
@@ -28,226 +28,236 @@
  * @summary Add C2 x86 Superword support for scalar product reduction optimizations : int test
  * @requires os.arch=="x86" | os.arch=="i386" | os.arch=="amd64" | os.arch=="x86_64" | os.arch=="aarch64"
  *
- * @run main/othervm -XX:+IgnoreUnrecognizedVMOptions -XX:+SuperWordReductions -XX:LoopUnrollLimit=250 -XX:CompileThresholdScaling=0.1 -XX:CompileCommand=exclude,ReductionPerf::main ReductionPerf
- * @run main/othervm -XX:+IgnoreUnrecognizedVMOptions -XX:-SuperWordReductions -XX:LoopUnrollLimit=250 -XX:CompileThresholdScaling=0.1 -XX:CompileCommand=exclude,ReductionPerf::main ReductionPerf
+ * @run main/othervm -XX:+IgnoreUnrecognizedVMOptions
+ *      -XX:LoopUnrollLimit=250 -XX:CompileThresholdScaling=0.1
+ *      -XX:CompileCommand=exclude,compiler.loopopts.superword.ReductionPerf::main
+ *      -XX:+SuperWordReductions
+ *      compiler.loopopts.superword.ReductionPerf
+ * @run main/othervm -XX:+IgnoreUnrecognizedVMOptions
+ *      -XX:LoopUnrollLimit=250 -XX:CompileThresholdScaling=0.1
+ *      -XX:CompileCommand=exclude,compiler.loopopts.superword.ReductionPerf::main
+ *      -XX:-SuperWordReductions
+ *      compiler.loopopts.superword.ReductionPerf
  */
 
+package compiler.loopopts.superword;
+
 public class ReductionPerf {
-  public static void main(String[] args) throws Exception {
-    int[] a1 = new int[8*1024];
-    int[] a2 = new int[8*1024];
-    int[] a3 = new int[8*1024];
-    long[] b1 = new long[8*1024];
-    long[] b2 = new long[8*1024];
-    long[] b3 = new long[8*1024];
-    float[] c1 = new float[8*1024];
-    float[] c2 = new float[8*1024];
-    float[] c3 = new float[8*1024];
-    double[] d1 = new double[8*1024];
-    double[] d2 = new double[8*1024];
-    double[] d3 = new double[8*1024];
+    public static void main(String[] args) throws Exception {
+        int[] a1 = new int[8 * 1024];
+        int[] a2 = new int[8 * 1024];
+        int[] a3 = new int[8 * 1024];
+        long[] b1 = new long[8 * 1024];
+        long[] b2 = new long[8 * 1024];
+        long[] b3 = new long[8 * 1024];
+        float[] c1 = new float[8 * 1024];
+        float[] c2 = new float[8 * 1024];
+        float[] c3 = new float[8 * 1024];
+        double[] d1 = new double[8 * 1024];
+        double[] d2 = new double[8 * 1024];
+        double[] d3 = new double[8 * 1024];
 
-    ReductionInit(a1,a2,a3,b1,b2,b3,c1,c2,c3,d1,d2,d3);
+        ReductionInit(a1, a2, a3, b1, b2, b3, c1, c2, c3, d1, d2, d3);
 
-    int    sumIv = sumInt(a1,a2,a3);
-    long   sumLv = sumLong(b1,b2,b3);
-    float  sumFv = sumFloat(c1,c2,c3);
-    double sumDv = sumDouble(d1,d2,d3);
-    int    mulIv = prodInt(a1,a2,a3);
-    long   mulLv = prodLong(b1,b2,b3);
-    float  mulFv = prodFloat(c1,c2,c3);
-    double mulDv = prodDouble(d1,d2,d3);
+        int sumIv = sumInt(a1, a2, a3);
+        long sumLv = sumLong(b1, b2, b3);
+        float sumFv = sumFloat(c1, c2, c3);
+        double sumDv = sumDouble(d1, d2, d3);
+        int mulIv = prodInt(a1, a2, a3);
+        long mulLv = prodLong(b1, b2, b3);
+        float mulFv = prodFloat(c1, c2, c3);
+        double mulDv = prodDouble(d1, d2, d3);
 
-    int    sumI = 0;
-    long   sumL = 0;
-    float  sumF = 0.f;
-    double sumD = 0.;
-    int    mulI = 0;
-    long   mulL = 0;
-    float  mulF = 0.f;
-    double mulD = 0.;
+        int sumI = 0;
+        long sumL = 0;
+        float sumF = 0.f;
+        double sumD = 0.;
+        int mulI = 0;
+        long mulL = 0;
+        float mulF = 0.f;
+        double mulD = 0.;
 
-    System.out.println("Warmup ...");
-    long  start = System.currentTimeMillis();
+        System.out.println("Warmup ...");
+        long start = System.currentTimeMillis();
 
-    for(int j = 0; j < 2000; j++) {
-      sumI = sumInt(a1,a2,a3);
-      sumL = sumLong(b1,b2,b3);
-      sumF = sumFloat(c1,c2,c3);
-      sumD = sumDouble(d1,d2,d3);
-      mulI = prodInt(a1,a2,a3);
-      mulL = prodLong(b1,b2,b3);
-      mulF = prodFloat(c1,c2,c3);
-      mulD = prodDouble(d1,d2,d3);
+        for (int j = 0; j < 2000; j++) {
+            sumI = sumInt(a1, a2, a3);
+            sumL = sumLong(b1, b2, b3);
+            sumF = sumFloat(c1, c2, c3);
+            sumD = sumDouble(d1, d2, d3);
+            mulI = prodInt(a1, a2, a3);
+            mulL = prodLong(b1, b2, b3);
+            mulF = prodFloat(c1, c2, c3);
+            mulD = prodDouble(d1, d2, d3);
+        }
+
+        long stop = System.currentTimeMillis();
+        System.out.println(" Warmup is done in " + (stop - start) + " msec");
+
+        if (sumIv != sumI) {
+            System.out.println("sum int:    " + sumIv + " != " + sumI);
+        }
+        if (sumLv != sumL) {
+            System.out.println("sum long:   " + sumLv + " != " + sumL);
+        }
+        if (sumFv != sumF) {
+            System.out.println("sum float:  " + sumFv + " != " + sumF);
+        }
+        if (sumDv != sumD) {
+            System.out.println("sum double: " + sumDv + " != " + sumD);
+        }
+        if (mulIv != mulI) {
+            System.out.println("prod int:    " + mulIv + " != " + mulI);
+        }
+        if (mulLv != mulL) {
+            System.out.println("prod long:   " + mulLv + " != " + mulL);
+        }
+        if (mulFv != mulF) {
+            System.out.println("prod float:  " + mulFv + " != " + mulF);
+        }
+        if (mulDv != mulD) {
+            System.out.println("prod double: " + mulDv + " != " + mulD);
+        }
+
+        start = System.currentTimeMillis();
+        for (int j = 0; j < 5000; j++) {
+            sumI = sumInt(a1, a2, a3);
+        }
+        stop = System.currentTimeMillis();
+        System.out.println("sum int:    " + (stop - start));
+
+        start = System.currentTimeMillis();
+        for (int j = 0; j < 5000; j++) {
+            sumL = sumLong(b1, b2, b3);
+        }
+        stop = System.currentTimeMillis();
+        System.out.println("sum long:   " + (stop - start));
+
+        start = System.currentTimeMillis();
+        for (int j = 0; j < 5000; j++) {
+            sumF = sumFloat(c1, c2, c3);
+        }
+        stop = System.currentTimeMillis();
+        System.out.println("sum float:  " + (stop - start));
+
+        start = System.currentTimeMillis();
+        for (int j = 0; j < 5000; j++) {
+            sumD = sumDouble(d1, d2, d3);
+        }
+        stop = System.currentTimeMillis();
+        System.out.println("sum double: " + (stop - start));
+
+        start = System.currentTimeMillis();
+        for (int j = 0; j < 5000; j++) {
+            mulI = prodInt(a1, a2, a3);
+        }
+        stop = System.currentTimeMillis();
+        System.out.println("prod int:    " + (stop - start));
+
+        start = System.currentTimeMillis();
+        for (int j = 0; j < 5000; j++) {
+            mulL = prodLong(b1, b2, b3);
+        }
+        stop = System.currentTimeMillis();
+        System.out.println("prod long:   " + (stop - start));
+
+        start = System.currentTimeMillis();
+        for (int j = 0; j < 5000; j++) {
+            mulF = prodFloat(c1, c2, c3);
+        }
+        stop = System.currentTimeMillis();
+        System.out.println("prod float:  " + (stop - start));
+
+        start = System.currentTimeMillis();
+        for (int j = 0; j < 5000; j++) {
+            mulD = prodDouble(d1, d2, d3);
+        }
+        stop = System.currentTimeMillis();
+        System.out.println("prod double: " + (stop - start));
+
     }
 
-    long stop = System.currentTimeMillis();
-    System.out.println(" Warmup is done in " + (stop - start) + " msec");
-
-    if (sumIv != sumI) {
-      System.out.println("sum int:    " + sumIv + " != " + sumI);
-    }
-    if (sumLv != sumL) {
-      System.out.println("sum long:   " + sumLv + " != " + sumL);
-    }
-    if (sumFv != sumF) {
-      System.out.println("sum float:  " + sumFv + " != " + sumF);
-    }
-    if (sumDv != sumD) {
-      System.out.println("sum double: " + sumDv + " != " + sumD);
-    }
-    if (mulIv != mulI) {
-      System.out.println("prod int:    " + mulIv + " != " + mulI);
-    }
-    if (mulLv != mulL) {
-      System.out.println("prod long:   " + mulLv + " != " + mulL);
-    }
-    if (mulFv != mulF) {
-      System.out.println("prod float:  " + mulFv + " != " + mulF);
-    }
-    if (mulDv != mulD) {
-      System.out.println("prod double: " + mulDv + " != " + mulD);
+    public static void ReductionInit(int[] a1, int[] a2, int[] a3,
+                                     long[] b1, long[] b2, long[] b3,
+                                     float[] c1, float[] c2, float[] c3,
+                                     double[] d1, double[] d2, double[] d3) {
+        for(int i = 0; i < a1.length; i++) {
+            a1[i] =          (i + 0);
+            a2[i] =          (i + 1);
+            a3[i] =          (i + 2);
+            b1[i] =   (long) (i + 0);
+            b2[i] =   (long) (i + 1);
+            b3[i] =   (long) (i + 2);
+            c1[i] =  (float) (i + 0);
+            c2[i] =  (float) (i + 1);
+            c3[i] =  (float) (i + 2);
+            d1[i] = (double) (i + 0);
+            d2[i] = (double) (i + 1);
+            d3[i] = (double) (i + 2);
+        }
     }
 
-    start = System.currentTimeMillis();
-    for (int j = 0; j < 5000; j++) {
-      sumI = sumInt(a1, a2 ,a3);
+    public static int sumInt(int[] a1, int[] a2, int[] a3) {
+        int total = 0;
+        for (int i = 0; i < a1.length; i++) {
+            total += (a1[i] * a2[i]) + (a1[i] * a3[i]) + (a2[i] * a3[i]);
+        }
+        return total;
     }
-    stop = System.currentTimeMillis();
-    System.out.println("sum int:    " + (stop - start));
 
-    start = System.currentTimeMillis();
-    for (int j = 0; j < 5000; j++) {
-      sumL = sumLong(b1, b2, b3);
+    public static long sumLong(long[] b1, long[] b2, long[] b3) {
+        long total = 0;
+        for (int i = 0; i < b1.length; i++) {
+            total += (b1[i] * b2[i]) + (b1[i] * b3[i]) + (b2[i] * b3[i]);
+        }
+        return total;
     }
-    stop = System.currentTimeMillis();
-    System.out.println("sum long:   " + (stop - start));
 
-    start = System.currentTimeMillis();
-    for (int j = 0; j < 5000; j++) {
-      sumF = sumFloat(c1, c2, c3);
+    public static float sumFloat(float[] c1, float[] c2, float[] c3) {
+        float total = 0;
+        for (int i = 0; i < c1.length; i++) {
+            total += (c1[i] * c2[i]) + (c1[i] * c3[i]) + (c2[i] * c3[i]);
+        }
+        return total;
     }
-    stop = System.currentTimeMillis();
-    System.out.println("sum float:  " + (stop - start));
 
-    start = System.currentTimeMillis();
-    for (int j = 0; j < 5000; j++) {
-      sumD = sumDouble(d1, d2, d3);
+    public static double sumDouble(double[] d1, double[] d2, double[] d3) {
+        double total = 0;
+        for (int i = 0; i < d1.length; i++) {
+            total += (d1[i] * d2[i]) + (d1[i] * d3[i]) + (d2[i] * d3[i]);
+        }
+        return total;
     }
-    stop = System.currentTimeMillis();
-    System.out.println("sum double: " + (stop - start));
 
-    start = System.currentTimeMillis();
-    for (int j = 0; j < 5000; j++) {
-      mulI = prodInt(a1, a2, a3);
+    public static int prodInt(int[] a1, int[] a2, int[] a3) {
+        int total = 1;
+        for (int i = 0; i < a1.length; i++) {
+            total *= (a1[i] * a2[i]) + (a1[i] * a3[i]) + (a2[i] * a3[i]);
+        }
+        return total;
     }
-    stop = System.currentTimeMillis();
-    System.out.println("prod int:    " + (stop - start));
 
-    start = System.currentTimeMillis();
-    for (int j = 0; j < 5000; j++) {
-      mulL = prodLong(b1, b2 ,b3);
+    public static long prodLong(long[] b1, long[] b2, long[] b3) {
+        long total = 1;
+        for (int i = 0; i < b1.length; i++) {
+            total *= (b1[i] * b2[i]) + (b1[i] * b3[i]) + (b2[i] * b3[i]);
+        }
+        return total;
     }
-    stop = System.currentTimeMillis();
-    System.out.println("prod long:   " + (stop - start));
 
-    start = System.currentTimeMillis();
-    for (int j = 0; j < 5000; j++) {
-      mulF = prodFloat(c1, c2, c3);
+    public static float prodFloat(float[] c1, float[] c2, float[] c3) {
+        float total = 1;
+        for (int i = 0; i < c1.length; i++) {
+            total *= (c1[i] * c2[i]) + (c1[i] * c3[i]) + (c2[i] * c3[i]);
+        }
+        return total;
     }
-    stop = System.currentTimeMillis();
-    System.out.println("prod float:  " + (stop - start));
 
-    start = System.currentTimeMillis();
-    for (int j = 0; j < 5000; j++) {
-      mulD = prodDouble(d1, d2, d3);
+    public static double prodDouble(double[] d1, double[] d2, double[] d3) {
+        double total = 1;
+        for (int i = 0; i < d1.length; i++) {
+            total *= (d1[i] * d2[i]) + (d1[i] * d3[i]) + (d2[i] * d3[i]);
+        }
+        return total;
     }
-    stop = System.currentTimeMillis();
-    System.out.println("prod double: " + (stop - start));
-
-  }
-
-  public static void ReductionInit(int[]    a1, int[]    a2, int[]    a3,
-                                   long[]   b1, long[]   b2, long[]   b3,
-                                   float[]  c1, float[]  c2, float[]  c3,
-                                   double[] d1, double[] d2, double[] d3 ) {
-    for(int i = 0; i < a1.length; i++) {
-      a1[i] =          (i + 0);
-      a2[i] =          (i + 1);
-      a3[i] =          (i + 2);
-      b1[i] =   (long) (i + 0);
-      b2[i] =   (long) (i + 1);
-      b3[i] =   (long) (i + 2);
-      c1[i] =  (float) (i + 0);
-      c2[i] =  (float) (i + 1);
-      c3[i] =  (float) (i + 2);
-      d1[i] = (double) (i + 0);
-      d2[i] = (double) (i + 1);
-      d3[i] = (double) (i + 2);
-    }
-  }
-
-  public static int sumInt(int[] a1, int[] a2, int[] a3) {
-    int total = 0;
-    for(int i = 0; i < a1.length; i++) {
-      total += (a1[i] * a2[i]) + (a1[i] * a3[i]) + (a2[i] * a3[i]);
-    }
-    return total;
-  }
-
-  public static long sumLong(long[] b1, long[] b2, long[] b3) {
-    long total = 0;
-    for(int i = 0; i < b1.length; i++) {
-      total += (b1[i] * b2[i]) + (b1[i] * b3[i]) + (b2[i] * b3[i]);
-    }
-    return total;
-  }
-
-  public static float sumFloat(float[] c1, float[] c2, float[] c3) {
-    float total = 0;
-    for(int i = 0; i < c1.length; i++) {
-      total += (c1[i] * c2[i]) + (c1[i] * c3[i]) + (c2[i] * c3[i]);
-    }
-    return total;
-  }
-
-  public static double sumDouble(double[] d1, double[] d2, double[] d3) {
-    double total = 0;
-    for(int i = 0; i < d1.length; i++) {
-      total += (d1[i] * d2[i]) + (d1[i] * d3[i]) + (d2[i] * d3[i]);
-    }
-    return total;
-  }
-
-  public static int prodInt(int[] a1, int[] a2, int[] a3) {
-    int total = 1;
-    for(int i = 0; i < a1.length; i++) {
-      total *= (a1[i] * a2[i]) + (a1[i] * a3[i]) + (a2[i] * a3[i]);
-    }
-    return total;
-  }
-
-  public static long prodLong(long[] b1, long[] b2, long[] b3) {
-    long total = 1;
-    for(int i = 0; i < b1.length; i++) {
-      total *= (b1[i] * b2[i]) + (b1[i] * b3[i]) + (b2[i] * b3[i]);
-    }
-    return total;
-  }
-
-  public static float prodFloat(float[] c1, float[] c2, float[] c3) {
-    float total = 1;
-    for(int i = 0; i < c1.length; i++) {
-      total *= (c1[i] * c2[i]) + (c1[i] * c3[i]) + (c2[i] * c3[i]);
-    }
-    return total;
-  }
-
-  public static double prodDouble(double[] d1, double[] d2, double[] d3) {
-    double total = 1;
-    for(int i = 0; i < d1.length; i++) {
-      total *= (d1[i] * d2[i]) + (d1[i] * d3[i]) + (d2[i] * d3[i]);
-    }
-    return total;
-  }
 }
diff --git a/hotspot/test/compiler/loopopts/superword/SumRedAbsNeg_Double.java b/hotspot/test/compiler/loopopts/superword/SumRedAbsNeg_Double.java
index 98e8f0f..807be10 100644
--- a/hotspot/test/compiler/loopopts/superword/SumRedAbsNeg_Double.java
+++ b/hotspot/test/compiler/loopopts/superword/SumRedAbsNeg_Double.java
@@ -28,72 +28,100 @@
  * @summary Add C2 AArch64 Superword support for scalar sum reduction optimizations : double abs & neg test
  * @requires os.arch=="aarch64"
  *
- * @run main/othervm -XX:+IgnoreUnrecognizedVMOptions -XX:+SuperWordReductions -XX:LoopUnrollLimit=250 -XX:LoopMaxUnroll=2 -XX:CompileThresholdScaling=0.1 SumRedAbsNeg_Double
- * @run main/othervm -XX:+IgnoreUnrecognizedVMOptions -XX:-SuperWordReductions -XX:LoopUnrollLimit=250 -XX:LoopMaxUnroll=2 -XX:CompileThresholdScaling=0.1 SumRedAbsNeg_Double
+ * @run main/othervm -XX:+IgnoreUnrecognizedVMOptions -XX:LoopUnrollLimit=250
+ *      -XX:CompileThresholdScaling=0.1
+ *      -XX:+SuperWordReductions
+ *      -XX:LoopMaxUnroll=2
+ *      compiler.loopopts.superword.SumRedAbsNeg_Double
+ * @run main/othervm -XX:+IgnoreUnrecognizedVMOptions -XX:LoopUnrollLimit=250
+ *      -XX:CompileThresholdScaling=0.1
+ *      -XX:-SuperWordReductions
+ *      -XX:LoopMaxUnroll=2
+ *      compiler.loopopts.superword.SumRedAbsNeg_Double
  *
- * @run main/othervm -XX:+IgnoreUnrecognizedVMOptions -XX:+SuperWordReductions -XX:LoopUnrollLimit=250 -XX:LoopMaxUnroll=4 -XX:CompileThresholdScaling=0.1 SumRedAbsNeg_Double
- * @run main/othervm -XX:+IgnoreUnrecognizedVMOptions -XX:-SuperWordReductions -XX:LoopUnrollLimit=250 -XX:LoopMaxUnroll=4 -XX:CompileThresholdScaling=0.1 SumRedAbsNeg_Double
+ * @run main/othervm -XX:+IgnoreUnrecognizedVMOptions -XX:LoopUnrollLimit=250
+ *      -XX:CompileThresholdScaling=0.1
+ *      -XX:+SuperWordReductions
+ *      -XX:LoopMaxUnroll=4
+ *      compiler.loopopts.superword.SumRedAbsNeg_Double
+ * @run main/othervm -XX:+IgnoreUnrecognizedVMOptions -XX:LoopUnrollLimit=250
+ *      -XX:CompileThresholdScaling=0.1
+ *      -XX:-SuperWordReductions
+ *      -XX:LoopMaxUnroll=4
+ *      compiler.loopopts.superword.SumRedAbsNeg_Double
  *
- * @run main/othervm -XX:+IgnoreUnrecognizedVMOptions -XX:+SuperWordReductions -XX:LoopUnrollLimit=250 -XX:LoopMaxUnroll=8 -XX:CompileThresholdScaling=0.1 SumRedAbsNeg_Double
- * @run main/othervm -XX:+IgnoreUnrecognizedVMOptions -XX:-SuperWordReductions -XX:LoopUnrollLimit=250 -XX:LoopMaxUnroll=8 -XX:CompileThresholdScaling=0.1 SumRedAbsNeg_Double
+ * @run main/othervm -XX:+IgnoreUnrecognizedVMOptions -XX:LoopUnrollLimit=250
+ *      -XX:CompileThresholdScaling=0.1
+ *      -XX:+SuperWordReductions
+ *      -XX:LoopMaxUnroll=8
+ *      compiler.loopopts.superword.SumRedAbsNeg_Double
+ * @run main/othervm -XX:+IgnoreUnrecognizedVMOptions -XX:LoopUnrollLimit=250
+ *      -XX:CompileThresholdScaling=0.1
+ *      -XX:-SuperWordReductions
+ *      -XX:LoopMaxUnroll=8
+ *      compiler.loopopts.superword.SumRedAbsNeg_Double
  *
- * @run main/othervm -XX:+IgnoreUnrecognizedVMOptions -XX:+SuperWordReductions -XX:LoopUnrollLimit=250 -XX:LoopMaxUnroll=16 -XX:CompileThresholdScaling=0.1 SumRedAbsNeg_Double
- * @run main/othervm -XX:+IgnoreUnrecognizedVMOptions -XX:-SuperWordReductions -XX:LoopUnrollLimit=250 -XX:LoopMaxUnroll=16 -XX:CompileThresholdScaling=0.1 SumRedAbsNeg_Double
+ * @run main/othervm -XX:+IgnoreUnrecognizedVMOptions -XX:LoopUnrollLimit=250
+ *      -XX:CompileThresholdScaling=0.1
+ *      -XX:+SuperWordReductions
+ *      -XX:LoopMaxUnroll=16
+ *      compiler.loopopts.superword.SumRedAbsNeg_Double
+ * @run main/othervm -XX:+IgnoreUnrecognizedVMOptions -XX:LoopUnrollLimit=250
+ *      -XX:CompileThresholdScaling=0.1
+ *      -XX:-SuperWordReductions
+ *      -XX:LoopMaxUnroll=16
+ *      compiler.loopopts.superword.SumRedAbsNeg_Double
  */
 
-public class SumRedAbsNeg_Double
-{
-  public static void main(String[] args) throws Exception {
-    double[] a = new double[256*1024];
-    double[] b = new double[256*1024];
-    double[] c = new double[256*1024];
-    double[] d = new double[256*1024];
-    sumReductionInit(a,b,c);
-    double total = 0;
-    double valid = 3.6028590866691944E19;
+package compiler.loopopts.superword;
 
-    for(int j = 0; j < 2000; j++) {
-      total = sumReductionImplement(a,b,c,d,total);
+public class SumRedAbsNeg_Double {
+    public static void main(String[] args) throws Exception {
+        double[] a = new double[256 * 1024];
+        double[] b = new double[256 * 1024];
+        double[] c = new double[256 * 1024];
+        double[] d = new double[256 * 1024];
+        sumReductionInit(a, b, c);
+        double total = 0;
+        double valid = 3.6028590866691944E19;
+
+        for (int j = 0; j < 2000; j++) {
+            total = sumReductionImplement(a, b, c, d, total);
+        }
+
+        if (total == valid) {
+            System.out.println("Success");
+        } else {
+            System.out.println("Invalid sum of elements variable in total: " + total);
+            System.out.println("Expected value = " + valid);
+            throw new Exception("Failed");
+        }
     }
 
-    if(total == valid) {
-      System.out.println("Success");
-    } else {
-      System.out.println("Invalid sum of elements variable in total: " + total);
-      System.out.println("Expected value = " + valid);
-      throw new Exception("Failed");
+    public static void sumReductionInit(
+            double[] a,
+            double[] b,
+            double[] c) {
+        for (int j = 0; j < 1; j++) {
+            for (int i = 0; i < a.length; i++) {
+                a[i] = i * 1 + j;
+                b[i] = i * 1 - j;
+                c[i] = i + j;
+            }
+        }
     }
-  }
 
-  public static void sumReductionInit(
-    double[] a,
-    double[] b,
-    double[] c)
-  {
-    for(int j = 0; j < 1; j++)
-    {
-      for(int i = 0; i < a.length; i++)
-      {
-        a[i] = i * 1 + j;
-        b[i] = i * 1 - j;
-        c[i] = i + j;
-      }
+    public static double sumReductionImplement(
+            double[] a,
+            double[] b,
+            double[] c,
+            double[] d,
+            double total) {
+        for (int i = 0; i < a.length; i++) {
+            d[i] = Math.abs(-a[i] * -b[i]) + Math.abs(-a[i] * -c[i]) + Math.abs(-b[i] * -c[i]);
+            total += d[i];
+        }
+        return total;
     }
-  }
-
-  public static double sumReductionImplement(
-    double[] a,
-    double[] b,
-    double[] c,
-    double[] d,
-    double total)
-  {
-    for(int i = 0; i < a.length; i++)
-    {
-      d[i] = Math.abs(-a[i] * -b[i]) + Math.abs(-a[i] * -c[i]) + Math.abs(-b[i] * -c[i]);
-      total += d[i];
-    }
-    return total;
-  }
 
 }
diff --git a/hotspot/test/compiler/loopopts/superword/SumRedAbsNeg_Float.java b/hotspot/test/compiler/loopopts/superword/SumRedAbsNeg_Float.java
index bbf7494..d108e10 100644
--- a/hotspot/test/compiler/loopopts/superword/SumRedAbsNeg_Float.java
+++ b/hotspot/test/compiler/loopopts/superword/SumRedAbsNeg_Float.java
@@ -28,72 +28,100 @@
  * @summary Add C2 AArch64 Superword support for scalar sum reduction optimizations : float abs & neg test
  * @requires os.arch=="aarch64"
  *
- * @run main/othervm -XX:+IgnoreUnrecognizedVMOptions -XX:+SuperWordReductions -XX:LoopUnrollLimit=250 -XX:LoopMaxUnroll=2 -XX:CompileThresholdScaling=0.1 SumRedAbsNeg_Float
- * @run main/othervm -XX:+IgnoreUnrecognizedVMOptions -XX:-SuperWordReductions -XX:LoopUnrollLimit=250 -XX:LoopMaxUnroll=2 -XX:CompileThresholdScaling=0.1 SumRedAbsNeg_Float
+ * @run main/othervm -XX:+IgnoreUnrecognizedVMOptions -XX:LoopUnrollLimit=250
+ *      -XX:CompileThresholdScaling=0.1
+ *      -XX:+SuperWordReductions
+ *      -XX:LoopMaxUnroll=2
+ *      compiler.loopopts.superword.SumRedAbsNeg_Double
+ * @run main/othervm -XX:+IgnoreUnrecognizedVMOptions -XX:LoopUnrollLimit=250
+ *      -XX:CompileThresholdScaling=0.1
+ *      -XX:-SuperWordReductions
+ *      -XX:LoopMaxUnroll=2
+ *      compiler.loopopts.superword.SumRedAbsNeg_Double
  *
- * @run main/othervm -XX:+IgnoreUnrecognizedVMOptions -XX:+SuperWordReductions -XX:LoopUnrollLimit=250 -XX:LoopMaxUnroll=4 -XX:CompileThresholdScaling=0.1 SumRedAbsNeg_Float
- * @run main/othervm -XX:+IgnoreUnrecognizedVMOptions -XX:-SuperWordReductions -XX:LoopUnrollLimit=250 -XX:LoopMaxUnroll=4 -XX:CompileThresholdScaling=0.1 SumRedAbsNeg_Float
+ * @run main/othervm -XX:+IgnoreUnrecognizedVMOptions -XX:LoopUnrollLimit=250
+ *      -XX:CompileThresholdScaling=0.1
+ *      -XX:+SuperWordReductions
+ *      -XX:LoopMaxUnroll=4
+ *      compiler.loopopts.superword.SumRedAbsNeg_Double
+ * @run main/othervm -XX:+IgnoreUnrecognizedVMOptions -XX:LoopUnrollLimit=250
+ *      -XX:CompileThresholdScaling=0.1
+ *      -XX:-SuperWordReductions
+ *      -XX:LoopMaxUnroll=4
+ *      compiler.loopopts.superword.SumRedAbsNeg_Double
  *
- * @run main/othervm -XX:+IgnoreUnrecognizedVMOptions -XX:+SuperWordReductions -XX:LoopUnrollLimit=250 -XX:LoopMaxUnroll=8 -XX:CompileThresholdScaling=0.1 SumRedAbsNeg_Float
- * @run main/othervm -XX:+IgnoreUnrecognizedVMOptions -XX:-SuperWordReductions -XX:LoopUnrollLimit=250 -XX:LoopMaxUnroll=8 -XX:CompileThresholdScaling=0.1 SumRedAbsNeg_Float
+ * @run main/othervm -XX:+IgnoreUnrecognizedVMOptions -XX:LoopUnrollLimit=250
+ *      -XX:CompileThresholdScaling=0.1
+ *      -XX:+SuperWordReductions
+ *      -XX:LoopMaxUnroll=8
+ *      compiler.loopopts.superword.SumRedAbsNeg_Double
+ * @run main/othervm -XX:+IgnoreUnrecognizedVMOptions -XX:LoopUnrollLimit=250
+ *      -XX:CompileThresholdScaling=0.1
+ *      -XX:-SuperWordReductions
+ *      -XX:LoopMaxUnroll=8
+ *      compiler.loopopts.superword.SumRedAbsNeg_Double
  *
- * @run main/othervm -XX:+IgnoreUnrecognizedVMOptions -XX:+SuperWordReductions -XX:LoopUnrollLimit=250 -XX:LoopMaxUnroll=16 -XX:CompileThresholdScaling=0.1 SumRedAbsNeg_Float
- * @run main/othervm -XX:+IgnoreUnrecognizedVMOptions -XX:-SuperWordReductions -XX:LoopUnrollLimit=250 -XX:LoopMaxUnroll=16 -XX:CompileThresholdScaling=0.1 SumRedAbsNeg_Float
+ * @run main/othervm -XX:+IgnoreUnrecognizedVMOptions -XX:LoopUnrollLimit=250
+ *      -XX:CompileThresholdScaling=0.1
+ *      -XX:+SuperWordReductions
+ *      -XX:LoopMaxUnroll=16
+ *      compiler.loopopts.superword.SumRedAbsNeg_Double
+ * @run main/othervm -XX:+IgnoreUnrecognizedVMOptions -XX:LoopUnrollLimit=250
+ *      -XX:CompileThresholdScaling=0.1
+ *      -XX:-SuperWordReductions
+ *      -XX:LoopMaxUnroll=16
+ *      compiler.loopopts.superword.SumRedAbsNeg_Double
  */
 
-public class SumRedAbsNeg_Float
-{
-  public static void main(String[] args) throws Exception {
-    float[] a = new float[256*1024];
-    float[] b = new float[256*1024];
-    float[] c = new float[256*1024];
-    float[] d = new float[256*1024];
-    sumReductionInit(a,b,c);
-    float total = 0;
-    float valid = (float)4.611686E18;
+package compiler.loopopts.superword;
 
-    for(int j = 0; j < 2000; j++) {
-      total = sumReductionImplement(a,b,c,d,total);
+public class SumRedAbsNeg_Float {
+    public static void main(String[] args) throws Exception {
+        float[] a = new float[256 * 1024];
+        float[] b = new float[256 * 1024];
+        float[] c = new float[256 * 1024];
+        float[] d = new float[256 * 1024];
+        sumReductionInit(a, b, c);
+        float total = 0;
+        float valid = (float) 4.611686E18;
+
+        for (int j = 0; j < 2000; j++) {
+            total = sumReductionImplement(a, b, c, d, total);
+        }
+
+        if (total == valid) {
+            System.out.println("Success");
+        } else {
+            System.out.println("Invalid sum of elements variable in total: " + total);
+            System.out.println("Expected value = " + valid);
+            throw new Exception("Failed");
+        }
     }
 
-    if(total == valid) {
-      System.out.println("Success");
-    } else {
-      System.out.println("Invalid sum of elements variable in total: " + total);
-      System.out.println("Expected value = " + valid);
-      throw new Exception("Failed");
+    public static void sumReductionInit(
+            float[] a,
+            float[] b,
+            float[] c) {
+        for (int j = 0; j < 1; j++) {
+            for (int i = 0; i < a.length; i++) {
+                a[i] = i * 1 + j;
+                b[i] = i * 1 - j;
+                c[i] = i + j;
+            }
+        }
     }
-  }
 
-  public static void sumReductionInit(
-    float[] a,
-    float[] b,
-    float[] c)
-  {
-    for(int j = 0; j < 1; j++)
-    {
-      for(int i = 0; i < a.length; i++)
-      {
-        a[i] = i * 1 + j;
-        b[i] = i * 1 - j;
-        c[i] = i + j;
-      }
+    public static float sumReductionImplement(
+            float[] a,
+            float[] b,
+            float[] c,
+            float[] d,
+            float total) {
+        for (int i = 0; i < a.length; i++) {
+            d[i] = Math.abs(-a[i] * -b[i]) + Math.abs(-a[i] * -c[i]) + Math.abs(-b[i] * -c[i]);
+            total += d[i];
+        }
+        return total;
     }
-  }
-
-  public static float sumReductionImplement(
-    float[] a,
-    float[] b,
-    float[] c,
-    float[] d,
-    float total)
-  {
-    for(int i = 0; i < a.length; i++)
-    {
-      d[i] = Math.abs(-a[i] * -b[i]) + Math.abs(-a[i] * -c[i]) + Math.abs(-b[i] * -c[i]);
-      total += d[i];
-    }
-    return total;
-  }
 
 }
diff --git a/hotspot/test/compiler/loopopts/superword/SumRedSqrt_Double.java b/hotspot/test/compiler/loopopts/superword/SumRedSqrt_Double.java
index ac9edd5..b13efa8 100644
--- a/hotspot/test/compiler/loopopts/superword/SumRedSqrt_Double.java
+++ b/hotspot/test/compiler/loopopts/superword/SumRedSqrt_Double.java
@@ -23,75 +23,104 @@
  */
 
 /**
-* @test
-* @bug 8135028
-* @summary Add C2 x86 Superword support for scalar sum reduction optimizations : double sqrt test
-* @requires os.arch=="x86" | os.arch=="i386" | os.arch=="amd64" | os.arch=="x86_64" | os.arch=="aarch64"
-*
-* @run main/othervm -XX:+IgnoreUnrecognizedVMOptions -XX:+SuperWordReductions -XX:LoopUnrollLimit=250 -XX:LoopMaxUnroll=2 -XX:CompileThresholdScaling=0.1 SumRedSqrt_Double
-* @run main/othervm -XX:+IgnoreUnrecognizedVMOptions -XX:-SuperWordReductions -XX:LoopUnrollLimit=250 -XX:LoopMaxUnroll=2 -XX:CompileThresholdScaling=0.1 SumRedSqrt_Double
-*
-* @run main/othervm -XX:+IgnoreUnrecognizedVMOptions -XX:+SuperWordReductions -XX:LoopUnrollLimit=250 -XX:LoopMaxUnroll=4 -XX:CompileThresholdScaling=0.1 SumRedSqrt_Double
-* @run main/othervm -XX:+IgnoreUnrecognizedVMOptions -XX:-SuperWordReductions -XX:LoopUnrollLimit=250 -XX:LoopMaxUnroll=4 -XX:CompileThresholdScaling=0.1 SumRedSqrt_Double
-*
-* @run main/othervm -XX:+IgnoreUnrecognizedVMOptions -XX:+SuperWordReductions -XX:LoopUnrollLimit=250 -XX:LoopMaxUnroll=8 -XX:CompileThresholdScaling=0.1 SumRedSqrt_Double
-* @run main/othervm -XX:+IgnoreUnrecognizedVMOptions -XX:-SuperWordReductions -XX:LoopUnrollLimit=250 -XX:LoopMaxUnroll=8 -XX:CompileThresholdScaling=0.1 SumRedSqrt_Double
-*
-* @run main/othervm -XX:+IgnoreUnrecognizedVMOptions -XX:+SuperWordReductions -XX:LoopUnrollLimit=250 -XX:LoopMaxUnroll=16 -XX:CompileThresholdScaling=0.1 SumRedSqrt_Double
-* @run main/othervm -XX:+IgnoreUnrecognizedVMOptions -XX:-SuperWordReductions -XX:LoopUnrollLimit=250 -XX:LoopMaxUnroll=16 -XX:CompileThresholdScaling=0.1 SumRedSqrt_Double
-*/
+ * @test
+ * @bug 8135028
+ * @summary Add C2 x86 Superword support for scalar sum reduction optimizations : double sqrt test
+ * @requires os.arch=="x86" | os.arch=="i386" | os.arch=="amd64" | os.arch=="x86_64" | os.arch=="aarch64"
+ *
+ * @run main/othervm -XX:+IgnoreUnrecognizedVMOptions -XX:LoopUnrollLimit=250
+ *      -XX:CompileThresholdScaling=0.1
+ *      -XX:+SuperWordReductions
+ *      -XX:LoopMaxUnroll=2
+ *      compiler.loopopts.superword.SumRedSqrt_Double
+ * @run main/othervm -XX:+IgnoreUnrecognizedVMOptions -XX:LoopUnrollLimit=250
+ *      -XX:CompileThresholdScaling=0.1
+ *      -XX:-SuperWordReductions
+ *      -XX:LoopMaxUnroll=2
+ *      compiler.loopopts.superword.SumRedSqrt_Double
+ *
+ * @run main/othervm -XX:+IgnoreUnrecognizedVMOptions -XX:LoopUnrollLimit=250
+ *      -XX:CompileThresholdScaling=0.1
+ *      -XX:+SuperWordReductions
+ *      -XX:LoopMaxUnroll=4
+ *      compiler.loopopts.superword.SumRedSqrt_Double
+ * @run main/othervm -XX:+IgnoreUnrecognizedVMOptions -XX:LoopUnrollLimit=250
+ *      -XX:CompileThresholdScaling=0.1
+ *      -XX:-SuperWordReductions
+ *      -XX:LoopMaxUnroll=4
+ *      compiler.loopopts.superword.SumRedSqrt_Double
+ *
+ * @run main/othervm -XX:+IgnoreUnrecognizedVMOptions -XX:LoopUnrollLimit=250
+ *      -XX:CompileThresholdScaling=0.1
+ *      -XX:+SuperWordReductions
+ *      -XX:LoopMaxUnroll=8
+ *      compiler.loopopts.superword.SumRedSqrt_Double
+ * @run main/othervm -XX:+IgnoreUnrecognizedVMOptions -XX:LoopUnrollLimit=250
+ *      -XX:CompileThresholdScaling=0.1
+ *      -XX:-SuperWordReductions
+ *      -XX:LoopMaxUnroll=8
+ *      compiler.loopopts.superword.SumRedSqrt_Double
+ *
+ * @run main/othervm -XX:+IgnoreUnrecognizedVMOptions -XX:LoopUnrollLimit=250
+ *      -XX:CompileThresholdScaling=0.1
+ *      -XX:+SuperWordReductions
+ *      -XX:LoopMaxUnroll=16
+ *      compiler.loopopts.superword.SumRedSqrt_Double
+ * @run main/othervm -XX:+IgnoreUnrecognizedVMOptions -XX:LoopUnrollLimit=250
+ *      -XX:CompileThresholdScaling=0.1
+ *      -XX:-SuperWordReductions
+ *      -XX:LoopMaxUnroll=16
+ *      compiler.loopopts.superword.SumRedSqrt_Double
+ */
 
-public class SumRedSqrt_Double
-{
-  public static void main(String[] args) throws Exception {
-    double[] a = new double[256*1024];
-    double[] b = new double[256*1024];
-    double[] c = new double[256*1024];
-    double[] d = new double[256*1024];
-    sumReductionInit(a,b,c);
-    double total = 0;
-    double valid = 2.06157643776E14;
-    for(int j = 0; j < 2000; j++) {
-      total = sumReductionImplement(a,b,c,d,total);
-    }
-    if(total == valid) {
-      System.out.println("Success");
-    } else {
-      System.out.println("Invalid sum of elements variable in total: " + total);
-      System.out.println("Expected value = " + valid);
-      throw new Exception("Failed");
-    }
-  }
 
-  public static void sumReductionInit(
-    double[] a,
-    double[] b,
-    double[] c)
-  {
-    for(int j = 0; j < 1; j++)
-    {
-      for(int i = 0; i < a.length; i++)
-      {
-        a[i] = i * 1 + j;
-        b[i] = i * 1 - j;
-        c[i] = i + j;
-      }
-    }
-  }
+package compiler.loopopts.superword;
 
-  public static double sumReductionImplement(
-    double[] a,
-    double[] b,
-    double[] c,
-    double[] d,
-    double total)
-  {
-    for(int i = 0; i < a.length; i++)
-    {
-      d[i]= Math.sqrt(a[i] * b[i]) + Math.sqrt(a[i] * c[i]) + Math.sqrt(b[i] * c[i]);
-      total += d[i];
+public class SumRedSqrt_Double {
+    public static void main(String[] args) throws Exception {
+        double[] a = new double[256 * 1024];
+        double[] b = new double[256 * 1024];
+        double[] c = new double[256 * 1024];
+        double[] d = new double[256 * 1024];
+        sumReductionInit(a, b, c);
+        double total = 0;
+        double valid = 2.06157643776E14;
+        for (int j = 0; j < 2000; j++) {
+            total = sumReductionImplement(a, b, c, d, total);
+        }
+        if (total == valid) {
+            System.out.println("Success");
+        } else {
+            System.out.println("Invalid sum of elements variable in total: " + total);
+            System.out.println("Expected value = " + valid);
+            throw new Exception("Failed");
+        }
     }
-    return total;
-  }
+
+    public static void sumReductionInit(
+            double[] a,
+            double[] b,
+            double[] c) {
+        for (int j = 0; j < 1; j++) {
+            for (int i = 0; i < a.length; i++) {
+                a[i] = i * 1 + j;
+                b[i] = i * 1 - j;
+                c[i] = i + j;
+            }
+        }
+    }
+
+    public static double sumReductionImplement(
+            double[] a,
+            double[] b,
+            double[] c,
+            double[] d,
+            double total) {
+        for (int i = 0; i < a.length; i++) {
+            d[i] = Math.sqrt(a[i] * b[i]) + Math.sqrt(a[i] * c[i]) + Math.sqrt(b[i] * c[i]);
+            total += d[i];
+        }
+        return total;
+    }
 
 }
diff --git a/hotspot/test/compiler/loopopts/superword/SumRed_Double.java b/hotspot/test/compiler/loopopts/superword/SumRed_Double.java
index b33ef59..f9e6f9e 100644
--- a/hotspot/test/compiler/loopopts/superword/SumRed_Double.java
+++ b/hotspot/test/compiler/loopopts/superword/SumRed_Double.java
@@ -28,70 +28,98 @@
  * @summary Add C2 x86 Superword support for scalar sum reduction optimizations : double test
  * @requires os.arch=="x86" | os.arch=="i386" | os.arch=="amd64" | os.arch=="x86_64" | os.arch=="aarch64"
  *
- * @run main/othervm -XX:+IgnoreUnrecognizedVMOptions -XX:+SuperWordReductions -XX:LoopUnrollLimit=250 -XX:LoopMaxUnroll=2 -XX:CompileThresholdScaling=0.1 SumRed_Double
- * @run main/othervm -XX:+IgnoreUnrecognizedVMOptions -XX:-SuperWordReductions -XX:LoopUnrollLimit=250 -XX:LoopMaxUnroll=2 -XX:CompileThresholdScaling=0.1 SumRed_Double
+ * @run main/othervm -XX:+IgnoreUnrecognizedVMOptions -XX:LoopUnrollLimit=250
+ *      -XX:CompileThresholdScaling=0.1
+ *      -XX:+SuperWordReductions
+ *      -XX:LoopMaxUnroll=2
+ *      compiler.loopopts.superword.SumRed_Double
+ * @run main/othervm -XX:+IgnoreUnrecognizedVMOptions -XX:LoopUnrollLimit=250
+ *      -XX:CompileThresholdScaling=0.1
+ *      -XX:-SuperWordReductions
+ *      -XX:LoopMaxUnroll=2
+ *      compiler.loopopts.superword.SumRed_Double
  *
- * @run main/othervm -XX:+IgnoreUnrecognizedVMOptions -XX:+SuperWordReductions -XX:LoopUnrollLimit=250 -XX:LoopMaxUnroll=4 -XX:CompileThresholdScaling=0.1 SumRed_Double
- * @run main/othervm -XX:+IgnoreUnrecognizedVMOptions -XX:-SuperWordReductions -XX:LoopUnrollLimit=250 -XX:LoopMaxUnroll=4 -XX:CompileThresholdScaling=0.1 SumRed_Double
+ * @run main/othervm -XX:+IgnoreUnrecognizedVMOptions -XX:LoopUnrollLimit=250
+ *      -XX:CompileThresholdScaling=0.1
+ *      -XX:+SuperWordReductions
+ *      -XX:LoopMaxUnroll=4
+ *      compiler.loopopts.superword.SumRed_Double
+ * @run main/othervm -XX:+IgnoreUnrecognizedVMOptions -XX:LoopUnrollLimit=250
+ *      -XX:CompileThresholdScaling=0.1
+ *      -XX:-SuperWordReductions
+ *      -XX:LoopMaxUnroll=4
+ *      compiler.loopopts.superword.SumRed_Double
  *
- * @run main/othervm -XX:+IgnoreUnrecognizedVMOptions -XX:+SuperWordReductions -XX:LoopUnrollLimit=250 -XX:LoopMaxUnroll=8 -XX:CompileThresholdScaling=0.1 SumRed_Double
- * @run main/othervm -XX:+IgnoreUnrecognizedVMOptions -XX:-SuperWordReductions -XX:LoopUnrollLimit=250 -XX:LoopMaxUnroll=8 -XX:CompileThresholdScaling=0.1 SumRed_Double
+ * @run main/othervm -XX:+IgnoreUnrecognizedVMOptions -XX:LoopUnrollLimit=250
+ *      -XX:CompileThresholdScaling=0.1
+ *      -XX:+SuperWordReductions
+ *      -XX:LoopMaxUnroll=8
+ *      compiler.loopopts.superword.SumRed_Double
+ * @run main/othervm -XX:+IgnoreUnrecognizedVMOptions -XX:LoopUnrollLimit=250
+ *      -XX:CompileThresholdScaling=0.1
+ *      -XX:-SuperWordReductions
+ *      -XX:LoopMaxUnroll=8
+ *      compiler.loopopts.superword.SumRed_Double
  *
- * @run main/othervm -XX:+IgnoreUnrecognizedVMOptions -XX:+SuperWordReductions -XX:LoopUnrollLimit=250 -XX:LoopMaxUnroll=16 -XX:CompileThresholdScaling=0.1 SumRed_Double
- * @run main/othervm -XX:+IgnoreUnrecognizedVMOptions -XX:-SuperWordReductions -XX:LoopUnrollLimit=250 -XX:LoopMaxUnroll=16 -XX:CompileThresholdScaling=0.1 SumRed_Double
+ * @run main/othervm -XX:+IgnoreUnrecognizedVMOptions -XX:LoopUnrollLimit=250
+ *      -XX:CompileThresholdScaling=0.1
+ *      -XX:+SuperWordReductions
+ *      -XX:LoopMaxUnroll=16
+ *      compiler.loopopts.superword.SumRed_Double
+ * @run main/othervm -XX:+IgnoreUnrecognizedVMOptions -XX:LoopUnrollLimit=250
+ *      -XX:CompileThresholdScaling=0.1
+ *      -XX:-SuperWordReductions
+ *      -XX:LoopMaxUnroll=16
+ *      compiler.loopopts.superword.SumRed_Double
  */
 
-public class SumRed_Double
-{
-  public static void main(String[] args) throws Exception {
-    double[] a = new double[256*1024];
-    double[] b = new double[256*1024];
-    double[] c = new double[256*1024];
-    double[] d = new double[256*1024];
-    sumReductionInit(a,b,c);
-    double total = 0;
-    double valid = 3.6028590866691944E19;
-    for(int j = 0; j < 2000; j++) {
-      total = sumReductionImplement(a,b,c,d,total);
-    }
-    if(total == valid) {
-      System.out.println("Success");
-    } else {
-      System.out.println("Invalid sum of elements variable in total: " + total);
-      System.out.println("Expected value = " + valid);
-      throw new Exception("Failed");
-    }
-  }
+package compiler.loopopts.superword;
 
-  public static void sumReductionInit(
-    double[] a,
-    double[] b,
-    double[] c)
-  {
-    for(int j = 0; j < 1; j++)
-    {
-      for(int i = 0; i < a.length; i++)
-      {
-        a[i] = i * 1 + j;
-        b[i] = i * 1 - j;
-        c[i] = i + j;
-      }
+public class SumRed_Double {
+    public static void main(String[] args) throws Exception {
+        double[] a = new double[256 * 1024];
+        double[] b = new double[256 * 1024];
+        double[] c = new double[256 * 1024];
+        double[] d = new double[256 * 1024];
+        sumReductionInit(a, b, c);
+        double total = 0;
+        double valid = 3.6028590866691944E19;
+        for (int j = 0; j < 2000; j++) {
+            total = sumReductionImplement(a, b, c, d, total);
+        }
+        if (total == valid) {
+            System.out.println("Success");
+        } else {
+            System.out.println("Invalid sum of elements variable in total: " + total);
+            System.out.println("Expected value = " + valid);
+            throw new Exception("Failed");
+        }
     }
-  }
 
-  public static double sumReductionImplement(
-    double[] a,
-    double[] b,
-    double[] c,
-    double[] d,
-    double total)
-  {
-    for(int i = 0; i < a.length; i++)
-    {
-      d[i]= (a[i] * b[i]) + (a[i] * c[i]) + (b[i] * c[i]);
-      total += d[i];
+    public static void sumReductionInit(
+            double[] a,
+            double[] b,
+            double[] c) {
+        for (int j = 0; j < 1; j++) {
+            for (int i = 0; i < a.length; i++) {
+                a[i] = i * 1 + j;
+                b[i] = i * 1 - j;
+                c[i] = i + j;
+            }
+        }
     }
-    return total;
-  }
+
+    public static double sumReductionImplement(
+            double[] a,
+            double[] b,
+            double[] c,
+            double[] d,
+            double total) {
+        for (int i = 0; i < a.length; i++) {
+            d[i] = (a[i] * b[i]) + (a[i] * c[i]) + (b[i] * c[i]);
+            total += d[i];
+        }
+        return total;
+    }
 
 }
diff --git a/hotspot/test/compiler/loopopts/superword/SumRed_Float.java b/hotspot/test/compiler/loopopts/superword/SumRed_Float.java
index 2f02f36..22afdba 100644
--- a/hotspot/test/compiler/loopopts/superword/SumRed_Float.java
+++ b/hotspot/test/compiler/loopopts/superword/SumRed_Float.java
@@ -28,70 +28,98 @@
  * @summary Add C2 x86 Superword support for scalar sum reduction optimizations : float test
  * @requires os.arch=="x86" | os.arch=="i386" | os.arch=="amd64" | os.arch=="x86_64" | os.arch=="aarch64"
  *
- * @run main/othervm -XX:+IgnoreUnrecognizedVMOptions -XX:+SuperWordReductions -XX:LoopUnrollLimit=250 -XX:LoopMaxUnroll=2 -XX:CompileThresholdScaling=0.1 SumRed_Float
- * @run main/othervm -XX:+IgnoreUnrecognizedVMOptions -XX:-SuperWordReductions -XX:LoopUnrollLimit=250 -XX:LoopMaxUnroll=2 -XX:CompileThresholdScaling=0.1 SumRed_Float
+ * @run main/othervm -XX:+IgnoreUnrecognizedVMOptions -XX:LoopUnrollLimit=250
+ *      -XX:CompileThresholdScaling=0.1
+ *      -XX:+SuperWordReductions
+ *      -XX:LoopMaxUnroll=2
+ *      compiler.loopopts.superword.SumRed_Float
+ * @run main/othervm -XX:+IgnoreUnrecognizedVMOptions -XX:LoopUnrollLimit=250
+ *      -XX:CompileThresholdScaling=0.1
+ *      -XX:-SuperWordReductions
+ *      -XX:LoopMaxUnroll=2
+ *      compiler.loopopts.superword.SumRed_Float
  *
- * @run main/othervm -XX:+IgnoreUnrecognizedVMOptions -XX:+SuperWordReductions -XX:LoopUnrollLimit=250 -XX:LoopMaxUnroll=4 -XX:CompileThresholdScaling=0.1 SumRed_Float
- * @run main/othervm -XX:+IgnoreUnrecognizedVMOptions -XX:-SuperWordReductions -XX:LoopUnrollLimit=250 -XX:LoopMaxUnroll=4 -XX:CompileThresholdScaling=0.1 SumRed_Float
+ * @run main/othervm -XX:+IgnoreUnrecognizedVMOptions -XX:LoopUnrollLimit=250
+ *      -XX:CompileThresholdScaling=0.1
+ *      -XX:+SuperWordReductions
+ *      -XX:LoopMaxUnroll=4
+ *      compiler.loopopts.superword.SumRed_Float
+ * @run main/othervm -XX:+IgnoreUnrecognizedVMOptions -XX:LoopUnrollLimit=250
+ *      -XX:CompileThresholdScaling=0.1
+ *      -XX:-SuperWordReductions
+ *      -XX:LoopMaxUnroll=4
+ *      compiler.loopopts.superword.SumRed_Float
  *
- * @run main/othervm -XX:+IgnoreUnrecognizedVMOptions -XX:+SuperWordReductions -XX:LoopUnrollLimit=250 -XX:LoopMaxUnroll=8 -XX:CompileThresholdScaling=0.1 SumRed_Float
- * @run main/othervm -XX:+IgnoreUnrecognizedVMOptions -XX:-SuperWordReductions -XX:LoopUnrollLimit=250 -XX:LoopMaxUnroll=8 -XX:CompileThresholdScaling=0.1 SumRed_Float
+ * @run main/othervm -XX:+IgnoreUnrecognizedVMOptions -XX:LoopUnrollLimit=250
+ *      -XX:CompileThresholdScaling=0.1
+ *      -XX:+SuperWordReductions
+ *      -XX:LoopMaxUnroll=8
+ *      compiler.loopopts.superword.SumRed_Float
+ * @run main/othervm -XX:+IgnoreUnrecognizedVMOptions -XX:LoopUnrollLimit=250
+ *      -XX:CompileThresholdScaling=0.1
+ *      -XX:-SuperWordReductions
+ *      -XX:LoopMaxUnroll=8
+ *      compiler.loopopts.superword.SumRed_Float
  *
- * @run main/othervm -XX:+IgnoreUnrecognizedVMOptions -XX:+SuperWordReductions -XX:LoopUnrollLimit=250 -XX:LoopMaxUnroll=16 -XX:CompileThresholdScaling=0.1 SumRed_Float
- * @run main/othervm -XX:+IgnoreUnrecognizedVMOptions -XX:-SuperWordReductions -XX:LoopUnrollLimit=250 -XX:LoopMaxUnroll=16 -XX:CompileThresholdScaling=0.1 SumRed_Float
+ * @run main/othervm -XX:+IgnoreUnrecognizedVMOptions -XX:LoopUnrollLimit=250
+ *      -XX:CompileThresholdScaling=0.1
+ *      -XX:+SuperWordReductions
+ *      -XX:LoopMaxUnroll=16
+ *      compiler.loopopts.superword.SumRed_Float
+ * @run main/othervm -XX:+IgnoreUnrecognizedVMOptions -XX:LoopUnrollLimit=250
+ *      -XX:CompileThresholdScaling=0.1
+ *      -XX:-SuperWordReductions
+ *      -XX:LoopMaxUnroll=16
+ *      compiler.loopopts.superword.SumRed_Float
  */
 
-public class SumRed_Float
-{
-  public static void main(String[] args) throws Exception {
-    float[] a = new float[256*1024];
-    float[] b = new float[256*1024];
-    float[] c = new float[256*1024];
-    float[] d = new float[256*1024];
-    sumReductionInit(a,b,c);
-    float total = 0;
-    float valid = (float)4.611686E18;
-    for(int j = 0; j < 2000; j++) {
-      total = sumReductionImplement(a,b,c,d,total);
-    }
-    if(total == valid) {
-      System.out.println("Success");
-    } else {
-      System.out.println("Invalid sum of elements variable in total: " + total);
-      System.out.println("Expected value = " + valid);
-      throw new Exception("Failed");
-    }
-  }
+package compiler.loopopts.superword;
 
-  public static void sumReductionInit(
-    float[] a,
-    float[] b,
-    float[] c)
-  {
-    for(int j = 0; j < 1; j++)
-    {
-      for(int i = 0; i < a.length; i++)
-      {
-        a[i] = i * 1 + j;
-        b[i] = i * 1 - j;
-        c[i] = i + j;
-      }
+public class SumRed_Float {
+    public static void main(String[] args) throws Exception {
+        float[] a = new float[256 * 1024];
+        float[] b = new float[256 * 1024];
+        float[] c = new float[256 * 1024];
+        float[] d = new float[256 * 1024];
+        sumReductionInit(a, b, c);
+        float total = 0;
+        float valid = (float) 4.611686E18;
+        for (int j = 0; j < 2000; j++) {
+            total = sumReductionImplement(a, b, c, d, total);
+        }
+        if (total == valid) {
+            System.out.println("Success");
+        } else {
+            System.out.println("Invalid sum of elements variable in total: " + total);
+            System.out.println("Expected value = " + valid);
+            throw new Exception("Failed");
+        }
     }
-  }
 
-  public static float sumReductionImplement(
-    float[] a,
-    float[] b,
-    float[] c,
-    float[] d,
-    float total)
-  {
-    for(int i = 0; i < a.length; i++)
-    {
-      d[i]= (a[i] * b[i]) + (a[i] * c[i]) + (b[i] * c[i]);
-      total += d[i];
+    public static void sumReductionInit(
+            float[] a,
+            float[] b,
+            float[] c) {
+        for (int j = 0; j < 1; j++) {
+            for (int i = 0; i < a.length; i++) {
+                a[i] = i * 1 + j;
+                b[i] = i * 1 - j;
+                c[i] = i + j;
+            }
+        }
     }
-    return total;
-  }
+
+    public static float sumReductionImplement(
+            float[] a,
+            float[] b,
+            float[] c,
+            float[] d,
+            float total) {
+        for (int i = 0; i < a.length; i++) {
+            d[i] = (a[i] * b[i]) + (a[i] * c[i]) + (b[i] * c[i]);
+            total += d[i];
+        }
+        return total;
+    }
 
 }
diff --git a/hotspot/test/compiler/loopopts/superword/SumRed_Int.java b/hotspot/test/compiler/loopopts/superword/SumRed_Int.java
index c6c4b0b..a567665 100644
--- a/hotspot/test/compiler/loopopts/superword/SumRed_Int.java
+++ b/hotspot/test/compiler/loopopts/superword/SumRed_Int.java
@@ -28,70 +28,98 @@
  * @summary Add C2 x86 Superword support for scalar sum reduction optimizations : int test
  * @requires os.arch=="x86" | os.arch=="i386" | os.arch=="amd64" | os.arch=="x86_64" | os.arch=="aarch64"
  *
- * @run main/othervm -XX:+IgnoreUnrecognizedVMOptions -XX:+SuperWordReductions -XX:LoopUnrollLimit=250 -XX:LoopMaxUnroll=2 -XX:CompileThresholdScaling=0.1 SumRed_Int
- * @run main/othervm -XX:+IgnoreUnrecognizedVMOptions -XX:-SuperWordReductions -XX:LoopUnrollLimit=250 -XX:LoopMaxUnroll=2 -XX:CompileThresholdScaling=0.1 SumRed_Int
+ * @run main/othervm -XX:+IgnoreUnrecognizedVMOptions -XX:LoopUnrollLimit=250
+ *      -XX:CompileThresholdScaling=0.1
+ *      -XX:+SuperWordReductions
+ *      -XX:LoopMaxUnroll=2
+ *      compiler.loopopts.superword.SumRed_Int
+ * @run main/othervm -XX:+IgnoreUnrecognizedVMOptions -XX:LoopUnrollLimit=250
+ *      -XX:CompileThresholdScaling=0.1
+ *      -XX:-SuperWordReductions
+ *      -XX:LoopMaxUnroll=2
+ *      compiler.loopopts.superword.SumRed_Int
  *
- * @run main/othervm -XX:+IgnoreUnrecognizedVMOptions -XX:+SuperWordReductions -XX:LoopUnrollLimit=250 -XX:LoopMaxUnroll=4 -XX:CompileThresholdScaling=0.1 SumRed_Int
- * @run main/othervm -XX:+IgnoreUnrecognizedVMOptions -XX:-SuperWordReductions -XX:LoopUnrollLimit=250 -XX:LoopMaxUnroll=4 -XX:CompileThresholdScaling=0.1 SumRed_Int
+ * @run main/othervm -XX:+IgnoreUnrecognizedVMOptions -XX:LoopUnrollLimit=250
+ *      -XX:CompileThresholdScaling=0.1
+ *      -XX:+SuperWordReductions
+ *      -XX:LoopMaxUnroll=4
+ *      compiler.loopopts.superword.SumRed_Int
+ * @run main/othervm -XX:+IgnoreUnrecognizedVMOptions -XX:LoopUnrollLimit=250
+ *      -XX:CompileThresholdScaling=0.1
+ *      -XX:-SuperWordReductions
+ *      -XX:LoopMaxUnroll=4
+ *      compiler.loopopts.superword.SumRed_Int
  *
- * @run main/othervm -XX:+IgnoreUnrecognizedVMOptions -XX:+SuperWordReductions -XX:LoopUnrollLimit=250 -XX:LoopMaxUnroll=8 -XX:CompileThresholdScaling=0.1 SumRed_Int
- * @run main/othervm -XX:+IgnoreUnrecognizedVMOptions -XX:-SuperWordReductions -XX:LoopUnrollLimit=250 -XX:LoopMaxUnroll=8 -XX:CompileThresholdScaling=0.1 SumRed_Int
+ * @run main/othervm -XX:+IgnoreUnrecognizedVMOptions -XX:LoopUnrollLimit=250
+ *      -XX:CompileThresholdScaling=0.1
+ *      -XX:+SuperWordReductions
+ *      -XX:LoopMaxUnroll=8
+ *      compiler.loopopts.superword.SumRed_Int
+ * @run main/othervm -XX:+IgnoreUnrecognizedVMOptions -XX:LoopUnrollLimit=250
+ *      -XX:CompileThresholdScaling=0.1
+ *      -XX:-SuperWordReductions
+ *      -XX:LoopMaxUnroll=8
+ *      compiler.loopopts.superword.SumRed_Int
  *
- * @run main/othervm -XX:+IgnoreUnrecognizedVMOptions -XX:+SuperWordReductions -XX:LoopUnrollLimit=250 -XX:LoopMaxUnroll=16 -XX:CompileThresholdScaling=0.1 SumRed_Int
- * @run main/othervm -XX:+IgnoreUnrecognizedVMOptions -XX:-SuperWordReductions -XX:LoopUnrollLimit=250 -XX:LoopMaxUnroll=16 -XX:CompileThresholdScaling=0.1 SumRed_Int
+ * @run main/othervm -XX:+IgnoreUnrecognizedVMOptions -XX:LoopUnrollLimit=250
+ *      -XX:CompileThresholdScaling=0.1
+ *      -XX:+SuperWordReductions
+ *      -XX:LoopMaxUnroll=16
+ *      compiler.loopopts.superword.SumRed_Int
+ * @run main/othervm -XX:+IgnoreUnrecognizedVMOptions -XX:LoopUnrollLimit=250
+ *      -XX:CompileThresholdScaling=0.1
+ *      -XX:-SuperWordReductions
+ *      -XX:LoopMaxUnroll=16
+ *      compiler.loopopts.superword.SumRed_Int
  */
 
-public class SumRed_Int
-{
-  public static void main(String[] args) throws Exception {
-    int[] a = new int[256*1024];
-    int[] b = new int[256*1024];
-    int[] c = new int[256*1024];
-    int[] d = new int[256*1024];
-    sumReductionInit(a,b,c);
-    int total = 0;
-    int valid = 262144000;
-    for(int j = 0; j < 2000; j++) {
-      total = sumReductionImplement(a,b,c,d,total);
-    }
-    if(total == valid) {
-      System.out.println("Success");
-    } else {
-      System.out.println("Invalid sum of elements variable in total: " + total);
-      System.out.println("Expected value = " + valid);
-      throw new Exception("Failed");
-    }
-  }
+package compiler.loopopts.superword;
 
-  public static void sumReductionInit(
-    int[] a,
-    int[] b,
-    int[] c)
-  {
-    for(int j = 0; j < 1; j++)
-    {
-      for(int i = 0; i < a.length; i++)
-      {
-        a[i] = i * 1 + j;
-        b[i] = i * 1 - j;
-        c[i] = i + j;
-      }
+public class SumRed_Int {
+    public static void main(String[] args) throws Exception {
+        int[] a = new int[256 * 1024];
+        int[] b = new int[256 * 1024];
+        int[] c = new int[256 * 1024];
+        int[] d = new int[256 * 1024];
+        sumReductionInit(a, b, c);
+        int total = 0;
+        int valid = 262144000;
+        for (int j = 0; j < 2000; j++) {
+            total = sumReductionImplement(a, b, c, d, total);
+        }
+        if (total == valid) {
+            System.out.println("Success");
+        } else {
+            System.out.println("Invalid sum of elements variable in total: " + total);
+            System.out.println("Expected value = " + valid);
+            throw new Exception("Failed");
+        }
     }
-  }
 
-  public static int sumReductionImplement(
-    int[] a,
-    int[] b,
-    int[] c,
-    int[] d,
-    int total)
-  {
-    for(int i = 0; i < a.length; i++)
-    {
-      d[i]= (a[i] * b[i]) + (a[i] * c[i]) + (b[i] * c[i]);
-      total += d[i];
+    public static void sumReductionInit(
+            int[] a,
+            int[] b,
+            int[] c) {
+        for (int j = 0; j < 1; j++) {
+            for (int i = 0; i < a.length; i++) {
+                a[i] = i * 1 + j;
+                b[i] = i * 1 - j;
+                c[i] = i + j;
+            }
+        }
     }
-    return total;
-  }
+
+    public static int sumReductionImplement(
+            int[] a,
+            int[] b,
+            int[] c,
+            int[] d,
+            int total) {
+        for (int i = 0; i < a.length; i++) {
+            d[i] = (a[i] * b[i]) + (a[i] * c[i]) + (b[i] * c[i]);
+            total += d[i];
+        }
+        return total;
+    }
 
 }
diff --git a/hotspot/test/compiler/loopopts/superword/SumRed_Long.java b/hotspot/test/compiler/loopopts/superword/SumRed_Long.java
index 503a11d..b841d7f 100644
--- a/hotspot/test/compiler/loopopts/superword/SumRed_Long.java
+++ b/hotspot/test/compiler/loopopts/superword/SumRed_Long.java
@@ -28,66 +28,77 @@
  * @summary Add C2 x86 Superword support for scalar sum reduction optimizations : long test
  * @requires os.arch=="x86" | os.arch=="i386" | os.arch=="amd64" | os.arch=="x86_64"
  *
- * @run main/othervm -XX:+IgnoreUnrecognizedVMOptions -XX:+SuperWordReductions -XX:LoopUnrollLimit=250 -XX:LoopMaxUnroll=4 -XX:CompileThresholdScaling=0.1 SumRed_Long
- * @run main/othervm -XX:+IgnoreUnrecognizedVMOptions -XX:-SuperWordReductions -XX:LoopUnrollLimit=250 -XX:LoopMaxUnroll=4 -XX:CompileThresholdScaling=0.1 SumRed_Long
+ * @run main/othervm -XX:+IgnoreUnrecognizedVMOptions -XX:LoopUnrollLimit=250
+ *      -XX:CompileThresholdScaling=0.1
+ *      -XX:+SuperWordReductions
+ *      -XX:LoopMaxUnroll=4
+ *      compiler.loopopts.superword.SumRed_Long
+ * @run main/othervm -XX:+IgnoreUnrecognizedVMOptions -XX:LoopUnrollLimit=250
+ *      -XX:CompileThresholdScaling=0.1
+ *      -XX:-SuperWordReductions
+ *      -XX:LoopMaxUnroll=4
+ *      compiler.loopopts.superword.SumRed_Long
  *
- * @run main/othervm -XX:+IgnoreUnrecognizedVMOptions -XX:+SuperWordReductions -XX:LoopUnrollLimit=250 -XX:LoopMaxUnroll=8 -XX:CompileThresholdScaling=0.1 SumRed_Long
- * @run main/othervm -XX:+IgnoreUnrecognizedVMOptions -XX:-SuperWordReductions -XX:LoopUnrollLimit=250 -XX:LoopMaxUnroll=8 -XX:CompileThresholdScaling=0.1 SumRed_Long
- *
+ * @run main/othervm -XX:+IgnoreUnrecognizedVMOptions -XX:LoopUnrollLimit=250
+ *      -XX:CompileThresholdScaling=0.1
+ *      -XX:+SuperWordReductions
+ *      -XX:LoopMaxUnroll=8
+ *      compiler.loopopts.superword.SumRed_Long
+ * @run main/othervm -XX:+IgnoreUnrecognizedVMOptions -XX:LoopUnrollLimit=250
+ *      -XX:CompileThresholdScaling=0.1
+ *      -XX:-SuperWordReductions
+ *      -XX:LoopMaxUnroll=8
+ *      compiler.loopopts.superword.SumRed_Long
  */
 
-public class SumRed_Long
-{
-  public static void main(String[] args) throws Exception {
-    long[] a = new long[256*1024];
-    long[] b = new long[256*1024];
-    long[] c = new long[256*1024];
-    long[] d = new long[256*1024];
-    sumReductionInit(a,b,c);
-    long total = 0;
-    long valid = 262144000;
-    for(int j = 0; j < 2000; j++) {
-      total = sumReductionImplement(a,b,c,d,total);
-    }
-    total = (int)total;
-    if(total == valid) {
-      System.out.println("Success");
-    } else {
-      System.out.println("Invalid sum of elements variable in total: " + total);
-      System.out.println("Expected value = " + valid);
-      throw new Exception("Failed");
-    }
-  }
+package compiler.loopopts.superword;
 
-  public static void sumReductionInit(
-    long[] a,
-    long[] b,
-    long[] c)
-  {
-    for(int j = 0; j < 1; j++)
-    {
-      for(int i = 0; i < a.length; i++)
-      {
-        a[i] = i * 1 + j;
-        b[i] = i * 1 - j;
-        c[i] = i + j;
-      }
+public class SumRed_Long {
+    public static void main(String[] args) throws Exception {
+        long[] a = new long[256 * 1024];
+        long[] b = new long[256 * 1024];
+        long[] c = new long[256 * 1024];
+        long[] d = new long[256 * 1024];
+        sumReductionInit(a, b, c);
+        long total = 0;
+        long valid = 262144000;
+        for (int j = 0; j < 2000; j++) {
+            total = sumReductionImplement(a, b, c, d, total);
+        }
+        total = (int) total;
+        if (total == valid) {
+            System.out.println("Success");
+        } else {
+            System.out.println("Invalid sum of elements variable in total: " + total);
+            System.out.println("Expected value = " + valid);
+            throw new Exception("Failed");
+        }
     }
-  }
 
-  public static long sumReductionImplement(
-    long[] a,
-    long[] b,
-    long[] c,
-    long[] d,
-    long total)
-  {
-    for(int i = 0; i < a.length; i++)
-    {
-      d[i]= (a[i] * b[i]) + (a[i] * c[i]) + (b[i] * c[i]);
-      total += d[i];
+    public static void sumReductionInit(
+            long[] a,
+            long[] b,
+            long[] c) {
+        for (int j = 0; j < 1; j++) {
+            for (int i = 0; i < a.length; i++) {
+                a[i] = i * 1 + j;
+                b[i] = i * 1 - j;
+                c[i] = i + j;
+            }
+        }
     }
-    return total;
-  }
+
+    public static long sumReductionImplement(
+            long[] a,
+            long[] b,
+            long[] c,
+            long[] d,
+            long total) {
+        for (int i = 0; i < a.length; i++) {
+            d[i] = (a[i] * b[i]) + (a[i] * c[i]) + (b[i] * c[i]);
+            total += d[i];
+        }
+        return total;
+    }
 
 }
diff --git a/hotspot/test/compiler/loopopts/superword/TestBestAlign.java b/hotspot/test/compiler/loopopts/superword/TestBestAlign.java
index 9609859..87fa90c 100644
--- a/hotspot/test/compiler/loopopts/superword/TestBestAlign.java
+++ b/hotspot/test/compiler/loopopts/superword/TestBestAlign.java
@@ -25,10 +25,12 @@
  * @test
  * @bug 8141624
  * @summary Limit calculation of pre loop during super word optimization is wrong
- * @run main/othervm TestBestAlign
+ * @run main/othervm compiler.loopopts.superword.TestBestAlign
  * @author gunter.haug@sap.com
  */
 
+package compiler.loopopts.superword;
+
 public class TestBestAlign {
 
     static final int initVal = -1;
diff --git a/hotspot/test/compiler/loopopts/superword/TestReductionWithLoopVariantUse.java b/hotspot/test/compiler/loopopts/superword/TestReductionWithLoopVariantUse.java
index b8e1d72..df471d5 100644
--- a/hotspot/test/compiler/loopopts/superword/TestReductionWithLoopVariantUse.java
+++ b/hotspot/test/compiler/loopopts/superword/TestReductionWithLoopVariantUse.java
@@ -25,10 +25,12 @@
  * @test
  * @bug 8080976
  * @summary Loop variant use in reduction should prevent vectorization
- * @run main/othervm -XX:-BackgroundCompilation -XX:-UseOnStackReplacement TestReductionWithLoopVariantUse
- *
+ * @run main/othervm -XX:-BackgroundCompilation -XX:-UseOnStackReplacement
+ *      compiler.loopopts.superword.TestReductionWithLoopVariantUse
  */
 
+package compiler.loopopts.superword;
+
 public class TestReductionWithLoopVariantUse {
     static int m(int[] array) {
         int c = 0;
diff --git a/hotspot/test/compiler/loopopts/superword/TestVectorizationWithInvariant.java b/hotspot/test/compiler/loopopts/superword/TestVectorizationWithInvariant.java
index 41e7769..8ef4cde 100644
--- a/hotspot/test/compiler/loopopts/superword/TestVectorizationWithInvariant.java
+++ b/hotspot/test/compiler/loopopts/superword/TestVectorizationWithInvariant.java
@@ -22,17 +22,20 @@
  *
  */
 
-import jdk.test.lib.*;
-import jdk.internal.misc.Unsafe;
-
 /**
  * @test
  * @bug 8078497
  * @summary Tests correct alignment of vectors with loop invariant offset.
  * @modules java.base/jdk.internal.misc
  * @library /testlibrary
- * @run main TestVectorizationWithInvariant
+ * @run main compiler.loopopts.superword.TestVectorizationWithInvariant
  */
+
+package compiler.loopopts.superword;
+
+import jdk.internal.misc.Unsafe;
+import jdk.test.lib.Utils;
+
 public class TestVectorizationWithInvariant {
 
     private static Unsafe unsafe;
diff --git a/hotspot/test/compiler/macronodes/TestEliminateAllocationPhi.java b/hotspot/test/compiler/macronodes/TestEliminateAllocationPhi.java
index e9a5154..b57dcde 100644
--- a/hotspot/test/compiler/macronodes/TestEliminateAllocationPhi.java
+++ b/hotspot/test/compiler/macronodes/TestEliminateAllocationPhi.java
@@ -25,10 +25,12 @@
  * @test
  * @bug 8046698
  * @summary PhiNode inserted between AllocateNode and Initialization node confuses allocation elimination
- * @run main/othervm -XX:-BackgroundCompilation -XX:-UseOnStackReplacement TestEliminateAllocationPhi
- *
+ * @run main/othervm -XX:-BackgroundCompilation -XX:-UseOnStackReplacement
+ *                   compiler.macronodes.TestEliminateAllocationPhi
  */
 
+package compiler.macronodes;
+
 public class TestEliminateAllocationPhi {
 
     // This will return I when called from m(0 and once optimized will
diff --git a/hotspot/test/compiler/membars/DekkerTest.java b/hotspot/test/compiler/membars/DekkerTest.java
index 83eb923..8fdb33c 100644
--- a/hotspot/test/compiler/membars/DekkerTest.java
+++ b/hotspot/test/compiler/membars/DekkerTest.java
@@ -25,14 +25,22 @@
  * @test
  * @bug 8007898
  * @summary Incorrect optimization of Memory Barriers in Matcher::post_store_load_barrier().
- * @run main/othervm -Xbatch -XX:+IgnoreUnrecognizedVMOptions -XX:-TieredCompilation -XX:CICompilerCount=1 -XX:+StressGCM -XX:+StressLCM DekkerTest
- * @run main/othervm -Xbatch -XX:+IgnoreUnrecognizedVMOptions -XX:-TieredCompilation -XX:CICompilerCount=1 -XX:+StressGCM -XX:+StressLCM DekkerTest
- * @run main/othervm -Xbatch -XX:+IgnoreUnrecognizedVMOptions -XX:-TieredCompilation -XX:CICompilerCount=1 -XX:+StressGCM -XX:+StressLCM DekkerTest
+ * @run main/othervm -Xbatch -XX:+UnlockDiagnosticVMOptions -XX:+IgnoreUnrecognizedVMOptions
+ *      -XX:-TieredCompilation -XX:CICompilerCount=1 -XX:+StressGCM -XX:+StressLCM
+ *      compiler.membars.DekkerTest
+ * @run main/othervm -Xbatch -XX:+UnlockDiagnosticVMOptions -XX:+IgnoreUnrecognizedVMOptions
+ *      -XX:-TieredCompilation -XX:CICompilerCount=1 -XX:+StressGCM -XX:+StressLCM
+ *      compiler.membars.DekkerTest
+ * @run main/othervm -Xbatch -XX:+UnlockDiagnosticVMOptions -XX:+IgnoreUnrecognizedVMOptions
+ *      -XX:-TieredCompilation -XX:CICompilerCount=1 -XX:+StressGCM -XX:+StressLCM
+ *      compiler.membars.DekkerTest
  * @author Martin Doerr martin DOT doerr AT sap DOT com
  *
  * Run 3 times since the failure is intermittent.
  */
 
+package compiler.membars;
+
 public class DekkerTest {
 
     /*
diff --git a/hotspot/test/compiler/membars/TestMemBarAcquire.java b/hotspot/test/compiler/membars/TestMemBarAcquire.java
index e255cc1..d8de1b4 100644
--- a/hotspot/test/compiler/membars/TestMemBarAcquire.java
+++ b/hotspot/test/compiler/membars/TestMemBarAcquire.java
@@ -24,30 +24,34 @@
 /*
  * @test TestMemBarAcquire
  * @bug 8048879
- * @summary "Tests optimization of MemBarAcquireNodes"
- * @run main/othervm -XX:-TieredCompilation -XX:-BackgroundCompilation TestMemBarAcquire
+ * @summary Tests optimization of MemBarAcquireNodes
+ * @run main/othervm -XX:-TieredCompilation -XX:-BackgroundCompilation
+ *                   compiler.membars.TestMemBarAcquire
  */
+
+package compiler.membars;
+
 public class TestMemBarAcquire {
-  private volatile static Object defaultObj = new Object();
-  private Object obj;
+    private volatile static Object defaultObj = new Object();
+    private Object obj;
 
-  public TestMemBarAcquire(Object param) {
-    // Volatile load. MemBarAcquireNode is added after the
-    // load to prevent following loads from floating up past.
-    // StoreNode is added to store result of load in 'obj'.
-    this.obj = defaultObj;
-    // Overrides 'obj' and therefore makes previous StoreNode
-    // and the corresponding LoadNode useless. However, the
-    // LoadNode is still connected to the MemBarAcquireNode
-    // that should now release the reference.
-    this.obj = param;
-  }
-
-  public static void main(String[] args) throws Exception {
-    // Make sure TestMemBarAcquire::<init> is compiled
-    for (int i = 0; i < 100000; ++i) {
-      TestMemBarAcquire p = new TestMemBarAcquire(new Object());
+    public TestMemBarAcquire(Object param) {
+        // Volatile load. MemBarAcquireNode is added after the
+        // load to prevent following loads from floating up past.
+        // StoreNode is added to store result of load in 'obj'.
+        this.obj = defaultObj;
+        // Overrides 'obj' and therefore makes previous StoreNode
+        // and the corresponding LoadNode useless. However, the
+        // LoadNode is still connected to the MemBarAcquireNode
+        // that should now release the reference.
+        this.obj = param;
     }
-  }
+
+    public static void main(String[] args) throws Exception {
+        // Make sure TestMemBarAcquire::<init> is compiled
+        for (int i = 0; i < 100000; ++i) {
+            TestMemBarAcquire p = new TestMemBarAcquire(new Object());
+        }
+    }
 }
 
diff --git a/hotspot/test/compiler/memoryinitialization/ZeroTLABTest.java b/hotspot/test/compiler/memoryinitialization/ZeroTLABTest.java
index 9be412a..09057c2 100644
--- a/hotspot/test/compiler/memoryinitialization/ZeroTLABTest.java
+++ b/hotspot/test/compiler/memoryinitialization/ZeroTLABTest.java
@@ -25,11 +25,15 @@
 /*
  * @test
  * @bug 8086053
- * @run main/othervm -Xcomp -XX:+UseTLAB -XX:+ZeroTLAB ZeroTLABTest
- * @run main/othervm -Xcomp -XX:+UseTLAB -XX:-ZeroTLAB ZeroTLABTest
- * @run main/othervm -Xcomp -XX:-UseTLAB -XX:+ZeroTLAB ZeroTLABTest
- * @run main/othervm -Xcomp -XX:-UseTLAB -XX:-ZeroTLAB ZeroTLABTest
+ *
+ * @run main/othervm -Xcomp -XX:+UseTLAB -XX:+ZeroTLAB compiler.memoryinitialization.ZeroTLABTest
+ * @run main/othervm -Xcomp -XX:+UseTLAB -XX:-ZeroTLAB compiler.memoryinitialization.ZeroTLABTest
+ * @run main/othervm -Xcomp -XX:-UseTLAB -XX:+ZeroTLAB compiler.memoryinitialization.ZeroTLABTest
+ * @run main/othervm -Xcomp -XX:-UseTLAB -XX:-ZeroTLAB compiler.memoryinitialization.ZeroTLABTest
  */
+
+package compiler.memoryinitialization;
+
 public class ZeroTLABTest {
     public static void main(String args[]) {
         System.out.println("Test PASSED");
diff --git a/hotspot/test/compiler/onSpinWait/TestOnSpinWait.java b/hotspot/test/compiler/onSpinWait/TestOnSpinWait.java
index 6a3fa0d..97c3ab6 100644
--- a/hotspot/test/compiler/onSpinWait/TestOnSpinWait.java
+++ b/hotspot/test/compiler/onSpinWait/TestOnSpinWait.java
@@ -26,15 +26,16 @@
  * @test TestOnSpinWait
  * @summary (x86 only) checks that java.lang.Thread.onSpinWait is intrinsified
  * @bug 8147844
- * @modules java.base/jdk.internal.misc
  * @library /testlibrary
+ * @modules java.base/jdk.internal.misc
  * @requires os.arch=="x86" | os.arch=="amd64" | os.arch=="x86_64"
- * @run main TestOnSpinWait
+ * @run driver compiler.onSpinWait.TestOnSpinWait
  */
 
-import java.lang.invoke.*;
-import jdk.test.lib.*;
-import static jdk.test.lib.Asserts.*;
+package compiler.onSpinWait;
+
+import jdk.test.lib.OutputAnalyzer;
+import jdk.test.lib.ProcessTools;
 
 public class TestOnSpinWait {
 
@@ -45,7 +46,7 @@
           "-XX:+IgnoreUnrecognizedVMOptions", "-showversion",
           "-XX:+TieredCompilation", "-XX:TieredStopAtLevel=1", "-Xbatch",
           "-XX:+PrintCompilation", "-XX:+UnlockDiagnosticVMOptions",
-          "-XX:+PrintInlining", "TestOnSpinWait$Launcher");
+          "-XX:+PrintInlining", Launcher.class.getName());
 
         OutputAnalyzer analyzer = new OutputAnalyzer(pb.start());
 
@@ -59,7 +60,7 @@
           "-XX:+IgnoreUnrecognizedVMOptions", "-showversion",
           "-XX:-TieredCompilation", "-Xbatch",
           "-XX:+PrintCompilation", "-XX:+UnlockDiagnosticVMOptions",
-          "-XX:+PrintInlining", "TestOnSpinWait$Launcher");
+          "-XX:+PrintInlining", Launcher.class.getName());
 
         analyzer = new OutputAnalyzer(pb.start());
 
diff --git a/hotspot/test/compiler/onSpinWait/TestOnSpinWaitEnableDisable.java b/hotspot/test/compiler/onSpinWait/TestOnSpinWaitEnableDisable.java
index 97a7dd7..dd0c9c8 100644
--- a/hotspot/test/compiler/onSpinWait/TestOnSpinWaitEnableDisable.java
+++ b/hotspot/test/compiler/onSpinWait/TestOnSpinWaitEnableDisable.java
@@ -26,10 +26,14 @@
  * @test TestOnSpinWaitEnableDisable
  * @summary Test to ensure basic functioning of java.lang.Thread.onSpinWait
  * @bug 8157683
- * @run main TestOnSpinWaitEnableDisable
- * @run main/othervm -XX:+UnlockDiagnosticVMOptions -XX:DisableIntrinsic=_onSpinWait TestOnSpinWaitEnableDisable
+ *
+ * @run main compiler.onSpinWait.TestOnSpinWaitEnableDisable
+ * @run main/othervm -XX:+UnlockDiagnosticVMOptions -XX:DisableIntrinsic=_onSpinWait
+ *                   compiler.onSpinWait.TestOnSpinWaitEnableDisable
  */
 
+package compiler.onSpinWait;
+
 public class TestOnSpinWaitEnableDisable {
     public static void main(String[] args) {
         for (int i = 0; i < 50_000; i++) {
diff --git a/hotspot/test/compiler/oracle/CheckCompileCommandOption.java b/hotspot/test/compiler/oracle/CheckCompileCommandOption.java
index 6489df5..10e71b4 100644
--- a/hotspot/test/compiler/oracle/CheckCompileCommandOption.java
+++ b/hotspot/test/compiler/oracle/CheckCompileCommandOption.java
@@ -21,21 +21,23 @@
  * questions.
  */
 
-import java.io.PrintWriter;
-import java.io.File;
-
-import jdk.test.lib.*;
-
 /*
  * @test CheckCompileCommandOption
+ * @summary Checks parsing of -XX:CompileCommand=option
  * @bug 8055286 8056964 8059847 8069035
- * @summary "Checks parsing of -XX:CompileCommand=option"
  * @library /testlibrary
  * @modules java.base/jdk.internal.misc
  *          java.management
- * @run main CheckCompileCommandOption
+ * @run driver compiler.oracle.CheckCompileCommandOption
  */
 
+package compiler.oracle;
+
+import jdk.test.lib.OutputAnalyzer;
+import jdk.test.lib.ProcessTools;
+
+import java.io.File;
+
 public class CheckCompileCommandOption {
 
     // Currently, two types of trailing options can be used with
diff --git a/hotspot/test/compiler/oracle/GetMethodOptionTest.java b/hotspot/test/compiler/oracle/GetMethodOptionTest.java
index ed295f41..2da784c 100644
--- a/hotspot/test/compiler/oracle/GetMethodOptionTest.java
+++ b/hotspot/test/compiler/oracle/GetMethodOptionTest.java
@@ -21,32 +21,34 @@
  * questions.
  */
 
-import java.lang.reflect.Executable;
-import java.util.function.BiFunction;
+/*
+ * @test
+ * @bug 8074980
+ * @library /testlibrary /test/lib
+ * @modules java.base/jdk.internal.misc
+ * @build sun.hotspot.WhiteBox jdk.test.lib.Asserts compiler.oracle.GetMethodOptionTest
+ * @run driver ClassFileInstaller sun.hotspot.WhiteBox
+ *                                sun.hotspot.WhiteBox$WhiteBoxPermission
+ * @run main/othervm -Xbootclasspath/a:. -XX:+UnlockDiagnosticVMOptions -XX:+WhiteBoxAPI
+ *                   -XX:CompileCommand=option,compiler.oracle.GetMethodOptionTest::test,ccstrlist,MyListOption,_foo,_bar
+ *                   -XX:CompileCommand=option,compiler.oracle.GetMethodOptionTest::test,ccstr,MyStrOption,_foo
+ *                   -XX:CompileCommand=option,compiler.oracle.GetMethodOptionTest::test,bool,MyBoolOption,false
+ *                   -XX:CompileCommand=option,compiler.oracle.GetMethodOptionTest::test,intx,MyIntxOption,-1
+ *                   -XX:CompileCommand=option,compiler.oracle.GetMethodOptionTest::test,uintx,MyUintxOption,1
+ *                   -XX:CompileCommand=option,compiler.oracle.GetMethodOptionTest::test,MyFlag
+ *                   -XX:CompileCommand=option,compiler.oracle.GetMethodOptionTest::test,double,MyDoubleOption1,1.123
+ *                   -XX:CompileCommand=option,compiler.oracle.GetMethodOptionTest::test,double,MyDoubleOption2,1.123
+ *                   -XX:CompileCommand=option,compiler.oracle.GetMethodOptionTest::test,bool,MyBoolOptionX,false,intx,MyIntxOptionX,-1,uintx,MyUintxOptionX,1,MyFlagX,double,MyDoubleOptionX,1.123
+ *                   compiler.oracle.GetMethodOptionTest
+ */
+
+package compiler.oracle;
 
 import jdk.test.lib.Asserts;
 import sun.hotspot.WhiteBox;
 
-/*
- * @test
- * @bug 8074980
- * @modules java.base/jdk.internal.misc
- * @library /testlibrary /test/lib
- * @build sun.hotspot.WhiteBox jdk.test.lib.Asserts GetMethodOptionTest
- * @run main ClassFileInstaller sun.hotspot.WhiteBox
- *                              sun.hotspot.WhiteBox$WhiteBoxPermission
- * @run main/othervm -Xbootclasspath/a:. -XX:+UnlockDiagnosticVMOptions -XX:+WhiteBoxAPI
- *                   -XX:CompileCommand=option,GetMethodOptionTest::test,ccstrlist,MyListOption,_foo,_bar
- *                   -XX:CompileCommand=option,GetMethodOptionTest::test,ccstr,MyStrOption,_foo
- *                   -XX:CompileCommand=option,GetMethodOptionTest::test,bool,MyBoolOption,false
- *                   -XX:CompileCommand=option,GetMethodOptionTest::test,intx,MyIntxOption,-1
- *                   -XX:CompileCommand=option,GetMethodOptionTest::test,uintx,MyUintxOption,1
- *                   -XX:CompileCommand=option,GetMethodOptionTest::test,MyFlag
- *                   -XX:CompileCommand=option,GetMethodOptionTest::test,double,MyDoubleOption1,1.123
- *                   -XX:CompileCommand=option,GetMethodOptionTest.test,double,MyDoubleOption2,1.123
- *                   -XX:CompileCommand=option,GetMethodOptionTest::test,bool,MyBoolOptionX,false,intx,MyIntxOptionX,-1,uintx,MyUintxOptionX,1,MyFlagX,double,MyDoubleOptionX,1.123
- *                   GetMethodOptionTest
- */
+import java.lang.reflect.Executable;
+import java.util.function.BiFunction;
 
 public class GetMethodOptionTest {
     private static final  WhiteBox WB = WhiteBox.getWhiteBox();
diff --git a/hotspot/test/compiler/oracle/MethodMatcherTest.java b/hotspot/test/compiler/oracle/MethodMatcherTest.java
index 1f15827..3e7f1a0 100644
--- a/hotspot/test/compiler/oracle/MethodMatcherTest.java
+++ b/hotspot/test/compiler/oracle/MethodMatcherTest.java
@@ -23,21 +23,24 @@
 
 /*
  * @test MethodMatcherTest
- * @modules java.base/jdk.internal.misc
- * @library /testlibrary /test/lib
- * @build sun.hotspot.WhiteBox
- * @run main ClassFileInstaller sun.hotspot.WhiteBox
- *                              sun.hotspot.WhiteBox$WhiteBoxPermission
- * @run main/othervm -Xbootclasspath/a:. -XX:+UnlockDiagnosticVMOptions -XX:+WhiteBoxAPI MethodMatcherTest
  * @summary Testing of compiler/MethodMatcher
  * @bug 8135068
+ * @library /testlibrary /test/lib
+ * @modules java.base/jdk.internal.misc
+ * @build sun.hotspot.WhiteBox
+ * @run driver ClassFileInstaller sun.hotspot.WhiteBox
+ *                                sun.hotspot.WhiteBox$WhiteBoxPermission
+ * @run main/othervm -Xbootclasspath/a:. -XX:+UnlockDiagnosticVMOptions -XX:+WhiteBoxAPI
+ *                   compiler.oracle.MethodMatcherTest
  */
 
+package compiler.oracle;
+
+import sun.hotspot.WhiteBox;
+
 import java.lang.reflect.Method;
 import java.util.ArrayList;
 
-import sun.hotspot.WhiteBox;
-
 public class MethodMatcherTest {
 
     /** Instance of WhiteBox */
@@ -83,14 +86,14 @@
         testCases.add(helper, "_pool,sub,Klass*,met@%hod,(0)V", PARSING_FAILURE);
 
         testCases.add(helper, "*.*", MATCH);
-        testCases.add(helper, "MethodMatcherTest.*", MATCH);
-        testCases.add(helper, "MethodMatcherTest.helper", MATCH);
-        testCases.add(helper, "MethodMatcherTest.helper()", MATCH);
-        testCases.add(helper, "MethodMatcherTest.helper()V", MATCH);
-        testCases.add(helper, "MethodMatcherTest.helper()V;", NO_MATCH);
-        testCases.add(helper, "MethodMatcherTest.helper()I", NO_MATCH);
-        testCases.add(helper, "MethodMatcherTest.helperX", NO_MATCH);
-        testCases.add(helper, "MethodMatcherTestX.helper;", NO_MATCH);
+        testCases.add(helper, "compiler/oracle/MethodMatcherTest.*", MATCH);
+        testCases.add(helper, "compiler/oracle/MethodMatcherTest.helper", MATCH);
+        testCases.add(helper, "compiler/oracle/MethodMatcherTest.helper()", MATCH);
+        testCases.add(helper, "compiler/oracle/MethodMatcherTest.helper()V", MATCH);
+        testCases.add(helper, "compiler/oracle/MethodMatcherTest.helper()V;", NO_MATCH);
+        testCases.add(helper, "compiler/oracle/MethodMatcherTest.helper()I", NO_MATCH);
+        testCases.add(helper, "compiler/oracle/MethodMatcherTest.helperX", NO_MATCH);
+        testCases.add(helper, "compiler/oracle/MethodMatcherTest.helper;", NO_MATCH);
         testCases.add(helper, "abc.*", NO_MATCH);
         testCases.add(helper, "*.abc", NO_MATCH);
 
@@ -100,13 +103,13 @@
         testCases.add(getDate, "java/util/Date.*", MATCH);
 
         testCases.add(inner, "*.*", MATCH);
-        testCases.add(inner, "MethodMatcherTest$TestCases.innerHelper", MATCH);
-        testCases.add(inner, "MethodMatcherTest*.innerHelper", MATCH);
-        testCases.add(inner, "MethodMatcherTest$*.innerHelper", MATCH);
+        testCases.add(inner, "compiler/oracle/MethodMatcherTest$TestCases.innerHelper", MATCH);
+        testCases.add(inner, "compiler/oracle/MethodMatcherTest*.innerHelper", MATCH);
+        testCases.add(inner, "compiler/oracle/MethodMatcherTest$*.innerHelper", MATCH);
         testCases.add(inner, "*$TestCases.innerHelper", MATCH);
         testCases.add(inner, "*TestCases.innerHelper", MATCH);
         testCases.add(inner, "TestCases.innerHelper", NO_MATCH);
-        testCases.add(inner, "MethodMatcherTest.innerHelper", NO_MATCH);
+        testCases.add(inner, "compiler/oracle/MethodMatcherTest.innerHelper", NO_MATCH);
 
         testCases.add(toString, "*.*", MATCH);
         testCases.add(toString, "java/lang/String.toString", MATCH);
diff --git a/hotspot/test/compiler/oracle/TestCompileCommand.java b/hotspot/test/compiler/oracle/TestCompileCommand.java
index 6ec02ac..d8ba4aa 100644
--- a/hotspot/test/compiler/oracle/TestCompileCommand.java
+++ b/hotspot/test/compiler/oracle/TestCompileCommand.java
@@ -21,21 +21,21 @@
  * questions.
  */
 
-import java.io.PrintWriter;
-import java.io.File;
-
-import jdk.test.lib.*;
-
 /*
  * @test TestCompileCommand
  * @bug 8069389
- * @summary "Regression tests of -XX:CompileCommand"
+ * @summary Regression tests of -XX:CompileCommand
  * @library /testlibrary
  * @modules java.base/jdk.internal.misc
  *          java.management
- * @run main TestCompileCommand
+ * @run driver compiler.oracle.TestCompileCommand
  */
 
+package compiler.oracle;
+
+import jdk.test.lib.OutputAnalyzer;
+import jdk.test.lib.ProcessTools;
+
 public class TestCompileCommand {
 
     private static final String[][] ARGUMENTS = {
diff --git a/hotspot/test/compiler/osr/TestOSRWithNonEmptyStack.java b/hotspot/test/compiler/osr/TestOSRWithNonEmptyStack.java
index 516d485..3cbcbb0 100644
--- a/hotspot/test/compiler/osr/TestOSRWithNonEmptyStack.java
+++ b/hotspot/test/compiler/osr/TestOSRWithNonEmptyStack.java
@@ -21,22 +21,37 @@
  * questions.
  */
 
-import java.lang.reflect.Constructor;
-import java.lang.reflect.Method;
-
-import jdk.internal.org.objectweb.asm.ClassWriter;
-import jdk.internal.org.objectweb.asm.Label;
-import jdk.internal.org.objectweb.asm.MethodVisitor;
-import static jdk.internal.org.objectweb.asm.Opcodes.*;
-
 /**
  * @test
  * @bug 8051344
  * @summary Force OSR compilation with non-empty stack at the OSR entry point.
  * @modules java.base/jdk.internal.org.objectweb.asm
- * @compile -XDignore.symbol.file TestOSRWithNonEmptyStack.java
- * @run main/othervm -XX:CompileOnly=TestCase.test TestOSRWithNonEmptyStack
+ * @run main/othervm -XX:CompileCommand=compileonly,TestCase::test
+ *                   compiler.osr.TestOSRWithNonEmptyStack
  */
+
+package compiler.osr;
+
+import jdk.internal.org.objectweb.asm.ClassWriter;
+import jdk.internal.org.objectweb.asm.Label;
+import jdk.internal.org.objectweb.asm.MethodVisitor;
+
+import java.lang.reflect.Constructor;
+import java.lang.reflect.Method;
+
+import static jdk.internal.org.objectweb.asm.Opcodes.ACC_PUBLIC;
+import static jdk.internal.org.objectweb.asm.Opcodes.ALOAD;
+import static jdk.internal.org.objectweb.asm.Opcodes.DUP;
+import static jdk.internal.org.objectweb.asm.Opcodes.IADD;
+import static jdk.internal.org.objectweb.asm.Opcodes.ICONST_0;
+import static jdk.internal.org.objectweb.asm.Opcodes.ICONST_1;
+import static jdk.internal.org.objectweb.asm.Opcodes.IF_ICMPLT;
+import static jdk.internal.org.objectweb.asm.Opcodes.ILOAD;
+import static jdk.internal.org.objectweb.asm.Opcodes.INVOKESPECIAL;
+import static jdk.internal.org.objectweb.asm.Opcodes.ISTORE;
+import static jdk.internal.org.objectweb.asm.Opcodes.POP;
+import static jdk.internal.org.objectweb.asm.Opcodes.RETURN;
+
 public class TestOSRWithNonEmptyStack extends ClassLoader {
     private static final int CLASS_FILE_VERSION = 52;
     private static final String CLASS_NAME = "TestCase";
diff --git a/hotspot/test/compiler/osr/TestRangeCheck.java b/hotspot/test/compiler/osr/TestRangeCheck.java
index 6079cb9..829a07d 100644
--- a/hotspot/test/compiler/osr/TestRangeCheck.java
+++ b/hotspot/test/compiler/osr/TestRangeCheck.java
@@ -25,8 +25,11 @@
  * @test TestRangeCheck
  * @bug 8054883
  * @summary Tests that range check is not skipped
+ * @run main compiler.osr.TestRangeCheck
  */
 
+package compiler.osr;
+
 public class TestRangeCheck {
     public static void main(String args[]) {
         try {
diff --git a/hotspot/test/compiler/print/PrintInlining.java b/hotspot/test/compiler/print/PrintInlining.java
index 6aa9033..deb1ae0 100644
--- a/hotspot/test/compiler/print/PrintInlining.java
+++ b/hotspot/test/compiler/print/PrintInlining.java
@@ -25,12 +25,15 @@
  * @test
  * @bug 8022585
  * @summary VM crashes when ran with -XX:+PrintInlining
- * @run main/othervm -Xcomp -XX:+UnlockDiagnosticVMOptions -XX:+PrintInlining PrintInlining
+ * @run main/othervm -Xcomp -XX:+UnlockDiagnosticVMOptions -XX:+PrintInlining
+ *                   compiler.print.PrintInlining
  *
  */
 
+package compiler.print;
+
 public class PrintInlining {
-  public static void main(String[] args) {
-    System.out.println("Passed");
-  }
+    public static void main(String[] args) {
+        System.out.println("Passed");
+    }
 }
diff --git a/hotspot/test/compiler/print/TestProfileReturnTypePrinting.java b/hotspot/test/compiler/print/TestProfileReturnTypePrinting.java
index ca57139..a09d9d3 100644
--- a/hotspot/test/compiler/print/TestProfileReturnTypePrinting.java
+++ b/hotspot/test/compiler/print/TestProfileReturnTypePrinting.java
@@ -24,14 +24,17 @@
 /**
  * @test
  * @bug 8073154
- * @build TestProfileReturnTypePrinting
+ * @build compiler.print.TestProfileReturnTypePrinting
  * @run main/othervm -XX:TypeProfileLevel=020
- *                   -XX:CompileOnly=TestProfileReturnTypePrinting.testMethod
+ *                   -XX:CompileCommand=compileonly,compiler.print.TestProfileReturnTypePrinting::testMethod
  *                   -XX:+IgnoreUnrecognizedVMOptions -XX:+PrintLIR
- *                   TestProfileReturnTypePrinting
+ *                   compiler.print.TestProfileReturnTypePrinting
  * @summary Verify that c1's LIR that contains ProfileType node could be dumped
  *          without a crash disregard to an exact class knowledge.
  */
+
+package compiler.print;
+
 public class TestProfileReturnTypePrinting {
     private static final int ITERATIONS = 1_000_000;
 
diff --git a/hotspot/test/compiler/profiling/TestMethodHandleInvokesIntrinsic.java b/hotspot/test/compiler/profiling/TestMethodHandleInvokesIntrinsic.java
index d882cc3..9ca1c13 100644
--- a/hotspot/test/compiler/profiling/TestMethodHandleInvokesIntrinsic.java
+++ b/hotspot/test/compiler/profiling/TestMethodHandleInvokesIntrinsic.java
@@ -25,11 +25,18 @@
  * @test
  * @bug 8041458
  * @summary profiling of arguments in C1 at MethodHandle invoke of intrinsic tries to profile popped argument.
- * @run main/othervm -XX:-BackgroundCompilation -XX:-UseOnStackReplacement -XX:TieredStopAtLevel=3 TestMethodHandleInvokesIntrinsic
+ *
+ * @run main/othervm -XX:-BackgroundCompilation -XX:-UseOnStackReplacement
+ *                   -XX:TieredStopAtLevel=3
+ *                   compiler.profiling.TestMethodHandleInvokesIntrinsic
  *
  */
 
-import java.lang.invoke.*;
+package compiler.profiling;
+
+import java.lang.invoke.MethodHandle;
+import java.lang.invoke.MethodHandles;
+import java.lang.invoke.MethodType;
 
 public class TestMethodHandleInvokesIntrinsic {
 
diff --git a/hotspot/test/compiler/profiling/TestSpecTrapClassUnloading.java b/hotspot/test/compiler/profiling/TestSpecTrapClassUnloading.java
index ae70098..acb891f 100644
--- a/hotspot/test/compiler/profiling/TestSpecTrapClassUnloading.java
+++ b/hotspot/test/compiler/profiling/TestSpecTrapClassUnloading.java
@@ -25,10 +25,18 @@
  * @test
  * @bug 8031752
  * @summary speculative traps need to be cleaned up at GC
- * @run main/othervm -XX:+IgnoreUnrecognizedVMOptions -XX:-TieredCompilation -XX:-UseOnStackReplacement -XX:-BackgroundCompilation -XX:+UseTypeSpeculation -XX:TypeProfileLevel=222 -XX:CompileCommand=exclude,java.lang.reflect.Method::invoke -XX:CompileCommand=exclude,sun.reflect.DelegatingMethodAccessorImpl::invoke -Xmx512M TestSpecTrapClassUnloading
  *
+ * @run main/othervm -XX:+IgnoreUnrecognizedVMOptions -XX:-TieredCompilation
+ *                   -XX:-UseOnStackReplacement -XX:-BackgroundCompilation
+ *                   -XX:+UseTypeSpeculation -XX:TypeProfileLevel=222
+ *                   -XX:CompileCommand=exclude,java.lang.reflect.Method::invoke
+ *                   -XX:CompileCommand=exclude,sun.reflect.DelegatingMethodAccessorImpl::invoke
+ *                   -Xmx512M
+ *                   compiler.profiling.TestSpecTrapClassUnloading
  */
 
+package compiler.profiling;
+
 import java.lang.reflect.Method;
 
 public class TestSpecTrapClassUnloading {
diff --git a/hotspot/test/compiler/profiling/TestUnexpectedProfilingMismatch.java b/hotspot/test/compiler/profiling/TestUnexpectedProfilingMismatch.java
index b118027..c0df67a 100644
--- a/hotspot/test/compiler/profiling/TestUnexpectedProfilingMismatch.java
+++ b/hotspot/test/compiler/profiling/TestUnexpectedProfilingMismatch.java
@@ -25,11 +25,17 @@
  * @test
  * @bug 8027631
  * @summary profiling of arguments at calls cannot rely on signature of callee for types
- * @run main/othervm -XX:-BackgroundCompilation -XX:TieredStopAtLevel=3 -XX:TypeProfileLevel=111 -XX:Tier3InvocationThreshold=200 -XX:Tier0InvokeNotifyFreqLog=7 TestUnexpectedProfilingMismatch
  *
+ * @run main/othervm -XX:-BackgroundCompilation -XX:TieredStopAtLevel=3 -XX:TypeProfileLevel=111
+ *                   -XX:Tier3InvocationThreshold=200 -XX:Tier0InvokeNotifyFreqLog=7
+ *                   compiler.profiling.TestUnexpectedProfilingMismatch
  */
 
-import java.lang.invoke.*;
+package compiler.profiling;
+
+import java.lang.invoke.MethodHandle;
+import java.lang.invoke.MethodHandles;
+import java.lang.invoke.MethodType;
 
 public class TestUnexpectedProfilingMismatch {
 
diff --git a/hotspot/test/compiler/profiling/UnsafeAccess.java b/hotspot/test/compiler/profiling/UnsafeAccess.java
index 28abc34..5118101 100644
--- a/hotspot/test/compiler/profiling/UnsafeAccess.java
+++ b/hotspot/test/compiler/profiling/UnsafeAccess.java
@@ -24,10 +24,14 @@
  * @test
  * @bug 8134918
  * @modules java.base/jdk.internal.misc
+ *
  * @run main/bootclasspath/othervm -XX:+IgnoreUnrecognizedVMOptions -XX:TypeProfileLevel=222 -XX:+UseTypeSpeculation -Xbatch
- *                                 -XX:CompileCommand=dontinline,UnsafeAccess::test*
- *                                 UnsafeAccess
+ *                                 -XX:CompileCommand=dontinline,compiler.profiling.UnsafeAccess::test*
+ *                                 compiler.profiling.UnsafeAccess
  */
+
+package compiler.profiling;
+
 import jdk.internal.misc.Unsafe;
 
 public class UnsafeAccess {
diff --git a/hotspot/test/compiler/profiling/spectrapredefineclass/Agent.java b/hotspot/test/compiler/profiling/spectrapredefineclass/Agent.java
index d6dd571..f0a30c6 100644
--- a/hotspot/test/compiler/profiling/spectrapredefineclass/Agent.java
+++ b/hotspot/test/compiler/profiling/spectrapredefineclass/Agent.java
@@ -21,12 +21,15 @@
  * questions.
  */
 
-import java.security.*;
-import java.lang.instrument.*;
-import java.lang.reflect.*;
-import java.lang.management.ManagementFactory;
+package compiler.profiling.spectrapredefineclass;
+
 import com.sun.tools.attach.VirtualMachine;
 
+import java.lang.instrument.ClassFileTransformer;
+import java.lang.instrument.Instrumentation;
+import java.lang.management.ManagementFactory;
+import java.security.ProtectionDomain;
+
 class A {
     void m() {
     }
diff --git a/hotspot/test/compiler/profiling/spectrapredefineclass/Launcher.java b/hotspot/test/compiler/profiling/spectrapredefineclass/Launcher.java
index 312734e..9559389 100644
--- a/hotspot/test/compiler/profiling/spectrapredefineclass/Launcher.java
+++ b/hotspot/test/compiler/profiling/spectrapredefineclass/Launcher.java
@@ -20,8 +20,6 @@
  * or visit www.oracle.com if you need additional information or have any
  * questions.
  */
-import java.io.PrintWriter;
-import jdk.test.lib.*;
 
 /*
  * @test
@@ -30,21 +28,34 @@
  * @modules java.base/jdk.internal.misc
  *          java.instrument
  *          java.management
- * @build Agent
- * @run main ClassFileInstaller Agent
- * @run main Launcher
- * @run main/othervm -XX:-TieredCompilation -XX:-BackgroundCompilation -XX:-UseOnStackReplacement -XX:TypeProfileLevel=222 -XX:ReservedCodeCacheSize=3M Agent
+ * @build compiler.profiling.spectrapredefineclass_classloaders.Agent
+ * @run driver ClassFileInstaller compiler.profiling.spectrapredefineclass.Agent
+ * @run driver compiler.profiling.spectrapredefineclass.Launcher
+ * @run main/othervm -XX:-TieredCompilation -XX:-BackgroundCompilation
+ *                   -XX:-UseOnStackReplacement -XX:TypeProfileLevel=222
+ *                   -XX:ReservedCodeCacheSize=3M
+ *                   compiler.profiling.spectrapredefineclass.Agent
  */
+
+package compiler.profiling.spectrapredefineclass;
+
+import jdk.test.lib.JDKToolFinder;
+
+import java.io.File;
+import java.io.PrintWriter;
+
 public class Launcher {
     public static void main(String[] args) throws Exception  {
 
       PrintWriter pw = new PrintWriter("MANIFEST.MF");
-      pw.println("Agent-Class: Agent");
+      pw.println("Agent-Class: " + Launcher.class.getPackage().getName() +".Agent");
       pw.println("Can-Retransform-Classes: true");
       pw.close();
 
       ProcessBuilder pb = new ProcessBuilder();
-      pb.command(new String[] { JDKToolFinder.getJDKTool("jar"), "cmf", "MANIFEST.MF", System.getProperty("test.classes",".") + "/agent.jar", "Agent.class"});
+      pb.command(new String[] { JDKToolFinder.getJDKTool("jar"), "cmf", "MANIFEST.MF",
+              System.getProperty("test.classes",".") + "/agent.jar",
+              "compiler/profiling/spectrapredefineclass/Agent.class".replace('/', File.separatorChar)});
       pb.start().waitFor();
     }
 }
diff --git a/hotspot/test/compiler/profiling/spectrapredefineclass_classloaders/A.java b/hotspot/test/compiler/profiling/spectrapredefineclass_classloaders/A.java
index cae091e..07b3622 100644
--- a/hotspot/test/compiler/profiling/spectrapredefineclass_classloaders/A.java
+++ b/hotspot/test/compiler/profiling/spectrapredefineclass_classloaders/A.java
@@ -1,3 +1,5 @@
+package compiler.profiling.spectrapredefineclass_classloaders;
+
 public class A {
     void m() {
     }
diff --git a/hotspot/test/compiler/profiling/spectrapredefineclass_classloaders/Agent.java b/hotspot/test/compiler/profiling/spectrapredefineclass_classloaders/Agent.java
index d03f7de..35f8523 100644
--- a/hotspot/test/compiler/profiling/spectrapredefineclass_classloaders/Agent.java
+++ b/hotspot/test/compiler/profiling/spectrapredefineclass_classloaders/Agent.java
@@ -21,16 +21,19 @@
  * questions.
  */
 
-import java.security.*;
-import java.lang.instrument.*;
-import java.lang.reflect.*;
-import java.lang.management.ManagementFactory;
+package compiler.profiling.spectrapredefineclass_classloaders;
+
 import com.sun.tools.attach.VirtualMachine;
-import java.lang.reflect.*;
+
+import java.lang.instrument.ClassFileTransformer;
+import java.lang.instrument.Instrumentation;
+import java.lang.management.ManagementFactory;
+import java.lang.reflect.Method;
 import java.net.MalformedURLException;
 import java.net.URL;
 import java.net.URLClassLoader;
 import java.nio.file.Paths;
+import java.security.ProtectionDomain;
 
 public class Agent implements ClassFileTransformer {
     public static ClassLoader newClassLoader() {
@@ -49,11 +52,12 @@
 
         // loader2 must be first on the list so loader 1 must be used first
         ClassLoader loader1 = newClassLoader();
-        Class dummy = loader1.loadClass("Test");
+        String packageName = Agent.class.getPackage().getName();
+        Class dummy = loader1.loadClass(packageName + ".Test");
 
         ClassLoader loader2 = newClassLoader();
 
-        Test_class = loader2.loadClass("Test");
+        Test_class = loader2.loadClass(packageName + ".Test");
         Method m3 = Test_class.getMethod("m3", ClassLoader.class);
         // Add speculative trap in m2() (loaded by loader1) that
         // references m4() (loaded by loader2).
diff --git a/hotspot/test/compiler/profiling/spectrapredefineclass_classloaders/B.java b/hotspot/test/compiler/profiling/spectrapredefineclass_classloaders/B.java
index 1b71f43..55a2851 100644
--- a/hotspot/test/compiler/profiling/spectrapredefineclass_classloaders/B.java
+++ b/hotspot/test/compiler/profiling/spectrapredefineclass_classloaders/B.java
@@ -1,3 +1,5 @@
+package compiler.profiling.spectrapredefineclass_classloaders;
+
 public class B extends A {
     void m() {
     }
diff --git a/hotspot/test/compiler/profiling/spectrapredefineclass_classloaders/Launcher.java b/hotspot/test/compiler/profiling/spectrapredefineclass_classloaders/Launcher.java
index 66f155d..328c5bc 100644
--- a/hotspot/test/compiler/profiling/spectrapredefineclass_classloaders/Launcher.java
+++ b/hotspot/test/compiler/profiling/spectrapredefineclass_classloaders/Launcher.java
@@ -20,8 +20,6 @@
  * or visit www.oracle.com if you need additional information or have any
  * questions.
  */
-import java.io.PrintWriter;
-import jdk.test.lib.*;
 
 /*
  * @test
@@ -30,21 +28,37 @@
  * @modules java.base/jdk.internal.misc
  *          java.instrument
  *          java.management
- * @build Agent Test A B
- * @run main ClassFileInstaller Agent
- * @run main Launcher
- * @run main/othervm -XX:-TieredCompilation -XX:-BackgroundCompilation -XX:-UseOnStackReplacement -XX:TypeProfileLevel=222 -XX:ReservedCodeCacheSize=3M Agent
+ * @build compiler.profiling.spectrapredefineclass_classloaders.Agent
+ *        compiler.profiling.spectrapredefineclass_classloaders.Test
+ *        compiler.profiling.spectrapredefineclass_classloaders.A
+ *        compiler.profiling.spectrapredefineclass_classloaders.B
+ * @run driver ClassFileInstaller compiler.profiling.spectrapredefineclass_classloaders.Agent
+ * @run driver compiler.profiling.spectrapredefineclass_classloaders.Launcher
+ * @run main/othervm -XX:-TieredCompilation -XX:-BackgroundCompilation
+ *                   -XX:-UseOnStackReplacement -XX:TypeProfileLevel=222
+ *                   -XX:ReservedCodeCacheSize=3M
+ *                   compiler.profiling.spectrapredefineclass_classloaders.Agent
  */
+package compiler.profiling.spectrapredefineclass_classloaders;
+
+import jdk.test.lib.JDKToolFinder;
+
+import java.io.File;
+import java.io.PrintWriter;
+
 public class Launcher {
-    public static void main(String[] args) throws Exception  {
+    public static void main(String[] args) throws Exception {
 
-      PrintWriter pw = new PrintWriter("MANIFEST.MF");
-      pw.println("Agent-Class: Agent");
-      pw.println("Can-Retransform-Classes: true");
-      pw.close();
+        PrintWriter pw = new PrintWriter("MANIFEST.MF");
 
-      ProcessBuilder pb = new ProcessBuilder();
-      pb.command(new String[] { JDKToolFinder.getJDKTool("jar"), "cmf", "MANIFEST.MF", System.getProperty("test.classes",".") + "/agent.jar", "Agent.class"});
-      pb.start().waitFor();
+        pw.println("Agent-Class: " + Launcher.class.getPackage().getName() + ".Agent");
+        pw.println("Can-Retransform-Classes: true");
+        pw.close();
+
+        ProcessBuilder pb = new ProcessBuilder();
+        pb.command(new String[]{JDKToolFinder.getJDKTool("jar"), "cmf", "MANIFEST.MF",
+                System.getProperty("test.classes", ".") + "/agent.jar",
+                "compiler/profiling/spectrapredefineclass/Agent.class".replace('/', File.separatorChar)});
+        pb.start().waitFor();
     }
 }
diff --git a/hotspot/test/compiler/profiling/spectrapredefineclass_classloaders/Test.java b/hotspot/test/compiler/profiling/spectrapredefineclass_classloaders/Test.java
index 189d39a..662fe00 100644
--- a/hotspot/test/compiler/profiling/spectrapredefineclass_classloaders/Test.java
+++ b/hotspot/test/compiler/profiling/spectrapredefineclass_classloaders/Test.java
@@ -1,4 +1,6 @@
-import java.lang.reflect.*;
+package compiler.profiling.spectrapredefineclass_classloaders;
+
+import java.lang.reflect.Method;
 
 public class Test {
 
@@ -19,11 +21,12 @@
     }
 
     public void m3(ClassLoader loader) throws Exception {
-        Class Test_class = loader.loadClass("Test");
+        String packageName = Test.class.getPackage().getName();
+        Class Test_class = loader.loadClass(packageName + ".Test");
         Object test = Test_class.newInstance();
-        Class A_class = loader.loadClass("A");
+        Class A_class = loader.loadClass(packageName + ".A");
         Object a = A_class.newInstance();
-        Class B_class = loader.loadClass("B");
+        Class B_class = loader.loadClass(packageName + ".B");
         Object b = B_class.newInstance();
         Method m1 = Test_class.getMethod("m1", A_class, Boolean.class);
 
diff --git a/hotspot/test/compiler/profiling/unloadingconflict/B.java b/hotspot/test/compiler/profiling/unloadingconflict/B.java
index c37eb86..7464d51 100644
--- a/hotspot/test/compiler/profiling/unloadingconflict/B.java
+++ b/hotspot/test/compiler/profiling/unloadingconflict/B.java
@@ -21,5 +21,7 @@
  * questions.
  */
 
+package compiler.profiling.unloadingconflict;
+
 public class B {
 }
diff --git a/hotspot/test/compiler/profiling/unloadingconflict/TestProfileConflictClassUnloading.java b/hotspot/test/compiler/profiling/unloadingconflict/TestProfileConflictClassUnloading.java
index c074e18..d68f5c0 100644
--- a/hotspot/test/compiler/profiling/unloadingconflict/TestProfileConflictClassUnloading.java
+++ b/hotspot/test/compiler/profiling/unloadingconflict/TestProfileConflictClassUnloading.java
@@ -24,12 +24,17 @@
 /*
  * @test
  * @bug 8027572
- * @summary class unloading resets profile, method compiled after the profile is first set and before class loading sets unknown bit with not recorded class
- * @build B
- * @run main/othervm -XX:TypeProfileLevel=222 -XX:-BackgroundCompilation TestProfileConflictClassUnloading
+ * @summary class unloading resets profile, method compiled after the profile is
+ * first set and before class loading sets unknown bit with not recorded class
+ * @library /
+ * @build compiler.profiling.unloadingconflict.B
+ * @run main/othervm -XX:TypeProfileLevel=222 -XX:-BackgroundCompilation
+ *                   compiler.profiling.unloadingconflict.TestProfileConflictClassUnloading
  *
  */
 
+package compiler.profiling.unloadingconflict;
+
 import java.net.MalformedURLException;
 import java.net.URL;
 import java.net.URLClassLoader;
@@ -66,7 +71,7 @@
 
     public static void main(String[] args) throws Exception {
         ClassLoader loader = newClassLoader();
-        Object o = loader.loadClass("B").newInstance();
+        Object o = loader.loadClass("compiler.profiling.unloadingconflict.B").newInstance();
         // collect conflicting profiles
         for (int i = 0; i < 5000; i++) {
             m2(o);
diff --git a/hotspot/test/compiler/rangechecks/PowerOf2SizedArraysChecks.java b/hotspot/test/compiler/rangechecks/PowerOf2SizedArraysChecks.java
index dad068d..531a075 100644
--- a/hotspot/test/compiler/rangechecks/PowerOf2SizedArraysChecks.java
+++ b/hotspot/test/compiler/rangechecks/PowerOf2SizedArraysChecks.java
@@ -26,11 +26,16 @@
  * @test
  * @bug 8003585
  * @summary strength reduce or eliminate range checks for power-of-two sized arrays
- * @run main/othervm -XX:CompileCommand=compileonly,PowerOf2SizedArraysChecks::test* -XX:-BackgroundCompilation PowerOf2SizedArraysChecks
  *
+ * @run main/othervm -XX:CompileCommand=compileonly,compiler.rangechecks.PowerOf2SizedArraysChecks::test*
+ *                   -XX:-BackgroundCompilation
+ *                   compiler.rangechecks.PowerOf2SizedArraysChecks
  */
 
-import java.util.function.*;
+package compiler.rangechecks;
+
+import java.util.function.BiFunction;
+import java.util.function.Function;
 
 public class PowerOf2SizedArraysChecks {
 
diff --git a/hotspot/test/compiler/rangechecks/TestBadFoldCompare.java b/hotspot/test/compiler/rangechecks/TestBadFoldCompare.java
index 74e53a0..4f15bf9 100644
--- a/hotspot/test/compiler/rangechecks/TestBadFoldCompare.java
+++ b/hotspot/test/compiler/rangechecks/TestBadFoldCompare.java
@@ -26,9 +26,13 @@
  * @bug 8085832
  * @bug 8135069
  * @summary x <= 0 || x > 0 wrongly folded as (x-1) >u -1 and x < 0 || x > -1 wrongly folded as x >u -1
- * @run main/othervm -XX:-BackgroundCompilation -XX:-UseOnStackReplacement TestBadFoldCompare
+ *
+ * @run main/othervm -XX:-BackgroundCompilation -XX:-UseOnStackReplacement
+ *                   compiler.rangechecks.TestBadFoldCompare
  */
 
+package compiler.rangechecks;
+
 public class TestBadFoldCompare {
 
     static boolean test1_taken;
diff --git a/hotspot/test/compiler/rangechecks/TestExplicitRangeChecks.java b/hotspot/test/compiler/rangechecks/TestExplicitRangeChecks.java
index a023d5a..d712535 100644
--- a/hotspot/test/compiler/rangechecks/TestExplicitRangeChecks.java
+++ b/hotspot/test/compiler/rangechecks/TestExplicitRangeChecks.java
@@ -25,24 +25,31 @@
  * @test
  * @bug 8073480
  * @summary explicit range checks should be recognized by C2
- * @modules java.base/jdk.internal.misc
  * @library /testlibrary /test/lib /
- * @build TestExplicitRangeChecks
+ * @modules java.base/jdk.internal.misc
+ * @build compiler.rangechecks.TestExplicitRangeChecks
  * @run driver ClassFileInstaller sun.hotspot.WhiteBox
  *                                jdk.test.lib.Platform
  * @run main/othervm -ea -Xmixed -Xbootclasspath/a:. -XX:+UnlockDiagnosticVMOptions -XX:+WhiteBoxAPI
- *                   -XX:-BackgroundCompilation -XX:-UseOnStackReplacement -XX:CompileCommand=compileonly,TestExplicitRangeChecks.test* TestExplicitRangeChecks
+ *                   -XX:-BackgroundCompilation -XX:-UseOnStackReplacement
+ *                   -XX:CompileCommand=compileonly,compiler.rangechecks.TestExplicitRangeChecks::test*
+ *                   compiler.rangechecks.TestExplicitRangeChecks
  *
  */
 
-import java.lang.annotation.*;
-import java.lang.reflect.*;
-import java.util.*;
-import sun.hotspot.WhiteBox;
-import sun.hotspot.code.NMethod;
-import jdk.test.lib.Platform;
-import jdk.internal.misc.Unsafe;
+package compiler.rangechecks;
+
 import compiler.whitebox.CompilerWhiteBoxTest;
+import jdk.internal.misc.Unsafe;
+import jdk.test.lib.Platform;
+import sun.hotspot.WhiteBox;
+
+import java.lang.annotation.Retention;
+import java.lang.annotation.RetentionPolicy;
+import java.lang.reflect.Field;
+import java.lang.reflect.Method;
+import java.lang.reflect.Modifier;
+import java.util.HashMap;
 
 public class TestExplicitRangeChecks {
     private static final WhiteBox WHITE_BOX = WhiteBox.getWhiteBox();
diff --git a/hotspot/test/compiler/rangechecks/TestRangeCheckEliminationDisabled.java b/hotspot/test/compiler/rangechecks/TestRangeCheckEliminationDisabled.java
index 288af4d..d5b3be7 100644
--- a/hotspot/test/compiler/rangechecks/TestRangeCheckEliminationDisabled.java
+++ b/hotspot/test/compiler/rangechecks/TestRangeCheckEliminationDisabled.java
@@ -26,8 +26,13 @@
  * @test TestRangeCheckEliminationDisabled
  * @bug 8154763
  * @summary Tests PostLoopMultiversioning with RangeCheckElimination disabled.
- * @run main/othervm -XX:+IgnoreUnrecognizedVMOptions -XX:+PostLoopMultiversioning -XX:-RangeCheckElimination TestRangeCheckEliminationDisabled
+ * @run main/othervm -XX:+IgnoreUnrecognizedVMOptions -XX:+UnlockDiagnosticVMOptions
+ *                   -XX:+PostLoopMultiversioning -XX:-RangeCheckElimination
+ *                   compiler.rangechecks.TestRangeCheckEliminationDisabled
  */
+
+package compiler.rangechecks;
+
 public class TestRangeCheckEliminationDisabled {
 
     public static void main(String[] args) {
diff --git a/hotspot/test/compiler/rangechecks/TestRangeCheckExceptionHandlerLoop.jasm b/hotspot/test/compiler/rangechecks/TestRangeCheckExceptionHandlerLoop.jasm
index 2befe6d..30eed33 100644
--- a/hotspot/test/compiler/rangechecks/TestRangeCheckExceptionHandlerLoop.jasm
+++ b/hotspot/test/compiler/rangechecks/TestRangeCheckExceptionHandlerLoop.jasm
@@ -22,7 +22,7 @@
  *
  */
 
-super public class TestRangeCheckExceptionHandlerLoop
+super public class compiler/rangechecks/TestRangeCheckExceptionHandlerLoop
 	version 51:0
 {
 
diff --git a/hotspot/test/compiler/rangechecks/TestRangeCheckExceptionHandlerLoopMain.java b/hotspot/test/compiler/rangechecks/TestRangeCheckExceptionHandlerLoopMain.java
index 3eac323..fe2636d 100644
--- a/hotspot/test/compiler/rangechecks/TestRangeCheckExceptionHandlerLoopMain.java
+++ b/hotspot/test/compiler/rangechecks/TestRangeCheckExceptionHandlerLoopMain.java
@@ -26,10 +26,14 @@
  * @test
  * @bug 8134883
  * @summary C1's range check elimination breaks with a non-natural loop that an exception handler as one entry
+ *
  * @compile TestRangeCheckExceptionHandlerLoop.jasm
- * @run main/othervm -XX:-BackgroundCompilation -XX:-UseOnStackReplacement TestRangeCheckExceptionHandlerLoopMain
+ * @run main/othervm -XX:-BackgroundCompilation -XX:-UseOnStackReplacement
+ *                  compiler.rangechecks.TestRangeCheckExceptionHandlerLoopMain
  */
 
+package compiler.rangechecks;
+
 public class TestRangeCheckExceptionHandlerLoopMain {
     public static void main(String[] args) throws Exception {
         Exception exception = new Exception();
diff --git a/hotspot/test/compiler/rangechecks/TestRangeCheckSmearing.java b/hotspot/test/compiler/rangechecks/TestRangeCheckSmearing.java
index 0ed34a4..17c4327 100644
--- a/hotspot/test/compiler/rangechecks/TestRangeCheckSmearing.java
+++ b/hotspot/test/compiler/rangechecks/TestRangeCheckSmearing.java
@@ -28,22 +28,28 @@
  * @library /testlibrary /test/lib /
  * @modules java.base/jdk.internal.misc
  *          java.management
- * @ignore 8157984
- * @build TestRangeCheckSmearing
+ * @build compiler.rangechecks.TestRangeCheckSmearing
  * @run driver ClassFileInstaller sun.hotspot.WhiteBox
  *                                jdk.test.lib.Platform
  * @run main/othervm -ea -Xmixed -Xbootclasspath/a:. -XX:+UnlockDiagnosticVMOptions -XX:+WhiteBoxAPI
- *                   -XX:-BackgroundCompilation -XX:-UseOnStackReplacement TestRangeCheckSmearing
+ *                   -XX:-BackgroundCompilation -XX:-UseOnStackReplacement
+ *                   compiler.rangechecks.TestRangeCheckSmearing
  *
  */
 
-import java.lang.annotation.*;
-import java.lang.reflect.*;
-import java.util.*;
-import sun.hotspot.WhiteBox;
-import sun.hotspot.code.NMethod;
-import jdk.test.lib.Platform;
+package compiler.rangechecks;
+
 import compiler.whitebox.CompilerWhiteBoxTest;
+import compiler.testlibrary.CompilerUtils;
+import jdk.test.lib.Platform;
+import sun.hotspot.WhiteBox;
+
+import java.lang.annotation.Retention;
+import java.lang.annotation.RetentionPolicy;
+import java.lang.reflect.Method;
+import java.lang.reflect.Modifier;
+import java.util.Arrays;
+import java.util.HashMap;
 
 public class TestRangeCheckSmearing {
     private static final WhiteBox WHITE_BOX = WhiteBox.getWhiteBox();
@@ -396,7 +402,7 @@
             System.out.println("ArrayIndexOutOfBoundsException was not thrown in "+name);
         }
 
-        if (Platform.isServer()) {
+        if (CompilerUtils.getMaxCompilationLevel() == CompilerWhiteBoxTest.COMP_LEVEL_FULL_OPTIMIZATION) {
             if (exceptionRequired == WHITE_BOX.isMethodCompiled(m)) {
                 System.out.println((exceptionRequired?"Didn't deoptimized":"deoptimized") + " in "+name);
                 test_success = false;
diff --git a/hotspot/test/compiler/rangechecks/TestRangeCheckSmearingLoopOpts.java b/hotspot/test/compiler/rangechecks/TestRangeCheckSmearingLoopOpts.java
index 699754a..63f4f89 100644
--- a/hotspot/test/compiler/rangechecks/TestRangeCheckSmearingLoopOpts.java
+++ b/hotspot/test/compiler/rangechecks/TestRangeCheckSmearingLoopOpts.java
@@ -25,9 +25,13 @@
  * @test
  * @bug 8048170
  * @summary Following range check smearing, range check cannot be replaced by dominating identical test.
- * @run main/othervm -XX:-BackgroundCompilation -XX:-UseOnStackReplacement TestRangeCheckSmearingLoopOpts
  *
+ * @run main/othervm -XX:-BackgroundCompilation -XX:-UseOnStackReplacement
+ *                   compiler.rangechecks.TestRangeCheckSmearingLoopOpts
  */
+
+package compiler.rangechecks;
+
 public class TestRangeCheckSmearingLoopOpts {
 
     static int dummy;
diff --git a/hotspot/test/compiler/rangechecks/TestUncommonTrapMerging.java b/hotspot/test/compiler/rangechecks/TestUncommonTrapMerging.java
index bbdda63..b6ae41e 100644
--- a/hotspot/test/compiler/rangechecks/TestUncommonTrapMerging.java
+++ b/hotspot/test/compiler/rangechecks/TestUncommonTrapMerging.java
@@ -25,9 +25,16 @@
  * @test
  * @bug 8140574
  * @summary Verify proper re-execution of checks after merging of uncommon traps
- * @run main/othervm -Xcomp -XX:-TieredCompilation -XX:CompileCommand=compileonly,TestUncommonTrapMerging::test* TestUncommonTrapMerging Test1
- * @run main/othervm -XX:CompileCommand=compileonly,TestUncommonTrapMerging::test* TestUncommonTrapMerging Test2
+ *
+ * @run main/othervm -Xcomp -XX:-TieredCompilation
+ *                   -XX:CompileCommand=compileonly,compiler.rangechecks.TestUncommonTrapMerging::test*
+ *                   compiler.rangechecks.TestUncommonTrapMerging Test1
+ * @run main/othervm -XX:CompileCommand=compileonly,compiler.rangechecks.TestUncommonTrapMerging::test*
+ *                   compiler.rangechecks.TestUncommonTrapMerging Test2
  */
+
+package compiler.rangechecks;
+
 public class TestUncommonTrapMerging {
 
     public static void main(String[] args) throws Throwable {
diff --git a/hotspot/test/compiler/reflection/ArrayNewInstanceOfVoid.java b/hotspot/test/compiler/reflection/ArrayNewInstanceOfVoid.java
index 6f8a273..928749e 100644
--- a/hotspot/test/compiler/reflection/ArrayNewInstanceOfVoid.java
+++ b/hotspot/test/compiler/reflection/ArrayNewInstanceOfVoid.java
@@ -25,8 +25,12 @@
  * @test
  * @bug 8029366
  * @summary ShouldNotReachHere error when creating an array with component type of void
+ *
+ * @run main compiler.reflection.ArrayNewInstanceOfVoid
  */
 
+package compiler.reflection;
+
 public class ArrayNewInstanceOfVoid {
     public static void main(String[] args) {
         for (int i = 0; i < 100_000; i++) {
diff --git a/hotspot/test/compiler/regalloc/C1ObjectSpillInLogicOp.java b/hotspot/test/compiler/regalloc/C1ObjectSpillInLogicOp.java
index cf7b65b..82316a8 100644
--- a/hotspot/test/compiler/regalloc/C1ObjectSpillInLogicOp.java
+++ b/hotspot/test/compiler/regalloc/C1ObjectSpillInLogicOp.java
@@ -24,24 +24,28 @@
 /*
  * @test
  * @bug 8027751
- * @requires vm.gc.G1
  * @summary C1 crashes generating G1 post-barrier in Unsafe.getAndSetObject() intrinsic because of the new value spill
- * @run main/othervm -XX:+UseG1GC C1ObjectSpillInLogicOp
+ * @requires vm.gc.G1
  *
+ * @run main/othervm -XX:+UseG1GC compiler.regalloc.C1ObjectSpillInLogicOp
+ */
+
+package compiler.regalloc;
+
+import java.util.concurrent.atomic.AtomicReferenceArray;
+
+/*
  * G1 barriers use logical operators (xor) on T_OBJECT mixed with T_LONG or T_INT.
  * The current implementation of logical operations on x86 in C1 doesn't allow for long operands to be on stack.
  * There is a special code in the register allocator that forces long arguments in registers on x86. However T_OBJECT
  * can be spilled just fine, and in that case the xor emission will fail.
  */
-
-import java.util.concurrent.atomic.*;
-
 public class C1ObjectSpillInLogicOp {
-  public static void main(String[] args) {
-    AtomicReferenceArray<Integer> x = new AtomicReferenceArray(128);
-    Integer y = new Integer(0);
-    for (int i = 0; i < 50000; i++) {
-      x.getAndSet(i % x.length(), y);
+    public static void main(String[] args) {
+        AtomicReferenceArray<Integer> x = new AtomicReferenceArray(128);
+        Integer y = new Integer(0);
+        for (int i = 0; i < 50000; i++) {
+            x.getAndSet(i % x.length(), y);
+        }
     }
-  }
 }
diff --git a/hotspot/test/compiler/regalloc/TestVectorRegAlloc.java b/hotspot/test/compiler/regalloc/TestVectorRegAlloc.java
index 0e95544..c737e39 100644
--- a/hotspot/test/compiler/regalloc/TestVectorRegAlloc.java
+++ b/hotspot/test/compiler/regalloc/TestVectorRegAlloc.java
@@ -25,11 +25,14 @@
 /**
  * @test
  * @bug 8131969
- * @summary assert in register allocation code when vector Phi for a loop is processed because code assumes all inputs already processed
- * @run main/othervm -Xbatch TestVectorRegAlloc
+ * @summary assert in register allocation code when vector Phi for a loop is
+ * processed because code assumes all inputs already processed
  *
+ * @run main/othervm -Xbatch compiler.regalloc.TestVectorRegAlloc
  */
 
+package compiler.regalloc;
+
 public class TestVectorRegAlloc {
 
     static int test_helper_i;
diff --git a/hotspot/test/compiler/relocations/TestPrintRelocations.java b/hotspot/test/compiler/relocations/TestPrintRelocations.java
index 2cfb038..88ed109 100644
--- a/hotspot/test/compiler/relocations/TestPrintRelocations.java
+++ b/hotspot/test/compiler/relocations/TestPrintRelocations.java
@@ -25,14 +25,19 @@
  * @test
  * @bug 8044538
  * @summary assert hit while printing relocations for jump table entries
- * @run main/othervm -XX:+IgnoreUnrecognizedVMOptions -Xcomp -XX:+PrintRelocations TestPrintRelocations
+ *
+ * @run main/othervm -XX:+IgnoreUnrecognizedVMOptions -Xcomp -XX:+PrintRelocations
+ *                   compiler.relocations.TestPrintRelocations
  */
-
 /**
  * The test compiles all methods (-Xcomp) and prints their relocation
  * entries (-XX:+PrintRelocations) to make sure the printing works.
  */
+
+package compiler.relocations;
+
 public class TestPrintRelocations {
 
-   static public void main(String[] args) { }
+    static public void main(String[] args) {
+    }
 }
diff --git a/hotspot/test/compiler/rtm/cli/RTMGenericCommandLineOptionTest.java b/hotspot/test/compiler/rtm/cli/RTMGenericCommandLineOptionTest.java
index cc2ad98..50784c5 100644
--- a/hotspot/test/compiler/rtm/cli/RTMGenericCommandLineOptionTest.java
+++ b/hotspot/test/compiler/rtm/cli/RTMGenericCommandLineOptionTest.java
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2014, 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2014, 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
@@ -22,8 +22,11 @@
  *
  */
 
-import jdk.test.lib.*;
-import jdk.test.lib.cli.*;
+package compiler.rtm.cli;
+
+import jdk.test.lib.ExitCode;
+import jdk.test.lib.Platform;
+import jdk.test.lib.cli.CommandLineOptionTest;
 
 import java.util.function.BooleanSupplier;
 
@@ -89,7 +92,7 @@
     @Override
     public void runTestCases() throws Throwable {
         if (Platform.isX86() || Platform.isX64() || Platform.isPPC()) {
-            if (Platform.isServer() && !Platform.isEmbedded()) {
+            if (Platform.isServer()) {
                 runX86SupportedVMTestCases();
             } else {
                 runX86UnsupportedVMTestCases();
diff --git a/hotspot/test/compiler/rtm/cli/RTMLockingAwareTest.java b/hotspot/test/compiler/rtm/cli/RTMLockingAwareTest.java
index 654040a..aad6397 100644
--- a/hotspot/test/compiler/rtm/cli/RTMLockingAwareTest.java
+++ b/hotspot/test/compiler/rtm/cli/RTMLockingAwareTest.java
@@ -22,14 +22,16 @@
  *
  */
 
-import java.util.List;
-import java.util.LinkedList;
+package compiler.rtm.cli;
 
-import jdk.test.lib.ExitCode;
-import jdk.test.lib.cli.*;
-import jdk.test.lib.cli.predicate.AndPredicate;
 import compiler.testlibrary.rtm.predicate.SupportedCPU;
 import compiler.testlibrary.rtm.predicate.SupportedVM;
+import jdk.test.lib.ExitCode;
+import jdk.test.lib.cli.CommandLineOptionTest;
+import jdk.test.lib.cli.predicate.AndPredicate;
+
+import java.util.LinkedList;
+import java.util.List;
 
 /**
  * Base for all RTM-related CLI tests on options whose processing depends
diff --git a/hotspot/test/compiler/rtm/cli/TestPrintPreciseRTMLockingStatisticsBase.java b/hotspot/test/compiler/rtm/cli/TestPrintPreciseRTMLockingStatisticsBase.java
index 769b0e2..e8c9d17 100644
--- a/hotspot/test/compiler/rtm/cli/TestPrintPreciseRTMLockingStatisticsBase.java
+++ b/hotspot/test/compiler/rtm/cli/TestPrintPreciseRTMLockingStatisticsBase.java
@@ -22,8 +22,11 @@
  *
  */
 
-import jdk.test.lib.*;
-import jdk.test.lib.cli.*;
+package compiler.rtm.cli;
+
+import jdk.test.lib.ExitCode;
+import jdk.test.lib.Platform;
+import jdk.test.lib.cli.CommandLineOptionTest;
 
 import java.util.function.BooleanSupplier;
 
diff --git a/hotspot/test/compiler/rtm/cli/TestPrintPreciseRTMLockingStatisticsOptionOnSupportedConfig.java b/hotspot/test/compiler/rtm/cli/TestPrintPreciseRTMLockingStatisticsOptionOnSupportedConfig.java
index e8e9fdb..e48cfec 100644
--- a/hotspot/test/compiler/rtm/cli/TestPrintPreciseRTMLockingStatisticsOptionOnSupportedConfig.java
+++ b/hotspot/test/compiler/rtm/cli/TestPrintPreciseRTMLockingStatisticsOptionOnSupportedConfig.java
@@ -30,18 +30,21 @@
  * @library /testlibrary /test/lib /
  * @modules java.base/jdk.internal.misc
  *          java.management
- * @build TestPrintPreciseRTMLockingStatisticsOptionOnSupportedConfig
+ *
+ * @build compiler.rtm.cli.TestPrintPreciseRTMLockingStatisticsOptionOnSupportedConfig
  * @run driver ClassFileInstaller sun.hotspot.WhiteBox
  *                                sun.hotspot.WhiteBox$WhiteBoxPermission
  * @run main/othervm -Xbootclasspath/a:. -XX:+UnlockDiagnosticVMOptions
  *                   -XX:+WhiteBoxAPI
- *                   TestPrintPreciseRTMLockingStatisticsOptionOnSupportedConfig
+ *                   compiler.rtm.cli.TestPrintPreciseRTMLockingStatisticsOptionOnSupportedConfig
  */
 
-import jdk.test.lib.cli.*;
-import jdk.test.lib.cli.predicate.AndPredicate;
+package compiler.rtm.cli;
+
 import compiler.testlibrary.rtm.predicate.SupportedCPU;
 import compiler.testlibrary.rtm.predicate.SupportedVM;
+import jdk.test.lib.cli.CommandLineOptionTest;
+import jdk.test.lib.cli.predicate.AndPredicate;
 
 public class TestPrintPreciseRTMLockingStatisticsOptionOnSupportedConfig
         extends TestPrintPreciseRTMLockingStatisticsBase {
diff --git a/hotspot/test/compiler/rtm/cli/TestPrintPreciseRTMLockingStatisticsOptionOnUnsupportedConfig.java b/hotspot/test/compiler/rtm/cli/TestPrintPreciseRTMLockingStatisticsOptionOnUnsupportedConfig.java
index ec2b431..aeec526 100644
--- a/hotspot/test/compiler/rtm/cli/TestPrintPreciseRTMLockingStatisticsOptionOnUnsupportedConfig.java
+++ b/hotspot/test/compiler/rtm/cli/TestPrintPreciseRTMLockingStatisticsOptionOnUnsupportedConfig.java
@@ -30,18 +30,21 @@
  * @library /testlibrary /test/lib /
  * @modules java.base/jdk.internal.misc
  *          java.management
- * @build TestPrintPreciseRTMLockingStatisticsOptionOnUnsupportedConfig
+ *
+ * @build compiler.rtm.cli.TestPrintPreciseRTMLockingStatisticsOptionOnUnsupportedConfig
  * @run driver ClassFileInstaller sun.hotspot.WhiteBox
  *                                sun.hotspot.WhiteBox$WhiteBoxPermission
  * @run main/othervm -Xbootclasspath/a:. -XX:+UnlockDiagnosticVMOptions
  *                   -XX:+WhiteBoxAPI
- *                 TestPrintPreciseRTMLockingStatisticsOptionOnUnsupportedConfig
+ *                   compiler.rtm.cli.TestPrintPreciseRTMLockingStatisticsOptionOnUnsupportedConfig
  */
 
-import jdk.test.lib.cli.predicate.AndPredicate;
-import jdk.test.lib.cli.predicate.NotPredicate;
+package compiler.rtm.cli;
+
 import compiler.testlibrary.rtm.predicate.SupportedCPU;
 import compiler.testlibrary.rtm.predicate.SupportedVM;
+import jdk.test.lib.cli.predicate.AndPredicate;
+import jdk.test.lib.cli.predicate.NotPredicate;
 
 public class TestPrintPreciseRTMLockingStatisticsOptionOnUnsupportedConfig
         extends TestPrintPreciseRTMLockingStatisticsBase {
diff --git a/hotspot/test/compiler/rtm/cli/TestRTMAbortRatioOptionOnSupportedConfig.java b/hotspot/test/compiler/rtm/cli/TestRTMAbortRatioOptionOnSupportedConfig.java
index b1a761d..2d16a62 100644
--- a/hotspot/test/compiler/rtm/cli/TestRTMAbortRatioOptionOnSupportedConfig.java
+++ b/hotspot/test/compiler/rtm/cli/TestRTMAbortRatioOptionOnSupportedConfig.java
@@ -30,13 +30,17 @@
  * @library /testlibrary /test/lib /
  * @modules java.base/jdk.internal.misc
  *          java.management
- * @build TestRTMAbortRatioOptionOnSupportedConfig
+ *
+ * @build compiler.rtm.cli.TestRTMAbortRatioOptionOnSupportedConfig
  * @run driver ClassFileInstaller sun.hotspot.WhiteBox
  *                                sun.hotspot.WhiteBox$WhiteBoxPermission
  * @run main/othervm -Xbootclasspath/a:. -XX:+UnlockDiagnosticVMOptions
- *                   -XX:+WhiteBoxAPI TestRTMAbortRatioOptionOnSupportedConfig
+ *                   -XX:+WhiteBoxAPI
+ *                   compiler.rtm.cli.TestRTMAbortRatioOptionOnSupportedConfig
  */
 
+package compiler.rtm.cli;
+
 public class TestRTMAbortRatioOptionOnSupportedConfig
         extends RTMLockingAwareTest {
     private static final String DEFAULT_VALUE = "50";
diff --git a/hotspot/test/compiler/rtm/cli/TestRTMAbortRatioOptionOnUnsupportedConfig.java b/hotspot/test/compiler/rtm/cli/TestRTMAbortRatioOptionOnUnsupportedConfig.java
index 0104b8f..5921ae7 100644
--- a/hotspot/test/compiler/rtm/cli/TestRTMAbortRatioOptionOnUnsupportedConfig.java
+++ b/hotspot/test/compiler/rtm/cli/TestRTMAbortRatioOptionOnUnsupportedConfig.java
@@ -30,17 +30,21 @@
  * @library /testlibrary /test/lib /
  * @modules java.base/jdk.internal.misc
  *          java.management
- * @build TestRTMAbortRatioOptionOnUnsupportedConfig
+ *
+ * @build compiler.rtm.cli.TestRTMAbortRatioOptionOnUnsupportedConfig
  * @run driver ClassFileInstaller sun.hotspot.WhiteBox
  *                                sun.hotspot.WhiteBox$WhiteBoxPermission
  * @run main/othervm -Xbootclasspath/a:. -XX:+UnlockDiagnosticVMOptions
- *                   -XX:+WhiteBoxAPI TestRTMAbortRatioOptionOnUnsupportedConfig
+ *                   -XX:+WhiteBoxAPI
+ *                   compiler.rtm.cli.TestRTMAbortRatioOptionOnUnsupportedConfig
  */
 
-import jdk.test.lib.cli.predicate.AndPredicate;
-import jdk.test.lib.cli.predicate.NotPredicate;
+package compiler.rtm.cli;
+
 import compiler.testlibrary.rtm.predicate.SupportedCPU;
 import compiler.testlibrary.rtm.predicate.SupportedVM;
+import jdk.test.lib.cli.predicate.AndPredicate;
+import jdk.test.lib.cli.predicate.NotPredicate;
 
 public class TestRTMAbortRatioOptionOnUnsupportedConfig
         extends RTMGenericCommandLineOptionTest {
diff --git a/hotspot/test/compiler/rtm/cli/TestRTMAbortThresholdOption.java b/hotspot/test/compiler/rtm/cli/TestRTMAbortThresholdOption.java
index 3edec23..7444280 100644
--- a/hotspot/test/compiler/rtm/cli/TestRTMAbortThresholdOption.java
+++ b/hotspot/test/compiler/rtm/cli/TestRTMAbortThresholdOption.java
@@ -26,13 +26,16 @@
  * @test
  * @bug 8031320
  * @summary Verify processing of RTMAbortThreshold option.
- * @library /testlibrary
+ * @library /testlibrary /
  * @modules java.base/jdk.internal.misc
  *          java.management
- * @build TestRTMAbortThresholdOption
- * @run main/othervm TestRTMAbortThresholdOption
+ *
+ * @build compiler.rtm.cli.TestRTMAbortThresholdOption
+ * @run main/othervm compiler.rtm.cli.TestRTMAbortThresholdOption
  */
 
+package compiler.rtm.cli;
+
 public class TestRTMAbortThresholdOption
         extends RTMGenericCommandLineOptionTest {
     private static final String DEFAULT_VALUE = "1000";
diff --git a/hotspot/test/compiler/rtm/cli/TestRTMLockingCalculationDelayOption.java b/hotspot/test/compiler/rtm/cli/TestRTMLockingCalculationDelayOption.java
index 9a70f7c..35213b4 100644
--- a/hotspot/test/compiler/rtm/cli/TestRTMLockingCalculationDelayOption.java
+++ b/hotspot/test/compiler/rtm/cli/TestRTMLockingCalculationDelayOption.java
@@ -26,13 +26,16 @@
  * @test
  * @bug 8031320
  * @summary Verify processing of RTMLockingCalculationDelay option.
- * @library /testlibrary
+ * @library /testlibrary /
  * @modules java.base/jdk.internal.misc
  *          java.management
- * @build TestRTMLockingCalculationDelayOption
- * @run main/othervm TestRTMLockingCalculationDelayOption
+ *
+ * @build compiler.rtm.cli.TestRTMLockingCalculationDelayOption
+ * @run main/othervm compiler.rtm.cli.TestRTMLockingCalculationDelayOption
  */
 
+package compiler.rtm.cli;
+
 public class TestRTMLockingCalculationDelayOption
         extends RTMGenericCommandLineOptionTest {
     private static final String DEFAULT_VALUE = "0";
diff --git a/hotspot/test/compiler/rtm/cli/TestRTMLockingThresholdOption.java b/hotspot/test/compiler/rtm/cli/TestRTMLockingThresholdOption.java
index f9c202a..91a5bff 100644
--- a/hotspot/test/compiler/rtm/cli/TestRTMLockingThresholdOption.java
+++ b/hotspot/test/compiler/rtm/cli/TestRTMLockingThresholdOption.java
@@ -26,13 +26,16 @@
  * @test
  * @bug 8031320
  * @summary Verify processing of RTMLockingThreshold option.
- * @library /testlibrary
+ * @library /testlibrary /
  * @modules java.base/jdk.internal.misc
  *          java.management
- * @build TestRTMLockingThresholdOption
- * @run main/othervm TestRTMLockingThresholdOption
+ *
+ * @build compiler.rtm.cli.TestRTMLockingThresholdOption
+ * @run main/othervm compiler.rtm.cli.TestRTMLockingThresholdOption
  */
 
+package compiler.rtm.cli;
+
 public class TestRTMLockingThresholdOption
         extends RTMGenericCommandLineOptionTest {
     private static final String DEFAULT_VALUE = "10000";
diff --git a/hotspot/test/compiler/rtm/cli/TestRTMRetryCountOption.java b/hotspot/test/compiler/rtm/cli/TestRTMRetryCountOption.java
index baaf4a7..d77c001 100644
--- a/hotspot/test/compiler/rtm/cli/TestRTMRetryCountOption.java
+++ b/hotspot/test/compiler/rtm/cli/TestRTMRetryCountOption.java
@@ -26,13 +26,16 @@
  * @test
  * @bug 8031320
  * @summary Verify processing of RTMRetryCount option.
- * @library /testlibrary
+ * @library /testlibrary /
  * @modules java.base/jdk.internal.misc
  *          java.management
- * @build TestRTMRetryCountOption
- * @run main/othervm TestRTMRetryCountOption
+ *
+ * @build compiler.rtm.cli.TestRTMRetryCountOption
+ * @run main/othervm compiler.rtm.cli.TestRTMRetryCountOption
  */
 
+package compiler.rtm.cli;
+
 public class TestRTMRetryCountOption extends RTMGenericCommandLineOptionTest {
     private static final String DEFAULT_VALUE = "5";
 
diff --git a/hotspot/test/compiler/rtm/cli/TestRTMSpinLoopCountOption.java b/hotspot/test/compiler/rtm/cli/TestRTMSpinLoopCountOption.java
index 23d0f05..dc9ebf7 100644
--- a/hotspot/test/compiler/rtm/cli/TestRTMSpinLoopCountOption.java
+++ b/hotspot/test/compiler/rtm/cli/TestRTMSpinLoopCountOption.java
@@ -26,13 +26,16 @@
  * @test
  * @bug 8031320
  * @summary Verify processing of RTMSpinLoopCount option.
- * @library /testlibrary
+ * @library /testlibrary /
  * @modules java.base/jdk.internal.misc
  *          java.management
- * @build TestRTMSpinLoopCountOption
- * @run main/othervm TestRTMSpinLoopCountOption
+ *
+ * @build compiler.rtm.cli.TestRTMSpinLoopCountOption
+ * @run main/othervm compiler.rtm.cli.TestRTMSpinLoopCountOption
  */
 
+package compiler.rtm.cli;
+
 public class TestRTMSpinLoopCountOption
         extends RTMGenericCommandLineOptionTest {
     private static final String DEFAULT_VALUE = "100";
diff --git a/hotspot/test/compiler/rtm/cli/TestRTMTotalCountIncrRateOptionOnSupportedConfig.java b/hotspot/test/compiler/rtm/cli/TestRTMTotalCountIncrRateOptionOnSupportedConfig.java
index 1e93004..b21aac4 100644
--- a/hotspot/test/compiler/rtm/cli/TestRTMTotalCountIncrRateOptionOnSupportedConfig.java
+++ b/hotspot/test/compiler/rtm/cli/TestRTMTotalCountIncrRateOptionOnSupportedConfig.java
@@ -30,14 +30,17 @@
  * @library /testlibrary /test/lib /
  * @modules java.base/jdk.internal.misc
  *          java.management
- * @build TestRTMTotalCountIncrRateOptionOnSupportedConfig
+ *
+ * @build compiler.rtm.cli.TestRTMTotalCountIncrRateOptionOnSupportedConfig
  * @run driver ClassFileInstaller sun.hotspot.WhiteBox
  *                                sun.hotspot.WhiteBox$WhiteBoxPermission
  * @run main/othervm -Xbootclasspath/a:. -XX:+UnlockDiagnosticVMOptions
  *                   -XX:+WhiteBoxAPI
- *                   TestRTMTotalCountIncrRateOptionOnSupportedConfig
+ *                   compiler.rtm.cli.TestRTMTotalCountIncrRateOptionOnSupportedConfig
  */
 
+package compiler.rtm.cli;
+
 public class TestRTMTotalCountIncrRateOptionOnSupportedConfig
         extends RTMLockingAwareTest {
     private static final String DEFAULT_VALUE = "64";
diff --git a/hotspot/test/compiler/rtm/cli/TestRTMTotalCountIncrRateOptionOnUnsupportedConfig.java b/hotspot/test/compiler/rtm/cli/TestRTMTotalCountIncrRateOptionOnUnsupportedConfig.java
index c855876..886d0c3 100644
--- a/hotspot/test/compiler/rtm/cli/TestRTMTotalCountIncrRateOptionOnUnsupportedConfig.java
+++ b/hotspot/test/compiler/rtm/cli/TestRTMTotalCountIncrRateOptionOnUnsupportedConfig.java
@@ -22,11 +22,6 @@
  *
  */
 
-import jdk.test.lib.cli.predicate.AndPredicate;
-import jdk.test.lib.cli.predicate.NotPredicate;
-import compiler.testlibrary.rtm.predicate.SupportedCPU;
-import compiler.testlibrary.rtm.predicate.SupportedVM;
-
 /**
  * @test
  * @bug 8031320
@@ -35,14 +30,22 @@
  * @library /testlibrary /test/lib /
  * @modules java.base/jdk.internal.misc
  *          java.management
- * @build TestRTMTotalCountIncrRateOptionOnUnsupportedConfig
+ *
+ * @build compiler.rtm.cli.TestRTMTotalCountIncrRateOptionOnUnsupportedConfig
  * @run driver ClassFileInstaller sun.hotspot.WhiteBox
  *                                sun.hotspot.WhiteBox$WhiteBoxPermission
  * @run main/othervm -Xbootclasspath/a:. -XX:+UnlockDiagnosticVMOptions
  *                   -XX:+WhiteBoxAPI
- *                   TestRTMTotalCountIncrRateOptionOnUnsupportedConfig
+ *                   compiler.rtm.cli.TestRTMTotalCountIncrRateOptionOnUnsupportedConfig
  */
 
+package compiler.rtm.cli;
+
+import compiler.testlibrary.rtm.predicate.SupportedCPU;
+import compiler.testlibrary.rtm.predicate.SupportedVM;
+import jdk.test.lib.cli.predicate.AndPredicate;
+import jdk.test.lib.cli.predicate.NotPredicate;
+
 public class TestRTMTotalCountIncrRateOptionOnUnsupportedConfig
         extends RTMGenericCommandLineOptionTest {
     private static final String DEFAULT_VALUE = "64";
diff --git a/hotspot/test/compiler/rtm/cli/TestUseRTMDeoptOptionOnSupportedConfig.java b/hotspot/test/compiler/rtm/cli/TestUseRTMDeoptOptionOnSupportedConfig.java
index 5ac9c26..001a826 100644
--- a/hotspot/test/compiler/rtm/cli/TestUseRTMDeoptOptionOnSupportedConfig.java
+++ b/hotspot/test/compiler/rtm/cli/TestUseRTMDeoptOptionOnSupportedConfig.java
@@ -30,18 +30,22 @@
  * @library /testlibrary /test/lib /
  * @modules java.base/jdk.internal.misc
  *          java.management
- * @build TestUseRTMDeoptOptionOnSupportedConfig
+ *
+ * @build compiler.rtm.cli.TestUseRTMDeoptOptionOnSupportedConfig
  * @run driver ClassFileInstaller sun.hotspot.WhiteBox
  *                                sun.hotspot.WhiteBox$WhiteBoxPermission
  * @run main/othervm -Xbootclasspath/a:. -XX:+UnlockDiagnosticVMOptions
- *                   -XX:+WhiteBoxAPI TestUseRTMDeoptOptionOnSupportedConfig
+ *                   -XX:+WhiteBoxAPI
+ *                   compiler.rtm.cli.TestUseRTMDeoptOptionOnSupportedConfig
  */
 
+package compiler.rtm.cli;
+
+import compiler.testlibrary.rtm.predicate.SupportedCPU;
+import compiler.testlibrary.rtm.predicate.SupportedVM;
 import jdk.test.lib.ExitCode;
 import jdk.test.lib.cli.CommandLineOptionTest;
 import jdk.test.lib.cli.predicate.AndPredicate;
-import compiler.testlibrary.rtm.predicate.SupportedCPU;
-import compiler.testlibrary.rtm.predicate.SupportedVM;
 
 public class TestUseRTMDeoptOptionOnSupportedConfig
         extends CommandLineOptionTest {
diff --git a/hotspot/test/compiler/rtm/cli/TestUseRTMDeoptOptionOnUnsupportedConfig.java b/hotspot/test/compiler/rtm/cli/TestUseRTMDeoptOptionOnUnsupportedConfig.java
index fd6ef44..385a7c7 100644
--- a/hotspot/test/compiler/rtm/cli/TestUseRTMDeoptOptionOnUnsupportedConfig.java
+++ b/hotspot/test/compiler/rtm/cli/TestUseRTMDeoptOptionOnUnsupportedConfig.java
@@ -30,19 +30,22 @@
  * @library /testlibrary /test/lib /
  * @modules java.base/jdk.internal.misc
  *          java.management
- * @build TestUseRTMDeoptOptionOnUnsupportedConfig
+ *
+ * @build compiler.rtm.cli.TestUseRTMDeoptOptionOnUnsupportedConfig
  * @run driver ClassFileInstaller sun.hotspot.WhiteBox
  *                                sun.hotspot.WhiteBox$WhiteBoxPermission
  * @run main/othervm -Xbootclasspath/a:. -XX:+UnlockDiagnosticVMOptions
- *                   -XX:+WhiteBoxAPI TestUseRTMDeoptOptionOnUnsupportedConfig
+ *                   -XX:+WhiteBoxAPI
+ *                   compiler.rtm.cli.TestUseRTMDeoptOptionOnUnsupportedConfig
  */
 
-import jdk.test.lib.cli.CommandLineOptionTest;
+package compiler.rtm.cli;
 
-import jdk.test.lib.cli.predicate.AndPredicate;
-import jdk.test.lib.cli.predicate.NotPredicate;
 import compiler.testlibrary.rtm.predicate.SupportedCPU;
 import compiler.testlibrary.rtm.predicate.SupportedVM;
+import jdk.test.lib.cli.CommandLineOptionTest;
+import jdk.test.lib.cli.predicate.AndPredicate;
+import jdk.test.lib.cli.predicate.NotPredicate;
 
 public class TestUseRTMDeoptOptionOnUnsupportedConfig
         extends RTMGenericCommandLineOptionTest {
diff --git a/hotspot/test/compiler/rtm/cli/TestUseRTMForStackLocksOptionOnSupportedConfig.java b/hotspot/test/compiler/rtm/cli/TestUseRTMForStackLocksOptionOnSupportedConfig.java
index 49c9ebd..532e68d 100644
--- a/hotspot/test/compiler/rtm/cli/TestUseRTMForStackLocksOptionOnSupportedConfig.java
+++ b/hotspot/test/compiler/rtm/cli/TestUseRTMForStackLocksOptionOnSupportedConfig.java
@@ -30,19 +30,22 @@
  * @library /testlibrary /test/lib /
  * @modules java.base/jdk.internal.misc
  *          java.management
- * @build TestUseRTMForStackLocksOptionOnSupportedConfig
+ *
+ * @build compiler.rtm.cli.TestUseRTMForStackLocksOptionOnSupportedConfig
  * @run driver ClassFileInstaller sun.hotspot.WhiteBox
  *                                sun.hotspot.WhiteBox$WhiteBoxPermission
  * @run main/othervm -Xbootclasspath/a:. -XX:+UnlockDiagnosticVMOptions
  *                   -XX:+WhiteBoxAPI
- *                   TestUseRTMForStackLocksOptionOnSupportedConfig
+ *                   compiler.rtm.cli.TestUseRTMForStackLocksOptionOnSupportedConfig
  */
 
-import jdk.test.lib.*;
-import jdk.test.lib.cli.*;
-import jdk.test.lib.cli.predicate.AndPredicate;
+package compiler.rtm.cli;
+
 import compiler.testlibrary.rtm.predicate.SupportedCPU;
 import compiler.testlibrary.rtm.predicate.SupportedVM;
+import jdk.test.lib.ExitCode;
+import jdk.test.lib.cli.CommandLineOptionTest;
+import jdk.test.lib.cli.predicate.AndPredicate;
 
 public class TestUseRTMForStackLocksOptionOnSupportedConfig
         extends CommandLineOptionTest {
diff --git a/hotspot/test/compiler/rtm/cli/TestUseRTMForStackLocksOptionOnUnsupportedConfig.java b/hotspot/test/compiler/rtm/cli/TestUseRTMForStackLocksOptionOnUnsupportedConfig.java
index ea1555a..563fec1 100644
--- a/hotspot/test/compiler/rtm/cli/TestUseRTMForStackLocksOptionOnUnsupportedConfig.java
+++ b/hotspot/test/compiler/rtm/cli/TestUseRTMForStackLocksOptionOnUnsupportedConfig.java
@@ -30,20 +30,23 @@
  * @library /testlibrary /test/lib /
  * @modules java.base/jdk.internal.misc
  *          java.management
- * @build TestUseRTMForStackLocksOptionOnUnsupportedConfig
+ *
+ * @build compiler.rtm.cli.TestUseRTMForStackLocksOptionOnUnsupportedConfig
  * @run driver ClassFileInstaller sun.hotspot.WhiteBox
  *                                sun.hotspot.WhiteBox$WhiteBoxPermission
  * @run main/othervm -Xbootclasspath/a:. -XX:+UnlockDiagnosticVMOptions
  *                   -XX:+WhiteBoxAPI
- *                    TestUseRTMForStackLocksOptionOnUnsupportedConfig
+ *                   compiler.rtm.cli.TestUseRTMForStackLocksOptionOnUnsupportedConfig
  */
 
+package compiler.rtm.cli;
+
+import compiler.testlibrary.rtm.predicate.SupportedCPU;
+import compiler.testlibrary.rtm.predicate.SupportedVM;
 import jdk.test.lib.ExitCode;
 import jdk.test.lib.cli.CommandLineOptionTest;
 import jdk.test.lib.cli.predicate.AndPredicate;
 import jdk.test.lib.cli.predicate.NotPredicate;
-import compiler.testlibrary.rtm.predicate.SupportedCPU;
-import compiler.testlibrary.rtm.predicate.SupportedVM;
 
 public class TestUseRTMForStackLocksOptionOnUnsupportedConfig
         extends RTMGenericCommandLineOptionTest {
diff --git a/hotspot/test/compiler/rtm/cli/TestUseRTMLockingOptionOnSupportedConfig.java b/hotspot/test/compiler/rtm/cli/TestUseRTMLockingOptionOnSupportedConfig.java
index ed8e386..b82badc 100644
--- a/hotspot/test/compiler/rtm/cli/TestUseRTMLockingOptionOnSupportedConfig.java
+++ b/hotspot/test/compiler/rtm/cli/TestUseRTMLockingOptionOnSupportedConfig.java
@@ -30,18 +30,22 @@
  * @library /testlibrary /test/lib /
  * @modules java.base/jdk.internal.misc
  *          java.management
- * @build TestUseRTMLockingOptionOnSupportedConfig
+ *
+ * @build compiler.rtm.cli.TestUseRTMLockingOptionOnSupportedConfig
  * @run driver ClassFileInstaller sun.hotspot.WhiteBox
  *                                sun.hotspot.WhiteBox$WhiteBoxPermission
  * @run main/othervm -Xbootclasspath/a:. -XX:+UnlockDiagnosticVMOptions
- *                   -XX:+WhiteBoxAPI TestUseRTMLockingOptionOnSupportedConfig
+ *                   -XX:+WhiteBoxAPI
+ *                   compiler.rtm.cli.TestUseRTMLockingOptionOnSupportedConfig
  */
 
-import jdk.test.lib.ExitCode;
-import jdk.test.lib.cli.*;
-import jdk.test.lib.cli.predicate.AndPredicate;
+package compiler.rtm.cli;
+
 import compiler.testlibrary.rtm.predicate.SupportedCPU;
 import compiler.testlibrary.rtm.predicate.SupportedVM;
+import jdk.test.lib.ExitCode;
+import jdk.test.lib.cli.CommandLineOptionTest;
+import jdk.test.lib.cli.predicate.AndPredicate;
 
 public class TestUseRTMLockingOptionOnSupportedConfig
         extends CommandLineOptionTest {
diff --git a/hotspot/test/compiler/rtm/cli/TestUseRTMLockingOptionOnUnsupportedCPU.java b/hotspot/test/compiler/rtm/cli/TestUseRTMLockingOptionOnUnsupportedCPU.java
index e5d2406..25e173e 100644
--- a/hotspot/test/compiler/rtm/cli/TestUseRTMLockingOptionOnUnsupportedCPU.java
+++ b/hotspot/test/compiler/rtm/cli/TestUseRTMLockingOptionOnUnsupportedCPU.java
@@ -30,19 +30,24 @@
  * @library /testlibrary /test/lib /
  * @modules java.base/jdk.internal.misc
  *          java.management
- * @build TestUseRTMLockingOptionOnUnsupportedCPU
+ *
+ * @build compiler.rtm.cli.TestUseRTMLockingOptionOnUnsupportedCPU
  * @run driver ClassFileInstaller sun.hotspot.WhiteBox
  *                                sun.hotspot.WhiteBox$WhiteBoxPermission
  * @run main/othervm -Xbootclasspath/a:. -XX:+UnlockDiagnosticVMOptions
- *                   -XX:+WhiteBoxAPI TestUseRTMLockingOptionOnUnsupportedCPU
+ *                   -XX:+WhiteBoxAPI
+ *                   compiler.rtm.cli.TestUseRTMLockingOptionOnUnsupportedCPU
  */
 
-import jdk.test.lib.*;
-import jdk.test.lib.cli.*;
-import jdk.test.lib.cli.predicate.AndPredicate;
-import jdk.test.lib.cli.predicate.NotPredicate;
+package compiler.rtm.cli;
+
 import compiler.testlibrary.rtm.predicate.SupportedCPU;
 import compiler.testlibrary.rtm.predicate.SupportedVM;
+import jdk.test.lib.ExitCode;
+import jdk.test.lib.Platform;
+import jdk.test.lib.cli.CommandLineOptionTest;
+import jdk.test.lib.cli.predicate.AndPredicate;
+import jdk.test.lib.cli.predicate.NotPredicate;
 
 public class TestUseRTMLockingOptionOnUnsupportedCPU
         extends CommandLineOptionTest {
diff --git a/hotspot/test/compiler/rtm/cli/TestUseRTMLockingOptionOnUnsupportedVM.java b/hotspot/test/compiler/rtm/cli/TestUseRTMLockingOptionOnUnsupportedVM.java
index 6b9c50d..f042a9d 100644
--- a/hotspot/test/compiler/rtm/cli/TestUseRTMLockingOptionOnUnsupportedVM.java
+++ b/hotspot/test/compiler/rtm/cli/TestUseRTMLockingOptionOnUnsupportedVM.java
@@ -30,19 +30,23 @@
  * @library /testlibrary /test/lib /
  * @modules java.base/jdk.internal.misc
  *          java.management
- * @build TestUseRTMLockingOptionOnUnsupportedVM
+ *
+ * @build compiler.rtm.cli.TestUseRTMLockingOptionOnUnsupportedVM
  * @run driver ClassFileInstaller sun.hotspot.WhiteBox
  *                                sun.hotspot.WhiteBox$WhiteBoxPermission
  * @run main/othervm -Xbootclasspath/a:. -XX:+UnlockDiagnosticVMOptions
- *                   -XX:+WhiteBoxAPI TestUseRTMLockingOptionOnUnsupportedVM
+ *                   -XX:+WhiteBoxAPI
+ *                   compiler.rtm.cli.TestUseRTMLockingOptionOnUnsupportedVM
  */
 
-import jdk.test.lib.ExitCode;
-import jdk.test.lib.cli.*;
-import jdk.test.lib.cli.predicate.AndPredicate;
-import jdk.test.lib.cli.predicate.NotPredicate;
+package compiler.rtm.cli;
+
 import compiler.testlibrary.rtm.predicate.SupportedCPU;
 import compiler.testlibrary.rtm.predicate.SupportedVM;
+import jdk.test.lib.ExitCode;
+import jdk.test.lib.cli.CommandLineOptionTest;
+import jdk.test.lib.cli.predicate.AndPredicate;
+import jdk.test.lib.cli.predicate.NotPredicate;
 
 public class TestUseRTMLockingOptionOnUnsupportedVM
         extends CommandLineOptionTest {
diff --git a/hotspot/test/compiler/rtm/cli/TestUseRTMLockingOptionWithBiasedLocking.java b/hotspot/test/compiler/rtm/cli/TestUseRTMLockingOptionWithBiasedLocking.java
index d43c25b..cc004bd 100644
--- a/hotspot/test/compiler/rtm/cli/TestUseRTMLockingOptionWithBiasedLocking.java
+++ b/hotspot/test/compiler/rtm/cli/TestUseRTMLockingOptionWithBiasedLocking.java
@@ -30,18 +30,22 @@
  * @library /testlibrary /test/lib /
  * @modules java.base/jdk.internal.misc
  *          java.management
- * @build TestUseRTMLockingOptionWithBiasedLocking
+ *
+ * @build compiler.rtm.cli.TestUseRTMLockingOptionWithBiasedLocking
  * @run driver ClassFileInstaller sun.hotspot.WhiteBox
  *                                sun.hotspot.WhiteBox$WhiteBoxPermission
  * @run main/othervm -Xbootclasspath/a:. -XX:+UnlockDiagnosticVMOptions
- *                   -XX:+WhiteBoxAPI TestUseRTMLockingOptionWithBiasedLocking
+ *                   -XX:+WhiteBoxAPI
+ *                   compiler.rtm.cli.TestUseRTMLockingOptionWithBiasedLocking
  */
 
-import jdk.test.lib.*;
-import jdk.test.lib.cli.*;
-import jdk.test.lib.cli.predicate.AndPredicate;
+package compiler.rtm.cli;
+
 import compiler.testlibrary.rtm.predicate.SupportedCPU;
 import compiler.testlibrary.rtm.predicate.SupportedVM;
+import jdk.test.lib.ExitCode;
+import jdk.test.lib.cli.CommandLineOptionTest;
+import jdk.test.lib.cli.predicate.AndPredicate;
 
 public class TestUseRTMLockingOptionWithBiasedLocking
         extends CommandLineOptionTest {
diff --git a/hotspot/test/compiler/rtm/cli/TestUseRTMXendForLockBusyOption.java b/hotspot/test/compiler/rtm/cli/TestUseRTMXendForLockBusyOption.java
index 9683da3..5d365b7 100644
--- a/hotspot/test/compiler/rtm/cli/TestUseRTMXendForLockBusyOption.java
+++ b/hotspot/test/compiler/rtm/cli/TestUseRTMXendForLockBusyOption.java
@@ -26,13 +26,16 @@
  * @test
  * @bug 8031320
  * @summary Verify processing of UseRTMXendForLockBusy option.
- * @library /testlibrary
+ * @library /testlibrary /
  * @modules java.base/jdk.internal.misc
  *          java.management
- * @build TestUseRTMXendForLockBusyOption
- * @run main/othervm TestUseRTMXendForLockBusyOption
+ *
+ * @build compiler.rtm.cli.TestUseRTMXendForLockBusyOption
+ * @run main/othervm compiler.rtm.cli.TestUseRTMXendForLockBusyOption
  */
 
+package compiler.rtm.cli;
+
 public class TestUseRTMXendForLockBusyOption
         extends RTMGenericCommandLineOptionTest {
     private static final String DEFAULT_VALUE = "true";
diff --git a/hotspot/test/compiler/rtm/locking/TestRTMAbortRatio.java b/hotspot/test/compiler/rtm/locking/TestRTMAbortRatio.java
index c9b6012..893fbc8 100644
--- a/hotspot/test/compiler/rtm/locking/TestRTMAbortRatio.java
+++ b/hotspot/test/compiler/rtm/locking/TestRTMAbortRatio.java
@@ -30,21 +30,30 @@
  * @library /testlibrary /test/lib /
  * @modules java.base/jdk.internal.misc
  *          java.management
- * @build TestRTMAbortRatio
+ * @build compiler.rtm.locking.TestRTMAbortRatio
  * @run driver ClassFileInstaller sun.hotspot.WhiteBox
  *                              sun.hotspot.WhiteBox$WhiteBoxPermission
  * @run main/othervm -Xbootclasspath/a:. -XX:+UnlockDiagnosticVMOptions
- *                   -XX:+WhiteBoxAPI TestRTMAbortRatio
+ *                   -XX:+WhiteBoxAPI
+ *                   compiler.rtm.locking.TestRTMAbortRatio
  */
 
-import java.util.List;
-import jdk.test.lib.*;
-import jdk.test.lib.cli.CommandLineOptionTest;
-import jdk.test.lib.cli.predicate.AndPredicate;
-import compiler.testlibrary.rtm.*;
+package compiler.rtm.locking;
+
+import compiler.testlibrary.rtm.AbortProvoker;
+import compiler.testlibrary.rtm.CompilableTest;
+import compiler.testlibrary.rtm.RTMLockingStatistics;
+import compiler.testlibrary.rtm.RTMTestBase;
 import compiler.testlibrary.rtm.predicate.SupportedCPU;
 import compiler.testlibrary.rtm.predicate.SupportedVM;
 import jdk.internal.misc.Unsafe;
+import jdk.test.lib.Asserts;
+import jdk.test.lib.OutputAnalyzer;
+import jdk.test.lib.Utils;
+import jdk.test.lib.cli.CommandLineOptionTest;
+import jdk.test.lib.cli.predicate.AndPredicate;
+
+import java.util.List;
 
 /**
  * Test verifies that method will be deoptimized on high abort ratio
diff --git a/hotspot/test/compiler/rtm/locking/TestRTMAbortThreshold.java b/hotspot/test/compiler/rtm/locking/TestRTMAbortThreshold.java
index c3a4f39..2d8492e 100644
--- a/hotspot/test/compiler/rtm/locking/TestRTMAbortThreshold.java
+++ b/hotspot/test/compiler/rtm/locking/TestRTMAbortThreshold.java
@@ -30,20 +30,28 @@
  * @library /testlibrary /test/lib /
  * @modules java.base/jdk.internal.misc
  *          java.management
- * @build TestRTMAbortThreshold
+ * @build compiler.rtm.locking.TestRTMAbortThreshold
  * @run driver ClassFileInstaller sun.hotspot.WhiteBox
  *                              sun.hotspot.WhiteBox$WhiteBoxPermission
  * @run main/othervm -Xbootclasspath/a:. -XX:+UnlockDiagnosticVMOptions
- *                   -XX:+WhiteBoxAPI TestRTMAbortThreshold
+ *                   -XX:+WhiteBoxAPI
+ *                   compiler.rtm.locking.TestRTMAbortThreshold
  */
 
-import java.util.List;
-import jdk.test.lib.*;
-import jdk.test.lib.cli.CommandLineOptionTest;
-import jdk.test.lib.cli.predicate.AndPredicate;
-import compiler.testlibrary.rtm.*;
+package compiler.rtm.locking;
+
+import compiler.testlibrary.rtm.AbortProvoker;
+import compiler.testlibrary.rtm.AbortType;
+import compiler.testlibrary.rtm.RTMLockingStatistics;
+import compiler.testlibrary.rtm.RTMTestBase;
 import compiler.testlibrary.rtm.predicate.SupportedCPU;
 import compiler.testlibrary.rtm.predicate.SupportedVM;
+import jdk.test.lib.Asserts;
+import jdk.test.lib.OutputAnalyzer;
+import jdk.test.lib.cli.CommandLineOptionTest;
+import jdk.test.lib.cli.predicate.AndPredicate;
+
+import java.util.List;
 
 /**
  * Test verifies that on RTMAbortThreshold option actually affects how soon
diff --git a/hotspot/test/compiler/rtm/locking/TestRTMAfterNonRTMDeopt.java b/hotspot/test/compiler/rtm/locking/TestRTMAfterNonRTMDeopt.java
index cbb3da2..606ed8c 100644
--- a/hotspot/test/compiler/rtm/locking/TestRTMAfterNonRTMDeopt.java
+++ b/hotspot/test/compiler/rtm/locking/TestRTMAfterNonRTMDeopt.java
@@ -32,21 +32,30 @@
  * @library /testlibrary /test/lib /
  * @modules java.base/jdk.internal.misc
  *          java.management
- * @build TestRTMAfterNonRTMDeopt
+ * @build compiler.rtm.locking.TestRTMAfterNonRTMDeopt
  * @run driver ClassFileInstaller sun.hotspot.WhiteBox
  *                                sun.hotspot.WhiteBox$WhiteBoxPermission
  * @run main/othervm -Xbootclasspath/a:. -XX:+UnlockDiagnosticVMOptions
- *                   -XX:+WhiteBoxAPI TestRTMAfterNonRTMDeopt
+ *                   -XX:+WhiteBoxAPI
+ *                   compiler.rtm.locking.TestRTMAfterNonRTMDeopt
  */
 
-import java.util.List;
-import jdk.test.lib.*;
-import jdk.test.lib.cli.CommandLineOptionTest;
-import jdk.test.lib.cli.predicate.AndPredicate;
-import compiler.testlibrary.rtm.*;
+package compiler.rtm.locking;
+
+import compiler.testlibrary.rtm.AbortProvoker;
+import compiler.testlibrary.rtm.CompilableTest;
+import compiler.testlibrary.rtm.RTMLockingStatistics;
+import compiler.testlibrary.rtm.RTMTestBase;
 import compiler.testlibrary.rtm.predicate.SupportedCPU;
 import compiler.testlibrary.rtm.predicate.SupportedVM;
 import jdk.internal.misc.Unsafe;
+import jdk.test.lib.Asserts;
+import jdk.test.lib.OutputAnalyzer;
+import jdk.test.lib.Utils;
+import jdk.test.lib.cli.CommandLineOptionTest;
+import jdk.test.lib.cli.predicate.AndPredicate;
+
+import java.util.List;
 
 /**
  * To verify that with +UseRTMDeopt method's RTM state will be
diff --git a/hotspot/test/compiler/rtm/locking/TestRTMDeoptOnHighAbortRatio.java b/hotspot/test/compiler/rtm/locking/TestRTMDeoptOnHighAbortRatio.java
index 25e24e4..f53a32c 100644
--- a/hotspot/test/compiler/rtm/locking/TestRTMDeoptOnHighAbortRatio.java
+++ b/hotspot/test/compiler/rtm/locking/TestRTMDeoptOnHighAbortRatio.java
@@ -30,20 +30,28 @@
  * @library /testlibrary /test/lib /
  * @modules java.base/jdk.internal.misc
  *          java.management
- * @build TestRTMDeoptOnHighAbortRatio
+ * @build compiler.rtm.locking.TestRTMDeoptOnHighAbortRatio
  * @run driver ClassFileInstaller sun.hotspot.WhiteBox
  *                                sun.hotspot.WhiteBox$WhiteBoxPermission
  * @run main/othervm -Xbootclasspath/a:. -XX:+UnlockDiagnosticVMOptions
- *                   -XX:+WhiteBoxAPI TestRTMDeoptOnHighAbortRatio
+ *                   -XX:+WhiteBoxAPI
+ *                   compiler.rtm.locking.TestRTMDeoptOnHighAbortRatio
  */
 
-import java.util.List;
-import jdk.test.lib.*;
-import jdk.test.lib.cli.CommandLineOptionTest;
-import jdk.test.lib.cli.predicate.AndPredicate;
-import compiler.testlibrary.rtm.*;
+package compiler.rtm.locking;
+
+import compiler.testlibrary.rtm.AbortProvoker;
+import compiler.testlibrary.rtm.AbortType;
+import compiler.testlibrary.rtm.RTMLockingStatistics;
+import compiler.testlibrary.rtm.RTMTestBase;
 import compiler.testlibrary.rtm.predicate.SupportedCPU;
 import compiler.testlibrary.rtm.predicate.SupportedVM;
+import jdk.test.lib.Asserts;
+import jdk.test.lib.OutputAnalyzer;
+import jdk.test.lib.cli.CommandLineOptionTest;
+import jdk.test.lib.cli.predicate.AndPredicate;
+
+import java.util.List;
 
 /**
  * Test verifies that on high abort ratio method wil be deoptimized with
diff --git a/hotspot/test/compiler/rtm/locking/TestRTMDeoptOnLowAbortRatio.java b/hotspot/test/compiler/rtm/locking/TestRTMDeoptOnLowAbortRatio.java
index ded7148..567ec62 100644
--- a/hotspot/test/compiler/rtm/locking/TestRTMDeoptOnLowAbortRatio.java
+++ b/hotspot/test/compiler/rtm/locking/TestRTMDeoptOnLowAbortRatio.java
@@ -29,21 +29,30 @@
  * @library /testlibrary /test/lib /
  * @modules java.base/jdk.internal.misc
  *          java.management
- * @build TestRTMDeoptOnLowAbortRatio
+ * @build compiler.rtm.locking.TestRTMDeoptOnLowAbortRatio
  * @run driver ClassFileInstaller sun.hotspot.WhiteBox
  *                                sun.hotspot.WhiteBox$WhiteBoxPermission
  * @run main/othervm -Xbootclasspath/a:. -XX:+UnlockDiagnosticVMOptions
- *                   -XX:+WhiteBoxAPI TestRTMDeoptOnLowAbortRatio
+ *                   -XX:+WhiteBoxAPI
+ *                   compiler.rtm.locking.TestRTMDeoptOnLowAbortRatio
  */
 
-import java.util.List;
-import jdk.test.lib.*;
-import jdk.test.lib.cli.CommandLineOptionTest;
-import jdk.test.lib.cli.predicate.AndPredicate;
-import compiler.testlibrary.rtm.*;
+package compiler.rtm.locking;
+
+import compiler.testlibrary.rtm.AbortProvoker;
+import compiler.testlibrary.rtm.CompilableTest;
+import compiler.testlibrary.rtm.RTMLockingStatistics;
+import compiler.testlibrary.rtm.RTMTestBase;
 import compiler.testlibrary.rtm.predicate.SupportedCPU;
 import compiler.testlibrary.rtm.predicate.SupportedVM;
 import jdk.internal.misc.Unsafe;
+import jdk.test.lib.Asserts;
+import jdk.test.lib.OutputAnalyzer;
+import jdk.test.lib.Utils;
+import jdk.test.lib.cli.CommandLineOptionTest;
+import jdk.test.lib.cli.predicate.AndPredicate;
+
+import java.util.List;
 
 /**
  * Test verifies that low abort ratio method will be deoptimized with
diff --git a/hotspot/test/compiler/rtm/locking/TestRTMLockingCalculationDelay.java b/hotspot/test/compiler/rtm/locking/TestRTMLockingCalculationDelay.java
index 8124d41..7c6ee46 100644
--- a/hotspot/test/compiler/rtm/locking/TestRTMLockingCalculationDelay.java
+++ b/hotspot/test/compiler/rtm/locking/TestRTMLockingCalculationDelay.java
@@ -30,19 +30,25 @@
  * @library /testlibrary /test/lib /
  * @modules java.base/jdk.internal.misc
  *          java.management
- * @build TestRTMLockingCalculationDelay
+ * @build compiler.rtm.locking.TestRTMLockingCalculationDelay
  * @run driver ClassFileInstaller sun.hotspot.WhiteBox
  *                                sun.hotspot.WhiteBox$WhiteBoxPermission
  * @run main/othervm -Xbootclasspath/a:. -XX:+UnlockDiagnosticVMOptions
- *                   -XX:+WhiteBoxAPI TestRTMLockingCalculationDelay
+ *                   -XX:+WhiteBoxAPI
+ *                   compiler.rtm.locking.TestRTMLockingCalculationDelay
  */
 
-import jdk.test.lib.*;
-import jdk.test.lib.cli.CommandLineOptionTest;
-import jdk.test.lib.cli.predicate.AndPredicate;
-import compiler.testlibrary.rtm.*;
+package compiler.rtm.locking;
+
+import compiler.testlibrary.rtm.AbortProvoker;
+import compiler.testlibrary.rtm.AbortType;
+import compiler.testlibrary.rtm.RTMTestBase;
 import compiler.testlibrary.rtm.predicate.SupportedCPU;
 import compiler.testlibrary.rtm.predicate.SupportedVM;
+import jdk.test.lib.Asserts;
+import jdk.test.lib.OutputAnalyzer;
+import jdk.test.lib.cli.CommandLineOptionTest;
+import jdk.test.lib.cli.predicate.AndPredicate;
 
 /**
  * Test verifies that abort ratio calculation could be delayed using
diff --git a/hotspot/test/compiler/rtm/locking/TestRTMLockingThreshold.java b/hotspot/test/compiler/rtm/locking/TestRTMLockingThreshold.java
index 415f872..d3ce56c 100644
--- a/hotspot/test/compiler/rtm/locking/TestRTMLockingThreshold.java
+++ b/hotspot/test/compiler/rtm/locking/TestRTMLockingThreshold.java
@@ -30,21 +30,30 @@
  * @library /testlibrary /test/lib /
  * @modules java.base/jdk.internal.misc
  *          java.management
- * @build TestRTMLockingThreshold
+ * @build compiler.rtm.locking.TestRTMLockingThreshold
  * @run driver ClassFileInstaller sun.hotspot.WhiteBox
  *                                sun.hotspot.WhiteBox$WhiteBoxPermission
  * @run main/othervm -Xbootclasspath/a:. -XX:+UnlockDiagnosticVMOptions
- *                   -XX:+WhiteBoxAPI TestRTMLockingThreshold
+ *                   -XX:+WhiteBoxAPI
+ *                   compiler.rtm.locking.TestRTMLockingThreshold
  */
 
-import java.util.List;
-import jdk.test.lib.*;
-import jdk.test.lib.cli.CommandLineOptionTest;
-import jdk.test.lib.cli.predicate.AndPredicate;
-import compiler.testlibrary.rtm.*;
+package compiler.rtm.locking;
+
+import compiler.testlibrary.rtm.AbortProvoker;
+import compiler.testlibrary.rtm.CompilableTest;
+import compiler.testlibrary.rtm.RTMLockingStatistics;
+import compiler.testlibrary.rtm.RTMTestBase;
 import compiler.testlibrary.rtm.predicate.SupportedCPU;
 import compiler.testlibrary.rtm.predicate.SupportedVM;
 import jdk.internal.misc.Unsafe;
+import jdk.test.lib.Asserts;
+import jdk.test.lib.OutputAnalyzer;
+import jdk.test.lib.Utils;
+import jdk.test.lib.cli.CommandLineOptionTest;
+import jdk.test.lib.cli.predicate.AndPredicate;
+
+import java.util.List;
 
 /**
  * Test verifies that RTMLockingThreshold option actually affects how soon
diff --git a/hotspot/test/compiler/rtm/locking/TestRTMRetryCount.java b/hotspot/test/compiler/rtm/locking/TestRTMRetryCount.java
index 82c884b..2a1fc7d 100644
--- a/hotspot/test/compiler/rtm/locking/TestRTMRetryCount.java
+++ b/hotspot/test/compiler/rtm/locking/TestRTMRetryCount.java
@@ -29,21 +29,28 @@
  * @library /testlibrary /test/lib /
  * @modules java.base/jdk.internal.misc
  *          java.management
- * @build TestRTMRetryCount
+ * @build compiler.rtm.locking.TestRTMRetryCount
  * @run driver ClassFileInstaller sun.hotspot.WhiteBox
  *                                sun.hotspot.WhiteBox$WhiteBoxPermission
  * @run main/othervm -Xbootclasspath/a:. -XX:+UnlockDiagnosticVMOptions
- *                   -XX:+WhiteBoxAPI TestRTMRetryCount
+ *                   -XX:+WhiteBoxAPI
+ *                   compiler.rtm.locking.TestRTMRetryCount
  */
 
-import java.util.List;
+package compiler.rtm.locking;
 
-import jdk.test.lib.*;
-import jdk.test.lib.cli.CommandLineOptionTest;
-import jdk.test.lib.cli.predicate.AndPredicate;
-import compiler.testlibrary.rtm.*;
+import compiler.testlibrary.rtm.BusyLock;
+import compiler.testlibrary.rtm.CompilableTest;
+import compiler.testlibrary.rtm.RTMLockingStatistics;
+import compiler.testlibrary.rtm.RTMTestBase;
 import compiler.testlibrary.rtm.predicate.SupportedCPU;
 import compiler.testlibrary.rtm.predicate.SupportedVM;
+import jdk.test.lib.Asserts;
+import jdk.test.lib.OutputAnalyzer;
+import jdk.test.lib.cli.CommandLineOptionTest;
+import jdk.test.lib.cli.predicate.AndPredicate;
+
+import java.util.List;
 
 /**
  * Test verifies that RTMRetryCount option actually affects amount of
diff --git a/hotspot/test/compiler/rtm/locking/TestRTMSpinLoopCount.java b/hotspot/test/compiler/rtm/locking/TestRTMSpinLoopCount.java
index 47e89b0..f6e849e 100644
--- a/hotspot/test/compiler/rtm/locking/TestRTMSpinLoopCount.java
+++ b/hotspot/test/compiler/rtm/locking/TestRTMSpinLoopCount.java
@@ -30,20 +30,28 @@
  * @library /testlibrary /test/lib /
  * @modules java.base/jdk.internal.misc
  *          java.management
- * @build TestRTMSpinLoopCount
+ * @build compiler.rtm.locking.TestRTMSpinLoopCount
  * @run driver ClassFileInstaller sun.hotspot.WhiteBox
  *                                sun.hotspot.WhiteBox$WhiteBoxPermission
  * @run main/othervm -Xbootclasspath/a:. -XX:+UnlockDiagnosticVMOptions
- *                   -XX:+WhiteBoxAPI TestRTMSpinLoopCount
+ *                   -XX:+WhiteBoxAPI
+ *                   compiler.rtm.locking.TestRTMSpinLoopCount
  */
 
-import java.util.List;
-import jdk.test.lib.*;
-import jdk.test.lib.cli.CommandLineOptionTest;
-import jdk.test.lib.cli.predicate.AndPredicate;
-import compiler.testlibrary.rtm.*;
+package compiler.rtm.locking;
+
+import compiler.testlibrary.rtm.BusyLock;
+import compiler.testlibrary.rtm.CompilableTest;
+import compiler.testlibrary.rtm.RTMLockingStatistics;
+import compiler.testlibrary.rtm.RTMTestBase;
 import compiler.testlibrary.rtm.predicate.SupportedCPU;
 import compiler.testlibrary.rtm.predicate.SupportedVM;
+import jdk.test.lib.Asserts;
+import jdk.test.lib.OutputAnalyzer;
+import jdk.test.lib.cli.CommandLineOptionTest;
+import jdk.test.lib.cli.predicate.AndPredicate;
+
+import java.util.List;
 
 /**
  * Test verifies that RTMSpinLoopCount increase time spent between retries
diff --git a/hotspot/test/compiler/rtm/locking/TestRTMTotalCountIncrRate.java b/hotspot/test/compiler/rtm/locking/TestRTMTotalCountIncrRate.java
index 41aeddb..6ae82df 100644
--- a/hotspot/test/compiler/rtm/locking/TestRTMTotalCountIncrRate.java
+++ b/hotspot/test/compiler/rtm/locking/TestRTMTotalCountIncrRate.java
@@ -30,22 +30,30 @@
  * @library /testlibrary /test/lib /
  * @modules java.base/jdk.internal.misc
  *          java.management
- * @build TestRTMTotalCountIncrRate
+ * @build compiler.rtm.locking.TestRTMTotalCountIncrRate
  * @run driver ClassFileInstaller sun.hotspot.WhiteBox
  *                                sun.hotspot.WhiteBox$WhiteBoxPermission
  * @run main/othervm -Xbootclasspath/a:. -XX:+UnlockDiagnosticVMOptions
- *                   -XX:+WhiteBoxAPI TestRTMTotalCountIncrRate
+ *                   -XX:+WhiteBoxAPI
+ *                   compiler.rtm.locking.TestRTMTotalCountIncrRate
  */
 
-import jdk.internal.misc.Unsafe;
-import java.util.List;
+package compiler.rtm.locking;
 
-import jdk.test.lib.*;
-import jdk.test.lib.cli.CommandLineOptionTest;
-import jdk.test.lib.cli.predicate.AndPredicate;
-import compiler.testlibrary.rtm.*;
+import compiler.testlibrary.rtm.AbortProvoker;
+import compiler.testlibrary.rtm.CompilableTest;
+import compiler.testlibrary.rtm.RTMLockingStatistics;
+import compiler.testlibrary.rtm.RTMTestBase;
 import compiler.testlibrary.rtm.predicate.SupportedCPU;
 import compiler.testlibrary.rtm.predicate.SupportedVM;
+import jdk.internal.misc.Unsafe;
+import jdk.test.lib.Asserts;
+import jdk.test.lib.OutputAnalyzer;
+import jdk.test.lib.Utils;
+import jdk.test.lib.cli.CommandLineOptionTest;
+import jdk.test.lib.cli.predicate.AndPredicate;
+
+import java.util.List;
 
 /**
  * Test verifies that with RTMTotalCountIncrRate=1 RTM locking statistics
diff --git a/hotspot/test/compiler/rtm/locking/TestUseRTMAfterLockInflation.java b/hotspot/test/compiler/rtm/locking/TestUseRTMAfterLockInflation.java
index 9bc68b4..be13c80 100644
--- a/hotspot/test/compiler/rtm/locking/TestUseRTMAfterLockInflation.java
+++ b/hotspot/test/compiler/rtm/locking/TestUseRTMAfterLockInflation.java
@@ -30,21 +30,28 @@
  * @library /testlibrary /test/lib /
  * @modules java.base/jdk.internal.misc
  *          java.management
- * @build TestUseRTMAfterLockInflation
+ * @build compiler.rtm.locking.TestUseRTMAfterLockInflation
  * @run driver ClassFileInstaller sun.hotspot.WhiteBox
  *                                sun.hotspot.WhiteBox$WhiteBoxPermission
  * @run main/othervm -Xbootclasspath/a:. -XX:+UnlockDiagnosticVMOptions
- *                   -XX:+WhiteBoxAPI TestUseRTMAfterLockInflation
+ *                   -XX:+WhiteBoxAPI
+ *                   compiler.rtm.locking.TestUseRTMAfterLockInflation
  */
 
-import java.util.List;
+package compiler.rtm.locking;
 
-import jdk.test.lib.*;
-import jdk.test.lib.cli.CommandLineOptionTest;
-import jdk.test.lib.cli.predicate.AndPredicate;
-import compiler.testlibrary.rtm.*;
+import compiler.testlibrary.rtm.AbortProvoker;
+import compiler.testlibrary.rtm.AbortType;
+import compiler.testlibrary.rtm.RTMLockingStatistics;
+import compiler.testlibrary.rtm.RTMTestBase;
 import compiler.testlibrary.rtm.predicate.SupportedCPU;
 import compiler.testlibrary.rtm.predicate.SupportedVM;
+import jdk.test.lib.Asserts;
+import jdk.test.lib.OutputAnalyzer;
+import jdk.test.lib.cli.CommandLineOptionTest;
+import jdk.test.lib.cli.predicate.AndPredicate;
+
+import java.util.List;
 
 /**
  * Test verifies that RTM is used after lock inflation by executing compiled
diff --git a/hotspot/test/compiler/rtm/locking/TestUseRTMDeopt.java b/hotspot/test/compiler/rtm/locking/TestUseRTMDeopt.java
index 054d2f7..05578b6 100644
--- a/hotspot/test/compiler/rtm/locking/TestUseRTMDeopt.java
+++ b/hotspot/test/compiler/rtm/locking/TestUseRTMDeopt.java
@@ -30,19 +30,25 @@
  * @library /testlibrary /test/lib /
  * @modules java.base/jdk.internal.misc
  *          java.management
- * @build TestUseRTMDeopt
+ * @build compiler.rtm.locking.TestUseRTMDeopt
  * @run driver ClassFileInstaller sun.hotspot.WhiteBox
  *                                sun.hotspot.WhiteBox$WhiteBoxPermission
  * @run main/othervm -Xbootclasspath/a:. -XX:+UnlockDiagnosticVMOptions
- *                   -XX:+WhiteBoxAPI TestUseRTMDeopt
+ *                   -XX:+WhiteBoxAPI
+ *                   compiler.rtm.locking.TestUseRTMDeopt
  */
 
-import jdk.test.lib.*;
-import jdk.test.lib.cli.CommandLineOptionTest;
-import jdk.test.lib.cli.predicate.AndPredicate;
-import compiler.testlibrary.rtm.*;
+package compiler.rtm.locking;
+
+import compiler.testlibrary.rtm.AbortProvoker;
+import compiler.testlibrary.rtm.AbortType;
+import compiler.testlibrary.rtm.RTMTestBase;
 import compiler.testlibrary.rtm.predicate.SupportedCPU;
 import compiler.testlibrary.rtm.predicate.SupportedVM;
+import jdk.test.lib.Asserts;
+import jdk.test.lib.OutputAnalyzer;
+import jdk.test.lib.cli.CommandLineOptionTest;
+import jdk.test.lib.cli.predicate.AndPredicate;
 
 /**
  * Test verifies that usage of UseRTMDeopt option affects uncommon traps usage
diff --git a/hotspot/test/compiler/rtm/locking/TestUseRTMForInflatedLocks.java b/hotspot/test/compiler/rtm/locking/TestUseRTMForInflatedLocks.java
index b9c23a4..94c4978 100644
--- a/hotspot/test/compiler/rtm/locking/TestUseRTMForInflatedLocks.java
+++ b/hotspot/test/compiler/rtm/locking/TestUseRTMForInflatedLocks.java
@@ -29,21 +29,27 @@
  * @library /testlibrary /test/lib /
  * @modules java.base/jdk.internal.misc
  *          java.management
- * @build TestUseRTMForInflatedLocks
+ * @build compiler.rtm.locking.TestUseRTMForInflatedLocks
  * @run driver ClassFileInstaller sun.hotspot.WhiteBox
  *                                sun.hotspot.WhiteBox$WhiteBoxPermission
  * @run main/othervm -Xbootclasspath/a:. -XX:+UnlockDiagnosticVMOptions
- *                   -XX:+WhiteBoxAPI TestUseRTMForInflatedLocks
+ *                   -XX:+WhiteBoxAPI compiler.rtm.locking.TestUseRTMForInflatedLocks
  */
 
-import java.util.List;
+package compiler.rtm.locking;
 
-import jdk.test.lib.*;
-import jdk.test.lib.cli.CommandLineOptionTest;
-import jdk.test.lib.cli.predicate.AndPredicate;
-import compiler.testlibrary.rtm.*;
+import compiler.testlibrary.rtm.AbortProvoker;
+import compiler.testlibrary.rtm.AbortType;
+import compiler.testlibrary.rtm.RTMLockingStatistics;
+import compiler.testlibrary.rtm.RTMTestBase;
 import compiler.testlibrary.rtm.predicate.SupportedCPU;
 import compiler.testlibrary.rtm.predicate.SupportedVM;
+import jdk.test.lib.Asserts;
+import jdk.test.lib.OutputAnalyzer;
+import jdk.test.lib.cli.CommandLineOptionTest;
+import jdk.test.lib.cli.predicate.AndPredicate;
+
+import java.util.List;
 
 /**
  * Test verifies that RTM-based lock elision could be used for inflated locks
diff --git a/hotspot/test/compiler/rtm/locking/TestUseRTMForStackLocks.java b/hotspot/test/compiler/rtm/locking/TestUseRTMForStackLocks.java
index afede71..6bb2646 100644
--- a/hotspot/test/compiler/rtm/locking/TestUseRTMForStackLocks.java
+++ b/hotspot/test/compiler/rtm/locking/TestUseRTMForStackLocks.java
@@ -29,21 +29,28 @@
  * @library /testlibrary /test/lib /
  * @modules java.base/jdk.internal.misc
  *          java.management
- * @build TestUseRTMForStackLocks
+ * @build compiler.rtm.locking.TestUseRTMForStackLocks
  * @run driver ClassFileInstaller sun.hotspot.WhiteBox
  *                                sun.hotspot.WhiteBox$WhiteBoxPermission
  * @run main/othervm -Xbootclasspath/a:. -XX:+UnlockDiagnosticVMOptions
- *                   -XX:+WhiteBoxAPI TestUseRTMForStackLocks
+ *                   -XX:+WhiteBoxAPI
+ *                   compiler.rtm.locking.TestUseRTMForStackLocks
  */
 
-import java.util.List;
+package compiler.rtm.locking;
 
-import jdk.test.lib.*;
-import jdk.test.lib.cli.CommandLineOptionTest;
-import jdk.test.lib.cli.predicate.AndPredicate;
-import compiler.testlibrary.rtm.*;
+import compiler.testlibrary.rtm.AbortProvoker;
+import compiler.testlibrary.rtm.AbortType;
+import compiler.testlibrary.rtm.RTMLockingStatistics;
+import compiler.testlibrary.rtm.RTMTestBase;
 import compiler.testlibrary.rtm.predicate.SupportedCPU;
 import compiler.testlibrary.rtm.predicate.SupportedVM;
+import jdk.test.lib.Asserts;
+import jdk.test.lib.OutputAnalyzer;
+import jdk.test.lib.cli.CommandLineOptionTest;
+import jdk.test.lib.cli.predicate.AndPredicate;
+
+import java.util.List;
 
 /**
  * Test verifies that RTM-based lock elision could be used for stack locks
diff --git a/hotspot/test/compiler/rtm/locking/TestUseRTMXendForLockBusy.java b/hotspot/test/compiler/rtm/locking/TestUseRTMXendForLockBusy.java
index c61e6bc..d8dc7ca 100644
--- a/hotspot/test/compiler/rtm/locking/TestUseRTMXendForLockBusy.java
+++ b/hotspot/test/compiler/rtm/locking/TestUseRTMXendForLockBusy.java
@@ -30,21 +30,29 @@
  * @library /testlibrary /test/lib /
  * @modules java.base/jdk.internal.misc
  *          java.management
- * @build TestUseRTMXendForLockBusy
+ * @build compiler.rtm.locking.TestUseRTMXendForLockBusy
  * @run driver ClassFileInstaller sun.hotspot.WhiteBox
  *                                sun.hotspot.WhiteBox$WhiteBoxPermission
  * @run main/othervm -Xbootclasspath/a:. -XX:+UnlockDiagnosticVMOptions
- *                   -XX:+WhiteBoxAPI TestUseRTMXendForLockBusy
+ *                   -XX:+WhiteBoxAPI
+ *                   compiler.rtm.locking.TestUseRTMXendForLockBusy
  */
 
-import java.util.List;
+package compiler.rtm.locking;
 
-import jdk.test.lib.*;
-import jdk.test.lib.cli.CommandLineOptionTest;
-import jdk.test.lib.cli.predicate.AndPredicate;
-import compiler.testlibrary.rtm.*;
+import compiler.testlibrary.rtm.AbortType;
+import compiler.testlibrary.rtm.BusyLock;
+import compiler.testlibrary.rtm.CompilableTest;
+import compiler.testlibrary.rtm.RTMLockingStatistics;
+import compiler.testlibrary.rtm.RTMTestBase;
 import compiler.testlibrary.rtm.predicate.SupportedCPU;
 import compiler.testlibrary.rtm.predicate.SupportedVM;
+import jdk.test.lib.Asserts;
+import jdk.test.lib.OutputAnalyzer;
+import jdk.test.lib.cli.CommandLineOptionTest;
+import jdk.test.lib.cli.predicate.AndPredicate;
+
+import java.util.List;
 
 /**
  * Test verifies that with +UseRTMXendForLockBusy there will be no aborts
diff --git a/hotspot/test/compiler/rtm/method_options/TestNoRTMLockElidingOption.java b/hotspot/test/compiler/rtm/method_options/TestNoRTMLockElidingOption.java
index 567ddd5..30d747e 100644
--- a/hotspot/test/compiler/rtm/method_options/TestNoRTMLockElidingOption.java
+++ b/hotspot/test/compiler/rtm/method_options/TestNoRTMLockElidingOption.java
@@ -30,20 +30,28 @@
  * @library /testlibrary /test/lib /
  * @modules java.base/jdk.internal.misc
  *          java.management
- * @build TestNoRTMLockElidingOption
+ * @build compiler.rtm.method_options.TestNoRTMLockElidingOption
  * @run driver ClassFileInstaller sun.hotspot.WhiteBox
  *                                sun.hotspot.WhiteBox$WhiteBoxPermission
  * @run main/othervm -Xbootclasspath/a:. -XX:+UnlockDiagnosticVMOptions
- *                   -XX:+WhiteBoxAPI TestNoRTMLockElidingOption
+ *                   -XX:+WhiteBoxAPI
+ *                   compiler.rtm.method_options.TestNoRTMLockElidingOption
  */
 
-import java.util.List;
-import jdk.test.lib.*;
-import jdk.test.lib.cli.CommandLineOptionTest;
-import jdk.test.lib.cli.predicate.AndPredicate;
-import compiler.testlibrary.rtm.*;
+package compiler.rtm.method_options;
+
+import compiler.testlibrary.rtm.AbortProvoker;
+import compiler.testlibrary.rtm.AbortType;
+import compiler.testlibrary.rtm.RTMLockingStatistics;
+import compiler.testlibrary.rtm.RTMTestBase;
 import compiler.testlibrary.rtm.predicate.SupportedCPU;
 import compiler.testlibrary.rtm.predicate.SupportedVM;
+import jdk.test.lib.Asserts;
+import jdk.test.lib.OutputAnalyzer;
+import jdk.test.lib.cli.CommandLineOptionTest;
+import jdk.test.lib.cli.predicate.AndPredicate;
+
+import java.util.List;
 
 /**
  * Test verifies that method tagged with option <i>NoRTMLockElidingOption</i>
diff --git a/hotspot/test/compiler/rtm/method_options/TestUseRTMLockElidingOption.java b/hotspot/test/compiler/rtm/method_options/TestUseRTMLockElidingOption.java
index acb8bdd..5080834 100644
--- a/hotspot/test/compiler/rtm/method_options/TestUseRTMLockElidingOption.java
+++ b/hotspot/test/compiler/rtm/method_options/TestUseRTMLockElidingOption.java
@@ -31,20 +31,28 @@
  * @library /testlibrary /test/lib /
  * @modules java.base/jdk.internal.misc
  *          java.management
- * @build TestUseRTMLockElidingOption
+ * @build compiler.rtm.method_options.TestUseRTMLockElidingOption
  * @run driver ClassFileInstaller sun.hotspot.WhiteBox
  *                                sun.hotspot.WhiteBox$WhiteBoxPermission
  * @run main/othervm -Xbootclasspath/a:. -XX:+UnlockDiagnosticVMOptions
- *                   -XX:+WhiteBoxAPI TestUseRTMLockElidingOption
+ *                   -XX:+WhiteBoxAPI
+ *                   compiler.rtm.method_options.TestUseRTMLockElidingOption
  */
 
-import java.util.List;
-import jdk.test.lib.*;
-import jdk.test.lib.cli.CommandLineOptionTest;
-import jdk.test.lib.cli.predicate.AndPredicate;
-import compiler.testlibrary.rtm.*;
+package compiler.rtm.method_options;
+
+import compiler.testlibrary.rtm.AbortProvoker;
+import compiler.testlibrary.rtm.AbortType;
+import compiler.testlibrary.rtm.RTMLockingStatistics;
+import compiler.testlibrary.rtm.RTMTestBase;
 import compiler.testlibrary.rtm.predicate.SupportedCPU;
 import compiler.testlibrary.rtm.predicate.SupportedVM;
+import jdk.test.lib.Asserts;
+import jdk.test.lib.OutputAnalyzer;
+import jdk.test.lib.cli.CommandLineOptionTest;
+import jdk.test.lib.cli.predicate.AndPredicate;
+
+import java.util.List;
 
 /**
  * Test verifies that method tagged with option <i>UseRTMLockElidingOption</i>
diff --git a/hotspot/test/compiler/rtm/print/TestPrintPreciseRTMLockingStatistics.java b/hotspot/test/compiler/rtm/print/TestPrintPreciseRTMLockingStatistics.java
index 40aa1a3..adeed6d 100644
--- a/hotspot/test/compiler/rtm/print/TestPrintPreciseRTMLockingStatistics.java
+++ b/hotspot/test/compiler/rtm/print/TestPrintPreciseRTMLockingStatistics.java
@@ -32,21 +32,31 @@
  * @library /testlibrary /test/lib /
  * @modules java.base/jdk.internal.misc
  *          java.management
- * @build TestPrintPreciseRTMLockingStatistics
+ * @build compiler.rtm.print.TestPrintPreciseRTMLockingStatistics
  * @run driver ClassFileInstaller sun.hotspot.WhiteBox
  *                                sun.hotspot.WhiteBox$WhiteBoxPermission
  * @run main/othervm -Xbootclasspath/a:. -XX:+UnlockDiagnosticVMOptions
- *                   -XX:+WhiteBoxAPI TestPrintPreciseRTMLockingStatistics
+ *                   -XX:+WhiteBoxAPI
+ *                   compiler.rtm.print.TestPrintPreciseRTMLockingStatistics
  */
 
-import java.util.*;
 
-import jdk.test.lib.*;
-import jdk.test.lib.cli.CommandLineOptionTest;
-import jdk.test.lib.cli.predicate.AndPredicate;
-import compiler.testlibrary.rtm.*;
+package compiler.rtm.print;
+
+import compiler.testlibrary.rtm.AbortProvoker;
+import compiler.testlibrary.rtm.AbortType;
+import compiler.testlibrary.rtm.RTMLockingStatistics;
+import compiler.testlibrary.rtm.RTMTestBase;
 import compiler.testlibrary.rtm.predicate.SupportedCPU;
 import compiler.testlibrary.rtm.predicate.SupportedVM;
+import jdk.test.lib.Asserts;
+import jdk.test.lib.OutputAnalyzer;
+import jdk.test.lib.cli.CommandLineOptionTest;
+import jdk.test.lib.cli.predicate.AndPredicate;
+
+import java.util.Collections;
+import java.util.LinkedList;
+import java.util.List;
 
 /**
  * Test verifies that VM output does not contain RTM locking statistics when it
diff --git a/hotspot/test/compiler/runtime/6778657/Test.java b/hotspot/test/compiler/runtime/6778657/Test.java
deleted file mode 100644
index 116693a..0000000
--- a/hotspot/test/compiler/runtime/6778657/Test.java
+++ /dev/null
@@ -1,75 +0,0 @@
-/*
- * Copyright (c) 2008, 2009, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- *
- */
-
-/*
- * @test
- * @bug 6778657
- * @summary Casts in SharedRuntime::f2i, f2l, d2i and d2l rely on undefined C++ behaviour
- */
-
-public class Test {
-  public static void check_f2i(int expect) {
-    float check = expect;
-    check *= 2;
-    int actual = (int) check;
-    if (actual != expect)
-      throw new RuntimeException("expecting " + expect + ", got " + actual);
-  }
-
-  public static void check_f2l(long expect) {
-    float check = expect;
-    check *= 2;
-    long actual = (long) check;
-    if (actual != expect)
-      throw new RuntimeException("expecting " + expect + ", got " + actual);
-  }
-
-  public static void check_d2i(int expect) {
-    double check = expect;
-    check *= 2;
-    int actual = (int) check;
-    if (actual != expect)
-      throw new RuntimeException("expecting " + expect + ", got " + actual);
-  }
-
-  public static void check_d2l(long expect) {
-    double check = expect;
-    check *= 2;
-    long actual = (long) check;
-    if (actual != expect)
-      throw new RuntimeException("expecting " + expect + ", got " + actual);
-  }
-
-  public static void main(String[] args) {
-    check_f2i(Integer.MAX_VALUE);
-    check_f2i(Integer.MIN_VALUE);
-    check_f2l(Long.MAX_VALUE);
-    check_f2l(Long.MIN_VALUE);
-    check_d2i(Integer.MAX_VALUE);
-    check_d2i(Integer.MIN_VALUE);
-    check_d2l(Long.MAX_VALUE);
-    check_d2l(Long.MIN_VALUE);
-  }
-}
-
diff --git a/hotspot/test/compiler/runtime/6865265/StackOverflowBug.java b/hotspot/test/compiler/runtime/6865265/StackOverflowBug.java
deleted file mode 100644
index c5d0f3b..0000000
--- a/hotspot/test/compiler/runtime/6865265/StackOverflowBug.java
+++ /dev/null
@@ -1,89 +0,0 @@
-/*
- * Copyright (c) 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.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- *
- */
-
-/**
- * @test
- * @bug 6865265
- * @summary JVM crashes with "missing exception handler" error
- * @author volker.simonis@sap.com
- *
- * @run main/othervm -XX:CompileThreshold=100 -Xbatch -Xss512k StackOverflowBug
- */
-
-
-public class StackOverflowBug {
-
-  public static int run() {
-    try {
-      try {
-        return run();
-      } catch (Throwable e) {
-        // Notice that the class 'Throwable' is NOT resolved by the verifier,
-        // because the verifier only checks if 'Throwable' is assignable to
-        // 'java.lang.Throwable' and this check succeeds immediately if the two
-        // types have equal names (see 'VerificationType::is_assignable_from' which
-        // is called from 'ClassVerifier::verify_exception_handler_table').
-        // This is strange, because if the two classes have different names,
-        // 'is_assignable_from()' calls 'is_reference_assignable_from()' which resolves
-        // both classes by calling 'SystemDictionary::resolve_or_fail()'. This call
-        // also takes into account the current class loader (i.e. the one which was used
-        // to load this class) and would place a corresponding
-        // "java.lang.Throwable / current-Classloader" entry into the system dictionary.
-        // This would in turn allow C2 to see 'java.lang.Throwable' as "loaded"
-        // (see 'Parse::catch_inline_exceptions()') when this method is compiled.
-        return 42;
-      }
-    }
-    finally {
-    }
-  }
-
-  public static void main(String argv[]) {
-    run();
-  }
-}
-
-/*
-  public static int run();
-    Code:
-       0: invokestatic  #2                  // Method run:()I
-       3: istore_0
-       4: iload_0
-       5: ireturn
-       6: astore_0
-       7: bipush        42
-       9: istore_1
-      10: iload_1
-      11: ireturn
-      12: astore_2
-      13: aload_2
-      14: athrow
-    Exception table:
-       from    to  target type
-           0     4     6   Class java/lang/Throwable
-           0     4    12   any
-           6    10    12   any
-          12    13    12   any
-
- */
diff --git a/hotspot/test/compiler/runtime/6892265/Test.java b/hotspot/test/compiler/runtime/6892265/Test.java
deleted file mode 100644
index fd51193..0000000
--- a/hotspot/test/compiler/runtime/6892265/Test.java
+++ /dev/null
@@ -1,65 +0,0 @@
-/*
- * Copyright (c) 2009, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- *
- */
-
-/**
- * @test
- * @bug 6892265
- * @summary System.arraycopy unable to reference elements beyond Integer.MAX_VALUE bytes
- *
- * @run main/othervm Test
- */
-
-public class Test {
-  static  final int NCOPY = 1;
-  static  final int OVERFLOW = 1;
-  static  int[] src2 = new int[NCOPY];
-  static  int[] dst2;
-
-  static void test() {
-    int N;
-    int SIZE;
-
-    N = Integer.MAX_VALUE/4 + OVERFLOW;
-    System.arraycopy(src2, 0, dst2, N, NCOPY);
-    System.arraycopy(dst2, N, src2, 0, NCOPY);
-  }
-
-  public static void main(String[] args) {
-    try {
-      dst2 = new int[NCOPY + Integer.MAX_VALUE/4 + OVERFLOW];
-    } catch (OutOfMemoryError e) {
-       System.exit(95); // Not enough memory
-    }
-    System.out.println("warmup");
-    for (int i=0; i <11000; i++) {
-      test();
-    }
-    System.out.println("start");
-    for (int i=0; i <1000; i++) {
-      test();
-    }
-    System.out.println("finish");
-  }
-
-}
diff --git a/hotspot/test/compiler/runtime/7196199/Test7196199.java b/hotspot/test/compiler/runtime/7196199/Test7196199.java
deleted file mode 100644
index 8f0c520..0000000
--- a/hotspot/test/compiler/runtime/7196199/Test7196199.java
+++ /dev/null
@@ -1,189 +0,0 @@
-/*
- * Copyright (c) 2012, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- *
- */
-
-/**
- * @test
- * @bug 7196199
- * @summary java/text/Bidi/Bug6665028.java failed: Bidi run count incorrect
- *
- * @run main/othervm/timeout=400 -Xmx32m -Xbatch -XX:+IgnoreUnrecognizedVMOptions -XX:+UnlockDiagnosticVMOptions -XX:-TieredCompilation -XX:CompileCommand=exclude,Test7196199.test -XX:+SafepointALot -XX:GuaranteedSafepointInterval=100 Test7196199
- */
-
-
-public class Test7196199 {
-  private static final int ARRLEN = 97;
-  private static final int ITERS  = 5000;
-  private static final int INI_ITERS  = 1000;
-  private static final int SFP_ITERS  = 10000;
-  private static final float SFP_ITERS_F  = 10000.f;
-  private static final float VALUE = 15.f;
-  public static void main(String args[]) {
-    int errn = test();
-    if (errn > 0) {
-      System.err.println("FAILED: " + errn + " errors");
-      System.exit(97);
-    }
-    System.out.println("PASSED");
-  }
-
-  static int test() {
-    float[] a0 = new float[ARRLEN];
-    float[] a1 = new float[ARRLEN];
-    // Initialize
-    for (int i=0; i<ARRLEN; i++) {
-      a0[i] = 0.f;
-      a1[i] = (float)i;
-    }
-    System.out.println("Warmup");
-    for (int i=0; i<INI_ITERS; i++) {
-      test_incrc(a0);
-      test_incrv(a0, VALUE);
-      test_addc(a0, a1);
-      test_addv(a0, a1, VALUE);
-    }
-    // Test and verify results
-    System.out.println("Verification");
-    int errn = 0;
-    for (int i=0; i<ARRLEN; i++)
-      a0[i] = 0.f;
-
-    System.out.println("  test_incrc");
-    for (int j=0; j<ITERS; j++) {
-      test_incrc(a0);
-      for (int i=0; i<ARRLEN; i++) {
-        errn += verify("test_incrc: ", i, a0[i], VALUE*SFP_ITERS_F);
-        a0[i] = 0.f; // Reset
-      }
-    }
-
-    System.out.println("  test_incrv");
-    for (int j=0; j<ITERS; j++) {
-      test_incrv(a0, VALUE);
-      for (int i=0; i<ARRLEN; i++) {
-        errn += verify("test_incrv: ", i, a0[i], VALUE*SFP_ITERS_F);
-        a0[i] = 0.f; // Reset
-      }
-    }
-
-    System.out.println("  test_addc");
-    for (int j=0; j<ITERS; j++) {
-      test_addc(a0, a1);
-      for (int i=0; i<ARRLEN; i++) {
-        errn += verify("test_addc: ", i, a0[i], ((float)i + VALUE)*SFP_ITERS_F);
-        a0[i] = 0.f; // Reset
-      }
-    }
-
-    System.out.println("  test_addv");
-    for (int j=0; j<ITERS; j++) {
-      test_addv(a0, a1, VALUE);
-      for (int i=0; i<ARRLEN; i++) {
-        errn += verify("test_addv: ", i, a0[i], ((float)i + VALUE)*SFP_ITERS_F);
-        a0[i] = 0.f; // Reset
-      }
-    }
-
-    if (errn > 0)
-      return errn;
-
-    System.out.println("Time");
-    long start, end;
-
-    start = System.currentTimeMillis();
-    for (int i=0; i<INI_ITERS; i++) {
-      test_incrc(a0);
-    }
-    end = System.currentTimeMillis();
-    System.out.println("test_incrc: " + (end - start));
-
-    start = System.currentTimeMillis();
-    for (int i=0; i<INI_ITERS; i++) {
-      test_incrv(a0, VALUE);
-    }
-    end = System.currentTimeMillis();
-    System.out.println("test_incrv: " + (end - start));
-
-    start = System.currentTimeMillis();
-    for (int i=0; i<INI_ITERS; i++) {
-      test_addc(a0, a1);
-    }
-    end = System.currentTimeMillis();
-    System.out.println("test_addc: " + (end - start));
-
-    start = System.currentTimeMillis();
-    for (int i=0; i<INI_ITERS; i++) {
-      test_addv(a0, a1, VALUE);
-    }
-    end = System.currentTimeMillis();
-    System.out.println("test_addv: " + (end - start));
-
-    return errn;
-  }
-
-  static void test_incrc(float[] a0) {
-    // Non-counted loop with safepoint.
-    for (long l = 0; l < SFP_ITERS; l++) {
-      // Counted and vectorized loop.
-      for (int i = 0; i < a0.length; i+=1) {
-        a0[i] += VALUE;
-      }
-    }
-  }
-  static void test_incrv(float[] a0, float b) {
-    // Non-counted loop with safepoint.
-    for (long l = 0; l < SFP_ITERS; l++) {
-      // Counted and vectorized loop.
-      for (int i = 0; i < a0.length; i+=1) {
-        a0[i] += b;
-      }
-    }
-  }
-  static void test_addc(float[] a0, float[] a1) {
-    // Non-counted loop with safepoint.
-    for (long l = 0; l < SFP_ITERS; l++) {
-      // Counted and vectorized loop.
-      for (int i = 0; i < a0.length; i+=1) {
-        a0[i] += a1[i]+VALUE;
-      }
-    }
-  }
-  static void test_addv(float[] a0, float[] a1, float b) {
-    // Non-counted loop with safepoint.
-    for (long l = 0; l < SFP_ITERS; l++) {
-      // Counted and vectorized loop.
-      for (int i = 0; i < a0.length; i+=1) {
-        a0[i] += a1[i]+b;
-      }
-    }
-  }
-
-  static int verify(String text, int i, float elem, float val) {
-    if (elem != val) {
-      System.err.println(text + "[" + i + "] = " + elem + " != " + val);
-      return 1;
-    }
-    return 0;
-  }
-}
-
diff --git a/hotspot/test/compiler/runtime/8010927/Test8010927.java b/hotspot/test/compiler/runtime/8010927/Test8010927.java
deleted file mode 100644
index 9453878..0000000
--- a/hotspot/test/compiler/runtime/8010927/Test8010927.java
+++ /dev/null
@@ -1,155 +0,0 @@
-/*
- * Copyright (c) 2013, 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.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-
-/*
- * @test
- * @bug 8010927
- * @summary Kitchensink crashed with SIGSEGV, Problematic frame: v ~StubRoutines::checkcast_arraycopy
- * @library /test/lib /testlibrary
- * @modules java.base/jdk.internal.misc
- * @build Test8010927
- * @run main ClassFileInstaller sun.hotspot.WhiteBox
- *                              sun.hotspot.WhiteBox$WhiteBoxPermission
- * @run main/othervm -XX:+UnlockDiagnosticVMOptions -XX:+IgnoreUnrecognizedVMOptions -XX:+WhiteBoxAPI -Xbootclasspath/a:. -Xmx64m -XX:NewSize=20971520 -XX:MaxNewSize=32m -XX:-UseTLAB -XX:-UseAdaptiveSizePolicy Test8010927
- */
-
-import sun.hotspot.WhiteBox;
-import java.lang.reflect.Field;
-import jdk.internal.misc.Unsafe;
-
-/**
- * The test creates uncommitted space between oldgen and young gen
- * by specifying MaxNewSize bigger than NewSize.
- * NewSize = 20971520 = (512*4K) * 10 for 4k pages
- * Then it tries to execute arraycopy() with elements type check
- * to the array at the end of survive space near unused space.
- */
-
-public class Test8010927 {
-
-  private static final Unsafe U;
-
-  static {
-    try {
-      Field unsafe = Unsafe.class.getDeclaredField("theUnsafe");
-      unsafe.setAccessible(true);
-      U = (Unsafe) unsafe.get(null);
-    } catch (Exception e) {
-      throw new Error(e);
-    }
-  }
-
-  public static Object[] o;
-
-  public static final boolean debug = Boolean.getBoolean("debug");
-
-  // 2 different obect arrays but same element types
-  static Test8010927[] masterA;
-  static Object[] masterB;
-  static final Test8010927 elem = new Test8010927();
-  static final WhiteBox wb = WhiteBox.getWhiteBox();
-
-  static final int obj_header_size = U.ARRAY_OBJECT_BASE_OFFSET;
-  static final int heap_oop_size = wb.getHeapOopSize();
-  static final int card_size = 512;
-  static final int one_card = (card_size - obj_header_size)/heap_oop_size;
-
-  static final int surv_size = 2112 * 1024;
-
-  // The size is big to not fit into survive space.
-  static final Object[] cache = new Object[(surv_size / card_size)];
-
-  public static void main(String[] args) {
-    masterA = new Test8010927[one_card];
-    masterB = new Object[one_card];
-    for (int i = 0; i < one_card; ++i) {
-      masterA[i] = elem;
-      masterB[i] = elem;
-    }
-
-    // Move cache[] to the old gen.
-    long low_limit = wb.getObjectAddress(cache);
-    System.gc();
-    // Move 'cache' to oldgen.
-    long upper_limit = wb.getObjectAddress(cache);
-    if ((low_limit - upper_limit) > 0) { // substaction works with unsigned values
-      // OldGen is placed before youngger for ParallelOldGC.
-      upper_limit = low_limit + 21000000l; // +20971520
-    }
-    // Each A[one_card] size is 512 bytes,
-    // it will take about 40000 allocations to trigger GC.
-    // cache[] has 8192 elements so GC should happen
-    // each 5th iteration.
-    for(long l = 0; l < 20; l++) {
-      fill_heap();
-      if (debug) {
-        System.out.println("test oop_disjoint_arraycopy");
-      }
-      testA_arraycopy();
-      if (debug) {
-        System.out.println("test checkcast_arraycopy");
-      }
-      testB_arraycopy();
-      // Execute arraycopy to the topmost array in young gen
-      if (debug) {
-        int top_index = get_top_address(low_limit, upper_limit);
-        if (top_index >= 0) {
-          long addr = wb.getObjectAddress(cache[top_index]);
-          System.out.println("top_addr: 0x" + Long.toHexString(addr) + ", 0x" + Long.toHexString(addr + 512));
-        }
-      }
-    }
-  }
-  static void fill_heap() {
-    for (int i = 0; i < cache.length; ++i) {
-      o = new Test8010927[one_card];
-      System.arraycopy(masterA, 0, o, 0, masterA.length);
-      cache[i] = o;
-    }
-    for (long j = 0; j < 256; ++j) {
-      o = new Long[10000]; // to trigger GC
-    }
-  }
-  static void testA_arraycopy() {
-    for (int i = 0; i < cache.length; ++i) {
-      System.arraycopy(masterA, 0, cache[i], 0, masterA.length);
-    }
-  }
-  static void testB_arraycopy() {
-    for (int i = 0; i < cache.length; ++i) {
-      System.arraycopy(masterB, 0, cache[i], 0, masterB.length);
-    }
-  }
-  static int get_top_address(long min, long max) {
-    int index = -1;
-    long addr = min;
-    for (int i = 0; i < cache.length; ++i) {
-      long test = wb.getObjectAddress(cache[i]);
-      if (((test - addr) > 0) && ((max - test) > 0)) { // substaction works with unsigned values
-        addr = test;
-        index = i;
-      }
-    }
-    return index;
-  }
-}
diff --git a/hotspot/test/compiler/runtime/7141637/SpreadNullArg.java b/hotspot/test/compiler/runtime/SpreadNullArg.java
similarity index 85%
rename from hotspot/test/compiler/runtime/7141637/SpreadNullArg.java
rename to hotspot/test/compiler/runtime/SpreadNullArg.java
index fac5d47..826058e 100644
--- a/hotspot/test/compiler/runtime/7141637/SpreadNullArg.java
+++ b/hotspot/test/compiler/runtime/SpreadNullArg.java
@@ -24,11 +24,14 @@
 /*
  * @test SpreadNullArg
  * @bug 7141637
- * @summary  verifies that the MethodHandle spread adapter can gracefully handle null arguments.
- * @run main SpreadNullArg
+ * @summary verifies that the MethodHandle spread adapter can gracefully handle null arguments.
+ *
+ * @run main compiler.runtime.SpreadNullArg
  * @author volker.simonis@gmail.com
  */
 
+package compiler.runtime;
+
 import java.lang.invoke.MethodHandle;
 import java.lang.invoke.MethodHandles;
 import java.lang.invoke.MethodType;
@@ -44,7 +47,7 @@
 
     try {
       mh_spread_target =
-        MethodHandles.lookup().findStatic(SpreadNullArg.class, "target_spread_arg", mt_ref_arg);
+          MethodHandles.lookup().findStatic(SpreadNullArg.class, "target_spread_arg", mt_ref_arg);
       result = (int) mh_spreadInvoker.invokeExact(mh_spread_target, (Object[]) null);
       throw new Error("Expected IllegalArgumentException was not thrown");
     } catch (IllegalArgumentException e) {
@@ -55,7 +58,7 @@
 
     if (result != 42) {
       throw new Error("result [" + result
-        + "] != 42 : Expected IllegalArgumentException was not thrown?");
+          + "] != 42 : Expected IllegalArgumentException was not thrown?");
     }
   }
 
diff --git a/hotspot/test/compiler/runtime/StackOverflowBug.java b/hotspot/test/compiler/runtime/StackOverflowBug.java
new file mode 100644
index 0000000..a4ee267
--- /dev/null
+++ b/hotspot/test/compiler/runtime/StackOverflowBug.java
@@ -0,0 +1,90 @@
+/*
+ * Copyright (c) 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.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ *
+ */
+
+/**
+ * @test
+ * @bug 6865265
+ * @summary JVM crashes with "missing exception handler" error
+ * @author volker.simonis@sap.com
+ *
+ * @run main/othervm -XX:CompileThreshold=100 -Xbatch -Xss512k
+ *      compiler.runtime.StackOverflowBug
+ */
+
+package compiler.runtime;
+
+public class StackOverflowBug {
+
+    public static int run() {
+        try {
+            try {
+                return run();
+            } catch (Throwable e) {
+                // Notice that the class 'Throwable' is NOT resolved by the verifier,
+                // because the verifier only checks if 'Throwable' is assignable to
+                // 'java.lang.Throwable' and this check succeeds immediately if the two
+                // types have equal names (see 'VerificationType::is_assignable_from' which
+                // is called from 'ClassVerifier::verify_exception_handler_table').
+                // This is strange, because if the two classes have different names,
+                // 'is_assignable_from()' calls 'is_reference_assignable_from()' which resolves
+                // both classes by calling 'SystemDictionary::resolve_or_fail()'. This call
+                // also takes into account the current class loader (i.e. the one which was used
+                // to load this class) and would place a corresponding
+                // "java.lang.Throwable / current-Classloader" entry into the system dictionary.
+                // This would in turn allow C2 to see 'java.lang.Throwable' as "loaded"
+                // (see 'Parse::catch_inline_exceptions()') when this method is compiled.
+                return 42;
+            }
+        } finally {
+        }
+    }
+
+    public static void main(String argv[]) {
+        run();
+    }
+}
+
+/*
+  public static int run();
+    Code:
+       0: invokestatic  #2                  // Method run:()I
+       3: istore_0
+       4: iload_0
+       5: ireturn
+       6: astore_0
+       7: bipush        42
+       9: istore_1
+      10: iload_1
+      11: ireturn
+      12: astore_2
+      13: aload_2
+      14: athrow
+    Exception table:
+       from    to  target type
+           0     4     6   Class java/lang/Throwable
+           0     4    12   any
+           6    10    12   any
+          12    13    12   any
+
+ */
diff --git a/hotspot/test/compiler/runtime/Test6778657.java b/hotspot/test/compiler/runtime/Test6778657.java
new file mode 100644
index 0000000..37787d2
--- /dev/null
+++ b/hotspot/test/compiler/runtime/Test6778657.java
@@ -0,0 +1,83 @@
+/*
+ * Copyright (c) 2008, 2009, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ *
+ */
+
+/*
+ * @test
+ * @bug 6778657
+ * @summary Casts in SharedRuntime::f2i, f2l, d2i and d2l rely on undefined C++ behaviour
+ *
+ * @run main compiler.runtime.Test6778657
+ */
+
+package compiler.runtime;
+
+public class Test6778657 {
+    public static void check_f2i(int expect) {
+        float check = expect;
+        check *= 2;
+        int actual = (int) check;
+        if (actual != expect) {
+            throw new RuntimeException("expecting " + expect + ", got " + actual);
+        }
+    }
+
+    public static void check_f2l(long expect) {
+        float check = expect;
+        check *= 2;
+        long actual = (long) check;
+        if (actual != expect) {
+            throw new RuntimeException("expecting " + expect + ", got " + actual);
+        }
+    }
+
+    public static void check_d2i(int expect) {
+        double check = expect;
+        check *= 2;
+        int actual = (int) check;
+        if (actual != expect) {
+            throw new RuntimeException("expecting " + expect + ", got " + actual);
+        }
+    }
+
+    public static void check_d2l(long expect) {
+        double check = expect;
+        check *= 2;
+        long actual = (long) check;
+        if (actual != expect) {
+            throw new RuntimeException("expecting " + expect + ", got " + actual);
+        }
+    }
+
+    public static void main(String[] args) {
+        check_f2i(Integer.MAX_VALUE);
+        check_f2i(Integer.MIN_VALUE);
+        check_f2l(Long.MAX_VALUE);
+        check_f2l(Long.MIN_VALUE);
+        check_d2i(Integer.MAX_VALUE);
+        check_d2i(Integer.MIN_VALUE);
+        check_d2l(Long.MAX_VALUE);
+        check_d2l(Long.MIN_VALUE);
+    }
+}
+
diff --git a/hotspot/test/compiler/runtime/6826736/Test.java b/hotspot/test/compiler/runtime/Test6826736.java
similarity index 84%
rename from hotspot/test/compiler/runtime/6826736/Test.java
rename to hotspot/test/compiler/runtime/Test6826736.java
index e1e1e8d2..1fb8dd6 100644
--- a/hotspot/test/compiler/runtime/6826736/Test.java
+++ b/hotspot/test/compiler/runtime/Test6826736.java
@@ -27,10 +27,17 @@
  * @bug 6826736
  * @summary CMS: core dump with -XX:+UseCompressedOops
  *
- * @run main/othervm/timeout=600 -XX:+IgnoreUnrecognizedVMOptions -Xbatch -XX:+ScavengeALot -XX:+UseCompressedOops -XX:HeapBaseMinAddress=32g -XX:CompileThreshold=100 -XX:CompileOnly=Test.test -XX:-BlockLayoutRotateLoops -XX:LoopUnrollLimit=0 -Xmx256m -XX:ParallelGCThreads=4 Test
+ * @run main/othervm/timeout=600 -XX:+IgnoreUnrecognizedVMOptions -Xbatch
+ *      -XX:+ScavengeALot -XX:+UseCompressedOops -XX:HeapBaseMinAddress=32g
+ *      -XX:CompileThreshold=100 -XX:-BlockLayoutRotateLoops
+ *      -XX:LoopUnrollLimit=0 -Xmx256m -XX:ParallelGCThreads=4
+ *      -XX:CompileCommand=compileonly,compiler.runtime.Test6826736::test
+ *      compiler.runtime.Test6826736
  */
 
-public class Test {
+package compiler.runtime;
+
+public class Test6826736 {
     int[] arr;
     int[] arr2;
     int test(int r) {
@@ -50,7 +57,7 @@
 
     public static void main(String[] args) {
         int r = 0;
-        Test t = new Test();
+        Test6826736 t = new Test6826736();
         for (int i = 0; i < 100; i++) {
             t.arr = new int[100];
             r = t.test(r);
diff --git a/hotspot/test/compiler/runtime/6859338/Test6859338.java b/hotspot/test/compiler/runtime/Test6859338.java
similarity index 92%
rename from hotspot/test/compiler/runtime/6859338/Test6859338.java
rename to hotspot/test/compiler/runtime/Test6859338.java
index 7357684..b7db714 100644
--- a/hotspot/test/compiler/runtime/6859338/Test6859338.java
+++ b/hotspot/test/compiler/runtime/Test6859338.java
@@ -27,9 +27,13 @@
  * @bug 6859338
  * @summary Assertion failure in sharedRuntime.cpp
  *
- * @run main/othervm -Xcomp -XX:+IgnoreUnrecognizedVMOptions -XX:+UnlockDiagnosticVMOptions -XX:-InlineObjectHash -Xbatch -XX:-ProfileInterpreter Test6859338
+ * @run main/othervm -Xcomp -XX:+IgnoreUnrecognizedVMOptions -XX:+UnlockDiagnosticVMOptions
+ *      -XX:-InlineObjectHash -Xbatch -XX:-ProfileInterpreter
+ *      compiler.runtime.Test6859338
  */
 
+package compiler.runtime;
+
 public class Test6859338 {
     static Object[] o = new Object[] { new Object(), null };
     public static void main(String[] args) {
diff --git a/hotspot/test/compiler/runtime/6863420/Test.java b/hotspot/test/compiler/runtime/Test6863420.java
similarity index 94%
rename from hotspot/test/compiler/runtime/6863420/Test.java
rename to hotspot/test/compiler/runtime/Test6863420.java
index 11d91d3..e18035c 100644
--- a/hotspot/test/compiler/runtime/6863420/Test.java
+++ b/hotspot/test/compiler/runtime/Test6863420.java
@@ -27,11 +27,15 @@
  * @bug 6863420
  * @summary os::javaTimeNanos() go backward on Solaris x86
  *
- * Notice the internal timeout in timeout thread Test.TOT.
- * @run main/othervm/timeout=300 Test
+ * @run main/othervm/timeout=300 compiler.runtime.Test6863420
+ */
+/*
+ * Notice the internal timeout in timeout thread Test6863420.TOT.
  */
 
-public class Test {
+package compiler.runtime;
+
+public class Test6863420 {
 
     static final int INTERNAL_TIMEOUT=240;
     static class TOT extends Thread {
diff --git a/hotspot/test/compiler/runtime/Test6892265.java b/hotspot/test/compiler/runtime/Test6892265.java
new file mode 100644
index 0000000..2f6df91
--- /dev/null
+++ b/hotspot/test/compiler/runtime/Test6892265.java
@@ -0,0 +1,67 @@
+/*
+ * Copyright (c) 2009, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ *
+ */
+
+/**
+ * @test
+ * @bug 6892265
+ * @summary System.arraycopy unable to reference elements beyond Integer.MAX_VALUE bytes
+ *
+ * @run main/othervm compiler.runtime.Test6892265
+ */
+
+package compiler.runtime;
+
+public class Test6892265 {
+    static final int NCOPY = 1;
+    static final int OVERFLOW = 1;
+    static int[] src2 = new int[NCOPY];
+    static int[] dst2;
+
+    static void test() {
+        int N;
+        int SIZE;
+
+        N = Integer.MAX_VALUE / 4 + OVERFLOW;
+        System.arraycopy(src2, 0, dst2, N, NCOPY);
+        System.arraycopy(dst2, N, src2, 0, NCOPY);
+    }
+
+    public static void main(String[] args) {
+        try {
+            dst2 = new int[NCOPY + Integer.MAX_VALUE / 4 + OVERFLOW];
+        } catch (OutOfMemoryError e) {
+            System.exit(95); // Not enough memory
+        }
+        System.out.println("warmup");
+        for (int i = 0; i < 11000; i++) {
+            test();
+        }
+        System.out.println("start");
+        for (int i = 0; i < 1000; i++) {
+            test();
+        }
+        System.out.println("finish");
+    }
+
+}
diff --git a/hotspot/test/compiler/runtime/7088020/Test7088020.java b/hotspot/test/compiler/runtime/Test7088020.java
similarity index 92%
rename from hotspot/test/compiler/runtime/7088020/Test7088020.java
rename to hotspot/test/compiler/runtime/Test7088020.java
index 4ea9913..fa11ec6 100644
--- a/hotspot/test/compiler/runtime/7088020/Test7088020.java
+++ b/hotspot/test/compiler/runtime/Test7088020.java
@@ -27,11 +27,15 @@
  * @bug 7088020
  * @summary SEGV in JNIHandleBlock::release_block
  *
- * @run main Test7088020
+ * @run main compiler.runtime.Test7088020
  */
 
-import java.lang.invoke.*;
+package compiler.runtime;
 
+import java.lang.invoke.MethodHandle;
+import java.lang.invoke.MethodHandles;
+import java.lang.invoke.MethodType;
+import java.lang.invoke.WrongMethodTypeException;
 
 public class Test7088020 {
     public static boolean test() {
diff --git a/hotspot/test/compiler/runtime/Test7196199.java b/hotspot/test/compiler/runtime/Test7196199.java
new file mode 100644
index 0000000..1a83660
--- /dev/null
+++ b/hotspot/test/compiler/runtime/Test7196199.java
@@ -0,0 +1,198 @@
+/*
+ * Copyright (c) 2012, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ *
+ */
+
+/**
+ * @test
+ * @bug 7196199
+ * @summary java/text/Bidi/Bug6665028.java failed: Bidi run count incorrect
+ *
+ * @run main/othervm/timeout=400 -Xmx32m -Xbatch -XX:+IgnoreUnrecognizedVMOptions
+ *      -XX:+UnlockDiagnosticVMOptions -XX:-TieredCompilation
+ *      -XX:+SafepointALot -XX:GuaranteedSafepointInterval=100
+ *      -XX:CompileCommand=exclude,compiler.runtime.Test7196199::test
+ *      compiler.runtime.Test7196199
+ */
+
+package compiler.runtime;
+
+public class Test7196199 {
+    private static final int ARRLEN = 97;
+    private static final int ITERS = 5000;
+    private static final int INI_ITERS = 1000;
+    private static final int SFP_ITERS = 10000;
+    private static final float SFP_ITERS_F = 10000.f;
+    private static final float VALUE = 15.f;
+
+    public static void main(String args[]) {
+        int errn = test();
+        if (errn > 0) {
+            System.err.println("FAILED: " + errn + " errors");
+            System.exit(97);
+        }
+        System.out.println("PASSED");
+    }
+
+    static int test() {
+        float[] a0 = new float[ARRLEN];
+        float[] a1 = new float[ARRLEN];
+        // Initialize
+        for (int i = 0; i < ARRLEN; i++) {
+            a0[i] = 0.f;
+            a1[i] = (float) i;
+        }
+        System.out.println("Warmup");
+        for (int i = 0; i < INI_ITERS; i++) {
+            test_incrc(a0);
+            test_incrv(a0, VALUE);
+            test_addc(a0, a1);
+            test_addv(a0, a1, VALUE);
+        }
+        // Test and verify results
+        System.out.println("Verification");
+        int errn = 0;
+        for (int i = 0; i < ARRLEN; i++)
+            a0[i] = 0.f;
+
+        System.out.println("  test_incrc");
+        for (int j = 0; j < ITERS; j++) {
+            test_incrc(a0);
+            for (int i = 0; i < ARRLEN; i++) {
+                errn += verify("test_incrc: ", i, a0[i], VALUE * SFP_ITERS_F);
+                a0[i] = 0.f; // Reset
+            }
+        }
+
+        System.out.println("  test_incrv");
+        for (int j = 0; j < ITERS; j++) {
+            test_incrv(a0, VALUE);
+            for (int i = 0; i < ARRLEN; i++) {
+                errn += verify("test_incrv: ", i, a0[i], VALUE * SFP_ITERS_F);
+                a0[i] = 0.f; // Reset
+            }
+        }
+
+        System.out.println("  test_addc");
+        for (int j = 0; j < ITERS; j++) {
+            test_addc(a0, a1);
+            for (int i = 0; i < ARRLEN; i++) {
+                errn += verify("test_addc: ", i, a0[i], ((float) i + VALUE) * SFP_ITERS_F);
+                a0[i] = 0.f; // Reset
+            }
+        }
+
+        System.out.println("  test_addv");
+        for (int j = 0; j < ITERS; j++) {
+            test_addv(a0, a1, VALUE);
+            for (int i = 0; i < ARRLEN; i++) {
+                errn += verify("test_addv: ", i, a0[i], ((float) i + VALUE) * SFP_ITERS_F);
+                a0[i] = 0.f; // Reset
+            }
+        }
+
+        if (errn > 0)
+            return errn;
+
+        System.out.println("Time");
+        long start, end;
+
+        start = System.currentTimeMillis();
+        for (int i = 0; i < INI_ITERS; i++) {
+            test_incrc(a0);
+        }
+        end = System.currentTimeMillis();
+        System.out.println("test_incrc: " + (end - start));
+
+        start = System.currentTimeMillis();
+        for (int i = 0; i < INI_ITERS; i++) {
+            test_incrv(a0, VALUE);
+        }
+        end = System.currentTimeMillis();
+        System.out.println("test_incrv: " + (end - start));
+
+        start = System.currentTimeMillis();
+        for (int i = 0; i < INI_ITERS; i++) {
+            test_addc(a0, a1);
+        }
+        end = System.currentTimeMillis();
+        System.out.println("test_addc: " + (end - start));
+
+        start = System.currentTimeMillis();
+        for (int i = 0; i < INI_ITERS; i++) {
+            test_addv(a0, a1, VALUE);
+        }
+        end = System.currentTimeMillis();
+        System.out.println("test_addv: " + (end - start));
+
+        return errn;
+    }
+
+    static void test_incrc(float[] a0) {
+        // Non-counted loop with safepoint.
+        for (long l = 0; l < SFP_ITERS; l++) {
+            // Counted and vectorized loop.
+            for (int i = 0; i < a0.length; i += 1) {
+                a0[i] += VALUE;
+            }
+        }
+    }
+
+    static void test_incrv(float[] a0, float b) {
+        // Non-counted loop with safepoint.
+        for (long l = 0; l < SFP_ITERS; l++) {
+            // Counted and vectorized loop.
+            for (int i = 0; i < a0.length; i += 1) {
+                a0[i] += b;
+            }
+        }
+    }
+
+    static void test_addc(float[] a0, float[] a1) {
+        // Non-counted loop with safepoint.
+        for (long l = 0; l < SFP_ITERS; l++) {
+            // Counted and vectorized loop.
+            for (int i = 0; i < a0.length; i += 1) {
+                a0[i] += a1[i] + VALUE;
+            }
+        }
+    }
+
+    static void test_addv(float[] a0, float[] a1, float b) {
+        // Non-counted loop with safepoint.
+        for (long l = 0; l < SFP_ITERS; l++) {
+            // Counted and vectorized loop.
+            for (int i = 0; i < a0.length; i += 1) {
+                a0[i] += a1[i] + b;
+            }
+        }
+    }
+
+    static int verify(String text, int i, float elem, float val) {
+        if (elem != val) {
+            System.err.println(text + "[" + i + "] = " + elem + " != " + val);
+            return 1;
+        }
+        return 0;
+    }
+}
+
diff --git a/hotspot/test/compiler/runtime/Test8010927.java b/hotspot/test/compiler/runtime/Test8010927.java
new file mode 100644
index 0000000..64dc5ca
--- /dev/null
+++ b/hotspot/test/compiler/runtime/Test8010927.java
@@ -0,0 +1,165 @@
+/*
+ * Copyright (c) 2013, 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.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+/*
+ * @test
+ * @bug 8010927
+ * @summary Kitchensink crashed with SIGSEGV, Problematic frame: v ~StubRoutines::checkcast_arraycopy
+ * @library /test/lib /testlibrary
+ * @modules java.base/jdk.internal.misc
+ * @build compiler.runtime.Test8010927
+ * @run driver ClassFileInstaller sun.hotspot.WhiteBox
+ *                                sun.hotspot.WhiteBox$WhiteBoxPermission
+ * @run main/othervm -XX:+UnlockDiagnosticVMOptions -XX:+IgnoreUnrecognizedVMOptions
+ *                   -XX:+WhiteBoxAPI -Xbootclasspath/a:. -Xmx64m -XX:NewSize=20971520
+ *                   -XX:MaxNewSize=32m -XX:-UseTLAB -XX:-UseAdaptiveSizePolicy
+ *                   compiler.runtime.Test8010927
+ */
+
+package compiler.runtime;
+
+import jdk.internal.misc.Unsafe;
+import sun.hotspot.WhiteBox;
+
+import java.lang.reflect.Field;
+
+/**
+ * The test creates uncommitted space between oldgen and young gen
+ * by specifying MaxNewSize bigger than NewSize.
+ * NewSize = 20971520 = (512*4K) * 10 for 4k pages
+ * Then it tries to execute arraycopy() with elements type check
+ * to the array at the end of survive space near unused space.
+ */
+
+public class Test8010927 {
+
+    private static final Unsafe U;
+
+    static {
+        try {
+            Field unsafe = Unsafe.class.getDeclaredField("theUnsafe");
+            unsafe.setAccessible(true);
+            U = (Unsafe) unsafe.get(null);
+        } catch (Exception e) {
+            throw new Error(e);
+        }
+    }
+
+    public static Object[] o;
+
+    public static final boolean debug = Boolean.getBoolean("debug");
+
+    // 2 different obect arrays but same element types
+    static Test8010927[] masterA;
+    static Object[] masterB;
+    static final Test8010927 elem = new Test8010927();
+    static final WhiteBox wb = WhiteBox.getWhiteBox();
+
+    static final int obj_header_size = U.ARRAY_OBJECT_BASE_OFFSET;
+    static final int heap_oop_size = wb.getHeapOopSize();
+    static final int card_size = 512;
+    static final int one_card = (card_size - obj_header_size) / heap_oop_size;
+
+    static final int surv_size = 2112 * 1024;
+
+    // The size is big to not fit into survive space.
+    static final Object[] cache = new Object[(surv_size / card_size)];
+
+    public static void main(String[] args) {
+        masterA = new Test8010927[one_card];
+        masterB = new Object[one_card];
+        for (int i = 0; i < one_card; ++i) {
+            masterA[i] = elem;
+            masterB[i] = elem;
+        }
+
+        // Move cache[] to the old gen.
+        long low_limit = wb.getObjectAddress(cache);
+        System.gc();
+        // Move 'cache' to oldgen.
+        long upper_limit = wb.getObjectAddress(cache);
+        if ((low_limit - upper_limit) > 0) { // substaction works with unsigned values
+            // OldGen is placed before youngger for ParallelOldGC.
+            upper_limit = low_limit + 21000000l; // +20971520
+        }
+        // Each A[one_card] size is 512 bytes,
+        // it will take about 40000 allocations to trigger GC.
+        // cache[] has 8192 elements so GC should happen
+        // each 5th iteration.
+        for (long l = 0; l < 20; l++) {
+            fill_heap();
+            if (debug) {
+                System.out.println("test oop_disjoint_arraycopy");
+            }
+            testA_arraycopy();
+            if (debug) {
+                System.out.println("test checkcast_arraycopy");
+            }
+            testB_arraycopy();
+            // Execute arraycopy to the topmost array in young gen
+            if (debug) {
+                int top_index = get_top_address(low_limit, upper_limit);
+                if (top_index >= 0) {
+                    long addr = wb.getObjectAddress(cache[top_index]);
+                    System.out.println("top_addr: 0x" + Long.toHexString(addr) + ", 0x" + Long.toHexString(addr + 512));
+                }
+            }
+        }
+    }
+
+    static void fill_heap() {
+        for (int i = 0; i < cache.length; ++i) {
+            o = new Test8010927[one_card];
+            System.arraycopy(masterA, 0, o, 0, masterA.length);
+            cache[i] = o;
+        }
+        for (long j = 0; j < 256; ++j) {
+            o = new Long[10000]; // to trigger GC
+        }
+    }
+
+    static void testA_arraycopy() {
+        for (int i = 0; i < cache.length; ++i) {
+            System.arraycopy(masterA, 0, cache[i], 0, masterA.length);
+        }
+    }
+
+    static void testB_arraycopy() {
+        for (int i = 0; i < cache.length; ++i) {
+            System.arraycopy(masterB, 0, cache[i], 0, masterB.length);
+        }
+    }
+
+    static int get_top_address(long min, long max) {
+        int index = -1;
+        long addr = min;
+        for (int i = 0; i < cache.length; ++i) {
+            long test = wb.getObjectAddress(cache[i]);
+            if (((test - addr) > 0) && ((max - test) > 0)) { // substaction works with unsigned values
+                addr = test;
+                index = i;
+            }
+        }
+        return index;
+    }
+}
diff --git a/hotspot/test/compiler/runtime/6891750/Test6891750.java b/hotspot/test/compiler/runtime/cr6891750/Test6891750.java
similarity index 96%
rename from hotspot/test/compiler/runtime/6891750/Test6891750.java
rename to hotspot/test/compiler/runtime/cr6891750/Test6891750.java
index 05381e8..a375639 100644
--- a/hotspot/test/compiler/runtime/6891750/Test6891750.java
+++ b/hotspot/test/compiler/runtime/cr6891750/Test6891750.java
@@ -26,10 +26,11 @@
  * @test
  * @bug 6891750
  * @summary deopt blob kills values in O5
- *
- * @run main Test6891750
+ * @run main compiler.runtime.cr6891750.Test6891750
  */
 
+package compiler.runtime.cr6891750;
+
 abstract class Base6891750 extends Thread {
     abstract public long m();
 }
diff --git a/hotspot/test/compiler/runtime/8015436/Test8015436.java b/hotspot/test/compiler/runtime/cr8015436/Test8015436.java
similarity index 92%
rename from hotspot/test/compiler/runtime/8015436/Test8015436.java
rename to hotspot/test/compiler/runtime/cr8015436/Test8015436.java
index 268e04a..8c70624 100644
--- a/hotspot/test/compiler/runtime/8015436/Test8015436.java
+++ b/hotspot/test/compiler/runtime/cr8015436/Test8015436.java
@@ -25,8 +25,8 @@
  * @test
  * @bug 8015436
  * @summary the IK _initial_method_idnum value must be adjusted if overpass methods are added
- * @run main Test8015436
  *
+ * @run main compiler.runtime.cr8015436.Test8015436
  */
 
 /*
@@ -38,15 +38,11 @@
  * All the invocations of the defaultMethod() must be completed successfully.
  */
 
-import java.lang.invoke.*;
+package compiler.runtime.cr8015436;
 
-interface InterfaceWithDefaultMethod {
-    public void someMethod();
-
-    default public void defaultMethod(String str){
-        System.out.println("defaultMethod() " + str);
-    }
-}
+import java.lang.invoke.MethodHandle;
+import java.lang.invoke.MethodHandles;
+import java.lang.invoke.MethodType;
 
 public class Test8015436 implements InterfaceWithDefaultMethod {
     @Override
@@ -66,6 +62,13 @@
     }
 }
 
+interface InterfaceWithDefaultMethod {
+    public void someMethod();
+
+    default public void defaultMethod(String str){
+        System.out.println("defaultMethod() " + str);
+    }
+}
 /*
  * A successful execution gives the output:
  *   someMethod() invoked
diff --git a/hotspot/test/compiler/runtime/safepoints/TestRegisterRestoring.java b/hotspot/test/compiler/runtime/safepoints/TestRegisterRestoring.java
index 08c2cb7..07b1542 100644
--- a/hotspot/test/compiler/runtime/safepoints/TestRegisterRestoring.java
+++ b/hotspot/test/compiler/runtime/safepoints/TestRegisterRestoring.java
@@ -27,36 +27,43 @@
  * @test
  * @bug 8148490
  * @summary Test correct saving and restoring of vector registers at safepoints.
- * @run main/othervm -XX:+IgnoreUnrecognizedVMOptions -Xbatch -XX:-TieredCompilation -XX:CompileCommand=exclude,TestRegisterRestoring::main -XX:+SafepointALot TestRegisterRestoring
+ *
+ * @run main/othervm -XX:+IgnoreUnrecognizedVMOptions -Xbatch -XX:-TieredCompilation
+ *                   -XX:+SafepointALot
+ *                   -XX:CompileCommand=exclude,compiler.runtime.safepoints.TestRegisterRestoring::main
+ *                   compiler.runtime.safepoints.TestRegisterRestoring
  */
-public class TestRegisterRestoring {
-  public static void main(String args[]) throws Exception {
-    // Initialize
-    float[] array = new float[100];
-    for (int i = 0; i < array.length; ++i) {
-      array[i] = 0;
-    }
-    // Test
-    for (int j = 0; j < 20_000; ++j) {
-      increment(array);
-      // Check result
-      for (int i = 0; i < array.length; i++) {
-        if (array[i] != 10_000) {
-          throw new RuntimeException("Test failed: array[" + i + "] = " + array[i] + " but should be 10.000");
-        }
-        array[i] = 0;
-      }
-    }
-  }
 
-  static void increment(float[] array) {
-    // Loop with safepoint
-    for (long l = 0; l < 10_000; l++) {
-      // Vectorized loop
-      for (int i = 0; i < array.length; ++i) {
-        array[i] += 1;
-      }
+package compiler.runtime.safepoints;
+
+public class TestRegisterRestoring {
+    public static void main(String args[]) throws Exception {
+        // Initialize
+        float[] array = new float[100];
+        for (int i = 0; i < array.length; ++i) {
+            array[i] = 0;
+        }
+        // Test
+        for (int j = 0; j < 20_000; ++j) {
+            increment(array);
+            // Check result
+            for (int i = 0; i < array.length; i++) {
+                if (array[i] != 10_000) {
+                    throw new RuntimeException("Test failed: array[" + i + "] = " + array[i] + " but should be 10.000");
+                }
+                array[i] = 0;
+            }
+        }
     }
-  }
+
+    static void increment(float[] array) {
+        // Loop with safepoint
+        for (long l = 0; l < 10_000; l++) {
+            // Vectorized loop
+            for (int i = 0; i < array.length; ++i) {
+                array[i] += 1;
+            }
+        }
+    }
 }
 
diff --git a/hotspot/test/compiler/stable/StableConfiguration.java b/hotspot/test/compiler/stable/StableConfiguration.java
index 6f11dcd..dc608df 100644
--- a/hotspot/test/compiler/stable/StableConfiguration.java
+++ b/hotspot/test/compiler/stable/StableConfiguration.java
@@ -27,8 +27,6 @@
 
 import sun.hotspot.WhiteBox;
 
-import java.lang.reflect.Method;
-
 public class StableConfiguration {
     static final WhiteBox WB = WhiteBox.getWhiteBox();
     public static final boolean isStableEnabled;
diff --git a/hotspot/test/compiler/stable/TestStableBoolean.java b/hotspot/test/compiler/stable/TestStableBoolean.java
index 0e9f7bc..dbb9705 100644
--- a/hotspot/test/compiler/stable/TestStableBoolean.java
+++ b/hotspot/test/compiler/stable/TestStableBoolean.java
@@ -58,6 +58,7 @@
 package compiler.stable;
 
 import jdk.internal.vm.annotation.Stable;
+
 import java.lang.reflect.InvocationTargetException;
 
 public class TestStableBoolean {
diff --git a/hotspot/test/compiler/stable/TestStableByte.java b/hotspot/test/compiler/stable/TestStableByte.java
index 46f4711..5561b4b 100644
--- a/hotspot/test/compiler/stable/TestStableByte.java
+++ b/hotspot/test/compiler/stable/TestStableByte.java
@@ -58,6 +58,7 @@
 package compiler.stable;
 
 import jdk.internal.vm.annotation.Stable;
+
 import java.lang.reflect.InvocationTargetException;
 
 public class TestStableByte {
diff --git a/hotspot/test/compiler/stable/TestStableChar.java b/hotspot/test/compiler/stable/TestStableChar.java
index 95c95c1..8a1f51e 100644
--- a/hotspot/test/compiler/stable/TestStableChar.java
+++ b/hotspot/test/compiler/stable/TestStableChar.java
@@ -57,9 +57,10 @@
 
 package compiler.stable;
 
-import java.lang.reflect.InvocationTargetException;
 import jdk.internal.vm.annotation.Stable;
 
+import java.lang.reflect.InvocationTargetException;
+
 public class TestStableChar {
     static final boolean isStableEnabled    = StableConfiguration.isStableEnabled;
 
diff --git a/hotspot/test/compiler/stable/TestStableDouble.java b/hotspot/test/compiler/stable/TestStableDouble.java
index 34a3df6..ff96b2c 100644
--- a/hotspot/test/compiler/stable/TestStableDouble.java
+++ b/hotspot/test/compiler/stable/TestStableDouble.java
@@ -57,9 +57,10 @@
 
 package compiler.stable;
 
-import java.lang.reflect.InvocationTargetException;
 import jdk.internal.vm.annotation.Stable;
 
+import java.lang.reflect.InvocationTargetException;
+
 public class TestStableDouble {
     static final boolean isStableEnabled    = StableConfiguration.isStableEnabled;
 
diff --git a/hotspot/test/compiler/stable/TestStableFloat.java b/hotspot/test/compiler/stable/TestStableFloat.java
index 0f9fc97..ab879c5 100644
--- a/hotspot/test/compiler/stable/TestStableFloat.java
+++ b/hotspot/test/compiler/stable/TestStableFloat.java
@@ -58,6 +58,7 @@
 package compiler.stable;
 
 import jdk.internal.vm.annotation.Stable;
+
 import java.lang.reflect.InvocationTargetException;
 
 public class TestStableFloat {
diff --git a/hotspot/test/compiler/stable/TestStableInt.java b/hotspot/test/compiler/stable/TestStableInt.java
index 4da1d89..e203a26 100644
--- a/hotspot/test/compiler/stable/TestStableInt.java
+++ b/hotspot/test/compiler/stable/TestStableInt.java
@@ -58,6 +58,7 @@
 package compiler.stable;
 
 import jdk.internal.vm.annotation.Stable;
+
 import java.lang.reflect.InvocationTargetException;
 
 public class TestStableInt {
diff --git a/hotspot/test/compiler/stable/TestStableLong.java b/hotspot/test/compiler/stable/TestStableLong.java
index dfbf93b..11e6a95 100644
--- a/hotspot/test/compiler/stable/TestStableLong.java
+++ b/hotspot/test/compiler/stable/TestStableLong.java
@@ -58,6 +58,7 @@
 package compiler.stable;
 
 import jdk.internal.vm.annotation.Stable;
+
 import java.lang.reflect.InvocationTargetException;
 
 public class TestStableLong {
diff --git a/hotspot/test/compiler/stable/TestStableMemoryBarrier.java b/hotspot/test/compiler/stable/TestStableMemoryBarrier.java
index 4a421c6..7837202 100644
--- a/hotspot/test/compiler/stable/TestStableMemoryBarrier.java
+++ b/hotspot/test/compiler/stable/TestStableMemoryBarrier.java
@@ -27,8 +27,6 @@
  * @test TestStableMemoryBarrier
  * @bug 8139758
  * @summary tests memory barrier correctly inserted for stable fields
- * @library /testlibrary /test/lib
- * @modules java.base/jdk.internal.misc
  * @modules java.base/jdk.internal.vm.annotation
  *
  * @run main/bootclasspath/othervm -Xcomp -XX:CompileOnly=::testCompile
diff --git a/hotspot/test/compiler/stable/TestStableMismatched.java b/hotspot/test/compiler/stable/TestStableMismatched.java
index a71ee78..57578fc 100644
--- a/hotspot/test/compiler/stable/TestStableMismatched.java
+++ b/hotspot/test/compiler/stable/TestStableMismatched.java
@@ -26,13 +26,17 @@
  * @test TestStableMismatched
  * @bug 8158228
  * @summary Tests if mismatched char load from stable byte[] returns correct result
+ *
  * @run main/othervm -XX:-CompactStrings -XX:TieredStopAtLevel=1 -Xcomp
- *                   -XX:CompileOnly=TestStableMismatched::test,::charAt
- *                   TestStableMismatched
+ *                   -XX:CompileOnly=compiler.stable.TestStableMismatched::test,::charAt
+ *                   compiler.stable.TestStableMismatched
  * @run main/othervm -XX:-CompactStrings -XX:-TieredCompilation -Xcomp
- *                   -XX:CompileOnly=TestStableMismatched::test,::charAt
- *                   TestStableMismatched
+ *                   -XX:CompileOnly=compiler.stable.TestStableMismatched::test,::charAt
+ *                   compiler.stable.TestStableMismatched
  */
+
+package compiler.stable;
+
 public class TestStableMismatched {
     public static void main(String args[]) {
         test();
diff --git a/hotspot/test/compiler/stable/TestStableObject.java b/hotspot/test/compiler/stable/TestStableObject.java
index 1ad6b68..58affb9 100644
--- a/hotspot/test/compiler/stable/TestStableObject.java
+++ b/hotspot/test/compiler/stable/TestStableObject.java
@@ -58,6 +58,7 @@
 package compiler.stable;
 
 import jdk.internal.vm.annotation.Stable;
+
 import java.lang.reflect.InvocationTargetException;
 
 public class TestStableObject {
diff --git a/hotspot/test/compiler/stable/TestStableShort.java b/hotspot/test/compiler/stable/TestStableShort.java
index acd8182..d893f8d 100644
--- a/hotspot/test/compiler/stable/TestStableShort.java
+++ b/hotspot/test/compiler/stable/TestStableShort.java
@@ -58,6 +58,7 @@
 package compiler.stable;
 
 import jdk.internal.vm.annotation.Stable;
+
 import java.lang.reflect.InvocationTargetException;
 
 public class TestStableShort {
diff --git a/hotspot/test/compiler/stable/TestStableUByte.java b/hotspot/test/compiler/stable/TestStableUByte.java
index 788feca..5431345 100644
--- a/hotspot/test/compiler/stable/TestStableUByte.java
+++ b/hotspot/test/compiler/stable/TestStableUByte.java
@@ -57,8 +57,8 @@
  *                                 -XX:-FoldStableValues
  *                                 -XX:CompileOnly=::get,::get1
  *                                 compiler.stable.TestStableUByte
- *
  */
+
 package compiler.stable;
 
 import jdk.internal.vm.annotation.Stable;
diff --git a/hotspot/test/compiler/stable/TestStableUShort.java b/hotspot/test/compiler/stable/TestStableUShort.java
index 43ebf3c..88f5cb4 100644
--- a/hotspot/test/compiler/stable/TestStableUShort.java
+++ b/hotspot/test/compiler/stable/TestStableUShort.java
@@ -57,8 +57,8 @@
  *                                 -XX:-FoldStableValues
  *                                 -XX:CompileOnly=::get,::get1
  *                                 compiler.stable.TestStableUShort
- *
  */
+
 package compiler.stable;
 
 import jdk.internal.vm.annotation.Stable;
diff --git a/hotspot/test/compiler/startup/NumCompilerThreadsCheck.java b/hotspot/test/compiler/startup/NumCompilerThreadsCheck.java
index 1eebffc..7abfc63 100644
--- a/hotspot/test/compiler/startup/NumCompilerThreadsCheck.java
+++ b/hotspot/test/compiler/startup/NumCompilerThreadsCheck.java
@@ -28,8 +28,15 @@
  * @library /testlibrary
  * @modules java.base/jdk.internal.misc
  *          java.management
+ *
+ * @run driver compiler.startup.NumCompilerThreadsCheck
  */
-import jdk.test.lib.*;
+
+package compiler.startup;
+
+import jdk.test.lib.OutputAnalyzer;
+import jdk.test.lib.Platform;
+import jdk.test.lib.ProcessTools;
 
 public class NumCompilerThreadsCheck {
 
diff --git a/hotspot/test/compiler/startup/SmallCodeCacheStartup.java b/hotspot/test/compiler/startup/SmallCodeCacheStartup.java
index fbab262..2ff6437 100644
--- a/hotspot/test/compiler/startup/SmallCodeCacheStartup.java
+++ b/hotspot/test/compiler/startup/SmallCodeCacheStartup.java
@@ -23,7 +23,6 @@
 
 /*
  * @test
- * @ignore 8134286
  * @bug 8023014
  * @summary Test ensures that there is no crash if there is not enough ReservedCodeCacheSize
  *          to initialize all compiler threads. The option -Xcomp gives the VM more time to
@@ -31,8 +30,16 @@
  * @library /testlibrary
  * @modules java.base/jdk.internal.misc
  *          java.management
+ *
+ * @ignore 8134286
+ * @run driver compiler.startup.SmallCodeCacheStartup
  */
-import jdk.test.lib.*;
+
+package compiler.startup;
+
+import jdk.test.lib.OutputAnalyzer;
+import jdk.test.lib.ProcessTools;
+
 import static jdk.test.lib.Asserts.assertTrue;
 
 public class SmallCodeCacheStartup {
diff --git a/hotspot/test/compiler/startup/StartupOutput.java b/hotspot/test/compiler/startup/StartupOutput.java
index 5d15e40..b8cd315 100644
--- a/hotspot/test/compiler/startup/StartupOutput.java
+++ b/hotspot/test/compiler/startup/StartupOutput.java
@@ -28,18 +28,24 @@
  * @library /testlibrary
  * @modules java.base/jdk.internal.misc
  *          java.management
+ *
+ * @run driver compiler.startup.StartupOutput
  */
-import jdk.test.lib.*;
+
+package compiler.startup;
+
+import jdk.test.lib.OutputAnalyzer;
+import jdk.test.lib.ProcessTools;
 
 public class StartupOutput {
-  public static void main(String[] args) throws Exception {
-    ProcessBuilder pb;
-    OutputAnalyzer out;
+    public static void main(String[] args) throws Exception {
+        ProcessBuilder pb;
+        OutputAnalyzer out;
 
-    pb = ProcessTools.createJavaProcessBuilder("-Xint", "-XX:+DisplayVMOutputToStdout", "-version");
-    out = new OutputAnalyzer(pb.start());
-    out.shouldNotContain("no space to run compilers");
+        pb = ProcessTools.createJavaProcessBuilder("-Xint", "-XX:+DisplayVMOutputToStdout", "-version");
+        out = new OutputAnalyzer(pb.start());
+        out.shouldNotContain("no space to run compilers");
 
-    out.shouldHaveExitValue(0);
-  }
+        out.shouldHaveExitValue(0);
+    }
 }
diff --git a/hotspot/test/compiler/startup/TieredStopAtLevel0SanityTest.java b/hotspot/test/compiler/startup/TieredStopAtLevel0SanityTest.java
index a7dbf2b..2dbce93 100644
--- a/hotspot/test/compiler/startup/TieredStopAtLevel0SanityTest.java
+++ b/hotspot/test/compiler/startup/TieredStopAtLevel0SanityTest.java
@@ -25,9 +25,13 @@
  * @test
  * @bug 8154151
  * @summary Sanity test flag combo that force compiles on level 0
- * @run main/othervm -Xcomp -XX:+UnlockDiagnosticVMOptions -XX:TieredStopAtLevel=0 TieredStopAtLevel0SanityTest
+ *
+ * @run main/othervm -Xcomp -XX:+UnlockDiagnosticVMOptions -XX:TieredStopAtLevel=0
+ *                   compiler.startup.TieredStopAtLevel0SanityTest
  */
 
+package compiler.startup;
+
 public class TieredStopAtLevel0SanityTest {
     public static void main(String[] args) throws Exception {
         System.out.println("Hello world!");
diff --git a/hotspot/test/compiler/stringopts/TestOptimizeStringConcat.java b/hotspot/test/compiler/stringopts/TestOptimizeStringConcat.java
index 2f0ec3c..1f14cee 100644
--- a/hotspot/test/compiler/stringopts/TestOptimizeStringConcat.java
+++ b/hotspot/test/compiler/stringopts/TestOptimizeStringConcat.java
@@ -26,9 +26,14 @@
  * @bug 8068909
  * @key regression
  * @summary test that string optimizations produce code, that doesn't lead to a crash.
- * @run main/othervm -XX:-BackgroundCompilation -XX:-UseOnStackReplacement TestOptimizeStringConcat
+ *
+ * @run main/othervm -XX:-BackgroundCompilation -XX:-UseOnStackReplacement
+ *                   compiler.stringopts.TestOptimizeStringConcat
  * @author axel.siebenborn@sap.com
  */
+
+package compiler.stringopts;
+
 public class TestOptimizeStringConcat {
 
     static boolean checkArgumentSyntax(String value, String allowedchars, String notallowedchars, String logmsg) {
diff --git a/hotspot/test/compiler/stringopts/TestStringObjectInitialization.java b/hotspot/test/compiler/stringopts/TestStringObjectInitialization.java
index 2d09be1..b25c225 100644
--- a/hotspot/test/compiler/stringopts/TestStringObjectInitialization.java
+++ b/hotspot/test/compiler/stringopts/TestStringObjectInitialization.java
@@ -22,19 +22,26 @@
  */
 
 
-import java.util.Arrays;
+
 
 /*
  * @test
  * @bug 8159244
- * @requires vm.gc == "Parallel" | vm.gc == "null"
  * @summary Verifies that no partially initialized String object escapes from
  *          C2's String concat optimization in a highly concurrent setting.
  *          This test triggers the bug in about 1 out of 10 runs.
+ * @requires vm.gc == "Parallel" | vm.gc == "null"
+ *
  * @compile -XDstringConcat=inline TestStringObjectInitialization.java
  * @run main/othervm/timeout=300 -XX:+IgnoreUnrecognizedVMOptions -XX:-UseCompressedOops -XX:-CompactStrings
- *                               -XX:-UseG1GC -XX:+UseParallelGC TestStringObjectInitialization
+ *                               -XX:-UseG1GC -XX:+UseParallelGC
+ *                               compiler.stringopts.TestStringObjectInitialization
  */
+
+package compiler.stringopts;
+
+import java.util.Arrays;
+
 public class TestStringObjectInitialization {
 
     String myString;
@@ -59,19 +66,19 @@
         // Trigger C2's string concatenation optimization
         add(s + Arrays.toString(sArray) + " const ");
     }
-}
 
-class Runner implements Runnable {
-    private TestStringObjectInitialization test;
+    private static class Runner implements Runnable {
+        private TestStringObjectInitialization test;
 
-    public Runner(TestStringObjectInitialization t) {
-        test = t;
-    }
+        public Runner(TestStringObjectInitialization t) {
+            test = t;
+        }
 
-    public void run(){
-        String[] array = {"a", "b", "c"};
-        for (int i = 0; i < 10000; ++i) {
-            test.run("a", array);
+        public void run() {
+            String[] array = {"a", "b", "c"};
+            for (int i = 0; i < 10000; ++i) {
+                test.run("a", array);
+            }
         }
     }
 }
diff --git a/hotspot/test/compiler/testlibrary/CompilerUtils.java b/hotspot/test/compiler/testlibrary/CompilerUtils.java
index 3af7e76..fea72bd 100644
--- a/hotspot/test/compiler/testlibrary/CompilerUtils.java
+++ b/hotspot/test/compiler/testlibrary/CompilerUtils.java
@@ -23,11 +23,13 @@
 
 package compiler.testlibrary;
 
+import java.util.Arrays;
 import jdk.test.lib.Asserts;
 import jdk.test.lib.Platform;
-import java.util.stream.IntStream;
 import sun.hotspot.WhiteBox;
 
+import java.util.stream.IntStream;
+
 public class CompilerUtils {
 
     private CompilerUtils() {
@@ -60,4 +62,14 @@
         }
         return new int[0];
     }
+
+    /**
+     * Returns maximum compilation level available
+     * @return an int value representing maximum compilation level available
+     */
+    public static int getMaxCompilationLevel() {
+        return Arrays.stream(getAvailableCompilationLevels())
+                .max()
+                .getAsInt();
+    }
 }
diff --git a/hotspot/test/compiler/testlibrary/rtm/AbortProvoker.java b/hotspot/test/compiler/testlibrary/rtm/AbortProvoker.java
index c7ae7f4..37b7ff6 100644
--- a/hotspot/test/compiler/testlibrary/rtm/AbortProvoker.java
+++ b/hotspot/test/compiler/testlibrary/rtm/AbortProvoker.java
@@ -24,13 +24,13 @@
 
 package compiler.testlibrary.rtm;
 
+import jdk.test.lib.Asserts;
+import sun.hotspot.WhiteBox;
+
 import java.util.Objects;
 import java.util.concurrent.BrokenBarrierException;
 import java.util.concurrent.CyclicBarrier;
 
-import jdk.test.lib.Asserts;
-import sun.hotspot.WhiteBox;
-
 /**
  * Base class for different transactional execution abortion
  * provokers aimed to force abort due to specified reason.
diff --git a/hotspot/test/compiler/testlibrary/rtm/RTMLockingStatistics.java b/hotspot/test/compiler/testlibrary/rtm/RTMLockingStatistics.java
index bf8598d..a558492 100644
--- a/hotspot/test/compiler/testlibrary/rtm/RTMLockingStatistics.java
+++ b/hotspot/test/compiler/testlibrary/rtm/RTMLockingStatistics.java
@@ -28,8 +28,8 @@
 import java.util.LinkedList;
 import java.util.List;
 import java.util.Map;
-import java.util.regex.Pattern;
 import java.util.regex.Matcher;
+import java.util.regex.Pattern;
 
 /**
  * Wrapper for +UsePreciseRTMLockingStatistics output.
diff --git a/hotspot/test/compiler/testlibrary/rtm/RTMTestBase.java b/hotspot/test/compiler/testlibrary/rtm/RTMTestBase.java
index f608d00..65cbf0a 100644
--- a/hotspot/test/compiler/testlibrary/rtm/RTMTestBase.java
+++ b/hotspot/test/compiler/testlibrary/rtm/RTMTestBase.java
@@ -24,21 +24,21 @@
 
 package compiler.testlibrary.rtm;
 
-import java.io.IOException;
-import java.nio.file.Files;
-import java.nio.file.Paths;
-import java.util.List;
-import java.util.LinkedList;
-import java.util.Arrays;
-import java.util.Collections;
-import java.util.regex.Matcher;
-import java.util.regex.Pattern;
-
 import jdk.test.lib.OutputAnalyzer;
 import jdk.test.lib.ProcessTools;
 import jdk.test.lib.Utils;
 import jdk.test.lib.cli.CommandLineOptionTest;
 
+import java.io.IOException;
+import java.nio.file.Files;
+import java.nio.file.Paths;
+import java.util.Arrays;
+import java.util.Collections;
+import java.util.LinkedList;
+import java.util.List;
+import java.util.regex.Matcher;
+import java.util.regex.Pattern;
+
 /**
  * Auxiliary methods used for RTM testing.
  */
diff --git a/hotspot/test/compiler/testlibrary/rtm/XAbortProvoker.java b/hotspot/test/compiler/testlibrary/rtm/XAbortProvoker.java
index 6bab4cd..b7891ee 100644
--- a/hotspot/test/compiler/testlibrary/rtm/XAbortProvoker.java
+++ b/hotspot/test/compiler/testlibrary/rtm/XAbortProvoker.java
@@ -24,8 +24,8 @@
 
 package compiler.testlibrary.rtm;
 
-import jdk.test.lib.Utils;
 import jdk.internal.misc.Unsafe;
+import jdk.test.lib.Utils;
 
 /**
  * Current RTM locking implementation force transaction abort
diff --git a/hotspot/test/compiler/testlibrary/rtm/predicate/SupportedCPU.java b/hotspot/test/compiler/testlibrary/rtm/predicate/SupportedCPU.java
index 8796d79..d634727 100644
--- a/hotspot/test/compiler/testlibrary/rtm/predicate/SupportedCPU.java
+++ b/hotspot/test/compiler/testlibrary/rtm/predicate/SupportedCPU.java
@@ -24,12 +24,11 @@
 
 package compiler.testlibrary.rtm.predicate;
 
+import jdk.test.lib.Platform;
 import sun.hotspot.cpuinfo.CPUInfo;
 
 import java.util.function.BooleanSupplier;
 
-import jdk.test.lib.Platform;
-
 public class SupportedCPU implements BooleanSupplier {
     @Override
     public boolean getAsBoolean() {
diff --git a/hotspot/test/compiler/testlibrary/rtm/predicate/SupportedVM.java b/hotspot/test/compiler/testlibrary/rtm/predicate/SupportedVM.java
index 352b4e9..5f2c002 100644
--- a/hotspot/test/compiler/testlibrary/rtm/predicate/SupportedVM.java
+++ b/hotspot/test/compiler/testlibrary/rtm/predicate/SupportedVM.java
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2014, 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2014, 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
@@ -31,6 +31,6 @@
 public class SupportedVM implements BooleanSupplier {
     @Override
     public boolean getAsBoolean() {
-        return Platform.isServer() && !Platform.isEmbedded();
+        return Platform.isServer();
     }
 }
diff --git a/hotspot/test/compiler/testlibrary/uncommontrap/Verifier.java b/hotspot/test/compiler/testlibrary/uncommontrap/Verifier.java
index c22db58..31ccc34 100644
--- a/hotspot/test/compiler/testlibrary/uncommontrap/Verifier.java
+++ b/hotspot/test/compiler/testlibrary/uncommontrap/Verifier.java
@@ -23,6 +23,8 @@
 
 package compiler.testlibrary.uncommontrap;
 
+import jdk.test.lib.Asserts;
+
 import java.io.FileReader;
 import java.io.IOException;
 import java.nio.file.Files;
@@ -33,8 +35,6 @@
 import java.util.Properties;
 import java.util.regex.Pattern;
 
-import jdk.test.lib.Asserts;
-
 /**
  * Utility tool aimed to verify presence or absence of specified uncommon trap
  * in compilation log.
diff --git a/hotspot/test/compiler/tiered/CompLevelsTest.java b/hotspot/test/compiler/tiered/CompLevelsTest.java
index 3aa5ba1..a084110 100644
--- a/hotspot/test/compiler/tiered/CompLevelsTest.java
+++ b/hotspot/test/compiler/tiered/CompLevelsTest.java
@@ -27,6 +27,8 @@
  * @author igor.ignatyev@oracle.com
  */
 
+package compiler.tiered;
+
 import compiler.whitebox.CompilerWhiteBoxTest;
 
 public abstract class CompLevelsTest extends CompilerWhiteBoxTest {
diff --git a/hotspot/test/compiler/tiered/ConstantGettersTransitionsTest.java b/hotspot/test/compiler/tiered/ConstantGettersTransitionsTest.java
index 4c6e972..6393f5c 100644
--- a/hotspot/test/compiler/tiered/ConstantGettersTransitionsTest.java
+++ b/hotspot/test/compiler/tiered/ConstantGettersTransitionsTest.java
@@ -23,21 +23,27 @@
 
 /**
  * @test ConstantGettersTransitionsTest
+ * @summary Test the correctness of compilation level transitions for constant getters methods
  * @library /testlibrary /test/lib /
  * @modules java.base/jdk.internal.misc
  *          java.management
- * @build TransitionsTestExecutor ConstantGettersTransitionsTest
+ *
+ * @build compiler.tiered.TransitionsTestExecutor
+ *        compiler.tiered.ConstantGettersTransitionsTest
  * @run driver ClassFileInstaller sun.hotspot.WhiteBox sun.hotspot.WhiteBox$WhiteBoxPermission
  * @run main/othervm/timeout=240 -Xmixed -Xbootclasspath/a:. -XX:+UnlockDiagnosticVMOptions
- *                   -XX:+WhiteBoxAPI -XX:+TieredCompilation -XX:-UseCounterDecay
- *                   -XX:CompileCommand=compileonly,ConstantGettersTestCase$TrivialMethods::*
- *                   TransitionsTestExecutor ConstantGettersTransitionsTest
- * @summary Test the correctness of compilation level transitions for constant getters methods
+ *      -XX:+WhiteBoxAPI -XX:+TieredCompilation -XX:-UseCounterDecay
+ *      -XX:CompileCommand=compileonly,compiler.tiered.ConstantGettersTransitionsTest$ConstantGettersTestCase$TrivialMethods::*
+ *      compiler.tiered.TransitionsTestExecutor
+ *      compiler.tiered.ConstantGettersTransitionsTest
  */
 
+package compiler.tiered;
+
+import compiler.whitebox.CompilerWhiteBoxTest;
+
 import java.lang.reflect.Executable;
 import java.util.concurrent.Callable;
-import compiler.whitebox.CompilerWhiteBoxTest;
 
 public class ConstantGettersTransitionsTest extends LevelTransitionTest {
     public static void main(String[] args) {
@@ -57,141 +63,141 @@
     private ConstantGettersTransitionsTest(TestCase testCase) {
         super(testCase);
     }
-}
 
-enum ConstantGettersTestCase implements CompilerWhiteBoxTest.TestCase {
-    ICONST_M1,
-    ICONST_0,
-    ICONST_1,
-    ICONST_2,
-    ICONST_3,
-    ICONST_4,
-    ICONST_5,
-    LCONST_0,
-    LCONST_1,
-    FCONST_0,
-    FCONST_1,
-    FCONST_2,
-    DCONST_0,
-    DCONST_1,
-    DCONST_W,
-    BYTE,
-    SHORT,
-    CHAR;
+    private static enum ConstantGettersTestCase implements CompilerWhiteBoxTest.TestCase {
+        ICONST_M1,
+        ICONST_0,
+        ICONST_1,
+        ICONST_2,
+        ICONST_3,
+        ICONST_4,
+        ICONST_5,
+        LCONST_0,
+        LCONST_1,
+        FCONST_0,
+        FCONST_1,
+        FCONST_2,
+        DCONST_0,
+        DCONST_1,
+        DCONST_W,
+        BYTE,
+        SHORT,
+        CHAR;
 
-    private final Executable executable;
-    private final Callable<Integer> callable;
+        private final Executable executable;
+        private final Callable<Integer> callable;
 
-    @Override
-    public Executable getExecutable() {
-        return executable;
-    }
-
-    @Override
-    public Callable<Integer> getCallable() {
-        return callable;
-    }
-
-    @Override
-    public boolean isOsr() {
-        return false;
-    }
-
-    private ConstantGettersTestCase() {
-        String name = "make" + this.name();
-        this.executable = LevelTransitionTest.Helper.getMethod(TrivialMethods.class, name);
-        this.callable = LevelTransitionTest.Helper.getCallable(new TrivialMethods(), name);
-    }
-
-    /**
-     * Contains methods that load constants with certain types of bytecodes
-     * See JVMS 2.11.2. Load and Store Instructions
-     * Note that it doesn't have a method for ldc_w instruction
-     */
-    private static class TrivialMethods {
-        public static int makeICONST_M1() {
-            return -1;
+        @Override
+        public Executable getExecutable() {
+            return executable;
         }
 
-        public static int makeICONST_0() {
-            return 0;
+        @Override
+        public Callable<Integer> getCallable() {
+            return callable;
         }
 
-        public static int makeICONST_1() {
-            return 1;
+        @Override
+        public boolean isOsr() {
+            return false;
         }
 
-        public static int makeICONST_2() {
-            return 2;
+        private ConstantGettersTestCase() {
+            String name = "make" + this.name();
+            this.executable = LevelTransitionTest.Helper.getMethod(TrivialMethods.class, name);
+            this.callable = LevelTransitionTest.Helper.getCallable(new TrivialMethods(), name);
         }
 
-        public static int makeICONST_3() {
-            return 3;
-        }
+        /**
+         * Contains methods that load constants with certain types of bytecodes
+         * See JVMS 2.11.2. Load and Store Instructions
+         * Note that it doesn't have a method for ldc_w instruction
+         */
+        private static class TrivialMethods {
+            public static int makeICONST_M1() {
+                return -1;
+            }
 
-        public static int makeICONST_4() {
-            return 4;
-        }
+            public static int makeICONST_0() {
+                return 0;
+            }
 
-        public static int makeICONST_5() {
-            return 5;
-        }
+            public static int makeICONST_1() {
+                return 1;
+            }
 
-        public static long makeLCONST_0() {
-            return 0L;
-        }
+            public static int makeICONST_2() {
+                return 2;
+            }
 
-        public static long makeLCONST_1() {
-            return 1L;
-        }
+            public static int makeICONST_3() {
+                return 3;
+            }
 
-        public static float makeFCONST_0() {
-            return 0F;
-        }
+            public static int makeICONST_4() {
+                return 4;
+            }
 
-        public static float makeFCONST_1() {
-            return 1F;
-        }
+            public static int makeICONST_5() {
+                return 5;
+            }
 
-        public static float makeFCONST_2() {
-            return 2F;
-        }
+            public static long makeLCONST_0() {
+                return 0L;
+            }
 
-        public static double makeDCONST_0() {
-            return 0D;
-        }
+            public static long makeLCONST_1() {
+                return 1L;
+            }
 
-        public static double makeDCONST_1() {
-            return 1D;
-        }
+            public static float makeFCONST_0() {
+                return 0F;
+            }
 
-        public static double makeDCONST_W() {
-            // ldc2_w
-            return Double.MAX_VALUE;
-        }
+            public static float makeFCONST_1() {
+                return 1F;
+            }
 
-        public static Object makeOBJECT() {
-            // aconst_null
-            return null;
-        }
+            public static float makeFCONST_2() {
+                return 2F;
+            }
 
-        public static byte makeBYTE() {
-            // bipush
-            return (byte) 0x7F;
-        }
+            public static double makeDCONST_0() {
+                return 0D;
+            }
 
-        public static short makeSHORT() {
-            // sipush
-            return (short) 0x7FFF;
-        }
+            public static double makeDCONST_1() {
+                return 1D;
+            }
 
-        public static char makeCHAR() {
-            // ldc
-            return (char) 0xFFFF;
-        }
+            public static double makeDCONST_W() {
+                // ldc2_w
+                return Double.MAX_VALUE;
+            }
 
-        public static boolean makeBOOLEAN() {
-            return true;
+            public static Object makeOBJECT() {
+                // aconst_null
+                return null;
+            }
+
+            public static byte makeBYTE() {
+                // bipush
+                return (byte) 0x7F;
+            }
+
+            public static short makeSHORT() {
+                // sipush
+                return (short) 0x7FFF;
+            }
+
+            public static char makeCHAR() {
+                // ldc
+                return (char) 0xFFFF;
+            }
+
+            public static boolean makeBOOLEAN() {
+                return true;
+            }
         }
     }
-}
+}
\ No newline at end of file
diff --git a/hotspot/test/compiler/tiered/LevelTransitionTest.java b/hotspot/test/compiler/tiered/LevelTransitionTest.java
index 01220a2..d49d995 100644
--- a/hotspot/test/compiler/tiered/LevelTransitionTest.java
+++ b/hotspot/test/compiler/tiered/LevelTransitionTest.java
@@ -23,29 +23,37 @@
 
 /**
  * @test LevelTransitionTest
+ * @summary Test the correctness of compilation level transitions for different methods
  * @library /testlibrary /test/lib /
  * @modules java.base/jdk.internal.misc
  *          java.management
+ *
  * @ignore 8067651
- * @build TransitionsTestExecutor LevelTransitionTest
- * @run driver ClassFileInstaller sun.hotspot.WhiteBox sun.hotspot.WhiteBox$WhiteBoxPermission
+ * @build compiler.tiered.TransitionsTestExecutor compiler.tiered.LevelTransitionTest
+ * @run driver ClassFileInstaller sun.hotspot.WhiteBox
+ *                                sun.hotspot.WhiteBox$WhiteBoxPermission
  * @run main/othervm/timeout=240 -Xmixed -Xbootclasspath/a:. -XX:+UnlockDiagnosticVMOptions
- *                   -XX:+WhiteBoxAPI -XX:+TieredCompilation
+ *                   -XX:+WhiteBoxAPI -XX:+TieredCompilation -XX:-UseCounterDecay
  *                   -XX:CompileCommand=compileonly,compiler.whitebox.SimpleTestCaseHelper::*
- *                   -XX:CompileCommand=compileonly,ExtendedTestCase$CompileMethodHolder::*
- *                   TransitionsTestExecutor LevelTransitionTest
- * @summary Test the correctness of compilation level transitions for different methods
+ *                   -XX:CompileCommand=compileonly,compiler.tiered.LevelTransitionTest$ExtendedTestCase$CompileMethodHolder::*
+ *                   compiler.tiered.TransitionsTestExecutor
+ *                   compiler.tiered.LevelTransitionTest
  */
 
+package compiler.tiered;
+
+import compiler.whitebox.CompilerWhiteBoxTest;
+import compiler.whitebox.SimpleTestCase;
+
 import java.lang.reflect.Executable;
 import java.lang.reflect.Method;
 import java.util.Objects;
 import java.util.concurrent.Callable;
-import compiler.whitebox.CompilerWhiteBoxTest;
-import compiler.whitebox.SimpleTestCase;
 
 public class LevelTransitionTest extends TieredLevelsTest {
-    /** Shows if method was profiled by being executed on levels 2 or 3 */
+    /**
+     * Shows if method was profiled by being executed on levels 2 or 3
+     */
     protected boolean isMethodProfiled;
     private int transitionCount;
 
@@ -103,7 +111,8 @@
             System.out.printf("Method %s is compiled on level %d. Expected level is %d%n", method, newLevel, expected);
             checkLevel(expected, newLevel);
             printInfo();
-        };
+        }
+        ;
     }
 
     /**
@@ -195,59 +204,66 @@
             };
         }
     }
-}
 
-enum ExtendedTestCase implements CompilerWhiteBoxTest.TestCase {
-    ACCESSOR_TEST("accessor"),
-    NONTRIVIAL_METHOD_TEST("nonTrivialMethod"),
-    TRIVIAL_CODE_TEST("trivialCode");
+    private static enum ExtendedTestCase implements CompilerWhiteBoxTest.TestCase {
+        ACCESSOR_TEST("accessor"),
+        NONTRIVIAL_METHOD_TEST("nonTrivialMethod"),
+        TRIVIAL_CODE_TEST("trivialCode");
 
-    private final Executable executable;
-    private final Callable<Integer> callable;
+        private final Executable executable;
+        private final Callable<Integer> callable;
 
-    @Override
-    public Executable getExecutable() {
-        return executable;
-    }
+        @Override
+        public Executable getExecutable() {
+            return executable;
+        }
 
-    @Override
-    public Callable<Integer> getCallable() {
-        return callable;
-    }
+        @Override
+        public Callable<Integer> getCallable() {
+            return callable;
+        }
 
-    @Override
-    public boolean isOsr() {
-        return false;
-    }
+        @Override
+        public boolean isOsr() {
+            return false;
+        }
 
-    private ExtendedTestCase(String methodName) {
-        this.executable = LevelTransitionTest.Helper.getMethod(CompileMethodHolder.class, methodName);
-        this.callable = LevelTransitionTest.Helper.getCallable(new CompileMethodHolder(), methodName);
-    }
+        private ExtendedTestCase(String methodName) {
+            this.executable = LevelTransitionTest.Helper.getMethod(CompileMethodHolder.class, methodName);
+            this.callable = LevelTransitionTest.Helper.getCallable(new CompileMethodHolder(), methodName);
+        }
 
-    private static class CompileMethodHolder {
-        private final int iter = 10;
-        private int field = 42;
+        private static class CompileMethodHolder {
+            private final int iter = 10;
+            private int field = 42;
 
-        /** Non-trivial method for threshold policy: contains loops */
-        public int nonTrivialMethod() {
-            int acc = 0;
-            for (int i = 0; i < iter; i++) {
-                acc += i;
+            /**
+             * Non-trivial method for threshold policy: contains loops
+             */
+            public int nonTrivialMethod() {
+                int acc = 0;
+                for (int i = 0; i < iter; i++) {
+                    acc += i;
+                }
+                return acc;
             }
-            return acc;
-        }
 
-        /** Field accessor method */
-        public int accessor() {
-            return field;
-        }
+            /**
+             * Field accessor method
+             */
+            public int accessor() {
+                return field;
+            }
 
-        /** Method considered as trivial by amount of code */
-        public int trivialCode() {
-            int var = 0xBAAD_C0DE;
-            var *= field;
-            return var;
+            /**
+             * Method considered as trivial by amount of code
+             */
+            public int trivialCode() {
+                int var = 0xBAAD_C0DE;
+                var *= field;
+                return var;
+            }
         }
     }
-}
+
+}
\ No newline at end of file
diff --git a/hotspot/test/compiler/tiered/NonTieredLevelsTest.java b/hotspot/test/compiler/tiered/NonTieredLevelsTest.java
index 9c471c6..3973bdc 100644
--- a/hotspot/test/compiler/tiered/NonTieredLevelsTest.java
+++ b/hotspot/test/compiler/tiered/NonTieredLevelsTest.java
@@ -23,39 +23,39 @@
 
 /**
  * @test NonTieredLevelsTest
+ * @summary Verify that only one level can be used
  * @library /testlibrary /test/lib /
  * @modules java.base/jdk.internal.misc
- * @modules java.management
- * @ignore 8157984
- * @build NonTieredLevelsTest
+ *          java.management
+ * @requires vm.opt.TieredStopAtLevel==null
+ * @build compiler.tiered.NonTieredLevelsTest
  * @run driver ClassFileInstaller sun.hotspot.WhiteBox
  *                                sun.hotspot.WhiteBox$WhiteBoxPermission
  * @run main/othervm -Xbootclasspath/a:. -XX:-TieredCompilation
  *                   -XX:+UnlockDiagnosticVMOptions -XX:+WhiteBoxAPI -XX:-UseCounterDecay
  *                   -XX:CompileCommand=compileonly,compiler.whitebox.SimpleTestCaseHelper::*
- *                   NonTieredLevelsTest
- * @summary Verify that only one level can be used
- * @author igor.ignatyev@oracle.com
+ *                   compiler.tiered.NonTieredLevelsTest
  */
 
+package compiler.tiered;
+
 import java.util.function.IntPredicate;
 import compiler.whitebox.CompilerWhiteBoxTest;
+import jdk.test.lib.Platform;
 
 public class NonTieredLevelsTest extends CompLevelsTest {
     private static final int AVAILABLE_COMP_LEVEL;
     private static final IntPredicate IS_AVAILABLE_COMPLEVEL;
     static {
-        String vmName = System.getProperty("java.vm.name");
-        if (vmName.endsWith(" Server VM")) {
+        if (Platform.isServer()) {
             AVAILABLE_COMP_LEVEL = COMP_LEVEL_FULL_OPTIMIZATION;
             IS_AVAILABLE_COMPLEVEL = x -> x == COMP_LEVEL_FULL_OPTIMIZATION;
-        } else if (vmName.endsWith(" Client VM")
-                || vmName.endsWith(" Minimal VM")) {
+        } else if (Platform.isClient() || Platform.isMinimal()) {
             AVAILABLE_COMP_LEVEL = COMP_LEVEL_SIMPLE;
             IS_AVAILABLE_COMPLEVEL = x -> x >= COMP_LEVEL_SIMPLE
                     && x <= COMP_LEVEL_FULL_PROFILE;
         } else {
-            throw new RuntimeException("Unknown VM: " + vmName);
+            throw new Error("TESTBUG: unknown VM: " + Platform.vmName);
         }
 
     }
diff --git a/hotspot/test/compiler/tiered/TieredLevelsTest.java b/hotspot/test/compiler/tiered/TieredLevelsTest.java
index 2f36bd5..768022b 100644
--- a/hotspot/test/compiler/tiered/TieredLevelsTest.java
+++ b/hotspot/test/compiler/tiered/TieredLevelsTest.java
@@ -23,24 +23,26 @@
 
 /**
  * @test TieredLevelsTest
+ * @summary Verify that all levels &lt; 'TieredStopAtLevel' can be used
  * @library /testlibrary /test/lib /
  * @modules java.base/jdk.internal.misc
- * @modules java.management
- * @build TieredLevelsTest
+ *          java.management
+ *
+ * @build compiler.tiered.TieredLevelsTest
  * @run driver ClassFileInstaller sun.hotspot.WhiteBox
  *                                sun.hotspot.WhiteBox$WhiteBoxPermission
  * @run main/othervm -Xbootclasspath/a:. -XX:+TieredCompilation
  *                   -XX:+UnlockDiagnosticVMOptions -XX:+WhiteBoxAPI -XX:-UseCounterDecay
  *                   -XX:CompileCommand=compileonly,compiler.whitebox.SimpleTestCaseHelper::*
- *                   TieredLevelsTest
- * @summary Verify that all levels &lt; 'TieredStopAtLevel' can be used
- * @author igor.ignatyev@oracle.com
+ *                   compiler.tiered.TieredLevelsTest
  */
 
+package compiler.tiered;
+
 import compiler.whitebox.CompilerWhiteBoxTest;
 
 public class TieredLevelsTest extends CompLevelsTest {
-    public static void main(String[] args) throws Exception, Throwable {
+    public static void main(String[] args) throws Throwable {
         if (CompilerWhiteBoxTest.skipOnTieredCompilation(false)) {
             return;
         }
diff --git a/hotspot/test/compiler/tiered/TransitionsTestExecutor.java b/hotspot/test/compiler/tiered/TransitionsTestExecutor.java
index 630bac2..832678b 100644
--- a/hotspot/test/compiler/tiered/TransitionsTestExecutor.java
+++ b/hotspot/test/compiler/tiered/TransitionsTestExecutor.java
@@ -21,6 +21,9 @@
  * questions.
  */
 
+package compiler.tiered;
+
+import compiler.whitebox.CompilerWhiteBoxTest;
 import jdk.test.lib.OutputAnalyzer;
 import jdk.test.lib.ProcessTools;
 
@@ -29,7 +32,6 @@
 import java.util.ArrayList;
 import java.util.Collections;
 import java.util.List;
-import compiler.whitebox.CompilerWhiteBoxTest;
 
 /**
  * Executes given test in a separate VM with enabled Tiered Compilation for
@@ -59,9 +61,6 @@
         Collections.addAll(args, policy, testName);
 
         OutputAnalyzer out = ProcessTools.executeTestJvm(args.toArray(new String[args.size()]));
-        int exitCode = out.getExitValue();
-        if (exitCode != 0) {
-            throw new Error("Test execution failed with exit code " + exitCode);
-        }
+        out.shouldHaveExitValue(0);
     }
 }
diff --git a/hotspot/test/compiler/types/TestMeetExactConstantArrays.java b/hotspot/test/compiler/types/TestMeetExactConstantArrays.java
index 951288e..1016d1b 100644
--- a/hotspot/test/compiler/types/TestMeetExactConstantArrays.java
+++ b/hotspot/test/compiler/types/TestMeetExactConstantArrays.java
@@ -25,10 +25,12 @@
  * @test
  * @bug 8075587
  * @summary meet of 2 constant arrays result in bottom
- * @run main/othervm TestMeetExactConstantArrays
  *
+ * @run main/othervm compiler.types.TestMeetExactConstantArrays
  */
 
+package compiler.types;
+
 public class TestMeetExactConstantArrays {
     public abstract static class NumbersHolder {
         public Number[] getNumbers() {
diff --git a/hotspot/test/compiler/types/TestMeetIncompatibleInterfaceArrays.java b/hotspot/test/compiler/types/TestMeetIncompatibleInterfaceArrays.java
index 9769afc..a5cf25d 100644
--- a/hotspot/test/compiler/types/TestMeetIncompatibleInterfaceArrays.java
+++ b/hotspot/test/compiler/types/TestMeetIncompatibleInterfaceArrays.java
@@ -28,9 +28,10 @@
  * @modules java.base/jdk.internal.org.objectweb.asm
  *          java.base/jdk.internal.misc
  * @library /testlibrary /test/lib
+ *
  * @build sun.hotspot.WhiteBox
- * @run main ClassFileInstaller sun.hotspot.WhiteBox
- *                              sun.hotspot.WhiteBox$WhiteBoxPermission
+ * @run driver ClassFileInstaller sun.hotspot.WhiteBox
+ *                                sun.hotspot.WhiteBox$WhiteBoxPermission
  * @run main/othervm
  *        -Xbootclasspath/a:.
  *        -XX:+UnlockDiagnosticVMOptions
@@ -41,10 +42,10 @@
  *        -XX:CICompilerCount=1
  *        -XX:+PrintCompilation
  *        -XX:+PrintInlining
- *        -XX:CompileCommand=compileonly,MeetIncompatibleInterfaceArrays*.run
- *        -XX:CompileCommand=dontinline,TestMeetIncompatibleInterfaceArrays$Helper.createI2*
+ *        -XX:CompileCommand=compileonly,MeetIncompatibleInterfaceArrays*::run
+ *        -XX:CompileCommand=dontinline,compiler.types.TestMeetIncompatibleInterfaceArrays$Helper::createI2*
  *        -XX:CompileCommand=quiet
- *        TestMeetIncompatibleInterfaceArrays 0
+ *        compiler.types.TestMeetIncompatibleInterfaceArrays 0
  * @run main/othervm
  *        -Xbootclasspath/a:.
  *        -XX:+UnlockDiagnosticVMOptions
@@ -55,10 +56,10 @@
  *        -XX:CICompilerCount=1
  *        -XX:+PrintCompilation
  *        -XX:+PrintInlining
- *        -XX:CompileCommand=compileonly,MeetIncompatibleInterfaceArrays*.run
- *        -XX:CompileCommand=inline,TestMeetIncompatibleInterfaceArrays$Helper.createI2*
+ *        -XX:CompileCommand=compileonly,MeetIncompatibleInterfaceArrays*::run
+ *        -XX:CompileCommand=inline,compiler.types.TestMeetIncompatibleInterfaceArrays$Helper::createI2*
  *        -XX:CompileCommand=quiet
- *        TestMeetIncompatibleInterfaceArrays 1
+ *        compiler.types.TestMeetIncompatibleInterfaceArrays 1
  * @run main/othervm
  *        -Xbootclasspath/a:.
  *        -XX:+UnlockDiagnosticVMOptions
@@ -72,22 +73,39 @@
  *        -XX:CICompilerCount=2
  *        -XX:+PrintCompilation
  *        -XX:+PrintInlining
- *        -XX:CompileCommand=compileonly,MeetIncompatibleInterfaceArrays*.run
- *        -XX:CompileCommand=compileonly,TestMeetIncompatibleInterfaceArrays$Helper.createI2*
- *        -XX:CompileCommand=inline,TestMeetIncompatibleInterfaceArrays$Helper.createI2*
+ *        -XX:CompileCommand=compileonly,MeetIncompatibleInterfaceArrays*::run
+ *        -XX:CompileCommand=compileonly,compiler.types.TestMeetIncompatibleInterfaceArrays$Helper::createI2*
+ *        -XX:CompileCommand=inline,compiler.types.TestMeetIncompatibleInterfaceArrays$Helper::createI2*
  *        -XX:CompileCommand=quiet
- *        TestMeetIncompatibleInterfaceArrays 2
+ *        compiler.types.TestMeetIncompatibleInterfaceArrays 2
  *
  * @author volker.simonis@gmail.com
  */
 
+package compiler.types;
+
+import jdk.internal.org.objectweb.asm.ClassWriter;
+import jdk.internal.org.objectweb.asm.MethodVisitor;
+import sun.hotspot.WhiteBox;
+
 import java.io.FileOutputStream;
 import java.lang.reflect.InvocationTargetException;
 import java.lang.reflect.Method;
-import jdk.internal.org.objectweb.asm.ClassWriter;
-import jdk.internal.org.objectweb.asm.MethodVisitor;
-import static jdk.internal.org.objectweb.asm.Opcodes.*;
-import sun.hotspot.WhiteBox;
+
+import static jdk.internal.org.objectweb.asm.Opcodes.AALOAD;
+import static jdk.internal.org.objectweb.asm.Opcodes.ACC_PUBLIC;
+import static jdk.internal.org.objectweb.asm.Opcodes.ACC_STATIC;
+import static jdk.internal.org.objectweb.asm.Opcodes.ALOAD;
+import static jdk.internal.org.objectweb.asm.Opcodes.ARETURN;
+import static jdk.internal.org.objectweb.asm.Opcodes.ASTORE;
+import static jdk.internal.org.objectweb.asm.Opcodes.GETSTATIC;
+import static jdk.internal.org.objectweb.asm.Opcodes.ICONST_0;
+import static jdk.internal.org.objectweb.asm.Opcodes.INVOKEINTERFACE;
+import static jdk.internal.org.objectweb.asm.Opcodes.INVOKESPECIAL;
+import static jdk.internal.org.objectweb.asm.Opcodes.INVOKESTATIC;
+import static jdk.internal.org.objectweb.asm.Opcodes.INVOKEVIRTUAL;
+import static jdk.internal.org.objectweb.asm.Opcodes.RETURN;
+import static jdk.internal.org.objectweb.asm.Opcodes.V1_8;
 
 public class TestMeetIncompatibleInterfaceArrays extends ClassLoader {
 
@@ -245,14 +263,14 @@
         constr.visitMaxs(0, 0);
         constr.visitEnd();
         MethodVisitor run = cw.visitMethod(ACC_PUBLIC | ACC_STATIC, "run",
-                "()" + a + "LTestMeetIncompatibleInterfaceArrays$I1;", null, null);
+                "()" + a + "Lcompiler/types/TestMeetIncompatibleInterfaceArrays$I1;", null, null);
         run.visitCode();
         if (dim == 4) {
-            run.visitMethodInsn(INVOKESTATIC, "TestMeetIncompatibleInterfaceArrays$Helper", createName + 3,
-                    "()" + "[[[" + "LTestMeetIncompatibleInterfaceArrays$I2;", false);
+            run.visitMethodInsn(INVOKESTATIC, "compiler/types/TestMeetIncompatibleInterfaceArrays$Helper", createName + 3,
+                    "()" + "[[[" + "Lcompiler/types/TestMeetIncompatibleInterfaceArrays$I2;", false);
         } else {
-            run.visitMethodInsn(INVOKESTATIC, "TestMeetIncompatibleInterfaceArrays$Helper", createName + dim,
-                    "()" + a + "LTestMeetIncompatibleInterfaceArrays$I2;", false);
+            run.visitMethodInsn(INVOKESTATIC, "compiler/types/TestMeetIncompatibleInterfaceArrays$Helper", createName + dim,
+                    "()" + a + "Lcompiler/types/TestMeetIncompatibleInterfaceArrays$I2;", false);
         }
         run.visitInsn(ARETURN);
         run.visitMaxs(0, 0);
@@ -260,7 +278,7 @@
         MethodVisitor test = cw.visitMethod(ACC_PUBLIC | ACC_STATIC, "test", "()V", null, null);
         test.visitCode();
         test.visitMethodInsn(INVOKESTATIC, baseClassName + dim + "ASM", "run",
-                "()" + a + "LTestMeetIncompatibleInterfaceArrays$I1;", false);
+                "()" + a + "Lcompiler/types/TestMeetIncompatibleInterfaceArrays$I1;", false);
         test.visitVarInsn(ASTORE, 0);
         if (dim > 0) {
             test.visitVarInsn(ALOAD, 0);
@@ -272,7 +290,7 @@
         }
         test.visitFieldInsn(GETSTATIC, "java/lang/System", "out", "Ljava/io/PrintStream;");
         test.visitVarInsn(ALOAD, dim > 0 ? 1 : 0);
-        test.visitMethodInsn(INVOKEINTERFACE, "TestMeetIncompatibleInterfaceArrays$I1", "getName",
+        test.visitMethodInsn(INVOKEINTERFACE, "compiler/types/TestMeetIncompatibleInterfaceArrays$I1", "getName",
                 "()Ljava/lang/String;", true);
         test.visitMethodInsn(INVOKEVIRTUAL, "java/io/PrintStream", "println", "(Ljava/lang/Object;)V", false);
         test.visitInsn(RETURN);
@@ -296,9 +314,9 @@
         final int pass = Integer.parseInt(args.length > 0 ? args[0] : "0");
 
         // Load and initialize some classes required for compilation
-        Class.forName("TestMeetIncompatibleInterfaceArrays$I1");
-        Class.forName("TestMeetIncompatibleInterfaceArrays$I2");
-        Class.forName("TestMeetIncompatibleInterfaceArrays$Helper");
+        Class.forName("compiler.types.TestMeetIncompatibleInterfaceArrays$I1");
+        Class.forName("compiler.types.TestMeetIncompatibleInterfaceArrays$I2");
+        Class.forName("compiler.types.TestMeetIncompatibleInterfaceArrays$Helper");
 
         for (int g = 0; g < 2; g++) {
             String baseClassName = "MeetIncompatibleInterfaceArrays";
diff --git a/hotspot/test/compiler/types/TestMeetTopArrayExactConstantArray.java b/hotspot/test/compiler/types/TestMeetTopArrayExactConstantArray.java
index 4ec6e7b..73234b4 100644
--- a/hotspot/test/compiler/types/TestMeetTopArrayExactConstantArray.java
+++ b/hotspot/test/compiler/types/TestMeetTopArrayExactConstantArray.java
@@ -25,10 +25,15 @@
  * @test
  * @bug 8027571
  * @summary meet of TopPTR exact array with constant array is not symmetric
- * @run main/othervm -XX:+IgnoreUnrecognizedVMOptions -XX:-UseOnStackReplacement -XX:TypeProfileLevel=222 -XX:+UseTypeSpeculation -XX:-BackgroundCompilation TestMeetTopArrayExactConstantArray
  *
+ * @run main/othervm -XX:+IgnoreUnrecognizedVMOptions -XX:-UseOnStackReplacement
+ *                   -XX:TypeProfileLevel=222 -XX:+UseTypeSpeculation
+ *                   -XX:-BackgroundCompilation
+ *                   compiler.types.TestMeetTopArrayExactConstantArray
  */
 
+package compiler.types;
+
 public class TestMeetTopArrayExactConstantArray {
 
     static class A {
diff --git a/hotspot/test/compiler/types/TestPhiElimination.java b/hotspot/test/compiler/types/TestPhiElimination.java
index 5029b99..d6e8958 100644
--- a/hotspot/test/compiler/types/TestPhiElimination.java
+++ b/hotspot/test/compiler/types/TestPhiElimination.java
@@ -26,8 +26,13 @@
  * @test
  * @bug 8150804
  * @summary Tests elimination of Phi nodes without losing type information.
- * @run main/othervm -XX:-BackgroundCompilation -XX:-UseOnStackReplacement TestPhiElimination
+ *
+ * @run main/othervm -XX:-BackgroundCompilation -XX:-UseOnStackReplacement
+ *                   compiler.types.TestPhiElimination
  */
+
+package compiler.types;
+
 public class TestPhiElimination {
     /*
        A::get() is inlined into test(obj) producing the following graph:
@@ -90,23 +95,20 @@
         }
     }
 
-}
+    static class A extends TestPhiElimination {
+        public Object f;
 
-class A extends TestPhiElimination {
-    public Object f;
-
-    public A create() {
-        return new A();
-    }
-
-    public synchronized Object get() {
-        if (f == null) {
-            f = create();
+        public A create() {
+            return new A();
         }
-        return f;
+
+        public synchronized Object get() {
+            if (f == null) {
+                f = create();
+            }
+            return f;
+        }
     }
-}
 
-class B extends A {
-
+    static class B extends A { }
 }
diff --git a/hotspot/test/compiler/types/TestSpeculationFailedHigherEqual.java b/hotspot/test/compiler/types/TestSpeculationFailedHigherEqual.java
index 70d5566..323edd9 100644
--- a/hotspot/test/compiler/types/TestSpeculationFailedHigherEqual.java
+++ b/hotspot/test/compiler/types/TestSpeculationFailedHigherEqual.java
@@ -25,10 +25,14 @@
  * @test
  * @bug 8027422
  * @summary type methods shouldn't always operate on speculative part
- * @run main/othervm -XX:+IgnoreUnrecognizedVMOptions -XX:TypeProfileLevel=222 -XX:+UseTypeSpeculation -XX:-BackgroundCompilation TestSpeculationFailedHigherEqual
  *
+ * @run main/othervm -XX:+IgnoreUnrecognizedVMOptions -XX:TypeProfileLevel=222
+ *                   -XX:+UseTypeSpeculation -XX:-BackgroundCompilation
+ *                   compiler.types.TestSpeculationFailedHigherEqual
  */
 
+package compiler.types;
+
 public class TestSpeculationFailedHigherEqual {
 
     static class A {
diff --git a/hotspot/test/compiler/types/TestTypePropagationToCmpU.java b/hotspot/test/compiler/types/TestTypePropagationToCmpU.java
index 9e08a8b..abc0ab2 100644
--- a/hotspot/test/compiler/types/TestTypePropagationToCmpU.java
+++ b/hotspot/test/compiler/types/TestTypePropagationToCmpU.java
@@ -25,8 +25,12 @@
  * @test
  * @bug 8080156 8060036
  * @summary Test correctness of type propagation to CmpUNodes.
- * @run main TestTypePropagationToCmpU
+ *
+ * @run main compiler.types.TestTypePropagationToCmpU
  */
+
+package compiler.types;
+
 public class TestTypePropagationToCmpU {
     public static void main(String[] args) {
         try {
diff --git a/hotspot/test/compiler/types/TypeSpeculation.java b/hotspot/test/compiler/types/TypeSpeculation.java
index 6f146b8..4bc53ac 100644
--- a/hotspot/test/compiler/types/TypeSpeculation.java
+++ b/hotspot/test/compiler/types/TypeSpeculation.java
@@ -25,10 +25,15 @@
  * @test
  * @bug 8024070
  * @summary Test that type speculation doesn't cause incorrect execution
- * @run main/othervm -XX:+IgnoreUnrecognizedVMOptions -XX:-UseOnStackReplacement -XX:-BackgroundCompilation -XX:TypeProfileLevel=222 -XX:+UseTypeSpeculation TypeSpeculation
  *
+ * @run main/othervm -XX:+IgnoreUnrecognizedVMOptions -XX:-UseOnStackReplacement
+ *                   -XX:-BackgroundCompilation -XX:TypeProfileLevel=222
+ *                   -XX:+UseTypeSpeculation
+ *                   compiler.types.TypeSpeculation
  */
 
+package compiler.types;
+
 public class TypeSpeculation {
 
     interface I {
diff --git a/hotspot/test/compiler/types/correctness/CorrectnessTest.java b/hotspot/test/compiler/types/correctness/CorrectnessTest.java
index 7add655..15a5bba 100644
--- a/hotspot/test/compiler/types/correctness/CorrectnessTest.java
+++ b/hotspot/test/compiler/types/correctness/CorrectnessTest.java
@@ -24,47 +24,62 @@
 /*
  * @test CorrectnessTest
  * @bug 8038418
- * @library /testlibrary /test/lib
+ * @summary Tests correctness of type usage with type profiling and speculations
+ * @requires vm.flavor == "server"
+ * @library /testlibrary /test/lib /
  * @modules java.base/jdk.internal.misc
  *          java.management
+ *
  * @ignore 8066173
- * @compile execution/TypeConflict.java execution/TypeProfile.java
- *          execution/MethodHandleDelegate.java
- * @build CorrectnessTest
- * @run main ClassFileInstaller sun.hotspot.WhiteBox
- *                              sun.hotspot.WhiteBox$WhiteBoxPermission
+ * @build compiler.types.correctness.CorrectnessTest
+ * @run driver ClassFileInstaller sun.hotspot.WhiteBox
+ *                                sun.hotspot.WhiteBox$WhiteBoxPermission
  * @run main/othervm -Xbootclasspath/a:. -XX:+IgnoreUnrecognizedVMOptions -XX:+UnlockExperimentalVMOptions
  *                   -XX:+UnlockDiagnosticVMOptions -XX:+WhiteBoxAPI
  *                   -XX:TypeProfileLevel=222 -XX:+UseTypeSpeculation
- *                   -XX:CompileCommand=exclude,execution/*::methodNotToCompile
- *                   -XX:CompileCommand=dontinline,scenarios/Scenario::collectReturnType
- *                   CorrectnessTest RETURN
+ *                   -XX:CompileCommand=exclude,compiler.types.correctness.execution.*::methodNotToCompile
+ *                   -XX:CompileCommand=dontinline,compiler.types.correctness.scenarios.Scenario::collectReturnType
+ *                   compiler.types.correctness.CorrectnessTest RETURN
  * @run main/othervm -Xbootclasspath/a:. -XX:+IgnoreUnrecognizedVMOptions -XX:+UnlockExperimentalVMOptions
  *                   -XX:+UnlockDiagnosticVMOptions -XX:+WhiteBoxAPI
  *                   -XX:TypeProfileLevel=222 -XX:+UseTypeSpeculation
- *                   -XX:CompileCommand=exclude,execution/*::methodNotToCompile
- *                   -XX:CompileCommand=dontinline,scenarios/Scenario::collectReturnType
- *                   CorrectnessTest PARAMETERS
+ *                   -XX:CompileCommand=exclude,compiler.types.correctness.execution.*::methodNotToCompile
+ *                   -XX:CompileCommand=dontinline,compiler.types.correctness.scenarios.Scenario::collectReturnType
+ *                   compiler.types.correctness.CorrectnessTest PARAMETERS
  * @run main/othervm -Xbootclasspath/a:. -XX:+IgnoreUnrecognizedVMOptions -XX:+UnlockExperimentalVMOptions
  *                   -XX:+UnlockDiagnosticVMOptions -XX:+WhiteBoxAPI
  *                   -XX:TypeProfileLevel=222 -XX:+UseTypeSpeculation
- *                   -XX:CompileCommand=exclude,execution/*::methodNotToCompile
- *                   -XX:CompileCommand=dontinline,scenarios/Scenario::collectReturnType
- *                   CorrectnessTest ARGUMENTS
- * @summary Tests correctness of type usage with type profiling and speculations
+ *                   -XX:CompileCommand=exclude,compiler.types.correctness.execution.*::methodNotToCompile
+ *                   -XX:CompileCommand=dontinline,compiler.types.correctness.scenarios.Scenario::collectReturnType
+ *                   compiler.types.correctness.CorrectnessTest ARGUMENTS
  */
 
+package compiler.types.correctness;
+
+import compiler.types.correctness.execution.Execution;
+import compiler.types.correctness.execution.MethodHandleDelegate;
+import compiler.types.correctness.execution.TypeConflict;
+import compiler.types.correctness.execution.TypeProfile;
+import compiler.types.correctness.hierarchies.DefaultMethodInterface;
+import compiler.types.correctness.hierarchies.DefaultMethodInterface2;
+import compiler.types.correctness.hierarchies.Linear;
+import compiler.types.correctness.hierarchies.Linear2;
+import compiler.types.correctness.hierarchies.NullableType;
+import compiler.types.correctness.hierarchies.OneRank;
+import compiler.types.correctness.hierarchies.TypeHierarchy;
+import compiler.types.correctness.scenarios.ArrayCopy;
+import compiler.types.correctness.scenarios.ArrayReferenceStore;
+import compiler.types.correctness.scenarios.CheckCast;
+import compiler.types.correctness.scenarios.ClassIdentity;
+import compiler.types.correctness.scenarios.ClassInstanceOf;
+import compiler.types.correctness.scenarios.ClassIsInstance;
+import compiler.types.correctness.scenarios.ProfilingType;
+import compiler.types.correctness.scenarios.ReceiverAtInvokes;
+import compiler.types.correctness.scenarios.Scenario;
 import jdk.test.lib.Asserts;
 import jdk.test.lib.Platform;
-import execution.Execution;
-import execution.MethodHandleDelegate;
-import execution.TypeConflict;
-import execution.TypeProfile;
-import hierarchies.*;
-import scenarios.*;
 import sun.hotspot.WhiteBox;
 
-import java.lang.reflect.Constructor;
 import java.lang.reflect.Method;
 import java.util.ArrayList;
 import java.util.List;
@@ -75,7 +90,7 @@
 
     public static void main(String[] args) {
         if (!Platform.isServer()) {
-            System.out.println("ALL TESTS SKIPPED");
+            throw new Error("TESTBUG: Not server VM");
         }
         Asserts.assertGTE(args.length, 1);
         ProfilingType profilingType = ProfilingType.valueOf(args[0]);
diff --git a/hotspot/test/compiler/types/correctness/OffTest.java b/hotspot/test/compiler/types/correctness/OffTest.java
index ecab6e8..ad623fe 100644
--- a/hotspot/test/compiler/types/correctness/OffTest.java
+++ b/hotspot/test/compiler/types/correctness/OffTest.java
@@ -24,24 +24,25 @@
 /*
  * @test CorrectnessTest
  * @bug 8038418
- * @library /testlibrary /test/lib
+ * @library /testlibrary /test/lib /
  * @modules java.base/jdk.internal.misc
  *          java.management
+ *
  * @ignore 8066173
- * @compile execution/TypeConflict.java execution/TypeProfile.java
- *          execution/MethodHandleDelegate.java
- * @build CorrectnessTest
- * @build OffTest
- * @run main ClassFileInstaller sun.hotspot.WhiteBox
- *                              sun.hotspot.WhiteBox$WhiteBoxPermission
- * @run main/timeout=1200 OffTest
+ * @build compiler.types.correctness.OffTest
+ * @run driver ClassFileInstaller sun.hotspot.WhiteBox
+ *                                sun.hotspot.WhiteBox$WhiteBoxPermission
+ * @run main/timeout=1200 compiler.types.correctness.OffTest
  */
 
+package compiler.types.correctness;
+
+import compiler.types.correctness.scenarios.ProfilingType;
 import jdk.test.lib.OutputAnalyzer;
 import jdk.test.lib.ProcessTools;
 import jdk.test.lib.Utils;
+
 import java.util.Random;
-import scenarios.ProfilingType;
 
 public class OffTest {
     private static final String[] OPTIONS = {
@@ -50,8 +51,8 @@
             "-XX:+UnlockExperimentalVMOptions",
             "-XX:+UnlockDiagnosticVMOptions",
             "-XX:+WhiteBoxAPI",
-            "-XX:CompileCommand=exclude,execution/*::methodNotToCompile",
-            "-XX:CompileCommand=dontinline,scenarios/Scenario::collectReturnType",
+            "-XX:CompileCommand=exclude,compiler.types.correctness.execution.*::methodNotToCompile",
+            "-XX:CompileCommand=dontinline,compiler.types.correctness.scenarios.Scenario::collectReturnType",
             "", // -XX:TypeProfileLevel=?
             "", // -XX:?UseTypeSpeculation
             CorrectnessTest.class.getName(),
diff --git a/hotspot/test/compiler/types/correctness/execution/Execution.java b/hotspot/test/compiler/types/correctness/execution/Execution.java
index f0b1949..f8b52bb 100644
--- a/hotspot/test/compiler/types/correctness/execution/Execution.java
+++ b/hotspot/test/compiler/types/correctness/execution/Execution.java
@@ -20,10 +20,10 @@
  * or visit www.oracle.com if you need additional information or have any
  * questions.
  */
-package execution;
+package compiler.types.correctness.execution;
 
-import hierarchies.TypeHierarchy;
-import scenarios.Scenario;
+import compiler.types.correctness.hierarchies.TypeHierarchy;
+import compiler.types.correctness.scenarios.Scenario;
 
 /**
  * Execution scenario represents test methods execution type.
@@ -33,7 +33,7 @@
 public interface Execution<T extends TypeHierarchy.I, R> {
     /**
      * Executes the test code of the given scenario
-     * See {@link scenarios.Scenario#run(T)}
+     * See {@link Scenario#run(T)}
      *
      * @param scenario test scenario
      */
diff --git a/hotspot/test/compiler/types/correctness/execution/MethodHandleDelegate.java b/hotspot/test/compiler/types/correctness/execution/MethodHandleDelegate.java
index d067449..ca61ed1 100644
--- a/hotspot/test/compiler/types/correctness/execution/MethodHandleDelegate.java
+++ b/hotspot/test/compiler/types/correctness/execution/MethodHandleDelegate.java
@@ -21,10 +21,10 @@
  * questions.
  */
 
-package execution;
+package compiler.types.correctness.execution;
 
-import hierarchies.TypeHierarchy;
-import scenarios.Scenario;
+import compiler.types.correctness.hierarchies.TypeHierarchy;
+import compiler.types.correctness.scenarios.Scenario;
 
 import java.lang.invoke.MethodHandle;
 import java.lang.invoke.MethodHandles;
diff --git a/hotspot/test/compiler/types/correctness/execution/TypeConflict.java b/hotspot/test/compiler/types/correctness/execution/TypeConflict.java
index a171504..69f779d 100644
--- a/hotspot/test/compiler/types/correctness/execution/TypeConflict.java
+++ b/hotspot/test/compiler/types/correctness/execution/TypeConflict.java
@@ -21,10 +21,10 @@
  * questions.
  */
 
-package execution;
+package compiler.types.correctness.execution;
 
-import hierarchies.TypeHierarchy;
-import scenarios.Scenario;
+import compiler.types.correctness.hierarchies.TypeHierarchy;
+import compiler.types.correctness.scenarios.Scenario;
 
 /**
  *  Type profiling conflict execution scenario. The main goal is
diff --git a/hotspot/test/compiler/types/correctness/execution/TypeProfile.java b/hotspot/test/compiler/types/correctness/execution/TypeProfile.java
index 446fdb8..69f75bb 100644
--- a/hotspot/test/compiler/types/correctness/execution/TypeProfile.java
+++ b/hotspot/test/compiler/types/correctness/execution/TypeProfile.java
@@ -21,10 +21,10 @@
  * questions.
  */
 
-package execution;
+package compiler.types.correctness.execution;
 
-import hierarchies.TypeHierarchy;
-import scenarios.Scenario;
+import compiler.types.correctness.hierarchies.TypeHierarchy;
+import compiler.types.correctness.scenarios.Scenario;
 
 /**
  * Profile type execution scenario. Executes tester method
diff --git a/hotspot/test/compiler/types/correctness/hierarchies/DefaultMethodInterface.java b/hotspot/test/compiler/types/correctness/hierarchies/DefaultMethodInterface.java
index bad66a0..f46a0e8 100644
--- a/hotspot/test/compiler/types/correctness/hierarchies/DefaultMethodInterface.java
+++ b/hotspot/test/compiler/types/correctness/hierarchies/DefaultMethodInterface.java
@@ -21,7 +21,7 @@
  * questions.
  */
 
-package hierarchies;
+package compiler.types.correctness.hierarchies;
 
 public class DefaultMethodInterface {
     private DefaultMethodInterface() {
diff --git a/hotspot/test/compiler/types/correctness/hierarchies/DefaultMethodInterface2.java b/hotspot/test/compiler/types/correctness/hierarchies/DefaultMethodInterface2.java
index 05c0ded..df32685 100644
--- a/hotspot/test/compiler/types/correctness/hierarchies/DefaultMethodInterface2.java
+++ b/hotspot/test/compiler/types/correctness/hierarchies/DefaultMethodInterface2.java
@@ -21,7 +21,7 @@
  * questions.
  */
 
-package hierarchies;
+package compiler.types.correctness.hierarchies;
 
 public class DefaultMethodInterface2 {
     private DefaultMethodInterface2() {
diff --git a/hotspot/test/compiler/types/correctness/hierarchies/Linear.java b/hotspot/test/compiler/types/correctness/hierarchies/Linear.java
index 85927ef..519157a 100644
--- a/hotspot/test/compiler/types/correctness/hierarchies/Linear.java
+++ b/hotspot/test/compiler/types/correctness/hierarchies/Linear.java
@@ -21,7 +21,7 @@
  * questions.
  */
 
-package hierarchies;
+package compiler.types.correctness.hierarchies;
 
 public class Linear {
     private Linear() {
diff --git a/hotspot/test/compiler/types/correctness/hierarchies/Linear2.java b/hotspot/test/compiler/types/correctness/hierarchies/Linear2.java
index a5df9b9..10d3195 100644
--- a/hotspot/test/compiler/types/correctness/hierarchies/Linear2.java
+++ b/hotspot/test/compiler/types/correctness/hierarchies/Linear2.java
@@ -21,7 +21,7 @@
  * questions.
  */
 
-package hierarchies;
+package compiler.types.correctness.hierarchies;
 
 public class Linear2 {
     private Linear2() {
diff --git a/hotspot/test/compiler/types/correctness/hierarchies/NullableType.java b/hotspot/test/compiler/types/correctness/hierarchies/NullableType.java
index 409a7c8..f338c1e 100644
--- a/hotspot/test/compiler/types/correctness/hierarchies/NullableType.java
+++ b/hotspot/test/compiler/types/correctness/hierarchies/NullableType.java
@@ -21,7 +21,7 @@
  * questions.
  */
 
-package hierarchies;
+package compiler.types.correctness.hierarchies;
 
 public class NullableType<M extends TypeHierarchy.I, N extends TypeHierarchy.I>
         extends TypeHierarchy<M, N> {
diff --git a/hotspot/test/compiler/types/correctness/hierarchies/OneRank.java b/hotspot/test/compiler/types/correctness/hierarchies/OneRank.java
index 4dcba0f..c29b9b9 100644
--- a/hotspot/test/compiler/types/correctness/hierarchies/OneRank.java
+++ b/hotspot/test/compiler/types/correctness/hierarchies/OneRank.java
@@ -21,7 +21,7 @@
  * questions.
  */
 
-package hierarchies;
+package compiler.types.correctness.hierarchies;
 
 public class OneRank {
     private OneRank() {
diff --git a/hotspot/test/compiler/types/correctness/hierarchies/TypeHierarchy.java b/hotspot/test/compiler/types/correctness/hierarchies/TypeHierarchy.java
index 91e168b..5c9821b 100644
--- a/hotspot/test/compiler/types/correctness/hierarchies/TypeHierarchy.java
+++ b/hotspot/test/compiler/types/correctness/hierarchies/TypeHierarchy.java
@@ -21,7 +21,7 @@
  * questions.
  */
 
-package hierarchies;
+package compiler.types.correctness.hierarchies;
 
 /**
  * Type hierarchy contains classes the type profiling and speculation are tested with
diff --git a/hotspot/test/compiler/types/correctness/scenarios/ArrayCopy.java b/hotspot/test/compiler/types/correctness/scenarios/ArrayCopy.java
index 3f51162..1e3f3d7 100644
--- a/hotspot/test/compiler/types/correctness/scenarios/ArrayCopy.java
+++ b/hotspot/test/compiler/types/correctness/scenarios/ArrayCopy.java
@@ -21,9 +21,9 @@
  * questions.
  */
 
-package scenarios;
+package compiler.types.correctness.scenarios;
 
-import hierarchies.TypeHierarchy;
+import compiler.types.correctness.hierarchies.TypeHierarchy;
 
 import java.util.Arrays;
 
diff --git a/hotspot/test/compiler/types/correctness/scenarios/ArrayReferenceStore.java b/hotspot/test/compiler/types/correctness/scenarios/ArrayReferenceStore.java
index f63e47e..868f786 100644
--- a/hotspot/test/compiler/types/correctness/scenarios/ArrayReferenceStore.java
+++ b/hotspot/test/compiler/types/correctness/scenarios/ArrayReferenceStore.java
@@ -21,9 +21,9 @@
  * questions.
  */
 
-package scenarios;
+package compiler.types.correctness.scenarios;
 
-import hierarchies.TypeHierarchy;
+import compiler.types.correctness.hierarchies.TypeHierarchy;
 
 import java.util.Arrays;
 
diff --git a/hotspot/test/compiler/types/correctness/scenarios/ArrayScenario.java b/hotspot/test/compiler/types/correctness/scenarios/ArrayScenario.java
index e93a578..5530bc5 100644
--- a/hotspot/test/compiler/types/correctness/scenarios/ArrayScenario.java
+++ b/hotspot/test/compiler/types/correctness/scenarios/ArrayScenario.java
@@ -21,10 +21,10 @@
  * questions.
  */
 
-package scenarios;
+package compiler.types.correctness.scenarios;
 
+import compiler.types.correctness.hierarchies.TypeHierarchy;
 import jdk.test.lib.Asserts;
-import hierarchies.TypeHierarchy;
 
 import java.lang.reflect.Array;
 import java.util.Arrays;
diff --git a/hotspot/test/compiler/types/correctness/scenarios/CheckCast.java b/hotspot/test/compiler/types/correctness/scenarios/CheckCast.java
index 97e6de6..2863381 100644
--- a/hotspot/test/compiler/types/correctness/scenarios/CheckCast.java
+++ b/hotspot/test/compiler/types/correctness/scenarios/CheckCast.java
@@ -21,10 +21,10 @@
  * questions.
  */
 
-package scenarios;
+package compiler.types.correctness.scenarios;
 
+import compiler.types.correctness.hierarchies.TypeHierarchy;
 import jdk.test.lib.Asserts;
-import hierarchies.TypeHierarchy;
 
 import java.util.Objects;
 
diff --git a/hotspot/test/compiler/types/correctness/scenarios/ClassIdentity.java b/hotspot/test/compiler/types/correctness/scenarios/ClassIdentity.java
index 84fe2ed..bc6cc25 100644
--- a/hotspot/test/compiler/types/correctness/scenarios/ClassIdentity.java
+++ b/hotspot/test/compiler/types/correctness/scenarios/ClassIdentity.java
@@ -21,10 +21,10 @@
  * questions.
  */
 
-package scenarios;
+package compiler.types.correctness.scenarios;
 
+import compiler.types.correctness.hierarchies.TypeHierarchy;
 import jdk.test.lib.Asserts;
-import hierarchies.TypeHierarchy;
 
 /**
  * Tests pattern: if (a.getClass() == D.class)
diff --git a/hotspot/test/compiler/types/correctness/scenarios/ClassInstanceOf.java b/hotspot/test/compiler/types/correctness/scenarios/ClassInstanceOf.java
index 8b39043..2192fe0 100644
--- a/hotspot/test/compiler/types/correctness/scenarios/ClassInstanceOf.java
+++ b/hotspot/test/compiler/types/correctness/scenarios/ClassInstanceOf.java
@@ -21,10 +21,10 @@
  * questions.
  */
 
-package scenarios;
+package compiler.types.correctness.scenarios;
 
+import compiler.types.correctness.hierarchies.TypeHierarchy;
 import jdk.test.lib.Asserts;
-import hierarchies.TypeHierarchy;
 
 /**
  * Tests instanceof
diff --git a/hotspot/test/compiler/types/correctness/scenarios/ClassIsInstance.java b/hotspot/test/compiler/types/correctness/scenarios/ClassIsInstance.java
index b4cd94d..6c466c4 100644
--- a/hotspot/test/compiler/types/correctness/scenarios/ClassIsInstance.java
+++ b/hotspot/test/compiler/types/correctness/scenarios/ClassIsInstance.java
@@ -21,10 +21,10 @@
  * questions.
  */
 
-package scenarios;
+package compiler.types.correctness.scenarios;
 
+import compiler.types.correctness.hierarchies.TypeHierarchy;
 import jdk.test.lib.Asserts;
-import hierarchies.TypeHierarchy;
 
 /**
  * Tests {@link Class#isInstance(Object)}
diff --git a/hotspot/test/compiler/types/correctness/scenarios/ProfilingType.java b/hotspot/test/compiler/types/correctness/scenarios/ProfilingType.java
index 449fb16..d94a9e5 100644
--- a/hotspot/test/compiler/types/correctness/scenarios/ProfilingType.java
+++ b/hotspot/test/compiler/types/correctness/scenarios/ProfilingType.java
@@ -21,7 +21,7 @@
  * questions.
  */
 
-package scenarios;
+package compiler.types.correctness.scenarios;
 
 public enum ProfilingType {
     /** type profiling of return values of reference types from an invoke */
diff --git a/hotspot/test/compiler/types/correctness/scenarios/ReceiverAtInvokes.java b/hotspot/test/compiler/types/correctness/scenarios/ReceiverAtInvokes.java
index f98632d..a6c430e 100644
--- a/hotspot/test/compiler/types/correctness/scenarios/ReceiverAtInvokes.java
+++ b/hotspot/test/compiler/types/correctness/scenarios/ReceiverAtInvokes.java
@@ -21,10 +21,10 @@
  * questions.
  */
 
-package scenarios;
+package compiler.types.correctness.scenarios;
 
+import compiler.types.correctness.hierarchies.TypeHierarchy;
 import jdk.test.lib.Asserts;
-import hierarchies.TypeHierarchy;
 
 /**
  * Receiver at invokes profiling and speculation
diff --git a/hotspot/test/compiler/types/correctness/scenarios/Scenario.java b/hotspot/test/compiler/types/correctness/scenarios/Scenario.java
index 4867920..d2aea49 100644
--- a/hotspot/test/compiler/types/correctness/scenarios/Scenario.java
+++ b/hotspot/test/compiler/types/correctness/scenarios/Scenario.java
@@ -21,9 +21,9 @@
  * questions.
  */
 
-package scenarios;
+package compiler.types.correctness.scenarios;
 
-import hierarchies.TypeHierarchy;
+import compiler.types.correctness.hierarchies.TypeHierarchy;
 
 /**
  * Test scenario
diff --git a/hotspot/test/compiler/uncommontrap/DeoptReallocFailure.java b/hotspot/test/compiler/uncommontrap/DeoptReallocFailure.java
index 1064527..0363689 100644
--- a/hotspot/test/compiler/uncommontrap/DeoptReallocFailure.java
+++ b/hotspot/test/compiler/uncommontrap/DeoptReallocFailure.java
@@ -25,30 +25,37 @@
  * @test
  * @bug 8146416
  * @library /test/lib /testlibrary /
+ *
  * @build sun.hotspot.WhiteBox
- * @run main ClassFileInstaller sun.hotspot.WhiteBox
- *                              sun.hotspot.WhiteBox$WhiteBoxPermission
- * @run main/othervm -Xbootclasspath/a:. -XX:+UnlockDiagnosticVMOptions -XX:+WhiteBoxAPI -Xbatch -XX:CompileCommand=exclude,DeoptReallocFailure::main -Xmx100m DeoptReallocFailure
+ * @run driver ClassFileInstaller sun.hotspot.WhiteBox
+ *                                sun.hotspot.WhiteBox$WhiteBoxPermission
+ * @run main/othervm -Xbootclasspath/a:. -XX:+UnlockDiagnosticVMOptions
+ *      -XX:+WhiteBoxAPI -Xbatch -Xmx100m
+ *      -XX:CompileCommand=exclude,compiler.uncommontrap.DeoptReallocFailure::main
+ *      compiler.uncommontrap.DeoptReallocFailure
  *
  */
-import java.lang.reflect.Method;
+
+package compiler.uncommontrap;
+
 import sun.hotspot.WhiteBox;
 
-class MemoryChunk {
-    MemoryChunk other;
-    Object[][] array;
-
-    MemoryChunk(MemoryChunk other) {
-        this.other = other;
-        array = new Object[1024 * 256][];
-    }
-}
-
-class NoEscape {
-    long f1;
-}
+import java.lang.reflect.Method;
 
 public class DeoptReallocFailure {
+    static class MemoryChunk {
+        MemoryChunk other;
+        Object[][] array;
+
+        MemoryChunk(MemoryChunk other) {
+            this.other = other;
+            array = new Object[1024 * 256][];
+        }
+    }
+
+    static class NoEscape {
+        long f1;
+    }
 
     static MemoryChunk root;
     private static final WhiteBox WB = WhiteBox.getWhiteBox();
diff --git a/hotspot/test/compiler/uncommontrap/StackOverflowGuardPagesOff.java b/hotspot/test/compiler/uncommontrap/StackOverflowGuardPagesOff.java
index 835283c..3d0e84b 100644
--- a/hotspot/test/compiler/uncommontrap/StackOverflowGuardPagesOff.java
+++ b/hotspot/test/compiler/uncommontrap/StackOverflowGuardPagesOff.java
@@ -25,10 +25,16 @@
  * @test
  * @bug 8029383
  * @summary stack overflow if callee is marked for deoptimization causes crash
- * @run main/othervm -XX:TieredStopAtLevel=1 -XX:-BackgroundCompilation -XX:CompileCommand=dontinline,StackOverflowGuardPagesOff::m1 -XX:CompileCommand=exclude,StackOverflowGuardPagesOff::m2 -Xss512K -XX:-UseOnStackReplacement StackOverflowGuardPagesOff
  *
+ * @run main/othervm -XX:TieredStopAtLevel=1 -XX:-BackgroundCompilation
+ *      -XX:CompileCommand=dontinline,compiler.uncommontrap.StackOverflowGuardPagesOff::m1
+ *      -XX:CompileCommand=exclude,compiler.uncommontrap.StackOverflowGuardPagesOff::m2
+ *      -Xss512K -XX:-UseOnStackReplacement
+ *      compiler.uncommontrap.StackOverflowGuardPagesOff
  */
 
+package compiler.uncommontrap;
+
 // This test calls m2 recursively until a stack overflow. Then calls
 // m3 that calls m1. m1 triggers B's class loading, as a result m1 and
 // m3 needs to be deoptimized. Deoptimization of m1 causes a stack
diff --git a/hotspot/test/compiler/uncommontrap/8009761/Test8009761.java b/hotspot/test/compiler/uncommontrap/Test8009761.java
similarity index 96%
rename from hotspot/test/compiler/uncommontrap/8009761/Test8009761.java
rename to hotspot/test/compiler/uncommontrap/Test8009761.java
index 91b58c6..df9141e 100644
--- a/hotspot/test/compiler/uncommontrap/8009761/Test8009761.java
+++ b/hotspot/test/compiler/uncommontrap/Test8009761.java
@@ -21,20 +21,28 @@
  * questions.
  */
 
-import sun.hotspot.WhiteBox;
-import java.lang.reflect.Method;
-
 /*
  * @test
  * @bug 8009761
- * @modules java.base/jdk.internal.misc
- * @library /testlibrary /test/lib
  * @summary Deoptimization on sparc doesn't set Llast_SP correctly in the interpreter frames it creates
- * @build Test8009761
- * @run main ClassFileInstaller sun.hotspot.WhiteBox
- *                              sun.hotspot.WhiteBox$WhiteBoxPermission
- * @run main/othervm -Xbootclasspath/a:. -XX:+UnlockDiagnosticVMOptions -XX:+WhiteBoxAPI -XX:CompileCommand=exclude,Test8009761::m2 -XX:-UseOnStackReplacement -XX:-BackgroundCompilation -Xss512K Test8009761
+ * @library /testlibrary /test/lib /
+ * @modules java.base/jdk.internal.misc
+ *
+ * @build compiler.uncommontrap.Test8009761
+ * @run driver ClassFileInstaller sun.hotspot.WhiteBox
+ *                                sun.hotspot.WhiteBox$WhiteBoxPermission
+ * @run main/othervm -Xbootclasspath/a:. -XX:+UnlockDiagnosticVMOptions -XX:+WhiteBoxAPI
+ *      -XX:-UseOnStackReplacement -XX:-BackgroundCompilation -Xss512K
+ *      -XX:CompileCommand=exclude,compiler.uncommontrap.Test8009761::m2
+ *      compiler.uncommontrap.Test8009761
  */
+
+package compiler.uncommontrap;
+
+import sun.hotspot.WhiteBox;
+
+import java.lang.reflect.Method;
+
 public class Test8009761 {
 
     private static final WhiteBox WHITE_BOX = WhiteBox.getWhiteBox();
diff --git a/hotspot/test/compiler/uncommontrap/TestDeoptOOM.java b/hotspot/test/compiler/uncommontrap/TestDeoptOOM.java
index 5342582..75a00d2 100644
--- a/hotspot/test/compiler/uncommontrap/TestDeoptOOM.java
+++ b/hotspot/test/compiler/uncommontrap/TestDeoptOOM.java
@@ -25,10 +25,15 @@
  * @test
  * @bug 6898462
  * @summary failed reallocations of scalar replaced objects during deoptimization causes crash
- * @run main/othervm -XX:-BackgroundCompilation -XX:CompileCommand=exclude,TestDeoptOOM::main -XX:CompileCommand=exclude,TestDeoptOOM::m9_1 -Xmx128M TestDeoptOOM
  *
+ * @run main/othervm -XX:-BackgroundCompilation -Xmx128M
+ *      -XX:CompileCommand=exclude,compiler.uncommontrap.TestDeoptOOM::main
+ *      -XX:CompileCommand=exclude,compiler.uncommontrap.TestDeoptOOM::m9_1
+ *      compiler.uncommontrap.TestDeoptOOM
  */
 
+package compiler.uncommontrap;
+
 public class TestDeoptOOM {
 
     long f1;
diff --git a/hotspot/test/compiler/uncommontrap/TestLockEliminatedAtDeopt.java b/hotspot/test/compiler/uncommontrap/TestLockEliminatedAtDeopt.java
index 153b214..6491f8e 100644
--- a/hotspot/test/compiler/uncommontrap/TestLockEliminatedAtDeopt.java
+++ b/hotspot/test/compiler/uncommontrap/TestLockEliminatedAtDeopt.java
@@ -25,10 +25,15 @@
  * @test
  * @bug 8032011
  * @summary biased locking's revoke_bias locks monitor in compiled frame with eliminated lock
- * @run main/othervm -XX:-UseOnStackReplacement -XX:CompileCommand=dontinline,TestLockEliminatedAtDeopt$A.m2 -XX:-BackgroundCompilation -XX:BiasedLockingStartupDelay=0 TestLockEliminatedAtDeopt
  *
+ * @run main/othervm -XX:-UseOnStackReplacement
+ *      -XX:CompileCommand=dontinline,compiler.uncommontrap.TestLockEliminatedAtDeopt$A::m2
+ *      -XX:-BackgroundCompilation -XX:BiasedLockingStartupDelay=0
+ *      compiler.uncommontrap.TestLockEliminatedAtDeopt
  */
 
+package compiler.uncommontrap;
+
 public class TestLockEliminatedAtDeopt {
 
     static class A {
diff --git a/hotspot/test/compiler/uncommontrap/TestStackBangMonitorOwned.java b/hotspot/test/compiler/uncommontrap/TestStackBangMonitorOwned.java
index c07a995..e1c45a7 100644
--- a/hotspot/test/compiler/uncommontrap/TestStackBangMonitorOwned.java
+++ b/hotspot/test/compiler/uncommontrap/TestStackBangMonitorOwned.java
@@ -25,9 +25,15 @@
  * @test
  * @bug 8032410
  * @summary Stack overflow at deoptimization doesn't release owned monitors
- * @run main/othervm -XX:-BackgroundCompilation -XX:CompileCommand=dontinline,TestStackBangMonitorOwned::m1 -XX:CompileCommand=exclude,TestStackBangMonitorOwned::m2 -Xss512K -XX:-UseOnStackReplacement TestStackBangMonitorOwned
  *
+ * @run main/othervm -XX:-BackgroundCompilation -Xss512K -XX:-UseOnStackReplacement
+ *      -XX:CompileCommand=dontinline,compiler.uncommontrap.TestStackBangMonitorOwned::m1
+ *      -XX:CompileCommand=exclude,compiler.uncommontrap.TestStackBangMonitorOwned::m2
+ *      compiler.uncommontrap.TestStackBangMonitorOwned
  */
+
+package compiler.uncommontrap;
+
 public class TestStackBangMonitorOwned {
 
     static class UnloadedClass1 {
diff --git a/hotspot/test/compiler/uncommontrap/TestStackBangRbp.java b/hotspot/test/compiler/uncommontrap/TestStackBangRbp.java
index 9b96951..c2c80ef 100644
--- a/hotspot/test/compiler/uncommontrap/TestStackBangRbp.java
+++ b/hotspot/test/compiler/uncommontrap/TestStackBangRbp.java
@@ -25,9 +25,15 @@
  * @test
  * @bug 8028308
  * @summary rbp not restored when stack overflow is thrown from deopt/uncommon trap blobs
- * @run main/othervm -XX:-BackgroundCompilation -XX:CompileCommand=dontinline,TestStackBangRbp::m1 -XX:CompileCommand=exclude,TestStackBangRbp::m2 -Xss512K -XX:-UseOnStackReplacement TestStackBangRbp
  *
+ * @run main/othervm -XX:-BackgroundCompilation -Xss512K -XX:-UseOnStackReplacement
+ *      -XX:CompileCommand=dontinline,compiler.uncommontrap.TestStackBangRbp::m1
+ *      -XX:CompileCommand=exclude,compiler.uncommontrap.TestStackBangRbp::m2
+ *      compiler.uncommontrap.TestStackBangRbp
  */
+
+package compiler.uncommontrap;
+
 public class TestStackBangRbp {
 
     static class UnloadedClass1 {
diff --git a/hotspot/test/compiler/uncommontrap/TestUnstableIfTrap.java b/hotspot/test/compiler/uncommontrap/TestUnstableIfTrap.java
index 3de7157a..25e4413 100644
--- a/hotspot/test/compiler/uncommontrap/TestUnstableIfTrap.java
+++ b/hotspot/test/compiler/uncommontrap/TestUnstableIfTrap.java
@@ -30,51 +30,67 @@
  *          java.compiler
  *          java.management
  *          jdk.jvmstat/sun.jvmstat.monitor
- * @build TestUnstableIfTrap jdk.test.lib.* compiler.testlibrary.uncommontrap.Verifier
+ *
+ * @build compiler.uncommontrap.TestUnstableIfTrap
+ *        jdk.test.lib.*
+ *        compiler.testlibrary.uncommontrap.Verifier
  * @run driver ClassFileInstaller sun.hotspot.WhiteBox
  *                                sun.hotspot.WhiteBox$WhiteBoxPermission
  * @run main/othervm -Xbatch -Xbootclasspath/a:. -XX:+UnlockDiagnosticVMOptions
  *                   -XX:+WhiteBoxAPI -XX:+LogCompilation
  *                   -XX:CompileCommand=compileonly,UnstableIfExecutable.test
  *                   -XX:LogFile=always_taken_not_fired.xml
- *                   TestUnstableIfTrap ALWAYS_TAKEN false
+ *                   compiler.uncommontrap.TestUnstableIfTrap ALWAYS_TAKEN false
  * @run main/othervm -Xbatch -Xbootclasspath/a:. -XX:+UnlockDiagnosticVMOptions
  *                   -XX:+WhiteBoxAPI -XX:+LogCompilation
  *                   -XX:CompileCommand=compileonly,UnstableIfExecutable.test
  *                   -XX:LogFile=always_taken_fired.xml
- *                   TestUnstableIfTrap ALWAYS_TAKEN true
+ *                   compiler.uncommontrap.TestUnstableIfTrap ALWAYS_TAKEN true
  * @run main/othervm -Xbatch -Xbootclasspath/a:. -XX:+UnlockDiagnosticVMOptions
  *                   -XX:+WhiteBoxAPI -XX:+LogCompilation
  *                   -XX:CompileCommand=compileonly,UnstableIfExecutable.test
  *                   -XX:LogFile=never_taken_not_fired.xml
- *                   TestUnstableIfTrap NEVER_TAKEN false
+ *                   compiler.uncommontrap.TestUnstableIfTrap NEVER_TAKEN false
  * @run main/othervm -Xbatch -Xbootclasspath/a:. -XX:+UnlockDiagnosticVMOptions
  *                   -XX:+WhiteBoxAPI -XX:+LogCompilation
  *                   -XX:CompileCommand=compileonly,UnstableIfExecutable.test
  *                   -XX:LogFile=never_taken_fired.xml
- *                   TestUnstableIfTrap NEVER_TAKEN true
+ *                   compiler.uncommontrap.TestUnstableIfTrap NEVER_TAKEN true
  * @run driver compiler.testlibrary.uncommontrap.Verifier always_taken_not_fired.xml
  *                                                        always_taken_fired.xml
  *                                                        never_taken_not_fired.xml
  *                                                        never_taken_fired.xml
  */
 
+package compiler.uncommontrap;
+
+import compiler.testlibrary.uncommontrap.Verifier;
+import jdk.internal.org.objectweb.asm.ClassVisitor;
+import jdk.internal.org.objectweb.asm.ClassWriter;
+import jdk.internal.org.objectweb.asm.Label;
+import jdk.internal.org.objectweb.asm.MethodVisitor;
+import jdk.test.lib.ByteCodeLoader;
+import jdk.test.lib.Platform;
+import sun.hotspot.WhiteBox;
+
 import java.io.File;
 import java.io.FileWriter;
 import java.io.IOException;
 import java.lang.reflect.Method;
 import java.util.Properties;
 
-import jdk.test.lib.ByteCodeLoader;
-import jdk.test.lib.Platform;
-import jdk.internal.org.objectweb.asm.ClassVisitor;
-import jdk.internal.org.objectweb.asm.ClassWriter;
-import jdk.internal.org.objectweb.asm.Label;
-import jdk.internal.org.objectweb.asm.MethodVisitor;
-import static jdk.internal.org.objectweb.asm.Opcodes.*;
-
-import sun.hotspot.WhiteBox;
-import compiler.testlibrary.uncommontrap.Verifier;
+import static jdk.internal.org.objectweb.asm.Opcodes.ACC_ABSTRACT;
+import static jdk.internal.org.objectweb.asm.Opcodes.ACC_PUBLIC;
+import static jdk.internal.org.objectweb.asm.Opcodes.ACC_STATIC;
+import static jdk.internal.org.objectweb.asm.Opcodes.ACC_VOLATILE;
+import static jdk.internal.org.objectweb.asm.Opcodes.GETSTATIC;
+import static jdk.internal.org.objectweb.asm.Opcodes.GOTO;
+import static jdk.internal.org.objectweb.asm.Opcodes.IADD;
+import static jdk.internal.org.objectweb.asm.Opcodes.ICONST_1;
+import static jdk.internal.org.objectweb.asm.Opcodes.IFEQ;
+import static jdk.internal.org.objectweb.asm.Opcodes.ILOAD;
+import static jdk.internal.org.objectweb.asm.Opcodes.ISUB;
+import static jdk.internal.org.objectweb.asm.Opcodes.RETURN;
 
 public class TestUnstableIfTrap {
     private static final WhiteBox WB = WhiteBox.getWhiteBox();
diff --git a/hotspot/test/compiler/uncommontrap/TraceDeoptimizationNoRealloc.java b/hotspot/test/compiler/uncommontrap/TraceDeoptimizationNoRealloc.java
index 563bbbb..4a371a5 100644
--- a/hotspot/test/compiler/uncommontrap/TraceDeoptimizationNoRealloc.java
+++ b/hotspot/test/compiler/uncommontrap/TraceDeoptimizationNoRealloc.java
@@ -25,10 +25,14 @@
  * @test
  * @bug 8067144
  * @summary -XX:+TraceDeoptimization tries to print realloc'ed objects even when there are none
- * @run main/othervm -XX:-BackgroundCompilation -XX:-UseOnStackReplacement -XX:+IgnoreUnrecognizedVMOptions -XX:+TraceDeoptimization TraceDeoptimizationNoRealloc
  *
+ * @run main/othervm -XX:-BackgroundCompilation -XX:-UseOnStackReplacement
+ *                   -XX:+IgnoreUnrecognizedVMOptions -XX:+TraceDeoptimization
+ *                   compiler.uncommontrap.TraceDeoptimizationNoRealloc
  */
 
+package compiler.uncommontrap;
+
 public class TraceDeoptimizationNoRealloc {
 
     static void m(boolean some_condition) {
diff --git a/hotspot/test/compiler/uncommontrap/UncommonTrapStackBang.java b/hotspot/test/compiler/uncommontrap/UncommonTrapStackBang.java
index e0c093b..d286d80 100644
--- a/hotspot/test/compiler/uncommontrap/UncommonTrapStackBang.java
+++ b/hotspot/test/compiler/uncommontrap/UncommonTrapStackBang.java
@@ -27,8 +27,10 @@
  * @bug 8026775
  * @summary Uncommon trap blob did not bang all the stack shadow pages
  *
- * @run main/othervm UncommonTrapStackBang
- *
+ * @run main/othervm compiler.uncommontrap.UncommonTrapStackBang
+ */
+
+/*
  * Note: This test does not reproduce the problem with absolute
  * certainty. Empirically the bug reproduces on Windows some 80+% of
  * the time. Setting everything up to fail in 100% of the cases turns
@@ -55,6 +57,9 @@
  * which raises an exception on Windows when the stack bang in
  * StringBuilder is performed.
  */
+
+package compiler.uncommontrap;
+
 public class UncommonTrapStackBang extends Thread {
     class Foo { }
 
diff --git a/hotspot/test/compiler/unsafe/GetUnsafeObjectG1PreBarrier.java b/hotspot/test/compiler/unsafe/GetUnsafeObjectG1PreBarrier.java
index a6707d5..be07553 100644
--- a/hotspot/test/compiler/unsafe/GetUnsafeObjectG1PreBarrier.java
+++ b/hotspot/test/compiler/unsafe/GetUnsafeObjectG1PreBarrier.java
@@ -25,14 +25,18 @@
  * @test
  * @bug 8016474
  * @summary The bug only happens with C1 and G1 using a different ObjectAlignmentInBytes than KlassAlignmentInBytes (which is 8)
+ *
  * @modules java.base/jdk.internal.misc
- * @run main/othervm -Xbatch -XX:+IgnoreUnrecognizedVMOptions -XX:ObjectAlignmentInBytes=32 GetUnsafeObjectG1PreBarrier
+ * @run main/othervm -Xbatch -XX:+IgnoreUnrecognizedVMOptions -XX:ObjectAlignmentInBytes=32
+ *                   compiler.unsafe.GetUnsafeObjectG1PreBarrier
  */
 
-import java.lang.reflect.Field;
+package compiler.unsafe;
 
 import jdk.internal.misc.Unsafe;
 
+import java.lang.reflect.Field;
+
 public class GetUnsafeObjectG1PreBarrier {
     private static final Unsafe unsafe;
     private static final int N = 100_000;
diff --git a/hotspot/test/compiler/unsafe/JdkInternalMiscUnsafeAccessTestBoolean.java b/hotspot/test/compiler/unsafe/JdkInternalMiscUnsafeAccessTestBoolean.java
index 816977d..e98e8b4 100644
--- a/hotspot/test/compiler/unsafe/JdkInternalMiscUnsafeAccessTestBoolean.java
+++ b/hotspot/test/compiler/unsafe/JdkInternalMiscUnsafeAccessTestBoolean.java
@@ -25,13 +25,16 @@
  * @test
  * @bug 8143628
  * @summary Test unsafe access for boolean
+ *
  * @modules java.base/jdk.internal.misc
- * @run testng/othervm -Diters=100   -Xint                   JdkInternalMiscUnsafeAccessTestBoolean
- * @run testng/othervm -Diters=20000 -XX:TieredStopAtLevel=1 JdkInternalMiscUnsafeAccessTestBoolean
- * @run testng/othervm -Diters=20000 -XX:-TieredCompilation  JdkInternalMiscUnsafeAccessTestBoolean
- * @run testng/othervm -Diters=20000                         JdkInternalMiscUnsafeAccessTestBoolean
+ * @run testng/othervm -Diters=100   -Xint                   compiler.unsafe.JdkInternalMiscUnsafeAccessTestBoolean
+ * @run testng/othervm -Diters=20000 -XX:TieredStopAtLevel=1 compiler.unsafe.JdkInternalMiscUnsafeAccessTestBoolean
+ * @run testng/othervm -Diters=20000 -XX:-TieredCompilation  compiler.unsafe.JdkInternalMiscUnsafeAccessTestBoolean
+ * @run testng/othervm -Diters=20000                         compiler.unsafe.JdkInternalMiscUnsafeAccessTestBoolean
  */
 
+package compiler.unsafe;
+
 import org.testng.annotations.Test;
 
 import java.lang.reflect.Field;
diff --git a/hotspot/test/compiler/unsafe/JdkInternalMiscUnsafeAccessTestByte.java b/hotspot/test/compiler/unsafe/JdkInternalMiscUnsafeAccessTestByte.java
index 9ce6f05..7828244 100644
--- a/hotspot/test/compiler/unsafe/JdkInternalMiscUnsafeAccessTestByte.java
+++ b/hotspot/test/compiler/unsafe/JdkInternalMiscUnsafeAccessTestByte.java
@@ -25,13 +25,16 @@
  * @test
  * @bug 8143628
  * @summary Test unsafe access for byte
+ *
  * @modules java.base/jdk.internal.misc
- * @run testng/othervm -Diters=100   -Xint                   JdkInternalMiscUnsafeAccessTestByte
- * @run testng/othervm -Diters=20000 -XX:TieredStopAtLevel=1 JdkInternalMiscUnsafeAccessTestByte
- * @run testng/othervm -Diters=20000 -XX:-TieredCompilation  JdkInternalMiscUnsafeAccessTestByte
- * @run testng/othervm -Diters=20000                         JdkInternalMiscUnsafeAccessTestByte
+ * @run testng/othervm -Diters=100   -Xint                   compiler.unsafe.JdkInternalMiscUnsafeAccessTestByte
+ * @run testng/othervm -Diters=20000 -XX:TieredStopAtLevel=1 compiler.unsafe.JdkInternalMiscUnsafeAccessTestByte
+ * @run testng/othervm -Diters=20000 -XX:-TieredCompilation  compiler.unsafe.JdkInternalMiscUnsafeAccessTestByte
+ * @run testng/othervm -Diters=20000                         compiler.unsafe.JdkInternalMiscUnsafeAccessTestByte
  */
 
+package compiler.unsafe;
+
 import org.testng.annotations.Test;
 
 import java.lang.reflect.Field;
diff --git a/hotspot/test/compiler/unsafe/JdkInternalMiscUnsafeAccessTestChar.java b/hotspot/test/compiler/unsafe/JdkInternalMiscUnsafeAccessTestChar.java
index df81a2f..c774f6b 100644
--- a/hotspot/test/compiler/unsafe/JdkInternalMiscUnsafeAccessTestChar.java
+++ b/hotspot/test/compiler/unsafe/JdkInternalMiscUnsafeAccessTestChar.java
@@ -25,13 +25,16 @@
  * @test
  * @bug 8143628
  * @summary Test unsafe access for char
+ *
  * @modules java.base/jdk.internal.misc
- * @run testng/othervm -Diters=100   -Xint                   JdkInternalMiscUnsafeAccessTestChar
- * @run testng/othervm -Diters=20000 -XX:TieredStopAtLevel=1 JdkInternalMiscUnsafeAccessTestChar
- * @run testng/othervm -Diters=20000 -XX:-TieredCompilation  JdkInternalMiscUnsafeAccessTestChar
- * @run testng/othervm -Diters=20000                         JdkInternalMiscUnsafeAccessTestChar
+ * @run testng/othervm -Diters=100   -Xint                   compiler.unsafe.JdkInternalMiscUnsafeAccessTestChar
+ * @run testng/othervm -Diters=20000 -XX:TieredStopAtLevel=1 compiler.unsafe.JdkInternalMiscUnsafeAccessTestChar
+ * @run testng/othervm -Diters=20000 -XX:-TieredCompilation  compiler.unsafe.JdkInternalMiscUnsafeAccessTestChar
+ * @run testng/othervm -Diters=20000                         compiler.unsafe.JdkInternalMiscUnsafeAccessTestChar
  */
 
+package compiler.unsafe;
+
 import org.testng.annotations.Test;
 
 import java.lang.reflect.Field;
diff --git a/hotspot/test/compiler/unsafe/JdkInternalMiscUnsafeAccessTestDouble.java b/hotspot/test/compiler/unsafe/JdkInternalMiscUnsafeAccessTestDouble.java
index 83874a5..8a366bf 100644
--- a/hotspot/test/compiler/unsafe/JdkInternalMiscUnsafeAccessTestDouble.java
+++ b/hotspot/test/compiler/unsafe/JdkInternalMiscUnsafeAccessTestDouble.java
@@ -25,13 +25,16 @@
  * @test
  * @bug 8143628
  * @summary Test unsafe access for double
+ *
  * @modules java.base/jdk.internal.misc
- * @run testng/othervm -Diters=100   -Xint                   JdkInternalMiscUnsafeAccessTestDouble
- * @run testng/othervm -Diters=20000 -XX:TieredStopAtLevel=1 JdkInternalMiscUnsafeAccessTestDouble
- * @run testng/othervm -Diters=20000 -XX:-TieredCompilation  JdkInternalMiscUnsafeAccessTestDouble
- * @run testng/othervm -Diters=20000                         JdkInternalMiscUnsafeAccessTestDouble
+ * @run testng/othervm -Diters=100   -Xint                   compiler.unsafe.JdkInternalMiscUnsafeAccessTestDouble
+ * @run testng/othervm -Diters=20000 -XX:TieredStopAtLevel=1 compiler.unsafe.JdkInternalMiscUnsafeAccessTestDouble
+ * @run testng/othervm -Diters=20000 -XX:-TieredCompilation  compiler.unsafe.JdkInternalMiscUnsafeAccessTestDouble
+ * @run testng/othervm -Diters=20000                         compiler.unsafe.JdkInternalMiscUnsafeAccessTestDouble
  */
 
+package compiler.unsafe;
+
 import org.testng.annotations.Test;
 
 import java.lang.reflect.Field;
diff --git a/hotspot/test/compiler/unsafe/JdkInternalMiscUnsafeAccessTestFloat.java b/hotspot/test/compiler/unsafe/JdkInternalMiscUnsafeAccessTestFloat.java
index f5191f0..03df5ea 100644
--- a/hotspot/test/compiler/unsafe/JdkInternalMiscUnsafeAccessTestFloat.java
+++ b/hotspot/test/compiler/unsafe/JdkInternalMiscUnsafeAccessTestFloat.java
@@ -25,13 +25,16 @@
  * @test
  * @bug 8143628
  * @summary Test unsafe access for float
+ *
  * @modules java.base/jdk.internal.misc
- * @run testng/othervm -Diters=100   -Xint                   JdkInternalMiscUnsafeAccessTestFloat
- * @run testng/othervm -Diters=20000 -XX:TieredStopAtLevel=1 JdkInternalMiscUnsafeAccessTestFloat
- * @run testng/othervm -Diters=20000 -XX:-TieredCompilation  JdkInternalMiscUnsafeAccessTestFloat
- * @run testng/othervm -Diters=20000                         JdkInternalMiscUnsafeAccessTestFloat
+ * @run testng/othervm -Diters=100   -Xint                   compiler.unsafe.JdkInternalMiscUnsafeAccessTestFloat
+ * @run testng/othervm -Diters=20000 -XX:TieredStopAtLevel=1 compiler.unsafe.JdkInternalMiscUnsafeAccessTestFloat
+ * @run testng/othervm -Diters=20000 -XX:-TieredCompilation  compiler.unsafe.JdkInternalMiscUnsafeAccessTestFloat
+ * @run testng/othervm -Diters=20000                         compiler.unsafe.JdkInternalMiscUnsafeAccessTestFloat
  */
 
+package compiler.unsafe;
+
 import org.testng.annotations.Test;
 
 import java.lang.reflect.Field;
diff --git a/hotspot/test/compiler/unsafe/JdkInternalMiscUnsafeAccessTestInt.java b/hotspot/test/compiler/unsafe/JdkInternalMiscUnsafeAccessTestInt.java
index 6428c0d..61498e6 100644
--- a/hotspot/test/compiler/unsafe/JdkInternalMiscUnsafeAccessTestInt.java
+++ b/hotspot/test/compiler/unsafe/JdkInternalMiscUnsafeAccessTestInt.java
@@ -25,13 +25,16 @@
  * @test
  * @bug 8143628
  * @summary Test unsafe access for int
+ *
  * @modules java.base/jdk.internal.misc
- * @run testng/othervm -Diters=100   -Xint                   JdkInternalMiscUnsafeAccessTestInt
- * @run testng/othervm -Diters=20000 -XX:TieredStopAtLevel=1 JdkInternalMiscUnsafeAccessTestInt
- * @run testng/othervm -Diters=20000 -XX:-TieredCompilation  JdkInternalMiscUnsafeAccessTestInt
- * @run testng/othervm -Diters=20000                         JdkInternalMiscUnsafeAccessTestInt
+ * @run testng/othervm -Diters=100   -Xint                   compiler.unsafe.JdkInternalMiscUnsafeAccessTestInt
+ * @run testng/othervm -Diters=20000 -XX:TieredStopAtLevel=1 compiler.unsafe.JdkInternalMiscUnsafeAccessTestInt
+ * @run testng/othervm -Diters=20000 -XX:-TieredCompilation  compiler.unsafe.JdkInternalMiscUnsafeAccessTestInt
+ * @run testng/othervm -Diters=20000                         compiler.unsafe.JdkInternalMiscUnsafeAccessTestInt
  */
 
+package compiler.unsafe;
+
 import org.testng.annotations.Test;
 
 import java.lang.reflect.Field;
diff --git a/hotspot/test/compiler/unsafe/JdkInternalMiscUnsafeAccessTestLong.java b/hotspot/test/compiler/unsafe/JdkInternalMiscUnsafeAccessTestLong.java
index 505681a..3a07e8e 100644
--- a/hotspot/test/compiler/unsafe/JdkInternalMiscUnsafeAccessTestLong.java
+++ b/hotspot/test/compiler/unsafe/JdkInternalMiscUnsafeAccessTestLong.java
@@ -25,13 +25,16 @@
  * @test
  * @bug 8143628
  * @summary Test unsafe access for long
+ *
  * @modules java.base/jdk.internal.misc
- * @run testng/othervm -Diters=100   -Xint                   JdkInternalMiscUnsafeAccessTestLong
- * @run testng/othervm -Diters=20000 -XX:TieredStopAtLevel=1 JdkInternalMiscUnsafeAccessTestLong
- * @run testng/othervm -Diters=20000 -XX:-TieredCompilation  JdkInternalMiscUnsafeAccessTestLong
- * @run testng/othervm -Diters=20000                         JdkInternalMiscUnsafeAccessTestLong
+ * @run testng/othervm -Diters=100   -Xint                   compiler.unsafe.JdkInternalMiscUnsafeAccessTestLong
+ * @run testng/othervm -Diters=20000 -XX:TieredStopAtLevel=1 compiler.unsafe.JdkInternalMiscUnsafeAccessTestLong
+ * @run testng/othervm -Diters=20000 -XX:-TieredCompilation  compiler.unsafe.JdkInternalMiscUnsafeAccessTestLong
+ * @run testng/othervm -Diters=20000                         compiler.unsafe.JdkInternalMiscUnsafeAccessTestLong
  */
 
+package compiler.unsafe;
+
 import org.testng.annotations.Test;
 
 import java.lang.reflect.Field;
diff --git a/hotspot/test/compiler/unsafe/JdkInternalMiscUnsafeAccessTestObject.java b/hotspot/test/compiler/unsafe/JdkInternalMiscUnsafeAccessTestObject.java
index 7fc59cd..1c5c2d0 100644
--- a/hotspot/test/compiler/unsafe/JdkInternalMiscUnsafeAccessTestObject.java
+++ b/hotspot/test/compiler/unsafe/JdkInternalMiscUnsafeAccessTestObject.java
@@ -25,13 +25,16 @@
  * @test
  * @bug 8143628
  * @summary Test unsafe access for Object
+ *
  * @modules java.base/jdk.internal.misc
- * @run testng/othervm -Diters=100   -Xint                   JdkInternalMiscUnsafeAccessTestObject
- * @run testng/othervm -Diters=20000 -XX:TieredStopAtLevel=1 JdkInternalMiscUnsafeAccessTestObject
- * @run testng/othervm -Diters=20000 -XX:-TieredCompilation  JdkInternalMiscUnsafeAccessTestObject
- * @run testng/othervm -Diters=20000                         JdkInternalMiscUnsafeAccessTestObject
+ * @run testng/othervm -Diters=100   -Xint                   compiler.unsafe.JdkInternalMiscUnsafeAccessTestObject
+ * @run testng/othervm -Diters=20000 -XX:TieredStopAtLevel=1 compiler.unsafe.JdkInternalMiscUnsafeAccessTestObject
+ * @run testng/othervm -Diters=20000 -XX:-TieredCompilation  compiler.unsafe.JdkInternalMiscUnsafeAccessTestObject
+ * @run testng/othervm -Diters=20000                         compiler.unsafe.JdkInternalMiscUnsafeAccessTestObject
  */
 
+package compiler.unsafe;
+
 import org.testng.annotations.Test;
 
 import java.lang.reflect.Field;
diff --git a/hotspot/test/compiler/unsafe/JdkInternalMiscUnsafeAccessTestShort.java b/hotspot/test/compiler/unsafe/JdkInternalMiscUnsafeAccessTestShort.java
index 12ab68c..30deaa8 100644
--- a/hotspot/test/compiler/unsafe/JdkInternalMiscUnsafeAccessTestShort.java
+++ b/hotspot/test/compiler/unsafe/JdkInternalMiscUnsafeAccessTestShort.java
@@ -25,13 +25,16 @@
  * @test
  * @bug 8143628
  * @summary Test unsafe access for short
+ *
  * @modules java.base/jdk.internal.misc
- * @run testng/othervm -Diters=100   -Xint                   JdkInternalMiscUnsafeAccessTestShort
- * @run testng/othervm -Diters=20000 -XX:TieredStopAtLevel=1 JdkInternalMiscUnsafeAccessTestShort
- * @run testng/othervm -Diters=20000 -XX:-TieredCompilation  JdkInternalMiscUnsafeAccessTestShort
- * @run testng/othervm -Diters=20000                         JdkInternalMiscUnsafeAccessTestShort
+ * @run testng/othervm -Diters=100   -Xint                   compiler.unsafe.JdkInternalMiscUnsafeAccessTestShort
+ * @run testng/othervm -Diters=20000 -XX:TieredStopAtLevel=1 compiler.unsafe.JdkInternalMiscUnsafeAccessTestShort
+ * @run testng/othervm -Diters=20000 -XX:-TieredCompilation  compiler.unsafe.JdkInternalMiscUnsafeAccessTestShort
+ * @run testng/othervm -Diters=20000                         compiler.unsafe.JdkInternalMiscUnsafeAccessTestShort
  */
 
+package compiler.unsafe;
+
 import org.testng.annotations.Test;
 
 import java.lang.reflect.Field;
diff --git a/hotspot/test/compiler/unsafe/JdkInternalMiscUnsafeUnalignedAccess.java b/hotspot/test/compiler/unsafe/JdkInternalMiscUnsafeUnalignedAccess.java
index 45959f0..f5b7681 100644
--- a/hotspot/test/compiler/unsafe/JdkInternalMiscUnsafeUnalignedAccess.java
+++ b/hotspot/test/compiler/unsafe/JdkInternalMiscUnsafeUnalignedAccess.java
@@ -26,13 +26,18 @@
  * @bug 8158260
  * @summary Test unaligned Unsafe accesses
  * @modules java.base/jdk.internal.misc
- * @run main/othervm -Diters=20000 -XX:-UseOnStackReplacement -XX:-BackgroundCompilation JdkInternalMiscUnsafeUnalignedAccess
+ *
+ * @run main/othervm -Diters=20000 -XX:-UseOnStackReplacement -XX:-BackgroundCompilation
+ *      compiler.unsafe.JdkInternalMiscUnsafeUnalignedAccess
  * @author volker.simonis@gmail.com
  */
 
+package compiler.unsafe;
+
+import jdk.internal.misc.Unsafe;
+
 import java.lang.reflect.Field;
 import java.nio.ByteOrder;
-import jdk.internal.misc.Unsafe;
 
 public class JdkInternalMiscUnsafeUnalignedAccess {
     static final int ITERS = Integer.getInteger("iters", 20_000);
diff --git a/hotspot/test/compiler/unsafe/SunMiscUnsafeAccessTestBoolean.java b/hotspot/test/compiler/unsafe/SunMiscUnsafeAccessTestBoolean.java
index c5349ff..7200bf7 100644
--- a/hotspot/test/compiler/unsafe/SunMiscUnsafeAccessTestBoolean.java
+++ b/hotspot/test/compiler/unsafe/SunMiscUnsafeAccessTestBoolean.java
@@ -25,13 +25,16 @@
  * @test
  * @bug 8143628
  * @summary Test unsafe access for boolean
+ *
  * @modules jdk.unsupported/sun.misc
- * @run testng/othervm -Diters=100   -Xint                   SunMiscUnsafeAccessTestBoolean
- * @run testng/othervm -Diters=20000 -XX:TieredStopAtLevel=1 SunMiscUnsafeAccessTestBoolean
- * @run testng/othervm -Diters=20000 -XX:-TieredCompilation  SunMiscUnsafeAccessTestBoolean
- * @run testng/othervm -Diters=20000                         SunMiscUnsafeAccessTestBoolean
+ * @run testng/othervm -Diters=100   -Xint                   compiler.unsafe.SunMiscUnsafeAccessTestBoolean
+ * @run testng/othervm -Diters=20000 -XX:TieredStopAtLevel=1 compiler.unsafe.SunMiscUnsafeAccessTestBoolean
+ * @run testng/othervm -Diters=20000 -XX:-TieredCompilation  compiler.unsafe.SunMiscUnsafeAccessTestBoolean
+ * @run testng/othervm -Diters=20000                         compiler.unsafe.SunMiscUnsafeAccessTestBoolean
  */
 
+package compiler.unsafe;
+
 import org.testng.annotations.Test;
 
 import java.lang.reflect.Field;
diff --git a/hotspot/test/compiler/unsafe/SunMiscUnsafeAccessTestByte.java b/hotspot/test/compiler/unsafe/SunMiscUnsafeAccessTestByte.java
index e15bd64..a30c01f 100644
--- a/hotspot/test/compiler/unsafe/SunMiscUnsafeAccessTestByte.java
+++ b/hotspot/test/compiler/unsafe/SunMiscUnsafeAccessTestByte.java
@@ -25,13 +25,16 @@
  * @test
  * @bug 8143628
  * @summary Test unsafe access for byte
+ *
  * @modules jdk.unsupported/sun.misc
- * @run testng/othervm -Diters=100   -Xint                   SunMiscUnsafeAccessTestByte
- * @run testng/othervm -Diters=20000 -XX:TieredStopAtLevel=1 SunMiscUnsafeAccessTestByte
- * @run testng/othervm -Diters=20000 -XX:-TieredCompilation  SunMiscUnsafeAccessTestByte
- * @run testng/othervm -Diters=20000                         SunMiscUnsafeAccessTestByte
+ * @run testng/othervm -Diters=100   -Xint                   compiler.unsafe.SunMiscUnsafeAccessTestByte
+ * @run testng/othervm -Diters=20000 -XX:TieredStopAtLevel=1 compiler.unsafe.SunMiscUnsafeAccessTestByte
+ * @run testng/othervm -Diters=20000 -XX:-TieredCompilation  compiler.unsafe.SunMiscUnsafeAccessTestByte
+ * @run testng/othervm -Diters=20000                         compiler.unsafe.SunMiscUnsafeAccessTestByte
  */
 
+package compiler.unsafe;
+
 import org.testng.annotations.Test;
 
 import java.lang.reflect.Field;
diff --git a/hotspot/test/compiler/unsafe/SunMiscUnsafeAccessTestChar.java b/hotspot/test/compiler/unsafe/SunMiscUnsafeAccessTestChar.java
index 3c34908..12dbb25 100644
--- a/hotspot/test/compiler/unsafe/SunMiscUnsafeAccessTestChar.java
+++ b/hotspot/test/compiler/unsafe/SunMiscUnsafeAccessTestChar.java
@@ -25,13 +25,16 @@
  * @test
  * @bug 8143628
  * @summary Test unsafe access for char
+ *
  * @modules jdk.unsupported/sun.misc
- * @run testng/othervm -Diters=100   -Xint                   SunMiscUnsafeAccessTestChar
- * @run testng/othervm -Diters=20000 -XX:TieredStopAtLevel=1 SunMiscUnsafeAccessTestChar
- * @run testng/othervm -Diters=20000 -XX:-TieredCompilation  SunMiscUnsafeAccessTestChar
- * @run testng/othervm -Diters=20000                         SunMiscUnsafeAccessTestChar
+ * @run testng/othervm -Diters=100   -Xint                   compiler.unsafe.SunMiscUnsafeAccessTestChar
+ * @run testng/othervm -Diters=20000 -XX:TieredStopAtLevel=1 compiler.unsafe.SunMiscUnsafeAccessTestChar
+ * @run testng/othervm -Diters=20000 -XX:-TieredCompilation  compiler.unsafe.SunMiscUnsafeAccessTestChar
+ * @run testng/othervm -Diters=20000                         compiler.unsafe.SunMiscUnsafeAccessTestChar
  */
 
+package compiler.unsafe;
+
 import org.testng.annotations.Test;
 
 import java.lang.reflect.Field;
diff --git a/hotspot/test/compiler/unsafe/SunMiscUnsafeAccessTestDouble.java b/hotspot/test/compiler/unsafe/SunMiscUnsafeAccessTestDouble.java
index 9300fc0..5fedde7 100644
--- a/hotspot/test/compiler/unsafe/SunMiscUnsafeAccessTestDouble.java
+++ b/hotspot/test/compiler/unsafe/SunMiscUnsafeAccessTestDouble.java
@@ -25,13 +25,16 @@
  * @test
  * @bug 8143628
  * @summary Test unsafe access for double
+ *
  * @modules jdk.unsupported/sun.misc
- * @run testng/othervm -Diters=100   -Xint                   SunMiscUnsafeAccessTestDouble
- * @run testng/othervm -Diters=20000 -XX:TieredStopAtLevel=1 SunMiscUnsafeAccessTestDouble
- * @run testng/othervm -Diters=20000 -XX:-TieredCompilation  SunMiscUnsafeAccessTestDouble
- * @run testng/othervm -Diters=20000                         SunMiscUnsafeAccessTestDouble
+ * @run testng/othervm -Diters=100   -Xint                   compiler.unsafe.SunMiscUnsafeAccessTestDouble
+ * @run testng/othervm -Diters=20000 -XX:TieredStopAtLevel=1 compiler.unsafe.SunMiscUnsafeAccessTestDouble
+ * @run testng/othervm -Diters=20000 -XX:-TieredCompilation  compiler.unsafe.SunMiscUnsafeAccessTestDouble
+ * @run testng/othervm -Diters=20000                         compiler.unsafe.SunMiscUnsafeAccessTestDouble
  */
 
+package compiler.unsafe;
+
 import org.testng.annotations.Test;
 
 import java.lang.reflect.Field;
diff --git a/hotspot/test/compiler/unsafe/SunMiscUnsafeAccessTestFloat.java b/hotspot/test/compiler/unsafe/SunMiscUnsafeAccessTestFloat.java
index 39a3f51..621e4ae 100644
--- a/hotspot/test/compiler/unsafe/SunMiscUnsafeAccessTestFloat.java
+++ b/hotspot/test/compiler/unsafe/SunMiscUnsafeAccessTestFloat.java
@@ -25,13 +25,16 @@
  * @test
  * @bug 8143628
  * @summary Test unsafe access for float
+ *
  * @modules jdk.unsupported/sun.misc
- * @run testng/othervm -Diters=100   -Xint                   SunMiscUnsafeAccessTestFloat
- * @run testng/othervm -Diters=20000 -XX:TieredStopAtLevel=1 SunMiscUnsafeAccessTestFloat
- * @run testng/othervm -Diters=20000 -XX:-TieredCompilation  SunMiscUnsafeAccessTestFloat
- * @run testng/othervm -Diters=20000                         SunMiscUnsafeAccessTestFloat
+ * @run testng/othervm -Diters=100   -Xint                   compiler.unsafe.SunMiscUnsafeAccessTestFloat
+ * @run testng/othervm -Diters=20000 -XX:TieredStopAtLevel=1 compiler.unsafe.SunMiscUnsafeAccessTestFloat
+ * @run testng/othervm -Diters=20000 -XX:-TieredCompilation  compiler.unsafe.SunMiscUnsafeAccessTestFloat
+ * @run testng/othervm -Diters=20000                         compiler.unsafe.SunMiscUnsafeAccessTestFloat
  */
 
+package compiler.unsafe;
+
 import org.testng.annotations.Test;
 
 import java.lang.reflect.Field;
diff --git a/hotspot/test/compiler/unsafe/SunMiscUnsafeAccessTestInt.java b/hotspot/test/compiler/unsafe/SunMiscUnsafeAccessTestInt.java
index 5b505ad..1e49aac 100644
--- a/hotspot/test/compiler/unsafe/SunMiscUnsafeAccessTestInt.java
+++ b/hotspot/test/compiler/unsafe/SunMiscUnsafeAccessTestInt.java
@@ -25,13 +25,16 @@
  * @test
  * @bug 8143628
  * @summary Test unsafe access for int
+ *
  * @modules jdk.unsupported/sun.misc
- * @run testng/othervm -Diters=100   -Xint                   SunMiscUnsafeAccessTestInt
- * @run testng/othervm -Diters=20000 -XX:TieredStopAtLevel=1 SunMiscUnsafeAccessTestInt
- * @run testng/othervm -Diters=20000 -XX:-TieredCompilation  SunMiscUnsafeAccessTestInt
- * @run testng/othervm -Diters=20000                         SunMiscUnsafeAccessTestInt
+ * @run testng/othervm -Diters=100   -Xint                   compiler.unsafe.SunMiscUnsafeAccessTestInt
+ * @run testng/othervm -Diters=20000 -XX:TieredStopAtLevel=1 compiler.unsafe.SunMiscUnsafeAccessTestInt
+ * @run testng/othervm -Diters=20000 -XX:-TieredCompilation  compiler.unsafe.SunMiscUnsafeAccessTestInt
+ * @run testng/othervm -Diters=20000                         compiler.unsafe.SunMiscUnsafeAccessTestInt
  */
 
+package compiler.unsafe;
+
 import org.testng.annotations.Test;
 
 import java.lang.reflect.Field;
diff --git a/hotspot/test/compiler/unsafe/SunMiscUnsafeAccessTestLong.java b/hotspot/test/compiler/unsafe/SunMiscUnsafeAccessTestLong.java
index 2864b04..e484bce 100644
--- a/hotspot/test/compiler/unsafe/SunMiscUnsafeAccessTestLong.java
+++ b/hotspot/test/compiler/unsafe/SunMiscUnsafeAccessTestLong.java
@@ -25,13 +25,16 @@
  * @test
  * @bug 8143628
  * @summary Test unsafe access for long
+ *
  * @modules jdk.unsupported/sun.misc
- * @run testng/othervm -Diters=100   -Xint                   SunMiscUnsafeAccessTestLong
- * @run testng/othervm -Diters=20000 -XX:TieredStopAtLevel=1 SunMiscUnsafeAccessTestLong
- * @run testng/othervm -Diters=20000 -XX:-TieredCompilation  SunMiscUnsafeAccessTestLong
- * @run testng/othervm -Diters=20000                         SunMiscUnsafeAccessTestLong
+ * @run testng/othervm -Diters=100   -Xint                   compiler.unsafe.SunMiscUnsafeAccessTestLong
+ * @run testng/othervm -Diters=20000 -XX:TieredStopAtLevel=1 compiler.unsafe.SunMiscUnsafeAccessTestLong
+ * @run testng/othervm -Diters=20000 -XX:-TieredCompilation  compiler.unsafe.SunMiscUnsafeAccessTestLong
+ * @run testng/othervm -Diters=20000                         compiler.unsafe.SunMiscUnsafeAccessTestLong
  */
 
+package compiler.unsafe;
+
 import org.testng.annotations.Test;
 
 import java.lang.reflect.Field;
diff --git a/hotspot/test/compiler/unsafe/SunMiscUnsafeAccessTestObject.java b/hotspot/test/compiler/unsafe/SunMiscUnsafeAccessTestObject.java
index b56cc41..1241f0f 100644
--- a/hotspot/test/compiler/unsafe/SunMiscUnsafeAccessTestObject.java
+++ b/hotspot/test/compiler/unsafe/SunMiscUnsafeAccessTestObject.java
@@ -25,13 +25,16 @@
  * @test
  * @bug 8143628
  * @summary Test unsafe access for Object
+ *
  * @modules jdk.unsupported/sun.misc
- * @run testng/othervm -Diters=100   -Xint                   SunMiscUnsafeAccessTestObject
- * @run testng/othervm -Diters=20000 -XX:TieredStopAtLevel=1 SunMiscUnsafeAccessTestObject
- * @run testng/othervm -Diters=20000 -XX:-TieredCompilation  SunMiscUnsafeAccessTestObject
- * @run testng/othervm -Diters=20000                         SunMiscUnsafeAccessTestObject
+ * @run testng/othervm -Diters=100   -Xint                   compiler.unsafe.SunMiscUnsafeAccessTestObject
+ * @run testng/othervm -Diters=20000 -XX:TieredStopAtLevel=1 compiler.unsafe.SunMiscUnsafeAccessTestObject
+ * @run testng/othervm -Diters=20000 -XX:-TieredCompilation  compiler.unsafe.SunMiscUnsafeAccessTestObject
+ * @run testng/othervm -Diters=20000                         compiler.unsafe.SunMiscUnsafeAccessTestObject
  */
 
+package compiler.unsafe;
+
 import org.testng.annotations.Test;
 
 import java.lang.reflect.Field;
diff --git a/hotspot/test/compiler/unsafe/SunMiscUnsafeAccessTestShort.java b/hotspot/test/compiler/unsafe/SunMiscUnsafeAccessTestShort.java
index 4d43464..d1d7b63 100644
--- a/hotspot/test/compiler/unsafe/SunMiscUnsafeAccessTestShort.java
+++ b/hotspot/test/compiler/unsafe/SunMiscUnsafeAccessTestShort.java
@@ -25,13 +25,16 @@
  * @test
  * @bug 8143628
  * @summary Test unsafe access for short
+ *
  * @modules jdk.unsupported/sun.misc
- * @run testng/othervm -Diters=100   -Xint                   SunMiscUnsafeAccessTestShort
- * @run testng/othervm -Diters=20000 -XX:TieredStopAtLevel=1 SunMiscUnsafeAccessTestShort
- * @run testng/othervm -Diters=20000 -XX:-TieredCompilation  SunMiscUnsafeAccessTestShort
- * @run testng/othervm -Diters=20000                         SunMiscUnsafeAccessTestShort
+ * @run testng/othervm -Diters=100   -Xint                   compiler.unsafe.SunMiscUnsafeAccessTestShort
+ * @run testng/othervm -Diters=20000 -XX:TieredStopAtLevel=1 compiler.unsafe.SunMiscUnsafeAccessTestShort
+ * @run testng/othervm -Diters=20000 -XX:-TieredCompilation  compiler.unsafe.SunMiscUnsafeAccessTestShort
+ * @run testng/othervm -Diters=20000                         compiler.unsafe.SunMiscUnsafeAccessTestShort
  */
 
+package compiler.unsafe;
+
 import org.testng.annotations.Test;
 
 import java.lang.reflect.Field;
diff --git a/hotspot/test/compiler/unsafe/TestUnsafeLoadControl.java b/hotspot/test/compiler/unsafe/TestUnsafeLoadControl.java
index 3fc0e82..fde5d53 100644
--- a/hotspot/test/compiler/unsafe/TestUnsafeLoadControl.java
+++ b/hotspot/test/compiler/unsafe/TestUnsafeLoadControl.java
@@ -26,13 +26,17 @@
  * @bug 8077504
  * @summary Unsafe load can loose control dependency and cause crash
  * @modules java.base/jdk.internal.misc
- * @run main/othervm -XX:-BackgroundCompilation -XX:-UseOnStackReplacement TestUnsafeLoadControl
  *
+ * @run main/othervm -XX:-BackgroundCompilation -XX:-UseOnStackReplacement
+ *                   compiler.unsafe.TestUnsafeLoadControl
  */
 
-import java.lang.reflect.Field;
+package compiler.unsafe;
+
 import jdk.internal.misc.Unsafe;
 
+import java.lang.reflect.Field;
+
 public class TestUnsafeLoadControl {
 
     private static final Unsafe UNSAFE;
diff --git a/hotspot/test/compiler/unsafe/UnsafeGetConstantField.java b/hotspot/test/compiler/unsafe/UnsafeGetConstantField.java
index 7701443..d897ba9 100644
--- a/hotspot/test/compiler/unsafe/UnsafeGetConstantField.java
+++ b/hotspot/test/compiler/unsafe/UnsafeGetConstantField.java
@@ -28,7 +28,7 @@
  * @summary tests on constant folding of unsafe get operations
  * @library /testlibrary
  *
- * @requires vm.flavor != "client"
+ * @requires vm.flavor == "server"
  *
  * @modules java.base/jdk.internal.org.objectweb.asm
  *          java.base/jdk.internal.vm.annotation
@@ -37,24 +37,26 @@
  * @run main/bootclasspath/othervm -XX:+UnlockDiagnosticVMOptions
  *                                 -Xbatch -XX:-TieredCompilation
  *                                 -XX:+FoldStableValues
- *                                 -XX:CompileCommand=dontinline,UnsafeGetConstantField.checkGetAddress()
- *                                 -XX:CompileCommand=dontinline,*.test*
+ *                                 -XX:CompileCommand=dontinline,compiler.unsafe.UnsafeGetConstantField::checkGetAddress
+ *                                 -XX:CompileCommand=dontinline,*::test*
  *                                 -XX:+UseUnalignedAccesses
- *                         -XaddReads:java.base=ALL-UNNAMED
+ *                                 -XaddReads:java.base=ALL-UNNAMED
  *                                 compiler.unsafe.UnsafeGetConstantField
  *
  * @run main/bootclasspath/othervm -XX:+UnlockDiagnosticVMOptions
  *                                 -Xbatch -XX:-TieredCompilation
  *                                 -XX:+FoldStableValues
- *                                 -XX:CompileCommand=dontinline,UnsafeGetConstantField.checkGetAddress()
- *                                 -XX:CompileCommand=dontinline,*.test*
- *                                 -XX:CompileCommand=inline,*Unsafe.get*
+ *                                 -XX:CompileCommand=dontinline,compiler.unsafe.UnsafeGetConstantField::checkGetAddress
+ *                                 -XX:CompileCommand=dontinline,*::test*
+ *                                 -XX:CompileCommand=inline,*Unsafe::get*
  *                                 -XX:-UseUnalignedAccesses
- *                         -XaddReads:java.base=ALL-UNNAMED
+ *                                 -XaddReads:java.base=ALL-UNNAMED
  *                                 compiler.unsafe.UnsafeGetConstantField
  */
+
 package compiler.unsafe;
 
+import jdk.internal.misc.Unsafe;
 import jdk.internal.org.objectweb.asm.ClassWriter;
 import jdk.internal.org.objectweb.asm.FieldVisitor;
 import jdk.internal.org.objectweb.asm.MethodVisitor;
@@ -63,25 +65,40 @@
 import jdk.internal.vm.annotation.Stable;
 import jdk.test.lib.Asserts;
 import jdk.test.lib.Platform;
-import jdk.internal.misc.Unsafe;
 
 import java.io.IOException;
 import java.nio.file.Files;
 import java.nio.file.Path;
 import java.nio.file.Paths;
 
-import static jdk.internal.org.objectweb.asm.Opcodes.*;
+import static jdk.internal.org.objectweb.asm.Opcodes.ACC_FINAL;
+import static jdk.internal.org.objectweb.asm.Opcodes.ACC_PUBLIC;
+import static jdk.internal.org.objectweb.asm.Opcodes.ACC_STATIC;
+import static jdk.internal.org.objectweb.asm.Opcodes.ACONST_NULL;
+import static jdk.internal.org.objectweb.asm.Opcodes.ALOAD;
+import static jdk.internal.org.objectweb.asm.Opcodes.ARETURN;
+import static jdk.internal.org.objectweb.asm.Opcodes.DUP;
+import static jdk.internal.org.objectweb.asm.Opcodes.GETFIELD;
+import static jdk.internal.org.objectweb.asm.Opcodes.GETSTATIC;
+import static jdk.internal.org.objectweb.asm.Opcodes.INVOKESPECIAL;
+import static jdk.internal.org.objectweb.asm.Opcodes.INVOKESTATIC;
+import static jdk.internal.org.objectweb.asm.Opcodes.INVOKEVIRTUAL;
+import static jdk.internal.org.objectweb.asm.Opcodes.NEW;
+import static jdk.internal.org.objectweb.asm.Opcodes.PUTFIELD;
+import static jdk.internal.org.objectweb.asm.Opcodes.PUTSTATIC;
+import static jdk.internal.org.objectweb.asm.Opcodes.RETURN;
 
 public class UnsafeGetConstantField {
     static final Class<?> THIS_CLASS = UnsafeGetConstantField.class;
     static final Unsafe U = Unsafe.getUnsafe();
 
     public static void main(String[] args) {
-        if (Platform.isServer()) {
-            testUnsafeGetAddress();
-            testUnsafeGetField();
-            testUnsafeGetFieldUnaligned();
+        if (!Platform.isServer()) {
+            throw new Error("TESTBUG: Not server VM");
         }
+        testUnsafeGetAddress();
+        testUnsafeGetField();
+        testUnsafeGetFieldUnaligned();
         System.out.println("TEST PASSED");
     }
 
diff --git a/hotspot/test/compiler/unsafe/UnsafeGetStableArrayElement.java b/hotspot/test/compiler/unsafe/UnsafeGetStableArrayElement.java
index c4d5672..956e993 100644
--- a/hotspot/test/compiler/unsafe/UnsafeGetStableArrayElement.java
+++ b/hotspot/test/compiler/unsafe/UnsafeGetStableArrayElement.java
@@ -28,7 +28,7 @@
  * @summary tests on constant folding of unsafe get operations from stable arrays
  * @library /testlibrary
  *
- * @requires vm.flavor != "client"
+ * @requires vm.flavor == "server"
  *
  * @modules java.base/jdk.internal.vm.annotation
  *          java.base/jdk.internal.misc
@@ -39,15 +39,18 @@
  *                   -XX:CompileCommand=dontinline,*Test::test*
  *                   compiler.unsafe.UnsafeGetStableArrayElement
  */
+
 package compiler.unsafe;
 
 import jdk.internal.misc.Unsafe;
 import jdk.internal.vm.annotation.Stable;
-import java.util.concurrent.Callable;
 import jdk.test.lib.Platform;
 
+import java.util.concurrent.Callable;
+
 import static jdk.internal.misc.Unsafe.*;
-import static jdk.test.lib.Asserts.*;
+import static jdk.test.lib.Asserts.assertEQ;
+import static jdk.test.lib.Asserts.assertNE;
 
 public class UnsafeGetStableArrayElement {
     @Stable static final boolean[] STABLE_BOOLEAN_ARRAY = new boolean[16];
@@ -329,9 +332,10 @@
     }
 
     public static void main(String[] args) throws Exception {
-        if (Platform.isServer()) {
-            testUnsafeAccess();
+        if (!Platform.isServer()) {
+            throw new Error("TESTBUG: Not server VM");
         }
+        testUnsafeAccess();
         System.out.println("TEST PASSED");
     }
 }
diff --git a/hotspot/test/compiler/unsafe/UnsafeRaw.java b/hotspot/test/compiler/unsafe/UnsafeRaw.java
index bb2e9a1..af1a1cd 100644
--- a/hotspot/test/compiler/unsafe/UnsafeRaw.java
+++ b/hotspot/test/compiler/unsafe/UnsafeRaw.java
@@ -28,12 +28,15 @@
  * @library /testlibrary
  * @modules java.base/jdk.internal.misc
  *          java.management
- * @run main/othervm -Xbatch UnsafeRaw
+ * @run main/othervm -Xbatch compiler.unsafe.UnsafeRaw
  */
 
-import jdk.test.lib.Utils;
-import java.util.Random;
+package compiler.unsafe;
+
 import jdk.internal.misc.Unsafe;
+import jdk.test.lib.Utils;
+
+import java.util.Random;
 
 public class UnsafeRaw {
   public static class Tests {
diff --git a/hotspot/test/compiler/unsafe/X-UnsafeAccessTest.java.template b/hotspot/test/compiler/unsafe/X-UnsafeAccessTest.java.template
index 2d1743ed..55ed81f 100644
--- a/hotspot/test/compiler/unsafe/X-UnsafeAccessTest.java.template
+++ b/hotspot/test/compiler/unsafe/X-UnsafeAccessTest.java.template
@@ -25,13 +25,16 @@
  * @test
  * @bug 8143628
  * @summary Test unsafe access for $type$
+ *
  * @modules $module$/$package$
- * @run testng/othervm -Diters=100   -Xint                   $Qualifier$UnsafeAccessTest$Type$
- * @run testng/othervm -Diters=20000 -XX:TieredStopAtLevel=1 $Qualifier$UnsafeAccessTest$Type$
- * @run testng/othervm -Diters=20000 -XX:-TieredCompilation  $Qualifier$UnsafeAccessTest$Type$
- * @run testng/othervm -Diters=20000                         $Qualifier$UnsafeAccessTest$Type$
+ * @run testng/othervm -Diters=100   -Xint                   compiler.unsafe.$Qualifier$UnsafeAccessTest$Type$
+ * @run testng/othervm -Diters=20000 -XX:TieredStopAtLevel=1 compiler.unsafe.$Qualifier$UnsafeAccessTest$Type$
+ * @run testng/othervm -Diters=20000 -XX:-TieredCompilation  compiler.unsafe.$Qualifier$UnsafeAccessTest$Type$
+ * @run testng/othervm -Diters=20000                         compiler.unsafe.$Qualifier$UnsafeAccessTest$Type$
  */
 
+package compiler.unsafe;
+
 import org.testng.annotations.Test;
 
 import java.lang.reflect.Field;
diff --git a/hotspot/test/compiler/vectorization/TestNaNVector.java b/hotspot/test/compiler/vectorization/TestNaNVector.java
new file mode 100644
index 0000000..d19f42e
--- /dev/null
+++ b/hotspot/test/compiler/vectorization/TestNaNVector.java
@@ -0,0 +1,89 @@
+/*
+ * 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.
+ */
+
+/**
+ * @test
+ * @bug 8160425
+ * @summary Test vectorization with a signalling NaN.
+ * @run main/othervm -XX:+IgnoreUnrecognizedVMOptions -XX:-OptimizeFill
+ *      compiler.vectorization.TestNaNVector
+ * @run main/othervm -XX:+IgnoreUnrecognizedVMOptions -XX:-OptimizeFill
+ *      -XX:MaxVectorSize=4 compiler.vectorization.TestNaNVector
+ */
+
+package compiler.vectorization;
+
+public class TestNaNVector {
+    private char[] array;
+    private static final int LEN = 1024;
+
+    public static void main(String args[]) {
+        TestNaNVector test = new TestNaNVector();
+        // Check double precision NaN
+        for (int i = 0; i < 10_000; ++i) {
+          test.vectorizeNaNDP();
+        }
+        System.out.println("Checking double precision Nan");
+        test.checkResult(0xfff7);
+
+        // Check single precision NaN
+        for (int i = 0; i < 10_000; ++i) {
+          test.vectorizeNaNSP();
+        }
+        System.out.println("Checking single precision Nan");
+        test.checkResult(0xff80);
+    }
+
+    public TestNaNVector() {
+        array = new char[LEN];
+    }
+
+    public void vectorizeNaNDP() {
+        // This loop will be vectorized and the array store will be replaced by
+        // a 64-bit vector store to four subsequent array elements. The vector
+        // should look like this '0xfff7fff7fff7fff7' and is read from the constant
+        // table. However, in floating point arithmetic this is a signalling NaN
+        // which may be converted to a quiet NaN when processed by the x87 FPU.
+        // If the signalling bit is set, the vector ends up in the constant table
+        // as '0xfffffff7fff7fff7' which leads to an incorrect result.
+        for (int i = 0; i < LEN; ++i) {
+            array[i] = 0xfff7;
+        }
+    }
+
+    public void vectorizeNaNSP() {
+        // Same as above but with single precision
+        for (int i = 0; i < LEN; ++i) {
+            array[i] = 0xff80;
+        }
+    }
+
+    public void checkResult(int expected) {
+        for (int i = 0; i < LEN; ++i) {
+            if (array[i] != expected) {
+                throw new RuntimeException("Invalid result: array[" + i + "] = " + (int)array[i] + " != " + expected);
+            }
+        }
+    }
+}
+
diff --git a/hotspot/test/compiler/vectorization/TestVectorUnalignedOffset.java b/hotspot/test/compiler/vectorization/TestVectorUnalignedOffset.java
index 081a6d9f..c3f80c1 100644
--- a/hotspot/test/compiler/vectorization/TestVectorUnalignedOffset.java
+++ b/hotspot/test/compiler/vectorization/TestVectorUnalignedOffset.java
@@ -25,10 +25,11 @@
  * @test
  * @bug 8155612
  * @summary Aarch64: vector nodes need to support misaligned offset
- * @run main/othervm -XX:-BackgroundCompilation TestVectorUnalignedOffset
  *
+ * @run main/othervm -XX:-BackgroundCompilation compiler.vectorization.TestVectorUnalignedOffset
  */
 
+package compiler.vectorization;
 
 public class TestVectorUnalignedOffset {
 
diff --git a/hotspot/test/compiler/whitebox/AllocationCodeBlobTest.java b/hotspot/test/compiler/whitebox/AllocationCodeBlobTest.java
index db37118..8f65176 100644
--- a/hotspot/test/compiler/whitebox/AllocationCodeBlobTest.java
+++ b/hotspot/test/compiler/whitebox/AllocationCodeBlobTest.java
@@ -22,32 +22,37 @@
  *
  */
 
-import java.lang.management.MemoryPoolMXBean;
-import java.util.EnumSet;
-import java.util.ArrayList;
-
-import sun.hotspot.WhiteBox;
-import sun.hotspot.code.BlobType;
-import jdk.test.lib.Asserts;
-import jdk.test.lib.InfiniteLoop;
-
 /*
  * @test AllocationCodeBlobTest
- * @bug 8059624 8064669
- * @library /testlibrary /test/lib
- * @modules java.base/jdk.internal.misc
- * @modules java.management
- * @build AllocationCodeBlobTest
- * @run main ClassFileInstaller sun.hotspot.WhiteBox
- *                              sun.hotspot.WhiteBox$WhiteBoxPermission
- * @run main/othervm -Xbootclasspath/a:. -XX:+UnlockDiagnosticVMOptions
- *                   -XX:+WhiteBoxAPI -XX:CompileCommand=compileonly,null::*
- *                   -XX:-SegmentedCodeCache AllocationCodeBlobTest
- * @run main/othervm -Xbootclasspath/a:. -XX:+UnlockDiagnosticVMOptions
- *                   -XX:+WhiteBoxAPI -XX:CompileCommand=compileonly,null::*
- *                   -XX:+SegmentedCodeCache AllocationCodeBlobTest
  * @summary testing of WB::allocate/freeCodeBlob()
+ * @bug 8059624 8064669
+ * @library /testlibrary /test/lib /
+ * @modules java.base/jdk.internal.misc
+ *          java.management
+ * @build compiler.whitebox.AllocationCodeBlobTest
+ * @run driver ClassFileInstaller sun.hotspot.WhiteBox
+ *                                sun.hotspot.WhiteBox$WhiteBoxPermission
+ * @run main/othervm -Xbootclasspath/a:. -XX:+UnlockDiagnosticVMOptions
+ *                   -XX:+WhiteBoxAPI -XX:CompileCommand=compileonly,null::*
+ *                   -XX:-SegmentedCodeCache
+ *                   compiler.whitebox.AllocationCodeBlobTest
+ * @run main/othervm -Xbootclasspath/a:. -XX:+UnlockDiagnosticVMOptions
+ *                   -XX:+WhiteBoxAPI -XX:CompileCommand=compileonly,null::*
+ *                   -XX:+SegmentedCodeCache
+ *                   compiler.whitebox.AllocationCodeBlobTest
  */
+
+package compiler.whitebox;
+
+import jdk.test.lib.Asserts;
+import jdk.test.lib.InfiniteLoop;
+import sun.hotspot.WhiteBox;
+import sun.hotspot.code.BlobType;
+
+import java.lang.management.MemoryPoolMXBean;
+import java.util.ArrayList;
+import java.util.EnumSet;
+
 public class AllocationCodeBlobTest {
     private static final WhiteBox WHITE_BOX = WhiteBox.getWhiteBox();
     private static final long CODE_CACHE_SIZE
diff --git a/hotspot/test/compiler/whitebox/BlockingCompilation.java b/hotspot/test/compiler/whitebox/BlockingCompilation.java
index 927cfea..a89ab05 100644
--- a/hotspot/test/compiler/whitebox/BlockingCompilation.java
+++ b/hotspot/test/compiler/whitebox/BlockingCompilation.java
@@ -31,19 +31,22 @@
  *        compiler.testlibrary.CompilerUtils
  * @run driver ClassFileInstaller sun.hotspot.WhiteBox
  *                                sun.hotspot.WhiteBox$WhiteBoxPermission
- * @run main/othervm/timeout=60
+ * @run main/othervm
  *        -Xbootclasspath/a:.
  *        -Xmixed
  *        -XX:+UnlockDiagnosticVMOptions
  *        -XX:+WhiteBoxAPI
  *        -XX:+PrintCompilation
- *        BlockingCompilation
+ *        compiler.whitebox.BlockingCompilation
  */
 
+package compiler.whitebox;
+
 import compiler.testlibrary.CompilerUtils;
+import sun.hotspot.WhiteBox;
+
 import java.lang.reflect.Method;
 import java.util.Random;
-import sun.hotspot.WhiteBox;
 
 public class BlockingCompilation {
     private static final WhiteBox WB = WhiteBox.getWhiteBox();
@@ -94,7 +97,9 @@
 
         // Blocking compilations on all levels, using the default versions of
         // WB.enqueueMethodForCompilation() and manually setting compiler directives.
-        String directive = "[{ match: \"BlockingCompilation.foo\", BackgroundCompilation: false }]";
+        String directive = "[{ match: \""
+                + BlockingCompilation.class.getName().replace('.', '/')
+                + ".foo\", BackgroundCompilation: false }]";
         if (WB.addCompilerDirective(directive) != 1) {
             throw new Exception("Failed to add compiler directive");
         }
diff --git a/hotspot/test/compiler/whitebox/ClearMethodStateTest.java b/hotspot/test/compiler/whitebox/ClearMethodStateTest.java
index 38eb99a..d0a06f9 100644
--- a/hotspot/test/compiler/whitebox/ClearMethodStateTest.java
+++ b/hotspot/test/compiler/whitebox/ClearMethodStateTest.java
@@ -21,23 +21,23 @@
  * questions.
  */
 
-import java.util.function.Function;
-
-import compiler.whitebox.CompilerWhiteBoxTest;
-
 /*
  * @test ClearMethodStateTest
  * @bug 8006683 8007288 8022832
+ * @summary testing of WB::clearMethodState()
  * @library /testlibrary /test/lib /
  * @modules java.base/jdk.internal.misc
- * @modules java.management
- * @build ClearMethodStateTest
+ *          java.management
+ * @build compiler.whitebox.ClearMethodStateTest
  * @run driver ClassFileInstaller sun.hotspot.WhiteBox
  *                                sun.hotspot.WhiteBox$WhiteBoxPermission
- * @run main/othervm -Xbootclasspath/a:. -Xmixed -XX:+UnlockDiagnosticVMOptions -XX:+WhiteBoxAPI -XX:+PrintCompilation -XX:-UseCounterDecay ClearMethodStateTest
- * @summary testing of WB::clearMethodState()
- * @author igor.ignatyev@oracle.com
+ * @run main/othervm -Xbootclasspath/a:. -Xmixed -XX:+UnlockDiagnosticVMOptions
+ *                   -XX:+WhiteBoxAPI -XX:+PrintCompilation -XX:-UseCounterDecay
+ *                   compiler.whitebox.ClearMethodStateTest
  */
+
+package compiler.whitebox;
+
 public class ClearMethodStateTest extends CompilerWhiteBoxTest {
 
     public static void main(String[] args) throws Exception {
diff --git a/hotspot/test/compiler/whitebox/CompilerWhiteBoxTest.java b/hotspot/test/compiler/whitebox/CompilerWhiteBoxTest.java
index e83cd1e..bc46d9e 100644
--- a/hotspot/test/compiler/whitebox/CompilerWhiteBoxTest.java
+++ b/hotspot/test/compiler/whitebox/CompilerWhiteBoxTest.java
@@ -20,8 +20,10 @@
  * or visit www.oracle.com if you need additional information or have any
  * questions.
  */
+
 package compiler.whitebox;
 
+import jdk.test.lib.Platform;
 import sun.hotspot.WhiteBox;
 import sun.hotspot.code.NMethod;
 
@@ -32,6 +34,7 @@
 
 /**
  * Abstract class for WhiteBox testing of JIT.
+ * Depends on jdk.test.lib.Platform from testlibrary.
  *
  * @author igor.ignatyev@oracle.com
  */
@@ -74,8 +77,6 @@
     public static final int THRESHOLD;
     /** invocation count to trigger OSR compilation */
     protected static final long BACKEDGE_THRESHOLD;
-    /** Value of {@code java.vm.info} (interpreted|mixed|comp mode) */
-    protected static final String MODE = System.getProperty("java.vm.info");
 
     static {
         if (TIERED_COMPILATION) {
@@ -164,10 +165,8 @@
      * @see #test()
      */
     protected final void runTest() {
-        if (CompilerWhiteBoxTest.MODE.startsWith("interpreted ")) {
-            System.err.println(
-                    "Warning: test is not applicable in interpreted mode");
-            return;
+        if (Platform.isInt()) {
+            throw new Error("TESTBUG: test can not be run in interpreter");
         }
         System.out.println("at test's start:");
         printInfo();
@@ -430,11 +429,10 @@
      *          Xcomp, otherwise {@code false}
      */
     protected boolean skipXcompOSR() {
-        boolean result =  testCase.isOsr()
-                && CompilerWhiteBoxTest.MODE.startsWith("compiled ");
+        boolean result = testCase.isOsr() && Platform.isComp();
         if (result && IS_VERBOSE) {
             System.err.printf("Warning: %s is not applicable in %s%n",
-                    testCase.name(), CompilerWhiteBoxTest.MODE);
+                    testCase.name(), Platform.vmInfo);
         }
         return result;
     }
diff --git a/hotspot/test/compiler/whitebox/DeoptimizeAllTest.java b/hotspot/test/compiler/whitebox/DeoptimizeAllTest.java
index e479149..2a718fc 100644
--- a/hotspot/test/compiler/whitebox/DeoptimizeAllTest.java
+++ b/hotspot/test/compiler/whitebox/DeoptimizeAllTest.java
@@ -21,21 +21,24 @@
  * questions.
  */
 
-import compiler.whitebox.CompilerWhiteBoxTest;
-
 /*
  * @test DeoptimizeAllTest
  * @bug 8006683 8007288 8022832
+ * @summary testing of WB::deoptimizeAll()
  * @library /testlibrary /test/lib /
  * @modules java.base/jdk.internal.misc
- * @modules java.management
- * @build DeoptimizeAllTest
+ *          java.management
+ * @build compiler.whitebox.DeoptimizeAllTest
  * @run driver ClassFileInstaller sun.hotspot.WhiteBox
- *                              sun.hotspot.WhiteBox$WhiteBoxPermission
- * @run main/othervm -Xbootclasspath/a:. -XX:+UnlockDiagnosticVMOptions -XX:+WhiteBoxAPI -XX:-UseCounterDecay -XX:CompileCommand=compileonly,compiler.whitebox.SimpleTestCaseHelper::* DeoptimizeAllTest
- * @summary testing of WB::deoptimizeAll()
- * @author igor.ignatyev@oracle.com
+ *                                sun.hotspot.WhiteBox$WhiteBoxPermission
+ * @run main/othervm -Xbootclasspath/a:. -XX:+UnlockDiagnosticVMOptions
+ *                   -XX:+WhiteBoxAPI -XX:-UseCounterDecay
+ *                   -XX:CompileCommand=compileonly,compiler.whitebox.SimpleTestCaseHelper::*
+ *                   compiler.whitebox.DeoptimizeAllTest
  */
+
+package compiler.whitebox;
+
 public class DeoptimizeAllTest extends CompilerWhiteBoxTest {
 
     public static void main(String[] args) throws Exception {
diff --git a/hotspot/test/compiler/whitebox/DeoptimizeFramesTest.java b/hotspot/test/compiler/whitebox/DeoptimizeFramesTest.java
index ce21094..62f4154 100644
--- a/hotspot/test/compiler/whitebox/DeoptimizeFramesTest.java
+++ b/hotspot/test/compiler/whitebox/DeoptimizeFramesTest.java
@@ -21,37 +21,37 @@
  * questions.
  */
 
-import compiler.whitebox.CompilerWhiteBoxTest;
-
 /*
  * @test DeoptimizeFramesTest
  * @bug 8028595
+ * @summary testing of WB::deoptimizeFrames()
  * @library /testlibrary /test/lib /
  * @modules java.base/jdk.internal.misc
- * @modules java.management
- * @build DeoptimizeFramesTest
+ *          java.management
+ * @build compiler.whitebox.DeoptimizeFramesTest
  * @run driver ClassFileInstaller sun.hotspot.WhiteBox
- *                              sun.hotspot.WhiteBox$WhiteBoxPermission
+ *                                sun.hotspot.WhiteBox$WhiteBoxPermission
  * @run main/othervm -Xbootclasspath/a:. -XX:+UnlockDiagnosticVMOptions
  *                   -XX:+WhiteBoxAPI -Xmixed -XX:-UseCounterDecay
- *                   -XX:CompileCommand=compileonly,DeoptimizeFramesTest$TestCaseImpl::method
+ *                   -XX:CompileCommand=compileonly,compiler.whitebox.DeoptimizeFramesTest$TestCaseImpl::method
  *                   -XX:+IgnoreUnrecognizedVMOptions -XX:-DeoptimizeRandom -XX:-DeoptimizeALot
- *                   DeoptimizeFramesTest true
+ *                   compiler.whitebox.DeoptimizeFramesTest true
  * @run main/othervm -Xbootclasspath/a:. -XX:+UnlockDiagnosticVMOptions
  *                   -XX:+WhiteBoxAPI -Xmixed -XX:-UseCounterDecay
- *                   -XX:CompileCommand=compileonly,DeoptimizeFramesTest$TestCaseImpl::method
+ *                   -XX:CompileCommand=compileonly,compiler.whitebox.DeoptimizeFramesTest$TestCaseImpl::method
  *                   -XX:+IgnoreUnrecognizedVMOptions -XX:-DeoptimizeRandom -XX:-DeoptimizeALot
- *                   DeoptimizeFramesTest false
- * @summary testing of WB::deoptimizeFrames()
+ *                   compiler.whitebox.DeoptimizeFramesTest false
  */
+
+package compiler.whitebox;
+
+import jdk.test.lib.Asserts;
+import sun.hotspot.code.NMethod;
+
 import java.lang.reflect.Executable;
 import java.util.concurrent.Callable;
 import java.util.concurrent.Phaser;
 
-import sun.hotspot.code.NMethod;
-import jdk.test.lib.Asserts;
-import jdk.test.lib.InfiniteLoop;
-
 public class DeoptimizeFramesTest extends CompilerWhiteBoxTest {
     private final boolean makeNotEntrant;
     private final Phaser phaser;
diff --git a/hotspot/test/compiler/whitebox/DeoptimizeMethodTest.java b/hotspot/test/compiler/whitebox/DeoptimizeMethodTest.java
index 71ef586..f505bbd 100644
--- a/hotspot/test/compiler/whitebox/DeoptimizeMethodTest.java
+++ b/hotspot/test/compiler/whitebox/DeoptimizeMethodTest.java
@@ -21,21 +21,24 @@
  * questions.
  */
 
-import compiler.whitebox.CompilerWhiteBoxTest;
-
 /*
  * @test DeoptimizeMethodTest
  * @bug 8006683 8007288 8022832
+ * @summary testing of WB::deoptimizeMethod()
  * @library /testlibrary /test/lib /
  * @modules java.base/jdk.internal.misc
- * @modules java.management
- * @build DeoptimizeMethodTest
+ *          java.management
+ * @build compiler.whitebox.DeoptimizeMethodTest
  * @run driver ClassFileInstaller sun.hotspot.WhiteBox
  *                                sun.hotspot.WhiteBox$WhiteBoxPermission
- * @run main/othervm -Xbootclasspath/a:. -XX:+UnlockDiagnosticVMOptions -XX:+WhiteBoxAPI -XX:-UseCounterDecay -XX:CompileCommand=compileonly,compiler.whitebox.SimpleTestCaseHelper::* DeoptimizeMethodTest
- * @summary testing of WB::deoptimizeMethod()
- * @author igor.ignatyev@oracle.com
+ * @run main/othervm -Xbootclasspath/a:. -XX:+UnlockDiagnosticVMOptions
+ *                   -XX:+WhiteBoxAPI -XX:-UseCounterDecay
+ *                   -XX:CompileCommand=compileonly,compiler.whitebox.SimpleTestCaseHelper::*
+ *                   compiler.whitebox.DeoptimizeMethodTest
  */
+
+package compiler.whitebox;
+
 public class DeoptimizeMethodTest extends CompilerWhiteBoxTest {
 
     public static void main(String[] args) throws Exception {
diff --git a/hotspot/test/compiler/whitebox/DeoptimizeMultipleOSRTest.java b/hotspot/test/compiler/whitebox/DeoptimizeMultipleOSRTest.java
index 82397fe..c5ec028 100644
--- a/hotspot/test/compiler/whitebox/DeoptimizeMultipleOSRTest.java
+++ b/hotspot/test/compiler/whitebox/DeoptimizeMultipleOSRTest.java
@@ -21,23 +21,28 @@
  * questions.
  */
 
-import sun.hotspot.WhiteBox;
-import java.lang.reflect.Executable;
-import java.lang.reflect.Method;
-import compiler.whitebox.CompilerWhiteBoxTest;
 
 /*
  * @test DeoptimizeMultipleOSRTest
  * @bug 8061817
+ * @summary testing of WB::deoptimizeMethod()
  * @library /testlibrary /test/lib /
  * @modules java.base/jdk.internal.misc
- * @modules java.management
- * @build DeoptimizeMultipleOSRTest
- * @run main ClassFileInstaller sun.hotspot.WhiteBox
- *                              sun.hotspot.WhiteBox$WhiteBoxPermission
- * @run main/othervm -Xbootclasspath/a:. -XX:+UnlockDiagnosticVMOptions -XX:+WhiteBoxAPI -XX:CompileCommand=compileonly,DeoptimizeMultipleOSRTest::triggerOSR DeoptimizeMultipleOSRTest
- * @summary testing of WB::deoptimizeMethod()
+ *          java.management
+ * @build compiler.whitebox.DeoptimizeMultipleOSRTest
+ * @run driver ClassFileInstaller sun.hotspot.WhiteBox
+ *                                sun.hotspot.WhiteBox$WhiteBoxPermission
+ * @run main/othervm -Xbootclasspath/a:. -XX:+UnlockDiagnosticVMOptions -XX:+WhiteBoxAPI
+ *                   -XX:CompileCommand=compileonly,compiler.whitebox.DeoptimizeMultipleOSRTest::triggerOSR
+ *                   compiler.whitebox.DeoptimizeMultipleOSRTest
  */
+
+package compiler.whitebox;
+
+import sun.hotspot.WhiteBox;
+
+import java.lang.reflect.Method;
+
 public class DeoptimizeMultipleOSRTest {
     private static final WhiteBox WHITE_BOX = WhiteBox.getWhiteBox();
     private static final long BACKEDGE_THRESHOLD = 150000;
diff --git a/hotspot/test/compiler/whitebox/EnqueueMethodForCompilationTest.java b/hotspot/test/compiler/whitebox/EnqueueMethodForCompilationTest.java
index 3bf0a1d..ccb8ab0 100644
--- a/hotspot/test/compiler/whitebox/EnqueueMethodForCompilationTest.java
+++ b/hotspot/test/compiler/whitebox/EnqueueMethodForCompilationTest.java
@@ -21,21 +21,23 @@
  * questions.
  */
 
-import compiler.whitebox.CompilerWhiteBoxTest;
-
 /*
  * @test EnqueueMethodForCompilationTest
  * @bug 8006683 8007288 8022832
+ * @summary testing of WB::enqueueMethodForCompilation()
  * @library /testlibrary /test/lib /
  * @modules java.base/jdk.internal.misc
- * @modules java.management
- * @build EnqueueMethodForCompilationTest
+ *          java.management
+ * @build compiler.whitebox.EnqueueMethodForCompilationTest
  * @run driver ClassFileInstaller sun.hotspot.WhiteBox
- *                              sun.hotspot.WhiteBox$WhiteBoxPermission
- * @run main/othervm -Xbootclasspath/a:. -Xmixed -XX:+UnlockDiagnosticVMOptions -XX:+WhiteBoxAPI -XX:+PrintCompilation -XX:-UseCounterDecay EnqueueMethodForCompilationTest
- * @summary testing of WB::enqueueMethodForCompilation()
- * @author igor.ignatyev@oracle.com
+ *                                sun.hotspot.WhiteBox$WhiteBoxPermission
+ * @run main/othervm -Xbootclasspath/a:. -Xmixed -XX:+UnlockDiagnosticVMOptions
+ *                   -XX:+WhiteBoxAPI -XX:+PrintCompilation -XX:-UseCounterDecay
+ *                   compiler.whitebox.EnqueueMethodForCompilationTest
  */
+
+package compiler.whitebox;
+
 public class EnqueueMethodForCompilationTest extends CompilerWhiteBoxTest {
 
     public static void main(String[] args) throws Exception {
diff --git a/hotspot/test/compiler/whitebox/ForceNMethodSweepTest.java b/hotspot/test/compiler/whitebox/ForceNMethodSweepTest.java
index ea22e25..f9b7cda 100644
--- a/hotspot/test/compiler/whitebox/ForceNMethodSweepTest.java
+++ b/hotspot/test/compiler/whitebox/ForceNMethodSweepTest.java
@@ -22,31 +22,30 @@
  *
  */
 
-import java.lang.reflect.Method;
-import java.util.EnumSet;
-
-import sun.hotspot.WhiteBox;
-import sun.hotspot.code.BlobType;
-
-import jdk.test.lib.Asserts;
-import jdk.test.lib.InfiniteLoop;
-import compiler.whitebox.CompilerWhiteBoxTest;
-
 /*
  * @test
  * @bug 8059624 8064669 8153265
+ * @summary testing of WB::forceNMethodSweep
  * @library /testlibrary /test/lib /
  * @modules java.base/jdk.internal.misc
- * @modules java.management
- * @build ForceNMethodSweepTest
+ *          java.management
+ * @build compiler.whitebox.ForceNMethodSweepTest
  * @run driver ClassFileInstaller sun.hotspot.WhiteBox
  *                                sun.hotspot.WhiteBox$WhiteBoxPermission
  * @run main/othervm -Xbootclasspath/a:. -XX:+UnlockDiagnosticVMOptions
  *                   -XX:-TieredCompilation -XX:+WhiteBoxAPI
  *                   -XX:CompileCommand=compileonly,compiler.whitebox.SimpleTestCaseHelper::*
- *                   -XX:-BackgroundCompilation -XX:-UseCounterDecay ForceNMethodSweepTest
- * @summary testing of WB::forceNMethodSweep
+ *                   -XX:-BackgroundCompilation -XX:-UseCounterDecay
+ *                   compiler.whitebox.ForceNMethodSweepTest
  */
+
+package compiler.whitebox;
+
+import jdk.test.lib.Asserts;
+import sun.hotspot.code.BlobType;
+
+import java.util.EnumSet;
+
 public class ForceNMethodSweepTest extends CompilerWhiteBoxTest {
     public static void main(String[] args) throws Exception {
         CompilerWhiteBoxTest.main(ForceNMethodSweepTest::new, args);
diff --git a/hotspot/test/compiler/whitebox/GetCodeHeapEntriesTest.java b/hotspot/test/compiler/whitebox/GetCodeHeapEntriesTest.java
index 8b2acf4..c6493c0 100644
--- a/hotspot/test/compiler/whitebox/GetCodeHeapEntriesTest.java
+++ b/hotspot/test/compiler/whitebox/GetCodeHeapEntriesTest.java
@@ -22,31 +22,34 @@
  *
  */
 
-import java.util.Arrays;
-import java.util.EnumSet;
-
-import sun.hotspot.WhiteBox;
-import sun.hotspot.code.CodeBlob;
-import sun.hotspot.code.BlobType;
-import jdk.test.lib.Asserts;
-
 /*
  * @test GetCodeHeapEntriesTest
  * @bug 8059624
- * @library /testlibrary /test/lib
+ * @summary testing of WB::getCodeHeapEntries()
+ * @library /testlibrary /test/lib /
  * @modules java.base/jdk.internal.misc
- * @modules java.management
- * @build GetCodeHeapEntriesTest
- * @run main ClassFileInstaller sun.hotspot.WhiteBox
- *                              sun.hotspot.WhiteBox$WhiteBoxPermission
+ *          java.management
+ * @build compiler.whitebox.GetCodeHeapEntriesTest
+ * @run driver ClassFileInstaller sun.hotspot.WhiteBox
+ *                                sun.hotspot.WhiteBox$WhiteBoxPermission
  * @run main/othervm -Xbootclasspath/a:. -XX:+UnlockDiagnosticVMOptions
  *                   -XX:+WhiteBoxAPI -XX:-SegmentedCodeCache
- *                   GetCodeHeapEntriesTest
+ *                   compiler.whitebox.GetCodeHeapEntriesTest
  * @run main/othervm -Xbootclasspath/a:. -XX:+UnlockDiagnosticVMOptions
  *                   -XX:+WhiteBoxAPI -XX:+SegmentedCodeCache
- *                   GetCodeHeapEntriesTest
- * @summary testing of WB::getCodeHeapEntries()
+ *                   compiler.whitebox.GetCodeHeapEntriesTest
  */
+
+package compiler.whitebox;
+
+import jdk.test.lib.Asserts;
+import sun.hotspot.WhiteBox;
+import sun.hotspot.code.BlobType;
+import sun.hotspot.code.CodeBlob;
+
+import java.util.Arrays;
+import java.util.EnumSet;
+
 public class GetCodeHeapEntriesTest {
     private static final WhiteBox WHITE_BOX = WhiteBox.getWhiteBox();
     private static final int SIZE = 1024;
diff --git a/hotspot/test/compiler/whitebox/GetNMethodTest.java b/hotspot/test/compiler/whitebox/GetNMethodTest.java
index bb9f9fc..4b64a6c 100644
--- a/hotspot/test/compiler/whitebox/GetNMethodTest.java
+++ b/hotspot/test/compiler/whitebox/GetNMethodTest.java
@@ -22,24 +22,28 @@
  *
  */
 
-import sun.hotspot.code.BlobType;
-import sun.hotspot.code.NMethod;
-import jdk.test.lib.Asserts;
-import compiler.whitebox.CompilerWhiteBoxTest;
-
 /*
  * @test GetNMethodTest
  * @bug 8038240
+ * @summary testing of WB::getNMethod()
  * @library /testlibrary /test/lib /
  * @modules java.base/jdk.internal.misc
- * @modules java.management
- * @build GetNMethodTest
+ *          java.management
+ * @build compiler.whitebox.GetNMethodTest
  * @run driver ClassFileInstaller sun.hotspot.WhiteBox
  *                                sun.hotspot.WhiteBox$WhiteBoxPermission
- * @run main/othervm -Xbootclasspath/a:. -Xmixed -XX:+UnlockDiagnosticVMOptions -XX:+WhiteBoxAPI -XX:-UseCounterDecay -XX:CompileCommand=compileonly,compiler.whitebox.SimpleTestCaseHelper::* GetNMethodTest
- * @summary testing of WB::getNMethod()
- * @author igor.ignatyev@oracle.com
+ * @run main/othervm -Xbootclasspath/a:. -Xmixed -XX:+UnlockDiagnosticVMOptions
+ *                   -XX:+WhiteBoxAPI -XX:-UseCounterDecay
+ *                   -XX:CompileCommand=compileonly,compiler.whitebox.SimpleTestCaseHelper::*
+ *                   compiler.whitebox.GetNMethodTest
  */
+
+package compiler.whitebox;
+
+import jdk.test.lib.Asserts;
+import sun.hotspot.code.BlobType;
+import sun.hotspot.code.NMethod;
+
 public class GetNMethodTest extends CompilerWhiteBoxTest {
     public static void main(String[] args) throws Exception {
         CompilerWhiteBoxTest.main(GetNMethodTest::new, args);
diff --git a/hotspot/test/compiler/whitebox/IsMethodCompilableTest.java b/hotspot/test/compiler/whitebox/IsMethodCompilableTest.java
index ff34c2a..6b80657 100644
--- a/hotspot/test/compiler/whitebox/IsMethodCompilableTest.java
+++ b/hotspot/test/compiler/whitebox/IsMethodCompilableTest.java
@@ -24,22 +24,28 @@
 /*
  * @test IsMethodCompilableTest
  * @bug 8007270 8006683 8007288 8022832
+ * @summary testing of WB::isMethodCompilable()
+ * @requires vm.flavor == "server"
  * @library /testlibrary /test/lib /
  * @modules java.base/jdk.internal.misc
  *          java.management
+ *
  * @build jdk.test.lib.*
  *        sun.hotspot.WhiteBox
- * @build IsMethodCompilableTest
+ * @build compiler.whitebox.IsMethodCompilableTest
  * @run driver ClassFileInstaller sun.hotspot.WhiteBox
  *                                sun.hotspot.WhiteBox$WhiteBoxPermission
  *                                jdk.test.lib.Platform
- * @run main/othervm/timeout=2400 -Xbootclasspath/a:. -Xmixed -XX:-TieredCompilation -XX:+UnlockDiagnosticVMOptions -XX:+WhiteBoxAPI -XX:PerMethodRecompilationCutoff=3 -XX:-UseCounterDecay -XX:CompileCommand=compileonly,compiler.whitebox.SimpleTestCaseHelper::* IsMethodCompilableTest
- * @summary testing of WB::isMethodCompilable()
- * @author igor.ignatyev@oracle.com
+ * @run main/othervm/timeout=2400 -XX:-TieredCompilation -Xmixed
+ *      -Xbootclasspath/a:. -XX:+UnlockDiagnosticVMOptions -XX:+WhiteBoxAPI
+ *      -XX:PerMethodRecompilationCutoff=3 -XX:-UseCounterDecay
+ *      -XX:CompileCommand=compileonly,compiler.whitebox.SimpleTestCaseHelper::*
+ *      compiler.whitebox.IsMethodCompilableTest
  */
 
+package compiler.whitebox;
+
 import jdk.test.lib.Platform;
-import compiler.whitebox.CompilerWhiteBoxTest;
 
 public class IsMethodCompilableTest extends CompilerWhiteBoxTest {
     /**
@@ -80,7 +86,7 @@
 
         // Only c2 compilations can be disabled through PerMethodRecompilationCutoff
         if (!Platform.isServer()) {
-            return;
+            throw new Error("TESTBUG: Not server VM");
         }
 
         if (skipXcompOSR()) {
diff --git a/hotspot/test/compiler/whitebox/LockCompilationTest.java b/hotspot/test/compiler/whitebox/LockCompilationTest.java
index eb04651..e3b8682 100644
--- a/hotspot/test/compiler/whitebox/LockCompilationTest.java
+++ b/hotspot/test/compiler/whitebox/LockCompilationTest.java
@@ -24,22 +24,20 @@
 /*
  * @test LockCompilationTest
  * @bug 8059624 8152169
+ * @summary testing of WB::lock/unlockCompilation()
  * @library /testlibrary /test/lib /
  * @modules java.base/jdk.internal.misc
- * @modules java.management
- * @build LockCompilationTest
+ *          java.management
+ * @build compiler.whitebox.LockCompilationTest
  * @run driver ClassFileInstaller sun.hotspot.WhiteBox
  *                                sun.hotspot.WhiteBox$WhiteBoxPermission
- * @run main/othervm -Xbootclasspath/a:. -Xmixed -XX:+UnlockDiagnosticVMOptions -XX:+WhiteBoxAPI -XX:-UseCounterDecay LockCompilationTest
- * @summary testing of WB::lock/unlockCompilation()
+ * @run main/othervm -Xbootclasspath/a:. -Xmixed -XX:+UnlockDiagnosticVMOptions
+ *                   -XX:+WhiteBoxAPI -XX:-UseCounterDecay
+ *                   compiler.whitebox.LockCompilationTest
  */
 
-import java.io.OutputStream;
-import java.io.PrintWriter;
-import java.util.concurrent.BrokenBarrierException;
-import java.util.concurrent.CyclicBarrier;
+package compiler.whitebox;
 
-import compiler.whitebox.CompilerWhiteBoxTest;
 import jdk.test.lib.Asserts;
 
 public class LockCompilationTest extends CompilerWhiteBoxTest {
diff --git a/hotspot/test/compiler/whitebox/MakeMethodNotCompilableTest.java b/hotspot/test/compiler/whitebox/MakeMethodNotCompilableTest.java
index ba06694..6722ace 100644
--- a/hotspot/test/compiler/whitebox/MakeMethodNotCompilableTest.java
+++ b/hotspot/test/compiler/whitebox/MakeMethodNotCompilableTest.java
@@ -21,21 +21,23 @@
  * questions.
  */
 
-import compiler.whitebox.CompilerWhiteBoxTest;
-
 /*
  * @test MakeMethodNotCompilableTest
  * @bug 8012322 8006683 8007288 8022832
+ * @summary testing of WB::makeMethodNotCompilable()
  * @library /testlibrary /test/lib /
  * @modules java.base/jdk.internal.misc
- * @modules java.management
- * @build MakeMethodNotCompilableTest
+ *          java.management
+ * @build compiler.whitebox.MakeMethodNotCompilableTest
  * @run driver ClassFileInstaller sun.hotspot.WhiteBox
  *                                sun.hotspot.WhiteBox$WhiteBoxPermission
- * @run main/othervm -Xbootclasspath/a:. -XX:+UnlockDiagnosticVMOptions -XX:+WhiteBoxAPI -Xmixed -XX:-UseCounterDecay MakeMethodNotCompilableTest
- * @summary testing of WB::makeMethodNotCompilable()
- * @author igor.ignatyev@oracle.com
+ * @run main/othervm -Xbootclasspath/a:. -XX:+UnlockDiagnosticVMOptions
+ *                   -XX:+WhiteBoxAPI -Xmixed -XX:-UseCounterDecay
+ *                   compiler.whitebox.MakeMethodNotCompilableTest
  */
+
+package compiler.whitebox;
+
 public class MakeMethodNotCompilableTest extends CompilerWhiteBoxTest {
     private int bci;
     public static void main(String[] args) throws Exception {
diff --git a/hotspot/test/compiler/whitebox/SetDontInlineMethodTest.java b/hotspot/test/compiler/whitebox/SetDontInlineMethodTest.java
index 3ba7b77..5a8c7c3 100644
--- a/hotspot/test/compiler/whitebox/SetDontInlineMethodTest.java
+++ b/hotspot/test/compiler/whitebox/SetDontInlineMethodTest.java
@@ -21,21 +21,24 @@
  * questions.
  */
 
-import compiler.whitebox.CompilerWhiteBoxTest;
-
 /*
  * @test SetDontInlineMethodTest
  * @bug 8006683 8007288 8022832
+ * @summary testing of WB::testSetDontInlineMethod()
  * @library /testlibrary /test/lib /
  * @modules java.base/jdk.internal.misc
- * @modules java.management
- * @build SetDontInlineMethodTest
- * @run main ClassFileInstaller sun.hotspot.WhiteBox
- *                              sun.hotspot.WhiteBox$WhiteBoxPermission
- * @run main/othervm -Xbootclasspath/a:. -XX:+UnlockDiagnosticVMOptions -XX:+WhiteBoxAPI -XX:CompileCommand=compileonly,compiler.whitebox.SimpleTestCaseHelper::* SetDontInlineMethodTest
- * @summary testing of WB::testSetDontInlineMethod()
- * @author igor.ignatyev@oracle.com
+ *          java.management
+ * @build compiler.whitebox.SetDontInlineMethodTest
+ * @run driver ClassFileInstaller sun.hotspot.WhiteBox
+ *                                sun.hotspot.WhiteBox$WhiteBoxPermission
+ * @run main/othervm -Xbootclasspath/a:. -XX:+UnlockDiagnosticVMOptions
+ *                   -XX:+WhiteBoxAPI
+ *                   -XX:CompileCommand=compileonly,compiler.whitebox.SimpleTestCaseHelper::*
+ *                   compiler.whitebox.SetDontInlineMethodTest
  */
+
+package compiler.whitebox;
+
 public class SetDontInlineMethodTest extends CompilerWhiteBoxTest {
 
     public static void main(String[] args) throws Exception {
diff --git a/hotspot/test/compiler/whitebox/SetForceInlineMethodTest.java b/hotspot/test/compiler/whitebox/SetForceInlineMethodTest.java
index c04f234..f3e27e9 100644
--- a/hotspot/test/compiler/whitebox/SetForceInlineMethodTest.java
+++ b/hotspot/test/compiler/whitebox/SetForceInlineMethodTest.java
@@ -21,21 +21,24 @@
  * questions.
  */
 
-import compiler.whitebox.CompilerWhiteBoxTest;
-
 /*
  * @test SetForceInlineMethodTest
  * @bug 8006683 8007288 8022832
+ * @summary testing of WB::testSetForceInlineMethod()
  * @library /testlibrary /test/lib /
  * @modules java.base/jdk.internal.misc
- * @modules java.management
- * @build SetForceInlineMethodTest
- * @run main ClassFileInstaller sun.hotspot.WhiteBox
- *                              sun.hotspot.WhiteBox$WhiteBoxPermission
- * @run main/othervm -Xbootclasspath/a:. -XX:+UnlockDiagnosticVMOptions -XX:+WhiteBoxAPI -XX:CompileCommand=compileonly,compiler.whitebox.SimpleTestCaseHelper::* SetForceInlineMethodTest
- * @summary testing of WB::testSetForceInlineMethod()
- * @author igor.ignatyev@oracle.com
+ *          java.management
+ * @build compiler.whitebox.SetForceInlineMethodTest
+ * @run driver ClassFileInstaller sun.hotspot.WhiteBox
+ *                                sun.hotspot.WhiteBox$WhiteBoxPermission
+ * @run main/othervm -Xbootclasspath/a:. -XX:+UnlockDiagnosticVMOptions
+ *                   -XX:+WhiteBoxAPI
+ *                   -XX:CompileCommand=compileonly,compiler.whitebox.SimpleTestCaseHelper::*
+ *                   compiler.whitebox.SetForceInlineMethodTest
  */
+
+package compiler.whitebox;
+
 public class SetForceInlineMethodTest extends CompilerWhiteBoxTest {
 
     public static void main(String[] args) throws Exception {
diff --git a/hotspot/test/compiler/whitebox/SimpleTestCase.java b/hotspot/test/compiler/whitebox/SimpleTestCase.java
index 2de860e..196c39e 100644
--- a/hotspot/test/compiler/whitebox/SimpleTestCase.java
+++ b/hotspot/test/compiler/whitebox/SimpleTestCase.java
@@ -23,11 +23,12 @@
 
 package compiler.whitebox;
 
+import sun.hotspot.WhiteBox;
+
 import java.lang.reflect.Constructor;
 import java.lang.reflect.Executable;
 import java.lang.reflect.Method;
 import java.util.concurrent.Callable;
-import sun.hotspot.WhiteBox;
 
 public enum SimpleTestCase implements CompilerWhiteBoxTest.TestCase {
     /** constructor test case */
diff --git a/hotspot/test/gc/TestSmallHeap.java b/hotspot/test/gc/TestSmallHeap.java
index 4b3d403..9b791a5 100644
--- a/hotspot/test/gc/TestSmallHeap.java
+++ b/hotspot/test/gc/TestSmallHeap.java
@@ -27,7 +27,6 @@
  * @requires vm.gc=="null"
  * @summary Verify that starting the VM with a small heap works
  * @library /testlibrary /test/lib /test/lib/share/classes
- * @ignore 8161552
  * @modules java.base/jdk.internal.misc
  * @modules java.management/sun.management
  * @build TestSmallHeap
@@ -35,7 +34,7 @@
  * @run main/othervm -Xbootclasspath/a:. -XX:+UnlockDiagnosticVMOptions -XX:+WhiteBoxAPI TestSmallHeap
  */
 
-/* Note: It would be nice to verify the minimal supported heap size (2m) here,
+/* Note: It would be nice to verify the minimal supported heap size here,
  * but we align the heap size based on the card table size. And the card table
  * size is aligned based on the minimal pages size provided by the os. This
  * means that on most platforms, where the minimal page size is 4k, we get a
@@ -44,14 +43,18 @@
  * we get a minimal heap size of 32m. We never use large pages for the card table.
  *
  * There is also no check in the VM for verifying that the maximum heap size
- * is larger than the supported minimal heap size. This means that specifying
- * -Xmx1m on the command line is fine but will give a heap of 2m (or 4m or 32m).
+ * is larger than the supported minimal heap size.
  *
- * To work around these rather strange behaviors this test uses -Xmx2m but then
+ * To work around these behaviors this test uses -Xmx4m but then
  * calculates what the expected heap size should be. The calculation is a
  * simplified version of the code in the VM. We assume that the card table will
  * use one page. Each byte in the card table corresponds to 512 bytes on the heap.
  * So, the expected heap size is page_size * 512.
+ *
+ * There is no formal requirement for the minimal value of the maximum heap size
+ * the VM should support. In most cases the VM could start with -Xmx2m.
+ * But with 2m limit GC could be triggered before VM initialization completed.
+ * Therefore we start the VM with 4M heap.
  */
 
 import jdk.test.lib.Asserts;
@@ -80,9 +83,10 @@
     }
 
     private static void verifySmallHeapSize(String gc, long expectedMaxHeap) throws Exception {
+        long minMaxHeap = 4 * 1024 * 1024;
         LinkedList<String> vmOptions = new LinkedList<>();
         vmOptions.add(gc);
-        vmOptions.add("-Xmx2m");
+        vmOptions.add("-Xmx" + minMaxHeap);
         vmOptions.add("-XX:+PrintFlagsFinal");
         vmOptions.add(VerifyHeapSize.class.getName());
 
@@ -90,6 +94,7 @@
         OutputAnalyzer analyzer = new OutputAnalyzer(pb.start());
         analyzer.shouldHaveExitValue(0);
 
+        expectedMaxHeap = Math.max(expectedMaxHeap, minMaxHeap);
         long maxHeapSize = Long.parseLong(analyzer.firstMatch("MaxHeapSize.+=\\s+(\\d+)",1));
         long actualHeapSize = Long.parseLong(analyzer.firstMatch(VerifyHeapSize.actualMsg + "(\\d+)",1));
         Asserts.assertEQ(maxHeapSize, expectedMaxHeap);
diff --git a/hotspot/test/gc/arguments/TestMaxHeapSizeTools.java b/hotspot/test/gc/arguments/TestMaxHeapSizeTools.java
index 46bd333..69bb75d 100644
--- a/hotspot/test/gc/arguments/TestMaxHeapSizeTools.java
+++ b/hotspot/test/gc/arguments/TestMaxHeapSizeTools.java
@@ -106,7 +106,6 @@
   }
 
   public static void checkGenMaxHeapErgo(String gcflag) throws Exception {
-    TestMaxHeapSizeTools.checkGenMaxHeapSize(gcflag, 3);
     TestMaxHeapSizeTools.checkGenMaxHeapSize(gcflag, 4);
     TestMaxHeapSizeTools.checkGenMaxHeapSize(gcflag, 5);
   }
@@ -132,7 +131,6 @@
   }
 
   private static void checkValidInitialMaxHeapCombinations(String gcflag) throws Exception {
-    expectValid(new String[] { gcflag, "-XX:MaxHeapSize=2048K", "-version" });
     expectValid(new String[] { gcflag, "-XX:InitialHeapSize=4M", "-XX:MaxHeapSize=8M", "-version" });
     expectValid(new String[] { gcflag, "-XX:MaxHeapSize=8M", "-XX:InitialHeapSize=4M", "-version" });
     expectValid(new String[] { gcflag, "-XX:MaxHeapSize=4M", "-XX:InitialHeapSize=4M", "-version" });
diff --git a/hotspot/test/gc/arguments/TestNewSizeFlags.java b/hotspot/test/gc/arguments/TestNewSizeFlags.java
index 4762afb..df01656 100644
--- a/hotspot/test/gc/arguments/TestNewSizeFlags.java
+++ b/hotspot/test/gc/arguments/TestNewSizeFlags.java
@@ -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
@@ -60,13 +60,13 @@
 
         // Test NewSize and MaxNewSize
         testNewSizeFlags(20 * M, 10 * M, 30 * M, 40 * M, options, false);
-        testNewSizeFlags(10 * M, 20 * M, 30 * M, 40 * M, options, false);
+        testNewSizeFlags(10 * M, 20 * M, 30 * M, 80 * M, options, false);
         testNewSizeFlags(-1, 20 * M, 30 * M, 40 * M, options, false);
         testNewSizeFlags(10 * M, -1, 30 * M, 40 * M, options, false);
         testNewSizeFlags(20 * M, 20 * M, 30 * M, 40 * M, options, false);
         testNewSizeFlags(20 * M, 30 * M, 40 * M, 50 * M, options, false);
         testNewSizeFlags(30 * M, 100 * M, 150 * M, 200 * M, options, false);
-        testNewSizeFlags(0, -1, 30 * M, 40 * M, options, false);
+        testNewSizeFlags(20 * M, 30 * M, 128 * M, 128 * M, options, false);
 
         // Test -Xmn
         testXmnFlags(0, 30 * M, 40 * M, options, true);
@@ -88,9 +88,11 @@
             long heapSize, long maxHeapSize,
             LinkedList<String> options,
             boolean failureExpected) throws Exception {
+        long expectedNewSize = newSize;
+        long expectedMaxNewSize = (maxNewSize >= 0 ? Math.max(maxNewSize, newSize) : maxNewSize);
         testVMOptions(newSize, maxNewSize,
                 heapSize, maxHeapSize,
-                newSize, (maxNewSize >= 0 ? Math.max(maxNewSize, newSize) : maxNewSize),
+                expectedNewSize, expectedMaxNewSize,
                 options, failureExpected);
     }
 
@@ -159,7 +161,9 @@
                 "-XX:-UseLargePages",
                 NewSizeVerifier.class.getName(),
                 Long.toString(expectedNewSize),
-                Long.toString(expectedMaxNewSize)
+                Long.toString(expectedMaxNewSize),
+                Long.toString(heapSize),
+                Long.toString(maxHeapSize)
         );
         vmOptions.removeIf(String::isEmpty);
         ProcessBuilder procBuilder = ProcessTools.createJavaProcessBuilder(vmOptions.toArray(new String[vmOptions.size()]));
@@ -177,7 +181,12 @@
      */
     public static class NewSizeVerifier {
 
-        static WhiteBox wb = WhiteBox.getWhiteBox();
+        private static final WhiteBox WB = WhiteBox.getWhiteBox();
+        private static final GCTypes.YoungGCType YOUNG_GC_TYPE = GCTypes.YoungGCType.getYoungGCType();
+        private static final long HEAP_SPACE_ALIGNMENT = WB.getHeapSpaceAlignment();
+        private static final long HEAP_ALIGNMENT = WB.getHeapAlignment();
+        private static final long PS_VIRTUAL_SPACE_ALIGNMENT =
+                (YOUNG_GC_TYPE == GCTypes.YoungGCType.PSNew) ? WB.psVirtualSpaceAlignment() : 0;
 
         public static final int ARRAY_LENGTH = 100;
         public static final int CHUNK_SIZE = 1024;
@@ -185,63 +194,79 @@
         public static byte garbage[][] = new byte[ARRAY_LENGTH][];
 
         public static void main(String args[]) throws Exception {
-            if (args.length != 2) {
-                throw new IllegalArgumentException("Expected 2 args: <expectedNewSize> <expectedMaxNewSize>");
+            if (args.length != 4) {
+                throw new IllegalArgumentException("Expected 4 args: <expectedNewSize> <expectedMaxNewSize> <initialHeapSize> <maxHeapSize>");
             }
             final long newSize = Long.valueOf(args[0]);
             final long maxNewSize = Long.valueOf(args[1]);
+            final long initialHeapSize = Long.valueOf(args[2]);
+            final long maxHeapSize = Long.valueOf(args[3]);
 
             // verify initial size
-            verifyNewSize(newSize, maxNewSize);
+            verifyNewSize(newSize, maxNewSize, initialHeapSize, maxHeapSize);
 
             // force GC and verify that size is still correct
-            AllocationHelper allocator = new AllocationHelper(MAX_ITERATIONS, ARRAY_LENGTH, CHUNK_SIZE, () -> (verifyNewSize(newSize, maxNewSize)));
+            AllocationHelper allocator = new AllocationHelper(MAX_ITERATIONS, ARRAY_LENGTH, CHUNK_SIZE, () -> (verifyNewSize(newSize, maxNewSize, initialHeapSize, maxHeapSize)));
             allocator.allocateMemoryAndVerifyNoOOME();
         }
 
         /**
          * Verify that actual young gen size conforms NewSize and MaxNewSize values.
          */
-        public static Void verifyNewSize(long newSize, long maxNewSize) {
-            long alignedNewSize = alignNewSize(newSize);
-            long alignedMaxNewSize = alignNewSize(maxNewSize);
+        public static Void verifyNewSize(long newSize, long maxNewSize,
+                long initialHeapSize, long maxHeapSize) {
+            long alignedNewSize = alignGenSize(newSize);
+            long alignedMaxNewSize = alignGenSize(maxNewSize);
+            long alignedXms = alignHeapSize(initialHeapSize);
+            long alignedXmx = alignHeapSize(maxHeapSize);
 
             MemoryUsage youngGenUsage = getYoungGenUsage();
+            long initSize = youngGenUsage.getInit();
+            long commitedSize = youngGenUsage.getCommitted();
+            long maxSize = youngGenUsage.getMax();
 
             if (newSize != -1) {
-                if (youngGenUsage.getInit() < alignedNewSize) {
+                if (initSize < alignedNewSize) {
                     throw new RuntimeException("initial new size < NewSize value: "
-                            + youngGenUsage.getInit() + " < " + alignedNewSize);
+                            + initSize + " < " + alignedNewSize);
                 }
 
-                if (youngGenUsage.getCommitted() < alignedNewSize) {
+                if (commitedSize < alignedNewSize) {
                     throw new RuntimeException("actual new size < NewSize value: "
-                            + youngGenUsage.getCommitted() + " < " + alignedNewSize);
+                            + commitedSize + " < " + alignedNewSize);
                 }
 
                 // for G1 max new size == committed new size
-                if (GCTypes.YoungGCType.getYoungGCType() != GCTypes.YoungGCType.G1
-                        && youngGenUsage.getMax() < alignedNewSize) {
+                if (YOUNG_GC_TYPE != GCTypes.YoungGCType.G1
+                        && maxSize < alignedNewSize) {
                     throw new RuntimeException("max new size < NewSize value: "
-                            + youngGenUsage.getMax() + " < " + alignedNewSize);
+                            + maxSize + " < " + alignedNewSize);
                 }
             }
 
             if (maxNewSize != -1) {
-                if (youngGenUsage.getInit() > alignedMaxNewSize) {
+                if (initSize > alignedMaxNewSize) {
                     throw new RuntimeException("initial new size > MaxNewSize value: "
-                            + youngGenUsage.getInit() + " > " + alignedMaxNewSize);
+                            + initSize + " > " + alignedMaxNewSize);
                 }
 
-                if (youngGenUsage.getCommitted() > alignedMaxNewSize) {
+                if (commitedSize > alignedMaxNewSize) {
                     throw new RuntimeException("actual new size > MaxNewSize value: "
-                            + youngGenUsage.getCommitted() + " > " + alignedMaxNewSize);
+                            + commitedSize + " > " + alignedMaxNewSize);
                 }
 
-                if (GCTypes.YoungGCType.getYoungGCType() != GCTypes.YoungGCType.G1
-                        && youngGenUsage.getMax() != alignedMaxNewSize) {
-                    throw new RuntimeException("max new size != MaxNewSize value: "
-                            + youngGenUsage.getMax() + " != " + alignedMaxNewSize);
+                if (alignedXms != alignedXmx) {
+                    if (YOUNG_GC_TYPE != GCTypes.YoungGCType.G1
+                            && maxSize != alignedMaxNewSize) {
+                        throw new RuntimeException("max new size != MaxNewSize value: "
+                                + maxSize + " != " + alignedMaxNewSize);
+                    }
+                } else {
+                    if (YOUNG_GC_TYPE != GCTypes.YoungGCType.G1
+                            && maxSize != alignedNewSize) {
+                        throw new RuntimeException("max new size != NewSize for case InitialHeapSize == MaxHeapSize value: "
+                                + maxSize + " != " + alignedNewSize + " HeapSize == " + alignedXms);
+                    }
                 }
             }
             return null;
@@ -256,41 +281,47 @@
          *  For all GCs used value is 0.
          */
         private static MemoryUsage getYoungGenUsage() {
-            if (GCTypes.YoungGCType.getYoungGCType() == GCTypes.YoungGCType.G1) {
-                return new MemoryUsage(HeapRegionUsageTool.getEdenUsage().getInit()
-                        + HeapRegionUsageTool.getSurvivorUsage().getInit(),
-                        0,
-                        HeapRegionUsageTool.getEdenUsage().getCommitted()
-                        + HeapRegionUsageTool.getSurvivorUsage().getCommitted(),
-                        Long.MAX_VALUE);
+            MemoryUsage edenUsage = HeapRegionUsageTool.getEdenUsage();
+            MemoryUsage survivorUsage = HeapRegionUsageTool.getSurvivorUsage();
+            long edenUsageInit = edenUsage.getInit();
+            long edenUsageCommited = edenUsage.getCommitted();
+            long survivorUsageInit = survivorUsage.getInit();
+            long survivorUsageCommited = survivorUsage.getCommitted();
+
+            if (YOUNG_GC_TYPE == GCTypes.YoungGCType.G1) {
+                return new MemoryUsage(edenUsageInit + survivorUsageInit, 0,
+                        edenUsageCommited + survivorUsageCommited, Long.MAX_VALUE);
             } else {
-                return new MemoryUsage(HeapRegionUsageTool.getEdenUsage().getInit()
-                        + HeapRegionUsageTool.getSurvivorUsage().getInit() * 2,
-                        0,
-                        HeapRegionUsageTool.getEdenUsage().getCommitted()
-                        + HeapRegionUsageTool.getSurvivorUsage().getCommitted() * 2,
-                        HeapRegionUsageTool.getEdenUsage().getMax()
-                        + HeapRegionUsageTool.getSurvivorUsage().getMax() * 2);
+                return new MemoryUsage(edenUsageInit + survivorUsageInit * 2, 0,
+                        edenUsageCommited + survivorUsageCommited * 2,
+                        edenUsage.getMax() + survivorUsage.getMax() * 2);
             }
         }
 
         /**
-         * Align value regardful to used young GC.
+         * Align generation size regardful to used young GC.
          */
-        public static long alignNewSize(long value) {
-            switch (GCTypes.YoungGCType.getYoungGCType()) {
+        public static long alignGenSize(long value) {
+            switch (YOUNG_GC_TYPE) {
                 case DefNew:
                 case ParNew:
-                    return HeapRegionUsageTool.alignDown(value, wb.getHeapSpaceAlignment());
+                    return HeapRegionUsageTool.alignDown(value, HEAP_SPACE_ALIGNMENT);
                 case PSNew:
                     return HeapRegionUsageTool.alignUp(HeapRegionUsageTool.alignDown(value,
-                            wb.getHeapSpaceAlignment()),
-                            wb.psVirtualSpaceAlignment());
+                            HEAP_SPACE_ALIGNMENT),
+                            PS_VIRTUAL_SPACE_ALIGNMENT);
                 case G1:
-                    return HeapRegionUsageTool.alignUp(value, wb.g1RegionSize());
+                    return HeapRegionUsageTool.alignUp(value, WB.g1RegionSize());
                 default:
                     throw new RuntimeException("Unexpected young GC type");
             }
         }
+
+        /**
+         * Align heap size.
+         */
+        public static long alignHeapSize(long value){
+            return HeapRegionUsageTool.alignUp(value,HEAP_ALIGNMENT);
+        }
     }
 }
diff --git a/hotspot/test/gc/arguments/TestParallelHeapSizeFlags.java b/hotspot/test/gc/arguments/TestParallelHeapSizeFlags.java
index d393a75..af0b2a7 100644
--- a/hotspot/test/gc/arguments/TestParallelHeapSizeFlags.java
+++ b/hotspot/test/gc/arguments/TestParallelHeapSizeFlags.java
@@ -29,7 +29,6 @@
  * parallel collectors.
  * @requires vm.gc=="null"
  * @library /testlibrary /test/lib
- * @ignore 8161552
  * @modules java.base/jdk.internal.misc
  *          java.management
  * @build TestParallelHeapSizeFlags TestMaxHeapSizeTools
diff --git a/hotspot/test/gc/arguments/TestSelectDefaultGC.java b/hotspot/test/gc/arguments/TestSelectDefaultGC.java
index 8dc1435..0c39a6b 100644
--- a/hotspot/test/gc/arguments/TestSelectDefaultGC.java
+++ b/hotspot/test/gc/arguments/TestSelectDefaultGC.java
@@ -55,14 +55,10 @@
         output.shouldHaveExitValue(0);
 
         final boolean isServer = actAsServer;
-        final boolean isEmbedded = Platform.isEmbedded();
 
         // Verify GC selection
-        // G1 is default for non-embedded server class machines
-        assertVMOption(output, "UseG1GC",            isServer && !isEmbedded);
-        // Parallel is default for embedded server class machines
-        assertVMOption(output, "UseParallelGC",      isServer && isEmbedded);
-        assertVMOption(output, "UseParallelOldGC",   isServer && isEmbedded);
+        // G1 is default for server class machines
+        assertVMOption(output, "UseG1GC",            isServer);
         // Serial is default for non-server class machines
         assertVMOption(output, "UseSerialGC",        !isServer);
         // CMS is never default
diff --git a/hotspot/test/gc/g1/TestGCLogMessages.java b/hotspot/test/gc/g1/TestGCLogMessages.java
index 90e4b71..ec9250c 100644
--- a/hotspot/test/gc/g1/TestGCLogMessages.java
+++ b/hotspot/test/gc/g1/TestGCLogMessages.java
@@ -95,6 +95,8 @@
         new LogMessageWithLevel("String Dedup Fixup", Level.INFO),
         new LogMessageWithLevel("Expand Heap After Collection", Level.INFO),
         // Free CSet
+        new LogMessageWithLevel("Free Collection Set", Level.INFO),
+        new LogMessageWithLevel("Free Collection Set Serial", Level.DEBUG),
         new LogMessageWithLevel("Young Free Collection Set", Level.DEBUG),
         new LogMessageWithLevel("Non-Young Free Collection Set", Level.DEBUG),
         // Humongous Eager Reclaim
diff --git a/hotspot/test/gc/g1/TestShrinkAuxiliaryData.java b/hotspot/test/gc/g1/TestShrinkAuxiliaryData.java
index 1600989..83ef798 100644
--- a/hotspot/test/gc/g1/TestShrinkAuxiliaryData.java
+++ b/hotspot/test/gc/g1/TestShrinkAuxiliaryData.java
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2014, 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2014, 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
@@ -44,6 +44,7 @@
     private static final int REGION_SIZE = 1024 * 1024;
 
     private final static String[] initialOpts = new String[]{
+        "-XX:NewSize=16m",
         "-XX:MinHeapFreeRatio=10",
         "-XX:MaxHeapFreeRatio=11",
         "-XX:+UseG1GC",
diff --git a/hotspot/test/gc/logging/TestUnifiedLoggingSwitchStress.java b/hotspot/test/gc/logging/TestUnifiedLoggingSwitchStress.java
index 647cd63..37fd5b2 100644
--- a/hotspot/test/gc/logging/TestUnifiedLoggingSwitchStress.java
+++ b/hotspot/test/gc/logging/TestUnifiedLoggingSwitchStress.java
@@ -43,6 +43,7 @@
  * @summary Switches gc log level on fly while stressing memory/gc
  * @key gc
  * @key stress
+ * @requires !vm.flightRecorder
  * @library /testlibrary /test/lib /
  * @modules java.management java.base/jdk.internal.misc
  *
diff --git a/hotspot/test/gc/metaspace/TestMetaspaceSizeFlags.java b/hotspot/test/gc/metaspace/TestMetaspaceSizeFlags.java
index b56343c..639694c 100644
--- a/hotspot/test/gc/metaspace/TestMetaspaceSizeFlags.java
+++ b/hotspot/test/gc/metaspace/TestMetaspaceSizeFlags.java
@@ -74,8 +74,8 @@
     OutputAnalyzer output = run(maxMetaspaceSize, metaspaceSize);
     output.shouldNotMatch("Error occurred during initialization of VM\n.*");
 
-    String stringMaxMetaspaceSize = output.firstMatch(".* MaxMetaspaceSize .* := (\\d+).*", 1);
-    String stringMetaspaceSize = output.firstMatch(".* MetaspaceSize .* := (\\d+).*", 1);
+    String stringMaxMetaspaceSize = output.firstMatch(".* MaxMetaspaceSize .* = (\\d+).*", 1);
+    String stringMetaspaceSize = output.firstMatch(".* MetaspaceSize .* = (\\d+).*", 1);
 
     return new MetaspaceFlags(Long.parseLong(stringMaxMetaspaceSize),
                               Long.parseLong(stringMetaspaceSize));
diff --git a/hotspot/test/gc/stress/TestGCOld.java b/hotspot/test/gc/stress/TestGCOld.java
index 23fb60a..3d74aa2 100644
--- a/hotspot/test/gc/stress/TestGCOld.java
+++ b/hotspot/test/gc/stress/TestGCOld.java
@@ -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
@@ -33,6 +33,7 @@
  * @run main/othervm -Xmx384M -XX:+UseConcMarkSweepGC TestGCOld 50 1 20 10 10000
  * @run main/othervm -Xmx384M -XX:+UseG1GC TestGCOld 50 1 20 10 10000
  * @run main/othervm -Xms64m -Xmx128m -XX:+UseG1GC -XX:+UseDynamicNumberOfGCThreads -Xlog:gc,gc+task=trace TestGCOld 50 5 20 1 5000
+ * @run main/othervm -Xms64m -Xmx128m -XX:+UseG1GC -XX:+UseDynamicNumberOfGCThreads  -XX:+UnlockDiagnosticVMOptions -XX:+InjectGCWorkerCreationFailure -Xlog:gc,gc+task=trace TestGCOld 50 5 20 1 5000
  */
 
 import java.text.*;
diff --git a/hotspot/test/gc/stress/TestStressG1Humongous.java b/hotspot/test/gc/stress/TestStressG1Humongous.java
index 6b507e4..501f646 100644
--- a/hotspot/test/gc/stress/TestStressG1Humongous.java
+++ b/hotspot/test/gc/stress/TestStressG1Humongous.java
@@ -53,6 +53,7 @@
     private static final int THREAD_COUNT = Integer.getInteger("threads", 2);
     private static final int REGION_SIZE = Integer.getInteger("regionsize", 1) * 1024 * 1024;
     private static final int HUMONGOUS_SIZE = (int) (REGION_SIZE * Double.parseDouble(System.getProperty("humongoussize", "1.5")));
+    private static final int NUMBER_OF_FREE_REGIONS = 2;
 
     private volatile boolean isRunning;
     private final ExecutorService threadExecutor;
@@ -92,8 +93,12 @@
     private int getExpectedAmountOfObjects() {
         long maxMem = Runtime.getRuntime().maxMemory();
         int expectedHObjects = (int) (maxMem / HUMONGOUS_SIZE);
-        // Will allocate 1 region less to give some free space for VM.
-        int checkedAmountOfHObjects = checkHeapCapacity(expectedHObjects) - 1;
+        // Will allocate NUMBER_OF_FREE_REGIONS region less to give some free space for VM.
+        int checkedAmountOfHObjects = checkHeapCapacity(expectedHObjects) - NUMBER_OF_FREE_REGIONS;
+        if (checkedAmountOfHObjects <= 0) {
+            throw new RuntimeException("Cannot start testing because selected maximum heap "
+                    + "is not large enough to contain more than " + NUMBER_OF_FREE_REGIONS + " regions");
+        }
         return checkedAmountOfHObjects;
     }
 
diff --git a/hotspot/test/runtime/7107135/Test7107135.sh b/hotspot/test/runtime/7107135/Test7107135.sh
deleted file mode 100644
index 5371b3a..0000000
--- a/hotspot/test/runtime/7107135/Test7107135.sh
+++ /dev/null
@@ -1,100 +0,0 @@
-#!/bin/sh
-
-#
-#  Copyright (c) 1998, 2014, Oracle and/or its affiliates. All rights reserved.
-#  Copyright (c) 2011 SAP SE. All rights reserved.
-#  DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
-#
-#  This code is free software; you can redistribute it and/or modify it
-#  under the terms of the GNU General Public License version 2 only, as
-#  published by the Free Software Foundation.
-#
-#  This code is distributed in the hope that it will be useful, but WITHOUT
-#  ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
-#  FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
-#  version 2 for more details (a copy is included in the LICENSE file that
-#  accompanied this code).
-#
-#  You should have received a copy of the GNU General Public License version
-#  2 along with this work; if not, write to the Free Software Foundation,
-#  Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
-#
-#  Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
-#  or visit www.oracle.com if you need additional information or have any
-#  questions.
-#
-
-##
-## @test Test7107135.sh
-## @bug 7107135
-## @bug 8021296
-## @bug 8025519
-## @summary Stack guard pages lost after loading library with executable stack.
-## @run shell Test7107135.sh
-##
-
-if [ "${TESTSRC}" = "" ]
-then
-  TESTSRC=${PWD}
-  echo "TESTSRC not set.  Using "${TESTSRC}" as default"
-fi
-echo "TESTSRC=${TESTSRC}"
-## Adding common setup Variables for running shell tests.
-. ${TESTSRC}/../../test_env.sh
-
-# set platform-dependent variables
-OS=`uname -s`
-case "$OS" in
-  Linux)
-    echo "Testing on Linux"
-    gcc_cmd=`which gcc`
-    if [ "x$gcc_cmd" == "x" ]; then
-        echo "WARNING: gcc not found. Cannot execute test." 2>&1
-        exit 0;
-    fi
-    ;;
-  *)
-    echo "Test passed; only valid for Linux"
-    exit 0;
-    ;;
-esac
-
-ARCH=`uname -m`
-
-THIS_DIR=.
-
-cp ${TESTSRC}${FS}*.java ${THIS_DIR}
-${COMPILEJAVA}${FS}bin${FS}javac *.java
-
-$gcc_cmd -fPIC -shared -c -o test.o \
-    -I${COMPILEJAVA}${FS}include -I${COMPILEJAVA}${FS}include${FS}linux \
-    ${TESTSRC}${FS}test.c
-
-ld -shared -z   execstack -o libtest-rwx.so test.o
-ld -shared -z noexecstack -o libtest-rw.so  test.o
-
-
-LD_LIBRARY_PATH=${THIS_DIR}
-echo   LD_LIBRARY_PATH = ${LD_LIBRARY_PATH}
-export LD_LIBRARY_PATH
-
-# This should not fail.
-echo Check testprogram. Expected to pass:
-echo ${TESTJAVA}${FS}bin${FS}java -cp ${THIS_DIR} Test test-rw
-${TESTJAVA}${FS}bin${FS}java -cp ${THIS_DIR} Test test-rw
-
-echo
-echo Test changing of stack protection:
-echo ${TESTJAVA}${FS}bin${FS}java -cp ${THIS_DIR} Test test-rwx
-${TESTJAVA}${FS}bin${FS}java -cp ${THIS_DIR} Test test-rwx
-JAVA_RETVAL=$?
-
-if [ "$JAVA_RETVAL" == "0" ]
-then
-  echo
-  echo ${TESTJAVA}${FS}bin${FS}java -cp ${THIS_DIR} TestMT test-rwx
-  ${TESTJAVA}${FS}bin${FS}java -cp ${THIS_DIR} TestMT test-rwx
-  JAVA_RETVAL=$?
-fi
-
-exit $JAVA_RETVAL
diff --git a/hotspot/test/runtime/8007320/ConstMethodTest.java b/hotspot/test/runtime/8007320/ConstMethodTest.java
index d24ff6d..734baaa 100644
--- a/hotspot/test/runtime/8007320/ConstMethodTest.java
+++ b/hotspot/test/runtime/8007320/ConstMethodTest.java
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2013, 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
@@ -23,7 +23,7 @@
 
 /*
  * @test
- * @bug 8007320 8014709
+ * @bug 8007320 8014709 8163231
  * @summary Test all optional fields in ConstMethod
  * @compile -g -parameters ConstMethodTest.java
  * @run main ConstMethodTest
@@ -122,8 +122,8 @@
                 equal(ann.length, 3);
                 Annotation foo = ann[0][0];
                 Annotation bar = ann[1][0];
-                equal(foo.toString(), "@Named(value=aName)");
-                equal(bar.toString(), "@Named(value=bName)");
+                equal(foo.toString(), "@Named(value=\"aName\")");
+                equal(bar.toString(), "@Named(value=\"bName\")");
                 check(foo.equals(foo));
                 check(bar.equals(bar));
                 check(! foo.equals(bar));
@@ -131,7 +131,7 @@
                 Annotation[] ann2 = m.getAnnotations();
                 equal(ann2.length, 1);
                 Annotation mann = ann2[0];
-                equal(mann.toString(), "@MyAnnotation(date=today, name=someName, value=Hello World)");
+                equal(mann.toString(), "@MyAnnotation(date=\"today\", name=\"someName\", value=\"Hello World\")");
                 // Test Method parameter names
                 Parameter[] parameters = m.getParameters();
                 if(parameters == null)
diff --git a/hotspot/test/runtime/RedefineTests/RedefineAnnotations.java b/hotspot/test/runtime/RedefineTests/RedefineAnnotations.java
index a759574..cfe4c97 100644
--- a/hotspot/test/runtime/RedefineTests/RedefineAnnotations.java
+++ b/hotspot/test/runtime/RedefineTests/RedefineAnnotations.java
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2014, 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2014, 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
@@ -370,7 +370,7 @@
     }
 
     private static void verifyTestAnnSite(Annotation testAnn, String expectedSite) {
-        String expectedAnn = "@TestAnn(site=" + expectedSite + ")";
+        String expectedAnn = "@TestAnn(site=\"" + expectedSite + "\")";
         assertTrue(testAnn.toString().equals(expectedAnn),
                    "Expected \"" + expectedAnn + "\", got \"" + testAnn + "\"");
     }
diff --git a/hotspot/test/runtime/StackGuardPages/invoke.c b/hotspot/test/runtime/StackGuardPages/exeinvoke.c
similarity index 89%
rename from hotspot/test/runtime/StackGuardPages/invoke.c
rename to hotspot/test/runtime/StackGuardPages/exeinvoke.c
index 580e128..fa2a06e 100644
--- a/hotspot/test/runtime/StackGuardPages/invoke.c
+++ b/hotspot/test/runtime/StackGuardPages/exeinvoke.c
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2010, 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2010, 2016, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -36,6 +36,7 @@
 #include <jni.h>
 #include <alloca.h>
 #include <signal.h>
+#include <string.h>
 #include <sys/mman.h>
 #include <stdlib.h>
 #include <sys/ucontext.h>
@@ -46,6 +47,8 @@
 
 #include <pthread.h>
 
+#define CLASS_PATH_OPT "-Djava.class.path="
+
 JavaVM* _jvm;
 
 static jmp_buf  context;
@@ -120,6 +123,7 @@
     fprintf(stderr, "Test ERROR. Can't call detach from current thread\n");
     exit(7);
   }
+  return NULL;
 }
 
 void do_overflow(){
@@ -209,24 +213,42 @@
 void usage() {
   fprintf(stderr, "Usage: invoke test_java_overflow\n");
   fprintf(stderr, "       invoke test_native_overflow\n");
-  exit(7);
 }
 
 
 int main (int argc, const char** argv) {
   JavaVMInitArgs vm_args;
-  JavaVMOption options[2];
+  JavaVMOption options[3];
   JNIEnv* env;
+  int optlen;
+  char *javaclasspath = NULL;
+  char javaclasspathopt[4096];
 
   printf("Test started with pid: %ld\n", (long) getpid());
 
+  /* set the java class path so the DoOverflow class can be found */
+  javaclasspath = getenv("CLASSPATH");
+
+  if (javaclasspath == NULL) {
+    fprintf(stderr, "Test ERROR. CLASSPATH is not set\n");
+    exit(7);
+  }
+  optlen = strlen(CLASS_PATH_OPT) + strlen(javaclasspath) + 1;
+  if (optlen > 4096) {
+    fprintf(stderr, "Test ERROR. CLASSPATH is too long\n");
+    exit(7);
+  }
+  snprintf(javaclasspathopt, sizeof(javaclasspathopt), "%s%s",
+      CLASS_PATH_OPT, javaclasspath);
+
   options[0].optionString = "-Xint";
-  options[1].optionString = "-Xss512k";
+  options[1].optionString = "-Xss328k";
+  options[2].optionString = javaclasspathopt;
 
   vm_args.version = JNI_VERSION_1_2;
   vm_args.ignoreUnrecognized = JNI_TRUE;
   vm_args.options = options;
-  vm_args.nOptions = 2;
+  vm_args.nOptions = 3;
 
   if (JNI_CreateJavaVM (&_jvm, (void **)&env, &vm_args) < 0 ) {
     fprintf(stderr, "Test ERROR. Can't create JavaVM\n");
@@ -263,4 +285,5 @@
 
   fprintf(stderr, "Test ERROR. Unknown parameter %s\n", ((argc > 1) ? argv[1] : "none"));
   usage();
+  exit(7);
 }
diff --git a/hotspot/test/runtime/StackGuardPages/testme.sh b/hotspot/test/runtime/StackGuardPages/testme.sh
index 7f6a24a..22c5001 100644
--- a/hotspot/test/runtime/StackGuardPages/testme.sh
+++ b/hotspot/test/runtime/StackGuardPages/testme.sh
@@ -1,8 +1,29 @@
+# Copyright (c) 2014, 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.
 #!/bin/sh
 
 #
 # @test testme.sh
 # @summary Stack guard pages should be installed correctly and removed when thread is detached
+# @compile DoOverflow.java
 # @run shell testme.sh
 #
 
@@ -21,40 +42,10 @@
   exit 0
 fi
 
-gcc_cmd=`which gcc`
-if [ "x$gcc_cmd" = "x" ]; then
-  echo "WARNING: gcc not found. Cannot execute test." 2>&1
-  exit 0;
-fi
-
-CFLAGS=-m${VM_BITS}
-
 LD_LIBRARY_PATH=.:${TESTJAVA}/jre/lib/${VM_CPU}/${VM_TYPE}:${TESTJAVA}/lib/${VM_CPU}/${VM_TYPE}:/usr/lib:$LD_LIBRARY_PATH
 export LD_LIBRARY_PATH
 
-echo "Architecture: ${VM_CPU}"
-echo "Compilation flag: ${CFLAGS}"
-echo "VM type: ${VM_TYPE}"
-echo "LD_LIBRARY_PATH: ${LD_LIBRARY_PATH}"
-
-# Note pthread may not be found thus invoke creation will fail to be created.
-# Check to ensure you have a /usr/lib/libpthread.so if you don't please look
-# for /usr/lib/`uname -m`-linux-gnu version ensure to add that path to below compilation.
-
-cp ${TESTSRC}/DoOverflow.java .
-${COMPILEJAVA}/bin/javac DoOverflow.java
-
-$gcc_cmd -DLINUX -g3 ${CFLAGS} -o invoke \
-    -I${TESTJAVA}/include -I${TESTJAVA}/include/linux \
-    -L${TESTJAVA}/jre/lib/${VM_CPU}/${VM_TYPE} \
-    -L${TESTJAVA}/lib/${VM_CPU}/${VM_TYPE} \
-     ${TESTSRC}/invoke.c -ljvm -lpthread
-
-if [ $? -ne 0 ] ; then
-    echo "Compile failed, Ignoring failed compilation and forcing the test to pass"
-    exit 0
-fi
-
-./invoke test_java_overflow
-./invoke test_native_overflow
+# Run the test for a java and native overflow
+${TESTNATIVEPATH}/invoke test_java_overflow
+${TESTNATIVEPATH}/invoke test_native_overflow
 exit $?
diff --git a/hotspot/test/runtime/Unsafe/GetUnsafe.java b/hotspot/test/runtime/Unsafe/GetUnsafe.java
deleted file mode 100644
index efc85af..0000000
--- a/hotspot/test/runtime/Unsafe/GetUnsafe.java
+++ /dev/null
@@ -1,46 +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.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-
-/*
- * @test
- * @summary Verifies that getUnsafe() actually throws SecurityException when unsafeAccess is prohibited.
- * @library /testlibrary
- * @modules java.base/jdk.internal.misc
- * @ignore 8161947
- * @run main GetUnsafe
- */
-
-import jdk.internal.misc.Unsafe;
-import static jdk.test.lib.Asserts.*;
-
-public class GetUnsafe {
-    public static void main(String args[]) throws Exception {
-        try {
-            Unsafe unsafe = Unsafe.getUnsafe();
-        } catch (SecurityException e) {
-            // Expected
-            return;
-        }
-        throw new RuntimeException("Did not get expected SecurityException");
-    }
-}
diff --git a/hotspot/test/runtime/7107135/Test.java b/hotspot/test/runtime/execstack/Test.java
similarity index 91%
rename from hotspot/test/runtime/7107135/Test.java
rename to hotspot/test/runtime/execstack/Test.java
index 9b48934..4fd931e 100644
--- a/hotspot/test/runtime/7107135/Test.java
+++ b/hotspot/test/runtime/execstack/Test.java
@@ -1,6 +1,6 @@
 /*
- * Copyright (c) 2002, 2013, Oracle and/or its affiliates. All rights reserved.
- * Copyright (c) 2011 SAP SE. All rights reserved.
+ * Copyright (c) 2002-2016, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2011 SAP AG.  All Rights Reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -42,7 +42,7 @@
     static int Runner() {
         counter = counter * -1;
         int i = counter;
-        if(counter < 2) counter += Runner();
+        if (counter < 2) counter += Runner();
         return i;
     }
 
diff --git a/hotspot/test/runtime/7107135/TestMT.java b/hotspot/test/runtime/execstack/TestMT.java
similarity index 93%
rename from hotspot/test/runtime/7107135/TestMT.java
rename to hotspot/test/runtime/execstack/TestMT.java
index 4fc297d..c02edd5 100644
--- a/hotspot/test/runtime/7107135/TestMT.java
+++ b/hotspot/test/runtime/execstack/TestMT.java
@@ -1,6 +1,6 @@
 /*
- * Copyright (c) 2002, 2013, Oracle and/or its affiliates. All rights reserved.
- * Copyright (c) 2011 SAP SE. All rights reserved.
+ * Copyright (c) 2002-2016, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2011 SAP AG.  All Rights Reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -37,7 +37,7 @@
         return false;
     }
 
-    public static int counter        = 1;
+    public static int counter = 1;
     static int Runner() {
         counter = counter * -1;
         int i = counter;
diff --git a/hotspot/test/runtime/execstack/Testexecstack.java b/hotspot/test/runtime/execstack/Testexecstack.java
new file mode 100644
index 0000000..eb0b89f
--- /dev/null
+++ b/hotspot/test/runtime/execstack/Testexecstack.java
@@ -0,0 +1,74 @@
+/*
+ * 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.
+ */
+
+/*
+ * @test Testexecstack.java
+ * @bug 7107135
+ * @bug 8021296
+ * @bug 8025519
+ * @summary Stack guard pages lost after loading library with executable stack.
+ * @requires (os.family == "linux")
+ * @library /testlibrary
+ * @build jdk.test.lib.*
+ * @compile Test.java
+ * @compile TestMT.java
+ * @run driver Testexecstack
+ */
+
+import jdk.test.lib.*;
+
+public class Testexecstack {
+
+    public static void main(String[] args) throws Throwable {
+
+        // Get the library path property
+        String libpath = System.getProperty("java.library.path");
+
+        // Create a new java process for the Test Java/JNI test without
+        // an executeable stack
+        ProcessBuilder pb = ProcessTools.createJavaProcessBuilder(
+            "-Djava.library.path=" + libpath + ":.", "Test", "test-rw");
+
+        // Start the process and check the output
+        OutputAnalyzer output = new OutputAnalyzer(pb.start());
+        output.shouldHaveExitValue(0);
+
+        // Create a new java process for the Test Java/JNI test with an
+        // executable stack
+        pb = ProcessTools.createJavaProcessBuilder(
+            "-Djava.library.path=" + libpath + ":.", "Test", "test-rwx");
+
+        // Start the process and check the output
+        output = new OutputAnalyzer(pb.start());
+        output.shouldHaveExitValue(0);
+
+        // Create a new java process for the TestMT Java/JNI test with an
+        // executable stack
+        pb = ProcessTools.createJavaProcessBuilder(
+            "-Djava.library.path=" + libpath + ":.", "TestMT", "test-rwx");
+
+        // Start the process and check the output
+        output = new OutputAnalyzer(pb.start());
+        output.shouldHaveExitValue(0);
+    }
+}
diff --git a/hotspot/test/runtime/7107135/test.c b/hotspot/test/runtime/execstack/libtest-rw.c
similarity index 76%
copy from hotspot/test/runtime/7107135/test.c
copy to hotspot/test/runtime/execstack/libtest-rw.c
index 3e39eae..93b11a1 100644
--- a/hotspot/test/runtime/7107135/test.c
+++ b/hotspot/test/runtime/execstack/libtest-rw.c
@@ -1,6 +1,6 @@
 /*
- * Copyright (c) 2002, 2013, Oracle and/or its affiliates. All rights reserved.
- * Copyright (c) 2011 SAP SE. All rights reserved.
+ * Copyright (c) 2002-2016, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2011 SAP AG.  All Rights Reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -22,6 +22,12 @@
  * questions.
  */
 
+/*
+ * This source file is the same as libtest-rwx.c and needs to be a separate
+ * file so it can be built with "-z noexecstack" by the build process.
+ * If any changes are made they probably also need to be made to libtest-rwx.c.
+ */
+
 #include <stdlib.h>
 #include <string.h>
 #include <stdio.h>
diff --git a/hotspot/test/runtime/7107135/test.c b/hotspot/test/runtime/execstack/libtest-rwx.c
similarity index 76%
rename from hotspot/test/runtime/7107135/test.c
rename to hotspot/test/runtime/execstack/libtest-rwx.c
index 3e39eae..62b5ac9 100644
--- a/hotspot/test/runtime/7107135/test.c
+++ b/hotspot/test/runtime/execstack/libtest-rwx.c
@@ -1,6 +1,6 @@
 /*
- * Copyright (c) 2002, 2013, Oracle and/or its affiliates. All rights reserved.
- * Copyright (c) 2011 SAP SE. All rights reserved.
+ * Copyright (c) 2002-2016, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2011 SAP AG.  All Rights Reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -22,6 +22,12 @@
  * questions.
  */
 
+/*
+ * This source file is the same as libtest-rw.c and needs to be a separate
+ * file so it can be built with "-z execstack" by the build process.
+ * If any changes are made they probably also need to be made to libtest-rwx.c.
+ */
+
 #include <stdlib.h>
 #include <string.h>
 #include <stdio.h>
diff --git a/hotspot/test/runtime/jsig/Test8017498.sh b/hotspot/test/runtime/jsig/Test8017498.sh
deleted file mode 100644
index 64b019d..0000000
--- a/hotspot/test/runtime/jsig/Test8017498.sh
+++ /dev/null
@@ -1,100 +0,0 @@
-#!/bin/sh
-
-#
-#  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.
-#
-#  This code is distributed in the hope that it will be useful, but WITHOUT
-#  ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
-#  FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
-#  version 2 for more details (a copy is included in the LICENSE file that
-#  accompanied this code).
-#
-#  You should have received a copy of the GNU General Public License version
-#  2 along with this work; if not, write to the Free Software Foundation,
-#  Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
-#
-#  Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
-#  or visit www.oracle.com if you need additional information or have any
-#  questions.
-#
-
-##
-## @test Test8017498.sh
-## @bug 8017498
-## @bug 8020791
-## @bug 8021296
-## @bug 8022301
-## @bug 8025519
-## @summary sigaction(sig) results in process hang/timed-out if sig is much greater than SIGRTMAX
-## @run shell/timeout=60 Test8017498.sh
-##
-
-if [ -z "${TESTSRC}" ]; then
-  TESTSRC="${PWD}"
-  echo "TESTSRC not set.  Using "${TESTSRC}" as default"
-fi
-
-echo "TESTSRC=${TESTSRC}"
-## Adding common setup Variables for running shell tests.
-. ${TESTSRC}/../../test_env.sh
-
-EXTRA_CFLAG=
-
-# set platform-dependent variables
-OS=`uname -s`
-case "$OS" in
-  Linux)
-    echo "Testing on Linux"
-    gcc_cmd=`which gcc`
-    if [ -z "$gcc_cmd" ]; then
-        echo "WARNING: gcc not found. Cannot execute test." 2>&1
-        exit 0;
-    fi
-    MY_LD_PRELOAD=${TESTJAVA}${FS}jre${FS}lib${FS}${VM_CPU}${FS}libjsig.so
-    if [ "$VM_BITS" = "32" ] && [ "$VM_CPU" != "arm" ] && [ "$VM_CPU" != "ppc" ]; then
-        EXTRA_CFLAG=-m32
-    fi
-    echo MY_LD_PRELOAD = ${MY_LD_PRELOAD}
-    ;;
-  *)
-    echo "Test passed; only valid for Linux"
-    exit 0;
-    ;;
-esac
-
-THIS_DIR=.
-
-cp "${TESTSRC}${FS}"*.java "${THIS_DIR}"
-${COMPILEJAVA}${FS}bin${FS}javac *.java
-
-$gcc_cmd -DLINUX -fPIC -shared \
-    ${EXTRA_CFLAG} -z noexecstack \
-    -o libTestJNI.so \
-    -I${COMPILEJAVA}${FS}include \
-    -I${COMPILEJAVA}${FS}include${FS}linux \
-    ${TESTSRC}${FS}TestJNI.c
-
-if [ $? -ne 0 ] ; then
-    echo "Compile failed, Ignoring failed compilation and forcing the test to pass"
-    exit 0
-fi
-
-# run the java test in the background
-cmd="LD_PRELOAD=$MY_LD_PRELOAD \
-    ${TESTJAVA}${FS}bin${FS}java \
-    -Djava.library.path=. -server TestJNI 100"
-echo "$cmd > test.out"
-eval $cmd > test.out
-
-if grep "old handler" test.out > ${NULL}; then
-    echo "Test Passed"
-    exit 0
-fi
-
-echo "Test Failed"
-exit 1
diff --git a/hotspot/test/runtime/jsig/TestJNI.c b/hotspot/test/runtime/jsig/libTestJNI.c
similarity index 100%
rename from hotspot/test/runtime/jsig/TestJNI.c
rename to hotspot/test/runtime/jsig/libTestJNI.c
diff --git a/hotspot/test/runtime/logging/MonitorMismatchTest.java b/hotspot/test/runtime/logging/MonitorMismatchTest.java
index 82d464c..0d7c76f 100644
--- a/hotspot/test/runtime/logging/MonitorMismatchTest.java
+++ b/hotspot/test/runtime/logging/MonitorMismatchTest.java
@@ -39,23 +39,21 @@
 public class MonitorMismatchTest {
 
     public static void main(String... args) throws Exception {
-        if (!Platform.isEmbedded()){
-            // monitormismatch should turn on.
-            ProcessBuilder pb = ProcessTools.createJavaProcessBuilder("-Xcomp",
-                                                                      "-XX:+TieredCompilation",
-                                                                      "-Xlog:monitormismatch=info",
-                                                                      "MonitorMismatchHelper");
-            OutputAnalyzer o = new OutputAnalyzer(pb.start());
-            o.shouldContain("[monitormismatch] Monitor mismatch in method");
+        // monitormismatch should turn on.
+        ProcessBuilder pb = ProcessTools.createJavaProcessBuilder("-Xcomp",
+                                                                  "-XX:+TieredCompilation",
+                                                                  "-Xlog:monitormismatch=info",
+                                                                  "MonitorMismatchHelper");
+        OutputAnalyzer o = new OutputAnalyzer(pb.start());
+        o.shouldContain("[monitormismatch] Monitor mismatch in method");
 
-            // monitormismatch should turn off.
-            pb = ProcessTools.createJavaProcessBuilder("-Xcomp",
-                                                       "-XX:+TieredCompilation",
-                                                       "-Xlog:monitormismatch=off",
-                                                       "MonitorMismatchHelper");
-            o = new OutputAnalyzer(pb.start());
-            o.shouldNotContain("[monitormismatch]");
-        }
+        // monitormismatch should turn off.
+        pb = ProcessTools.createJavaProcessBuilder("-Xcomp",
+                                                   "-XX:+TieredCompilation",
+                                                   "-Xlog:monitormismatch=off",
+                                                   "MonitorMismatchHelper");
+        o = new OutputAnalyzer(pb.start());
+        o.shouldNotContain("[monitormismatch]");
     };
 
 }
diff --git a/hotspot/test/runtime/modules/JVMDefineModule.java b/hotspot/test/runtime/modules/JVMDefineModule.java
index 602c5fd..82f5065 100644
--- a/hotspot/test/runtime/modules/JVMDefineModule.java
+++ b/hotspot/test/runtime/modules/JVMDefineModule.java
@@ -77,7 +77,7 @@
             ModuleHelper.DefineModule(new Object(),  "9.0", "mymodule/here", new String[] { "mypackage1" });
             throw new RuntimeException("Failed to get expected IAE or NPE for bad module");
         } catch(IllegalArgumentException e) {
-            if (!e.getMessage().contains("module is not a subclass")) {
+            if (!e.getMessage().contains("module is not an instance of type java.lang.reflect.Module")) {
               throw new RuntimeException("Failed to get expected IAE message for bad module: " + e.getMessage());
             }
         }
diff --git a/hotspot/test/serviceability/dcmd/compiler/CompilerQueueTest.java b/hotspot/test/serviceability/dcmd/compiler/CompilerQueueTest.java
index 708ee0b..217e9c2 100644
--- a/hotspot/test/serviceability/dcmd/compiler/CompilerQueueTest.java
+++ b/hotspot/test/serviceability/dcmd/compiler/CompilerQueueTest.java
@@ -29,6 +29,7 @@
  *          java.compiler
  *          java.management
  *          jdk.jvmstat/sun.jvmstat.monitor
+ * @summary Test of diagnostic command Compiler.queue
  * @build jdk.test.lib.*
  *        jdk.test.lib.dcmd.*
  *        sun.hotspot.WhiteBox
@@ -38,7 +39,6 @@
  * @run testng/othervm -Xbootclasspath/a:. -XX:+UnlockDiagnosticVMOptions -Xmixed -XX:+WhiteBoxAPI CompilerQueueTest
  * @run testng/othervm -Xbootclasspath/a:. -XX:+UnlockDiagnosticVMOptions -Xmixed -XX:-TieredCompilation -XX:+WhiteBoxAPI CompilerQueueTest
  * @run testng/othervm -Xbootclasspath/a:. -XX:+UnlockDiagnosticVMOptions -Xint -XX:+WhiteBoxAPI CompilerQueueTest
- * @summary Test of diagnostic command Compiler.queue
  */
 
 import compiler.testlibrary.CompilerUtils;
@@ -107,7 +107,7 @@
             boolean added = WB.enqueueMethodForCompilation(testcase.method, testcase.level);
             // Set results to false for those methods we must to find
             // We will also assert if we find any test method we don't expect
-            Assert.assertTrue(WB.isMethodQueuedForCompilation(testcase.method));
+            Assert.assertEquals(added, WB.isMethodQueuedForCompilation(testcase.method));
             testcase.check = false;
         }
 
diff --git a/hotspot/test/serviceability/jvmti/ExceptionCaughtOutOfPhase/ExceptionCaughtOutOfPhaseTest.java b/hotspot/test/serviceability/jvmti/ExceptionCaughtOutOfPhase/ExceptionCaughtOutOfPhaseTest.java
new file mode 100644
index 0000000..2c823d3
--- /dev/null
+++ b/hotspot/test/serviceability/jvmti/ExceptionCaughtOutOfPhase/ExceptionCaughtOutOfPhaseTest.java
@@ -0,0 +1,61 @@
+/*
+ * 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.
+ */
+
+import java.security.AccessController;
+import java.security.PrivilegedAction;
+
+/*
+ * @test
+ * @bug 8134434
+ * @summary JVM_DoPrivileged() fires assert(_exception_caught == false) failed: _exception_caught is out of phase
+ * @run main/othervm -agentlib:jdwp=transport=dt_socket,address=9000,server=y,suspend=n -Xbatch ExceptionCaughtOutOfPhaseTest
+ */
+
+public class ExceptionCaughtOutOfPhaseTest {
+    public static void main(String[] args) {
+        PrivilegedAction action = new HotThrowingAction();
+        System.out.println("### Warm-up");
+        for(int i=0; i<11000; i++) {
+            try {
+                action.run(); // call run() to get it compiled
+            } catch(Throwable t) {
+                // ignored
+            }
+        }
+
+        System.out.println("### Warm-up done");
+        System.out.println("### Executing privileged action");
+
+        try {
+            AccessController.doPrivileged(action);
+        } catch (Error e) {
+            // ignored
+        }
+    }
+
+    public static class HotThrowingAction implements PrivilegedAction {
+        public Object run() {
+            throw new Error();
+        }
+    }
+}
diff --git a/hotspot/test/serviceability/jvmti/GetModulesInfo/JvmtiGetAllModulesTest.java b/hotspot/test/serviceability/jvmti/GetModulesInfo/JvmtiGetAllModulesTest.java
new file mode 100644
index 0000000..90855ba
--- /dev/null
+++ b/hotspot/test/serviceability/jvmti/GetModulesInfo/JvmtiGetAllModulesTest.java
@@ -0,0 +1,130 @@
+/*
+ * 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.
+ */
+
+/**
+ * @test
+ * @summary Verifies the JVMTI GetAllModules API
+ * @library /testlibrary
+ * @run main/othervm -agentlib:JvmtiGetAllModulesTest JvmtiGetAllModulesTest
+ *
+ */
+import java.lang.reflect.Layer;
+import java.lang.reflect.Module;
+import java.lang.module.ModuleReference;
+import java.lang.module.ModuleFinder;
+import java.lang.module.ModuleReader;
+import java.lang.module.ModuleDescriptor;
+import java.lang.module.Configuration;
+import java.util.Arrays;
+import java.util.Set;
+import java.util.Map;
+import java.util.function.Supplier;
+import java.util.Objects;
+import java.util.Optional;
+import java.net.URI;
+import java.util.HashSet;
+import java.util.HashMap;
+import java.util.stream.Collectors;
+import jdk.test.lib.Asserts;
+
+public class JvmtiGetAllModulesTest {
+
+    private static native Module[] getModulesNative();
+
+    private static Set<Module> getModulesJVMTI() {
+
+        Set<Module> modules = Arrays.stream(getModulesNative()).collect(Collectors.toSet());
+
+        // JVMTI reports unnamed modules, Java API does not
+        // remove the unnamed modules here, so the resulting report can be expected
+        // to be equal to what Java reports
+        modules.removeIf(mod -> !mod.isNamed());
+
+        return modules;
+    }
+
+    public static void main(String[] args) throws Exception {
+
+        final String MY_MODULE_NAME = "myModule";
+
+        // Verify that JVMTI reports exactly the same info as Java regarding the named modules
+        Asserts.assertEquals(Layer.boot().modules(), getModulesJVMTI());
+
+        // Load a new named module
+        ModuleDescriptor descriptor
+                = new ModuleDescriptor.Builder(MY_MODULE_NAME)
+                .build();
+        ModuleFinder finder = finderOf(descriptor);
+        ClassLoader loader = new ClassLoader() {};
+        Configuration parent = Layer.boot().configuration();
+        Configuration cf = parent.resolveRequires(finder, ModuleFinder.of(), Set.of(MY_MODULE_NAME));
+        Layer my = Layer.boot().defineModules(cf, m -> loader);
+
+        // Verify that the loaded module is indeed reported by JVMTI
+        Set<Module> jvmtiModules = getModulesJVMTI();
+        for (Module mod : my.modules()) {
+            if (!jvmtiModules.contains(mod)) {
+                throw new RuntimeException("JVMTI did not report the loaded named module: " + mod.getName());
+            }
+        }
+
+    }
+
+    /**
+     * Returns a ModuleFinder that finds modules with the given module
+     * descriptors.
+     */
+    static ModuleFinder finderOf(ModuleDescriptor... descriptors) {
+
+        // Create a ModuleReference for each module
+        Map<String, ModuleReference> namesToReference = new HashMap<>();
+
+        for (ModuleDescriptor descriptor : descriptors) {
+            String name = descriptor.name();
+
+            URI uri = URI.create("module:/" + name);
+
+            Supplier<ModuleReader> supplier = () -> {
+                throw new UnsupportedOperationException();
+            };
+
+            ModuleReference mref = new ModuleReference(descriptor, uri, supplier);
+
+            namesToReference.put(name, mref);
+        }
+
+        return new ModuleFinder() {
+            @Override
+            public Optional<ModuleReference> find(String name) {
+                Objects.requireNonNull(name);
+                return Optional.ofNullable(namesToReference.get(name));
+            }
+
+            @Override
+            public Set<ModuleReference> findAll() {
+                return new HashSet<>(namesToReference.values());
+            }
+        };
+    }
+
+}
diff --git a/hotspot/test/serviceability/jvmti/GetModulesInfo/libJvmtiGetAllModulesTest.c b/hotspot/test/serviceability/jvmti/GetModulesInfo/libJvmtiGetAllModulesTest.c
new file mode 100644
index 0000000..ed83d19
--- /dev/null
+++ b/hotspot/test/serviceability/jvmti/GetModulesInfo/libJvmtiGetAllModulesTest.c
@@ -0,0 +1,67 @@
+/*
+ * 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.
+ */
+
+#include <stdio.h>
+#include <string.h>
+#include <jvmti.h>
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+    static jvmtiEnv *jvmti = NULL;
+
+    JNIEXPORT jint JNICALL Agent_OnLoad(JavaVM *jvm, char *options, void *reserved) {
+        int err = (*jvm)->GetEnv(jvm, (void**) &jvmti, JVMTI_VERSION_9);
+        if (err != JNI_OK) {
+            return JNI_ERR;
+        }
+        return JNI_OK;
+    }
+
+    JNIEXPORT jobjectArray JNICALL
+    Java_JvmtiGetAllModulesTest_getModulesNative(JNIEnv *env, jclass cls) {
+
+        jvmtiError err;
+        jint modules_count = -1;
+        jobject* modules_ptr;
+        jobjectArray array = NULL;
+        int i = 0;
+
+        err = (*jvmti)->GetAllModules(jvmti, &modules_count, &modules_ptr);
+        if (err != JVMTI_ERROR_NONE) {
+            return NULL;
+        }
+
+        array = (*env)->NewObjectArray(env, modules_count, (*env)->FindClass(env, "java/lang/reflect/Module"), NULL);
+
+        for (i = 0; i < modules_count; ++i) {
+            (*env)->SetObjectArrayElement(env, array, i, modules_ptr[i]);
+        }
+
+        return array;
+    }
+
+#ifdef __cplusplus
+}
+#endif
diff --git a/hotspot/test/serviceability/sa/TestClassLoaderStats.java b/hotspot/test/serviceability/sa/TestClassLoaderStats.java
deleted file mode 100644
index 6cbd9ee..0000000
--- a/hotspot/test/serviceability/sa/TestClassLoaderStats.java
+++ /dev/null
@@ -1,79 +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.
- *
- * 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.util.ArrayList;
-import java.util.List;
-
-import jdk.test.lib.Platform;
-import jdk.test.lib.ProcessTools;
-import jdk.test.lib.OutputAnalyzer;
-import jdk.test.lib.Utils;
-import jdk.test.lib.apps.LingeredApp;
-
-/*
- * @test
- * @summary Started failing on 2016.06.24 due to 8160376 on MacOS X so
- * quarantine it on that platform:
- * @requires os.family != "mac"
- * @modules java.base/jdk.internal.misc
- * @library /test/lib/share/classes
- * @library /testlibrary
- * @build jdk.test.lib.*
- * @build jdk.test.lib.apps.*
- * @run main TestClassLoaderStats
- */
-public class TestClassLoaderStats {
-
-    public static void main(String[] args) throws Exception {
-        if (!Platform.shouldSAAttach()) {
-            System.out.println("SA attach not expected to work - test skipped.");
-            return;
-        }
-
-        LingeredApp app = null;
-        try {
-            List<String> vmArgs = new ArrayList<String>();
-            vmArgs.add("-XX:+UsePerfData");
-            vmArgs.addAll(Utils.getVmOptions());
-            app = LingeredApp.startApp(vmArgs);
-
-            System.out.println("Attaching sun.jvm.hotspot.tools.ClassLoaderStats to " + app.getPid());
-            ProcessBuilder processBuilder = ProcessTools.createJavaProcessBuilder(
-                    "-XX:+UsePerfData",
-                    "sun.jvm.hotspot.tools.ClassLoaderStats",
-                    Long.toString(app.getPid()));
-            OutputAnalyzer output = ProcessTools.executeProcess(processBuilder);
-            System.out.println(output.getOutput());
-
-            output.shouldHaveExitValue(0);
-            output.shouldContain("Debugger attached successfully.");
-            // The class loader stats header needs to be presented in the output:
-            output.shouldMatch("class_loader\\W+classes\\W+bytes\\W+parent_loader\\W+alive?\\W+type");
-            output.stderrShouldNotMatch("[E|e]xception");
-            output.stderrShouldNotMatch("[E|e]rror");
-        } finally {
-            LingeredApp.stopApp(app);
-        }
-    }
-
-}
diff --git a/hotspot/test/serviceability/sa/TestInstanceKlassSize.java b/hotspot/test/serviceability/sa/TestInstanceKlassSize.java
new file mode 100644
index 0000000..5d13df4
--- /dev/null
+++ b/hotspot/test/serviceability/sa/TestInstanceKlassSize.java
@@ -0,0 +1,198 @@
+/*
+ * 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.
+ *
+ * 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 sun.jvm.hotspot.HotSpotAgent;
+import sun.jvm.hotspot.utilities.SystemDictionaryHelper;
+import sun.jvm.hotspot.debugger.*;
+
+import java.util.ArrayList;
+import java.util.List;
+import java.util.stream.Collectors;
+
+import jdk.test.lib.JDKToolLauncher;
+import jdk.test.lib.Platform;
+import jdk.test.lib.ProcessTools;
+import jdk.test.lib.OutputAnalyzer;
+import jdk.test.lib.Utils;
+import jdk.test.lib.apps.LingeredApp;
+import jdk.test.lib.Asserts;
+
+import java.io.*;
+import java.util.*;
+
+/*
+ * @test
+ * @library /test/lib/share/classes
+ * @library /testlibrary
+ * @build jdk.test.lib.*
+ * @build jdk.test.lib.apps.*
+ * @modules java.base/jdk.internal.misc
+ * @modules jdk.hotspot.agent
+ * @modules jdk.hotspot.agent/sun.jvm.hotspot
+ * @modules jdk.hotspot.agent/sun.jvm.hotspot.utilities
+ * @modules jdk.hotspot.agent/sun.jvm.hotspot.oops
+ * @compile -XDignore.symbol.file=true -Xmodule:jdk.hotspot.agent TestInstanceKlassSize.java
+ * @run main/othervm  TestInstanceKlassSize
+ */
+
+public class TestInstanceKlassSize {
+
+    private static String getJcmdInstanceKlassSize(OutputAnalyzer output,
+                                                   String instanceKlassName) {
+        for (String s : output.asLines()) {
+            if (s.contains(instanceKlassName)) {
+                String tokens[];
+                System.out.println(s);
+                tokens = s.split("\\s+");
+                return tokens[3];
+            }
+        }
+        return null;
+    }
+
+    private static OutputAnalyzer jcmd(Long pid,
+                                       String... toolArgs) throws Exception {
+        ProcessBuilder processBuilder = new ProcessBuilder();
+        JDKToolLauncher launcher = JDKToolLauncher.createUsingTestJDK("jcmd");
+        launcher.addToolArg(Long.toString(pid));
+        if (toolArgs != null) {
+            for (String toolArg : toolArgs) {
+                launcher.addToolArg(toolArg);
+            }
+        }
+
+        processBuilder.command(launcher.getCommand());
+        System.out.println(
+            processBuilder.command().stream().collect(Collectors.joining(" ")));
+        return ProcessTools.executeProcess(processBuilder);
+    }
+
+    private static void startMeWithArgs() throws Exception {
+
+        LingeredApp app = null;
+        OutputAnalyzer output = null;
+        try {
+            List<String> vmArgs = new ArrayList<String>();
+            vmArgs.add("-XX:+UnlockDiagnosticVMOptions");
+            vmArgs.add("-XX:+UsePerfData");
+            vmArgs.addAll(Utils.getVmOptions());
+            app = LingeredApp.startApp(vmArgs);
+            System.out.println ("Started LingeredApp with pid " + app.getPid());
+        } catch (Exception ex) {
+            ex.printStackTrace();
+            throw new RuntimeException(ex);
+        }
+        try {
+            String[] instanceKlassNames = new String[] {
+                                              " java.lang.Object",
+                                              " java.util.Vector",
+                                              " sun.util.PreHashedMap",
+                                              " java.lang.String",
+                                              " java.lang.Thread",
+                                              " java.lang.Byte",
+                                          };
+            String[] toolArgs = {
+                "-XX:+UnlockDiagnosticVMOptions",
+                "-XaddExports:jdk.hotspot.agent/sun.jvm.hotspot=ALL-UNNAMED",
+                "-XaddExports:jdk.hotspot.agent/sun.jvm.hotspot.utilities=ALL-UNNAMED",
+                "-XaddExports:jdk.hotspot.agent/sun.jvm.hotspot.oops=ALL-UNNAMED",
+                "TestInstanceKlassSize",
+                Long.toString(app.getPid())
+            };
+
+            OutputAnalyzer jcmdOutput = jcmd(
+                           app.getPid(),
+                           "GC.class_stats", "VTab,ITab,OopMap,KlassBytes");
+            ProcessBuilder processBuilder = ProcessTools
+                                            .createJavaProcessBuilder(toolArgs);
+            output = ProcessTools.executeProcess(processBuilder);
+            System.out.println(output.getOutput());
+            output.shouldHaveExitValue(0);
+
+            // Check whether the size matches that which jcmd outputs
+            for (String instanceKlassName : instanceKlassNames) {
+                System.out.println ("Trying to match for" + instanceKlassName);
+                String jcmdInstanceKlassSize = getJcmdInstanceKlassSize(
+                                                      jcmdOutput,
+                                                      instanceKlassName);
+                for (String s : output.asLines()) {
+                    if (s.contains(instanceKlassName)) {
+                       Asserts.assertTrue(
+                          s.contains(jcmdInstanceKlassSize),
+                          "The size computed by SA for" +
+                          instanceKlassName + " does not match.");
+                    }
+                }
+            }
+        } finally {
+            LingeredApp.stopApp(app);
+        }
+    }
+
+    private static void SAInstanceKlassSize(int pid,
+                                            String[] SAInstanceKlassNames) {
+        HotSpotAgent agent = new HotSpotAgent();
+        try {
+            agent.attach(pid);
+        }
+        catch (DebuggerException e) {
+            System.out.println(e.getMessage());
+            System.err.println("Unable to connect to process ID: " + pid);
+
+            agent.detach();
+            e.printStackTrace();
+        }
+
+        for (String SAInstanceKlassName : SAInstanceKlassNames) {
+            Long size = SystemDictionaryHelper.findInstanceKlass(
+                            SAInstanceKlassName).getSize();
+            System.out.println("SA: The size of " + SAInstanceKlassName +
+                               " is " + size);
+        }
+        agent.detach();
+    }
+
+    public static void main(String[] args) throws Exception {
+
+        if (!Platform.shouldSAAttach()) {
+            System.out.println("SA attach not expected to work - test skipped.");
+            return;
+        }
+
+        if (args == null || args.length == 0) {
+            System.out.println ("No args run. Starting with args now.");
+            startMeWithArgs();
+        } else {
+            String[] SAInstanceKlassNames = new String[] {
+                                                "java.lang.Object",
+                                                "java.util.Vector",
+                                                "sun.util.PreHashedMap",
+                                                "java.lang.String",
+                                                "java.lang.Thread",
+                                                "java.lang.Byte"
+                                             };
+            SAInstanceKlassSize(Integer.parseInt(args[0]), SAInstanceKlassNames);
+        }
+    }
+}
+
diff --git a/hotspot/test/serviceability/sa/TestInstanceKlassSizeForInterface.java b/hotspot/test/serviceability/sa/TestInstanceKlassSizeForInterface.java
new file mode 100644
index 0000000..085ac24
--- /dev/null
+++ b/hotspot/test/serviceability/sa/TestInstanceKlassSizeForInterface.java
@@ -0,0 +1,185 @@
+/*
+ * 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.
+ *
+ * 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 sun.jvm.hotspot.HotSpotAgent;
+import sun.jvm.hotspot.utilities.SystemDictionaryHelper;
+import sun.jvm.hotspot.oops.InstanceKlass;
+import sun.jvm.hotspot.debugger.*;
+
+import jdk.test.lib.JDKToolLauncher;
+import jdk.test.lib.JDKToolFinder;
+import jdk.test.lib.Platform;
+import jdk.test.lib.ProcessTools;
+import jdk.test.lib.OutputAnalyzer;
+import jdk.test.lib.Utils;
+import jdk.test.lib.Asserts;
+
+/*
+ * @test
+ * @library /test/lib/share/classes
+ * @library /testlibrary
+ * @build jdk.test.lib.*
+ * @build jdk.test.lib.apps.*
+ * @modules java.base/jdk.internal.misc
+ * @modules jdk.hotspot.agent
+ * @modules jdk.hotspot.agent/sun.jvm.hotspot
+ * @modules jdk.hotspot.agent/sun.jvm.hotspot.utilities
+ * @modules jdk.hotspot.agent/sun.jvm.hotspot.oops
+ * @compile -XDignore.symbol.file=true -Xmodule:jdk.hotspot.agent TestInstanceKlassSizeForInterface.java
+ * @run main/othervm TestInstanceKlassSizeForInterface
+ */
+
+interface Language {
+    static final long nbrOfWords = 99999;
+    public abstract long getNbrOfWords();
+}
+
+class ParselTongue implements Language {
+    public long getNbrOfWords() {
+      return nbrOfWords * 4;
+    }
+}
+
+public class TestInstanceKlassSizeForInterface {
+
+    private static void SAInstanceKlassSize(int pid,
+                                            String[] instanceKlassNames) {
+
+        HotSpotAgent agent = new HotSpotAgent();
+        try {
+            agent.attach((int)pid);
+        }
+        catch (DebuggerException e) {
+            System.out.println(e.getMessage());
+            System.err.println("Unable to connect to process ID: " + pid);
+
+            agent.detach();
+            e.printStackTrace();
+        }
+
+        for (String instanceKlassName : instanceKlassNames) {
+            InstanceKlass iKlass = SystemDictionaryHelper.findInstanceKlass(
+                                       instanceKlassName);
+            System.out.println("SA: The size of " + instanceKlassName +
+                               " is " + iKlass.getSize());
+        }
+        agent.detach();
+    }
+
+    private static String getJcmdInstanceKlassSize(OutputAnalyzer output,
+                                                   String instanceKlassName) {
+        for (String s : output.asLines()) {
+            if (s.contains(instanceKlassName)) {
+                String tokens[];
+                System.out.println(s);
+                tokens = s.split("\\s+");
+                return tokens[3];
+            }
+        }
+        return null;
+    }
+
+    private static void createAnotherToAttach(
+                            String[] instanceKlassNames) throws Exception {
+
+        ProcessBuilder pb = new ProcessBuilder();
+
+        // Grab the pid from the current java process and pass it
+        String[] toolArgs = {
+            "-XX:+UnlockDiagnosticVMOptions",
+            "-XaddExports:jdk.hotspot.agent/sun.jvm.hotspot=ALL-UNNAMED",
+            "-XaddExports:jdk.hotspot.agent/sun.jvm.hotspot.utilities=ALL-UNNAMED",
+            "-XaddExports:jdk.hotspot.agent/sun.jvm.hotspot.oops=ALL-UNNAMED",
+            "TestInstanceKlassSizeForInterface",
+            Long.toString(ProcessTools.getProcessId())
+        };
+
+        pb.command(new String[] {
+                          JDKToolFinder.getJDKTool("jcmd"),
+                          Long.toString(ProcessTools.getProcessId()),
+                          "GC.class_stats",
+                          "VTab,ITab,OopMap,KlassBytes"
+                      }
+                  );
+
+        // Start a new process to attach to the current process
+        ProcessBuilder processBuilder = ProcessTools
+                  .createJavaProcessBuilder(toolArgs);
+        OutputAnalyzer SAOutput = ProcessTools.executeProcess(processBuilder);
+        System.out.println(SAOutput.getOutput());
+
+        OutputAnalyzer jcmdOutput = new OutputAnalyzer(pb.start());
+        System.out.println(jcmdOutput.getOutput());
+
+        // Match the sizes from both the output streams
+        for (String instanceKlassName : instanceKlassNames) {
+            System.out.println ("Trying to match for " + instanceKlassName);
+            String jcmdInstanceKlassSize = getJcmdInstanceKlassSize(
+                                                      jcmdOutput,
+                                                      instanceKlassName);
+            for (String s : SAOutput.asLines()) {
+                if (s.contains(instanceKlassName)) {
+                   Asserts.assertTrue(
+                      s.contains(jcmdInstanceKlassSize),
+                      "The size computed by SA for " +
+                      instanceKlassName + " does not match.");
+                }
+            }
+        }
+    }
+
+    public static void main (String... args) throws Exception {
+        String[] instanceKlassNames = new String[] {
+                                          "Language",
+                                          "ParselTongue",
+                                          "TestInstanceKlassSizeForInterface$1"
+                                      };
+
+        if (!Platform.shouldSAAttach()) {
+            System.out.println(
+               "SA attach not expected to work - test skipped.");
+            return;
+        }
+
+        if ( args == null || args.length == 0 ) {
+            ParselTongue lang = new ParselTongue();
+
+            Language ventro = new Language() {
+                public long getNbrOfWords() {
+                    return nbrOfWords * 8;
+                }
+            };
+
+            // Not tested at this point. The test needs to be enhanced
+            // later to test for the sizes of the Lambda MetaFactory
+            // generated anonymous classes too. (After JDK-8160228 gets
+            // fixed.)
+            Runnable r2 = () -> System.out.println("Hello world!");
+            r2.run();
+
+            createAnotherToAttach(instanceKlassNames);
+        } else {
+            SAInstanceKlassSize(Integer.parseInt(args[0]), instanceKlassNames);
+        }
+    }
+}
diff --git a/hotspot/test/serviceability/sa/TestStackTrace.java b/hotspot/test/serviceability/sa/TestStackTrace.java
deleted file mode 100644
index de6c970..0000000
--- a/hotspot/test/serviceability/sa/TestStackTrace.java
+++ /dev/null
@@ -1,77 +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.
- *
- * 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.util.ArrayList;
-import java.util.List;
-
-import jdk.test.lib.OutputAnalyzer;
-import jdk.test.lib.Platform;
-import jdk.test.lib.ProcessTools;
-import jdk.test.lib.Utils;
-import jdk.test.lib.apps.LingeredApp;
-
-/*
- * @test
- * @summary Started failing on 2016.06.24 due to 8160376 on MacOS X so
- * quarantine it on that platform:
- * @requires os.family != "mac"
- * @modules java.base/jdk.internal.misc
- * @library /test/lib/share/classes
- * @library /testlibrary
- * @build jdk.test.lib.*
- * @build jdk.test.lib.apps.*
- * @run main TestStackTrace
- */
-public class TestStackTrace {
-
-    public static void main(String[] args) throws Exception {
-        if (!Platform.shouldSAAttach()) {
-            System.out.println("SA attach not expected to work - test skipped.");
-            return;
-        }
-
-        LingeredApp app = null;
-        try {
-            List<String> vmArgs = new ArrayList<String>();
-            vmArgs.add("-XX:+UsePerfData");
-            vmArgs.addAll(Utils.getVmOptions());
-            app = LingeredApp.startApp(vmArgs);
-
-            System.out.println("Attaching sun.jvm.hotspot.tools.StackTrace to " + app.getPid());
-            ProcessBuilder processBuilder = ProcessTools.createJavaProcessBuilder(
-                    "-XX:+UsePerfData",
-                    "sun.jvm.hotspot.tools.StackTrace",
-                    Long.toString(app.getPid()));
-            OutputAnalyzer output = ProcessTools.executeProcess(processBuilder);
-            System.out.println(output.getOutput());
-
-            output.shouldHaveExitValue(0);
-            output.shouldContain("Debugger attached successfully.");
-            output.stderrShouldNotMatch("[E|e]xception");
-            output.stderrShouldNotMatch("[E|e]rror");
-        } finally {
-            LingeredApp.stopApp(app);
-        }
-     }
-
-}
diff --git a/hotspot/test/testlibrary/ctw/Makefile b/hotspot/test/testlibrary/ctw/Makefile
index a4fc462..ed63271 100644
--- a/hotspot/test/testlibrary/ctw/Makefile
+++ b/hotspot/test/testlibrary/ctw/Makefile
@@ -1,5 +1,5 @@
 #
-# Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved.
+# Copyright (c) 2013, 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
@@ -35,12 +35,13 @@
 SRC_DIR = src
 BUILD_DIR = build
 OUTPUT_DIR = $(BUILD_DIR)/classes
-WHITEBOX_DIR = ../whitebox
+TESTLIBRARY_DIR = ../../../../test/lib
 
 JAVAC = $(JDK_HOME)/bin/javac
 JAR = $(JDK_HOME)/bin/jar
 
-SRC_FILES = $(shell find $(SRC_DIR) -name '*.java')
+SRC_FILES = $(shell find $(SRC_DIR) $(TESTLIBRARY_DIR)/share/classes -name '*.java')
+WB_SRC_FILES = $(shell find $(TESTLIBRARY_DIR)/sun/hotspot -name '*.java')
 
 MAIN_CLASS = sun.hotspot.tools.ctw.CompileTheWorld
 
@@ -52,22 +53,29 @@
 	@rm -rf ctw.jar wb.jar
 
 cleantmp:
-	@rm -rf filelist manifest.mf
+	@rm -rf filelist wb_filelist manifest.mf
 	@rm -rf $(BUILD_DIR)
 
-ctw.jar: filelist wb.jar manifest.mf
+ctw.jar: filelist wb.jar
 	@mkdir -p $(OUTPUT_DIR)
-	$(JAVAC) -sourcepath $(SRC_DIR) -d $(OUTPUT_DIR) -cp wb.jar @filelist
-	$(JAR) cfm ctw.jar manifest.mf -C $(OUTPUT_DIR) .
+	$(JAVAC) -XaddExports:java.base/jdk.internal.jimage=ALL-UNNAMED \
+		-XaddExports:java.base/jdk.internal.misc=ALL-UNNAMED \
+		-XaddExports:java.base/jdk.internal.reflect=ALL-UNNAMED \
+		-sourcepath $(SRC_DIR) -d $(OUTPUT_DIR) -cp wb.jar @filelist
+	$(JAR) --create --file=$@ --main-class $(MAIN_CLASS) -C $(OUTPUT_DIR) .
 
-wb.jar: 
-	make -C ${WHITEBOX_DIR} wb.jar
-	cp ${WHITEBOX_DIR}/wb.jar ./
-	make -C ${WHITEBOX_DIR} clean
+wb.jar: wb_filelist
+	@mkdir -p $(OUTPUT_DIR)
+	$(JAVAC)  -sourcepath $(TESTLIBRARY_DIR) \
+		-d $(OUTPUT_DIR) \
+		-cp $(OUTPUT_DIR) \
+		@wb_filelist
+	$(JAR) --create --file=$@ -C $(OUTPUT_DIR) .
+
+wb_filelist: $(WB_SRC_FILES)
+	@rm -f $@
+	@echo $(WB_SRC_FILES) > $@
 
 filelist: $(SRC_FILES)
 	@rm -f $@
 	@echo $(SRC_FILES) > $@
-
-manifest.mf:
-	@echo "Main-Class: ${MAIN_CLASS}" > manifest.mf
diff --git a/hotspot/test/testlibrary/ctw/src/sun/hotspot/tools/ctw/ClassPathDirEntry.java b/hotspot/test/testlibrary/ctw/src/sun/hotspot/tools/ctw/ClassPathDirEntry.java
index b1e8fe2..bafe2dd 100644
--- a/hotspot/test/testlibrary/ctw/src/sun/hotspot/tools/ctw/ClassPathDirEntry.java
+++ b/hotspot/test/testlibrary/ctw/src/sun/hotspot/tools/ctw/ClassPathDirEntry.java
@@ -54,7 +54,7 @@
 
     @Override
     public void process() {
-        System.out.println("# dir: " + root);
+        CompileTheWorld.OUT.println("# dir: " + root);
         if (!Files.exists(root)) {
             return;
         }
diff --git a/hotspot/test/testlibrary/ctw/src/sun/hotspot/tools/ctw/ClassPathJarEntry.java b/hotspot/test/testlibrary/ctw/src/sun/hotspot/tools/ctw/ClassPathJarEntry.java
index a639a63..bf72bc6 100644
--- a/hotspot/test/testlibrary/ctw/src/sun/hotspot/tools/ctw/ClassPathJarEntry.java
+++ b/hotspot/test/testlibrary/ctw/src/sun/hotspot/tools/ctw/ClassPathJarEntry.java
@@ -50,7 +50,7 @@
 
     @Override
     public void process() {
-        System.out.println("# jar: " + root);
+        CompileTheWorld.OUT.println("# jar: " + root);
         if (!Files.exists(root)) {
             return;
         }
diff --git a/hotspot/test/testlibrary/ctw/src/sun/hotspot/tools/ctw/ClassPathJarInDirEntry.java b/hotspot/test/testlibrary/ctw/src/sun/hotspot/tools/ctw/ClassPathJarInDirEntry.java
index a9f7c8a..c9bdcb1 100644
--- a/hotspot/test/testlibrary/ctw/src/sun/hotspot/tools/ctw/ClassPathJarInDirEntry.java
+++ b/hotspot/test/testlibrary/ctw/src/sun/hotspot/tools/ctw/ClassPathJarInDirEntry.java
@@ -40,7 +40,7 @@
 
     @Override
     public void process() {
-        System.out.println("# jar_in_dir: " + root);
+        CompileTheWorld.OUT.println("# jar_in_dir: " + root);
         if (!Files.exists(root)) {
             return;
         }
diff --git a/hotspot/test/testlibrary/ctw/src/sun/hotspot/tools/ctw/ClassPathJimageEntry.java b/hotspot/test/testlibrary/ctw/src/sun/hotspot/tools/ctw/ClassPathJimageEntry.java
new file mode 100644
index 0000000..7043e4b
--- /dev/null
+++ b/hotspot/test/testlibrary/ctw/src/sun/hotspot/tools/ctw/ClassPathJimageEntry.java
@@ -0,0 +1,68 @@
+/*
+ * 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 sun.hotspot.tools.ctw;
+
+import jdk.internal.jimage.ImageReader;
+
+import java.io.IOException;
+import java.net.MalformedURLException;
+import java.net.URL;
+import java.net.URLClassLoader;
+import java.nio.file.Files;
+import java.nio.file.Path;
+import java.util.Arrays;
+import java.util.concurrent.Executor;
+
+/**
+ * Handler for jimage-files containing classes to compile.
+ */
+public class ClassPathJimageEntry extends PathHandler {
+    public ClassPathJimageEntry(Path root, Executor executor) {
+        super(root, executor);
+        try {
+            URL url = root.toUri().toURL();
+            setLoader(new URLClassLoader(new URL[]{url}));
+        } catch (MalformedURLException e) {
+            e.printStackTrace();
+        }
+    }
+
+    @Override
+    public void process() {
+        CompileTheWorld.OUT.println("# jimage: " + root);
+        if (!Files.exists(root)) {
+            return;
+        }
+        try {
+            ImageReader reader = ImageReader.open(root);
+            Arrays.stream(reader.getEntryNames())
+                    .filter(name -> name.endsWith(".class"))
+                    .filter(name -> !name.endsWith("module-info.class"))
+                    .map(Utils::fileNameToClassName)
+                    .forEach(this::processClass);
+        } catch (IOException ioe) {
+            ioe.printStackTrace();
+        }
+    }
+}
diff --git a/hotspot/test/testlibrary/ctw/src/sun/hotspot/tools/ctw/ClassesListInFile.java b/hotspot/test/testlibrary/ctw/src/sun/hotspot/tools/ctw/ClassesListInFile.java
index d25364ad..7c810dd 100644
--- a/hotspot/test/testlibrary/ctw/src/sun/hotspot/tools/ctw/ClassesListInFile.java
+++ b/hotspot/test/testlibrary/ctw/src/sun/hotspot/tools/ctw/ClassesListInFile.java
@@ -40,7 +40,7 @@
 
     @Override
     public void process() {
-        System.out.println("# list: " + root);
+        CompileTheWorld.OUT.println("# list: " + root);
         if (!Files.exists(root)) {
             return;
         }
diff --git a/hotspot/test/testlibrary/ctw/src/sun/hotspot/tools/ctw/CompileTheWorld.java b/hotspot/test/testlibrary/ctw/src/sun/hotspot/tools/ctw/CompileTheWorld.java
index b398ea1..88a94f6 100644
--- a/hotspot/test/testlibrary/ctw/src/sun/hotspot/tools/ctw/CompileTheWorld.java
+++ b/hotspot/test/testlibrary/ctw/src/sun/hotspot/tools/ctw/CompileTheWorld.java
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2013, 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2013, 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
@@ -33,14 +33,20 @@
 import java.util.concurrent.*;
 
 public class CompileTheWorld {
+    // in case when a static constructor changes System::out and System::err
+    // we hold these values of output streams
+    static PrintStream OUT = System.out;
+    static final PrintStream ERR = System.err;
     /**
-     * Entry point. Compiles classes in {@code args}, or all classes in
-     * boot-classpath if args is empty
+     * Entry point. Compiles classes in {@code paths}
      *
-     * @param args paths to jar/zip, dir contains classes, or to .lst file
-     *             contains list of classes to compile
+     * @param paths paths to jar/zip, dir contains classes, or to .lst file
+     *              contains list of classes to compile
      */
-    public static void main(String[] args) {
+    public static void main(String[] paths) {
+        if (paths.length == 0) {
+            throw new IllegalArgumentException("Expect a path to a compile target.");
+        }
         String logfile = Utils.LOG_FILE;
         PrintStream os = null;
         if (logfile != null) {
@@ -50,7 +56,7 @@
             }
         }
         if (os != null) {
-            System.setOut(os);
+            OUT = os;
         }
 
         try {
@@ -62,12 +68,6 @@
             } catch (java.lang.NoClassDefFoundError e) {
                 // compact1, compact2 support
             }
-            String[] paths = args;
-            boolean skipRtJar = false;
-            if (args.length == 0) {
-                paths = getDefaultPaths();
-                skipRtJar = true;
-            }
             ExecutorService executor = createExecutor();
             long start = System.currentTimeMillis();
             try {
@@ -75,17 +75,13 @@
                 for (int i = 0, n = paths.length; i < n
                         && !PathHandler.isFinished(); ++i) {
                     path = paths[i];
-                    if (skipRtJar && i > 0 && isRtJar(path)) {
-                        // rt.jar is not first, so skip it
-                        continue;
-                    }
                     PathHandler.create(path, executor).process();
                 }
             } finally {
                 await(executor);
             }
-            System.out.printf("Done (%d classes, %d methods, %d ms)%n",
-                    Compiler.getClassCount(),
+            CompileTheWorld.OUT.printf("Done (%d classes, %d methods, %d ms)%n",
+                    PathHandler.getClassCount(),
                     Compiler.getMethodCount(),
                     System.currentTimeMillis() - start);
         } finally {
@@ -111,13 +107,6 @@
         return result;
     }
 
-    private static String[] getDefaultPaths() {
-        String property = System.getProperty("sun.boot.class.path");
-        System.out.println(
-                "# use 'sun.boot.class.path' as args: " + property);
-        return Utils.PATH_SEPARATOR.split(property);
-    }
-
     private static void await(ExecutorService executor) {
         executor.shutdown();
         while (!executor.isTerminated()) {
@@ -130,10 +119,6 @@
         }
     }
 
-    private static boolean isRtJar(String path) {
-        return Utils.endsWithIgnoreCase(path, File.separator + "rt.jar");
-    }
-
     private static class CurrentThreadExecutor extends AbstractExecutorService {
         private boolean isShutdown;
 
diff --git a/hotspot/test/testlibrary/ctw/src/sun/hotspot/tools/ctw/Compiler.java b/hotspot/test/testlibrary/ctw/src/sun/hotspot/tools/ctw/Compiler.java
index 96b627a..e546f2e 100644
--- a/hotspot/test/testlibrary/ctw/src/sun/hotspot/tools/ctw/Compiler.java
+++ b/hotspot/test/testlibrary/ctw/src/sun/hotspot/tools/ctw/Compiler.java
@@ -26,7 +26,6 @@
 import sun.hotspot.WhiteBox;
 import jdk.internal.misc.SharedSecrets;
 import jdk.internal.reflect.ConstantPool;
-
 import java.lang.reflect.Executable;
 
 import java.util.Objects;
@@ -38,18 +37,11 @@
  * Also contains compiled methods and classes counters.
  */
 public class Compiler {
-    private Compiler() { }
-    private static final WhiteBox WHITE_BOX = WhiteBox.getWhiteBox();
-    private static final AtomicLong CLASS_COUNT = new AtomicLong(0L);
-    private static final AtomicLong METHOD_COUNT = new AtomicLong(0L);
-    private static volatile boolean CLASSES_LIMIT_REACHED = false;
 
-    /**
-     * @return count of processed classes
-     */
-    public static long getClassCount() {
-        return CLASS_COUNT.get();
-    }
+    private static final WhiteBox WHITE_BOX = WhiteBox.getWhiteBox();
+    private static final AtomicLong METHOD_COUNT = new AtomicLong(0L);
+
+    private Compiler() { }
 
     /**
      * @return count of processed methods
@@ -59,58 +51,46 @@
     }
 
     /**
-     * @return {@code true} if classes limit is reached
-     */
-    public static boolean isLimitReached() {
-        return CLASSES_LIMIT_REACHED;
-    }
-
-    /**
      * Compiles all methods and constructors.
      *
      * @param aClass class to compile
+     * @param id an id of the class
      * @param executor executor used for compile task invocation
      * @throws NullPointerException if {@code class} or {@code executor}
      *                              is {@code null}
      */
-    public static void compileClass(Class aClass, Executor executor) {
+    public static void compileClass(Class<?> aClass, long id, Executor executor) {
         Objects.requireNonNull(aClass);
         Objects.requireNonNull(executor);
-        long id = CLASS_COUNT.incrementAndGet();
-        if (id > Utils.COMPILE_THE_WORLD_STOP_AT) {
-            CLASS_COUNT.decrementAndGet();
-            CLASSES_LIMIT_REACHED = true;
-            return;
-        }
-
-        if (id >= Utils.COMPILE_THE_WORLD_START_AT) {
-            String name = aClass.getName();
-            try {
-                System.out.printf("[%d]\t%s%n", id, name);
-                ConstantPool constantPool = SharedSecrets.getJavaLangAccess().
-                        getConstantPool(aClass);
-                if (Utils.COMPILE_THE_WORLD_PRELOAD_CLASSES) {
-                    preloadClasses(name, id, constantPool);
-                }
-                long methodCount = 0;
-                for (Executable e : aClass.getDeclaredConstructors()) {
-                    ++methodCount;
-                    executor.execute(new CompileMethodCommand(id, name, e));
-                }
-                for (Executable e : aClass.getDeclaredMethods()) {
-                    ++methodCount;
-                    executor.execute(new CompileMethodCommand(id, name, e));
-                }
-                METHOD_COUNT.addAndGet(methodCount);
-
-                if (Utils.DEOPTIMIZE_ALL_CLASSES_RATE > 0
-                        && (id % Utils.DEOPTIMIZE_ALL_CLASSES_RATE == 0)) {
-                    WHITE_BOX.deoptimizeAll();
-                }
-            } catch (Throwable t) {
-                System.out.printf("[%d]\t%s\tskipping %s%n", id, name, t);
-                t.printStackTrace();
+        try {
+            ConstantPool constantPool = SharedSecrets.getJavaLangAccess().
+                    getConstantPool(aClass);
+            if (Utils.COMPILE_THE_WORLD_PRELOAD_CLASSES) {
+                preloadClasses(aClass.getName(), id, constantPool);
             }
+            int startLevel = Utils.INITIAL_COMP_LEVEL;
+            int endLevel = Utils.TIERED_COMPILATION ? Utils.TIERED_STOP_AT_LEVEL : startLevel;
+            for (int i = startLevel; i <= endLevel; ++i) {
+                WHITE_BOX.enqueueInitializerForCompilation(aClass, i);
+            }
+            long methodCount = 0;
+            for (Executable e : aClass.getDeclaredConstructors()) {
+                ++methodCount;
+                executor.execute(new CompileMethodCommand(id, e));
+            }
+            for (Executable e : aClass.getDeclaredMethods()) {
+                ++methodCount;
+                executor.execute(new CompileMethodCommand(id, e));
+            }
+            METHOD_COUNT.addAndGet(methodCount);
+
+            if (Utils.DEOPTIMIZE_ALL_CLASSES_RATE > 0
+                    && (id % Utils.DEOPTIMIZE_ALL_CLASSES_RATE == 0)) {
+                WHITE_BOX.deoptimizeAll();
+            }
+        } catch (Throwable t) {
+            CompileTheWorld.OUT.printf("[%d]\t%s\tskipping %s%n", id, aClass.getName(), t);
+            t.printStackTrace();
         }
     }
 
@@ -124,8 +104,8 @@
                 }
             }
         } catch (Throwable t) {
-            System.out.printf("[%d]\t%s\tpreloading failed : %s%n", id,
-                    className, t);
+            CompileTheWorld.OUT.printf("[%d]\t%s\tpreloading failed : %s%n",
+                    id, className, t);
         }
     }
 
@@ -142,13 +122,11 @@
 
         /**
          * @param classId   id of class
-         * @param className name of class
          * @param method    compiled for compilation
          */
-        public CompileMethodCommand(long classId, String className,
-                Executable method) {
+        public CompileMethodCommand(long classId, Executable method) {
             this.classId = classId;
-            this.className = className;
+            this.className = method.getDeclaringClass().getName();
             this.method = method;
         }
 
@@ -158,10 +136,10 @@
             if (Utils.TIERED_COMPILATION) {
                 for (int i = compLevel; i <= Utils.TIERED_STOP_AT_LEVEL; ++i) {
                     WHITE_BOX.deoptimizeMethod(method);
-                    compileMethod(method, i);
+                    compileAtLevel(i);
                 }
             } else {
-                compileMethod(method, compLevel);
+                compileAtLevel(compLevel);
             }
         }
 
@@ -183,29 +161,29 @@
             }
         }
 
-        private void compileMethod(Executable method, int compLevel) {
+        private void compileAtLevel(int compLevel) {
             if (WHITE_BOX.isMethodCompilable(method, compLevel)) {
                 try {
                     WHITE_BOX.enqueueMethodForCompilation(method, compLevel);
                     waitCompilation();
                     int tmp = WHITE_BOX.getMethodCompilationLevel(method);
                     if (tmp != compLevel) {
-                        logMethod(method, "compilation level = " + tmp
+                        log("compilation level = " + tmp
                                 + ", but not " + compLevel);
                     } else if (Utils.IS_VERBOSE) {
-                        logMethod(method, "compilation level = " + tmp + ". OK");
+                        log("compilation level = " + tmp + ". OK");
                     }
                 } catch (Throwable t) {
-                    logMethod(method, "error on compile at " + compLevel
+                    log("error on compile at " + compLevel
                             + " level");
                     t.printStackTrace();
                 }
             } else if (Utils.IS_VERBOSE) {
-                logMethod(method, "not compilable at " + compLevel);
+                log("not compilable at " + compLevel);
             }
         }
 
-        private void logMethod(Executable method, String message) {
+        private void log(String message) {
             StringBuilder builder = new StringBuilder("[");
             builder.append(classId);
             builder.append("]\t");
@@ -226,7 +204,7 @@
                 builder.append('\t');
                 builder.append(message);
             }
-            System.err.println(builder);
+            CompileTheWorld.ERR.println(builder);
         }
     }
 
diff --git a/hotspot/test/testlibrary/ctw/src/sun/hotspot/tools/ctw/PathHandler.java b/hotspot/test/testlibrary/ctw/src/sun/hotspot/tools/ctw/PathHandler.java
index 04b23e7..a8e1491 100644
--- a/hotspot/test/testlibrary/ctw/src/sun/hotspot/tools/ctw/PathHandler.java
+++ b/hotspot/test/testlibrary/ctw/src/sun/hotspot/tools/ctw/PathHandler.java
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2013, 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
@@ -23,21 +23,25 @@
 
 package sun.hotspot.tools.ctw;
 
+import jdk.internal.misc.Unsafe;
+
 import java.nio.file.Files;
 import java.nio.file.Path;
 import java.nio.file.Paths;
-import java.io.File;
-
 import java.util.Objects;
-import java.util.regex.Pattern;
-import java.util.regex.Matcher;
 import java.util.concurrent.Executor;
+import java.util.concurrent.atomic.AtomicLong;
+import java.util.regex.Matcher;
+import java.util.regex.Pattern;
 
 /**
  * Abstract handler for path.
  * Concrete subclasses should implement method {@link #process()}.
  */
 public abstract class PathHandler {
+    private static final Unsafe UNSAFE = jdk.test.lib.Utils.getUnsafe();
+    private static final AtomicLong CLASS_COUNT = new AtomicLong(0L);
+    private static volatile boolean CLASSES_LIMIT_REACHED = false;
     private static final Pattern JAR_IN_DIR_PATTERN
             = Pattern.compile("^(.*[/\\\\])?\\*$");
     protected final Path root;
@@ -81,6 +85,8 @@
                 return new ClassPathJarEntry(p, executor);
             } else if (isListFile(p)) {
                 return new ClassesListInFile(p, executor);
+            } else if (isJimageFile(p)) {
+                return new ClassPathJimageEntry(p, executor);
             } else {
                 return new ClassPathDirEntry(p, executor);
             }
@@ -96,6 +102,13 @@
         return false;
     }
 
+    private static boolean isJimageFile(Path path) {
+        String filename = path.getFileName().toString();
+        return Files.isRegularFile(path)
+                && ("modules".equals(filename)
+                || Utils.endsWithIgnoreCase(filename, ".jimage"));
+    }
+
     private static boolean isListFile(Path path) {
         if (Files.isRegularFile(path)) {
             String name = path.toString();
@@ -122,24 +135,54 @@
     }
 
     /**
-     * Processes specificed class.
+     * Processes specified class.
      * @param name fully qualified name of class to process
      */
     protected final void processClass(String name) {
-        try {
-            Class aClass = Class.forName(name, true, loader);
-            Compiler.compileClass(aClass, executor);
-        } catch (ClassNotFoundException | LinkageError e) {
-            System.out.printf("Class %s loading failed : %s%n", name,
-                e.getMessage());
+        Objects.requireNonNull(name);
+        if (CLASSES_LIMIT_REACHED) {
+            return;
+        }
+        long id = CLASS_COUNT.incrementAndGet();
+        if (id > Utils.COMPILE_THE_WORLD_STOP_AT) {
+            CLASSES_LIMIT_REACHED = true;
+            return;
+        }
+        if (id >= Utils.COMPILE_THE_WORLD_START_AT) {
+            try {
+                Class<?> aClass = loader.loadClass(name);
+                if (name != "sun.reflect.misc.Trampoline"
+                        && name != "sun.tools.jconsole.OutputViewer") { // workaround for JDK-8159155
+                    UNSAFE.ensureClassInitialized(aClass);
+                }
+                CompileTheWorld.OUT.printf("[%d]\t%s%n", id, name);
+                Compiler.compileClass(aClass, id, executor);
+            } catch (ClassNotFoundException e) {
+                CompileTheWorld.OUT.printf("Class %s loading failed : %s%n",
+                        name, e.getMessage());
+            }
         }
     }
 
     /**
-     * @return {@code true} if processing should be stopped
+     * @return count of processed classes
+     */
+    public static long getClassCount() {
+        long id = CLASS_COUNT.get();
+        if (id < Utils.COMPILE_THE_WORLD_START_AT) {
+            return 0;
+        }
+        if (id > Utils.COMPILE_THE_WORLD_STOP_AT) {
+            return Utils.COMPILE_THE_WORLD_STOP_AT - Utils.COMPILE_THE_WORLD_START_AT + 1;
+        }
+        return id - Utils.COMPILE_THE_WORLD_START_AT + 1;
+    }
+
+    /**
+     * @return {@code true} if classes limit is reached and processing should be stopped
      */
     public static boolean isFinished() {
-        return Compiler.isLimitReached();
+        return CLASSES_LIMIT_REACHED;
     }
 
 }
diff --git a/hotspot/test/testlibrary/ctw/src/sun/hotspot/tools/ctw/Utils.java b/hotspot/test/testlibrary/ctw/src/sun/hotspot/tools/ctw/Utils.java
index 4e98bd8..4159c48 100644
--- a/hotspot/test/testlibrary/ctw/src/sun/hotspot/tools/ctw/Utils.java
+++ b/hotspot/test/testlibrary/ctw/src/sun/hotspot/tools/ctw/Utils.java
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2013, 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2013, 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
@@ -207,7 +207,12 @@
      */
     public static String fileNameToClassName(String filename) {
         assert isClassFile(filename);
-        return filename.substring(0, filename.length() - CLASSFILE_EXT.length())
-                       .replace(File.separatorChar, '.');
+        // workaround for the class naming in jimage : /<module>/<class_name>
+        final char nameSeparator = '/';
+        int nameStart = filename.charAt(0) == nameSeparator
+                ? filename.indexOf(nameSeparator, 1) + 1
+                : 0;
+        return filename.substring(nameStart, filename.length() - CLASSFILE_EXT.length())
+                       .replace(nameSeparator, '.');
     }
 }
diff --git a/hotspot/test/testlibrary/jdk/test/lib/Platform.java b/hotspot/test/testlibrary/jdk/test/lib/Platform.java
index 6477322..d090663 100644
--- a/hotspot/test/testlibrary/jdk/test/lib/Platform.java
+++ b/hotspot/test/testlibrary/jdk/test/lib/Platform.java
@@ -31,12 +31,13 @@
  */
 @Deprecated
 public class Platform {
+    public  static final String vmName      = System.getProperty("java.vm.name");
+    public  static final String vmInfo      = System.getProperty("java.vm.info");
     private static final String osName      = System.getProperty("os.name");
     private static final String dataModel   = System.getProperty("sun.arch.data.model");
     private static final String vmVersion   = System.getProperty("java.vm.version");
     private static final String jdkDebug    = System.getProperty("jdk.debug");
     private static final String osArch      = System.getProperty("os.arch");
-    private static final String vmName      = System.getProperty("java.vm.name");
     private static final String userName    = System.getProperty("user.name");
     private static final String compiler    = System.getProperty("sun.management.compiler");
 
@@ -60,14 +61,22 @@
         return vmName.endsWith(" Minimal VM");
     }
 
-    public static boolean isEmbedded() {
-        return vmName.contains("Embedded");
-    }
-
     public static boolean isTieredSupported() {
         return compiler.contains("Tiered Compilers");
     }
 
+    public static boolean isInt() {
+        return vmInfo.contains("interpreted");
+    }
+
+    public static boolean isMixed() {
+        return vmInfo.contains("mixed");
+    }
+
+    public static boolean isComp() {
+        return vmInfo.contains("compiled");
+    }
+
     public static boolean is32bit() {
         return dataModel.equals("32");
     }
diff --git a/hotspot/test/testlibrary/jdk/test/lib/Utils.java b/hotspot/test/testlibrary/jdk/test/lib/Utils.java
index 8ad11fd..6925f73 100644
--- a/hotspot/test/testlibrary/jdk/test/lib/Utils.java
+++ b/hotspot/test/testlibrary/jdk/test/lib/Utils.java
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2013, 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2013, 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
@@ -317,8 +317,8 @@
             output = ProcessTools.executeProcess(jcmdLauncher.getCommand());
             output.shouldHaveExitValue(0);
 
-            // Search for a line starting with numbers (pid), follwed by the key.
-            Pattern pattern = Pattern.compile("([0-9]+)\\s.*(" + key + ").*\\r?\\n");
+            // Search for a line starting with numbers (pid), followed by the key.
+            Pattern pattern = Pattern.compile("^([0-9]+)\\s.*(" + key + ")", Pattern.MULTILINE);
             Matcher matcher = pattern.matcher(output.getStdout());
 
             int pid = -1;
diff --git a/hotspot/test/testlibrary/jittester/src/jdk/test/lib/jittester/Automatic.java b/hotspot/test/testlibrary/jittester/src/jdk/test/lib/jittester/Automatic.java
index ee81bcf..334911c 100644
--- a/hotspot/test/testlibrary/jittester/src/jdk/test/lib/jittester/Automatic.java
+++ b/hotspot/test/testlibrary/jittester/src/jdk/test/lib/jittester/Automatic.java
@@ -120,16 +120,30 @@
             String name = "Test_" + counter;
             Pair<IRNode, IRNode> irTree = generateIRTree(name);
             System.out.printf(" %8d |", counter);
+            long maxWaitTime = TimeUnit.MINUTES.toMillis(MINUTES_TO_WAIT);
             double generationTime = System.currentTimeMillis() - start;
             System.out.printf(" %8.0f |", generationTime);
             start = System.currentTimeMillis();
-            for (TestsGenerator generator : generators) {
-                generator.accept(irTree.first, irTree.second);
+            Thread generatorThread = new Thread(() -> {
+                for (TestsGenerator generator : generators) {
+                        generator.accept(irTree.first, irTree.second);
+                }
+            });
+            generatorThread.start();
+            try {
+                generatorThread.join(maxWaitTime);
+            } catch (InterruptedException ie) {
+                throw new Error("Test generation interrupted: " + ie, ie);
             }
-            double runningTime = System.currentTimeMillis() - start;
-            System.out.printf(" %8.0f |%n", runningTime);
-            if (runningTime < TimeUnit.MINUTES.toMillis(MINUTES_TO_WAIT)) {
-                ++counter;
+            if (generatorThread.isAlive()) {
+                // maxTime reached, so, proceed to next test generation
+                generatorThread.interrupt();
+            } else {
+                double runningTime = System.currentTimeMillis() - start;
+                System.out.printf(" %8.0f |%n", runningTime);
+                if (runningTime < maxWaitTime) {
+                    ++counter;
+                }
             }
         } while (counter < ProductionParams.numberOfTests.value());
     }
diff --git a/hotspot/test/testlibrary_tests/TestMutuallyExclusivePlatformPredicates.java b/hotspot/test/testlibrary_tests/TestMutuallyExclusivePlatformPredicates.java
index 4f20576..98cf13b 100644
--- a/hotspot/test/testlibrary_tests/TestMutuallyExclusivePlatformPredicates.java
+++ b/hotspot/test/testlibrary_tests/TestMutuallyExclusivePlatformPredicates.java
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2014, 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2014, 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
@@ -49,7 +49,8 @@
         BITNESS("is32bit", "is64bit"),
         OS("isAix", "isLinux", "isOSX", "isSolaris", "isWindows"),
         VM_TYPE("isClient", "isServer", "isGraal", "isMinimal", "isZero"),
-        IGNORED("isEmbedded", "isDebugBuild", "shouldSAAttach",
+        MODE("isInt", "isMixed", "isComp"),
+        IGNORED("isDebugBuild", "shouldSAAttach",
                 "canPtraceAttachLinux", "canAttachOSX", "isTieredSupported");
 
         public final List<String> methodNames;
diff --git a/hotspot/test/testlibrary_tests/ctw/ClassesDirTest.java b/hotspot/test/testlibrary_tests/ctw/ClassesDirTest.java
index a114366..eb29c5b 100644
--- a/hotspot/test/testlibrary_tests/ctw/ClassesDirTest.java
+++ b/hotspot/test/testlibrary_tests/ctw/ClassesDirTest.java
@@ -25,7 +25,8 @@
  * @test
  * @bug 8012447
  * @library /testlibrary /test/lib /testlibrary/ctw/src
- * @modules java.base/jdk.internal.misc
+ * @modules java.base/jdk.internal.jimage
+ *          java.base/jdk.internal.misc
  *          java.base/jdk.internal.reflect
  *          java.management
  * @build ClassFileInstaller sun.hotspot.tools.ctw.CompileTheWorld sun.hotspot.WhiteBox Foo Bar
diff --git a/hotspot/test/testlibrary_tests/ctw/ClassesListTest.java b/hotspot/test/testlibrary_tests/ctw/ClassesListTest.java
index f9feeaa..873180c 100644
--- a/hotspot/test/testlibrary_tests/ctw/ClassesListTest.java
+++ b/hotspot/test/testlibrary_tests/ctw/ClassesListTest.java
@@ -25,7 +25,8 @@
  * @test
  * @bug 8012447
  * @library /testlibrary /test/lib /testlibrary/ctw/src
- * @modules java.base/jdk.internal.misc
+ * @modules java.base/jdk.internal.jimage
+ *          java.base/jdk.internal.misc
  *          java.base/jdk.internal.reflect
  *          java.management
  * @build ClassFileInstaller sun.hotspot.tools.ctw.CompileTheWorld sun.hotspot.WhiteBox Foo Bar
diff --git a/hotspot/test/testlibrary_tests/ctw/JarDirTest.java b/hotspot/test/testlibrary_tests/ctw/JarDirTest.java
index 7bc97e6..57f12a6 100644
--- a/hotspot/test/testlibrary_tests/ctw/JarDirTest.java
+++ b/hotspot/test/testlibrary_tests/ctw/JarDirTest.java
@@ -25,7 +25,8 @@
  * @test
  * @bug 8012447
  * @library /testlibrary /test/lib /testlibrary/ctw/src
- * @modules java.base/jdk.internal.misc
+ * @modules java.base/jdk.internal.jimage
+ *          java.base/jdk.internal.misc
  *          java.base/jdk.internal.reflect
  *          java.compiler
  *          java.management
diff --git a/hotspot/test/testlibrary_tests/ctw/JarsTest.java b/hotspot/test/testlibrary_tests/ctw/JarsTest.java
index e357912..e9bc05c 100644
--- a/hotspot/test/testlibrary_tests/ctw/JarsTest.java
+++ b/hotspot/test/testlibrary_tests/ctw/JarsTest.java
@@ -25,7 +25,8 @@
  * @test
  * @bug 8012447
  * @library /testlibrary /test/lib /testlibrary/ctw/src
- * @modules java.base/jdk.internal.misc
+ * @modules java.base/jdk.internal.jimage
+ *          java.base/jdk.internal.misc
  *          java.base/jdk.internal.reflect
  *          java.compiler
  *          java.management
diff --git a/jaxp/.hgtags b/jaxp/.hgtags
index d974c63..ac9804a 100644
--- a/jaxp/.hgtags
+++ b/jaxp/.hgtags
@@ -372,3 +372,4 @@
 bdc3c0b737efbf899709eb3121ce760dcfb51151 jdk-9+127
 8a7681a9d70640ac7fbf05c28f53c1d51d8d00a1 jdk-9+128
 74241304e87b0d463391a8ecab40979b5af86dc2 jdk-9+129
+e66cdc2de6b02443911d386fc9217b0d824d0686 jdk-9+130
diff --git a/jaxp/src/java.xml/share/classes/javax/xml/xpath/XPathFactory.java b/jaxp/src/java.xml/share/classes/javax/xml/xpath/XPathFactory.java
index 05f7a4e..220e6ea 100644
--- a/jaxp/src/java.xml/share/classes/javax/xml/xpath/XPathFactory.java
+++ b/jaxp/src/java.xml/share/classes/javax/xml/xpath/XPathFactory.java
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2003, 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2003, 2016, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -93,14 +93,14 @@
     public static XPathFactory newInstance() {
 
         try {
-                return newInstance(DEFAULT_OBJECT_MODEL_URI);
-        } catch (XPathFactoryConfigurationException xpathFactoryConfigurationException) {
-                throw new RuntimeException(
-                        "XPathFactory#newInstance() failed to create an XPathFactory for the default object model: "
-                        + DEFAULT_OBJECT_MODEL_URI
-                        + " with the XPathFactoryConfigurationException: "
-                        + xpathFactoryConfigurationException.toString()
-                );
+            return newInstance(DEFAULT_OBJECT_MODEL_URI);
+        } catch (XPathFactoryConfigurationException e) {
+            throw new RuntimeException(
+                    "XPathFactory#newInstance() failed to create an XPathFactory for the default object model: "
+                    + DEFAULT_OBJECT_MODEL_URI
+                    + " with the XPathFactoryConfigurationException: "
+                    + e.getMessage(), e
+            );
         }
     }
 
diff --git a/jaxp/test/ProblemList.txt b/jaxp/test/ProblemList.txt
index 8489703..27337ae 100644
--- a/jaxp/test/ProblemList.txt
+++ b/jaxp/test/ProblemList.txt
@@ -27,4 +27,4 @@
 
 javax/xml/jaxp/unittest/common/TransformationWarningsTest.java	8150145 generic-all
 
-javax/xml/jaxp/unittest/stream/FactoryFindTest.java             8156508 generic-all
+javax/xml/jaxp/unittest/common/ValidationWarningsTest.java      8150145 generic-all
diff --git a/jaxp/test/TEST.ROOT b/jaxp/test/TEST.ROOT
index a90dc70..190bdf5 100644
--- a/jaxp/test/TEST.ROOT
+++ b/jaxp/test/TEST.ROOT
@@ -14,6 +14,11 @@
 # Tests that must run in othervm mode
 othervm.dirs=javax/xml/jaxp
 
+lib.dirs = /javax/xml/jaxp/libs
+
+# Declare module dependency
+modules=java.xml
+
 # Group definitions
 groups=TEST.groups
 
diff --git a/jaxp/test/javax/xml/jaxp/functional/TEST.properties b/jaxp/test/javax/xml/jaxp/functional/TEST.properties
deleted file mode 100644
index f94f3b9..0000000
--- a/jaxp/test/javax/xml/jaxp/functional/TEST.properties
+++ /dev/null
@@ -1,12 +0,0 @@
-# This file identifies root(s) of the test-ng hierarchy.
-
-TestNG.dirs = .
-
-lib.dirs = /javax/xml/jaxp/libs
-
-# Tests that must run in othervm mode
-othervm.dirs= /javax/xml/jaxp/functional
-
-# Declare module dependency
-modules=java.xml
-
diff --git a/jaxp/test/javax/xml/jaxp/functional/catalog/CatalogReferCircularityTest.java b/jaxp/test/javax/xml/jaxp/functional/catalog/CatalogReferCircularityTest.java
index 300b386..41eda62 100644
--- a/jaxp/test/javax/xml/jaxp/functional/catalog/CatalogReferCircularityTest.java
+++ b/jaxp/test/javax/xml/jaxp/functional/catalog/CatalogReferCircularityTest.java
@@ -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
@@ -28,17 +28,21 @@
 import javax.xml.catalog.CatalogException;
 
 import org.testng.annotations.DataProvider;
+import org.testng.annotations.Listeners;
 import org.testng.annotations.Test;
 
 /*
  * @test
  * @bug 8077931
+ * @library /javax/xml/jaxp/libs
+ * @run testng/othervm -DrunSecMngr=true catalog.CatalogReferCircularityTest
+ * @run testng/othervm catalog.CatalogReferCircularityTest
  * @summary Via nextCatalog entry, the catalog reference chain may be
  *          a (partial) closed circuit. For instance, a catalog may use itself
  *          as an additional catalog specified in its own nextCatalog entry.
  *          This case tests if the implementation handles this issue.
- * @compile ../../libs/catalog/CatalogTestUtils.java
  */
+@Listeners({jaxp.library.FilePolicy.class})
 public class CatalogReferCircularityTest {
 
     @Test(dataProvider = "catalogName",
@@ -49,7 +53,7 @@
     }
 
     @DataProvider(name = "catalogName")
-    private Object[][] catalogName() {
+    public Object[][] catalogName() {
         return new Object[][] {
                 // This catalog defines itself as next catalog.
                 { "catalogReferCircle-itself.xml" },
@@ -60,3 +64,4 @@
                 { "catalogReferCircle-left.xml" } };
     }
 }
+
diff --git a/jaxp/test/javax/xml/jaxp/functional/catalog/DefaultFeaturesTest.java b/jaxp/test/javax/xml/jaxp/functional/catalog/DefaultFeaturesTest.java
index 4aaf3e5..9a05145 100644
--- a/jaxp/test/javax/xml/jaxp/functional/catalog/DefaultFeaturesTest.java
+++ b/jaxp/test/javax/xml/jaxp/functional/catalog/DefaultFeaturesTest.java
@@ -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
@@ -29,13 +29,18 @@
 import org.testng.Assert;
 import org.testng.annotations.BeforeClass;
 import org.testng.annotations.DataProvider;
+import org.testng.annotations.Listeners;
 import org.testng.annotations.Test;
 
 /*
  * @test
  * @bug 8077931
+ * @library /javax/xml/jaxp/libs
+ * @run testng/othervm -DrunSecMngr=true catalog.DefaultFeaturesTest
+ * @run testng/othervm catalog.DefaultFeaturesTest
  * @summary This case tests if the default feature values are expected.
  */
+@Listeners({jaxp.library.FilePolicy.class})
 public class DefaultFeaturesTest {
 
     private CatalogFeatures defaultFeature;
@@ -56,7 +61,7 @@
     }
 
     @DataProvider(name = "feature-value")
-    private Object[][] data() {
+    public Object[][] data() {
         return new Object[][] {
                 { Feature.FILES, null },
                 { Feature.PREFER, CatalogTestUtils.PREFER_PUBLIC },
@@ -64,3 +69,4 @@
                 { Feature.RESOLVE, CatalogTestUtils.RESOLVE_STRICT } };
     }
 }
+
diff --git a/jaxp/test/javax/xml/jaxp/functional/catalog/DeferFeatureTest.java b/jaxp/test/javax/xml/jaxp/functional/catalog/DeferFeatureTest.java
index a0066a9..1f046f3 100644
--- a/jaxp/test/javax/xml/jaxp/functional/catalog/DeferFeatureTest.java
+++ b/jaxp/test/javax/xml/jaxp/functional/catalog/DeferFeatureTest.java
@@ -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
@@ -28,6 +28,8 @@
 import static catalog.CatalogTestUtils.getCatalogPath;
 import static javax.xml.catalog.CatalogFeatures.Feature.DEFER;
 import static javax.xml.catalog.CatalogManager.catalog;
+import static jaxp.library.JAXPTestUtilities.runWithAllPerm;
+import static jaxp.library.JAXPTestUtilities.tryRunWithAllPerm;
 
 import java.lang.reflect.Method;
 
@@ -36,16 +38,20 @@
 
 import org.testng.Assert;
 import org.testng.annotations.DataProvider;
+import org.testng.annotations.Listeners;
 import org.testng.annotations.Test;
 
 /*
  * @test
  * @bug 8077931
+ * @library /javax/xml/jaxp/libs
+ * @run testng/othervm -DrunSecMngr=true catalog.DeferFeatureTest
+ * @run testng/othervm catalog.DeferFeatureTest
  * @summary This case tests whether the catalogs specified in delegateSystem,
  *          delegatePublic, delegateURI and nextCatalog entries are used lazily
  *          in resolution via defer feature.
- * @compile ../../libs/catalog/CatalogTestUtils.java
  */
+@Listeners({jaxp.library.FilePolicy.class})
 public class DeferFeatureTest {
 
     @Test(dataProvider = "catalog-countOfLoadedCatalogFile")
@@ -55,7 +61,7 @@
     }
 
     @DataProvider(name = "catalog-countOfLoadedCatalogFile")
-    private Object[][] data() {
+    public Object[][] data() {
         return new Object[][]{
             // By default, alternative catalogs are not loaded.
             {createCatalog(CatalogFeatures.defaults()), 0},
@@ -75,9 +81,9 @@
     }
 
     private int loadedCatalogCount(Catalog catalog) throws Exception {
-        Method method = catalog.getClass().getDeclaredMethod(
-                "loadedCatalogCount");
-        method.setAccessible(true);
+        Method method = tryRunWithAllPerm(() -> catalog.getClass().getDeclaredMethod("loadedCatalogCount"));
+        runWithAllPerm(() -> method.setAccessible(true));
         return (int) method.invoke(catalog);
     }
 }
+
diff --git a/jaxp/test/javax/xml/jaxp/functional/catalog/DelegatePublicTest.java b/jaxp/test/javax/xml/jaxp/functional/catalog/DelegatePublicTest.java
index 931c66c..e89c820 100644
--- a/jaxp/test/javax/xml/jaxp/functional/catalog/DelegatePublicTest.java
+++ b/jaxp/test/javax/xml/jaxp/functional/catalog/DelegatePublicTest.java
@@ -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
@@ -31,15 +31,18 @@
 import javax.xml.catalog.CatalogResolver;
 
 import org.testng.annotations.DataProvider;
+import org.testng.annotations.Listeners;
 import org.testng.annotations.Test;
 
 /*
  * @test
  * @bug 8077931
+ * @library /javax/xml/jaxp/libs
+ * @run testng/othervm -DrunSecMngr=true catalog.DelegatePublicTest
+ * @run testng/othervm catalog.DelegatePublicTest
  * @summary Get matched URIs from DelegatePublic entries.
- * @compile ../../libs/catalog/CatalogTestUtils.java
- * @compile ../../libs/catalog/ResolutionChecker.java
  */
+@Listeners({jaxp.library.FilePolicy.class})
 public class DelegatePublicTest {
 
     @Test(dataProvider = "publicId-matchedUri")
@@ -48,7 +51,7 @@
     }
 
     @DataProvider(name = "publicId-matchedUri")
-    private Object[][] dataOnMatch() {
+    public Object[][] dataOnMatch() {
         return new Object[][] {
                 // The matched URI of the specified public id is defined in
                 // a delegate catalog file of the current catalog file.
@@ -79,7 +82,7 @@
     }
 
     @DataProvider(name = "publicId-expectedExceptionClass")
-    private Object[][] dataOnException() {
+    public Object[][] dataOnException() {
         return new Object[][] {
                 // The matched delegatePublic entry of the specified public id
                 // defines a non-existing delegate catalog file. That should
@@ -97,3 +100,4 @@
         return catalogResolver("delegatePublic.xml");
     }
 }
+
diff --git a/jaxp/test/javax/xml/jaxp/functional/catalog/DelegateSystemTest.java b/jaxp/test/javax/xml/jaxp/functional/catalog/DelegateSystemTest.java
index c4191f4..f18b6c2 100644
--- a/jaxp/test/javax/xml/jaxp/functional/catalog/DelegateSystemTest.java
+++ b/jaxp/test/javax/xml/jaxp/functional/catalog/DelegateSystemTest.java
@@ -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
@@ -31,15 +31,18 @@
 import javax.xml.catalog.CatalogResolver;
 
 import org.testng.annotations.DataProvider;
+import org.testng.annotations.Listeners;
 import org.testng.annotations.Test;
 
 /*
  * @test
  * @bug 8077931
+ * @library /javax/xml/jaxp/libs
+ * @run testng/othervm -DrunSecMngr=true catalog.DelegateSystemTest
+ * @run testng/othervm catalog.DelegateSystemTest
  * @summary Get matched URIs from delegateSystem entries.
- * @compile ../../libs/catalog/CatalogTestUtils.java
- * @compile ../../libs/catalog/ResolutionChecker.java
  */
+@Listeners({jaxp.library.FilePolicy.class})
 public class DelegateSystemTest {
 
     @Test(dataProvider = "systemId-matchedUri")
@@ -48,7 +51,7 @@
     }
 
     @DataProvider(name = "systemId-matchedUri")
-    private Object[][] dataOnMatch() {
+    public Object[][] dataOnMatch() {
         return new Object[][] {
                 // The matched URI of the specified system id is defined in
                 // a delegate catalog file of the current catalog file.
@@ -79,7 +82,7 @@
     }
 
     @DataProvider(name = "systemId-expectedExceptionClass")
-    private Object[][] dataOnException() {
+    public Object[][] dataOnException() {
         return new Object[][] {
                 // The matched delegateSystem entry of the specified system id
                 // defines a non-existing delegate catalog file. That should
@@ -97,3 +100,4 @@
         return catalogResolver("delegateSystem.xml");
     }
 }
+
diff --git a/jaxp/test/javax/xml/jaxp/functional/catalog/DelegateUriTest.java b/jaxp/test/javax/xml/jaxp/functional/catalog/DelegateUriTest.java
index 956df3a..44addf5 100644
--- a/jaxp/test/javax/xml/jaxp/functional/catalog/DelegateUriTest.java
+++ b/jaxp/test/javax/xml/jaxp/functional/catalog/DelegateUriTest.java
@@ -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
@@ -31,15 +31,18 @@
 import javax.xml.catalog.CatalogUriResolver;
 
 import org.testng.annotations.DataProvider;
+import org.testng.annotations.Listeners;
 import org.testng.annotations.Test;
 
 /*
  * @test
  * @bug 8077931
+ * @library /javax/xml/jaxp/libs
+ * @run testng/othervm -DrunSecMngr=true catalog.DelegateUriTest
+ * @run testng/othervm catalog.DelegateUriTest
  * @summary Get matched URIs from delegateURI entries.
- * @compile ../../libs/catalog/CatalogTestUtils.java
- * @compile ../../libs/catalog/ResolutionChecker.java
  */
+@Listeners({jaxp.library.FilePolicy.class})
 public class DelegateUriTest {
 
     @Test(dataProvider = "uri-matchedUri")
@@ -48,7 +51,7 @@
     }
 
     @DataProvider(name = "uri-matchedUri")
-    private Object[][] data() {
+    public Object[][] data() {
         return new Object[][] {
                 // The matched URI of the specified URI reference is defined in
                 // a delegate catalog file of the current catalog file.
@@ -78,7 +81,7 @@
     }
 
     @DataProvider(name = "uri-expectedExceptionClass")
-    private Object[][] dataOnException() {
+    public Object[][] dataOnException() {
         return new Object[][] {
                 // The matched delegateURI entry of the specified URI reference
                 // defines a non-existing delegate catalog file. That should
@@ -96,3 +99,4 @@
         return catalogUriResolver("delegateUri.xml");
     }
 }
+
diff --git a/jaxp/test/javax/xml/jaxp/functional/catalog/GroupTest.java b/jaxp/test/javax/xml/jaxp/functional/catalog/GroupTest.java
index f73af230..fd27668 100644
--- a/jaxp/test/javax/xml/jaxp/functional/catalog/GroupTest.java
+++ b/jaxp/test/javax/xml/jaxp/functional/catalog/GroupTest.java
@@ -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
@@ -32,16 +32,19 @@
 import javax.xml.catalog.CatalogResolver;
 
 import org.testng.annotations.DataProvider;
+import org.testng.annotations.Listeners;
 import org.testng.annotations.Test;
 
 /*
  * @test
  * @bug 8077931
+ * @library /javax/xml/jaxp/libs
+ * @run testng/othervm -DrunSecMngr=true catalog.GroupTest
+ * @run testng/othervm catalog.GroupTest
  * @summary Get matched URIs from system, public and uri entries respectively,
  *          and some of the entries are enclosed by group entries.
- * @compile ../../libs/catalog/CatalogTestUtils.java
- * @compile ../../libs/catalog/ResolutionChecker.java
  */
+@Listeners({jaxp.library.FilePolicy.class})
 public class GroupTest {
 
     private static final String CATALOG_GROUP = "group.xml";
@@ -52,7 +55,7 @@
     }
 
     @DataProvider(name = "systemId-matchedUri")
-    private Object[][] dataOnSysId() {
+    public Object[][] dataOnSysId() {
         return new Object[][] {
                 // The matched URI of the specified system id is enclosed by a
                 // group entry.
@@ -78,7 +81,7 @@
     }
 
     @DataProvider(name = "publicId-matchedUri")
-    private Object[][] dataOnPubId() {
+    public Object[][] dataOnPubId() {
         return new Object[][] {
                 // The matched URI of the specified public id is enclosed by a
                 // group entry.
@@ -104,7 +107,7 @@
     }
 
     @DataProvider(name = "uri-matchedUri")
-    private Object[][] dataOnUri() {
+    public Object[][] dataOnUri() {
         return new Object[][] {
                 // The matched URI of the specified URI reference is enclosed by
                 // a group entry.
@@ -128,3 +131,4 @@
         return catalogResolver(CATALOG_GROUP);
     }
 }
+
diff --git a/jaxp/test/javax/xml/jaxp/functional/catalog/LoadCatalogTest.java b/jaxp/test/javax/xml/jaxp/functional/catalog/LoadCatalogTest.java
index d5a3734..b985876 100644
--- a/jaxp/test/javax/xml/jaxp/functional/catalog/LoadCatalogTest.java
+++ b/jaxp/test/javax/xml/jaxp/functional/catalog/LoadCatalogTest.java
@@ -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
@@ -36,17 +36,20 @@
 import javax.xml.catalog.CatalogUriResolver;
 
 import org.testng.annotations.DataProvider;
+import org.testng.annotations.Listeners;
 import org.testng.annotations.Test;
 
 /*
  * @test
  * @bug 8077931
+ * @library /javax/xml/jaxp/libs
+ * @run testng/othervm -DrunSecMngr=true catalog.LoadCatalogTest
+ * @run testng/othervm catalog.LoadCatalogTest
  * @summary When catalog resolver loads catalog files, the current catalog file
  *          and the catalog files specified by the nextCatalog entries may not
  *          accessible. This case tests how does the resolver handle this issue.
- * @compile ../../libs/catalog/CatalogTestUtils.java
- * @compile ../../libs/catalog/ResolutionChecker.java
  */
+@Listeners({jaxp.library.FilePolicy.class})
 public class LoadCatalogTest {
 
     private static final String CATALOG_LOADCATALOGFILES = "loadCatalogFiles.xml";
@@ -62,7 +65,7 @@
     }
 
     @DataProvider(name = "entityResolver")
-    private Object[][] entityResolver() {
+    public Object[][] entityResolver() {
         return new Object[][] {
                 // This EntityResolver loads multiple catalog files one by one.
                 // All of the files are available.
@@ -82,7 +85,7 @@
     }
 
     @DataProvider(name = "uriResolver")
-    private Object[][] uriResolver() {
+    public Object[][] uriResolver() {
         return new Object[][] {
                 // This URIResolver loads multiple catalog files one by one.
                 // All of the files are available.
@@ -108,7 +111,7 @@
     }
 
     @DataProvider(name = "catalogName")
-    private Object[][] catalogName() {
+    public Object[][] catalogName() {
         return new Object[][] {
                 // This catalog file set includes null catalog files.
                 { (String[]) null },
@@ -118,3 +121,4 @@
                 { new String[] { CATALOG_LOADCATALOGFILES } } };
     }
 }
+
diff --git a/jaxp/test/javax/xml/jaxp/functional/catalog/NextCatalogTest.java b/jaxp/test/javax/xml/jaxp/functional/catalog/NextCatalogTest.java
index 688a669..3f14dcd 100644
--- a/jaxp/test/javax/xml/jaxp/functional/catalog/NextCatalogTest.java
+++ b/jaxp/test/javax/xml/jaxp/functional/catalog/NextCatalogTest.java
@@ -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
@@ -33,16 +33,19 @@
 import javax.xml.catalog.CatalogUriResolver;
 
 import org.testng.annotations.DataProvider;
+import org.testng.annotations.Listeners;
 import org.testng.annotations.Test;
 
 /*
  * @test
  * @bug 8077931
+ * @library /javax/xml/jaxp/libs
+ * @run testng/othervm -DrunSecMngr=true catalog.NextCatalogTest
+ * @run testng/othervm catalog.NextCatalogTest
  * @summary Get matched URIs from system, public and uri entries respectively,
  *          but some of the entries are defined in none-current catalog files.
- * @compile ../../libs/catalog/CatalogTestUtils.java
- * @compile ../../libs/catalog/ResolutionChecker.java
  */
+@Listeners({jaxp.library.FilePolicy.class})
 public class NextCatalogTest {
 
     private static final String CATALOG_NEXTCATALOGLEFT
@@ -56,7 +59,7 @@
     }
 
     @DataProvider(name = "systemId-matchedUri")
-    private Object[][] dataOnSysId() {
+    public Object[][] dataOnSysId() {
         return new Object[][] {
                 // This matched URI of the specified system id is defined in a
                 // next catalog file.
@@ -88,7 +91,7 @@
     }
 
     @DataProvider(name = "publicId-matchedUri")
-    private Object[][] dataOnPubId() {
+    public Object[][] dataOnPubId() {
         return new Object[][] {
                 // This matched URI of the specified public id is defined in a
                 // next catalog file.
@@ -120,7 +123,7 @@
     }
 
     @DataProvider(name = "uri-matchedUri")
-    private Object[][] dataOnUri() {
+    public Object[][] dataOnUri() {
         return new Object[][] {
                 // This matched URI of the specified URI reference is defined in
                 // a next catalog file.
@@ -156,3 +159,4 @@
                 CATALOG_NEXTCATALOGRIGHT);
     }
 }
+
diff --git a/jaxp/test/javax/xml/jaxp/functional/catalog/NormalizationTest.java b/jaxp/test/javax/xml/jaxp/functional/catalog/NormalizationTest.java
index 882e17e..b7715c0 100644
--- a/jaxp/test/javax/xml/jaxp/functional/catalog/NormalizationTest.java
+++ b/jaxp/test/javax/xml/jaxp/functional/catalog/NormalizationTest.java
@@ -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
@@ -33,18 +33,21 @@
 import javax.xml.catalog.CatalogUriResolver;
 
 import org.testng.annotations.DataProvider;
+import org.testng.annotations.Listeners;
 import org.testng.annotations.Test;
 
 /*
  * @test
  * @bug 8077931
+ * @library /javax/xml/jaxp/libs
+ * @run testng/othervm -DrunSecMngr=true catalog.NormalizationTest
+ * @run testng/othervm catalog.NormalizationTest
  * @summary Before matching identifiers and URI references, it has to normalize
  *          the passed identifiers and URI references. And then the catalog
  *          resolver uses the normalized stuff to search the counterparts in
  *          catalog files.
- * @compile ../../libs/catalog/CatalogTestUtils.java
- * @compile ../../libs/catalog/ResolutionChecker.java
  */
+@Listeners({jaxp.library.FilePolicy.class})
 public class NormalizationTest {
 
     private static final String CATALOG_NORMALIZATION = "normalization.xml";
@@ -65,7 +68,7 @@
     }
 
     @DataProvider(name = "systemId_uri-matchedUri")
-    private Object[][] dataOnSysIdAndUri() {
+    public Object[][] dataOnSysIdAndUri() {
         return new Object[][] {
                 // The specified system id/URI reference contains spaces. And
                 // the counterparts in system/uri entries also contain spaces.
@@ -87,7 +90,7 @@
     }
 
     @DataProvider(name = "publicId-matchedUri")
-    private Object[][] dataOnPubId() {
+    public Object[][] dataOnPubId() {
         return new Object[][] {
                 // The specified public id contains spaces. And the counterparts
                 // in public entry also contains spaces.
@@ -112,3 +115,4 @@
         return catalogUriResolver(CATALOG_NORMALIZATION);
     }
 }
+
diff --git a/jaxp/test/javax/xml/jaxp/functional/catalog/PreferFeatureTest.java b/jaxp/test/javax/xml/jaxp/functional/catalog/PreferFeatureTest.java
index 61d7c14..c449771 100644
--- a/jaxp/test/javax/xml/jaxp/functional/catalog/PreferFeatureTest.java
+++ b/jaxp/test/javax/xml/jaxp/functional/catalog/PreferFeatureTest.java
@@ -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
@@ -33,16 +33,20 @@
 import javax.xml.catalog.CatalogResolver;
 
 import org.testng.annotations.DataProvider;
+import org.testng.annotations.Listeners;
 import org.testng.annotations.Test;
 
 /*
  * @test
  * @bug 8077931
+ * @library /javax/xml/jaxp/libs
+ * @run testng/othervm -DrunSecMngr=true catalog.PreferFeatureTest
+ * @run testng/othervm catalog.PreferFeatureTest
  * @summary This case tests how does the feature affect the catalog resolution,
  *          and tests the priority between this feature and attribute prefer
  *          in catalog file.
- * @compile ../../libs/catalog/CatalogTestUtils.java
  */
+@Listeners({jaxp.library.FilePolicy.class})
 public class PreferFeatureTest {
 
     @Test(dataProvider = "prefer-publicId-systemId",
@@ -53,7 +57,7 @@
     }
 
     @DataProvider(name = "prefer-publicId-systemId")
-    private Object[][] data() {
+    public Object[][] data() {
         return new Object[][] {
                 // The feature prefer is system. There's a match for the
                 // specified public id, and no match for the specified system id.
@@ -77,3 +81,4 @@
                 "preferFeature.xml");
     }
 }
+
diff --git a/jaxp/test/javax/xml/jaxp/functional/catalog/PreferTest.java b/jaxp/test/javax/xml/jaxp/functional/catalog/PreferTest.java
index ef03ff8..2f73bb7 100644
--- a/jaxp/test/javax/xml/jaxp/functional/catalog/PreferTest.java
+++ b/jaxp/test/javax/xml/jaxp/functional/catalog/PreferTest.java
@@ -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
@@ -29,18 +29,21 @@
 import javax.xml.catalog.CatalogResolver;
 
 import org.testng.annotations.DataProvider;
+import org.testng.annotations.Listeners;
 import org.testng.annotations.Test;
 
 /*
  * @test
  * @bug 8077931
+ * @library /javax/xml/jaxp/libs
+ * @run testng/othervm -DrunSecMngr=true catalog.PreferTest
+ * @run testng/othervm catalog.PreferTest
  * @summary Get matched URIs from system and public family entries, which
  *          specify the prefer attribute. It tests how does the prefer attribute
  *          affect the resolution procedure. The test rule is based on OASIS
  *          Standard V1.1 section 4.1.1. "The prefer attribute".
- * @compile ../../libs/catalog/CatalogTestUtils.java
- * @compile ../../libs/catalog/ResolutionChecker.java
  */
+@Listeners({jaxp.library.FilePolicy.class})
 public class PreferTest {
 
     @Test(dataProvider = "publicId-systemId-matchedUri")
@@ -50,7 +53,7 @@
     }
 
     @DataProvider(name = "publicId-systemId-matchedUri")
-    private Object[][] data() {
+    public Object[][] data() {
         return new Object[][] {
                 // The prefer attribute is public. Both of the specified public
                 // id and system id have matches in the catalog file. But
@@ -89,3 +92,4 @@
         return catalogResolver("prefer.xml");
     }
 }
+
diff --git a/jaxp/test/javax/xml/jaxp/functional/catalog/PublicFamilyTest.java b/jaxp/test/javax/xml/jaxp/functional/catalog/PublicFamilyTest.java
index c0e7643..e149949 100644
--- a/jaxp/test/javax/xml/jaxp/functional/catalog/PublicFamilyTest.java
+++ b/jaxp/test/javax/xml/jaxp/functional/catalog/PublicFamilyTest.java
@@ -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
@@ -30,18 +30,21 @@
 import javax.xml.catalog.CatalogException;
 import javax.xml.catalog.CatalogResolver;
 
+import org.testng.annotations.Listeners;
 import org.testng.annotations.Test;
 
 /*
  * @test
  * @bug 8077931
+ * @library /javax/xml/jaxp/libs
+ * @run testng/othervm -DrunSecMngr=true catalog.PublicFamilyTest
+ * @run testng/othervm catalog.PublicFamilyTest
  * @summary Get matched URIs from public and delegatePublic entries.
  *          It tests the resolution priorities among the public family entries.
  *          The test rule is based on OASIS Standard V1.1 section 7.1.2.
  *          "Resolution of External Identifiers".
- * @compile ../../libs/catalog/CatalogTestUtils.java
- * @compile ../../libs/catalog/ResolutionChecker.java
  */
+@Listeners({jaxp.library.FilePolicy.class})
 public class PublicFamilyTest {
 
     /*
@@ -67,3 +70,4 @@
         return catalogResolver("publicFamily.xml");
     }
 }
+
diff --git a/jaxp/test/javax/xml/jaxp/functional/catalog/PublicTest.java b/jaxp/test/javax/xml/jaxp/functional/catalog/PublicTest.java
index d63df96..48c103e 100644
--- a/jaxp/test/javax/xml/jaxp/functional/catalog/PublicTest.java
+++ b/jaxp/test/javax/xml/jaxp/functional/catalog/PublicTest.java
@@ -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
@@ -32,15 +32,18 @@
 import javax.xml.catalog.CatalogResolver;
 
 import org.testng.annotations.DataProvider;
+import org.testng.annotations.Listeners;
 import org.testng.annotations.Test;
 
 /*
  * @test
  * @bug 8077931
+ * @library /javax/xml/jaxp/libs
+ * @run testng/othervm -DrunSecMngr=true catalog.PublicTest
+ * @run testng/othervm catalog.PublicTest
  * @summary Get matched URIs from public entries.
- * @compile ../../libs/catalog/CatalogTestUtils.java
- * @compile ../../libs/catalog/ResolutionChecker.java
  */
+@Listeners({jaxp.library.FilePolicy.class})
 public class PublicTest {
 
     @Test(dataProvider = "publicId-matchedUri")
@@ -89,3 +92,4 @@
         return catalogResolver(CATALOG_PUBLIC);
     }
 }
+
diff --git a/jaxp/test/javax/xml/jaxp/functional/catalog/ResolveFeatureTest.java b/jaxp/test/javax/xml/jaxp/functional/catalog/ResolveFeatureTest.java
index 4aa7465..9cb29bd 100644
--- a/jaxp/test/javax/xml/jaxp/functional/catalog/ResolveFeatureTest.java
+++ b/jaxp/test/javax/xml/jaxp/functional/catalog/ResolveFeatureTest.java
@@ -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
@@ -40,16 +40,19 @@
 import javax.xml.catalog.CatalogResolver;
 import javax.xml.catalog.CatalogUriResolver;
 
+import org.testng.annotations.Listeners;
 import org.testng.annotations.Test;
 
 /*
  * @test
  * @bug 8077931
+ * @library /javax/xml/jaxp/libs
+ * @run testng/othervm -DrunSecMngr=true catalog.ResolveFeatureTest
+ * @run testng/othervm catalog.ResolveFeatureTest
  * @summary This case tests how does resolve feature affect the catalog
  *          resolution.
- * @compile ../../libs/catalog/CatalogTestUtils.java
- * @compile ../../libs/catalog/ResolutionChecker.java
  */
+@Listeners({jaxp.library.FilePolicy.class})
 public class ResolveFeatureTest {
 
     /*
@@ -128,3 +131,4 @@
         return builder().with(Feature.RESOLVE, resolve).build();
     }
 }
+
diff --git a/jaxp/test/javax/xml/jaxp/functional/catalog/RewriteSystemTest.java b/jaxp/test/javax/xml/jaxp/functional/catalog/RewriteSystemTest.java
index c00f6b5..fb45816 100644
--- a/jaxp/test/javax/xml/jaxp/functional/catalog/RewriteSystemTest.java
+++ b/jaxp/test/javax/xml/jaxp/functional/catalog/RewriteSystemTest.java
@@ -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
@@ -31,15 +31,18 @@
 import javax.xml.catalog.CatalogResolver;
 
 import org.testng.annotations.DataProvider;
+import org.testng.annotations.Listeners;
 import org.testng.annotations.Test;
 
 /*
  * @test
  * @bug 8077931
+ * @library /javax/xml/jaxp/libs
+ * @run testng/othervm -DrunSecMngr=true catalog.RewriteSystemTest
+ * @run testng/othervm catalog.RewriteSystemTest
  * @summary Get matched URIs from rewriteSystem entries.
- * @compile ../../libs/catalog/CatalogTestUtils.java
- * @compile ../../libs/catalog/ResolutionChecker.java
  */
+@Listeners({jaxp.library.FilePolicy.class})
 public class RewriteSystemTest {
 
     @Test(dataProvider = "systemId-matchedUri")
@@ -92,3 +95,4 @@
         return catalogResolver("rewriteSystem.xml");
     }
 }
+
diff --git a/jaxp/test/javax/xml/jaxp/functional/catalog/RewriteUriTest.java b/jaxp/test/javax/xml/jaxp/functional/catalog/RewriteUriTest.java
index 5032a89..0a44942 100644
--- a/jaxp/test/javax/xml/jaxp/functional/catalog/RewriteUriTest.java
+++ b/jaxp/test/javax/xml/jaxp/functional/catalog/RewriteUriTest.java
@@ -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
@@ -31,15 +31,18 @@
 import javax.xml.catalog.CatalogUriResolver;
 
 import org.testng.annotations.DataProvider;
+import org.testng.annotations.Listeners;
 import org.testng.annotations.Test;
 
 /*
  * @test
  * @bug 8077931
+ * @library /javax/xml/jaxp/libs
+ * @run testng/othervm -DrunSecMngr=true catalog.RewriteUriTest
+ * @run testng/othervm catalog.RewriteUriTest
  * @summary Get matched URIs from rewriteURI entries.
- * @compile ../../libs/catalog/CatalogTestUtils.java
- * @compile ../../libs/catalog/ResolutionChecker.java
  */
+@Listeners({jaxp.library.FilePolicy.class})
 public class RewriteUriTest {
 
     @Test(dataProvider = "uri-matchedUri")
@@ -92,3 +95,4 @@
         return catalogUriResolver("rewriteUri.xml");
     }
 }
+
diff --git a/jaxp/test/javax/xml/jaxp/functional/catalog/SpecifyCatalogTest.java b/jaxp/test/javax/xml/jaxp/functional/catalog/SpecifyCatalogTest.java
index a1be6d2..6085e6e 100644
--- a/jaxp/test/javax/xml/jaxp/functional/catalog/SpecifyCatalogTest.java
+++ b/jaxp/test/javax/xml/jaxp/functional/catalog/SpecifyCatalogTest.java
@@ -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
@@ -23,6 +23,8 @@
 
 package catalog;
 
+import static jaxp.library.JAXPTestUtilities.setSystemProperty;
+
 import static catalog.CatalogTestUtils.FEATURE_FILES;
 import static catalog.CatalogTestUtils.catalogResolver;
 import static catalog.CatalogTestUtils.catalogUriResolver;
@@ -36,15 +38,18 @@
 import javax.xml.catalog.CatalogResolver;
 import javax.xml.catalog.CatalogUriResolver;
 
+import org.testng.annotations.Listeners;
 import org.testng.annotations.Test;
 
 /*
  * @test
  * @bug 8077931
+ * @library /javax/xml/jaxp/libs
+ * @run testng/othervm -DrunSecMngr=true catalog.SpecifyCatalogTest
+ * @run testng/othervm catalog.SpecifyCatalogTest
  * @summary This case tests how to specify the catalog files.
- * @compile ../../libs/catalog/CatalogTestUtils.java
- * @compile ../../libs/catalog/ResolutionChecker.java
  */
+@Listeners({jaxp.library.FilePolicy.class})
 public class SpecifyCatalogTest {
 
     private static final String ID_URI = "http://remote/dtd/uri/doc.dtd";
@@ -76,7 +81,7 @@
      */
     @Test
     public void specifyCatalogViaSysProps() {
-        System.setProperty(FEATURE_FILES,
+        setSystemProperty(FEATURE_FILES,
                 getCatalogPath("specifyCatalog-sysProps.xml"));
 
         checkResolutionOnEntityResolver(catalogResolver((String[]) null),
@@ -106,3 +111,4 @@
         return builder().with(FILES, getCatalogPath(catalogName)).build();
     }
 }
+
diff --git a/jaxp/test/javax/xml/jaxp/functional/catalog/SystemFamilyTest.java b/jaxp/test/javax/xml/jaxp/functional/catalog/SystemFamilyTest.java
index 9bd3c79..aa921b5 100644
--- a/jaxp/test/javax/xml/jaxp/functional/catalog/SystemFamilyTest.java
+++ b/jaxp/test/javax/xml/jaxp/functional/catalog/SystemFamilyTest.java
@@ -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
@@ -31,18 +31,21 @@
 import javax.xml.catalog.CatalogResolver;
 
 import org.testng.annotations.DataProvider;
+import org.testng.annotations.Listeners;
 import org.testng.annotations.Test;
 
 /*
  * @test
  * @bug 8077931
+ * @library /javax/xml/jaxp/libs
+ * @run testng/othervm -DrunSecMngr=true catalog.SystemFamilyTest
+ * @run testng/othervm catalog.SystemFamilyTest
  * @summary Get matched URIs from system, rewriteSystem, systemSuffix and
  *          delegateSystem entries. It tests the resolution priorities among
  *          the system family entries. The test rule is based on OASIS
  *          Standard V1.1 section 7.1.2. "Resolution of External Identifiers".
- * @compile ../../libs/catalog/CatalogTestUtils.java
- * @compile ../../libs/catalog/ResolutionChecker.java
  */
+@Listeners({jaxp.library.FilePolicy.class})
 public class SystemFamilyTest {
 
     @Test(dataProvider = "systemId-matchedUri")
@@ -81,3 +84,4 @@
         return catalogResolver("systemFamily.xml");
     }
 }
+
diff --git a/jaxp/test/javax/xml/jaxp/functional/catalog/SystemSuffixTest.java b/jaxp/test/javax/xml/jaxp/functional/catalog/SystemSuffixTest.java
index 9ebd18a..9762270 100644
--- a/jaxp/test/javax/xml/jaxp/functional/catalog/SystemSuffixTest.java
+++ b/jaxp/test/javax/xml/jaxp/functional/catalog/SystemSuffixTest.java
@@ -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
@@ -31,15 +31,18 @@
 import javax.xml.catalog.CatalogResolver;
 
 import org.testng.annotations.DataProvider;
+import org.testng.annotations.Listeners;
 import org.testng.annotations.Test;
 
 /*
  * @test
  * @bug 8077931
+ * @library /javax/xml/jaxp/libs
+ * @run testng/othervm -DrunSecMngr=true catalog.SystemSuffixTest
+ * @run testng/othervm catalog.SystemSuffixTest
  * @summary Get matched URIs from systemSuffix entries.
- * @compile ../../libs/catalog/CatalogTestUtils.java
- * @compile ../../libs/catalog/ResolutionChecker.java
  */
+@Listeners({jaxp.library.FilePolicy.class})
 public class SystemSuffixTest {
 
     @Test(dataProvider = "systemId-matchedUri")
@@ -92,3 +95,4 @@
         return catalogResolver("systemSuffix.xml");
     }
 }
+
diff --git a/jaxp/test/javax/xml/jaxp/functional/catalog/SystemTest.java b/jaxp/test/javax/xml/jaxp/functional/catalog/SystemTest.java
index 74dab68..d780293 100644
--- a/jaxp/test/javax/xml/jaxp/functional/catalog/SystemTest.java
+++ b/jaxp/test/javax/xml/jaxp/functional/catalog/SystemTest.java
@@ -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
@@ -32,15 +32,18 @@
 import javax.xml.catalog.CatalogResolver;
 
 import org.testng.annotations.DataProvider;
+import org.testng.annotations.Listeners;
 import org.testng.annotations.Test;
 
 /*
  * @test
  * @bug 8077931
+ * @library /javax/xml/jaxp/libs
+ * @run testng/othervm -DrunSecMngr=true catalog.SystemTest
+ * @run testng/othervm catalog.SystemTest
  * @summary Get matched URIs from system entries.
- * @compile ../../libs/catalog/CatalogTestUtils.java
- * @compile ../../libs/catalog/ResolutionChecker.java
  */
+@Listeners({jaxp.library.FilePolicy.class})
 public class SystemTest {
 
     @Test(dataProvider = "systemId-matchedUri")
@@ -89,3 +92,4 @@
         return catalogResolver(CATALOG_SYSTEM);
     }
 }
+
diff --git a/jaxp/test/javax/xml/jaxp/functional/catalog/UriFamilyTest.java b/jaxp/test/javax/xml/jaxp/functional/catalog/UriFamilyTest.java
index f2e19c6..f6104e8 100644
--- a/jaxp/test/javax/xml/jaxp/functional/catalog/UriFamilyTest.java
+++ b/jaxp/test/javax/xml/jaxp/functional/catalog/UriFamilyTest.java
@@ -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
@@ -31,18 +31,21 @@
 import javax.xml.catalog.CatalogUriResolver;
 
 import org.testng.annotations.DataProvider;
+import org.testng.annotations.Listeners;
 import org.testng.annotations.Test;
 
 /*
  * @test
  * @bug 8077931
+ * @library /javax/xml/jaxp/libs
+ * @run testng/othervm -DrunSecMngr=true catalog.UriFamilyTest
+ * @run testng/othervm catalog.UriFamilyTest
  * @summary Get matched URIs from uri, rewriteURI, uriSuffix and delegateURI
  *          entries. It tests the resolution priorities among the uri family
  *          entries. The test rule is based on OASIS Standard V1.1 section
  *          7.2.2. "Resolution of External Identifiers".
- * @compile ../../libs/catalog/CatalogTestUtils.java
- * @compile ../../libs/catalog/ResolutionChecker.java
  */
+@Listeners({jaxp.library.FilePolicy.class})
 public class UriFamilyTest {
 
     @Test(dataProvider = "uri-matchedUri")
@@ -81,3 +84,4 @@
         return catalogUriResolver("uriFamily.xml");
     }
 }
+
diff --git a/jaxp/test/javax/xml/jaxp/functional/catalog/UriSuffixTest.java b/jaxp/test/javax/xml/jaxp/functional/catalog/UriSuffixTest.java
index e79cdf8..9cc4a27 100644
--- a/jaxp/test/javax/xml/jaxp/functional/catalog/UriSuffixTest.java
+++ b/jaxp/test/javax/xml/jaxp/functional/catalog/UriSuffixTest.java
@@ -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
@@ -31,15 +31,18 @@
 import javax.xml.catalog.CatalogUriResolver;
 
 import org.testng.annotations.DataProvider;
+import org.testng.annotations.Listeners;
 import org.testng.annotations.Test;
 
 /*
  * @test
  * @bug 8077931
+ * @library /javax/xml/jaxp/libs
+ * @run testng/othervm -DrunSecMngr=true catalog.UriSuffixTest
+ * @run testng/othervm catalog.UriSuffixTest
  * @summary Get matched URIs from rewriteURI entries.
- * @compile ../../libs/catalog/CatalogTestUtils.java
- * @compile ../../libs/catalog/ResolutionChecker.java
  */
+@Listeners({jaxp.library.FilePolicy.class})
 public class UriSuffixTest {
 
     @Test(dataProvider = "uri-matchedUri")
@@ -92,3 +95,4 @@
         return catalogUriResolver("uriSuffix.xml");
     }
 }
+
diff --git a/jaxp/test/javax/xml/jaxp/functional/catalog/UriTest.java b/jaxp/test/javax/xml/jaxp/functional/catalog/UriTest.java
index 88a1666..ae17e34 100644
--- a/jaxp/test/javax/xml/jaxp/functional/catalog/UriTest.java
+++ b/jaxp/test/javax/xml/jaxp/functional/catalog/UriTest.java
@@ -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
@@ -34,15 +34,18 @@
 import javax.xml.catalog.CatalogUriResolver;
 
 import org.testng.annotations.DataProvider;
+import org.testng.annotations.Listeners;
 import org.testng.annotations.Test;
 
 /*
  * @test
  * @bug 8077931
+ * @library /javax/xml/jaxp/libs
+ * @run testng/othervm -DrunSecMngr=true catalog.UriTest
+ * @run testng/othervm catalog.UriTest
  * @summary Get matched URIs from uri entries.
- * @compile ../../libs/catalog/CatalogTestUtils.java
- * @compile ../../libs/catalog/ResolutionChecker.java
  */
+@Listeners({jaxp.library.FilePolicy.class})
 public class UriTest {
 
     @Test(dataProvider = "uri-matchedUri")
@@ -101,3 +104,4 @@
         return catalogUriResolver(CATALOG_URI);
     }
 }
+
diff --git a/jaxp/test/javax/xml/jaxp/functional/catalog/UrnUnwrappingTest.java b/jaxp/test/javax/xml/jaxp/functional/catalog/UrnUnwrappingTest.java
index e2281ea..468de7e 100644
--- a/jaxp/test/javax/xml/jaxp/functional/catalog/UrnUnwrappingTest.java
+++ b/jaxp/test/javax/xml/jaxp/functional/catalog/UrnUnwrappingTest.java
@@ -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
@@ -29,17 +29,20 @@
 import javax.xml.catalog.CatalogResolver;
 
 import org.testng.annotations.DataProvider;
+import org.testng.annotations.Listeners;
 import org.testng.annotations.Test;
 
 /*
  * @test
  * @bug 8077931
+ * @library /javax/xml/jaxp/libs
+ * @run testng/othervm -DrunSecMngr=true catalog.UrnUnwrappingTest
+ * @run testng/othervm catalog.UrnUnwrappingTest
  * @summary If the passed public identifier is started with "urn:publicid:",
  *          it has to be regarded as URN and normalized. And then the catalog
  *          resolver uses the normalized stuff to do matching.
- * @compile ../../libs/catalog/CatalogTestUtils.java
- * @compile ../../libs/catalog/ResolutionChecker.java
  */
+@Listeners({jaxp.library.FilePolicy.class})
 public class UrnUnwrappingTest {
 
     @Test(dataProvider = "urn-matchedUri")
@@ -48,7 +51,7 @@
     }
 
     @DataProvider(name = "urn-matchedUri")
-    private Object[][] data() {
+    public Object[][] data() {
         return new Object[][] {
                 // The specified public id is URN format.
                 { "urn:publicid:-:REMOTE:DTD+ALICE+DOCALICE+XML:EN",
@@ -64,3 +67,4 @@
         return catalogResolver("urnUnwrapping.xml");
     }
 }
+
diff --git a/jaxp/test/javax/xml/jaxp/functional/catalog/ValidateCatalogTest.java b/jaxp/test/javax/xml/jaxp/functional/catalog/ValidateCatalogTest.java
index 2b4170c..d0194ca 100644
--- a/jaxp/test/javax/xml/jaxp/functional/catalog/ValidateCatalogTest.java
+++ b/jaxp/test/javax/xml/jaxp/functional/catalog/ValidateCatalogTest.java
@@ -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
@@ -32,17 +32,20 @@
 
 import javax.xml.catalog.CatalogException;
 
+import org.testng.annotations.Listeners;
 import org.testng.annotations.Test;
 
 /*
  * @test
  * @bug 8077931
+ * @library /javax/xml/jaxp/libs
+ * @run testng/othervm -DrunSecMngr=true catalog.ValidateCatalogTest
+ * @run testng/othervm catalog.ValidateCatalogTest
  * @summary A legal catalog file must be well-formed XML, the root element
  *          must be catalog, and the naming space of the root element must be
  *          urn:oasis:names:tc:entity:xmlns:xml:catalog.
- * @compile ../../libs/catalog/CatalogTestUtils.java
- * @compile ../../libs/catalog/ResolutionChecker.java
  */
+@Listeners({jaxp.library.FilePolicy.class})
 public class ValidateCatalogTest {
 
     private static final String CATALOG_WRONGROOT = "validateCatalog-wrongRoot.xml";
@@ -99,3 +102,4 @@
                 "http://local/dtd/docAliceURI.dtd");
     }
 }
+
diff --git a/jaxp/test/javax/xml/jaxp/functional/javax/xml/datatype/ptests/DurationTest.java b/jaxp/test/javax/xml/jaxp/functional/javax/xml/datatype/ptests/DurationTest.java
index f18cf9c..2a27b94 100644
--- a/jaxp/test/javax/xml/jaxp/functional/javax/xml/datatype/ptests/DurationTest.java
+++ b/jaxp/test/javax/xml/jaxp/functional/javax/xml/datatype/ptests/DurationTest.java
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1999, 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1999, 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
@@ -44,17 +44,21 @@
 import javax.xml.datatype.Duration;
 import javax.xml.namespace.QName;
 
-import jaxp.library.JAXPBaseTest;
-
 import org.testng.Assert;
 import org.testng.annotations.BeforeClass;
 import org.testng.annotations.DataProvider;
+import org.testng.annotations.Listeners;
 import org.testng.annotations.Test;
 
 /*
+ * @test
+ * @library /javax/xml/jaxp/libs
+ * @run testng/othervm -DrunSecMngr=true javax.xml.datatype.ptests.DurationTest
+ * @run testng/othervm javax.xml.datatype.ptests.DurationTest
  * @summary Class containing the test cases for Duration.
  */
-public class DurationTest extends JAXPBaseTest {
+@Listeners({jaxp.library.BasePolicy.class})
+public class DurationTest {
 
     private DatatypeFactory datatypeFactory;
 
@@ -583,3 +587,4 @@
     private final BigInteger one = BigInteger.ONE;
 
 }
+
diff --git a/jaxp/test/javax/xml/jaxp/functional/javax/xml/datatype/ptests/FactoryNewInstanceTest.java b/jaxp/test/javax/xml/jaxp/functional/javax/xml/datatype/ptests/FactoryNewInstanceTest.java
index 48f4a19c..8f21a2b 100644
--- a/jaxp/test/javax/xml/jaxp/functional/javax/xml/datatype/ptests/FactoryNewInstanceTest.java
+++ b/jaxp/test/javax/xml/jaxp/functional/javax/xml/datatype/ptests/FactoryNewInstanceTest.java
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1999, 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1999, 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,15 +30,20 @@
 import javax.xml.datatype.Duration;
 
 import jaxp.library.JAXPDataProvider;
-import jaxp.library.JAXPBaseTest;
 
 import org.testng.annotations.DataProvider;
+import org.testng.annotations.Listeners;
 import org.testng.annotations.Test;
 
 /*
+ * @test
+ * @library /javax/xml/jaxp/libs
+ * @run testng/othervm -DrunSecMngr=true javax.xml.datatype.ptests.FactoryNewInstanceTest
+ * @run testng/othervm javax.xml.datatype.ptests.FactoryNewInstanceTest
  * @summary Tests for DatatypeFactory.newInstance(factoryClassName , classLoader)
  */
-public class FactoryNewInstanceTest extends JAXPBaseTest {
+@Listeners({jaxp.library.BasePolicy.class})
+public class FactoryNewInstanceTest {
 
     private static final String DATATYPE_FACTORY_CLASSNAME = "com.sun.org.apache.xerces.internal.jaxp.datatype.DatatypeFactoryImpl";
 
@@ -72,3 +77,4 @@
     }
 
 }
+
diff --git a/jaxp/test/javax/xml/jaxp/functional/javax/xml/datatype/ptests/XMLGregorianCalendarTest.java b/jaxp/test/javax/xml/jaxp/functional/javax/xml/datatype/ptests/XMLGregorianCalendarTest.java
index 3b47d51..bd98ec9 100644
--- a/jaxp/test/javax/xml/jaxp/functional/javax/xml/datatype/ptests/XMLGregorianCalendarTest.java
+++ b/jaxp/test/javax/xml/jaxp/functional/javax/xml/datatype/ptests/XMLGregorianCalendarTest.java
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1999, 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1999, 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
@@ -39,18 +39,22 @@
 import javax.xml.datatype.Duration;
 import javax.xml.datatype.XMLGregorianCalendar;
 
-import jaxp.library.JAXPBaseTest;
-
 import org.testng.Assert;
 import org.testng.annotations.BeforeClass;
 import org.testng.annotations.DataProvider;
+import org.testng.annotations.Listeners;
 import org.testng.annotations.Test;
 
 /*
+ * @test
  * @bug 5049592 5041845 5048932 5064587 5040542 5049531 5049528
+ * @library /javax/xml/jaxp/libs
+ * @run testng/othervm -DrunSecMngr=true javax.xml.datatype.ptests.XMLGregorianCalendarTest
+ * @run testng/othervm javax.xml.datatype.ptests.XMLGregorianCalendarTest
  * @summary Class containing the test cases for XMLGregorianCalendar
  */
-public class XMLGregorianCalendarTest extends JAXPBaseTest {
+@Listeners({jaxp.library.BasePolicy.class})
+public class XMLGregorianCalendarTest {
 
     private DatatypeFactory datatypeFactory;
 
@@ -354,3 +358,4 @@
     private final int undef = DatatypeConstants.FIELD_UNDEFINED;
 
 }
+
diff --git a/jaxp/test/javax/xml/jaxp/functional/javax/xml/parsers/ptests/DBFNamespaceTest.java b/jaxp/test/javax/xml/jaxp/functional/javax/xml/parsers/ptests/DBFNamespaceTest.java
index 6c2f073..9eec790 100644
--- a/jaxp/test/javax/xml/jaxp/functional/javax/xml/parsers/ptests/DBFNamespaceTest.java
+++ b/jaxp/test/javax/xml/jaxp/functional/javax/xml/parsers/ptests/DBFNamespaceTest.java
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1999, 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1999, 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
@@ -23,18 +23,21 @@
 
 package javax.xml.parsers.ptests;
 
+import static javax.xml.parsers.ptests.ParserTestConst.GOLDEN_DIR;
+import static javax.xml.parsers.ptests.ParserTestConst.XML_DIR;
 import static jaxp.library.JAXPTestUtilities.USER_DIR;
 import static jaxp.library.JAXPTestUtilities.compareWithGold;
 import static org.testng.Assert.assertTrue;
+
 import java.io.File;
+
 import javax.xml.parsers.DocumentBuilderFactory;
-import static javax.xml.parsers.ptests.ParserTestConst.GOLDEN_DIR;
-import static javax.xml.parsers.ptests.ParserTestConst.XML_DIR;
 import javax.xml.transform.TransformerFactory;
 import javax.xml.transform.dom.DOMSource;
 import javax.xml.transform.sax.SAXResult;
-import jaxp.library.JAXPFileBaseTest;
+
 import org.testng.annotations.DataProvider;
+import org.testng.annotations.Listeners;
 import org.testng.annotations.Test;
 import org.w3c.dom.Document;
 
@@ -42,7 +45,14 @@
  * This tests DocumentBuilderFactory for namespace processing and no-namespace
  * processing.
  */
-public class DBFNamespaceTest extends JAXPFileBaseTest {
+/*
+ * @test
+ * @library /javax/xml/jaxp/libs
+ * @run testng/othervm -DrunSecMngr=true javax.xml.parsers.ptests.DBFNamespaceTest
+ * @run testng/othervm javax.xml.parsers.ptests.DBFNamespaceTest
+ */
+@Listeners({jaxp.library.FilePolicy.class})
+public class DBFNamespaceTest {
 
     /**
      * Provide input for the cases that supporting namespace or not.
@@ -95,3 +105,5 @@
         }
     }
 }
+
+
diff --git a/jaxp/test/javax/xml/jaxp/functional/javax/xml/parsers/ptests/DocumentBuilderFactoryTest.java b/jaxp/test/javax/xml/jaxp/functional/javax/xml/parsers/ptests/DocumentBuilderFactoryTest.java
index 77196ee..2419a23 100644
--- a/jaxp/test/javax/xml/jaxp/functional/javax/xml/parsers/ptests/DocumentBuilderFactoryTest.java
+++ b/jaxp/test/javax/xml/jaxp/functional/javax/xml/parsers/ptests/DocumentBuilderFactoryTest.java
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1999, 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1999, 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
@@ -40,7 +40,6 @@
 import java.io.File;
 import java.io.FileInputStream;
 import java.io.FileNotFoundException;
-import java.io.FilePermission;
 import java.io.FileReader;
 
 import javax.xml.parsers.DocumentBuilder;
@@ -55,9 +54,9 @@
 import javax.xml.transform.sax.SAXResult;
 
 import jaxp.library.JAXPDataProvider;
-import jaxp.library.JAXPFileBaseTest;
 
 import org.testng.annotations.DataProvider;
+import org.testng.annotations.Listeners;
 import org.testng.annotations.Test;
 import org.w3c.dom.Document;
 import org.w3c.dom.Element;
@@ -70,7 +69,14 @@
  * @bug 8080907
  * This checks the methods of DocumentBuilderFactoryImpl.
  */
-public class DocumentBuilderFactoryTest extends JAXPFileBaseTest {
+/*
+ * @test
+ * @library /javax/xml/jaxp/libs
+ * @run testng/othervm -DrunSecMngr=true javax.xml.parsers.ptests.DocumentBuilderFactoryTest
+ * @run testng/othervm javax.xml.parsers.ptests.DocumentBuilderFactoryTest
+ */
+@Listeners({jaxp.library.FilePolicy.class})
+public class DocumentBuilderFactoryTest {
     /**
      * DocumentBuilderFactory implementation class name.
      */
@@ -419,8 +425,6 @@
     @Test
     public void testCheckDocumentBuilderFactory13() throws Exception {
         // Accesing default working directory.
-        String workingDir = getSystemProperty("user.dir");
-        setPermissions(new FilePermission(workingDir + "/*", "read"));
         DocumentBuilderFactory dbf = DocumentBuilderFactory.newInstance();
         DocumentBuilder docBuilder = dbf.newDocumentBuilder();
         Document doc = docBuilder.parse(new File(XML_DIR + "dbf10import.xsl")
@@ -436,8 +440,6 @@
     @Test(expectedExceptions = SAXException.class)
     public void testCheckDocumentBuilderFactory14() throws Exception {
         // Accesing default working directory.
-        String workingDir = getSystemProperty("user.dir");
-        setPermissions(new FilePermission(workingDir, "read"));
         DocumentBuilderFactory dbf = DocumentBuilderFactory.newInstance();
         DocumentBuilder docBuilder = dbf.newDocumentBuilder();
         docBuilder.parse("");
@@ -529,3 +531,5 @@
         assertTrue(compareWithGold(goldFile, outputFile));
     }
 }
+
+
diff --git a/jaxp/test/javax/xml/jaxp/functional/javax/xml/parsers/ptests/DocumentBuilderImpl01.java b/jaxp/test/javax/xml/jaxp/functional/javax/xml/parsers/ptests/DocumentBuilderImpl01.java
index 144df20..e805094 100644
--- a/jaxp/test/javax/xml/jaxp/functional/javax/xml/parsers/ptests/DocumentBuilderImpl01.java
+++ b/jaxp/test/javax/xml/jaxp/functional/javax/xml/parsers/ptests/DocumentBuilderImpl01.java
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1999, 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1999, 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
@@ -23,18 +23,21 @@
 
 package javax.xml.parsers.ptests;
 
+import static javax.xml.parsers.ptests.ParserTestConst.XML_DIR;
 import static jaxp.library.JAXPTestUtilities.FILE_SEP;
 import static org.testng.Assert.assertFalse;
+import static org.testng.Assert.assertNotNull;
+
 import java.io.File;
 import java.io.FileInputStream;
 import java.io.FilePermission;
+
 import javax.xml.parsers.DocumentBuilder;
 import javax.xml.parsers.DocumentBuilderFactory;
 import javax.xml.parsers.ParserConfigurationException;
-import static javax.xml.parsers.ptests.ParserTestConst.XML_DIR;
-import jaxp.library.JAXPFileReadOnlyBaseTest;
-import static org.testng.Assert.assertNotNull;
+
 import org.testng.annotations.DataProvider;
+import org.testng.annotations.Listeners;
 import org.testng.annotations.Test;
 import org.xml.sax.EntityResolver;
 import org.xml.sax.InputSource;
@@ -42,8 +45,14 @@
 /**
  * This checks for the methods of DocumentBuilder
  */
-public class DocumentBuilderImpl01 extends JAXPFileReadOnlyBaseTest
-            implements EntityResolver {
+/*
+ * @test
+ * @library /javax/xml/jaxp/libs
+ * @run testng/othervm -DrunSecMngr=true javax.xml.parsers.ptests.DocumentBuilderImpl01
+ * @run testng/othervm javax.xml.parsers.ptests.DocumentBuilderImpl01
+ */
+@Listeners({jaxp.library.FilePolicy.class})
+public class DocumentBuilderImpl01 implements EntityResolver {
     /**
      * Provide DocumentBuilder.
      *
@@ -82,7 +91,7 @@
      * @param docBuilder document builder instance.
      * @throws Exception If any errors occur.
      */
-    @Test(groups = {"readLocalFiles"}, dataProvider = "builder-provider")
+    @Test(dataProvider = "builder-provider")
     public void testCheckDocumentBuilderImpl04(DocumentBuilder docBuilder)
             throws Exception {
         try (FileInputStream fis = new FileInputStream(new File(XML_DIR,
@@ -97,7 +106,7 @@
      * @param docBuilder document builder instance.
      * @throws Exception If any errors occur.
      */
-    @Test(groups = {"readLocalFiles"}, dataProvider = "builder-provider")
+    @Test(dataProvider = "builder-provider")
     public void testCheckDocumentBuilderImpl05(DocumentBuilder docBuilder)
             throws Exception {
         assertNotNull(docBuilder.parse(new File(XML_DIR,
@@ -109,11 +118,9 @@
      * @param docBuilder document builder instance.
      * @throws Exception If any errors occur.
      */
-    @Test(groups = {"readLocalFiles"}, dataProvider = "builder-provider")
+    @Test(dataProvider = "builder-provider")
     public void testCheckDocumentBuilderImpl06(DocumentBuilder docBuilder)
             throws Exception {
-        setPermissions(new FilePermission(XML_DIR + "../-",
-                "read"));
         try (FileInputStream fis = new FileInputStream(new File(XML_DIR,
                 "DocumentBuilderImpl02.xml"))) {
             assertNotNull(docBuilder.parse(fis, new File(XML_DIR).toURI()
@@ -150,3 +157,5 @@
             return null;
     }
 }
+
+
diff --git a/jaxp/test/javax/xml/jaxp/functional/javax/xml/parsers/ptests/FactoryConfErrorTest.java b/jaxp/test/javax/xml/jaxp/functional/javax/xml/parsers/ptests/FactoryConfErrorTest.java
index 88a66dd..32c25b3 100644
--- a/jaxp/test/javax/xml/jaxp/functional/javax/xml/parsers/ptests/FactoryConfErrorTest.java
+++ b/jaxp/test/javax/xml/jaxp/functional/javax/xml/parsers/ptests/FactoryConfErrorTest.java
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1999, 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1999, 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
@@ -23,20 +23,30 @@
 
 package javax.xml.parsers.ptests;
 
+import static jaxp.library.JAXPTestUtilities.setSystemProperty;
+import static jaxp.library.JAXPTestUtilities.clearSystemProperty;
+
 import javax.xml.parsers.DocumentBuilderFactory;
 import javax.xml.parsers.FactoryConfigurationError;
 import javax.xml.parsers.SAXParserFactory;
-import jaxp.library.JAXPBaseTest;
 
 import org.testng.annotations.AfterTest;
 import org.testng.annotations.BeforeTest;
+import org.testng.annotations.Listeners;
 import org.testng.annotations.Test;
 
 /**
  * Class containing the test cases for SAXParserFactory/DocumentBuilderFactory
  * newInstance methods.
  */
-public class FactoryConfErrorTest extends JAXPBaseTest {
+/*
+ * @test
+ * @library /javax/xml/jaxp/libs
+ * @run testng/othervm -DrunSecMngr=true javax.xml.parsers.ptests.FactoryConfErrorTest
+ * @run testng/othervm javax.xml.parsers.ptests.FactoryConfErrorTest
+ */
+@Listeners({jaxp.library.BasePolicy.class})
+public class FactoryConfErrorTest {
 
     /**
      * Set properties DocumentBuilderFactory and SAXParserFactory to invalid
@@ -54,8 +64,8 @@
      */
     @AfterTest
     public void cleanup() {
-        setSystemProperty("javax.xml.parsers.DocumentBuilderFactory", null);
-        setSystemProperty("javax.xml.parsers.SAXParserFactory", null);
+        clearSystemProperty("javax.xml.parsers.DocumentBuilderFactory");
+        clearSystemProperty("javax.xml.parsers.SAXParserFactory");
     }
 
     /**
@@ -76,3 +86,5 @@
         DocumentBuilderFactory.newInstance();
     }
 }
+
+
diff --git a/jaxp/test/javax/xml/jaxp/functional/javax/xml/parsers/ptests/SAXFactoryNewInstanceTest.java b/jaxp/test/javax/xml/jaxp/functional/javax/xml/parsers/ptests/SAXFactoryNewInstanceTest.java
index d2f3561..e4db5b4 100644
--- a/jaxp/test/javax/xml/jaxp/functional/javax/xml/parsers/ptests/SAXFactoryNewInstanceTest.java
+++ b/jaxp/test/javax/xml/jaxp/functional/javax/xml/parsers/ptests/SAXFactoryNewInstanceTest.java
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1999, 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1999, 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
@@ -31,16 +31,21 @@
 import javax.xml.parsers.SAXParserFactory;
 
 import jaxp.library.JAXPDataProvider;
-import jaxp.library.JAXPBaseTest;
 
 import org.testng.annotations.DataProvider;
+import org.testng.annotations.Listeners;
 import org.testng.annotations.Test;
 import org.xml.sax.SAXException;
 
 /*
+ * @test
+ * @library /javax/xml/jaxp/libs
+ * @run testng/othervm -DrunSecMngr=true javax.xml.parsers.ptests.SAXFactoryNewInstanceTest
+ * @run testng/othervm javax.xml.parsers.ptests.SAXFactoryNewInstanceTest
  * @summary Tests for SAXParserFactory.newInstance(factoryClassName , classLoader)
  */
-public class SAXFactoryNewInstanceTest extends JAXPBaseTest {
+@Listeners({jaxp.library.BasePolicy.class})
+public class SAXFactoryNewInstanceTest {
 
     private static final String SAXPARSER_FACTORY_CLASSNAME = "com.sun.org.apache.xerces.internal.jaxp.SAXParserFactoryImpl";
 
@@ -73,3 +78,5 @@
     }
 
 }
+
+
diff --git a/jaxp/test/javax/xml/jaxp/functional/javax/xml/parsers/ptests/SAXParserFactTest.java b/jaxp/test/javax/xml/jaxp/functional/javax/xml/parsers/ptests/SAXParserFactTest.java
index 8c84ed8..6b8245a 100644
--- a/jaxp/test/javax/xml/jaxp/functional/javax/xml/parsers/ptests/SAXParserFactTest.java
+++ b/jaxp/test/javax/xml/jaxp/functional/javax/xml/parsers/ptests/SAXParserFactTest.java
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1999, 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1999, 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
@@ -24,14 +24,23 @@
 package javax.xml.parsers.ptests;
 import static org.testng.Assert.assertFalse;
 import static org.testng.Assert.assertTrue;
+
 import javax.xml.parsers.SAXParserFactory;
-import jaxp.library.JAXPBaseTest;
+
+import org.testng.annotations.Listeners;
 import org.testng.annotations.Test;
 
 /**
  * Class containing the test cases for SAXParserFactory API.
  */
-public class SAXParserFactTest extends JAXPBaseTest {
+/*
+ * @test
+ * @library /javax/xml/jaxp/libs
+ * @run testng/othervm -DrunSecMngr=true javax.xml.parsers.ptests.SAXParserFactTest
+ * @run testng/othervm javax.xml.parsers.ptests.SAXParserFactTest
+ */
+@Listeners({jaxp.library.BasePolicy.class})
+public class SAXParserFactTest {
 
     private static final String NAMESPACES = "http://xml.org/sax/features/namespaces";
     private static final String NAMESPACE_PREFIXES = "http://xml.org/sax/features/namespace-prefixes";
@@ -220,3 +229,5 @@
         assertFalse(spf.getFeature(EXTERNAL_P_ENTITIES));
     }
 }
+
+
diff --git a/jaxp/test/javax/xml/jaxp/functional/javax/xml/parsers/ptests/SAXParserTest.java b/jaxp/test/javax/xml/jaxp/functional/javax/xml/parsers/ptests/SAXParserTest.java
index 920f091..adc1b65 100644
--- a/jaxp/test/javax/xml/jaxp/functional/javax/xml/parsers/ptests/SAXParserTest.java
+++ b/jaxp/test/javax/xml/jaxp/functional/javax/xml/parsers/ptests/SAXParserTest.java
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1999, 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1999, 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
@@ -23,15 +23,23 @@
 
 package javax.xml.parsers.ptests;
 
+import static javax.xml.parsers.ptests.ParserTestConst.XML_DIR;
+import static jaxp.library.JAXPTestUtilities.USER_DIR;
+import static jaxp.library.JAXPTestUtilities.tryRunWithTmpPermission;
+
 import java.io.File;
 import java.io.FileInputStream;
 import java.io.FilePermission;
 import java.io.IOException;
+import java.util.PropertyPermission;
+
 import javax.xml.parsers.SAXParser;
 import javax.xml.parsers.SAXParserFactory;
-import static javax.xml.parsers.ptests.ParserTestConst.XML_DIR;
-import jaxp.library.JAXPFileReadOnlyBaseTest;
+
+import jaxp.library.JAXPTestUtilities;
+
 import org.testng.annotations.DataProvider;
+import org.testng.annotations.Listeners;
 import org.testng.annotations.Test;
 import org.xml.sax.HandlerBase;
 import org.xml.sax.InputSource;
@@ -41,7 +49,14 @@
 /**
  * Class contains the test cases for SAXParser API
  */
-public class SAXParserTest extends JAXPFileReadOnlyBaseTest {
+/*
+ * @test
+ * @library /javax/xml/jaxp/libs
+ * @run testng/othervm -DrunSecMngr=true javax.xml.parsers.ptests.SAXParserTest
+ * @run testng/othervm javax.xml.parsers.ptests.SAXParserTest
+ */
+@Listeners({jaxp.library.FilePolicy.class})
+public class SAXParserTest {
     /**
      * Provide SAXParser.
      *
@@ -92,13 +107,7 @@
     @Test(expectedExceptions = { SAXException.class },
             dataProvider = "parser-provider")
     public void testParse03(SAXParser saxparser) throws Exception {
-        String workingDir = getSystemProperty("user.dir");
-        setPermissions(new FilePermission(workingDir, "read"));
-        try {
-            saxparser.parse("", new HandlerBase());
-        } finally {
-            setPermissions();
-        }
+        saxparser.parse("", new HandlerBase());
     }
 
     /**
@@ -124,13 +133,7 @@
      */
     @Test(expectedExceptions = SAXException.class, dataProvider = "parser-provider")
     public void testParse05(SAXParser saxparser) throws Exception {
-        String workingDir = getSystemProperty("user.dir");
-        setPermissions(new FilePermission(workingDir, "read"));
-        try {
-            saxparser.parse(new File(""), new HandlerBase());
-        } finally {
-            setPermissions();
-        }
+        tryRunWithTmpPermission(() -> saxparser.parse(new File(""), new HandlerBase()), new PropertyPermission("user.dir", "read"));
     }
 
     /**
@@ -176,23 +179,18 @@
     }
 
     /**
-     * Test with non-existence URI, parsing should fail and throw
-     * SAXException or IOException.
+     * Test with non-existence URI, parsing should fail and throw SAXException
+     * or IOException.
      *
-     * @param saxparser a SAXParser instance.
-     * @throws Exception If any errors occur.
+     * @param saxparser
+     *            a SAXParser instance.
+     * @throws Exception
+     *             If any errors occur.
      */
-    @Test(expectedExceptions = { SAXException.class, IOException.class },
-            dataProvider = "parser-provider")
+    @Test(expectedExceptions = { SAXException.class, IOException.class }, dataProvider = "parser-provider")
     public void testParse09(SAXParser saxparser) throws Exception {
-        String workingDir = getSystemProperty("user.dir");
-        setPermissions(new FilePermission(workingDir + "/../-", "read"));
-        String uri = " ";
-        try {
-            saxparser.parse(uri, new DefaultHandler());
-        } finally {
-            setPermissions();
-        }
+        JAXPTestUtilities.tryRunWithTmpPermission(() -> saxparser.parse(" ", new DefaultHandler()),
+                new FilePermission(USER_DIR + " ", "read"));
     }
 
     /**
@@ -204,14 +202,8 @@
      */
     @Test(expectedExceptions = SAXException.class, dataProvider = "parser-provider")
     public void testParse10(SAXParser saxparser) throws Exception {
-        String workingDir = getSystemProperty("user.dir");
-        setPermissions(new FilePermission(workingDir, "read"));
         File file = new File("");
-        try {
-            saxparser.parse(file, new DefaultHandler());
-        } finally {
-            setPermissions();
-        }
+        tryRunWithTmpPermission(() -> saxparser.parse(file, new DefaultHandler()), new PropertyPermission("user.dir", "read"));
     }
 
     /**
@@ -248,7 +240,7 @@
      * @param saxparser a SAXParser instance.
      * @throws Exception If any errors occur.
      */
-    @Test(groups = {"readLocalFiles"}, expectedExceptions = SAXException.class,
+    @Test(expectedExceptions = SAXException.class,
             dataProvider = "parser-provider")
     public void testParse13(SAXParser saxparser) throws Exception {
         try (FileInputStream instream = new FileInputStream(new File(
@@ -263,7 +255,7 @@
      * @param saxparser a SAXParser instance.
      * @throws Exception If any errors occur.
      */
-    @Test(groups = {"readLocalFiles"}, dataProvider = "parser-provider")
+    @Test(dataProvider = "parser-provider")
     public void testParse14(SAXParser saxparser) throws Exception {
         saxparser.parse(new File(XML_DIR, "parsertest.xml"),
                 new HandlerBase());
@@ -276,7 +268,7 @@
      * @param saxparser a SAXParser instance.
      * @throws Exception If any errors occur.
      */
-    @Test(groups = {"readLocalFiles"}, dataProvider = "parser-provider")
+    @Test(dataProvider = "parser-provider")
     public void testParse15(SAXParser saxparser) throws Exception {
         try (FileInputStream instream = new FileInputStream(new File(XML_DIR,
                 "correct.xml"))) {
@@ -291,7 +283,7 @@
      * @param saxparser a SAXParser instance.
      * @throws Exception If any errors occur.
      */
-    @Test(groups = {"readLocalFiles"}, dataProvider = "parser-provider")
+    @Test(dataProvider = "parser-provider")
     public void testParse16(SAXParser saxparser) throws Exception {
         try (FileInputStream instream = new FileInputStream(
                 new File(XML_DIR, "parsertest.xml"))) {
@@ -306,7 +298,7 @@
      * @param saxparser a SAXParser instance.
      * @throws Exception If any errors occur.
      */
-    @Test(groups = {"readLocalFiles"}, dataProvider = "parser-provider")
+    @Test(dataProvider = "parser-provider")
     public void testParse17(SAXParser saxparser) throws Exception {
         File file = new File(XML_DIR, "correct.xml");
         saxparser.parse(file.toURI().toASCIIString(), new HandlerBase());
@@ -319,7 +311,7 @@
      * @param saxparser a SAXParser instance.
      * @throws Exception If any errors occur.
      */
-    @Test(groups = {"readLocalFiles"}, expectedExceptions = SAXException.class,
+    @Test(expectedExceptions = SAXException.class,
             dataProvider = "parser-provider")
     public void testParse18(SAXParser saxparser) throws Exception {
         saxparser.parse(new File(XML_DIR, "valid.xml"), new HandlerBase());
@@ -332,7 +324,7 @@
      * @param saxparser a SAXParser instance.
      * @throws Exception If any errors occur.
      */
-    @Test(groups = {"readLocalFiles"}, dataProvider = "parser-provider")
+    @Test(dataProvider = "parser-provider")
     public void testParse19(SAXParser saxparser) throws Exception {
         saxparser.parse(new File(XML_DIR, "correct.xml"), new HandlerBase());
     }
@@ -344,7 +336,7 @@
      * @param saxparser a SAXParser instance.
      * @throws Exception If any errors occur.
      */
-    @Test(groups = {"readLocalFiles"}, expectedExceptions = SAXException.class,
+    @Test(expectedExceptions = SAXException.class,
             dataProvider = "parser-provider")
     public void testParse20(SAXParser saxparser) throws Exception {
         try(FileInputStream instream = new FileInputStream(new File(XML_DIR,
@@ -360,7 +352,7 @@
      * @param saxparser a SAXParser instance.
      * @throws Exception If any errors occur.
      */
-    @Test(groups = {"readLocalFiles"}, dataProvider = "parser-provider")
+    @Test(dataProvider = "parser-provider")
     public void testParse21(SAXParser saxparser) throws Exception {
         try (FileInputStream instream = new FileInputStream(new File(XML_DIR,
                 "correct.xml"))) {
@@ -375,7 +367,7 @@
      * @param saxparser a SAXParser instance.
      * @throws Exception If any errors occur.
      */
-    @Test(groups = {"readLocalFiles"}, expectedExceptions = SAXException.class,
+    @Test(expectedExceptions = SAXException.class,
             dataProvider = "parser-provider")
     public void testParse22(SAXParser saxparser) throws Exception {
         try (FileInputStream instream = new FileInputStream(
@@ -391,7 +383,7 @@
      * @param saxparser a SAXParser instance.
      * @throws Exception If any errors occur.
      */
-    @Test(groups = {"readLocalFiles"}, dataProvider = "parser-provider")
+    @Test(dataProvider = "parser-provider")
     public void testParse23(SAXParser saxparser) throws Exception {
         DefaultHandler handler = new DefaultHandler();
         saxparser.parse(new File(XML_DIR, "parsertest.xml"), handler);
@@ -404,7 +396,7 @@
      * @param saxparser a SAXParser instance.
      * @throws Exception If any errors occur.
      */
-    @Test(groups = {"readLocalFiles"}, dataProvider = "parser-provider")
+    @Test(dataProvider = "parser-provider")
     public void testParse24(SAXParser saxparser) throws Exception {
         try (FileInputStream instream = new FileInputStream(new File(XML_DIR,
                 "correct.xml"))) {
@@ -420,7 +412,7 @@
      * @param saxparser a SAXParser instance.
      * @throws Exception If any errors occur.
      */
-    @Test(groups = {"readLocalFiles"}, dataProvider = "parser-provider")
+    @Test(dataProvider = "parser-provider")
     public void testParse25(SAXParser saxparser) throws Exception {
         try (FileInputStream instream = new FileInputStream(
                 new File(XML_DIR, "parsertest.xml"))) {
@@ -435,7 +427,7 @@
      * @param saxparser a SAXParser instance.
      * @throws Exception If any errors occur.
      */
-    @Test(groups = {"readLocalFiles"}, dataProvider = "parser-provider")
+    @Test(dataProvider = "parser-provider")
     public void testParse26(SAXParser saxparser) throws Exception {
         File file = new File(XML_DIR, "correct.xml");
         saxparser.parse(file.toURI().toASCIIString(), new DefaultHandler());
@@ -448,7 +440,7 @@
      * @param saxparser a SAXParser instance.
      * @throws Exception If any errors occur.
      */
-    @Test(groups = {"readLocalFiles"}, expectedExceptions = SAXException.class,
+    @Test(expectedExceptions = SAXException.class,
             dataProvider = "parser-provider")
     public void testParse27(SAXParser saxparser) throws Exception {
         saxparser.parse(new File(XML_DIR, "valid.xml"), new DefaultHandler());
@@ -461,7 +453,7 @@
      * @param saxparser a SAXParser instance.
      * @throws Exception If any errors occur.
      */
-    @Test(groups = {"readLocalFiles"}, dataProvider = "parser-provider")
+    @Test(dataProvider = "parser-provider")
     public void testParse28(SAXParser saxparser) throws Exception {
         saxparser.parse(new File(XML_DIR, "correct.xml"), new DefaultHandler());
     }
@@ -472,7 +464,7 @@
      * @param saxparser a SAXParser instance.
      * @throws Exception If any errors occur.
      */
-    @Test(groups = {"readLocalFiles"}, expectedExceptions = SAXException.class,
+    @Test(expectedExceptions = SAXException.class,
             dataProvider = "parser-provider")
     public void testParse29(SAXParser saxparser) throws Exception {
         try (FileInputStream instream = new FileInputStream(
@@ -487,7 +479,7 @@
      * @param saxparser a SAXParser instance.
      * @throws Exception If any errors occur.
      */
-    @Test(groups = {"readLocalFiles"}, dataProvider = "parser-provider")
+    @Test(dataProvider = "parser-provider")
     public void testParse30(SAXParser saxparser) throws Exception {
         try (FileInputStream instream = new FileInputStream(
                 new File(XML_DIR, "correct.xml"))) {
@@ -500,7 +492,7 @@
      *
      * @throws Exception If any errors occur.
      */
-    @Test(groups = {"readLocalFiles"})
+    @Test
     public void testParse31() throws Exception {
         try (FileInputStream instream = new FileInputStream(
                 new File(XML_DIR, "ns4.xml"))) {
@@ -510,3 +502,5 @@
         }
     }
 }
+
+
diff --git a/jaxp/test/javax/xml/jaxp/functional/javax/xml/parsers/ptests/SAXParserTest02.java b/jaxp/test/javax/xml/jaxp/functional/javax/xml/parsers/ptests/SAXParserTest02.java
index c396d73..d7efae1 100644
--- a/jaxp/test/javax/xml/jaxp/functional/javax/xml/parsers/ptests/SAXParserTest02.java
+++ b/jaxp/test/javax/xml/jaxp/functional/javax/xml/parsers/ptests/SAXParserTest02.java
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1999, 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1999, 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
@@ -24,13 +24,15 @@
 package javax.xml.parsers.ptests;
 
 import static org.testng.Assert.assertFalse;
+import static org.testng.Assert.assertNotNull;
 import static org.testng.Assert.assertNull;
 import static org.testng.Assert.assertTrue;
+
 import javax.xml.parsers.SAXParser;
 import javax.xml.parsers.SAXParserFactory;
-import jaxp.library.JAXPBaseTest;
-import static org.testng.Assert.assertNotNull;
+
 import org.testng.annotations.DataProvider;
+import org.testng.annotations.Listeners;
 import org.testng.annotations.Test;
 import org.xml.sax.SAXException;
 import org.xml.sax.SAXNotSupportedException;
@@ -40,7 +42,14 @@
 /**
  * Class contains the test cases for SAXParser API
  */
-public class SAXParserTest02 extends JAXPBaseTest {
+/*
+ * @test
+ * @library /javax/xml/jaxp/libs
+ * @run testng/othervm -DrunSecMngr=true javax.xml.parsers.ptests.SAXParserTest02
+ * @run testng/othervm javax.xml.parsers.ptests.SAXParserTest02
+ */
+@Listeners({jaxp.library.BasePolicy.class})
+public class SAXParserTest02 {
     private static final String DOM_NODE = "http://xml.org/sax/properties/dom-node";
     private static final String XML_STRING = "http://xml.org/sax/properties/xml-string";
     private static final String DECL_HANDLER = "http://xml.org/sax/properties/declaration-handler";
@@ -260,3 +269,5 @@
         }
     }
 }
+
+
diff --git a/jaxp/test/javax/xml/jaxp/functional/javax/xml/parsers/ptests/SAXParserTest03.java b/jaxp/test/javax/xml/jaxp/functional/javax/xml/parsers/ptests/SAXParserTest03.java
index 636b1e2..e16a070 100644
--- a/jaxp/test/javax/xml/jaxp/functional/javax/xml/parsers/ptests/SAXParserTest03.java
+++ b/jaxp/test/javax/xml/jaxp/functional/javax/xml/parsers/ptests/SAXParserTest03.java
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1999, 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1999, 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
@@ -23,25 +23,32 @@
 
 package javax.xml.parsers.ptests;
 
+import static javax.xml.parsers.ptests.ParserTestConst.XML_DIR;
 import static org.testng.Assert.assertFalse;
 import static org.testng.Assert.assertTrue;
+import static org.testng.Assert.fail;
+
 import java.io.File;
-import java.io.FilePermission;
+
 import javax.xml.parsers.SAXParser;
 import javax.xml.parsers.SAXParserFactory;
-import static javax.xml.parsers.ptests.ParserTestConst.XML_DIR;
-import jaxp.library.JAXPFileReadOnlyBaseTest;
-import static org.testng.Assert.fail;
-import org.testng.annotations.AfterGroups;
-import org.testng.annotations.BeforeGroups;
+
 import org.testng.annotations.DataProvider;
+import org.testng.annotations.Listeners;
 import org.testng.annotations.Test;
 import org.xml.sax.SAXException;
 
 /**
  * Class contains the test cases for SAXParser API
  */
-public class SAXParserTest03 extends JAXPFileReadOnlyBaseTest {
+/*
+ * @test
+ * @library /javax/xml/jaxp/libs
+ * @run testng/othervm -DrunSecMngr=true javax.xml.parsers.ptests.SAXParserTest03
+ * @run testng/othervm javax.xml.parsers.ptests.SAXParserTest03
+ */
+@Listeners({jaxp.library.FilePolicy.class})
+public class SAXParserTest03 {
 
     /**
      * Provide SAXParserFactory.
@@ -63,7 +70,7 @@
      * @param handler an error handler for capturing events.
      * @throws Exception If any errors occur.
      */
-    @Test(groups = {"readLocalFiles"}, dataProvider = "input-provider")
+    @Test(dataProvider = "input-provider")
     public void testParseValidate01(SAXParserFactory spf, MyErrorHandler handler)
             throws Exception {
             spf.newSAXParser().parse(new File(XML_DIR, "parsertest.xml"), handler);
@@ -78,7 +85,7 @@
      * @param handler an error handler for capturing events.
      * @throws Exception If any errors occur.
      */
-    @Test(groups = {"readLocalFiles"}, dataProvider = "input-provider")
+    @Test(dataProvider = "input-provider")
     public void testParseValidate02(SAXParserFactory spf, MyErrorHandler handler)
             throws Exception {
             spf.setNamespaceAware(true);
@@ -95,7 +102,7 @@
      * @param handler an error handler for capturing events.
      * @throws Exception If any errors occur.
      */
-    @Test(groups = {"readLocalFiles"}, dataProvider = "input-provider")
+    @Test(dataProvider = "input-provider")
     public void testParseValidate03(SAXParserFactory spf, MyErrorHandler handler)
             throws Exception {
         try {
@@ -109,3 +116,5 @@
     }
 
 }
+
+
diff --git a/jaxp/test/javax/xml/jaxp/functional/javax/xml/stream/ptests/XMLEventFactoryNewInstanceTest.java b/jaxp/test/javax/xml/jaxp/functional/javax/xml/stream/ptests/XMLEventFactoryNewInstanceTest.java
index eb991f0..9d588c3 100644
--- a/jaxp/test/javax/xml/jaxp/functional/javax/xml/stream/ptests/XMLEventFactoryNewInstanceTest.java
+++ b/jaxp/test/javax/xml/jaxp/functional/javax/xml/stream/ptests/XMLEventFactoryNewInstanceTest.java
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1999, 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1999, 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
@@ -23,20 +23,28 @@
 
 package javax.xml.stream.ptests;
 
+import static jaxp.library.JAXPTestUtilities.setSystemProperty;
+import static jaxp.library.JAXPTestUtilities.clearSystemProperty;
+
 import static org.testng.Assert.assertNotNull;
 
 import javax.xml.stream.XMLEventFactory;
 
 import jaxp.library.JAXPDataProvider;
-import jaxp.library.JAXPBaseTest;
 
 import org.testng.annotations.DataProvider;
+import org.testng.annotations.Listeners;
 import org.testng.annotations.Test;
 
 /*
+ * @test
+ * @library /javax/xml/jaxp/libs
+ * @run testng/othervm -DrunSecMngr=true javax.xml.stream.ptests.XMLEventFactoryNewInstanceTest
+ * @run testng/othervm javax.xml.stream.ptests.XMLEventFactoryNewInstanceTest
  * @summary Tests for XMLEventFactory.newFactory(factoryId , classLoader)
  */
-public class XMLEventFactoryNewInstanceTest extends JAXPBaseTest {
+@Listeners({jaxp.library.BasePolicy.class})
+public class XMLEventFactoryNewInstanceTest {
 
     private static final String XMLEVENT_FACTORY_CLASSNAME = "com.sun.xml.internal.stream.events.XMLEventFactoryImpl";
     private static final String XMLEVENT_FACRORY_ID = "javax.xml.stream.XMLEventFactory";
@@ -59,7 +67,7 @@
             XMLEventFactory xef = XMLEventFactory.newFactory(factoryId, classLoader);
             assertNotNull(xef);
         } finally {
-            setSystemProperty(XMLEVENT_FACRORY_ID, null);
+            clearSystemProperty(XMLEVENT_FACRORY_ID);
         }
     }
 
@@ -74,3 +82,4 @@
     }
 
 }
+
diff --git a/jaxp/test/javax/xml/jaxp/functional/javax/xml/stream/ptests/XMLInputFactoryNewInstanceTest.java b/jaxp/test/javax/xml/jaxp/functional/javax/xml/stream/ptests/XMLInputFactoryNewInstanceTest.java
index 0d5afe3..b983d76 100644
--- a/jaxp/test/javax/xml/jaxp/functional/javax/xml/stream/ptests/XMLInputFactoryNewInstanceTest.java
+++ b/jaxp/test/javax/xml/jaxp/functional/javax/xml/stream/ptests/XMLInputFactoryNewInstanceTest.java
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1999, 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1999, 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
@@ -23,20 +23,28 @@
 
 package javax.xml.stream.ptests;
 
+import static jaxp.library.JAXPTestUtilities.setSystemProperty;
+import static jaxp.library.JAXPTestUtilities.clearSystemProperty;
+
 import static org.testng.Assert.assertNotNull;
 
 import javax.xml.stream.XMLInputFactory;
 
 import jaxp.library.JAXPDataProvider;
-import jaxp.library.JAXPBaseTest;
 
 import org.testng.annotations.DataProvider;
+import org.testng.annotations.Listeners;
 import org.testng.annotations.Test;
 
 /*
+ * @test
+ * @library /javax/xml/jaxp/libs
+ * @run testng/othervm -DrunSecMngr=true javax.xml.stream.ptests.XMLInputFactoryNewInstanceTest
+ * @run testng/othervm javax.xml.stream.ptests.XMLInputFactoryNewInstanceTest
  * @summary Tests for XMLInputFactory.newFactory(factoryId , classLoader)
  */
-public class XMLInputFactoryNewInstanceTest extends JAXPBaseTest {
+@Listeners({jaxp.library.BasePolicy.class})
+public class XMLInputFactoryNewInstanceTest {
 
     private static final String XMLINPUT_FACTORY_CLASSNAME = "com.sun.xml.internal.stream.XMLInputFactoryImpl";
     private static final String XMLINPUT_FACRORY_ID = "javax.xml.stream.XMLInputFactory";
@@ -59,7 +67,7 @@
             XMLInputFactory xif = XMLInputFactory.newFactory(factoryId, classLoader);
             assertNotNull(xif);
         } finally {
-            setSystemProperty(XMLINPUT_FACRORY_ID, null);
+            clearSystemProperty(XMLINPUT_FACRORY_ID);
         }
     }
 
@@ -74,3 +82,4 @@
     }
 
 }
+
diff --git a/jaxp/test/javax/xml/jaxp/functional/javax/xml/transform/ptests/Bug6384418Test.java b/jaxp/test/javax/xml/jaxp/functional/javax/xml/transform/ptests/Bug6384418Test.java
index bb227d3..8fce6a8 100644
--- a/jaxp/test/javax/xml/jaxp/functional/javax/xml/transform/ptests/Bug6384418Test.java
+++ b/jaxp/test/javax/xml/jaxp/functional/javax/xml/transform/ptests/Bug6384418Test.java
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1999, 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1999, 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
@@ -23,6 +23,8 @@
 
 package javax.xml.transform.ptests;
 
+import static javax.xml.transform.ptests.TransformerTestConst.XML_DIR;
+
 import java.io.ByteArrayOutputStream;
 import java.io.File;
 
@@ -34,17 +36,20 @@
 import javax.xml.transform.stream.StreamResult;
 import javax.xml.transform.stream.StreamSource;
 
-import jaxp.library.JAXPFileBaseTest;
-import static javax.xml.transform.ptests.TransformerTestConst.XML_DIR;
-
+import org.testng.annotations.Listeners;
 import org.testng.annotations.Test;
 import org.w3c.dom.Document;
 
 /*
+ * @test
  * @bug 6384418
+ * @library /javax/xml/jaxp/libs
+ * @run testng/othervm -DrunSecMngr=true javax.xml.transform.ptests.Bug6384418Test
+ * @run testng/othervm javax.xml.transform.ptests.Bug6384418Test
  * @summary verify the transforming won't throw any exception
  */
-public class Bug6384418Test extends JAXPFileBaseTest {
+@Listeners({jaxp.library.FilePolicy.class})
+public class Bug6384418Test {
 
     @Test
     public void test() throws Exception {
@@ -62,3 +67,5 @@
     }
 
 }
+
+
diff --git a/jaxp/test/javax/xml/jaxp/functional/javax/xml/transform/ptests/DOMResultTest.java b/jaxp/test/javax/xml/jaxp/functional/javax/xml/transform/ptests/DOMResultTest.java
index 42069ea..b1a86f7 100644
--- a/jaxp/test/javax/xml/jaxp/functional/javax/xml/transform/ptests/DOMResultTest.java
+++ b/jaxp/test/javax/xml/jaxp/functional/javax/xml/transform/ptests/DOMResultTest.java
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2003, 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2003, 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
@@ -23,20 +23,23 @@
 
 package javax.xml.transform.ptests;
 
-import java.io.BufferedWriter;
-import java.io.FileWriter;
-import java.io.IOException;
-import javax.xml.transform.TransformerFactory;
-import javax.xml.transform.dom.DOMResult;
 import static javax.xml.transform.ptests.TransformerTestConst.GOLDEN_DIR;
 import static javax.xml.transform.ptests.TransformerTestConst.XML_DIR;
-import javax.xml.transform.sax.SAXSource;
-import javax.xml.transform.sax.SAXTransformerFactory;
-import javax.xml.transform.sax.TransformerHandler;
-import jaxp.library.JAXPFileBaseTest;
 import static jaxp.library.JAXPTestUtilities.USER_DIR;
 import static jaxp.library.JAXPTestUtilities.compareWithGold;
 import static org.testng.Assert.assertTrue;
+
+import java.io.BufferedWriter;
+import java.io.FileWriter;
+import java.io.IOException;
+
+import javax.xml.transform.TransformerFactory;
+import javax.xml.transform.dom.DOMResult;
+import javax.xml.transform.sax.SAXSource;
+import javax.xml.transform.sax.SAXTransformerFactory;
+import javax.xml.transform.sax.TransformerHandler;
+
+import org.testng.annotations.Listeners;
 import org.testng.annotations.Test;
 import org.w3c.dom.Attr;
 import org.w3c.dom.NamedNodeMap;
@@ -50,7 +53,14 @@
  * DOM parse on test file to be compared with golden output file. No Exception
  * is expected.
  */
-public class DOMResultTest extends JAXPFileBaseTest {
+/*
+ * @test
+ * @library /javax/xml/jaxp/libs
+ * @run testng/othervm -DrunSecMngr=true javax.xml.transform.ptests.DOMResultTest
+ * @run testng/othervm javax.xml.transform.ptests.DOMResultTest
+ */
+@Listeners({jaxp.library.FilePolicy.class})
+public class DOMResultTest {
     /**
      * Unit test for simple DOM parsing.
      * @throws Exception If any errors occur.
@@ -108,3 +118,5 @@
                 writeNodes(kids.item(i), bWriter);
     }
 }
+
+
diff --git a/jaxp/test/javax/xml/jaxp/functional/javax/xml/transform/ptests/ErrorListenerTest.java b/jaxp/test/javax/xml/jaxp/functional/javax/xml/transform/ptests/ErrorListenerTest.java
index 1941783..7d01e52 100644
--- a/jaxp/test/javax/xml/jaxp/functional/javax/xml/transform/ptests/ErrorListenerTest.java
+++ b/jaxp/test/javax/xml/jaxp/functional/javax/xml/transform/ptests/ErrorListenerTest.java
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2003, 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2003, 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
@@ -23,23 +23,32 @@
 
 package javax.xml.transform.ptests;
 
+import static javax.xml.transform.ptests.TransformerTestConst.XML_DIR;
+import static org.testng.Assert.assertEquals;
+import static org.testng.Assert.fail;
+
 import java.io.File;
-import java.io.FilePermission;
+
 import javax.xml.transform.ErrorListener;
 import javax.xml.transform.TransformerConfigurationException;
 import javax.xml.transform.TransformerException;
 import javax.xml.transform.TransformerFactory;
-import static javax.xml.transform.ptests.TransformerTestConst.XML_DIR;
 import javax.xml.transform.stream.StreamSource;
-import jaxp.library.JAXPBaseTest;
-import static org.testng.Assert.assertEquals;
-import static org.testng.Assert.fail;
+
+import org.testng.annotations.Listeners;
 import org.testng.annotations.Test;
 
 /**
  * Class containing the test cases for ErrorListener interface
  */
-public class ErrorListenerTest extends JAXPBaseTest implements ErrorListener {
+/*
+ * @test
+ * @library /javax/xml/jaxp/libs
+ * @run testng/othervm -DrunSecMngr=true javax.xml.transform.ptests.ErrorListenerTest
+ * @run testng/othervm javax.xml.transform.ptests.ErrorListenerTest
+ */
+@Listeners({jaxp.library.FilePolicy.class})
+public class ErrorListenerTest implements ErrorListener {
     /**
      * Define ErrorListener's status.
      */
@@ -60,7 +69,6 @@
         try {
             TransformerFactory tfactory = TransformerFactory.newInstance();
             tfactory.setErrorListener (listener);
-            setPermissions(new FilePermission(XML_DIR + "invalid.xsl", "read"));
             tfactory.newTransformer(new StreamSource(
                                         new File(XML_DIR + "invalid.xsl")));
             fail("Expect TransformerConfigurationException here");
@@ -96,3 +104,5 @@
         this.status = ListenerStatus.FATAL;
     }
 }
+
+
diff --git a/jaxp/test/javax/xml/jaxp/functional/javax/xml/transform/ptests/SAXSourceTest.java b/jaxp/test/javax/xml/jaxp/functional/javax/xml/transform/ptests/SAXSourceTest.java
index ca4c67e..81f97cd 100644
--- a/jaxp/test/javax/xml/jaxp/functional/javax/xml/transform/ptests/SAXSourceTest.java
+++ b/jaxp/test/javax/xml/jaxp/functional/javax/xml/transform/ptests/SAXSourceTest.java
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2003, 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2003, 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
@@ -23,18 +23,21 @@
 
 package javax.xml.transform.ptests;
 
-import java.io.File;
-import java.io.FileInputStream;
-import java.io.IOException;
-import javax.xml.parsers.DocumentBuilderFactory;
-import javax.xml.transform.dom.DOMSource;
 import static javax.xml.transform.ptests.TransformerTestConst.XML_DIR;
-import javax.xml.transform.sax.SAXSource;
-import javax.xml.transform.stream.StreamSource;
-import jaxp.library.JAXPFileReadOnlyBaseTest;
 import static org.testng.Assert.assertEquals;
 import static org.testng.Assert.assertNotNull;
 import static org.testng.Assert.assertNull;
+
+import java.io.File;
+import java.io.FileInputStream;
+import java.io.IOException;
+
+import javax.xml.parsers.DocumentBuilderFactory;
+import javax.xml.transform.dom.DOMSource;
+import javax.xml.transform.sax.SAXSource;
+import javax.xml.transform.stream.StreamSource;
+
+import org.testng.annotations.Listeners;
 import org.testng.annotations.Test;
 import org.xml.sax.InputSource;
 
@@ -42,7 +45,14 @@
 /**
  * Unit test for SAXSource sourceToInputSource API.
  */
-public class SAXSourceTest extends JAXPFileReadOnlyBaseTest {
+/*
+ * @test
+ * @library /javax/xml/jaxp/libs
+ * @run testng/othervm -DrunSecMngr=true javax.xml.transform.ptests.SAXSourceTest
+ * @run testng/othervm javax.xml.transform.ptests.SAXSourceTest
+ */
+@Listeners({jaxp.library.FilePolicy.class})
+public class SAXSourceTest {
     /**
      * Test style-sheet file name
      */
@@ -53,7 +63,7 @@
      *
      * @throws IOException reading file error.
      */
-    @Test(groups = {"readLocalFiles"})
+    @Test
     public void source2inputsource01() throws IOException {
         try (FileInputStream fis = new FileInputStream(TEST_FILE)) {
             StreamSource streamSource = new StreamSource(fis);
@@ -68,7 +78,7 @@
      *
      * @throws Exception If any errors occur.
      */
-    @Test(groups = {"readLocalFiles"})
+    @Test
     public void source2inputsource02() throws Exception {
         DocumentBuilderFactory dbf = DocumentBuilderFactory.newInstance();
         dbf.setNamespaceAware(true);
@@ -83,7 +93,7 @@
      *
      * @throws IOException reading file error.
      */
-    @Test(groups = {"readLocalFiles"})
+    @Test
     public void source2inputsource03() throws IOException {
         String SYSTEM_ID = "file:///" + XML_DIR;
         try (FileInputStream fis = new FileInputStream(TEST_FILE)) {
@@ -95,3 +105,5 @@
         }
     }
 }
+
+
diff --git a/jaxp/test/javax/xml/jaxp/functional/javax/xml/transform/ptests/SAXTFactoryTest.java b/jaxp/test/javax/xml/jaxp/functional/javax/xml/transform/ptests/SAXTFactoryTest.java
index 60da93a..4721e7c 100644
--- a/jaxp/test/javax/xml/jaxp/functional/javax/xml/transform/ptests/SAXTFactoryTest.java
+++ b/jaxp/test/javax/xml/jaxp/functional/javax/xml/transform/ptests/SAXTFactoryTest.java
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2003, 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2003, 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
@@ -23,27 +23,30 @@
 
 package javax.xml.transform.ptests;
 
+import static javax.xml.transform.ptests.TransformerTestConst.GOLDEN_DIR;
+import static javax.xml.transform.ptests.TransformerTestConst.XML_DIR;
+import static jaxp.library.JAXPTestUtilities.USER_DIR;
+import static jaxp.library.JAXPTestUtilities.compareWithGold;
+import static org.testng.Assert.assertTrue;
+
 import java.io.File;
 import java.io.FileInputStream;
 import java.io.FileOutputStream;
+
 import javax.xml.parsers.DocumentBuilder;
 import javax.xml.parsers.DocumentBuilderFactory;
 import javax.xml.transform.Result;
 import javax.xml.transform.TransformerConfigurationException;
 import javax.xml.transform.TransformerFactory;
 import javax.xml.transform.dom.DOMSource;
-import static javax.xml.transform.ptests.TransformerTestConst.GOLDEN_DIR;
-import static javax.xml.transform.ptests.TransformerTestConst.XML_DIR;
 import javax.xml.transform.sax.SAXSource;
 import javax.xml.transform.sax.SAXTransformerFactory;
 import javax.xml.transform.sax.TemplatesHandler;
 import javax.xml.transform.sax.TransformerHandler;
 import javax.xml.transform.stream.StreamResult;
 import javax.xml.transform.stream.StreamSource;
-import jaxp.library.JAXPFileBaseTest;
-import static jaxp.library.JAXPTestUtilities.USER_DIR;
-import static jaxp.library.JAXPTestUtilities.compareWithGold;
-import static org.testng.Assert.assertTrue;
+
+import org.testng.annotations.Listeners;
 import org.testng.annotations.Test;
 import org.w3c.dom.Document;
 import org.w3c.dom.Node;
@@ -56,7 +59,14 @@
  * Test newTransformerhandler() method which takes StreamSource as argument can
  * be set to XMLReader.
  */
-public class SAXTFactoryTest extends JAXPFileBaseTest {
+/*
+ * @test
+ * @library /javax/xml/jaxp/libs
+ * @run testng/othervm -DrunSecMngr=true javax.xml.transform.ptests.SAXTFactoryTest
+ * @run testng/othervm javax.xml.transform.ptests.SAXTFactoryTest
+ */
+@Listeners({jaxp.library.FilePolicy.class})
+public class SAXTFactoryTest {
     /**
      * Test style-sheet file.
      */
@@ -421,3 +431,5 @@
         assertTrue(compareWithGold(goldFile, outputFile));
     }
 }
+
+
diff --git a/jaxp/test/javax/xml/jaxp/functional/javax/xml/transform/ptests/StreamResultTest.java b/jaxp/test/javax/xml/jaxp/functional/javax/xml/transform/ptests/StreamResultTest.java
index 9ff71b9..832c538 100644
--- a/jaxp/test/javax/xml/jaxp/functional/javax/xml/transform/ptests/StreamResultTest.java
+++ b/jaxp/test/javax/xml/jaxp/functional/javax/xml/transform/ptests/StreamResultTest.java
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2003, 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2003, 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
@@ -22,11 +22,16 @@
  */
 package javax.xml.transform.ptests;
 
+import static javax.xml.transform.ptests.TransformerTestConst.XML_DIR;
+import static jaxp.library.JAXPTestUtilities.USER_DIR;
+import static jaxp.library.JAXPTestUtilities.failUnexpected;
+
 import java.io.File;
 import java.io.FileInputStream;
 import java.io.IOException;
 import java.util.Arrays;
 import java.util.Properties;
+
 import javax.xml.parsers.DocumentBuilder;
 import javax.xml.parsers.DocumentBuilderFactory;
 import javax.xml.parsers.ParserConfigurationException;
@@ -34,12 +39,10 @@
 import javax.xml.transform.TransformerException;
 import javax.xml.transform.TransformerFactory;
 import javax.xml.transform.dom.DOMSource;
-import static javax.xml.transform.ptests.TransformerTestConst.XML_DIR;
 import javax.xml.transform.stream.StreamResult;
 import javax.xml.transform.stream.StreamSource;
-import jaxp.library.JAXPFileBaseTest;
-import static jaxp.library.JAXPTestUtilities.USER_DIR;
-import static jaxp.library.JAXPTestUtilities.failUnexpected;
+
+import org.testng.annotations.Listeners;
 import org.testng.annotations.Test;
 import org.w3c.dom.Document;
 import org.xml.sax.SAXException;
@@ -48,7 +51,14 @@
  * Test a StreamResult using a file name that contains URL characters that need
  * to be encoded.
  */
-public class StreamResultTest extends JAXPFileBaseTest {
+/*
+ * @test
+ * @library /javax/xml/jaxp/libs
+ * @run testng/othervm -DrunSecMngr=true javax.xml.transform.ptests.StreamResultTest
+ * @run testng/othervm javax.xml.transform.ptests.StreamResultTest
+ */
+@Listeners({jaxp.library.FilePolicy.class})
+public class StreamResultTest {
     /**
      * Unit test for StreamResult.
      */
@@ -96,3 +106,5 @@
         });
     }
 }
+
+
diff --git a/jaxp/test/javax/xml/jaxp/functional/javax/xml/transform/ptests/TfClearParamTest.java b/jaxp/test/javax/xml/jaxp/functional/javax/xml/transform/ptests/TfClearParamTest.java
index 0238497..b30cd90 100644
--- a/jaxp/test/javax/xml/jaxp/functional/javax/xml/transform/ptests/TfClearParamTest.java
+++ b/jaxp/test/javax/xml/jaxp/functional/javax/xml/transform/ptests/TfClearParamTest.java
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2003, 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2003, 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
@@ -22,20 +22,23 @@
  */
 package javax.xml.transform.ptests;
 
+import static javax.xml.transform.ptests.TransformerTestConst.XML_DIR;
+import static org.testng.Assert.assertEquals;
+import static org.testng.Assert.assertNull;
+
 import java.io.File;
 import java.io.FileInputStream;
+
 import javax.xml.parsers.DocumentBuilder;
 import javax.xml.parsers.DocumentBuilderFactory;
 import javax.xml.transform.Transformer;
 import javax.xml.transform.TransformerConfigurationException;
 import javax.xml.transform.TransformerFactory;
 import javax.xml.transform.dom.DOMSource;
-import static javax.xml.transform.ptests.TransformerTestConst.XML_DIR;
 import javax.xml.transform.sax.SAXSource;
 import javax.xml.transform.stream.StreamSource;
-import jaxp.library.JAXPFileReadOnlyBaseTest;
-import static org.testng.Assert.assertEquals;
-import static org.testng.Assert.assertNull;
+
+import org.testng.annotations.Listeners;
 import org.testng.annotations.Test;
 import org.w3c.dom.Document;
 import org.w3c.dom.Node;
@@ -44,7 +47,14 @@
 /**
  * Class containing the test cases for SAXParserFactory API
  */
-public class TfClearParamTest extends JAXPFileReadOnlyBaseTest {
+/*
+ * @test
+ * @library /javax/xml/jaxp/libs
+ * @run testng/othervm -DrunSecMngr=true javax.xml.transform.ptests.TfClearParamTest
+ * @run testng/othervm javax.xml.transform.ptests.TfClearParamTest
+ */
+@Listeners({jaxp.library.FilePolicy.class})
+public class TfClearParamTest {
     /**
      * Test style-sheet file name.
      */
@@ -128,7 +138,7 @@
      * @throws TransformerConfigurationException If for some reason the
      *         TransformerHandler can not be created.
      */
-    @Test (groups = {"readLocalFiles"})
+    @Test
     public void clear05() throws TransformerConfigurationException {
         Transformer transformer = TransformerFactory.newInstance().
                 newTransformer(new StreamSource(new File(XSL_FILE)));
@@ -143,7 +153,7 @@
      * @throws TransformerConfigurationException If for some reason the
      *         TransformerHandler can not be created.
      */
-    @Test (groups = {"readLocalFiles"})
+    @Test
     public void clear06() throws TransformerConfigurationException {
         Transformer transformer = TransformerFactory.newInstance().
                 newTransformer(new StreamSource(new File(XSL_FILE)));
@@ -157,7 +167,7 @@
      * the a name that set before. Value should be same as set one.
      * @throws Exception If any errors occur.
      */
-    @Test (groups = {"readLocalFiles"})
+    @Test
     public void clear07() throws Exception {
         try (FileInputStream fis = new FileInputStream(XSL_FILE)) {
             SAXSource saxSource = new SAXSource();
@@ -174,7 +184,7 @@
      * the a name that wasn't set before. Null is expected.
      * @throws Exception If any errors occur.
      */
-    @Test (groups = {"readLocalFiles"})
+    @Test
     public void clear08() throws Exception {
         try (FileInputStream fis = new FileInputStream(XSL_FILE)) {
             SAXSource saxSource = new SAXSource();
@@ -192,7 +202,7 @@
      * the a name that set before. Value should be same as set one.
      * @throws Exception If any errors occur.
      */
-    @Test (groups = {"readLocalFiles"})
+    @Test
     public void clear09() throws Exception {
         TransformerFactory tfactory = TransformerFactory.newInstance();
 
@@ -213,7 +223,7 @@
      * the a name that wasn't set before. Null is expected.
      * @throws Exception If any errors occur.
      */
-    @Test (groups = {"readLocalFiles"})
+    @Test
     public void clear10() throws Exception {
         TransformerFactory tfactory = TransformerFactory.newInstance();
 
@@ -229,3 +239,5 @@
         assertNull(transformer.getParameter(LONG_PARAM_NAME));
     }
 }
+
+
diff --git a/jaxp/test/javax/xml/jaxp/functional/javax/xml/transform/ptests/TransformTest.java b/jaxp/test/javax/xml/jaxp/functional/javax/xml/transform/ptests/TransformTest.java
index 417f641..038bb16 100644
--- a/jaxp/test/javax/xml/jaxp/functional/javax/xml/transform/ptests/TransformTest.java
+++ b/jaxp/test/javax/xml/jaxp/functional/javax/xml/transform/ptests/TransformTest.java
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1999, 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1999, 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
@@ -38,7 +38,6 @@
 
 import javax.xml.parsers.DocumentBuilder;
 import javax.xml.parsers.DocumentBuilderFactory;
-import javax.xml.parsers.ParserConfigurationException;
 import javax.xml.stream.XMLEventWriter;
 import javax.xml.stream.XMLInputFactory;
 import javax.xml.stream.XMLOutputFactory;
@@ -58,10 +57,9 @@
 import javax.xml.transform.stream.StreamResult;
 import javax.xml.transform.stream.StreamSource;
 
-import jaxp.library.JAXPFileBaseTest;
-
 import org.testng.annotations.BeforeClass;
 import org.testng.annotations.DataProvider;
+import org.testng.annotations.Listeners;
 import org.testng.annotations.Test;
 import org.w3c.dom.Document;
 import org.xml.sax.Attributes;
@@ -71,10 +69,15 @@
 import org.xml.sax.SAXException;
 
 /*
+ * @test
+ * @library /javax/xml/jaxp/libs
+ * @run testng/othervm -DrunSecMngr=true javax.xml.transform.ptests.TransformTest
+ * @run testng/othervm javax.xml.transform.ptests.TransformTest
  * @summary Tests for variable combination of Transformer.transform(Source, Result)
  */
 @Test(singleThreaded = true)
-public class TransformTest extends JAXPFileBaseTest {
+@Listeners({jaxp.library.FilePolicy.class})
+public class TransformTest {
 
     /*
      * Initialize the share objects.
@@ -381,3 +384,5 @@
     private Document xmlDoc;
 
 }
+
+
diff --git a/jaxp/test/javax/xml/jaxp/functional/javax/xml/transform/ptests/TransformerExcpTest.java b/jaxp/test/javax/xml/jaxp/functional/javax/xml/transform/ptests/TransformerExcpTest.java
index 1a936cb..58d6076 100644
--- a/jaxp/test/javax/xml/jaxp/functional/javax/xml/transform/ptests/TransformerExcpTest.java
+++ b/jaxp/test/javax/xml/jaxp/functional/javax/xml/transform/ptests/TransformerExcpTest.java
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2003, 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2003, 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
@@ -22,32 +22,40 @@
  */
 package javax.xml.transform.ptests;
 
-import java.io.File;
-import java.io.FilePermission;
-import javax.xml.transform.Transformer;
-import javax.xml.transform.TransformerException;
-import javax.xml.transform.TransformerFactory;
 import static javax.xml.transform.ptests.TransformerTestConst.XML_DIR;
-import javax.xml.transform.sax.SAXResult;
-import javax.xml.transform.stream.StreamSource;
-import jaxp.library.JAXPBaseTest;
 import static org.testng.Assert.assertEquals;
 import static org.testng.Assert.assertNotNull;
 import static org.testng.Assert.assertNull;
 import static org.testng.Assert.fail;
+
+import java.io.File;
+
+import javax.xml.transform.Transformer;
+import javax.xml.transform.TransformerException;
+import javax.xml.transform.TransformerFactory;
+import javax.xml.transform.sax.SAXResult;
+import javax.xml.transform.stream.StreamSource;
+
+import org.testng.annotations.Listeners;
 import org.testng.annotations.Test;
 
 /**
  *  Basic test for TransformerException specification.
  */
-public class TransformerExcpTest extends JAXPBaseTest {
+/*
+ * @test
+ * @library /javax/xml/jaxp/libs
+ * @run testng/othervm -DrunSecMngr=true javax.xml.transform.ptests.TransformerExcpTest
+ * @run testng/othervm javax.xml.transform.ptests.TransformerExcpTest
+ */
+@Listeners({jaxp.library.FilePolicy.class})
+public class TransformerExcpTest {
     /**
      * Transform an unformatted style-sheet file. TransformerException is thrown.
      */
     @Test
     public void tfexception() {
         try {
-            setPermissions(new FilePermission(XML_DIR  + "-", "read"));
             // invalid.xsl has well-formedness error. Therefore transform throws
             // TransformerException
             StreamSource streamSource
@@ -63,8 +71,6 @@
             assertNotNull(e.getException());
             assertNull(e.getLocationAsString());
             assertEquals(e.getMessageAndLocation(),e.getMessage());
-        } finally {
-            setPermissions();
         }
     }
 
@@ -99,3 +105,5 @@
         assertNotNull(te.initCause(null));
     }
 }
+
+
diff --git a/jaxp/test/javax/xml/jaxp/functional/javax/xml/transform/ptests/TransformerFactoryTest.java b/jaxp/test/javax/xml/jaxp/functional/javax/xml/transform/ptests/TransformerFactoryTest.java
index 7324b1c..ae8a2bc 100644
--- a/jaxp/test/javax/xml/jaxp/functional/javax/xml/transform/ptests/TransformerFactoryTest.java
+++ b/jaxp/test/javax/xml/jaxp/functional/javax/xml/transform/ptests/TransformerFactoryTest.java
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2003, 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2003, 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
@@ -22,33 +22,45 @@
  */
 package javax.xml.transform.ptests;
 
-import java.io.*;
-
-import javax.xml.parsers.*;
-import javax.xml.transform.*;
-import javax.xml.transform.dom.*;
-
 import static javax.xml.transform.ptests.TransformerTestConst.GOLDEN_DIR;
 import static javax.xml.transform.ptests.TransformerTestConst.XML_DIR;
-
-import javax.xml.transform.stream.*;
-
-import jaxp.library.JAXPDataProvider;
-import jaxp.library.JAXPFileBaseTest;
 import static jaxp.library.JAXPTestUtilities.USER_DIR;
 import static jaxp.library.JAXPTestUtilities.compareWithGold;
 import static org.testng.Assert.assertNotNull;
 import static org.testng.Assert.assertTrue;
 
+import java.io.FileInputStream;
+import java.io.FileOutputStream;
+
+import javax.xml.parsers.DocumentBuilder;
+import javax.xml.parsers.DocumentBuilderFactory;
+import javax.xml.transform.Source;
+import javax.xml.transform.Transformer;
+import javax.xml.transform.TransformerConfigurationException;
+import javax.xml.transform.TransformerFactory;
+import javax.xml.transform.TransformerFactoryConfigurationError;
+import javax.xml.transform.dom.DOMSource;
+import javax.xml.transform.stream.StreamResult;
+
+import jaxp.library.JAXPDataProvider;
+
 import org.testng.annotations.DataProvider;
+import org.testng.annotations.Listeners;
 import org.testng.annotations.Test;
-import org.w3c.dom.*;
+import org.w3c.dom.Document;
 
 /**
  * Class containing the test cases for TransformerFactory API's
  * getAssociatedStyleSheet method and TransformerFactory.newInstance(factoryClassName , classLoader).
  */
-public class TransformerFactoryTest extends JAXPFileBaseTest {
+/*
+ * @test
+ * @library /javax/xml/jaxp/libs
+ * @run testng/othervm -DrunSecMngr=true javax.xml.transform.ptests.TransformerFactoryTest
+ * @run testng/othervm javax.xml.transform.ptests.TransformerFactoryTest
+ */
+@Listeners({jaxp.library.FilePolicy.class})
+public class TransformerFactoryTest {
     /**
      * TransformerFactory implementation class name.
      */
@@ -129,3 +141,5 @@
         assertTrue(compareWithGold(goldFile, outputFile));
     }
 }
+
+
diff --git a/jaxp/test/javax/xml/jaxp/functional/javax/xml/transform/ptests/TransformerTest.java b/jaxp/test/javax/xml/jaxp/functional/javax/xml/transform/ptests/TransformerTest.java
index 8e718b0..a8d7e47 100644
--- a/jaxp/test/javax/xml/jaxp/functional/javax/xml/transform/ptests/TransformerTest.java
+++ b/jaxp/test/javax/xml/jaxp/functional/javax/xml/transform/ptests/TransformerTest.java
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2003, 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2003, 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
@@ -22,9 +22,15 @@
  */
 package javax.xml.transform.ptests;
 
+import static javax.xml.transform.ptests.TransformerTestConst.XML_DIR;
+import static org.testng.Assert.assertEquals;
+import static org.testng.Assert.assertNotNull;
+import static org.testng.Assert.assertTrue;
+
 import java.io.File;
 import java.io.FileInputStream;
 import java.util.Properties;
+
 import javax.xml.parsers.DocumentBuilder;
 import javax.xml.parsers.DocumentBuilderFactory;
 import javax.xml.transform.ErrorListener;
@@ -33,13 +39,10 @@
 import javax.xml.transform.TransformerException;
 import javax.xml.transform.TransformerFactory;
 import javax.xml.transform.dom.DOMSource;
-import static javax.xml.transform.ptests.TransformerTestConst.XML_DIR;
 import javax.xml.transform.sax.SAXSource;
 import javax.xml.transform.stream.StreamSource;
-import jaxp.library.JAXPFileReadOnlyBaseTest;
-import static org.testng.Assert.assertEquals;
-import static org.testng.Assert.assertNotNull;
-import static org.testng.Assert.assertTrue;
+
+import org.testng.annotations.Listeners;
 import org.testng.annotations.Test;
 import org.w3c.dom.Document;
 import org.xml.sax.InputSource;
@@ -47,7 +50,14 @@
 /**
  * Basic test cases for Transformer API
  */
-public class TransformerTest extends JAXPFileReadOnlyBaseTest {
+/*
+ * @test
+ * @library /javax/xml/jaxp/libs
+ * @run testng/othervm -DrunSecMngr=true javax.xml.transform.ptests.TransformerTest
+ * @run testng/othervm javax.xml.transform.ptests.TransformerTest
+ */
+@Listeners({jaxp.library.FilePolicy.class})
+public class TransformerTest {
     /**
      * XSLT file serves every test method.
      */
@@ -58,7 +68,7 @@
      * @throws TransformerConfigurationException If for some reason the
      *         TransformerHandler can not be created.
      */
-    @Test (groups = {"readLocalFiles"})
+    @Test
     public void transformer01() throws TransformerConfigurationException {
         TransformerFactory tfactory = TransformerFactory.newInstance();
         StreamSource streamSource = new StreamSource(
@@ -71,7 +81,7 @@
      * This tests if newTransformer(SAXSource) method returns Transformer.
      * @throws Exception If any errors occur.
      */
-    @Test (groups = {"readLocalFiles"})
+    @Test
     public void transformer02() throws Exception {
         try (FileInputStream fis = new FileInputStream(TEST_XSL)) {
             TransformerFactory tfactory = TransformerFactory.newInstance();
@@ -86,7 +96,7 @@
      *
      * @throws Exception If any errors occur.
      */
-    @Test (groups = {"readLocalFiles"})
+    @Test
     public void transformer03() throws Exception {
         TransformerFactory tfactory = TransformerFactory.newInstance();
 
@@ -105,7 +115,7 @@
      *
      * @throws Exception If any errors occur.
      */
-    @Test (groups = {"readLocalFiles"})
+    @Test
     public void transformer04() throws Exception {
         DocumentBuilderFactory dbf = DocumentBuilderFactory.newInstance();
         dbf.setNamespaceAware(true);
@@ -125,7 +135,7 @@
      *
      * @throws Exception If any errors occur.
      */
-    @Test (groups = {"readLocalFiles"})
+    @Test
     public void transformer05() throws Exception {
         DocumentBuilderFactory dbf = DocumentBuilderFactory.newInstance();
         dbf.setNamespaceAware(true);
@@ -150,7 +160,7 @@
      *
      * @throws Exception If any errors occur.
      */
-    @Test (groups = {"readLocalFiles"})
+    @Test
     public void transformer06() throws Exception {
         TransformerFactory tfactory = TransformerFactory.newInstance();
 
@@ -197,3 +207,5 @@
         System.out.println(" In fatal");
     }
 }
+
+
diff --git a/jaxp/test/javax/xml/jaxp/functional/javax/xml/transform/ptests/TransformerTest02.java b/jaxp/test/javax/xml/jaxp/functional/javax/xml/transform/ptests/TransformerTest02.java
index 0f50b34..3a9a058 100644
--- a/jaxp/test/javax/xml/jaxp/functional/javax/xml/transform/ptests/TransformerTest02.java
+++ b/jaxp/test/javax/xml/jaxp/functional/javax/xml/transform/ptests/TransformerTest02.java
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2003, 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2003, 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
@@ -22,21 +22,24 @@
  */
 package javax.xml.transform.ptests;
 
+import static javax.xml.transform.ptests.TransformerTestConst.GOLDEN_DIR;
+import static javax.xml.transform.ptests.TransformerTestConst.XML_DIR;
+import static jaxp.library.JAXPTestUtilities.USER_DIR;
+import static jaxp.library.JAXPTestUtilities.compareWithGold;
+import static org.testng.Assert.assertTrue;
+
 import java.io.File;
 import java.io.FileInputStream;
 import java.io.FileOutputStream;
+
 import javax.xml.parsers.DocumentBuilderFactory;
 import javax.xml.transform.Transformer;
 import javax.xml.transform.TransformerFactory;
 import javax.xml.transform.dom.DOMSource;
-import static javax.xml.transform.ptests.TransformerTestConst.GOLDEN_DIR;
-import static javax.xml.transform.ptests.TransformerTestConst.XML_DIR;
 import javax.xml.transform.stream.StreamResult;
 import javax.xml.transform.stream.StreamSource;
-import jaxp.library.JAXPFileBaseTest;
-import static jaxp.library.JAXPTestUtilities.USER_DIR;
-import static jaxp.library.JAXPTestUtilities.compareWithGold;
-import static org.testng.Assert.assertTrue;
+
+import org.testng.annotations.Listeners;
 import org.testng.annotations.Test;
 
 
@@ -44,7 +47,14 @@
  * Here a transformer is created using DOMSource. Some specific output property
  * is set on transformer. Then transform(StreamSource, StreamResult) is tested.
  */
-public class TransformerTest02 extends JAXPFileBaseTest {
+/*
+ * @test
+ * @library /javax/xml/jaxp/libs
+ * @run testng/othervm -DrunSecMngr=true javax.xml.transform.ptests.TransformerTest02
+ * @run testng/othervm javax.xml.transform.ptests.TransformerTest02
+ */
+@Listeners({jaxp.library.FilePolicy.class})
+public class TransformerTest02 {
     /**
      * Unit test for transform(StreamSource, StreamResult).
      *
@@ -75,3 +85,5 @@
         assertTrue(compareWithGold(goldFile, outputFile));
     }
 }
+
+
diff --git a/jaxp/test/javax/xml/jaxp/functional/javax/xml/transform/ptests/TransformerTest03.java b/jaxp/test/javax/xml/jaxp/functional/javax/xml/transform/ptests/TransformerTest03.java
index 23855e5..d0330a7 100644
--- a/jaxp/test/javax/xml/jaxp/functional/javax/xml/transform/ptests/TransformerTest03.java
+++ b/jaxp/test/javax/xml/jaxp/functional/javax/xml/transform/ptests/TransformerTest03.java
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2003, 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2003, 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
@@ -22,22 +22,25 @@
  */
 package javax.xml.transform.ptests;
 
+import static javax.xml.transform.ptests.TransformerTestConst.GOLDEN_DIR;
+import static javax.xml.transform.ptests.TransformerTestConst.XML_DIR;
+import static jaxp.library.JAXPTestUtilities.USER_DIR;
+import static jaxp.library.JAXPTestUtilities.compareWithGold;
+import static org.testng.Assert.assertTrue;
+
 import java.io.File;
 import java.io.FileInputStream;
 import java.io.FileOutputStream;
 import java.util.Properties;
+
 import javax.xml.parsers.DocumentBuilderFactory;
 import javax.xml.transform.Transformer;
 import javax.xml.transform.TransformerFactory;
 import javax.xml.transform.dom.DOMSource;
-import static javax.xml.transform.ptests.TransformerTestConst.GOLDEN_DIR;
-import static javax.xml.transform.ptests.TransformerTestConst.XML_DIR;
 import javax.xml.transform.stream.StreamResult;
 import javax.xml.transform.stream.StreamSource;
-import jaxp.library.JAXPFileBaseTest;
-import static jaxp.library.JAXPTestUtilities.USER_DIR;
-import static jaxp.library.JAXPTestUtilities.compareWithGold;
-import static org.testng.Assert.assertTrue;
+
+import org.testng.annotations.Listeners;
 import org.testng.annotations.Test;
 
 /**
@@ -46,7 +49,14 @@
  * for transformer. Then transform(StreamSource, StreamResult) is used for
  * transformation. This tests the setOutputProperties() method.
  */
-public class TransformerTest03 extends JAXPFileBaseTest {
+/*
+ * @test
+ * @library /javax/xml/jaxp/libs
+ * @run testng/othervm -DrunSecMngr=true javax.xml.transform.ptests.TransformerTest03
+ * @run testng/othervm javax.xml.transform.ptests.TransformerTest03
+ */
+@Listeners({jaxp.library.FilePolicy.class})
+public class TransformerTest03 {
     /**
      * Test for Transformer.setOutputProperties method.
      *
@@ -84,3 +94,5 @@
         assertTrue(compareWithGold(goldFile, outputFile));
     }
 }
+
+
diff --git a/jaxp/test/javax/xml/jaxp/functional/javax/xml/transform/ptests/URIResolverTest.java b/jaxp/test/javax/xml/jaxp/functional/javax/xml/transform/ptests/URIResolverTest.java
index 05889f6..d595b48 100644
--- a/jaxp/test/javax/xml/jaxp/functional/javax/xml/transform/ptests/URIResolverTest.java
+++ b/jaxp/test/javax/xml/jaxp/functional/javax/xml/transform/ptests/URIResolverTest.java
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2003, 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2003, 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
@@ -22,8 +22,13 @@
  */
 package javax.xml.transform.ptests;
 
+import static javax.xml.transform.ptests.TransformerTestConst.XML_DIR;
+import static org.testng.Assert.assertEquals;
+import static org.testng.Assert.assertNotNull;
+
 import java.io.File;
 import java.io.FileInputStream;
+
 import javax.xml.parsers.DocumentBuilder;
 import javax.xml.parsers.DocumentBuilderFactory;
 import javax.xml.transform.Source;
@@ -31,13 +36,11 @@
 import javax.xml.transform.TransformerFactory;
 import javax.xml.transform.URIResolver;
 import javax.xml.transform.dom.DOMSource;
-import static javax.xml.transform.ptests.TransformerTestConst.XML_DIR;
 import javax.xml.transform.sax.SAXSource;
 import javax.xml.transform.stream.StreamResult;
 import javax.xml.transform.stream.StreamSource;
-import jaxp.library.JAXPFileBaseTest;
-import static org.testng.Assert.assertEquals;
-import static org.testng.Assert.assertNotNull;
+
+import org.testng.annotations.Listeners;
 import org.testng.annotations.Test;
 import org.w3c.dom.Document;
 import org.xml.sax.InputSource;
@@ -45,7 +48,14 @@
 /**
  * URIResolver should be invoked when transform happens.
  */
-public class URIResolverTest extends JAXPFileBaseTest implements URIResolver {
+/*
+ * @test
+ * @library /javax/xml/jaxp/libs
+ * @run testng/othervm -DrunSecMngr=true javax.xml.transform.ptests.URIResolverTest
+ * @run testng/othervm javax.xml.transform.ptests.URIResolverTest
+ */
+@Listeners({jaxp.library.FilePolicy.class})
+public class URIResolverTest implements URIResolver {
     /**
      * System ID constant.
      */
@@ -115,7 +125,7 @@
      *
      * @throws Exception If any errors occur.
      */
-    @Test (groups = {"readLocalFiles"})
+    @Test
     public static void resolver01() throws Exception {
         try (FileInputStream fis = new FileInputStream(XSL_INCLUDE_FILE)) {
             TransformerFactory tfactory = TransformerFactory.newInstance();
@@ -134,7 +144,7 @@
      *
      * @throws Exception If any errors occur.
      */
-    @Test (groups = {"readLocalFiles"})
+    @Test
     public static void resolver02() throws Exception {
         TransformerFactory tfactory = TransformerFactory.newInstance();
         URIResolverTest resolver = new URIResolverTest(XSL_TEMP_FILE, SYSTEM_ID);
@@ -155,7 +165,7 @@
      *
      * @throws Exception If any errors occur.
      */
-    @Test (groups = {"readLocalFiles"})
+    @Test
     public static void resolver03() throws Exception {
         try (FileInputStream fis = new FileInputStream(XSL_INCLUDE_FILE)){
             URIResolverTest resolver = new URIResolverTest(XSL_TEMP_FILE, SYSTEM_ID);
@@ -174,7 +184,7 @@
      *
      * @throws Exception If any errors occur.
      */
-    @Test (groups = {"readLocalFiles"})
+    @Test
     public static void resolver04() throws Exception {
         try (FileInputStream fis = new FileInputStream(XSL_IMPORT_FILE)) {
             URIResolverTest resolver = new URIResolverTest(XSL_TEMP_FILE, SYSTEM_ID);
@@ -192,7 +202,7 @@
      *
      * @throws Exception If any errors occur.
      */
-    @Test (groups = {"readLocalFiles"})
+    @Test
     public static void resolver05() throws Exception {
         URIResolverTest resolver = new URIResolverTest(XSL_TEMP_FILE, SYSTEM_ID);
         TransformerFactory tfactory = TransformerFactory.newInstance();
@@ -211,7 +221,7 @@
      *
      * @throws Exception If any errors occur.
      */
-    @Test (groups = {"readLocalFiles"})
+    @Test
     public static void resolver06() throws Exception {
         try (FileInputStream fis = new FileInputStream(XSL_IMPORT_FILE)){
             URIResolverTest resolver = new URIResolverTest(XSL_TEMP_FILE, SYSTEM_ID);
@@ -230,7 +240,7 @@
      *
      * @throws Exception If any errors occur.
      */
-    @Test (groups = {"readLocalFiles"})
+    @Test
     public static void docResolver01() throws Exception {
         try (FileInputStream fis = new FileInputStream(XML_DIR + "doctest.xsl")) {
             URIResolverTest resolver = new URIResolverTest("temp/colors.xml", SYSTEM_ID);
@@ -252,3 +262,5 @@
         }
     }
 }
+
+
diff --git a/jaxp/test/javax/xml/jaxp/functional/javax/xml/transform/ptests/othervm/TFCErrorTest.java b/jaxp/test/javax/xml/jaxp/functional/javax/xml/transform/ptests/othervm/TFCErrorTest.java
index 489fe83..f86d4b9 100644
--- a/jaxp/test/javax/xml/jaxp/functional/javax/xml/transform/ptests/othervm/TFCErrorTest.java
+++ b/jaxp/test/javax/xml/jaxp/functional/javax/xml/transform/ptests/othervm/TFCErrorTest.java
@@ -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
@@ -22,15 +22,27 @@
  */
 package javax.xml.transform.ptests.othervm;
 
-import javax.xml.transform.*;
-import jaxp.library.JAXPBaseTest;
+import static jaxp.library.JAXPTestUtilities.setSystemProperty;
+
 import static org.testng.Assert.fail;
+
+import javax.xml.transform.TransformerFactory;
+import javax.xml.transform.TransformerFactoryConfigurationError;
+
+import org.testng.annotations.Listeners;
 import org.testng.annotations.Test;
 
 /**
  * Negative test for set invalid TransformerFactory property.
  */
-public class TFCErrorTest  extends JAXPBaseTest {
+/*
+ * @test
+ * @library /javax/xml/jaxp/libs
+ * @run testng/othervm -DrunSecMngr=true javax.xml.transform.ptests.othervm.TFCErrorTest
+ * @run testng/othervm javax.xml.transform.ptests.othervm.TFCErrorTest
+ */
+@Listeners({jaxp.library.BasePolicy.class})
+public class TFCErrorTest {
     @Test(expectedExceptions = ClassNotFoundException.class)
     public void tfce01() throws Exception {
         try{
@@ -42,3 +54,5 @@
         }
     }
 }
+
+
diff --git a/jaxp/test/javax/xml/jaxp/functional/javax/xml/validation/ptests/SchemaFactoryTest.java b/jaxp/test/javax/xml/jaxp/functional/javax/xml/validation/ptests/SchemaFactoryTest.java
index 1cdcbf7..f18588a 100644
--- a/jaxp/test/javax/xml/jaxp/functional/javax/xml/validation/ptests/SchemaFactoryTest.java
+++ b/jaxp/test/javax/xml/jaxp/functional/javax/xml/validation/ptests/SchemaFactoryTest.java
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1999, 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1999, 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
@@ -54,6 +54,7 @@
 
 import org.testng.annotations.BeforeClass;
 import org.testng.annotations.DataProvider;
+import org.testng.annotations.Listeners;
 import org.testng.annotations.Test;
 import org.w3c.dom.Document;
 import org.xml.sax.ErrorHandler;
@@ -64,10 +65,15 @@
 import org.xml.sax.SAXParseException;
 
 /*
+ * @test
  * @bug 8080907
+ * @library /javax/xml/jaxp/libs
+ * @run testng/othervm -DrunSecMngr=true javax.xml.validation.ptests.SchemaFactoryTest
+ * @run testng/othervm javax.xml.validation.ptests.SchemaFactoryTest
  * @summary Class containing the test cases for SchemaFactory
  */
 @Test(singleThreaded = true)
+@Listeners({jaxp.library.FilePolicy.class})
 public class SchemaFactoryTest {
 
     @BeforeClass
@@ -398,3 +404,4 @@
     private Document xsdDoc2;
     private byte[] xml;
 }
+
diff --git a/jaxp/test/javax/xml/jaxp/functional/javax/xml/validation/ptests/TypeInfoProviderTest.java b/jaxp/test/javax/xml/jaxp/functional/javax/xml/validation/ptests/TypeInfoProviderTest.java
index d34c708..782981a 100644
--- a/jaxp/test/javax/xml/jaxp/functional/javax/xml/validation/ptests/TypeInfoProviderTest.java
+++ b/jaxp/test/javax/xml/jaxp/functional/javax/xml/validation/ptests/TypeInfoProviderTest.java
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1999, 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1999, 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
@@ -39,8 +39,7 @@
 import javax.xml.validation.TypeInfoProvider;
 import javax.xml.validation.ValidatorHandler;
 
-import jaxp.library.JAXPFileBaseTest;
-
+import org.testng.annotations.Listeners;
 import org.testng.annotations.Test;
 import org.xml.sax.Attributes;
 import org.xml.sax.InputSource;
@@ -49,9 +48,14 @@
 import org.xml.sax.helpers.DefaultHandler;
 
 /*
+ * @test
+ * @library /javax/xml/jaxp/libs
+ * @run testng/othervm -DrunSecMngr=true javax.xml.validation.ptests.TypeInfoProviderTest
+ * @run testng/othervm javax.xml.validation.ptests.TypeInfoProviderTest
  * @summary test ValidatorHandler.getTypeInfoProvider()
  */
-public class TypeInfoProviderTest extends JAXPFileBaseTest {
+@Listeners({jaxp.library.FilePolicy.class})
+public class TypeInfoProviderTest {
 
     private ValidatorHandler validatorHandler;
 
@@ -91,3 +95,4 @@
 
     }
 }
+
diff --git a/jaxp/test/javax/xml/jaxp/functional/javax/xml/validation/ptests/ValidatorHandlerTest.java b/jaxp/test/javax/xml/jaxp/functional/javax/xml/validation/ptests/ValidatorHandlerTest.java
index 3b48a21..b80a9f5 100644
--- a/jaxp/test/javax/xml/jaxp/functional/javax/xml/validation/ptests/ValidatorHandlerTest.java
+++ b/jaxp/test/javax/xml/jaxp/functional/javax/xml/validation/ptests/ValidatorHandlerTest.java
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1999, 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1999, 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
@@ -37,6 +37,7 @@
 import javax.xml.validation.ValidatorHandler;
 
 import org.testng.annotations.BeforeClass;
+import org.testng.annotations.Listeners;
 import org.testng.annotations.Test;
 import org.xml.sax.ContentHandler;
 import org.xml.sax.ErrorHandler;
@@ -46,8 +47,13 @@
 import org.xml.sax.helpers.DefaultHandler;
 
 /*
+ * @test
+ * @library /javax/xml/jaxp/libs
+ * @run testng/othervm -DrunSecMngr=true javax.xml.validation.ptests.ValidatorHandlerTest
+ * @run testng/othervm javax.xml.validation.ptests.ValidatorHandlerTest
  * @summary Class containing the test cases for ValidatorHandler API
  */
+@Listeners({jaxp.library.FilePolicy.class})
 public class ValidatorHandlerTest {
     @BeforeClass
     public void setup() throws SAXException {
@@ -142,3 +148,4 @@
     private Schema schema;
 
 }
+
diff --git a/jaxp/test/javax/xml/jaxp/functional/javax/xml/validation/ptests/ValidatorTest.java b/jaxp/test/javax/xml/jaxp/functional/javax/xml/validation/ptests/ValidatorTest.java
index c455f07..17015bf 100644
--- a/jaxp/test/javax/xml/jaxp/functional/javax/xml/validation/ptests/ValidatorTest.java
+++ b/jaxp/test/javax/xml/jaxp/functional/javax/xml/validation/ptests/ValidatorTest.java
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1999, 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1999, 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
@@ -45,10 +45,9 @@
 import javax.xml.validation.SchemaFactory;
 import javax.xml.validation.Validator;
 
-import jaxp.library.JAXPFileBaseTest;
-
 import org.testng.annotations.BeforeClass;
 import org.testng.annotations.DataProvider;
+import org.testng.annotations.Listeners;
 import org.testng.annotations.Test;
 import org.w3c.dom.Document;
 import org.xml.sax.ErrorHandler;
@@ -59,9 +58,14 @@
 import org.xml.sax.helpers.DefaultHandler;
 
 /*
+ * @test
+ * @library /javax/xml/jaxp/libs
+ * @run testng/othervm -DrunSecMngr=true javax.xml.validation.ptests.ValidatorTest
+ * @run testng/othervm javax.xml.validation.ptests.ValidatorTest
  * @summary Class containing the test cases for Validator API
  */
-public class ValidatorTest extends JAXPFileBaseTest {
+@Listeners({jaxp.library.FilePolicy.class})
+public class ValidatorTest {
 
     @BeforeClass
     public void setup() throws SAXException, IOException, ParserConfigurationException {
@@ -205,3 +209,4 @@
     private Document xmlDoc;
 
 }
+
diff --git a/jaxp/test/javax/xml/jaxp/functional/javax/xml/xpath/ptests/XPathExpressionTest.java b/jaxp/test/javax/xml/jaxp/functional/javax/xml/xpath/ptests/XPathExpressionTest.java
index bf9c250..585804c 100644
--- a/jaxp/test/javax/xml/jaxp/functional/javax/xml/xpath/ptests/XPathExpressionTest.java
+++ b/jaxp/test/javax/xml/jaxp/functional/javax/xml/xpath/ptests/XPathExpressionTest.java
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2003, 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2003, 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
@@ -23,26 +23,28 @@
 
 package javax.xml.xpath.ptests;
 
-import java.io.FilePermission;
-import java.io.InputStream;
-import java.nio.file.Files;
-import java.nio.file.Path;
-import java.nio.file.Paths;
-import javax.xml.XMLConstants;
-import javax.xml.namespace.QName;
-import javax.xml.parsers.DocumentBuilderFactory;
-import javax.xml.xpath.XPath;
 import static javax.xml.xpath.XPathConstants.BOOLEAN;
 import static javax.xml.xpath.XPathConstants.NODE;
 import static javax.xml.xpath.XPathConstants.NODESET;
 import static javax.xml.xpath.XPathConstants.NUMBER;
 import static javax.xml.xpath.XPathConstants.STRING;
+import static javax.xml.xpath.ptests.XPathTestConst.XML_DIR;
+import static org.testng.Assert.assertEquals;
+
+import java.io.InputStream;
+import java.nio.file.Files;
+import java.nio.file.Path;
+import java.nio.file.Paths;
+
+import javax.xml.XMLConstants;
+import javax.xml.namespace.QName;
+import javax.xml.parsers.DocumentBuilderFactory;
+import javax.xml.xpath.XPath;
 import javax.xml.xpath.XPathExpressionException;
 import javax.xml.xpath.XPathFactory;
-import static javax.xml.xpath.ptests.XPathTestConst.XML_DIR;
-import jaxp.library.JAXPFileReadOnlyBaseTest;
-import static org.testng.Assert.assertEquals;
+
 import org.testng.annotations.BeforeTest;
+import org.testng.annotations.Listeners;
 import org.testng.annotations.Test;
 import org.w3c.dom.Attr;
 import org.w3c.dom.Document;
@@ -52,7 +54,14 @@
 /**
  * Class containing the test cases for XPathExpression API.
  */
-public class XPathExpressionTest extends JAXPFileReadOnlyBaseTest {
+/*
+ * @test
+ * @library /javax/xml/jaxp/libs
+ * @run testng/othervm -DrunSecMngr=true javax.xml.xpath.ptests.XPathExpressionTest
+ * @run testng/othervm javax.xml.xpath.ptests.XPathExpressionTest
+ */
+@Listeners({jaxp.library.FilePolicy.class})
+public class XPathExpressionTest {
     /**
      * Document object for testing XML file.
      */
@@ -89,7 +98,6 @@
      */
     @BeforeTest
     public void setup() throws Exception {
-        setPermissions(new FilePermission(XML_PATH.toFile().toString(), "read"));
         document = DocumentBuilderFactory.newInstance().newDocumentBuilder().parse(XML_PATH.toFile());
         xpath = XPathFactory.newInstance().newXPath();
     }
@@ -264,7 +272,7 @@
      *
      * @throws Exception If any errors occur.
      */
-    @Test (groups = {"readLocalFiles"})
+    @Test
     public void testCheckXPathExpression15() throws Exception {
         try (InputStream is = Files.newInputStream(XML_PATH)) {
             assertEquals(xpath.compile(EXPRESSION_NAME_A).
@@ -287,7 +295,7 @@
      *
      * @throws Exception If any errors occur.
      */
-    @Test(groups = {"readLocalFiles"}, expectedExceptions = NullPointerException.class)
+    @Test(expectedExceptions = NullPointerException.class)
     public void testCheckXPathExpression17() throws Exception {
         try (InputStream is = Files.newInputStream(XML_PATH)) {
             xpath.compile(null).evaluate(new InputSource(is));
@@ -300,7 +308,7 @@
      *
      * @throws Exception If any errors occur.
      */
-    @Test(groups = {"readLocalFiles"}, expectedExceptions = XPathExpressionException.class)
+    @Test(expectedExceptions = XPathExpressionException.class)
     public void testCheckXPathExpression18() throws Exception {
         try (InputStream is = Files.newInputStream(XML_PATH)) {
             xpath.compile("-*&").evaluate(new InputSource(is));
@@ -313,7 +321,7 @@
      *
      * @throws Exception If any errors occur.
      */
-    @Test(groups = {"readLocalFiles"}, expectedExceptions = XPathExpressionException.class)
+    @Test(expectedExceptions = XPathExpressionException.class)
     public void testCheckXPathExpression19() throws Exception {
         try (InputStream is = Files.newInputStream(XML_PATH)) {
             xpath.compile(" ").evaluate(new InputSource(is));
@@ -326,7 +334,7 @@
      *
      * @throws Exception If any errors occur.
      */
-    @Test(groups = {"readLocalFiles"})
+    @Test
     public void testCheckXPathExpression20() throws Exception {
         try (InputStream is = Files.newInputStream(XML_PATH)) {
             assertEquals(xpath.compile(EXPRESSION_NAME_A).
@@ -351,7 +359,7 @@
      *
      * @throws Exception If any errors occur.
      */
-    @Test(groups = {"readLocalFiles"}, expectedExceptions = NullPointerException.class)
+    @Test(expectedExceptions = NullPointerException.class)
     public void testCheckXPathExpression22() throws Exception {
         try (InputStream is = Files.newInputStream(XML_PATH)) {
             xpath.compile(null).evaluate(new InputSource(is), STRING);
@@ -364,7 +372,7 @@
      *
      * @throws Exception If any errors occur.
      */
-    @Test(groups = {"readLocalFiles"}, expectedExceptions = NullPointerException.class)
+    @Test(expectedExceptions = NullPointerException.class)
     public void testCheckXPathExpression23() throws Exception {
         try (InputStream is = Files.newInputStream(XML_PATH)) {
             xpath.compile(EXPRESSION_NAME_A).evaluate(new InputSource(is), null);
@@ -377,7 +385,7 @@
      *
      * @throws Exception If any errors occur.
      */
-    @Test(groups = {"readLocalFiles"}, expectedExceptions = XPathExpressionException.class)
+    @Test(expectedExceptions = XPathExpressionException.class)
     public void testCheckXPathExpression24() throws Exception {
         try (InputStream is = Files.newInputStream(XML_PATH)) {
             xpath.compile("-*&").evaluate(new InputSource(is), STRING);
@@ -390,7 +398,7 @@
      *
      * @throws Exception If any errors occur.
      */
-    @Test(groups = {"readLocalFiles"}, expectedExceptions = XPathExpressionException.class)
+    @Test(expectedExceptions = XPathExpressionException.class)
     public void testCheckXPathExpression25() throws Exception {
         try (InputStream is = Files.newInputStream(XML_PATH)) {
             xpath.compile(" ").evaluate(new InputSource(is), STRING);
@@ -404,7 +412,7 @@
      *
      * @throws Exception If any errors occur.
      */
-    @Test(groups = {"readLocalFiles"}, expectedExceptions = IllegalArgumentException.class)
+    @Test(expectedExceptions = IllegalArgumentException.class)
     public void testCheckXPathExpression26() throws Exception {
         try (InputStream is = Files.newInputStream(XML_PATH)) {
             xpath.compile(EXPRESSION_NAME_A).evaluate(new InputSource(is), TEST_QNAME);
@@ -417,7 +425,7 @@
      *
      * @throws Exception If any errors occur.
      */
-    @Test(groups = {"readLocalFiles"})
+    @Test
     public void testCheckXPathExpression27() throws Exception {
         try (InputStream is = Files.newInputStream(XML_PATH)) {
             assertEquals(xpath.compile(EXPRESSION_NAME_A).
@@ -431,7 +439,7 @@
      *
      * @throws Exception If any errors occur.
      */
-    @Test(groups = {"readLocalFiles"})
+    @Test
     public void testCheckXPathExpression28() throws Exception {
         try (InputStream is = Files.newInputStream(XML_PATH)) {
             assertEquals(xpath.compile(EXPRESSION_NAME_B).
@@ -445,7 +453,7 @@
      *
      * @throws Exception If any errors occur.
      */
-    @Test(groups = {"readLocalFiles"})
+    @Test
     public void testCheckXPathExpression29() throws Exception {
         try (InputStream is = Files.newInputStream(XML_PATH)) {
             assertEquals(xpath.compile(EXPRESSION_NAME_A).
@@ -459,7 +467,7 @@
      *
      * @throws Exception If any errors occur.
      */
-    @Test(groups = {"readLocalFiles"})
+    @Test
     public void testCheckXPathExpression30() throws Exception {
         try (InputStream is = Files.newInputStream(XML_PATH)) {
             Attr attr = (Attr) xpath.compile(EXPRESSION_NAME_A).
@@ -474,7 +482,7 @@
      *
      * @throws Exception If any errors occur.
      */
-    @Test(groups = {"readLocalFiles"})
+    @Test
     public void testCheckXPathExpression31() throws Exception {
         try (InputStream is = Files.newInputStream(XML_PATH)) {
             NodeList nodeList = (NodeList) xpath.compile(EXPRESSION_NAME_A).
@@ -483,3 +491,5 @@
         }
     }
 }
+
+
diff --git a/jaxp/test/javax/xml/jaxp/functional/javax/xml/xpath/ptests/XPathFactoryTest.java b/jaxp/test/javax/xml/jaxp/functional/javax/xml/xpath/ptests/XPathFactoryTest.java
index a55e1b4..517fecc 100644
--- a/jaxp/test/javax/xml/jaxp/functional/javax/xml/xpath/ptests/XPathFactoryTest.java
+++ b/jaxp/test/javax/xml/jaxp/functional/javax/xml/xpath/ptests/XPathFactoryTest.java
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2003, 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2003, 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
@@ -24,22 +24,29 @@
 package javax.xml.xpath.ptests;
 
 import static javax.xml.xpath.XPathConstants.DOM_OBJECT_MODEL;
+import static org.testng.Assert.assertNotNull;
 
 import javax.xml.xpath.XPath;
 import javax.xml.xpath.XPathFactory;
 import javax.xml.xpath.XPathFactoryConfigurationException;
 
 import jaxp.library.JAXPDataProvider;
-import jaxp.library.JAXPBaseTest;
-import static org.testng.Assert.assertNotNull;
 
 import org.testng.annotations.DataProvider;
+import org.testng.annotations.Listeners;
 import org.testng.annotations.Test;
 
 /**
  * Class containing the test cases for XPathFactory API.
  */
-public class XPathFactoryTest extends JAXPBaseTest {
+/*
+ * @test
+ * @library /javax/xml/jaxp/libs
+ * @run testng/othervm -DrunSecMngr=true javax.xml.xpath.ptests.XPathFactoryTest
+ * @run testng/othervm javax.xml.xpath.ptests.XPathFactoryTest
+ */
+@Listeners({jaxp.library.BasePolicy.class})
+public class XPathFactoryTest {
     /**
      * Valid URL for creating a XPath factory.
      */
@@ -211,3 +218,5 @@
         assertNotNull(XPathFactory.newInstance(DOM_OBJECT_MODEL));
     }
 }
+
+
diff --git a/jaxp/test/javax/xml/jaxp/functional/javax/xml/xpath/ptests/XPathFunctionResolverTest.java b/jaxp/test/javax/xml/jaxp/functional/javax/xml/xpath/ptests/XPathFunctionResolverTest.java
index cf10465..8f19976 100644
--- a/jaxp/test/javax/xml/jaxp/functional/javax/xml/xpath/ptests/XPathFunctionResolverTest.java
+++ b/jaxp/test/javax/xml/jaxp/functional/javax/xml/xpath/ptests/XPathFunctionResolverTest.java
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2003, 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2003, 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
@@ -23,18 +23,27 @@
 
 package javax.xml.xpath.ptests;
 
+import static org.testng.Assert.assertEquals;
+
 import javax.xml.xpath.XPath;
 import javax.xml.xpath.XPathExpressionException;
 import javax.xml.xpath.XPathFactory;
-import jaxp.library.JAXPBaseTest;
-import static org.testng.Assert.assertEquals;
+
 import org.testng.annotations.BeforeTest;
+import org.testng.annotations.Listeners;
 import org.testng.annotations.Test;
 
 /**
  * Class containing the test cases for XPathFunctionResolver.
  */
-public class XPathFunctionResolverTest extends JAXPBaseTest {
+/*
+ * @test
+ * @library /javax/xml/jaxp/libs
+ * @run testng/othervm -DrunSecMngr=true javax.xml.xpath.ptests.XPathFunctionResolverTest
+ * @run testng/othervm javax.xml.xpath.ptests.XPathFunctionResolverTest
+ */
+@Listeners({jaxp.library.BasePolicy.class})
+public class XPathFunctionResolverTest {
     /**
      * A XPath for evaluation environment and expressions.
      */
@@ -73,3 +82,5 @@
         assertEquals(xpath.evaluate(null, "5"), "2");
     }
 }
+
+
diff --git a/jaxp/test/javax/xml/jaxp/functional/javax/xml/xpath/ptests/XPathTest.java b/jaxp/test/javax/xml/jaxp/functional/javax/xml/xpath/ptests/XPathTest.java
index 765cf18b..f3f4a0d 100644
--- a/jaxp/test/javax/xml/jaxp/functional/javax/xml/xpath/ptests/XPathTest.java
+++ b/jaxp/test/javax/xml/jaxp/functional/javax/xml/xpath/ptests/XPathTest.java
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2003, 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2003, 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
@@ -23,30 +23,32 @@
 
 package javax.xml.xpath.ptests;
 
-import java.io.FilePermission;
-import java.io.InputStream;
-import java.nio.file.Files;
-import java.nio.file.Path;
-import java.nio.file.Paths;
-import java.util.Iterator;
-import javax.xml.XMLConstants;
-import javax.xml.namespace.NamespaceContext;
-import javax.xml.namespace.QName;
-import javax.xml.parsers.DocumentBuilderFactory;
-import javax.xml.xpath.XPath;
 import static javax.xml.xpath.XPathConstants.BOOLEAN;
 import static javax.xml.xpath.XPathConstants.NODE;
 import static javax.xml.xpath.XPathConstants.NODESET;
 import static javax.xml.xpath.XPathConstants.NUMBER;
 import static javax.xml.xpath.XPathConstants.STRING;
-import javax.xml.xpath.XPathExpressionException;
-import javax.xml.xpath.XPathFactory;
 import static javax.xml.xpath.ptests.XPathTestConst.XML_DIR;
-import jaxp.library.JAXPFileReadOnlyBaseTest;
 import static org.testng.AssertJUnit.assertEquals;
 import static org.testng.AssertJUnit.assertNotNull;
 import static org.testng.AssertJUnit.assertNull;
+
+import java.io.InputStream;
+import java.nio.file.Files;
+import java.nio.file.Path;
+import java.nio.file.Paths;
+import java.util.Iterator;
+
+import javax.xml.XMLConstants;
+import javax.xml.namespace.NamespaceContext;
+import javax.xml.namespace.QName;
+import javax.xml.parsers.DocumentBuilderFactory;
+import javax.xml.xpath.XPath;
+import javax.xml.xpath.XPathExpressionException;
+import javax.xml.xpath.XPathFactory;
+
 import org.testng.annotations.BeforeTest;
+import org.testng.annotations.Listeners;
 import org.testng.annotations.Test;
 import org.w3c.dom.Attr;
 import org.w3c.dom.Document;
@@ -56,7 +58,14 @@
 /**
  * Class containing the test cases for XPath API.
  */
-public class XPathTest extends JAXPFileReadOnlyBaseTest {
+/*
+ * @test
+ * @library /javax/xml/jaxp/libs
+ * @run testng/othervm -DrunSecMngr=true javax.xml.xpath.ptests.XPathTest
+ * @run testng/othervm javax.xml.xpath.ptests.XPathTest
+ */
+@Listeners({jaxp.library.FilePolicy.class})
+public class XPathTest {
     /**
      * Document object for testing XML file.
      */
@@ -93,7 +102,6 @@
      */
     @BeforeTest
     public void setup() throws Exception {
-        setPermissions(new FilePermission(XML_DIR + "-", "read"));
         document = DocumentBuilderFactory.newInstance().newDocumentBuilder().parse(XML_PATH.toFile());
         xpath = XPathFactory.newInstance().newXPath();
     }
@@ -347,7 +355,7 @@
      *
      * @throws Exception If any errors occur.
      */
-    @Test (groups = {"readLocalFiles"})
+    @Test
     public void testCheckXPath22() throws Exception {
         try (InputStream is = Files.newInputStream(XML_PATH)) {
             assertEquals(xpath.evaluate(EXPRESSION_NAME_A, new InputSource(is)), "6");
@@ -371,7 +379,7 @@
      *
      * @throws Exception If any errors occur.
      */
-    @Test(groups = {"readLocalFiles"}, expectedExceptions = NullPointerException.class)
+    @Test(expectedExceptions = NullPointerException.class)
     public void testCheckXPath24() throws Exception {
         try (InputStream is = Files.newInputStream(XML_PATH)) {
             xpath.evaluate(null, new InputSource(is));
@@ -385,7 +393,7 @@
      *
      * @throws Exception If any errors occur.
      */
-    @Test(groups = {"readLocalFiles"}, expectedExceptions = XPathExpressionException.class)
+    @Test(expectedExceptions = XPathExpressionException.class)
     public void testCheckXPath25() throws Exception {
         try (InputStream is = Files.newInputStream(XML_PATH)) {
             xpath.evaluate("-*&", new InputSource(is));
@@ -398,7 +406,7 @@
      *
      * @throws Exception If any errors occur.
      */
-    @Test(groups = {"readLocalFiles"}, expectedExceptions = XPathExpressionException.class)
+    @Test(expectedExceptions = XPathExpressionException.class)
     public void testCheckXPath26() throws Exception {
         try (InputStream is = Files.newInputStream(XML_PATH)) {
             xpath.evaluate(" ", new InputSource(is));
@@ -411,7 +419,7 @@
      *
      * @throws Exception If any errors occur.
      */
-    @Test(groups = {"readLocalFiles"})
+    @Test
     public void testCheckXPath27() throws Exception {
         try (InputStream is = Files.newInputStream(XML_PATH)) {
             assertEquals(xpath.evaluate(EXPRESSION_NAME_A, new InputSource(is), STRING), "6");
@@ -435,7 +443,7 @@
      *
      * @throws Exception If any errors occur.
      */
-    @Test(groups = {"readLocalFiles"}, expectedExceptions = NullPointerException.class)
+    @Test(expectedExceptions = NullPointerException.class)
     public void testCheckXPath29() throws Exception {
         try (InputStream is = Files.newInputStream(XML_PATH)) {
             xpath.evaluate(null, new InputSource(is), STRING);
@@ -448,7 +456,7 @@
      *
      * @throws Exception If any errors occur.
      */
-    @Test(groups = {"readLocalFiles"}, expectedExceptions = NullPointerException.class)
+    @Test(expectedExceptions = NullPointerException.class)
     public void testCheckXPath30() throws Exception {
         try (InputStream is = Files.newInputStream(XML_PATH)) {
             xpath.evaluate(EXPRESSION_NAME_A, new InputSource(is), null);
@@ -461,7 +469,7 @@
      *
      * @throws Exception If any errors occur.
      */
-    @Test(groups = {"readLocalFiles"}, expectedExceptions = XPathExpressionException.class)
+    @Test(expectedExceptions = XPathExpressionException.class)
     public void testCheckXPath31() throws Exception {
         try (InputStream is = Files.newInputStream(XML_PATH)) {
             xpath.evaluate("-*&", new InputSource(is), STRING);
@@ -474,7 +482,7 @@
      *
      * @throws Exception If any errors occur.
      */
-    @Test(groups = {"readLocalFiles"}, expectedExceptions = XPathExpressionException.class)
+    @Test(expectedExceptions = XPathExpressionException.class)
     public void testCheckXPath32() throws Exception {
         try (InputStream is = Files.newInputStream(XML_PATH)) {
             xpath.evaluate(" ", new InputSource(is), STRING);
@@ -488,7 +496,7 @@
      *
      * @throws Exception If any errors occur.
      */
-    @Test(groups = {"readLocalFiles"}, expectedExceptions = IllegalArgumentException.class)
+    @Test(expectedExceptions = IllegalArgumentException.class)
     public void testCheckXPath33() throws Exception {
         try (InputStream is = Files.newInputStream(XML_PATH)) {
             xpath.evaluate(EXPRESSION_NAME_A, new InputSource(is), TEST_QNAME);
@@ -501,7 +509,7 @@
      *
      * @throws Exception If any errors occur.
      */
-    @Test(groups = {"readLocalFiles"})
+    @Test
     public void testCheckXPath34() throws Exception {
         try (InputStream is = Files.newInputStream(XML_PATH)) {
             assertEquals(xpath.evaluate(EXPRESSION_NAME_A, new InputSource(is),
@@ -515,7 +523,7 @@
      *
      * @throws Exception If any errors occur.
      */
-    @Test(groups = {"readLocalFiles"})
+    @Test
     public void testCheckXPath35() throws Exception {
         try (InputStream is = Files.newInputStream(XML_PATH)) {
             assertEquals(xpath.evaluate(EXPRESSION_NAME_B, new InputSource(is),
@@ -529,7 +537,7 @@
      *
      * @throws Exception If any errors occur.
      */
-    @Test(groups = {"readLocalFiles"})
+    @Test
     public void testCheckXPath36() throws Exception {
         try (InputStream is = Files.newInputStream(XML_PATH)) {
             assertEquals(xpath.evaluate(EXPRESSION_NAME_A, new InputSource(is),
@@ -543,7 +551,7 @@
      *
      * @throws Exception If any errors occur.
      */
-    @Test(groups = {"readLocalFiles"})
+    @Test
     public void testCheckXPath37() throws Exception {
         try (InputStream is = Files.newInputStream(XML_PATH)) {
             assertEquals(((Attr)xpath.evaluate(EXPRESSION_NAME_A,
@@ -557,7 +565,7 @@
      *
      * @throws Exception If any errors occur.
      */
-    @Test(groups = {"readLocalFiles"})
+    @Test
     public void testCheckXPath38() throws Exception {
         try (InputStream is = Files.newInputStream(XML_PATH)) {
             NodeList nodeList = (NodeList)xpath.evaluate(EXPRESSION_NAME_A,
@@ -573,7 +581,7 @@
      *
      * @throws Exception If any errors occur.
      */
-    @Test(groups = {"readLocalFiles"})
+    @Test
     public void testCheckXPath52() throws Exception {
         try (InputStream is = Files.newInputStream(XML_PATH)) {
             assertEquals(xpath.evaluate(EXPRESSION_NAME_B, new InputSource(is),
@@ -587,7 +595,7 @@
      *
      * @throws Exception If any errors occur.
      */
-    @Test(groups = {"readLocalFiles"})
+    @Test
     public void testCheckXPath53() throws Exception {
         try (InputStream is = Files.newInputStream(XML_PATH)) {
             assertEquals(xpath.evaluate(EXPRESSION_NAME_A, new InputSource(is),
@@ -601,7 +609,7 @@
      *
      * @throws Exception If any errors occur.
      */
-    @Test(groups = {"readLocalFiles"})
+    @Test
     public void testCheckXPath54() throws Exception {
         try (InputStream is = Files.newInputStream(XML_PATH)) {
             assertEquals(((Attr)xpath.evaluate(EXPRESSION_NAME_A,
@@ -615,7 +623,7 @@
      *
      * @throws Exception If any errors occur.
      */
-    @Test(groups = {"readLocalFiles"})
+    @Test
     public void testCheckXPath55() throws Exception {
         try (InputStream is = Files.newInputStream(XML_PATH)) {
             NodeList nodeList = (NodeList)xpath.evaluate(EXPRESSION_NAME_A,
@@ -749,3 +757,5 @@
         }
     }
 }
+
+
diff --git a/jaxp/test/javax/xml/jaxp/functional/org/w3c/dom/ptests/AbstractCharacterDataTest.java b/jaxp/test/javax/xml/jaxp/functional/org/w3c/dom/ptests/AbstractCharacterDataTest.java
index c1ef114..c1b3381 100644
--- a/jaxp/test/javax/xml/jaxp/functional/org/w3c/dom/ptests/AbstractCharacterDataTest.java
+++ b/jaxp/test/javax/xml/jaxp/functional/org/w3c/dom/ptests/AbstractCharacterDataTest.java
@@ -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
@@ -31,8 +31,6 @@
 
 import javax.xml.parsers.ParserConfigurationException;
 
-import jaxp.library.JAXPFileBaseTest;
-
 import org.testng.annotations.DataProvider;
 import org.testng.annotations.Test;
 import org.w3c.dom.CharacterData;
@@ -42,7 +40,7 @@
 /*
  * @summary common test for the CharacterData Interface
  */
-public abstract class AbstractCharacterDataTest extends JAXPFileBaseTest {
+public abstract class AbstractCharacterDataTest {
     @DataProvider(name = "data-for-length")
     public Object[][] getDataForTestLength() {
         return new Object[][] {
diff --git a/jaxp/test/javax/xml/jaxp/functional/org/w3c/dom/ptests/AttrTest.java b/jaxp/test/javax/xml/jaxp/functional/org/w3c/dom/ptests/AttrTest.java
index b166c30..e17afe6 100644
--- a/jaxp/test/javax/xml/jaxp/functional/org/w3c/dom/ptests/AttrTest.java
+++ b/jaxp/test/javax/xml/jaxp/functional/org/w3c/dom/ptests/AttrTest.java
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2003, 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2003, 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
@@ -28,8 +28,8 @@
 import static org.testng.Assert.assertNull;
 import static org.testng.Assert.assertTrue;
 import static org.w3c.dom.ptests.DOMTestUtil.createDOM;
-import jaxp.library.JAXPFileBaseTest;
 
+import org.testng.annotations.Listeners;
 import org.testng.annotations.Test;
 import org.w3c.dom.Attr;
 import org.w3c.dom.Document;
@@ -38,9 +38,14 @@
 
 
 /*
+ * @test
+ * @library /javax/xml/jaxp/libs
+ * @run testng/othervm -DrunSecMngr=true org.w3c.dom.ptests.AttrTest
+ * @run testng/othervm org.w3c.dom.ptests.AttrTest
  * @summary Test for the Attr Interface
  */
-public class AttrTest extends JAXPFileBaseTest {
+@Listeners({jaxp.library.FilePolicy.class})
+public class AttrTest {
     /*
      * Verify getName method against both existing Attr and new Attr.
      */
@@ -146,3 +151,4 @@
     }
 
 }
+
diff --git a/jaxp/test/javax/xml/jaxp/functional/org/w3c/dom/ptests/CommentTest.java b/jaxp/test/javax/xml/jaxp/functional/org/w3c/dom/ptests/CommentTest.java
index daf585b..eda658b 100644
--- a/jaxp/test/javax/xml/jaxp/functional/org/w3c/dom/ptests/CommentTest.java
+++ b/jaxp/test/javax/xml/jaxp/functional/org/w3c/dom/ptests/CommentTest.java
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2003, 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2003, 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
@@ -28,13 +28,19 @@
 
 import javax.xml.parsers.ParserConfigurationException;
 
+import org.testng.annotations.Listeners;
 import org.w3c.dom.CharacterData;
 import org.w3c.dom.Document;
 import org.xml.sax.SAXException;
 
 /*
+ * @test
+ * @library /javax/xml/jaxp/libs /javax/xml/jaxp/functional
+ * @run testng/othervm -DrunSecMngr=true org.w3c.dom.ptests.CommentTest
+ * @run testng/othervm org.w3c.dom.ptests.CommentTest
  * @summary Test for Comment implementation returned by Document.createComment(String)
  */
+@Listeners({jaxp.library.FilePolicy.class})
 public class CommentTest extends AbstractCharacterDataTest {
     @Override
     protected CharacterData createCharacterData(String text) throws IOException, SAXException, ParserConfigurationException {
@@ -42,3 +48,4 @@
         return document.createComment(text);
     }
 }
+
diff --git a/jaxp/test/javax/xml/jaxp/functional/org/w3c/dom/ptests/DocumentTest.java b/jaxp/test/javax/xml/jaxp/functional/org/w3c/dom/ptests/DocumentTest.java
index 90dd8cc..fe309a8 100644
--- a/jaxp/test/javax/xml/jaxp/functional/org/w3c/dom/ptests/DocumentTest.java
+++ b/jaxp/test/javax/xml/jaxp/functional/org/w3c/dom/ptests/DocumentTest.java
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2003, 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2003, 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
@@ -31,9 +31,9 @@
 import static org.w3c.dom.ptests.DOMTestUtil.DOMEXCEPTION_EXPECTED;
 import static org.w3c.dom.ptests.DOMTestUtil.createDOMWithNS;
 import static org.w3c.dom.ptests.DOMTestUtil.createNewDocument;
-import jaxp.library.JAXPFileBaseTest;
 
 import org.testng.annotations.DataProvider;
+import org.testng.annotations.Listeners;
 import org.testng.annotations.Test;
 import org.w3c.dom.Attr;
 import org.w3c.dom.DOMException;
@@ -42,9 +42,14 @@
 import org.w3c.dom.NodeList;
 
 /*
+ * @test
+ * @library /javax/xml/jaxp/libs
+ * @run testng/othervm -DrunSecMngr=true org.w3c.dom.ptests.DocumentTest
+ * @run testng/othervm org.w3c.dom.ptests.DocumentTest
  * @summary Test createAttributeNS, getElementsByTagNameNS and createElementNS method of Document
  */
-public class DocumentTest extends JAXPFileBaseTest {
+@Listeners({jaxp.library.FilePolicy.class})
+public class DocumentTest {
 
     @DataProvider(name = "invalid-nsuri")
     public Object[][] getInvalidNamespaceURI() {
@@ -170,3 +175,4 @@
         doc.createElement("!nc$%^*(!");
     }
 }
+
diff --git a/jaxp/test/javax/xml/jaxp/functional/org/w3c/dom/ptests/DocumentTypeTest.java b/jaxp/test/javax/xml/jaxp/functional/org/w3c/dom/ptests/DocumentTypeTest.java
index d260d1f..63d2396 100644
--- a/jaxp/test/javax/xml/jaxp/functional/org/w3c/dom/ptests/DocumentTypeTest.java
+++ b/jaxp/test/javax/xml/jaxp/functional/org/w3c/dom/ptests/DocumentTypeTest.java
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2003, 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2003, 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
@@ -25,17 +25,22 @@
 
 import static org.testng.Assert.assertEquals;
 import static org.w3c.dom.ptests.DOMTestUtil.createDOM;
-import jaxp.library.JAXPFileBaseTest;
 
 import org.testng.Assert;
+import org.testng.annotations.Listeners;
 import org.testng.annotations.Test;
 import org.w3c.dom.DocumentType;
 import org.w3c.dom.NamedNodeMap;
 
 /*
+ * @test
+ * @library /javax/xml/jaxp/libs
+ * @run testng/othervm -DrunSecMngr=true org.w3c.dom.ptests.DocumentTypeTest
+ * @run testng/othervm org.w3c.dom.ptests.DocumentTypeTest
  * @summary Test DocumentType
  */
-public class DocumentTypeTest extends JAXPFileBaseTest {
+@Listeners({jaxp.library.FilePolicy.class})
+public class DocumentTypeTest {
 
     /*
      * Test testGetEntities method, and verify the entity items.
@@ -87,3 +92,4 @@
     }
 
 }
+
diff --git a/jaxp/test/javax/xml/jaxp/functional/org/w3c/dom/ptests/DomImplementationTest.java b/jaxp/test/javax/xml/jaxp/functional/org/w3c/dom/ptests/DomImplementationTest.java
index fb6ec4b..9e8c024 100644
--- a/jaxp/test/javax/xml/jaxp/functional/org/w3c/dom/ptests/DomImplementationTest.java
+++ b/jaxp/test/javax/xml/jaxp/functional/org/w3c/dom/ptests/DomImplementationTest.java
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2003, 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2003, 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,18 +27,22 @@
 
 import javax.xml.parsers.ParserConfigurationException;
 
-import jaxp.library.JAXPBaseTest;
-
 import org.testng.annotations.DataProvider;
+import org.testng.annotations.Listeners;
 import org.testng.annotations.Test;
 import org.w3c.dom.DOMImplementation;
 import org.w3c.dom.Document;
 import org.w3c.dom.DocumentType;
 
 /*
+ * @test
+ * @library /javax/xml/jaxp/libs
+ * @run testng/othervm -DrunSecMngr=true org.w3c.dom.ptests.DomImplementationTest
+ * @run testng/othervm org.w3c.dom.ptests.DomImplementationTest
  * @summary Test DomImplementation API
  */
-public class DomImplementationTest extends JAXPBaseTest {
+@Listeners({jaxp.library.BasePolicy.class})
+public class DomImplementationTest {
     /*
      * Test createDocument method with a namespace uri, qualified name and null
      * for the doctype
@@ -125,3 +129,4 @@
         assertEquals(documentType.getName(), name);
     }
 }
+
diff --git a/jaxp/test/javax/xml/jaxp/functional/org/w3c/dom/ptests/ElementTest.java b/jaxp/test/javax/xml/jaxp/functional/org/w3c/dom/ptests/ElementTest.java
index 2e4841f..6726eb0 100644
--- a/jaxp/test/javax/xml/jaxp/functional/org/w3c/dom/ptests/ElementTest.java
+++ b/jaxp/test/javax/xml/jaxp/functional/org/w3c/dom/ptests/ElementTest.java
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2003, 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2003, 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
@@ -37,9 +37,8 @@
 
 import javax.xml.parsers.DocumentBuilderFactory;
 
-import jaxp.library.JAXPFileBaseTest;
-
 import org.testng.annotations.DataProvider;
+import org.testng.annotations.Listeners;
 import org.testng.annotations.Test;
 import org.w3c.dom.Attr;
 import org.w3c.dom.DOMException;
@@ -50,9 +49,14 @@
 import org.xml.sax.InputSource;
 
 /*
+ * @test
+ * @library /javax/xml/jaxp/libs
+ * @run testng/othervm -DrunSecMngr=true org.w3c.dom.ptests.ElementTest
+ * @run testng/othervm org.w3c.dom.ptests.ElementTest
  * @summary Test for the methods of Element Interface
  */
-public class ElementTest extends JAXPFileBaseTest {
+@Listeners({jaxp.library.FilePolicy.class})
+public class ElementTest {
     @Test
     public void testGetAttributeNS() throws Exception {
         Document document = createDOMWithNS("ElementSample01.xml");
@@ -251,3 +255,4 @@
     }
 
 }
+
diff --git a/jaxp/test/javax/xml/jaxp/functional/org/w3c/dom/ptests/EntityChildTest.java b/jaxp/test/javax/xml/jaxp/functional/org/w3c/dom/ptests/EntityChildTest.java
index 099b7c1..ffac684 100644
--- a/jaxp/test/javax/xml/jaxp/functional/org/w3c/dom/ptests/EntityChildTest.java
+++ b/jaxp/test/javax/xml/jaxp/functional/org/w3c/dom/ptests/EntityChildTest.java
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2003, 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2003, 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,17 +30,21 @@
 import javax.xml.parsers.DocumentBuilder;
 import javax.xml.parsers.DocumentBuilderFactory;
 
-import jaxp.library.JAXPFileBaseTest;
-
+import org.testng.annotations.Listeners;
 import org.testng.annotations.Test;
 import org.w3c.dom.Document;
 import org.w3c.dom.Element;
 import org.w3c.dom.NodeList;
 
 /*
+ * @test
+ * @library /javax/xml/jaxp/libs
+ * @run testng/othervm -DrunSecMngr=true org.w3c.dom.ptests.EntityChildTest
+ * @run testng/othervm org.w3c.dom.ptests.EntityChildTest
  * @summary Test DOM Parser: parsing an xml file that contains external entities.
  */
-public class EntityChildTest extends JAXPFileBaseTest {
+@Listeners({jaxp.library.FilePolicy.class})
+public class EntityChildTest {
 
     @Test
     public void test() throws Exception {
@@ -57,3 +61,4 @@
         assertEquals(nl.getLength(), 3);
     }
 }
+
diff --git a/jaxp/test/javax/xml/jaxp/functional/org/w3c/dom/ptests/NamedNodeMapTest.java b/jaxp/test/javax/xml/jaxp/functional/org/w3c/dom/ptests/NamedNodeMapTest.java
index 49037f8..405934b 100644
--- a/jaxp/test/javax/xml/jaxp/functional/org/w3c/dom/ptests/NamedNodeMapTest.java
+++ b/jaxp/test/javax/xml/jaxp/functional/org/w3c/dom/ptests/NamedNodeMapTest.java
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2003, 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2003, 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
@@ -25,8 +25,8 @@
 import static org.testng.Assert.assertEquals;
 import static org.testng.Assert.assertNull;
 import static org.w3c.dom.ptests.DOMTestUtil.createDOMWithNS;
-import jaxp.library.JAXPFileBaseTest;
 
+import org.testng.annotations.Listeners;
 import org.testng.annotations.Test;
 import org.w3c.dom.Attr;
 import org.w3c.dom.Document;
@@ -35,9 +35,14 @@
 import org.w3c.dom.NodeList;
 
 /*
+ * @test
+ * @library /javax/xml/jaxp/libs
+ * @run testng/othervm -DrunSecMngr=true org.w3c.dom.ptests.NamedNodeMapTest
+ * @run testng/othervm org.w3c.dom.ptests.NamedNodeMapTest
  * @summary Test for the methods of NamedNodeMap Interface
  */
-public class NamedNodeMapTest extends JAXPFileBaseTest {
+@Listeners({jaxp.library.FilePolicy.class})
+public class NamedNodeMapTest {
     /*
      * Test setNamedItemNS method with a node having the same namespaceURI and
      * qualified name as an existing one, and then test with a non-existing node.
@@ -116,3 +121,4 @@
     }
 
 }
+
diff --git a/jaxp/test/javax/xml/jaxp/functional/org/w3c/dom/ptests/NodeListTest.java b/jaxp/test/javax/xml/jaxp/functional/org/w3c/dom/ptests/NodeListTest.java
index 4aa51f7..8d2d155 100644
--- a/jaxp/test/javax/xml/jaxp/functional/org/w3c/dom/ptests/NodeListTest.java
+++ b/jaxp/test/javax/xml/jaxp/functional/org/w3c/dom/ptests/NodeListTest.java
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2003, 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2003, 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
@@ -24,20 +24,25 @@
 
 import static org.testng.Assert.assertEquals;
 import static org.w3c.dom.ptests.DOMTestUtil.createDOM;
-import jaxp.library.JAXPFileBaseTest;
 
 import org.testng.annotations.DataProvider;
+import org.testng.annotations.Listeners;
 import org.testng.annotations.Test;
 import org.w3c.dom.Document;
 import org.w3c.dom.Element;
 import org.w3c.dom.NodeList;
 
 /*
+ * @test
+ * @library /javax/xml/jaxp/libs
+ * @run testng/othervm -DrunSecMngr=true org.w3c.dom.ptests.NodeListTest
+ * @run testng/othervm org.w3c.dom.ptests.NodeListTest
  * @summary Verifies a bug found in jaxp1.0.1 and 1.1FCS. After going out of
  * bound, the last element of a NodeList returns null. The bug has been fixed
  * in jaxp 1.1.1 build.
  */
-public class NodeListTest extends JAXPFileBaseTest {
+@Listeners({jaxp.library.FilePolicy.class})
+public class NodeListTest {
 
     @DataProvider(name = "xml")
     public Object[][] getTestData() {
@@ -59,3 +64,4 @@
     }
 
 }
+
diff --git a/jaxp/test/javax/xml/jaxp/functional/org/w3c/dom/ptests/NodeTest.java b/jaxp/test/javax/xml/jaxp/functional/org/w3c/dom/ptests/NodeTest.java
index dddc2ce..25c047b 100644
--- a/jaxp/test/javax/xml/jaxp/functional/org/w3c/dom/ptests/NodeTest.java
+++ b/jaxp/test/javax/xml/jaxp/functional/org/w3c/dom/ptests/NodeTest.java
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2003, 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2003, 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
@@ -23,6 +23,7 @@
 package org.w3c.dom.ptests;
 
 import static jaxp.library.JAXPTestUtilities.compareWithGold;
+import static jaxp.library.JAXPTestUtilities.tryRunWithTmpPermission;
 import static org.testng.Assert.assertEquals;
 import static org.testng.Assert.assertFalse;
 import static org.testng.Assert.assertNotEquals;
@@ -33,6 +34,7 @@
 import static org.w3c.dom.ptests.DOMTestUtil.createNewDocument;
 
 import java.io.File;
+import java.util.PropertyPermission;
 
 import javax.xml.transform.Transformer;
 import javax.xml.transform.TransformerException;
@@ -41,9 +43,8 @@
 import javax.xml.transform.dom.DOMSource;
 import javax.xml.transform.stream.StreamResult;
 
-import jaxp.library.JAXPFileBaseTest;
-
 import org.testng.annotations.DataProvider;
+import org.testng.annotations.Listeners;
 import org.testng.annotations.Test;
 import org.w3c.dom.DOMException;
 import org.w3c.dom.Document;
@@ -53,9 +54,14 @@
 import org.w3c.dom.NodeList;
 
 /*
+ * @test
+ * @library /javax/xml/jaxp/libs
+ * @run testng/othervm -DrunSecMngr=true org.w3c.dom.ptests.NodeTest
+ * @run testng/othervm org.w3c.dom.ptests.NodeTest
  * @summary Test Node interface
  */
-public class NodeTest extends JAXPFileBaseTest {
+@Listeners({jaxp.library.FilePolicy.class})
+public class NodeTest {
     @DataProvider(name = "feature-supported")
     public Object[][] getFeatureSupportedList() throws Exception {
         Document document = createDOMWithNS("Node01.xml");
@@ -153,7 +159,7 @@
 
         String outputfile = "InsertBefore.out";
         String goldfile = GOLDEN_DIR + "InsertBeforeGF.out";
-        outputXml(document, outputfile);
+        tryRunWithTmpPermission(() -> outputXml(document, outputfile), new PropertyPermission("user.dir", "read"));
         assertTrue(compareWithGold(goldfile, outputfile));
     }
 
@@ -171,7 +177,7 @@
 
         String outputfile = "ReplaceChild3.out";
         String goldfile = GOLDEN_DIR + "ReplaceChild3GF.out";
-        outputXml(document, outputfile);
+        tryRunWithTmpPermission(() -> outputXml(document, outputfile), new PropertyPermission("user.dir", "read"));
         assertTrue(compareWithGold(goldfile, outputfile));
     }
 
@@ -205,3 +211,4 @@
         transformer.transform(domSource, streamResult);
     }
 }
+
diff --git a/jaxp/test/javax/xml/jaxp/functional/org/w3c/dom/ptests/NotationTest.java b/jaxp/test/javax/xml/jaxp/functional/org/w3c/dom/ptests/NotationTest.java
index eea6ab4..0b698f3 100644
--- a/jaxp/test/javax/xml/jaxp/functional/org/w3c/dom/ptests/NotationTest.java
+++ b/jaxp/test/javax/xml/jaxp/functional/org/w3c/dom/ptests/NotationTest.java
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2003, 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2003, 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
@@ -29,8 +29,7 @@
 
 import javax.xml.parsers.ParserConfigurationException;
 
-import jaxp.library.JAXPFileBaseTest;
-
+import org.testng.annotations.Listeners;
 import org.testng.annotations.Test;
 import org.w3c.dom.Document;
 import org.w3c.dom.NamedNodeMap;
@@ -38,9 +37,14 @@
 import org.xml.sax.SAXException;
 
 /*
+ * @test
+ * @library /javax/xml/jaxp/libs
+ * @run testng/othervm -DrunSecMngr=true org.w3c.dom.ptests.NotationTest
+ * @run testng/othervm org.w3c.dom.ptests.NotationTest
  * @summary Test for Notation interface
  */
-public class NotationTest extends JAXPFileBaseTest {
+@Listeners({jaxp.library.FilePolicy.class})
+public class NotationTest {
     /*
      * Test getSystemId method.
      */
@@ -70,3 +74,4 @@
     }
 
 }
+
diff --git a/jaxp/test/javax/xml/jaxp/functional/org/w3c/dom/ptests/PITest.java b/jaxp/test/javax/xml/jaxp/functional/org/w3c/dom/ptests/PITest.java
index 15bd687..3ddf96e 100644
--- a/jaxp/test/javax/xml/jaxp/functional/org/w3c/dom/ptests/PITest.java
+++ b/jaxp/test/javax/xml/jaxp/functional/org/w3c/dom/ptests/PITest.java
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2003, 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2003, 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
@@ -24,16 +24,21 @@
 
 import static org.testng.Assert.assertEquals;
 import static org.w3c.dom.ptests.DOMTestUtil.createDOMWithNS;
-import jaxp.library.JAXPFileBaseTest;
 
+import org.testng.annotations.Listeners;
 import org.testng.annotations.Test;
 import org.w3c.dom.Document;
 import org.w3c.dom.ProcessingInstruction;
 
 /*
+ * @test
+ * @library /javax/xml/jaxp/libs
+ * @run testng/othervm -DrunSecMngr=true org.w3c.dom.ptests.PITest
+ * @run testng/othervm org.w3c.dom.ptests.PITest
  * @summary Test for the methods of Processing Instruction
  */
-public class PITest extends JAXPFileBaseTest {
+@Listeners({jaxp.library.FilePolicy.class})
+public class PITest {
     /*
      * Test getData, setData and getTarget methods
      */
@@ -49,3 +54,4 @@
     }
 
 }
+
diff --git a/jaxp/test/javax/xml/jaxp/functional/org/w3c/dom/ptests/TextTest.java b/jaxp/test/javax/xml/jaxp/functional/org/w3c/dom/ptests/TextTest.java
index 7932114..223853e 100644
--- a/jaxp/test/javax/xml/jaxp/functional/org/w3c/dom/ptests/TextTest.java
+++ b/jaxp/test/javax/xml/jaxp/functional/org/w3c/dom/ptests/TextTest.java
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2003, 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2003, 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 @@
 
 import javax.xml.parsers.ParserConfigurationException;
 
+import org.testng.annotations.Listeners;
 import org.testng.annotations.Test;
 import org.w3c.dom.CharacterData;
 import org.w3c.dom.Document;
@@ -39,8 +40,13 @@
 import org.xml.sax.SAXException;
 
 /*
+ * @test
+ * @library /javax/xml/jaxp/libs /javax/xml/jaxp/functional
+ * @run testng/othervm -DrunSecMngr=true org.w3c.dom.ptests.TextTest
+ * @run testng/othervm org.w3c.dom.ptests.TextTest
  * @summary Test for Text implementation returned by Document.createTextNode(String)
  */
+@Listeners({jaxp.library.FilePolicy.class})
 public class TextTest extends AbstractCharacterDataTest {
     /*
      * Verify splitText method works as the spec.
@@ -68,3 +74,4 @@
     }
 
 }
+
diff --git a/jaxp/test/javax/xml/jaxp/functional/org/w3c/dom/ptests/TypeInfoTest.java b/jaxp/test/javax/xml/jaxp/functional/org/w3c/dom/ptests/TypeInfoTest.java
index f68dd91..c407ff5 100644
--- a/jaxp/test/javax/xml/jaxp/functional/org/w3c/dom/ptests/TypeInfoTest.java
+++ b/jaxp/test/javax/xml/jaxp/functional/org/w3c/dom/ptests/TypeInfoTest.java
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2005, 2015, 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
@@ -30,8 +30,7 @@
 import javax.xml.parsers.DocumentBuilder;
 import javax.xml.parsers.DocumentBuilderFactory;
 
-import jaxp.library.JAXPBaseTest;
-
+import org.testng.annotations.Listeners;
 import org.testng.annotations.Test;
 import org.w3c.dom.Document;
 import org.w3c.dom.Element;
@@ -39,9 +38,14 @@
 import org.xml.sax.InputSource;
 
 /*
+ * @test
+ * @library /javax/xml/jaxp/libs
+ * @run testng/othervm -DrunSecMngr=true org.w3c.dom.ptests.TypeInfoTest
+ * @run testng/othervm org.w3c.dom.ptests.TypeInfoTest
  * @summary Test getTypeName and getTypeNamespace methods of TypeInfo interface
  */
-public class TypeInfoTest extends JAXPBaseTest {
+@Listeners({jaxp.library.BasePolicy.class})
+public class TypeInfoTest {
     /*
      * Get the TypeInfo of the root element, and verify it.
      */
@@ -136,3 +140,4 @@
 
 
 }
+
diff --git a/jaxp/test/javax/xml/jaxp/functional/org/xml/sax/ptests/AttrImplTest.java b/jaxp/test/javax/xml/jaxp/functional/org/xml/sax/ptests/AttrImplTest.java
index 708b533..2337dce 100644
--- a/jaxp/test/javax/xml/jaxp/functional/org/xml/sax/ptests/AttrImplTest.java
+++ b/jaxp/test/javax/xml/jaxp/functional/org/xml/sax/ptests/AttrImplTest.java
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2003, 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2003, 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
@@ -22,16 +22,24 @@
  */
 package org.xml.sax.ptests;
 
-import jaxp.library.JAXPBaseTest;
 import static org.testng.Assert.assertEquals;
 import static org.testng.Assert.assertNull;
+
+import org.testng.annotations.Listeners;
 import org.testng.annotations.Test;
 import org.xml.sax.helpers.AttributesImpl;
 
 /**
  * Class containing the test cases for AttributesImpl API.
  */
-public class AttrImplTest extends JAXPBaseTest {
+/*
+ * @test
+ * @library /javax/xml/jaxp/libs
+ * @run testng/othervm -DrunSecMngr=true org.xml.sax.ptests.AttrImplTest
+ * @run testng/othervm org.xml.sax.ptests.AttrImplTest
+ */
+@Listeners({jaxp.library.BasePolicy.class})
+public class AttrImplTest {
     private static final String CAR_URI = "http://www.cars.com/xml";
 
     private static final String CAR_LOCALNAME = "part";
@@ -194,3 +202,5 @@
         attr.removeAttribute(1);
     }
 }
+
+
diff --git a/jaxp/test/javax/xml/jaxp/functional/org/xml/sax/ptests/AttributesNSTest.java b/jaxp/test/javax/xml/jaxp/functional/org/xml/sax/ptests/AttributesNSTest.java
index 8309fc1..f42dc9c 100644
--- a/jaxp/test/javax/xml/jaxp/functional/org/xml/sax/ptests/AttributesNSTest.java
+++ b/jaxp/test/javax/xml/jaxp/functional/org/xml/sax/ptests/AttributesNSTest.java
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2003, 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2003, 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
@@ -22,17 +22,20 @@
  */
 package org.xml.sax.ptests;
 
-import java.io.File;
-import javax.xml.parsers.SAXParser;
-import javax.xml.parsers.SAXParserFactory;
-import jaxp.library.JAXPFileBaseTest;
 import static jaxp.library.JAXPTestUtilities.USER_DIR;
 import static jaxp.library.JAXPTestUtilities.compareWithGold;
 import static org.testng.Assert.assertTrue;
-import org.testng.annotations.Test;
 import static org.xml.sax.ptests.SAXTestConst.GOLDEN_DIR;
 import static org.xml.sax.ptests.SAXTestConst.XML_DIR;
 
+import java.io.File;
+
+import javax.xml.parsers.SAXParser;
+import javax.xml.parsers.SAXParserFactory;
+
+import org.testng.annotations.Listeners;
+import org.testng.annotations.Test;
+
 /**
  * This tests the Attributes interface. Here the startElement() callback of
  * ContentHandler has Attributes as one of its arguments. Attributes
@@ -40,7 +43,14 @@
  * of Attributes interfaces are tested. This program uses Namespace processing
  * with namespaces in XML file. This program does not use Validation
  */
-public class AttributesNSTest extends JAXPFileBaseTest {
+/*
+ * @test
+ * @library /javax/xml/jaxp/libs
+ * @run testng/othervm -DrunSecMngr=true org.xml.sax.ptests.AttributesNSTest
+ * @run testng/othervm org.xml.sax.ptests.AttributesNSTest
+ */
+@Listeners({jaxp.library.FilePolicy.class})
+public class AttributesNSTest {
     /**
      * Test for Attribute Interface's setter/getter.
      *
@@ -64,3 +74,5 @@
         assertTrue(compareWithGold(goldFile, outputFile));
     }
 }
+
+
diff --git a/jaxp/test/javax/xml/jaxp/functional/org/xml/sax/ptests/AttributesTest.java b/jaxp/test/javax/xml/jaxp/functional/org/xml/sax/ptests/AttributesTest.java
index 351ceee..e56e945 100644
--- a/jaxp/test/javax/xml/jaxp/functional/org/xml/sax/ptests/AttributesTest.java
+++ b/jaxp/test/javax/xml/jaxp/functional/org/xml/sax/ptests/AttributesTest.java
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2003, 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2003, 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
@@ -22,17 +22,20 @@
  */
 package org.xml.sax.ptests;
 
-import java.io.File;
-import javax.xml.parsers.SAXParser;
-import javax.xml.parsers.SAXParserFactory;
-import jaxp.library.JAXPFileBaseTest;
 import static jaxp.library.JAXPTestUtilities.USER_DIR;
 import static jaxp.library.JAXPTestUtilities.compareWithGold;
 import static org.testng.Assert.assertTrue;
-import org.testng.annotations.Test;
 import static org.xml.sax.ptests.SAXTestConst.GOLDEN_DIR;
 import static org.xml.sax.ptests.SAXTestConst.XML_DIR;
 
+import java.io.File;
+
+import javax.xml.parsers.SAXParser;
+import javax.xml.parsers.SAXParserFactory;
+
+import org.testng.annotations.Listeners;
+import org.testng.annotations.Test;
+
 /**
  * This tests the Attributes interface. Here the startElement() callback of
  * ContentHandler has Attributes as one of its arguments. Attributes
@@ -41,7 +44,14 @@
  * This program uses Namespace processing without any namepsaces in xml file.
  * This program uses Validation
  */
-public class AttributesTest extends JAXPFileBaseTest {
+/*
+ * @test
+ * @library /javax/xml/jaxp/libs
+ * @run testng/othervm -DrunSecMngr=true org.xml.sax.ptests.AttributesTest
+ * @run testng/othervm org.xml.sax.ptests.AttributesTest
+ */
+@Listeners({jaxp.library.FilePolicy.class})
+public class AttributesTest {
     /**
      * Unit test for Attributes interface. Prints all attributes into output
      * file. Check it with golden file.
@@ -66,3 +76,5 @@
         assertTrue(compareWithGold(goldFile, outputFile));
     }
 }
+
+
diff --git a/jaxp/test/javax/xml/jaxp/functional/org/xml/sax/ptests/ContentHandlerTest.java b/jaxp/test/javax/xml/jaxp/functional/org/xml/sax/ptests/ContentHandlerTest.java
index 7ab081e..bbcb4b4 100644
--- a/jaxp/test/javax/xml/jaxp/functional/org/xml/sax/ptests/ContentHandlerTest.java
+++ b/jaxp/test/javax/xml/jaxp/functional/org/xml/sax/ptests/ContentHandlerTest.java
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2003, 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2003, 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
@@ -22,15 +22,20 @@
  */
 package org.xml.sax.ptests;
 
+import static jaxp.library.JAXPTestUtilities.USER_DIR;
+import static jaxp.library.JAXPTestUtilities.compareWithGold;
+import static org.testng.Assert.assertTrue;
+import static org.xml.sax.ptests.SAXTestConst.GOLDEN_DIR;
+import static org.xml.sax.ptests.SAXTestConst.XML_DIR;
+
 import java.io.BufferedWriter;
 import java.io.FileInputStream;
 import java.io.FileWriter;
 import java.io.IOException;
+
 import javax.xml.parsers.SAXParserFactory;
-import jaxp.library.JAXPFileBaseTest;
-import static jaxp.library.JAXPTestUtilities.USER_DIR;
-import static jaxp.library.JAXPTestUtilities.compareWithGold;
-import static org.testng.Assert.assertTrue;
+
+import org.testng.annotations.Listeners;
 import org.testng.annotations.Test;
 import org.xml.sax.Attributes;
 import org.xml.sax.InputSource;
@@ -38,15 +43,20 @@
 import org.xml.sax.SAXException;
 import org.xml.sax.XMLReader;
 import org.xml.sax.helpers.XMLFilterImpl;
-import static org.xml.sax.ptests.SAXTestConst.GOLDEN_DIR;
-import static org.xml.sax.ptests.SAXTestConst.XML_DIR;
 
 /**
  * Class registers a content event handler to XMLReader. Content event handler
  * transverses XML and print all visited node  when XMLreader parses XML. Test
  * verifies output is same as the golden file.
  */
-public class ContentHandlerTest extends JAXPFileBaseTest {
+/*
+ * @test
+ * @library /javax/xml/jaxp/libs
+ * @run testng/othervm -DrunSecMngr=true org.xml.sax.ptests.ContentHandlerTest
+ * @run testng/othervm org.xml.sax.ptests.ContentHandlerTest
+ */
+@Listeners({jaxp.library.FilePolicy.class})
+public class ContentHandlerTest {
     /**
      * Content event handler visit all nodes to print to output file.
      *
@@ -254,3 +264,5 @@
             bWriter.close();
     }
 }
+
+
diff --git a/jaxp/test/javax/xml/jaxp/functional/org/xml/sax/ptests/DefaultHandlerTest.java b/jaxp/test/javax/xml/jaxp/functional/org/xml/sax/ptests/DefaultHandlerTest.java
index 309c95d..f8cce65 100644
--- a/jaxp/test/javax/xml/jaxp/functional/org/xml/sax/ptests/DefaultHandlerTest.java
+++ b/jaxp/test/javax/xml/jaxp/functional/org/xml/sax/ptests/DefaultHandlerTest.java
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2003, 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2003, 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
@@ -22,30 +22,40 @@
  */
 package org.xml.sax.ptests;
 
+import static jaxp.library.JAXPTestUtilities.USER_DIR;
+import static jaxp.library.JAXPTestUtilities.compareWithGold;
+import static org.testng.Assert.assertTrue;
+import static org.xml.sax.ptests.SAXTestConst.GOLDEN_DIR;
+import static org.xml.sax.ptests.SAXTestConst.XML_DIR;
+
 import java.io.BufferedWriter;
 import java.io.File;
 import java.io.FileWriter;
 import java.io.IOException;
+
 import javax.xml.parsers.SAXParser;
 import javax.xml.parsers.SAXParserFactory;
-import jaxp.library.JAXPFileBaseTest;
-import static jaxp.library.JAXPTestUtilities.USER_DIR;
-import static jaxp.library.JAXPTestUtilities.compareWithGold;
-import static org.testng.Assert.assertTrue;
+
+import org.testng.annotations.Listeners;
 import org.testng.annotations.Test;
 import org.xml.sax.Attributes;
 import org.xml.sax.Locator;
 import org.xml.sax.SAXException;
 import org.xml.sax.SAXParseException;
 import org.xml.sax.helpers.DefaultHandler;
-import static org.xml.sax.ptests.SAXTestConst.GOLDEN_DIR;
-import static org.xml.sax.ptests.SAXTestConst.XML_DIR;
 
 /**
  * XMLReader parse XML with default handler that transverses XML and
  * print all visited node. Test verifies output is same as the golden file.
  */
-public class DefaultHandlerTest extends JAXPFileBaseTest {
+/*
+ * @test
+ * @library /javax/xml/jaxp/libs
+ * @run testng/othervm -DrunSecMngr=true org.xml.sax.ptests.DefaultHandlerTest
+ * @run testng/othervm org.xml.sax.ptests.DefaultHandlerTest
+ */
+@Listeners({jaxp.library.FilePolicy.class})
+public class DefaultHandlerTest {
     /**
      * Test default handler that transverses XML and  print all visited node.
      *
@@ -262,3 +272,5 @@
         }
     }
 }
+
+
diff --git a/jaxp/test/javax/xml/jaxp/functional/org/xml/sax/ptests/EHFatalTest.java b/jaxp/test/javax/xml/jaxp/functional/org/xml/sax/ptests/EHFatalTest.java
index d8ad68c..9d4621a 100644
--- a/jaxp/test/javax/xml/jaxp/functional/org/xml/sax/ptests/EHFatalTest.java
+++ b/jaxp/test/javax/xml/jaxp/functional/org/xml/sax/ptests/EHFatalTest.java
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2003, 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2003, 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
@@ -22,31 +22,41 @@
  */
 package org.xml.sax.ptests;
 
-import java.io.BufferedWriter;
-import java.io.FileInputStream;
-import java.io.FileWriter;
-import java.io.IOException;
-import javax.xml.parsers.SAXParser;
-import javax.xml.parsers.SAXParserFactory;
-import jaxp.library.JAXPFileBaseTest;
 import static jaxp.library.JAXPTestUtilities.USER_DIR;
 import static jaxp.library.JAXPTestUtilities.compareWithGold;
 import static org.testng.Assert.assertTrue;
 import static org.testng.Assert.fail;
+import static org.xml.sax.ptests.SAXTestConst.GOLDEN_DIR;
+import static org.xml.sax.ptests.SAXTestConst.XML_DIR;
+
+import java.io.BufferedWriter;
+import java.io.FileInputStream;
+import java.io.FileWriter;
+import java.io.IOException;
+
+import javax.xml.parsers.SAXParser;
+import javax.xml.parsers.SAXParserFactory;
+
+import org.testng.annotations.Listeners;
 import org.testng.annotations.Test;
 import org.xml.sax.InputSource;
 import org.xml.sax.SAXException;
 import org.xml.sax.SAXParseException;
 import org.xml.sax.XMLReader;
 import org.xml.sax.helpers.XMLFilterImpl;
-import static org.xml.sax.ptests.SAXTestConst.GOLDEN_DIR;
-import static org.xml.sax.ptests.SAXTestConst.XML_DIR;
 
 /**
  * ErrorHandler unit test. Set a ErrorHandle to XMLReader. Capture fatal error
  * events in ErrorHandler.
  */
-public class EHFatalTest extends JAXPFileBaseTest {
+/*
+ * @test
+ * @library /javax/xml/jaxp/libs
+ * @run testng/othervm -DrunSecMngr=true org.xml.sax.ptests.EHFatalTest
+ * @run testng/othervm org.xml.sax.ptests.EHFatalTest
+ */
+@Listeners({jaxp.library.FilePolicy.class})
+public class EHFatalTest {
     /**
      * Error Handler to capture all error events to output file. Verifies the
      * output file is same as golden file.
@@ -125,3 +135,5 @@
         bWriter.close();
     }
 }
+
+
diff --git a/jaxp/test/javax/xml/jaxp/functional/org/xml/sax/ptests/NSSupportTest.java b/jaxp/test/javax/xml/jaxp/functional/org/xml/sax/ptests/NSSupportTest.java
index a8731a4..148f46a 100644
--- a/jaxp/test/javax/xml/jaxp/functional/org/xml/sax/ptests/NSSupportTest.java
+++ b/jaxp/test/javax/xml/jaxp/functional/org/xml/sax/ptests/NSSupportTest.java
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2003, 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2003, 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
@@ -22,17 +22,26 @@
  */
 package org.xml.sax.ptests;
 
-import java.util.Enumeration;
-import jaxp.library.JAXPBaseTest;
 import static org.testng.Assert.assertEquals;
 import static org.testng.Assert.assertNull;
+
+import java.util.Enumeration;
+
+import org.testng.annotations.Listeners;
 import org.testng.annotations.Test;
 import org.xml.sax.helpers.NamespaceSupport;
 
 /**
  * Unit test cases for NamespaceSupport API
  */
-public class NSSupportTest extends JAXPBaseTest {
+/*
+ * @test
+ * @library /javax/xml/jaxp/libs
+ * @run testng/othervm -DrunSecMngr=true org.xml.sax.ptests.NSSupportTest
+ * @run testng/othervm org.xml.sax.ptests.NSSupportTest
+ */
+@Listeners({jaxp.library.BasePolicy.class})
+public class NSSupportTest {
     /**
      * Empty prefix name.
      */
@@ -122,3 +131,5 @@
         assertNull(support.getURI(DC_PREFIX));
     }
 }
+
+
diff --git a/jaxp/test/javax/xml/jaxp/functional/org/xml/sax/ptests/NSTableTest.java b/jaxp/test/javax/xml/jaxp/functional/org/xml/sax/ptests/NSTableTest.java
index 72a8cf3..615554f 100644
--- a/jaxp/test/javax/xml/jaxp/functional/org/xml/sax/ptests/NSTableTest.java
+++ b/jaxp/test/javax/xml/jaxp/functional/org/xml/sax/ptests/NSTableTest.java
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2003, 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2003, 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
@@ -22,11 +22,13 @@
  */
 package org.xml.sax.ptests;
 
-import javax.xml.parsers.SAXParser;
-import javax.xml.parsers.SAXParserFactory;
-import jaxp.library.JAXPBaseTest;
 import static org.testng.Assert.assertFalse;
 import static org.testng.Assert.assertTrue;
+
+import javax.xml.parsers.SAXParser;
+import javax.xml.parsers.SAXParserFactory;
+
+import org.testng.annotations.Listeners;
 import org.testng.annotations.Test;
 import org.xml.sax.XMLReader;
 
@@ -34,7 +36,14 @@
  * Class containing the test cases for Namespace Table defined at
  * http://www.megginson.com/SAX/Java/namespaces.html
  */
-public class NSTableTest extends JAXPBaseTest {
+/*
+ * @test
+ * @library /javax/xml/jaxp/libs
+ * @run testng/othervm -DrunSecMngr=true org.xml.sax.ptests.NSTableTest
+ * @run testng/othervm org.xml.sax.ptests.NSTableTest
+ */
+@Listeners({jaxp.library.BasePolicy.class})
+public class NSTableTest {
     private static final String NAMESPACES =
                         "http://xml.org/sax/features/namespaces";
     private static final String NAMESPACE_PREFIXES =
@@ -159,3 +168,5 @@
         assertFalse(spf.getFeature(NAMESPACE_PREFIXES));
     }
 }
+
+
diff --git a/jaxp/test/javax/xml/jaxp/functional/org/xml/sax/ptests/ParserAdapterTest.java b/jaxp/test/javax/xml/jaxp/functional/org/xml/sax/ptests/ParserAdapterTest.java
index f7ee1e9..4fb4de2 100644
--- a/jaxp/test/javax/xml/jaxp/functional/org/xml/sax/ptests/ParserAdapterTest.java
+++ b/jaxp/test/javax/xml/jaxp/functional/org/xml/sax/ptests/ParserAdapterTest.java
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2003, 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2003, 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
@@ -22,12 +22,16 @@
  */
 package org.xml.sax.ptests;
 
-import java.io.FileInputStream;
-import javax.xml.parsers.SAXParserFactory;
-import jaxp.library.JAXPFileReadOnlyBaseTest;
 import static org.testng.Assert.assertFalse;
 import static org.testng.Assert.assertNotNull;
 import static org.testng.Assert.assertTrue;
+import static org.xml.sax.ptests.SAXTestConst.XML_DIR;
+
+import java.io.FileInputStream;
+
+import javax.xml.parsers.SAXParserFactory;
+
+import org.testng.annotations.Listeners;
 import org.testng.annotations.Test;
 import org.xml.sax.ContentHandler;
 import org.xml.sax.InputSource;
@@ -37,14 +41,20 @@
 import org.xml.sax.helpers.ParserAdapter;
 import org.xml.sax.helpers.XMLFilterImpl;
 import org.xml.sax.helpers.XMLReaderAdapter;
-import static org.xml.sax.ptests.SAXTestConst.XML_DIR;
 
 
 /**
  * Unit test cases for ParserAdapter API. By default the only features recognized
  * are namespaces and namespace-prefixes.
  */
-public class ParserAdapterTest extends JAXPFileReadOnlyBaseTest {
+/*
+ * @test
+ * @library /javax/xml/jaxp/libs
+ * @run testng/othervm -DrunSecMngr=true org.xml.sax.ptests.ParserAdapterTest
+ * @run testng/othervm org.xml.sax.ptests.ParserAdapterTest
+ */
+@Listeners({jaxp.library.FilePolicy.class})
+public class ParserAdapterTest {
     /**
      * namespaces feature name.
      */
@@ -234,7 +244,7 @@
      *
      * @throws Exception If any errors occur.
      */
-    @Test(groups = {"readLocalFiles"}, expectedExceptions = SAXException.class)
+    @Test(expectedExceptions = SAXException.class)
     public void parse02() throws Exception {
         try(FileInputStream fis = new FileInputStream(XML_DIR + "invalid.xml")) {
             InputSource is = new InputSource(fis);
@@ -247,7 +257,7 @@
      *
      * @throws Exception If any errors occur.
      */
-    @Test(groups = {"readLocalFiles"})
+    @Test
     public void parse03() throws Exception {
         try(FileInputStream fis = new FileInputStream(XML_DIR + "correct.xml")) {
             InputSource is = new InputSource(fis);
@@ -255,3 +265,5 @@
         }
     }
 }
+
+
diff --git a/jaxp/test/javax/xml/jaxp/functional/org/xml/sax/ptests/ResolverTest.java b/jaxp/test/javax/xml/jaxp/functional/org/xml/sax/ptests/ResolverTest.java
index 38cece5..49796f2 100644
--- a/jaxp/test/javax/xml/jaxp/functional/org/xml/sax/ptests/ResolverTest.java
+++ b/jaxp/test/javax/xml/jaxp/functional/org/xml/sax/ptests/ResolverTest.java
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2003, 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2003, 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
@@ -22,28 +22,45 @@
  */
 package org.xml.sax.ptests;
 
+import static java.nio.file.StandardCopyOption.REPLACE_EXISTING;
+import static jaxp.library.JAXPTestUtilities.USER_DIR;
+import static jaxp.library.JAXPTestUtilities.compareWithGold;
+import static org.testng.Assert.assertTrue;
+import static org.xml.sax.ptests.SAXTestConst.GOLDEN_DIR;
+import static org.xml.sax.ptests.SAXTestConst.XML_DIR;
+
 import java.io.BufferedWriter;
 import java.io.FileInputStream;
 import java.io.FileWriter;
 import java.io.IOException;
+import java.net.URI;
+import java.net.URISyntaxException;
+import java.nio.file.Files;
+import java.nio.file.Paths;
+
 import javax.xml.parsers.SAXParser;
 import javax.xml.parsers.SAXParserFactory;
-import jaxp.library.JAXPFileBaseTest;
-import static jaxp.library.JAXPTestUtilities.USER_DIR;
-import static jaxp.library.JAXPTestUtilities.compareWithGold;
-import static org.testng.Assert.assertTrue;
+
+import org.testng.annotations.Listeners;
+import org.testng.annotations.Test;
 import org.xml.sax.InputSource;
 import org.xml.sax.SAXException;
 import org.xml.sax.XMLReader;
 import org.xml.sax.helpers.XMLFilterImpl;
-import static org.xml.sax.ptests.SAXTestConst.GOLDEN_DIR;
-import static org.xml.sax.ptests.SAXTestConst.XML_DIR;
 
 /**
  * Entity resolver should be invoked in XML parse. This test verifies parsing
  * process by checking the output with golden file.
  */
-public class ResolverTest extends JAXPFileBaseTest {
+/*
+ * @test
+ * @library /javax/xml/jaxp/libs
+ * @run testng/othervm -DrunSecMngr=true org.xml.sax.ptests.ResolverTest
+ * @run testng/othervm org.xml.sax.ptests.ResolverTest
+ */
+@Test
+@Listeners({jaxp.library.FilePolicy.class})
+public class ResolverTest {
     /**
      * Unit test for entityResolver setter.
      *
@@ -54,6 +71,11 @@
         String goldFile = GOLDEN_DIR + "EntityResolverGF.out";
         String xmlFile = XML_DIR + "publish.xml";
 
+        Files.copy(Paths.get(XML_DIR + "publishers.dtd"),
+                Paths.get(USER_DIR + "publishers.dtd"), REPLACE_EXISTING);
+        Files.copy(Paths.get(XML_DIR + "familytree.dtd"),
+                Paths.get(USER_DIR + "familytree.dtd"), REPLACE_EXISTING);
+
         try(FileInputStream instream = new FileInputStream(xmlFile);
                 MyEntityResolver eResolver = new MyEntityResolver(outputFile)) {
             SAXParser saxParser = SAXParserFactory.newInstance().newSAXParser();
@@ -97,7 +119,7 @@
     @Override
     public InputSource resolveEntity(String publicid, String systemid)
             throws SAXException, IOException {
-        String str = "In resolveEntity.." + " " + publicid + " " + systemid;
+        String str = "In resolveEntity.." + " " + publicid + " " + getFileName(systemid);
         bWriter.write( str, 0,str.length());
         bWriter.newLine();
         return super.resolveEntity(publicid, systemid);
@@ -112,4 +134,14 @@
         bWriter.flush();
         bWriter.close();
     }
+
+    private String getFileName(String systemid) {
+        try {
+            return Paths.get(new URI(systemid)).getFileName().toString();
+        } catch (URISyntaxException e) {
+            throw new RuntimeException(e);
+        }
+    }
 }
+
+
diff --git a/jaxp/test/javax/xml/jaxp/functional/org/xml/sax/ptests/SAXParserNSTableTest.java b/jaxp/test/javax/xml/jaxp/functional/org/xml/sax/ptests/SAXParserNSTableTest.java
index cb748b6..84d534b 100644
--- a/jaxp/test/javax/xml/jaxp/functional/org/xml/sax/ptests/SAXParserNSTableTest.java
+++ b/jaxp/test/javax/xml/jaxp/functional/org/xml/sax/ptests/SAXParserNSTableTest.java
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2003, 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2003, 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
@@ -22,21 +22,31 @@
  */
 package org.xml.sax.ptests;
 
-import java.io.File;
-import javax.xml.parsers.SAXParserFactory;
-import jaxp.library.JAXPFileBaseTest;
 import static jaxp.library.JAXPTestUtilities.USER_DIR;
 import static jaxp.library.JAXPTestUtilities.compareWithGold;
 import static org.testng.Assert.assertTrue;
-import org.testng.annotations.Test;
 import static org.xml.sax.ptests.SAXTestConst.GOLDEN_DIR;
 import static org.xml.sax.ptests.SAXTestConst.XML_DIR;
 
+import java.io.File;
+
+import javax.xml.parsers.SAXParserFactory;
+
+import org.testng.annotations.Listeners;
+import org.testng.annotations.Test;
+
 /**
  * This class contains the testcases to test SAXParser with regard to
  * Namespace Table defined at http://www.megginson.com/SAX/Java/namespaces.html
  */
-public class SAXParserNSTableTest extends JAXPFileBaseTest {
+/*
+ * @test
+ * @library /javax/xml/jaxp/libs
+ * @run testng/othervm -DrunSecMngr=true org.xml.sax.ptests.SAXParserNSTableTest
+ * @run testng/othervm org.xml.sax.ptests.SAXParserNSTableTest
+ */
+@Listeners({jaxp.library.FilePolicy.class})
+public class SAXParserNSTableTest {
     /**
      * namespace processing is enabled. namespace-prefix is also is enabled.
      * So it is a True-True combination.
@@ -97,3 +107,5 @@
         assertTrue(compareWithGold(goldFile, outputFile));
     }
 }
+
+
diff --git a/jaxp/test/javax/xml/jaxp/functional/org/xml/sax/ptests/XMLFilterCBTest.java b/jaxp/test/javax/xml/jaxp/functional/org/xml/sax/ptests/XMLFilterCBTest.java
index 0d8fba8..9abea36 100644
--- a/jaxp/test/javax/xml/jaxp/functional/org/xml/sax/ptests/XMLFilterCBTest.java
+++ b/jaxp/test/javax/xml/jaxp/functional/org/xml/sax/ptests/XMLFilterCBTest.java
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2003, 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2003, 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
@@ -22,15 +22,21 @@
  */
 package org.xml.sax.ptests;
 
+import static jaxp.library.JAXPTestUtilities.USER_DIR;
+import static jaxp.library.JAXPTestUtilities.compareWithGold;
+import static org.testng.Assert.assertTrue;
+import static org.xml.sax.ptests.SAXTestConst.GOLDEN_DIR;
+import static org.xml.sax.ptests.SAXTestConst.XML_DIR;
+
 import java.io.BufferedWriter;
 import java.io.FileInputStream;
 import java.io.FileWriter;
 import java.io.IOException;
+
 import javax.xml.parsers.SAXParserFactory;
-import jaxp.library.JAXPFileBaseTest;
-import static jaxp.library.JAXPTestUtilities.USER_DIR;
-import static jaxp.library.JAXPTestUtilities.compareWithGold;
-import static org.testng.Assert.assertTrue;
+
+import org.testng.annotations.Listeners;
+import org.testng.annotations.Test;
 import org.xml.sax.Attributes;
 import org.xml.sax.InputSource;
 import org.xml.sax.Locator;
@@ -38,14 +44,20 @@
 import org.xml.sax.SAXParseException;
 import org.xml.sax.XMLReader;
 import org.xml.sax.helpers.XMLFilterImpl;
-import static org.xml.sax.ptests.SAXTestConst.GOLDEN_DIR;
-import static org.xml.sax.ptests.SAXTestConst.XML_DIR;
 
 /**
  * Set parent of XMLFilter to XMLReader. Parsing on XML file will invoke XMLFilter
  * to write to output file. Test verifies output is same as the golden file.
  */
-public class XMLFilterCBTest extends JAXPFileBaseTest {
+/*
+ * @test
+ * @library /javax/xml/jaxp/libs
+ * @run testng/othervm -DrunSecMngr=true org.xml.sax.ptests.XMLFilterCBTest
+ * @run testng/othervm org.xml.sax.ptests.XMLFilterCBTest
+ */
+@Test
+@Listeners({jaxp.library.FilePolicy.class})
+public class XMLFilterCBTest {
     /**
      * Test XMLFilter working with XML reader.
      *
@@ -273,3 +285,5 @@
             bWriter.close();
     }
 }
+
+
diff --git a/jaxp/test/javax/xml/jaxp/functional/org/xml/sax/ptests/XMLFilterTest.java b/jaxp/test/javax/xml/jaxp/functional/org/xml/sax/ptests/XMLFilterTest.java
index 52a91ce..df6bce2 100644
--- a/jaxp/test/javax/xml/jaxp/functional/org/xml/sax/ptests/XMLFilterTest.java
+++ b/jaxp/test/javax/xml/jaxp/functional/org/xml/sax/ptests/XMLFilterTest.java
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2003, 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2003, 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
@@ -22,23 +22,33 @@
  */
 package org.xml.sax.ptests;
 
-import java.io.FileInputStream;
-import javax.xml.parsers.SAXParserFactory;
-import jaxp.library.JAXPFileReadOnlyBaseTest;
 import static org.testng.Assert.assertFalse;
 import static org.testng.Assert.assertNotNull;
 import static org.testng.Assert.assertTrue;
+import static org.xml.sax.ptests.SAXTestConst.XML_DIR;
+
+import java.io.FileInputStream;
+
+import javax.xml.parsers.SAXParserFactory;
+
+import org.testng.annotations.Listeners;
 import org.testng.annotations.Test;
 import org.xml.sax.InputSource;
 import org.xml.sax.SAXNotRecognizedException;
 import org.xml.sax.XMLReader;
 import org.xml.sax.helpers.XMLFilterImpl;
-import static org.xml.sax.ptests.SAXTestConst.XML_DIR;
 
 /**
  * Unit test for XMLFilter.
  */
-public class XMLFilterTest extends JAXPFileReadOnlyBaseTest {
+/*
+ * @test
+ * @library /javax/xml/jaxp/libs
+ * @run testng/othervm -DrunSecMngr=true org.xml.sax.ptests.XMLFilterTest
+ * @run testng/othervm org.xml.sax.ptests.XMLFilterTest
+ */
+@Listeners({jaxp.library.FilePolicy.class})
+public class XMLFilterTest {
     /**
      * name spaces constant.
      */
@@ -217,7 +227,7 @@
      *
      * @throws Exception If any errors occur.
      */
-    @Test(groups = {"readLocalFiles"}, expectedExceptions = NullPointerException.class)
+    @Test(expectedExceptions = NullPointerException.class)
     public void parse02() throws Exception {
         try(FileInputStream fis = new FileInputStream(XML_DIR + "invalid.xml")) {
             new XMLFilterImpl().parse(new InputSource(fis));
@@ -229,10 +239,12 @@
      *
      * @throws Exception If any errors occur.
      */
-    @Test(groups = {"readLocalFiles"}, expectedExceptions = NullPointerException.class)
+    @Test(expectedExceptions = NullPointerException.class)
     public void parse03() throws Exception {
         try(FileInputStream fis = new FileInputStream(XML_DIR + "correct2.xml")) {
             new XMLFilterImpl().parse(new InputSource(fis));
         }
     }
 }
+
+
diff --git a/jaxp/test/javax/xml/jaxp/functional/org/xml/sax/ptests/XMLReaderAdapterTest.java b/jaxp/test/javax/xml/jaxp/functional/org/xml/sax/ptests/XMLReaderAdapterTest.java
index fff624d..9ea1a1a 100644
--- a/jaxp/test/javax/xml/jaxp/functional/org/xml/sax/ptests/XMLReaderAdapterTest.java
+++ b/jaxp/test/javax/xml/jaxp/functional/org/xml/sax/ptests/XMLReaderAdapterTest.java
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2003, 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2003, 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
@@ -22,24 +22,33 @@
  */
 package org.xml.sax.ptests;
 
-import java.io.FileInputStream;
-import java.io.FilePermission;
-import javax.xml.parsers.SAXParserFactory;
-import jaxp.library.JAXPBaseTest;
 import static org.testng.Assert.assertNotNull;
 import static org.testng.Assert.assertTrue;
+import static org.xml.sax.ptests.SAXTestConst.XML_DIR;
+
+import java.io.FileInputStream;
+
+import javax.xml.parsers.SAXParserFactory;
+
+import org.testng.annotations.Listeners;
 import org.testng.annotations.Test;
 import org.xml.sax.HandlerBase;
 import org.xml.sax.InputSource;
 import org.xml.sax.SAXException;
 import org.xml.sax.XMLReader;
 import org.xml.sax.helpers.XMLReaderAdapter;
-import static org.xml.sax.ptests.SAXTestConst.XML_DIR;
 
 /**
  * Class containing the test cases for XMLReaderAdapter API
  */
-public class XMLReaderAdapterTest extends JAXPBaseTest {
+/*
+ * @test
+ * @library /javax/xml/jaxp/libs
+ * @run testng/othervm -DrunSecMngr=true org.xml.sax.ptests.XMLReaderAdapterTest
+ * @run testng/othervm org.xml.sax.ptests.XMLReaderAdapterTest
+ */
+@Listeners({jaxp.library.FilePolicy.class})
+public class XMLReaderAdapterTest {
     /**
      * http://xml.org/sax/features/namespace-prefixes property name.
      */
@@ -92,7 +101,6 @@
      */
     @Test
     public void parse01() throws Exception {
-        setPermissions(new FilePermission(XML_DIR + "/-", "read"));
         try (FileInputStream fis = new FileInputStream(XML_DIR + "namespace1.xml")) {
             XMLReader xmlReader = SAXParserFactory.newInstance().newSAXParser().getXMLReader();
             if (!xmlReader.getFeature(NM_PREFIXES_PROPERTY)) {
@@ -102,6 +110,7 @@
             xmlRA.setDocumentHandler(new HandlerBase());
             xmlRA.parse(new InputSource(fis));
         }
-        setPermissions();
     }
 }
+
+
diff --git a/jaxp/test/javax/xml/jaxp/functional/org/xml/sax/ptests/XMLReaderFactoryTest.java b/jaxp/test/javax/xml/jaxp/functional/org/xml/sax/ptests/XMLReaderFactoryTest.java
index ae5e921..221244b 100644
--- a/jaxp/test/javax/xml/jaxp/functional/org/xml/sax/ptests/XMLReaderFactoryTest.java
+++ b/jaxp/test/javax/xml/jaxp/functional/org/xml/sax/ptests/XMLReaderFactoryTest.java
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2003, 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2003, 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
@@ -22,8 +22,11 @@
  */
 package org.xml.sax.ptests;
 
-import jaxp.library.JAXPBaseTest;
+import static jaxp.library.JAXPTestUtilities.setSystemProperty;
+
 import static org.testng.Assert.assertNotNull;
+
+import org.testng.annotations.Listeners;
 import org.testng.annotations.Test;
 import org.xml.sax.SAXException;
 import org.xml.sax.helpers.XMLReaderFactory;
@@ -31,7 +34,14 @@
 /**
  * Unit test for XMLReaderFactory.createXMLReader API.
  */
-public class XMLReaderFactoryTest extends JAXPBaseTest {
+/*
+ * @test
+ * @library /javax/xml/jaxp/libs
+ * @run testng/othervm -DrunSecMngr=true org.xml.sax.ptests.XMLReaderFactoryTest
+ * @run testng/othervm org.xml.sax.ptests.XMLReaderFactoryTest
+ */
+@Listeners({jaxp.library.BasePolicy.class})
+public class XMLReaderFactoryTest {
     /**
      * No exception expected when create XMLReader by default.
      * @throws org.xml.sax.SAXException when xml reader creation failed.
@@ -66,3 +76,5 @@
         XMLReaderFactory.createXMLReader("org.apache.crimson.parser.ABCD");
     }
 }
+
+
diff --git a/jaxp/test/javax/xml/jaxp/functional/org/xml/sax/ptests/XMLReaderNSTableTest.java b/jaxp/test/javax/xml/jaxp/functional/org/xml/sax/ptests/XMLReaderNSTableTest.java
index f9a2be0..9f91dde 100644
--- a/jaxp/test/javax/xml/jaxp/functional/org/xml/sax/ptests/XMLReaderNSTableTest.java
+++ b/jaxp/test/javax/xml/jaxp/functional/org/xml/sax/ptests/XMLReaderNSTableTest.java
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2003, 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2003, 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
@@ -22,23 +22,35 @@
  */
 package org.xml.sax.ptests;
 
-import java.io.FileInputStream;
-import javax.xml.parsers.SAXParser;
-import javax.xml.parsers.SAXParserFactory;
-import jaxp.library.JAXPFileBaseTest;
 import static jaxp.library.JAXPTestUtilities.USER_DIR;
 import static jaxp.library.JAXPTestUtilities.compareWithGold;
 import static org.testng.Assert.assertTrue;
-import org.xml.sax.InputSource;
-import org.xml.sax.XMLReader;
 import static org.xml.sax.ptests.SAXTestConst.GOLDEN_DIR;
 import static org.xml.sax.ptests.SAXTestConst.XML_DIR;
 
+import java.io.FileInputStream;
+
+import javax.xml.parsers.SAXParser;
+import javax.xml.parsers.SAXParserFactory;
+
+import org.testng.annotations.Listeners;
+import org.testng.annotations.Test;
+import org.xml.sax.InputSource;
+import org.xml.sax.XMLReader;
+
 /** This class contains the testcases to test XMLReader with regard to
   * Namespace Table defined at
   * http://www.megginson.com/SAX/Java/namespaces.html
   */
-public class XMLReaderNSTableTest extends JAXPFileBaseTest {
+/*
+ * @test
+ * @library /javax/xml/jaxp/libs
+ * @run testng/othervm -DrunSecMngr=true org.xml.sax.ptests.XMLReaderNSTableTest
+ * @run testng/othervm org.xml.sax.ptests.XMLReaderNSTableTest
+ */
+@Test
+@Listeners({jaxp.library.FilePolicy.class})
+public class XMLReaderNSTableTest {
     /**
      * XML file that used to be parsed.
      */
@@ -109,7 +121,7 @@
         String goldFile = GOLDEN_DIR + "NSTableFTGF.out";
 
         SAXParserFactory spf = SAXParserFactory.newInstance();
-        spf.setNamespaceAware(true);
+        //NamespaceAware is false by default, so don't need to set here
         XMLReader xmlReader = spf.newSAXParser().getXMLReader();
         try (FileInputStream fis = new FileInputStream(xmlFile);
             MyNSContentHandler handler = new MyNSContentHandler(outputFile)) {
@@ -119,3 +131,5 @@
         assertTrue(compareWithGold(goldFile, outputFile));
     }
 }
+
+
diff --git a/jaxp/test/javax/xml/jaxp/functional/org/xml/sax/ptests/XMLReaderTest.java b/jaxp/test/javax/xml/jaxp/functional/org/xml/sax/ptests/XMLReaderTest.java
index c01986f..0ba1ae5 100644
--- a/jaxp/test/javax/xml/jaxp/functional/org/xml/sax/ptests/XMLReaderTest.java
+++ b/jaxp/test/javax/xml/jaxp/functional/org/xml/sax/ptests/XMLReaderTest.java
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2003, 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2003, 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
@@ -22,14 +22,18 @@
  */
 package org.xml.sax.ptests;
 
-import java.io.FileInputStream;
-import javax.xml.parsers.SAXParserFactory;
-import jaxp.library.JAXPFileReadOnlyBaseTest;
 import static org.testng.Assert.assertEquals;
 import static org.testng.Assert.assertFalse;
 import static org.testng.Assert.assertNotNull;
 import static org.testng.Assert.assertNull;
 import static org.testng.Assert.assertTrue;
+import static org.xml.sax.ptests.SAXTestConst.XML_DIR;
+
+import java.io.FileInputStream;
+
+import javax.xml.parsers.SAXParserFactory;
+
+import org.testng.annotations.Listeners;
 import org.testng.annotations.Test;
 import org.xml.sax.InputSource;
 import org.xml.sax.SAXException;
@@ -39,12 +43,18 @@
 import org.xml.sax.ext.DeclHandler;
 import org.xml.sax.ext.LexicalHandler;
 import org.xml.sax.helpers.XMLFilterImpl;
-import static org.xml.sax.ptests.SAXTestConst.XML_DIR;
 
 /**
  * Class containing the test cases for SAXParser API
  */
-public class XMLReaderTest extends JAXPFileReadOnlyBaseTest {
+/*
+ * @test
+ * @library /javax/xml/jaxp/libs
+ * @run testng/othervm -DrunSecMngr=true org.xml.sax.ptests.XMLReaderTest
+ * @run testng/othervm org.xml.sax.ptests.XMLReaderTest
+ */
+@Listeners({jaxp.library.FilePolicy.class})
+public class XMLReaderTest {
 
     /**
      * XML namespaces.
@@ -434,7 +444,7 @@
      *
      * @throws Exception If any errors occur.
      */
-    @Test(groups = {"readLocalFiles"}, expectedExceptions = SAXException.class)
+    @Test(expectedExceptions = SAXException.class)
     public void parse02() throws Exception {
         try (FileInputStream fis = new FileInputStream(XML_DIR + "invalid.xml")) {
             SAXParserFactory spf = SAXParserFactory.newInstance();
@@ -448,7 +458,7 @@
      *
      * @throws Exception If any errors occur.
      */
-    @Test(groups = {"readLocalFiles"})
+    @Test
     public void parse03() throws Exception {
         try (FileInputStream fis = new FileInputStream(XML_DIR + "correct2.xml")) {
             SAXParserFactory spf = SAXParserFactory.newInstance();
@@ -661,3 +671,5 @@
     public void internalEntityDecl(String name, String value) {
     }
 }
+
+
diff --git a/jaxp/test/javax/xml/jaxp/functional/org/xml/sax/xmlfiles/familytree.dtd b/jaxp/test/javax/xml/jaxp/functional/org/xml/sax/xmlfiles/familytree.dtd
new file mode 100644
index 0000000..b913715
--- /dev/null
+++ b/jaxp/test/javax/xml/jaxp/functional/org/xml/sax/xmlfiles/familytree.dtd
@@ -0,0 +1 @@
+<familytree>purplelustrous</familytree>
diff --git a/jaxp/test/javax/xml/jaxp/functional/org/xml/sax/xmlfiles/out/EntityResolverGF.out b/jaxp/test/javax/xml/jaxp/functional/org/xml/sax/xmlfiles/out/EntityResolverGF.out
index a44ae1b..6bf3402 100644
--- a/jaxp/test/javax/xml/jaxp/functional/org/xml/sax/xmlfiles/out/EntityResolverGF.out
+++ b/jaxp/test/javax/xml/jaxp/functional/org/xml/sax/xmlfiles/out/EntityResolverGF.out
@@ -1,2 +1,2 @@
-In resolveEntity.. -//mkrishna mohan//DTD//music pub//EN/ http://sc11152338.us.oracle.com:8080/xmlsqe/jaxp/web/testfiles/JAXPREP/publishers.dtd
-In resolveEntity.. null http://sc11152338.us.oracle.com:8080/xmlsqe/jaxp/web/testfiles/JAXPREP/familytree.dtd
+In resolveEntity.. -//mkrishna mohan//DTD//music pub//EN/ publishers.dtd
+In resolveEntity.. null familytree.dtd
diff --git a/jaxp/test/javax/xml/jaxp/functional/org/xml/sax/xmlfiles/out/NSTableFTGF.out b/jaxp/test/javax/xml/jaxp/functional/org/xml/sax/xmlfiles/out/NSTableFTGF.out
index 491e0f5..6634b53 100644
--- a/jaxp/test/javax/xml/jaxp/functional/org/xml/sax/xmlfiles/out/NSTableFTGF.out
+++ b/jaxp/test/javax/xml/jaxp/functional/org/xml/sax/xmlfiles/out/NSTableFTGF.out
@@ -1,109 +1,59 @@
 setDocumentLocator...
 startDocument...
-startPrefixMapping...
-prefix: <xml> uri: <http://www.w3.org/XML/1998/namespace>
-startPrefixMapping...
-prefix: <xmlns> uri: <http://www.w3.org/2000/xmlns/>
 startElement...
 namespaceURI: <> localName: <> qName: <html> Number of Attributes: <2> Line# <3>
 characters...length is:3
 <
   >
-startPrefixMapping...
-prefix: <xml> uri: <http://www.w3.org/XML/1998/namespace>
-startPrefixMapping...
-prefix: <xmlns> uri: <http://www.w3.org/2000/xmlns/>
 startElement...
 namespaceURI: <> localName: <> qName: <head> Number of Attributes: <0> Line# <4>
 characters...length is:5
 <
     >
-startPrefixMapping...
-prefix: <xml> uri: <http://www.w3.org/XML/1998/namespace>
-startPrefixMapping...
-prefix: <xmlns> uri: <http://www.w3.org/2000/xmlns/>
 startElement...
 namespaceURI: <> localName: <> qName: <title> Number of Attributes: <0> Line# <5>
 characters...length is:10
 <Typography>
 endElement...
 namespaceURI: <> localName: <> qName: <title>
-endPrefixMapping...
-prefix: <xml>
-endPrefixMapping...
-prefix: <xmlns>
 characters...length is:3
 <
   >
 endElement...
 namespaceURI: <> localName: <> qName: <head>
-endPrefixMapping...
-prefix: <xml>
-endPrefixMapping...
-prefix: <xmlns>
 characters...length is:4
 <
 
   >
-startPrefixMapping...
-prefix: <xml> uri: <http://www.w3.org/XML/1998/namespace>
-startPrefixMapping...
-prefix: <xmlns> uri: <http://www.w3.org/2000/xmlns/>
 startElement...
 namespaceURI: <> localName: <> qName: <body> Number of Attributes: <0> Line# <8>
 characters...length is:5
 <
     >
-startPrefixMapping...
-prefix: <xml> uri: <http://www.w3.org/XML/1998/namespace>
-startPrefixMapping...
-prefix: <xmlns> uri: <http://www.w3.org/2000/xmlns/>
 startElement...
 namespaceURI: <> localName: <> qName: <p> Number of Attributes: <0> Line# <9>
 characters...length is:77
 < Welcome to the world of typography! Here is a book that you may find useful.>
 endElement...
 namespaceURI: <> localName: <> qName: <p>
-endPrefixMapping...
-prefix: <xml>
-endPrefixMapping...
-prefix: <xmlns>
 characters...length is:5
 <
     >
-startPrefixMapping...
-prefix: <xml> uri: <http://www.w3.org/XML/1998/namespace>
-startPrefixMapping...
-prefix: <xmlns> uri: <http://www.w3.org/2000/xmlns/>
 startElement...
 namespaceURI: <> localName: <> qName: <b:title> Number of Attributes: <1> Line# <10>
 characters...length is:18
 <Digital Typography>
 endElement...
 namespaceURI: <> localName: <> qName: <b:title>
-endPrefixMapping...
-prefix: <xml>
-endPrefixMapping...
-prefix: <xmlns>
-characters...length is:1
-< >
 characters...length is:5
 <
     >
-startPrefixMapping...
-prefix: <xml> uri: <http://www.w3.org/XML/1998/namespace>
-startPrefixMapping...
-prefix: <xmlns> uri: <http://www.w3.org/2000/xmlns/>
 startElement...
 namespaceURI: <> localName: <> qName: <b:author> Number of Attributes: <0> Line# <11>
 characters...length is:12
 <Donald Knuth>
 endElement...
 namespaceURI: <> localName: <> qName: <b:author>
-endPrefixMapping...
-prefix: <xml>
-endPrefixMapping...
-prefix: <xmlns>
 characters...length is:5
 <
     >
@@ -113,18 +63,10 @@
   >
 endElement...
 namespaceURI: <> localName: <> qName: <body>
-endPrefixMapping...
-prefix: <xml>
-endPrefixMapping...
-prefix: <xmlns>
 characters...length is:2
 <
 
 >
 endElement...
 namespaceURI: <> localName: <> qName: <html>
-endPrefixMapping...
-prefix: <xml>
-endPrefixMapping...
-prefix: <xmlns>
 endDocument...
diff --git a/jaxp/test/javax/xml/jaxp/functional/org/xml/sax/xmlfiles/publish.xml b/jaxp/test/javax/xml/jaxp/functional/org/xml/sax/xmlfiles/publish.xml
index 4c46f7b..e15cf98 100644
--- a/jaxp/test/javax/xml/jaxp/functional/org/xml/sax/xmlfiles/publish.xml
+++ b/jaxp/test/javax/xml/jaxp/functional/org/xml/sax/xmlfiles/publish.xml
@@ -1,6 +1,5 @@
 <?xml version="1.0" standalone="no"?>
-<!DOCTYPE document PUBLIC "-//mkrishna mohan//DTD//music pub//EN/"
-		"http://sc11152338.us.oracle.com:8080/xmlsqe/jaxp/web/testfiles/JAXPREP/publishers.dtd">
+<!DOCTYPE document PUBLIC "-//mkrishna mohan//DTD//music pub//EN/" "publishers.dtd">
 <document>
 	Publishers of the Music of New York Women Composers
 	<title>The Publishers </title>
diff --git a/jaxp/test/javax/xml/jaxp/functional/org/xml/sax/xmlfiles/publishers.dtd b/jaxp/test/javax/xml/jaxp/functional/org/xml/sax/xmlfiles/publishers.dtd
new file mode 100644
index 0000000..afbc4a9
--- /dev/null
+++ b/jaxp/test/javax/xml/jaxp/functional/org/xml/sax/xmlfiles/publishers.dtd
@@ -0,0 +1,16 @@
+<!ELEMENT document ANY>
+<!ELEMENT title (#PCDATA)>
+<!ELEMENT publisher_list (publisher*)>
+<!ELEMENT publisher (name, email?, homepage?, address?, voice?, fax?, dtdname?)>
+<!ELEMENT name (#PCDATA)>
+<!ELEMENT email (#PCDATA)>
+<!ELEMENT homepage (#PCDATA)>
+<!ELEMENT address (street+, city, state, zip, country?)>
+<!ELEMENT street (#PCDATA)>
+<!ELEMENT city (#PCDATA)>
+<!ELEMENT state (#PCDATA)>
+<!ELEMENT zip (#PCDATA)>
+<!ELEMENT country (#PCDATA)>
+<!ELEMENT voice (#PCDATA)>
+<!ELEMENT fax (#PCDATA)>
+<!ENTITY  familytree SYSTEM "familytree.dtd">
diff --git a/jaxp/test/javax/xml/jaxp/functional/test/astro/AstroTest.java b/jaxp/test/javax/xml/jaxp/functional/test/astro/AstroTest.java
index d31fd23..8671a12 100644
--- a/jaxp/test/javax/xml/jaxp/functional/test/astro/AstroTest.java
+++ b/jaxp/test/javax/xml/jaxp/functional/test/astro/AstroTest.java
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2002, 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2002, 2016, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -24,6 +24,7 @@
 package test.astro;
 
 import static java.lang.String.valueOf;
+import static jaxp.library.JAXPTestUtilities.USER_DIR;
 import static org.testng.Assert.assertEquals;
 import static test.astro.AstroConstants.ASTROCAT;
 import static test.astro.AstroConstants.GOLDEN_DIR;
@@ -35,13 +36,16 @@
 
 import javax.xml.transform.sax.TransformerHandler;
 
-import jaxp.library.JAXPFileBaseTest;
-
 import org.testng.annotations.BeforeClass;
 import org.testng.annotations.DataProvider;
+import org.testng.annotations.Listeners;
 import org.testng.annotations.Test;
 
 /*
+ * @test
+ * @library /javax/xml/jaxp/libs
+ * @run testng/othervm -DrunSecMngr=true test.astro.AstroTest
+ * @run testng/othervm test.astro.AstroTest
  * @summary run astro application, test xslt
  *
  * There are vast amounts of textual astronomical data, typically user is
@@ -66,7 +70,8 @@
  * AstroProcessor to test different JAXP classes and features.
  *
  */
-public class AstroTest extends JAXPFileBaseTest {
+@Listeners({jaxp.library.FilePolicy.class})
+public class AstroTest {
     private FiltersAndGolden[] data;
 
     @BeforeClass
@@ -107,7 +112,7 @@
         for (int i = 0; i < filterCreators.length; i++)
             filters[i] = filterCreators[i].createFilter(astro);
 
-        String outputfile = Files.createTempFile(Paths.get("").toAbsolutePath(), "query" + processNum + ".out.", null).toString();
+        String outputfile = Files.createTempFile(Paths.get(USER_DIR), "query" + processNum + ".out.", null).toString();
         System.out.println("output file: " + outputfile);
         astro.process(outputfile, filters);
         assertEquals(Files.readAllLines(Paths.get(outputfile)), goldenfileContent);
@@ -140,3 +145,4 @@
         }
     }
 }
+
diff --git a/jaxp/test/javax/xml/jaxp/functional/test/astro/DocumentLSTest.java b/jaxp/test/javax/xml/jaxp/functional/test/astro/DocumentLSTest.java
index b0a7628..20179d5 100644
--- a/jaxp/test/javax/xml/jaxp/functional/test/astro/DocumentLSTest.java
+++ b/jaxp/test/javax/xml/jaxp/functional/test/astro/DocumentLSTest.java
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2002, 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2002, 2016, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -40,8 +40,7 @@
 import javax.xml.parsers.DocumentBuilderFactory;
 import javax.xml.parsers.ParserConfigurationException;
 
-import jaxp.library.JAXPFileBaseTest;
-
+import org.testng.annotations.Listeners;
 import org.testng.annotations.Test;
 import org.w3c.dom.Document;
 import org.w3c.dom.Element;
@@ -52,9 +51,14 @@
 import org.w3c.dom.ls.LSSerializer;
 
 /*
+ * @test
+ * @library /javax/xml/jaxp/libs
+ * @run testng/othervm -DrunSecMngr=true test.astro.DocumentLSTest
+ * @run testng/othervm test.astro.DocumentLSTest
  * @summary org.w3c.dom.ls tests
  */
-public class DocumentLSTest extends JAXPFileBaseTest {
+@Listeners({jaxp.library.FilePolicy.class})
+public class DocumentLSTest {
     /*
      * Test creating an empty Document
      */
@@ -178,3 +182,4 @@
         return dbf.newDocumentBuilder();
     }
 }
+
diff --git a/jaxp/test/javax/xml/jaxp/functional/test/astro/NamespaceContextTest.java b/jaxp/test/javax/xml/jaxp/functional/test/astro/NamespaceContextTest.java
index 6a1d0dd..e9584a9 100644
--- a/jaxp/test/javax/xml/jaxp/functional/test/astro/NamespaceContextTest.java
+++ b/jaxp/test/javax/xml/jaxp/functional/test/astro/NamespaceContextTest.java
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2002, 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2002, 2016, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -28,14 +28,18 @@
 
 import javax.xml.namespace.QName;
 
-import jaxp.library.JAXPBaseTest;
-
+import org.testng.annotations.Listeners;
 import org.testng.annotations.Test;
 
 /*
+ * @test
+ * @library /javax/xml/jaxp/libs
+ * @run testng/othervm -DrunSecMngr=true test.astro.NamespaceContextTest
+ * @run testng/othervm test.astro.NamespaceContextTest
  * @summary javax.xml.namespace.QName tests
  */
-public class NamespaceContextTest extends JAXPBaseTest {
+@Listeners({jaxp.library.BasePolicy.class})
+public class NamespaceContextTest {
     private static final String PREFIX = "astro";
     private static final String LOCAL_PART = "stardb";
     private static final String NS_URI = "http://www.astro.com";
@@ -85,3 +89,4 @@
         assertEquals(QName.valueOf(qname.toString()), qname);
     }
 }
+
diff --git a/jaxp/test/javax/xml/jaxp/functional/test/astro/SAX201Test.java b/jaxp/test/javax/xml/jaxp/functional/test/astro/SAX201Test.java
index bcba454..d1bb70a 100644
--- a/jaxp/test/javax/xml/jaxp/functional/test/astro/SAX201Test.java
+++ b/jaxp/test/javax/xml/jaxp/functional/test/astro/SAX201Test.java
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2002, 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2002, 2016, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -24,15 +24,19 @@
 
 import javax.xml.parsers.SAXParserFactory;
 
-import jaxp.library.JAXPBaseTest;
-
+import org.testng.annotations.Listeners;
 import org.testng.annotations.Test;
 import org.xml.sax.XMLReader;
 
 /*
+ * @test
+ * @library /javax/xml/jaxp/libs
+ * @run testng/othervm -DrunSecMngr=true test.astro.SAX201Test
+ * @run testng/othervm test.astro.SAX201Test
  * @summary verify SAX 2.0.1 allows to use null in setters
  */
-public class SAX201Test extends JAXPBaseTest {
+@Listeners({jaxp.library.BasePolicy.class})
+public class SAX201Test {
     @Test
     public void test() throws Exception {
         SAXParserFactory spf = SAXParserFactory.newInstance();
@@ -44,3 +48,4 @@
         reader.setDTDHandler(null); // SAX 2.0.1 allows
     }
 }
+
diff --git a/jaxp/test/javax/xml/jaxp/functional/test/astro/SchemaValidationTest.java b/jaxp/test/javax/xml/jaxp/functional/test/astro/SchemaValidationTest.java
index c84fddb..6c557fb 100644
--- a/jaxp/test/javax/xml/jaxp/functional/test/astro/SchemaValidationTest.java
+++ b/jaxp/test/javax/xml/jaxp/functional/test/astro/SchemaValidationTest.java
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2002, 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2002, 2016, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -33,16 +33,20 @@
 import javax.xml.parsers.SAXParser;
 import javax.xml.parsers.SAXParserFactory;
 
-import jaxp.library.JAXPFileBaseTest;
-
+import org.testng.annotations.Listeners;
 import org.testng.annotations.Test;
 import org.xml.sax.SAXException;
 import org.xml.sax.helpers.DefaultHandler;
 
 /*
+ * @test
+ * @library /javax/xml/jaxp/libs
+ * @run testng/othervm -DrunSecMngr=true test.astro.SchemaValidationTest
+ * @run testng/othervm test.astro.SchemaValidationTest
  * @summary test parser sets schema related properties to do validation
  */
-public class SchemaValidationTest extends JAXPFileBaseTest {
+@Listeners({jaxp.library.FilePolicy.class})
+public class SchemaValidationTest {
     /*
      * Only set the schemaLanguage, without setting schemaSource. It should
      * work.
@@ -72,3 +76,4 @@
         return spf.newSAXParser();
     }
 }
+
diff --git a/jaxp/test/javax/xml/jaxp/functional/test/astro/XPathAPITest.java b/jaxp/test/javax/xml/jaxp/functional/test/astro/XPathAPITest.java
index a97590f..ba3aae0 100644
--- a/jaxp/test/javax/xml/jaxp/functional/test/astro/XPathAPITest.java
+++ b/jaxp/test/javax/xml/jaxp/functional/test/astro/XPathAPITest.java
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2002, 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2002, 2016, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -45,20 +45,24 @@
 import javax.xml.xpath.XPathFactory;
 import javax.xml.xpath.XPathVariableResolver;
 
-import jaxp.library.JAXPFileBaseTest;
-
 import org.testng.annotations.BeforeClass;
 import org.testng.annotations.DataProvider;
+import org.testng.annotations.Listeners;
 import org.testng.annotations.Test;
 import org.w3c.dom.Document;
 import org.w3c.dom.NodeList;
 import org.xml.sax.InputSource;
 
 /*
+ * @test
+ * @library /javax/xml/jaxp/libs
+ * @run testng/othervm -DrunSecMngr=true test.astro.XPathAPITest
+ * @run testng/othervm test.astro.XPathAPITest
  * @summary test XPath API
  */
 @Test(singleThreaded = true)
-public class XPathAPITest extends JAXPFileBaseTest {
+@Listeners({jaxp.library.FilePolicy.class})
+public class XPathAPITest {
     private static final String STARDB_STAR_3_CONSTELLATION = "//astro:stardb/astro:star[3]/astro:constellation";
     private static final String STARDB_STAR = "//astro:stardb/astro:star";
     private Document doc;
@@ -167,3 +171,4 @@
         return new InputSource(filenameToURL(ASTROCAT));
     }
 }
+
diff --git a/jaxp/test/javax/xml/jaxp/functional/test/auctionportal/AuctionController.java b/jaxp/test/javax/xml/jaxp/functional/test/auctionportal/AuctionController.java
index 576f44a..1238fb8 100644
--- a/jaxp/test/javax/xml/jaxp/functional/test/auctionportal/AuctionController.java
+++ b/jaxp/test/javax/xml/jaxp/functional/test/auctionportal/AuctionController.java
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2003, 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2003, 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
@@ -22,18 +22,23 @@
  */
 package test.auctionportal;
 
-import static test.auctionportal.HiBidConstants.JAXP_SCHEMA_LANGUAGE;
-import static test.auctionportal.HiBidConstants.JAXP_SCHEMA_SOURCE;
+import static javax.xml.XMLConstants.W3C_XML_SCHEMA_NS_URI;
+import static jaxp.library.JAXPTestUtilities.bomStream;
 import static org.testng.Assert.assertEquals;
 import static org.testng.Assert.assertFalse;
 import static org.testng.Assert.assertTrue;
+import static test.auctionportal.HiBidConstants.JAXP_SCHEMA_LANGUAGE;
+import static test.auctionportal.HiBidConstants.JAXP_SCHEMA_SOURCE;
+import static test.auctionportal.HiBidConstants.PORTAL_ACCOUNT_NS;
+import static test.auctionportal.HiBidConstants.XML_DIR;
+
 import java.io.File;
 import java.io.FileInputStream;
 import java.io.InputStream;
 import java.math.BigInteger;
 import java.nio.file.Paths;
 import java.util.GregorianCalendar;
-import static javax.xml.XMLConstants.W3C_XML_SCHEMA_NS_URI;
+
 import javax.xml.datatype.DatatypeConstants;
 import javax.xml.datatype.DatatypeFactory;
 import javax.xml.datatype.Duration;
@@ -46,8 +51,8 @@
 import javax.xml.validation.Schema;
 import javax.xml.validation.SchemaFactory;
 import javax.xml.validation.Validator;
-import jaxp.library.JAXPFileReadOnlyBaseTest;
-import static jaxp.library.JAXPTestUtilities.bomStream;
+
+import org.testng.annotations.Listeners;
 import org.testng.annotations.Test;
 import org.w3c.dom.Attr;
 import org.w3c.dom.DOMConfiguration;
@@ -58,20 +63,25 @@
 import org.w3c.dom.bootstrap.DOMImplementationRegistry;
 import org.w3c.dom.ls.DOMImplementationLS;
 import org.w3c.dom.ls.LSSerializer;
-import static test.auctionportal.HiBidConstants.PORTAL_ACCOUNT_NS;
-import static test.auctionportal.HiBidConstants.XML_DIR;
 
 /**
  * This is the user controller  class for the Auction portal HiBid.com.
  */
-public class AuctionController extends JAXPFileReadOnlyBaseTest {
+/*
+ * @test
+ * @library /javax/xml/jaxp/libs
+ * @run testng/othervm -DrunSecMngr=true test.auctionportal.AuctionController
+ * @run testng/othervm test.auctionportal.AuctionController
+ */
+@Listeners({jaxp.library.FilePolicy.class})
+public class AuctionController {
     /**
      * Check for DOMErrorHandler handling DOMError. Before fix of bug 4890927
      * DOMConfiguration.setParameter("well-formed",true) throws an exception.
      *
      * @throws Exception If any errors occur.
      */
-    @Test(groups = {"readLocalFiles"})
+    @Test
     public void testCreateNewItem2Sell() throws Exception {
         String xmlFile = XML_DIR + "novelsInvalid.xml";
 
@@ -94,7 +104,7 @@
      *
      * @throws Exception If any errors occur.
      */
-    @Test(groups = {"readLocalFiles"})
+    @Test
     public void testCreateNewItem2SellRetry() throws Exception  {
         String xmlFile = XML_DIR + "accountInfo.xml";
 
@@ -126,7 +136,7 @@
      *
      * @throws Exception If any errors occur.
      */
-    @Test(groups = {"readLocalFiles"})
+    @Test
     public void testCreateID() throws Exception {
         String xmlFile = XML_DIR + "accountInfo.xml";
 
@@ -147,7 +157,7 @@
      *
      * @throws Exception If any errors occur.
      */
-    @Test(groups = {"readLocalFiles"})
+    @Test
     public void testCheckingUserData() throws Exception {
         String xmlFile = XML_DIR + "accountInfo.xml";
 
@@ -184,7 +194,7 @@
      * @throws Exception If any errors occur.
      * @see <a href="content/movies.xml">movies.xml</a>
      */
-    @Test(groups = {"readLocalFiles"})
+    @Test
     public void testCheckingEncoding() throws Exception {
         // Note since movies.xml is UTF-16 encoding. We're not using stanard XML
         // file suffix.
@@ -206,7 +216,7 @@
      * @throws Exception If any errors occur.
      * @see <a href="content/userDetails.xsd">userDetails.xsd</a>
      */
-    @Test(groups = {"readLocalFiles"})
+    @Test
     public void testGetOwnerInfo() throws Exception {
         String schemaFile = XML_DIR + "userDetails.xsd";
         String xmlFile = XML_DIR + "userDetails.xml";
@@ -241,7 +251,7 @@
      * @see <a href="content/coins.xsd">coins.xsd</a>
      * @see <a href="content/coinsImportMe.xsd">coinsImportMe.xsd</a>
      */
-    @Test(groups = {"readLocalFiles"})
+    @Test
     public void testGetOwnerItemList() throws Exception {
         String xsdFile = XML_DIR + "coins.xsd";
         String xmlFile = XML_DIR + "coins.xml";
@@ -277,7 +287,7 @@
      * @see <a href="content/coinsImportMe.xsd">coinsImportMe.xsd</a>
      */
 
-    @Test(groups = {"readLocalFiles"})
+    @Test
     public void testGetOwnerItemList1() throws Exception {
         String xsdFile = XML_DIR + "coins.xsd";
         String xmlFile = XML_DIR + "coins.xml";
@@ -299,7 +309,7 @@
      *
      * @throws Exception If any errors occur.
      */
-    @Test(groups = {"readLocalFiles"})
+    @Test
     public void testGetItemDuration() throws Exception {
         String xmlFile = XML_DIR + "itemsDuration.xml";
 
@@ -332,7 +342,7 @@
      *
      * @throws Exception If any errors occur.
      */
-    @Test(groups = {"readLocalFiles"})
+    @Test
     public void testGetTypeInfo() throws Exception {
         String xmlFile = XML_DIR + "accountInfo.xml";
 
@@ -356,3 +366,5 @@
         assertTrue(roletypeInfo.getTypeNamespace().equals(PORTAL_ACCOUNT_NS));
     }
 }
+
+
diff --git a/jaxp/test/javax/xml/jaxp/functional/test/auctionportal/AuctionItemRepository.java b/jaxp/test/javax/xml/jaxp/functional/test/auctionportal/AuctionItemRepository.java
index 25e7864..4ab09cf 100644
--- a/jaxp/test/javax/xml/jaxp/functional/test/auctionportal/AuctionItemRepository.java
+++ b/jaxp/test/javax/xml/jaxp/functional/test/auctionportal/AuctionItemRepository.java
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2003, 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2003, 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
@@ -22,18 +22,26 @@
  */
 package test.auctionportal;
 
-import static test.auctionportal.HiBidConstants.SP_ENTITY_EXPANSION_LIMIT;
-import static test.auctionportal.HiBidConstants.SP_MAX_OCCUR_LIMIT;
+import static jaxp.library.JAXPTestUtilities.setSystemProperty;
+
+import static javax.xml.XMLConstants.FEATURE_SECURE_PROCESSING;
+import static javax.xml.XMLConstants.W3C_XML_SCHEMA_NS_URI;
+import static jaxp.library.JAXPTestUtilities.USER_DIR;
+import static jaxp.library.JAXPTestUtilities.compareDocumentWithGold;
+import static org.testng.Assert.assertFalse;
+import static org.testng.Assert.assertTrue;
+import static test.auctionportal.HiBidConstants.GOLDEN_DIR;
 import static test.auctionportal.HiBidConstants.JAXP_SCHEMA_LANGUAGE;
 import static test.auctionportal.HiBidConstants.JAXP_SCHEMA_SOURCE;
-import static org.testng.Assert.assertTrue;
+import static test.auctionportal.HiBidConstants.SP_ENTITY_EXPANSION_LIMIT;
+import static test.auctionportal.HiBidConstants.SP_MAX_OCCUR_LIMIT;
+import static test.auctionportal.HiBidConstants.XML_DIR;
+
 import java.io.File;
 import java.io.FileInputStream;
 import java.io.FileOutputStream;
-import java.io.FilePermission;
 import java.io.InputStream;
-import static javax.xml.XMLConstants.FEATURE_SECURE_PROCESSING;
-import static javax.xml.XMLConstants.W3C_XML_SCHEMA_NS_URI;
+
 import javax.xml.parsers.DocumentBuilder;
 import javax.xml.parsers.DocumentBuilderFactory;
 import javax.xml.parsers.SAXParser;
@@ -41,20 +49,23 @@
 import javax.xml.transform.TransformerFactory;
 import javax.xml.transform.dom.DOMSource;
 import javax.xml.transform.stream.StreamResult;
-import jaxp.library.JAXPFileBaseTest;
-import static jaxp.library.JAXPTestUtilities.USER_DIR;
-import static jaxp.library.JAXPTestUtilities.compareDocumentWithGold;
-import static org.testng.Assert.assertFalse;
+
+import org.testng.annotations.Listeners;
 import org.testng.annotations.Test;
 import org.w3c.dom.Document;
 import org.xml.sax.SAXParseException;
-import static test.auctionportal.HiBidConstants.GOLDEN_DIR;
-import static test.auctionportal.HiBidConstants.XML_DIR;
 
 /**
  * This is a test class for the Auction portal HiBid.com.
  */
-public class AuctionItemRepository extends JAXPFileBaseTest {
+/*
+ * @test
+ * @library /javax/xml/jaxp/libs
+ * @run testng/othervm -DrunSecMngr=true test.auctionportal.AuctionItemRepository
+ * @run testng/othervm test.auctionportal.AuctionItemRepository
+ */
+@Listeners({jaxp.library.FilePolicy.class})
+public class AuctionItemRepository {
     /**
      * XML file for parsing.
      */
@@ -84,7 +95,6 @@
         SAXParser parser = factory.newSAXParser();
 
         MyErrorHandler fatalHandler = new MyErrorHandler();
-        setPermissions(new FilePermission(ENTITY_XML, "read"));
         parser.parse(new File(ENTITY_XML), fatalHandler);
         assertFalse(fatalHandler.isAnyError());
     }
@@ -107,7 +117,6 @@
 
         SAXParser parser = factory.newSAXParser();
         MyErrorHandler fatalHandler = new MyErrorHandler();
-        setPermissions(new FilePermission(ENTITY_XML, "read"));
         parser.parse(new File(ENTITY_XML), fatalHandler);
     }
 
@@ -127,7 +136,6 @@
         setSystemProperty(SP_MAX_OCCUR_LIMIT, String.valueOf(10000));
         SAXParser parser = factory.newSAXParser();
         parser.setProperty(JAXP_SCHEMA_LANGUAGE, W3C_XML_SCHEMA_NS_URI);
-        setPermissions(new FilePermission(XML_DIR + "-", "read"));
         parser.setProperty(JAXP_SCHEMA_SOURCE, new File(schema_file));
         try (InputStream is = new FileInputStream(xml_file)) {
             MyErrorHandler eh = new MyErrorHandler();
@@ -150,13 +158,8 @@
         DocumentBuilder dBuilder = dfactory.newDocumentBuilder();
         MyErrorHandler eh = new MyErrorHandler();
         dBuilder.setErrorHandler(eh);
-        try {
-            setPermissions(new FilePermission(ENTITY_XML, "read"));
-            dBuilder.parse(ENTITY_XML);
-            assertFalse(eh.isAnyError());
-        } finally {
-            setPermissions();
-        }
+        dBuilder.parse(ENTITY_XML);
+        assertFalse(eh.isAnyError());
     }
 
     /**
@@ -174,7 +177,6 @@
         DocumentBuilder dBuilder = dfactory.newDocumentBuilder();
         MyErrorHandler eh = new MyErrorHandler();
         dBuilder.setErrorHandler(eh);
-        setPermissions(new FilePermission(ENTITY_XML, "read"));
         dBuilder.parse(ENTITY_XML);
     }
 
@@ -369,3 +371,5 @@
         assertTrue(compareDocumentWithGold(goldFile, resultFile));
     }
 }
+
+
diff --git a/jaxp/test/javax/xml/jaxp/functional/test/auctionportal/UserController.java b/jaxp/test/javax/xml/jaxp/functional/test/auctionportal/UserController.java
index b32cb3d..4ee18c4 100644
--- a/jaxp/test/javax/xml/jaxp/functional/test/auctionportal/UserController.java
+++ b/jaxp/test/javax/xml/jaxp/functional/test/auctionportal/UserController.java
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2003, 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2003, 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
@@ -22,20 +22,26 @@
  */
 package test.auctionportal;
 
-import static test.auctionportal.HiBidConstants.JAXP_SCHEMA_LANGUAGE;
+import static javax.xml.XMLConstants.W3C_XML_SCHEMA_NS_URI;
+import static jaxp.library.JAXPTestUtilities.USER_DIR;
+import static jaxp.library.JAXPTestUtilities.compareDocumentWithGold;
+import static org.testng.Assert.assertEquals;
 import static org.testng.Assert.assertFalse;
+import static org.testng.Assert.assertTrue;
+import static test.auctionportal.HiBidConstants.GOLDEN_DIR;
+import static test.auctionportal.HiBidConstants.JAXP_SCHEMA_LANGUAGE;
+import static test.auctionportal.HiBidConstants.PORTAL_ACCOUNT_NS;
+import static test.auctionportal.HiBidConstants.XML_DIR;
+
 import java.io.FileOutputStream;
 import java.nio.file.Files;
 import java.nio.file.Paths;
 import java.nio.file.StandardCopyOption;
-import static javax.xml.XMLConstants.W3C_XML_SCHEMA_NS_URI;
+
 import javax.xml.parsers.DocumentBuilder;
 import javax.xml.parsers.DocumentBuilderFactory;
-import jaxp.library.JAXPFileBaseTest;
-import static jaxp.library.JAXPTestUtilities.USER_DIR;
-import static jaxp.library.JAXPTestUtilities.compareDocumentWithGold;
-import static org.testng.Assert.assertEquals;
-import static org.testng.Assert.assertTrue;
+
+import org.testng.annotations.Listeners;
 import org.testng.annotations.Test;
 import org.w3c.dom.Attr;
 import org.w3c.dom.Document;
@@ -46,14 +52,18 @@
 import org.w3c.dom.ls.DOMImplementationLS;
 import org.w3c.dom.ls.LSParser;
 import org.w3c.dom.ls.LSSerializer;
-import static test.auctionportal.HiBidConstants.GOLDEN_DIR;
-import static test.auctionportal.HiBidConstants.PORTAL_ACCOUNT_NS;
-import static test.auctionportal.HiBidConstants.XML_DIR;
 
 /**
  * This is the user controller class for the Auction portal HiBid.com.
  */
-public class UserController extends JAXPFileBaseTest {
+/*
+ * @test
+ * @library /javax/xml/jaxp/libs
+ * @run testng/othervm -DrunSecMngr=true test.auctionportal.UserController
+ * @run testng/othervm test.auctionportal.UserController
+ */
+@Listeners({jaxp.library.FilePolicy.class})
+public class UserController {
     /**
      * Checking when creating an XML document using DOM Level 2 validating
      * it without having a schema source or a schema location It must throw a
@@ -150,7 +160,7 @@
      *
      * @throws Exception If any errors occur.
      */
-    @Test(groups = {"readLocalFiles"})
+    @Test
     public void testMoreUserInfo() throws Exception {
         String xmlFile = XML_DIR + "accountInfo.xml";
         DocumentBuilderFactory dbf = DocumentBuilderFactory.newInstance();
@@ -294,3 +304,5 @@
         assertTrue(compareDocumentWithGold(goldFile, resultFile));
     }
 }
+
+
diff --git a/jaxp/test/javax/xml/jaxp/functional/test/gaptest/Bug4511326.java b/jaxp/test/javax/xml/jaxp/functional/test/gaptest/Bug4511326.java
index fec94a1..65e38a7 100644
--- a/jaxp/test/javax/xml/jaxp/functional/test/gaptest/Bug4511326.java
+++ b/jaxp/test/javax/xml/jaxp/functional/test/gaptest/Bug4511326.java
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2003, 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2003, 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
@@ -29,16 +29,19 @@
 import javax.xml.transform.TransformerFactory;
 import javax.xml.transform.stream.StreamSource;
 
-import jaxp.library.JAXPBaseTest;
-
+import org.testng.annotations.Listeners;
 import org.testng.annotations.Test;
 
 /*
+ * @test
  * @bug 4511326
+ * @library /javax/xml/jaxp/libs
+ * @run testng/othervm -DrunSecMngr=true test.gaptest.Bug4511326
+ * @run testng/othervm test.gaptest.Bug4511326
  * @summary In forwards-compatible mode the attribute isn't ignored
  */
-
-public class Bug4511326 extends JAXPBaseTest {
+@Listeners({jaxp.library.BasePolicy.class})
+public class Bug4511326 {
 
     private static final String XSL = "<xsl:stylesheet version='2.0' "
                                + "xmlns:xsl='http://www.w3.org/1999/XSL/Transform'>"
@@ -61,3 +64,4 @@
     }
 
 }
+
diff --git a/jaxp/test/javax/xml/jaxp/functional/test/gaptest/Bug4512806.java b/jaxp/test/javax/xml/jaxp/functional/test/gaptest/Bug4512806.java
index 631b091..cfc74fd 100644
--- a/jaxp/test/javax/xml/jaxp/functional/test/gaptest/Bug4512806.java
+++ b/jaxp/test/javax/xml/jaxp/functional/test/gaptest/Bug4512806.java
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2003, 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2003, 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,15 +34,19 @@
 import javax.xml.transform.TransformerFactory;
 import javax.xml.transform.stream.StreamSource;
 
-import jaxp.library.JAXPBaseTest;
-
+import org.testng.annotations.Listeners;
 import org.testng.annotations.Test;
 
 /*
+ * @test
  * @bug 4512806
+ * @library /javax/xml/jaxp/libs
+ * @run testng/othervm -DrunSecMngr=true test.gaptest.Bug4512806
+ * @run testng/othervm test.gaptest.Bug4512806
  * @summary test transformer.setOutputProperties(null)
  */
-public class Bug4512806 extends JAXPBaseTest {
+@Listeners({jaxp.library.BasePolicy.class})
+public class Bug4512806 {
 
     @Test
     public void testProperty() throws TransformerConfigurationException {
@@ -86,3 +90,4 @@
 
 
 }
+
diff --git a/jaxp/test/javax/xml/jaxp/functional/test/gaptest/Bug4515047.java b/jaxp/test/javax/xml/jaxp/functional/test/gaptest/Bug4515047.java
index 0b822c8..a833c11 100644
--- a/jaxp/test/javax/xml/jaxp/functional/test/gaptest/Bug4515047.java
+++ b/jaxp/test/javax/xml/jaxp/functional/test/gaptest/Bug4515047.java
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2003, 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2003, 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
@@ -31,16 +31,19 @@
 import javax.xml.transform.dom.DOMSource;
 import javax.xml.transform.stream.StreamResult;
 
-import jaxp.library.JAXPBaseTest;
-
+import org.testng.annotations.Listeners;
 import org.testng.annotations.Test;
 
 /*
+ * @test
  * @bug 4515047
+ * @library /javax/xml/jaxp/libs
+ * @run testng/othervm -DrunSecMngr=true test.gaptest.Bug4515047
+ * @run testng/othervm test.gaptest.Bug4515047
  * @summary test transform an empty dom source
  */
-
-public class Bug4515047 extends JAXPBaseTest {
+@Listeners({jaxp.library.BasePolicy.class})
+public class Bug4515047 {
 
     @Test
     public void testCreateTxDoc() throws TransformerException, ParserConfigurationException {
@@ -59,3 +62,4 @@
     }
 
 }
+
diff --git a/jaxp/test/javax/xml/jaxp/functional/test/gaptest/Bug4515660.java b/jaxp/test/javax/xml/jaxp/functional/test/gaptest/Bug4515660.java
index 6f2c314..bff0d401 100644
--- a/jaxp/test/javax/xml/jaxp/functional/test/gaptest/Bug4515660.java
+++ b/jaxp/test/javax/xml/jaxp/functional/test/gaptest/Bug4515660.java
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2003, 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2003, 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
@@ -23,6 +23,9 @@
 
 package test.gaptest;
 
+import static jaxp.library.JAXPTestUtilities.setSystemProperty;
+import static jaxp.library.JAXPTestUtilities.clearSystemProperty;
+
 import static org.testng.Assert.assertTrue;
 
 import java.io.IOException;
@@ -39,21 +42,25 @@
 import javax.xml.transform.sax.SAXTransformerFactory;
 import javax.xml.transform.stream.StreamResult;
 
-import jaxp.library.JAXPBaseTest;
-
 import org.testng.annotations.AfterClass;
 import org.testng.annotations.BeforeClass;
+import org.testng.annotations.Listeners;
 import org.testng.annotations.Test;
 import org.xml.sax.InputSource;
 import org.xml.sax.SAXException;
 import org.xml.sax.helpers.XMLFilterImpl;
 
 /*
+ * @test
  * @bug 4515660
+ * @library /javax/xml/jaxp/libs
+ * @run testng/othervm -DrunSecMngr=true test.gaptest.Bug4515660
+ * @run testng/othervm test.gaptest.Bug4515660
  * @summary verify property org.xml.sax.driver is used by SAXTransformerFactory
  */
 @Test(singleThreaded = true)
-public class Bug4515660 extends JAXPBaseTest {
+@Listeners({jaxp.library.BasePolicy.class})
+public class Bug4515660 {
 
     @BeforeClass
     public void setSaxDrier() {
@@ -62,7 +69,7 @@
 
     @AfterClass
     public void clearSaxDrier() {
-        setSystemProperty("org.xml.sax.driver", null);
+        clearSystemProperty("org.xml.sax.driver");
     }
 
     @Test
@@ -121,3 +128,4 @@
     }
 
 }
+
diff --git a/jaxp/test/javax/xml/jaxp/functional/test/gaptest/Bug4693341.java b/jaxp/test/javax/xml/jaxp/functional/test/gaptest/Bug4693341.java
index d7d586b..8db96ac 100644
--- a/jaxp/test/javax/xml/jaxp/functional/test/gaptest/Bug4693341.java
+++ b/jaxp/test/javax/xml/jaxp/functional/test/gaptest/Bug4693341.java
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2003, 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2003, 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
@@ -42,24 +42,28 @@
 import javax.xml.transform.stream.StreamResult;
 import javax.xml.transform.stream.StreamSource;
 
-import jaxp.library.JAXPFileBaseTest;
-
+import org.testng.annotations.Listeners;
 import org.testng.annotations.Test;
 import org.xml.sax.SAXException;
 
 /*
+ * @test
  * @bug 4693341
+ * @library /javax/xml/jaxp/libs
+ * @run testng/othervm -DrunSecMngr=true test.gaptest.Bug4693341
+ * @run testng/othervm test.gaptest.Bug4693341
  * @summary test transforming to stream with external dtd
  */
 
-public class Bug4693341 extends JAXPFileBaseTest {
+@Listeners({jaxp.library.FilePolicy.class})
+public class Bug4693341 {
 
     @Test
     public void test() throws TransformerException, ParserConfigurationException, SAXException, IOException {
 
         Transformer transformer = TransformerFactory.newInstance().newTransformer();
 
-        String out = USER_DIR + File.separator + "Bug4693341.out";
+        String out = USER_DIR + "Bug4693341.out";
         StreamResult result = new StreamResult(new File(out));
 
         String in = XML_DIR + "Bug4693341.xml";
@@ -69,7 +73,7 @@
         System.out.println(source.getSystemId());
 
         Files.copy(Paths.get(XML_DIR + "Bug4693341.dtd"),
-                Paths.get(USER_DIR + File.separator + "Bug4693341.dtd"), REPLACE_EXISTING);
+                Paths.get(USER_DIR + "Bug4693341.dtd"), REPLACE_EXISTING);
 
         transformer.transform(source, result);
 
@@ -77,3 +81,4 @@
     }
 
 }
+
diff --git a/jaxp/test/javax/xml/jaxp/functional/test/gaptest/Bug4848653.java b/jaxp/test/javax/xml/jaxp/functional/test/gaptest/Bug4848653.java
index f4de775..4fa09cc 100644
--- a/jaxp/test/javax/xml/jaxp/functional/test/gaptest/Bug4848653.java
+++ b/jaxp/test/javax/xml/jaxp/functional/test/gaptest/Bug4848653.java
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2003, 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2003, 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
@@ -32,8 +32,7 @@
 import javax.xml.parsers.SAXParser;
 import javax.xml.parsers.SAXParserFactory;
 
-import jaxp.library.JAXPFileBaseTest;
-
+import org.testng.annotations.Listeners;
 import org.testng.annotations.Test;
 import org.xml.sax.ErrorHandler;
 import org.xml.sax.InputSource;
@@ -42,11 +41,15 @@
 import org.xml.sax.XMLReader;
 
 /*
+ * @test
  * @bug 4848653
+ * @library /javax/xml/jaxp/libs
+ * @run testng/othervm -DrunSecMngr=true test.gaptest.Bug4848653
+ * @run testng/othervm test.gaptest.Bug4848653
  * @summary Verify JAXP schemaLanguage property is ignored if setValidating(false)
  */
-
-public class Bug4848653 extends JAXPFileBaseTest {
+@Listeners({jaxp.library.FilePolicy.class})
+public class Bug4848653 {
 
     @Test
     public void test() throws IOException, SAXException, ParserConfigurationException {
@@ -78,3 +81,4 @@
     }
 
 }
+
diff --git a/jaxp/test/javax/xml/jaxp/functional/test/gaptest/Bug4858685.java b/jaxp/test/javax/xml/jaxp/functional/test/gaptest/Bug4858685.java
index 5dd5401..7bb8ea5 100644
--- a/jaxp/test/javax/xml/jaxp/functional/test/gaptest/Bug4858685.java
+++ b/jaxp/test/javax/xml/jaxp/functional/test/gaptest/Bug4858685.java
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2003, 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2003, 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
@@ -37,19 +37,22 @@
 import javax.xml.transform.dom.DOMResult;
 import javax.xml.transform.stream.StreamSource;
 
-import jaxp.library.JAXPFileBaseTest;
-
+import org.testng.annotations.Listeners;
 import org.testng.annotations.Test;
 import org.w3c.dom.NamedNodeMap;
 import org.w3c.dom.Node;
 import org.w3c.dom.NodeList;
 
 /*
+ * @test
  * @bug 4858685 4894410
+ * @library /javax/xml/jaxp/libs
+ * @run testng/othervm -DrunSecMngr=true test.gaptest.Bug4858685
+ * @run testng/othervm test.gaptest.Bug4858685
  * @summary test transforming text node
  */
-
-public class Bug4858685 extends JAXPFileBaseTest {
+@Listeners({jaxp.library.FilePolicy.class})
+public class Bug4858685 {
     @Test
     public void test() throws TransformerException, IOException {
         String uri = XML_DIR + "certificate.xml";
@@ -244,3 +247,4 @@
 
     }
 }
+
diff --git a/jaxp/test/javax/xml/jaxp/internaltest/TEST.properties b/jaxp/test/javax/xml/jaxp/internaltest/TEST.properties
deleted file mode 100644
index 9c55156..0000000
--- a/jaxp/test/javax/xml/jaxp/internaltest/TEST.properties
+++ /dev/null
@@ -1,3 +0,0 @@
-# jaxp test uses TestNG
-TestNG.dirs = javax/xml/common/bug6979306 javax/xml/parsers/bug8003147 javax/xml/transform/bug6551616 javax/xml/transform/cli
-
diff --git a/jaxp/test/javax/xml/jaxp/internaltest/javax/xml/parsers/bug8003147/Bug8003147Test.java b/jaxp/test/javax/xml/jaxp/internaltest/javax/xml/parsers/bug8003147/Bug8003147Test.java
deleted file mode 100644
index 2781c97..0000000
--- a/jaxp/test/javax/xml/jaxp/internaltest/javax/xml/parsers/bug8003147/Bug8003147Test.java
+++ /dev/null
@@ -1,81 +0,0 @@
-/*
- * Copyright (c) 2014, 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.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-
-/*
- * @test
- * @modules java.xml/com.sun.org.apache.bcel.internal.classfile
- *          java.xml/com.sun.org.apache.bcel.internal.generic
- * @bug 8003147
- * @summary Test port fix for BCEL bug 39695.
- */
-
-import java.io.FileOutputStream;
-import java.util.ArrayList;
-
-import org.testng.Assert;
-import org.testng.annotations.Test;
-
-import com.sun.org.apache.bcel.internal.classfile.ClassParser;
-import com.sun.org.apache.bcel.internal.classfile.ConstantClass;
-import com.sun.org.apache.bcel.internal.classfile.ConstantPool;
-import com.sun.org.apache.bcel.internal.classfile.ConstantUtf8;
-import com.sun.org.apache.bcel.internal.classfile.JavaClass;
-import com.sun.org.apache.bcel.internal.classfile.Method;
-import com.sun.org.apache.bcel.internal.generic.ClassGen;
-import com.sun.org.apache.bcel.internal.generic.MethodGen;
-
-public class Bug8003147Test {
-
-    @Test
-    public void test() throws Exception {
-        String classfile = getClass().getResource("Bug8003147Test.class").getPath();
-        JavaClass jc = new ClassParser(classfile).parse();
-        // rename class
-        ConstantPool cp = jc.getConstantPool();
-        int cpIndex = ((ConstantClass) cp.getConstant(jc.getClassNameIndex())).getNameIndex();
-        cp.setConstant(cpIndex, new ConstantUtf8("Bug8003147TestPrime"));
-        ClassGen gen = new ClassGen(jc);
-        Method[] methods = jc.getMethods();
-        int index;
-        for (index = 0; index < methods.length; index++) {
-            if (methods[index].getName().equals("doSomething")) {
-                break;
-            }
-        }
-        Method m = methods[index];
-        MethodGen mg = new MethodGen(m, gen.getClassName(), gen.getConstantPool());
-        gen.replaceMethod(m, mg.getMethod());
-        String path = classfile.replace("Bug8003147Test", "Bug8003147TestPrime");
-        gen.getJavaClass().dump(new FileOutputStream(path));
-
-        try {
-            Class.forName("Bug8003147TestPrime");
-        } catch (ClassFormatError cfe) {
-            cfe.printStackTrace();
-            Assert.fail("modified version of class does not pass verification");
-        }
-    }
-
-    public void doSomething(double d, ArrayList<Integer> list) {
-    }
-}
diff --git a/jaxp/test/javax/xml/jaxp/internaltest/javax/xml/transform/cli/tigertest-in.xml b/jaxp/test/javax/xml/jaxp/internaltest/javax/xml/transform/cli/tigertest-in.xml
deleted file mode 100644
index eeb3723..0000000
--- a/jaxp/test/javax/xml/jaxp/internaltest/javax/xml/transform/cli/tigertest-in.xml
+++ /dev/null
@@ -1,7 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<office:document xmlns:office="http://openoffice.org/2000/office" xmlns:style="http://openoffice.org/2000/style"  office:class="text" office:version="1.0">
-	<office:styles>
-		<style:default-style style:family="graphics"/>
-		<style:default-style style:family="paragraph"/>
-	</office:styles>
-</office:document>
diff --git a/jaxp/test/javax/xml/jaxp/internaltest/javax/xml/transform/cli/tigertest.xsl b/jaxp/test/javax/xml/jaxp/internaltest/javax/xml/transform/cli/tigertest.xsl
deleted file mode 100644
index 5b10fc8..0000000
--- a/jaxp/test/javax/xml/jaxp/internaltest/javax/xml/transform/cli/tigertest.xsl
+++ /dev/null
@@ -1,21 +0,0 @@
-<?xml version='1.0' encoding="UTF-8"?>

-<xsl:stylesheet version="1.0"

-		xmlns:xsl="http://www.w3.org/1999/XSL/Transform"

-		xmlns:office="http://openoffice.org/2000/office"

-		xmlns:style="http://openoffice.org/2000/style">

-

-	<xsl:output method="xml" encoding="UTF-8"/>

-

-	<xsl:template match="/">

-		<xsl:variable name="copyData">

-			<xsl:call-template name="copy-by-template" />

-		</xsl:variable>

-		<test>

-  		   <xsl:copy-of select="$copyData"/>

-		</test>

-	</xsl:template>

-

-	<xsl:template name="copy-by-template">

-		<xsl:copy-of select="/"/>

-	</xsl:template>

-</xsl:stylesheet>

diff --git a/jaxp/test/javax/xml/jaxp/isolatedjdk/TEST.properties b/jaxp/test/javax/xml/jaxp/isolatedjdk/TEST.properties
deleted file mode 100644
index 95fac7b..0000000
--- a/jaxp/test/javax/xml/jaxp/isolatedjdk/TEST.properties
+++ /dev/null
@@ -1,4 +0,0 @@
-lib.dirs=/javax/xml/jaxp/libs
-
-# Declare module dependency
-modules=java.xml
\ No newline at end of file
diff --git a/jaxp/test/javax/xml/jaxp/libs/catalog/CatalogTestUtils.java b/jaxp/test/javax/xml/jaxp/libs/catalog/CatalogTestUtils.java
index 0e0ff9f..a0e83d5 100644
--- a/jaxp/test/javax/xml/jaxp/libs/catalog/CatalogTestUtils.java
+++ b/jaxp/test/javax/xml/jaxp/libs/catalog/CatalogTestUtils.java
@@ -37,6 +37,8 @@
 import javax.xml.catalog.CatalogResolver;
 import javax.xml.catalog.CatalogUriResolver;
 
+import jaxp.library.JAXPTestUtilities;
+
 /*
  * Utilities for testing XML Catalog API.
  */
@@ -126,24 +128,10 @@
     static String getCatalogPath(String catalogName) {
         return catalogName == null
                 ? null
-                : getPathByClassName(CatalogTestUtils.class, "catalogFiles")
+                : JAXPTestUtilities.getPathByClassName(CatalogTestUtils.class, "catalogFiles")
                         + catalogName;
     }
 
-    /*
-     * Acquire a full path string by given class name and relative path string.
-     */
-    private static String getPathByClassName(Class<?> clazz,
-            String relativeDir) {
-        String packageName = FILE_SEP
-                + clazz.getPackage().getName().replaceAll("[.]", FILE_SEP);
-        String javaSourcePath = System.getProperty("test.src").replaceAll(
-                "\\" + File.separator, FILE_SEP) + packageName + FILE_SEP;
-        String normalizedPath = Paths.get(javaSourcePath,
-                relativeDir).normalize().toAbsolutePath().toString();
-        return normalizedPath.replace("\\", FILE_SEP) + FILE_SEP;
-    }
-
     /* ********** jaxp.properties ********** */
 
     /*
diff --git a/jaxp/test/javax/xml/jaxp/libs/jaxp/library/BasePolicy.java b/jaxp/test/javax/xml/jaxp/libs/jaxp/library/BasePolicy.java
new file mode 100644
index 0000000..5289148
--- /dev/null
+++ b/jaxp/test/javax/xml/jaxp/libs/jaxp/library/BasePolicy.java
@@ -0,0 +1,75 @@
+/*
+ * 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 jaxp.library;
+
+import org.testng.ITestContext;
+import org.testng.ITestListener;
+import org.testng.ITestResult;
+
+/**
+ * This policy includes default permissions.
+ * It should be used as one listener: either TestListener or MethodListener.
+ */
+public class BasePolicy implements ITestListener {
+
+    @Override
+    public void onFinish(ITestContext arg0) {
+        try {
+            JAXPPolicyManager.teardownPolicyManager();
+        } catch (Exception e) {
+            throw new RuntimeException("Failed to teardonw the policy manager", e);
+        }
+    }
+
+    @Override
+    public void onStart(ITestContext arg0) {
+        // suppose to only run othervm mode
+        if (isRunWithSecurityManager())
+            JAXPPolicyManager.getJAXPPolicyManager(true);
+    }
+
+    @Override
+    public void onTestFailedButWithinSuccessPercentage(ITestResult arg0) {
+    }
+
+    @Override
+    public void onTestFailure(ITestResult arg0) {
+    }
+
+    @Override
+    public void onTestSkipped(ITestResult arg0) {
+    }
+
+    @Override
+    public void onTestStart(ITestResult arg0) {
+    }
+
+    @Override
+    public void onTestSuccess(ITestResult arg0) {
+    }
+
+    protected boolean isRunWithSecurityManager() {
+        final String runSecMngr = JAXPTestUtilities.getSystemProperty("runSecMngr");
+        return runSecMngr != null && runSecMngr.equals("true");
+    }
+}
diff --git a/jaxp/test/javax/xml/jaxp/libs/jaxp/library/FilePolicy.java b/jaxp/test/javax/xml/jaxp/libs/jaxp/library/FilePolicy.java
new file mode 100644
index 0000000..d40c0c5
--- /dev/null
+++ b/jaxp/test/javax/xml/jaxp/libs/jaxp/library/FilePolicy.java
@@ -0,0 +1,51 @@
+/*
+ * 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 jaxp.library;
+
+import static jaxp.library.JAXPTestUtilities.getSystemProperty;
+
+import java.io.FilePermission;
+
+import org.testng.ITestContext;
+
+/**
+ * This policy can access local XML files.
+ */
+public class FilePolicy extends BasePolicy {
+
+    @Override
+    public void onStart(ITestContext arg0) {
+        // suppose to only run othervm mode
+        if (isRunWithSecurityManager()) {
+            JAXPPolicyManager policyManager = JAXPPolicyManager.getJAXPPolicyManager(true);
+            String userdir = getSystemProperty("user.dir");
+            policyManager.addPermission(new FilePermission(userdir + "/-", "read,write,delete"));
+            String testSrc = System.getProperty("test.src");
+            // to handle the directory structure of some functional test suite
+            if (testSrc.endsWith("ptests"))
+                testSrc = testSrc.substring(0, testSrc.length() - 7);
+            policyManager.addPermission(new FilePermission(testSrc + "/-", "read"));
+            policyManager.addPermission(new FilePermission(userdir, "read"));
+        }
+    }
+}
diff --git a/jaxp/test/javax/xml/jaxp/libs/jaxp/library/InternalAPIPolicy.java b/jaxp/test/javax/xml/jaxp/libs/jaxp/library/InternalAPIPolicy.java
new file mode 100644
index 0000000..b943144
--- /dev/null
+++ b/jaxp/test/javax/xml/jaxp/libs/jaxp/library/InternalAPIPolicy.java
@@ -0,0 +1,43 @@
+/*
+ * 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 jaxp.library;
+
+import org.testng.ITestContext;
+
+/**
+ * This policy can access internal jaxp packages.
+ */
+public class InternalAPIPolicy extends BasePolicy {
+
+    @Override
+    public void onStart(ITestContext arg0) {
+        // suppose to only run othervm mode
+        if (isRunWithSecurityManager()) {
+            JAXPPolicyManager policyManager = JAXPPolicyManager.getJAXPPolicyManager(true);
+            policyManager.addPermission(new RuntimePermission("accessClassInPackage.com.sun.org.apache.xerces.internal.jaxp"));
+            policyManager.addPermission(new RuntimePermission("accessClassInPackage.com.sun.org.apache.bcel.internal.classfile"));
+            policyManager.addPermission(new RuntimePermission("accessClassInPackage.com.sun.org.apache.bcel.internal.generic"));
+            policyManager.addPermission(new RuntimePermission("accessClassInPackage.com.sun.org.apache.xalan.internal.xsltc.trax"));
+        }
+    }
+}
diff --git a/jaxp/test/javax/xml/jaxp/libs/jaxp/library/JAXPBaseTest.java b/jaxp/test/javax/xml/jaxp/libs/jaxp/library/JAXPBaseTest.java
deleted file mode 100644
index 687ff70..0000000
--- a/jaxp/test/javax/xml/jaxp/libs/jaxp/library/JAXPBaseTest.java
+++ /dev/null
@@ -1,138 +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.
- *
- * 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 jaxp.library;
-
-import java.security.Permission;
-import java.security.Permissions;
-import java.security.Policy;
-import java.util.PropertyPermission;
-import org.testng.annotations.AfterClass;
-import org.testng.annotations.BeforeClass;
-
-/**
- * This is a base class that every test class must extend if it needs to be run
- * with security mode.
- */
-public class JAXPBaseTest {
-    /**
-     * Backing up policy.
-     */
-    protected static Policy policy;
-
-    /**
-     * Backing up security manager.
-     */
-    private static SecurityManager sm;
-
-    /*
-     * Install a SecurityManager along with a base Policy to allow testNG to
-     * run when there is a security manager.
-     */
-    @BeforeClass
-    public void setUpClass() throws Exception {
-        setPolicy(new TestPolicy());
-        System.setSecurityManager(new SecurityManager());
-    }
-
-    /*
-     * Install the original Policy and SecurityManager when there is a security
-     * manager.
-     */
-    @AfterClass
-    public void tearDownClass() throws Exception {
-        System.setSecurityManager(sm);
-        setPolicy(policy);
-    }
-
-    /*
-     * Utility Method used to set the current Policy.
-     */
-    protected static void setPolicy(Policy p) {
-        Policy.setPolicy(p);
-    }
-
-    /*
-     * Add the specified permission(s) to the test policy.
-     * Note there is no way to add permissions to current permissions. Reset
-     * test policy by setting minimal permmisons in addition to specified
-     * permissions when calling this method.
-     */
-    protected static void setPermissions(Permission... ps) {
-        Policy.setPolicy(new TestPolicy(ps));
-    }
-
-    /*
-     * Add the specified permission(s) to the test policy.
-     * Note there is no way to add permissions to current permissions. Reset
-     * test policy by setting minimal permmisons in addition to specified
-     * permissions when calling this method.
-     */
-    protected static void setPermissions(Permissions ps) {
-        Policy.setPolicy(new TestPolicy(ps));
-    }
-
-    /**
-     * Backing up policy and security manager for restore when there is a
-     * security manager.
-     */
-    public JAXPBaseTest() {
-        policy = Policy.getPolicy();
-        sm = System.getSecurityManager();
-    }
-
-    /**
-     * Safety acquire a system property.
-     * Note invocation of this method will restore permission to limited
-     * minimal permission of tests. If there is additional permission set
-     * already, you need restore permission by yourself.
-     * @param propName System property name to be acquired.
-     * @return property value
-     */
-    protected String getSystemProperty(final String propName) {
-        setPermissions(new PropertyPermission(propName, "read"));
-        try {
-            return System.getProperty(propName);
-        } finally {
-            setPermissions();
-        }
-    }
-
-    /**
-     * Safety set a system property by given system value.
-     *
-     * @param propName System property name to be set.
-     * @param propValue System property value to be set.
-     */
-    protected void setSystemProperty(final String propName, final String propValue) {
-        setPermissions(new PropertyPermission(propName, "write"));
-        try {
-            if (propValue == null) {
-                System.clearProperty(propName);
-            } else {
-                System.setProperty(propName, propValue);
-            }
-        } finally {
-            setPermissions();
-        }
-    }
-}
diff --git a/jaxp/test/javax/xml/jaxp/libs/jaxp/library/JAXPFileBaseTest.java b/jaxp/test/javax/xml/jaxp/libs/jaxp/library/JAXPFileBaseTest.java
deleted file mode 100644
index c45c6d3..0000000
--- a/jaxp/test/javax/xml/jaxp/libs/jaxp/library/JAXPFileBaseTest.java
+++ /dev/null
@@ -1,105 +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.
- *
- * 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 jaxp.library;
-
-import java.io.FilePermission;
-import java.security.Permission;
-import java.security.Permissions;
-import java.security.Policy;
-import static jaxp.library.JAXPBaseTest.setPolicy;
-import org.testng.annotations.BeforeClass;
-
-/**
- * This is a base class that every test class that need to access local XML
- * files must extend if it needs to be run with security mode.
- */
-public class JAXPFileBaseTest extends JAXPBaseTest {
-    /*
-     * Install a SecurityManager along with a base Policy to allow testNG to
-     * run when there is a security manager.
-     */
-    @BeforeClass
-    @Override
-    public void setUpClass() throws Exception {
-        setPolicy(new FileTestPolicy());
-        System.setSecurityManager(new SecurityManager());
-    }
-
-    /*
-     * Add the specified permission(s) to the test policy.
-     * Note there is no way to add permissions to current permissions. Reset
-     * test policy by setting minimal permmisons in addition to specified
-     * permissions when calling this method.
-     */
-    protected static void setPermissions(Permission... ps) {
-        Policy.setPolicy(new FileTestPolicy(ps));
-    }
-
-    /*
-     * Add the specified permission(s) to the test policy.
-     * Note there is no way to add permissions to current permissions. Reset
-     * test policy by setting minimal permmisons in addition to specified
-     * permissions when calling this method.
-     */
-    protected static void setPermissions(Permissions ps) {
-        Policy.setPolicy(new FileTestPolicy(ps));
-    }
-}
-
-/**
- * This policy is only given to tests that need access local files. Additional
- * permissions for accessing local files have been granted by default.
- * @author HaiboYan
- */
-class FileTestPolicy extends TestPolicy {
-    /**
-     * Constructor which sets the minimum permissions by default allowing testNG
-     * to work with a SecurityManager.
-     * @param ps permissions to be added.
-     */
-    public FileTestPolicy(Permissions ps) {
-        super(ps);
-    }
-
-    /**
-     * Constructor which sets the minimum permissions by default allowing testNG
-     * to work with a SecurityManager.
-     * @param ps permission array to be added.
-     */
-    public FileTestPolicy(Permission... ps) {
-        super(ps);
-    }
-
-    /**
-     * Defines the minimal permissions required by testNG when running these
-     * tests
-     */
-    @Override
-    protected void setMinimalPermissions() {
-        super.setMinimalPermissions();
-        permissions.add(new FilePermission(System.getProperty("user.dir") + "/-",
-                "read, write"));
-        permissions.add(new FilePermission(System.getProperty("test.src") + "/-",
-                "read"));
-    }
-}
diff --git a/jaxp/test/javax/xml/jaxp/libs/jaxp/library/JAXPFileReadOnlyBaseTest.java b/jaxp/test/javax/xml/jaxp/libs/jaxp/library/JAXPFileReadOnlyBaseTest.java
deleted file mode 100644
index eed9a05..0000000
--- a/jaxp/test/javax/xml/jaxp/libs/jaxp/library/JAXPFileReadOnlyBaseTest.java
+++ /dev/null
@@ -1,55 +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.
- *
- * 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 jaxp.library;
-
-import java.io.FilePermission;
-import static jaxp.library.JAXPBaseTest.setPermissions;
-import org.testng.annotations.AfterGroups;
-import org.testng.annotations.BeforeGroups;
-
-/**
- * This is a base class that every test class that need to reading local XML
- * files must extend if it needs to be run with security mode.
- */
-public class JAXPFileReadOnlyBaseTest extends JAXPBaseTest {
-    /**
-     * Source files/XML files directory.
-     */
-    private final String SRC_DIR = getSystemProperty("test.src");
-
-    /**
-     * Allowing access local file system for this group.
-     */
-    @BeforeGroups (groups = {"readLocalFiles"})
-    public void setFilePermissions() {
-        setPermissions(new FilePermission(SRC_DIR + "/-", "read"));
-    }
-
-    /**
-     * Restore the system property.
-     */
-    @AfterGroups (groups = {"readLocalFiles"})
-    public void restoreFilePermissions() {
-        setPermissions();
-    }
-}
diff --git a/jaxp/test/javax/xml/jaxp/libs/jaxp/library/JAXPPolicyManager.java b/jaxp/test/javax/xml/jaxp/libs/jaxp/library/JAXPPolicyManager.java
new file mode 100644
index 0000000..a52c854
--- /dev/null
+++ b/jaxp/test/javax/xml/jaxp/libs/jaxp/library/JAXPPolicyManager.java
@@ -0,0 +1,300 @@
+/*
+ * 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.
+ *
+ * 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 jaxp.library;
+
+
+import java.security.CodeSource;
+import java.security.Permission;
+import java.security.PermissionCollection;
+import java.security.Permissions;
+import java.security.Policy;
+import java.security.ProtectionDomain;
+import java.security.SecurityPermission;
+import java.util.Enumeration;
+import java.util.HashMap;
+import java.util.Map;
+import java.util.PropertyPermission;
+import java.util.StringJoiner;
+
+
+/*
+ * This is a base class that every test class must extend if it needs to be run
+ * with security mode.
+ */
+public class JAXPPolicyManager {
+    /*
+     * Backing up policy.
+     */
+    private Policy policyBackup;
+
+    /*
+     * Backing up security manager.
+     */
+    private SecurityManager smBackup;
+
+    /*
+     * Current policy.
+     */
+    private TestPolicy policy = new TestPolicy();
+
+    /*
+     * JAXPPolicyManager singleton.
+     */
+    private static JAXPPolicyManager policyManager = null;
+
+    /*
+     * Install a SecurityManager along with a default Policy to allow testNG to
+     * run when there is a security manager.
+     */
+    private JAXPPolicyManager() {
+        // Backing up policy and security manager for restore
+        policyBackup = Policy.getPolicy();
+        smBackup = System.getSecurityManager();
+
+        // Set customized policy
+        setDefaultPermissions();
+        Policy.setPolicy(policy);
+        System.setSecurityManager(new SecurityManager());
+    }
+
+    static synchronized JAXPPolicyManager getJAXPPolicyManager(boolean createIfNone) {
+        if (policyManager == null & createIfNone)
+            policyManager = new JAXPPolicyManager();
+        return policyManager;
+    }
+
+    private void teardown() throws Exception {
+        System.setSecurityManager(smBackup);
+        Policy.setPolicy(policyBackup);
+    }
+
+    /*
+     * Restore the original Policy and SecurityManager.
+     */
+    static synchronized void teardownPolicyManager() throws Exception {
+        if (policyManager != null) {
+            policyManager.teardown();
+            policyManager = null;
+        }
+    }
+
+    /*
+     * Set default permissions, sub-class of JAXPBaseTest should override this
+     * method.
+     */
+    private void setDefaultPermissions() {
+        //Permissions to set security manager and policy
+        addPermission(new SecurityPermission("getPolicy"));
+        addPermission(new SecurityPermission("setPolicy"));
+        addPermission(new RuntimePermission("setSecurityManager"));
+        //Properties that jtreg and TestNG require
+        addPermission(new PropertyPermission("testng.show.stack.frames", "read"));
+        addPermission(new PropertyPermission("test.src", "read"));
+        addPermission(new PropertyPermission("test.classes", "read"));
+        addPermission(new PropertyPermission("dataproviderthreadcount", "read"));
+        addPermission(new PropertyPermission("experimental", "read"));
+    }
+
+    /*
+     * Add permission to the TestPolicy.
+     *
+     * @param permission to be added.
+     */
+    void addPermission(Permission p) {
+        policy.addPermission(p);
+    }
+
+    /*
+     * Add a temporary permission in current thread context. This won't impact
+     * global policy and doesn't support permission combination.
+     *
+     * @param permission
+     *            to add.
+     * @return index of the added permission.
+     */
+    int addTmpPermission(Permission p) {
+        return policy.addTmpPermission(p);
+    }
+
+    /*
+     * set allowAll in current thread context.
+     */
+    void setAllowAll(boolean allow) {
+        policy.setAllowAll(allow);
+    }
+
+    /*
+     * Remove a temporary permission from current thread context.
+     *
+     * @param index to remove.
+     *
+     * @throws RuntimeException if no temporary permission list in current
+     *             thread context or no permission correlated to the index.
+     */
+    void removeTmpPermission(int index) {
+        policy.removeTmpPermission(index);
+    }
+
+
+}
+
+/*
+ * Simple Policy class that supports the required Permissions to validate the
+ * JAXP concrete classes.
+ */
+class TestPolicy extends Policy {
+    private final PermissionCollection permissions = new Permissions();
+
+    private ThreadLocal<Map<Integer, Permission>> transientPermissions = new ThreadLocal<>();
+    private ThreadLocal<Boolean> allowAll = new ThreadLocal<>();
+
+    private static Policy defaultPolicy = Policy.getPolicy();
+
+    /*
+     * Add permission to this policy.
+     *
+     * @param permission to be added.
+     */
+    void addPermission(Permission p) {
+        permissions.add(p);
+    }
+
+    /*
+     * Set all permissions. Caution: this should not called carefully unless
+     * it's really needed.
+     *
+     * private void setAllPermissions() { permissions.add(new AllPermission());
+     * }
+     */
+
+    /*
+     * Overloaded methods from the Policy class.
+     */
+    @Override
+    public String toString() {
+        StringJoiner sj = new StringJoiner("\n", "policy: ", "");
+        Enumeration<Permission> perms = permissions.elements();
+        while (perms.hasMoreElements()) {
+            sj.add(perms.nextElement().toString());
+        }
+        return sj.toString();
+
+    }
+
+    @Override
+    public PermissionCollection getPermissions(ProtectionDomain domain) {
+        return permissions;
+    }
+
+    @Override
+    public PermissionCollection getPermissions(CodeSource codesource) {
+        return permissions;
+    }
+
+    @Override
+    public boolean implies(ProtectionDomain domain, Permission perm) {
+        if (allowAll())
+            return true;
+
+        if (defaultPolicy.implies(domain, perm))
+            return true;
+
+        if (permissions.implies(perm))
+            return true;
+        else
+            return tmpImplies(perm);
+    }
+
+    /*
+     * Add a temporary permission in current thread context. This won't impact
+     * global policy and doesn't support permission combination.
+     *
+     * @param permission to add.
+     * @return index of the added permission.
+     */
+    int addTmpPermission(Permission p) {
+        Map<Integer, Permission> tmpPermissions = transientPermissions.get();
+        if (tmpPermissions == null)
+            tmpPermissions = new HashMap<>();
+
+        int id = tmpPermissions.size();
+        tmpPermissions.put(id, p);
+        transientPermissions.set(tmpPermissions);
+        return id;
+    }
+
+    /*
+     * Remove a temporary permission from current thread context.
+     *
+     * @param index to remove.
+     *
+     * @throws RuntimeException if no temporary permission list in current
+     *             thread context or no permission correlated to the index.
+     */
+    void removeTmpPermission(int index) {
+        try {
+            Map<Integer, Permission> tmpPermissions = transientPermissions.get();
+            tmpPermissions.remove(index);
+        } catch (NullPointerException | IndexOutOfBoundsException e) {
+            throw new RuntimeException("Tried to delete a non-existent temporary permission", e);
+        }
+    }
+
+    /*
+     * Checks to see if the specified permission is implied by temporary
+     * permission list in current thread context.
+     *
+     * @param permission the Permission object to compare.
+     *
+     * @return true if "permission" is implied by any permission in the
+     *         temporary permission list, false if not.
+     */
+    private boolean tmpImplies(Permission perm) {
+        Map<Integer, Permission> tmpPermissions = transientPermissions.get();
+        if (tmpPermissions != null) {
+            for (Permission p : tmpPermissions.values()) {
+                if (p.implies(perm))
+                    return true;
+            }
+        }
+        return false;
+    }
+
+    /*
+     * Checks to see if allow all permission requests in current thread context.
+     */
+    private boolean allowAll() {
+        Boolean allow = allowAll.get();
+        if (allow != null) {
+            return allow;
+        }
+        return false;
+    }
+
+    /*
+     * set allowAll in current thread context.
+     */
+    void setAllowAll(boolean allow) {
+        allowAll.set(allow);
+    }
+}
diff --git a/jaxp/test/javax/xml/jaxp/libs/jaxp/library/JAXPTestUtilities.java b/jaxp/test/javax/xml/jaxp/libs/jaxp/library/JAXPTestUtilities.java
index 8269f05..d89e740 100644
--- a/jaxp/test/javax/xml/jaxp/libs/jaxp/library/JAXPTestUtilities.java
+++ b/jaxp/test/javax/xml/jaxp/libs/jaxp/library/JAXPTestUtilities.java
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2014, 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2014, 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
@@ -22,6 +22,8 @@
  */
 package jaxp.library;
 
+import static org.testng.Assert.fail;
+
 import java.io.ByteArrayInputStream;
 import java.io.File;
 import java.io.IOException;
@@ -34,12 +36,18 @@
 import java.nio.charset.UnsupportedCharsetException;
 import java.nio.file.Files;
 import java.nio.file.Paths;
+import java.security.Permission;
+import java.util.ArrayList;
 import java.util.HashMap;
 import java.util.List;
 import java.util.Map;
+import java.util.Optional;
+import java.util.concurrent.Callable;
 import java.util.concurrent.ConcurrentHashMap;
+import java.util.function.Supplier;
 import java.util.regex.Pattern;
 import java.util.stream.Collectors;
+
 import javax.xml.parsers.DocumentBuilder;
 import javax.xml.parsers.DocumentBuilderFactory;
 import javax.xml.parsers.ParserConfigurationException;
@@ -48,7 +56,7 @@
 import javax.xml.transform.TransformerFactory;
 import javax.xml.transform.dom.DOMSource;
 import javax.xml.transform.stream.StreamResult;
-import static org.testng.Assert.fail;
+
 import org.w3c.dom.Document;
 import org.w3c.dom.Node;
 import org.xml.sax.SAXException;
@@ -74,12 +82,6 @@
     public static final String FILE_SEP = "/";
 
     /**
-     * Current test directory.
-     */
-    public static final String USER_DIR =
-            System.getProperty("user.dir", ".") + FILE_SEP;;
-
-    /**
      * A map storing every test's current test file pointer. File number should
      * be incremental and it's a thread-safe reading on this file number.
      */
@@ -89,7 +91,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.
@@ -130,8 +132,15 @@
      */
     public static boolean compareWithGold(String goldfile, String outputfile,
              Charset cs) throws IOException {
-        return Files.readAllLines(Paths.get(goldfile)).
+        boolean isSame = Files.readAllLines(Paths.get(goldfile)).
                 equals(Files.readAllLines(Paths.get(outputfile), cs));
+        if (!isSame) {
+            System.err.println("Golden file " + goldfile + " :");
+            Files.readAllLines(Paths.get(goldfile)).forEach(System.err::println);
+            System.err.println("Output file " + outputfile + " :");
+            Files.readAllLines(Paths.get(outputfile), cs).forEach(System.err::println);
+        }
+        return isSame;
     }
 
     /**
@@ -308,10 +317,10 @@
         int nextNumber = currentFileNumber.contains(clazz)
                 ? currentFileNumber.get(clazz) + 1 : 1;
         Integer i = currentFileNumber.putIfAbsent(clazz, nextNumber);
-        if (i != null && i != nextNumber) {
+        if (i != null) {
             do {
                 nextNumber = currentFileNumber.get(clazz) + 1;
-            } while (currentFileNumber.replace(clazz, nextNumber -1, nextNumber));
+            } while (!currentFileNumber.replace(clazz, nextNumber - 1, nextNumber));
         }
         return USER_DIR + clazz.getName() + nextNumber + ".out";
     }
@@ -324,12 +333,177 @@
      * @return a string represents the full path of accessing path.
      */
     public static String getPathByClassName(Class clazz, String relativeDir) {
-        String packageName = FILE_SEP +
-                clazz.getPackage().getName().replaceAll("[.]", FILE_SEP);
-        String javaSourcePath = System.getProperty("test.src").replaceAll("\\" + File.separator, FILE_SEP)
-                + packageName + FILE_SEP;
+        String javaSourcePath = System.getProperty("test.src").replaceAll("\\" + File.separator, FILE_SEP);
         String normalizedPath = Paths.get(javaSourcePath, relativeDir).normalize().
                 toAbsolutePath().toString();
         return normalizedPath.replace("\\", FILE_SEP) + FILE_SEP;
     }
+
+
+    /**
+     * Run the supplier with all permissions. This won't impact global policy.
+     *
+     * @param s
+     *            Supplier to run
+     */
+    public static <T> T runWithAllPerm(Supplier<T> s) {
+        Optional<JAXPPolicyManager> policyManager = Optional.ofNullable(JAXPPolicyManager
+                .getJAXPPolicyManager(false));
+        policyManager.ifPresent(manager -> manager.setAllowAll(true));
+        try {
+            return s.get();
+        } finally {
+            policyManager.ifPresent(manager -> manager.setAllowAll(false));
+        }
+    }
+
+    /**
+     * Run the supplier with all permissions. This won't impact global policy.
+     *
+     * @param s
+     *            Supplier to run
+     */
+    public static <T> T tryRunWithAllPerm(Callable<T> c) throws Exception {
+        Optional<JAXPPolicyManager> policyManager = Optional.ofNullable(JAXPPolicyManager
+                .getJAXPPolicyManager(false));
+        policyManager.ifPresent(manager -> manager.setAllowAll(true));
+        try {
+            return c.call();
+        } finally {
+            policyManager.ifPresent(manager -> manager.setAllowAll(false));
+        }
+    }
+
+    /**
+     * Run the Runnable with all permissions. This won't impact global policy.
+     *
+     * @param s
+     *            Supplier to run
+     */
+    public static void runWithAllPerm(Runnable r) {
+        Optional<JAXPPolicyManager> policyManager = Optional.ofNullable(JAXPPolicyManager
+                .getJAXPPolicyManager(false));
+        policyManager.ifPresent(manager -> manager.setAllowAll(true));
+        try {
+            r.run();
+        } finally {
+            policyManager.ifPresent(manager -> manager.setAllowAll(false));
+        }
+    }
+
+    /**
+     * Acquire a system property.
+     *
+     * @param name
+     *            System property name to be acquired.
+     * @return property value
+     */
+    public static String getSystemProperty(String name) {
+        return runWithAllPerm(() -> System.getProperty(name));
+    }
+
+    /**
+     * Set a system property by given system value.
+     *
+     * @param name
+     *            System property name to be set.
+     * @param value
+     *            System property value to be set.
+     */
+    public static void setSystemProperty(String name, String value) {
+        runWithAllPerm(() -> System.setProperty(name, value));
+    }
+
+    /**
+     * Clear a system property.
+     *
+     * @param name
+     *            System property name to be cleared.
+     */
+    public static void clearSystemProperty(String name) {
+        runWithAllPerm(() -> System.clearProperty(name));
+    }
+
+    /**
+     * Run the runnable with assigning temporary permissions. This won't impact
+     * global policy.
+     *
+     * @param r
+     *            Runnable to run
+     * @param ps
+     *            assigning permissions to add.
+     */
+    public static void runWithTmpPermission(Runnable r, Permission... ps) {
+        JAXPPolicyManager policyManager = JAXPPolicyManager.getJAXPPolicyManager(false);
+        List<Integer> tmpPermissionIndexes = new ArrayList();
+        if (policyManager != null) {
+            for (Permission p : ps)
+                tmpPermissionIndexes.add(policyManager.addTmpPermission(p));
+        }
+        try {
+            r.run();
+        } finally {
+            for (int index: tmpPermissionIndexes)
+                policyManager.removeTmpPermission(index);
+        }
+    }
+
+    /**
+     * Run the supplier with assigning temporary permissions. This won't impact
+     * global policy.
+     *
+     * @param s
+     *            Supplier to run
+     * @param ps
+     *            assigning permissions to add.
+     */
+    public static <T> T runWithTmpPermission(Supplier<T> s, Permission... ps) {
+        JAXPPolicyManager policyManager = JAXPPolicyManager.getJAXPPolicyManager(false);
+        List<Integer> tmpPermissionIndexes = new ArrayList();
+        if (policyManager != null) {
+            for (Permission p : ps)
+                tmpPermissionIndexes.add(policyManager.addTmpPermission(p));
+        }
+        try {
+            return s.get();
+        } finally {
+            for (int index: tmpPermissionIndexes)
+                policyManager.removeTmpPermission(index);
+        }
+    }
+
+    /**
+     * Run the RunnableWithException with assigning temporary permissions. This
+     * won't impact global policy.
+     *
+     * @param r
+     *            RunnableWithException to execute
+     * @param ps
+     *            assigning permissions to add.
+     */
+    public static void tryRunWithTmpPermission(RunnableWithException r, Permission... ps) throws Exception {
+        JAXPPolicyManager policyManager = JAXPPolicyManager.getJAXPPolicyManager(false);
+        List<Integer> tmpPermissionIndexes = new ArrayList();
+        if (policyManager != null) {
+            for (Permission p : ps)
+                tmpPermissionIndexes.add(policyManager.addTmpPermission(p));
+        }
+        try {
+            r.run();
+        } finally {
+            for (int index: tmpPermissionIndexes)
+                policyManager.removeTmpPermission(index);
+        }
+    }
+
+    @FunctionalInterface
+    public interface RunnableWithException {
+        void run() throws Exception;
+    }
+
+    /**
+     * Current test directory.
+     */
+    public static final String USER_DIR = getSystemProperty("user.dir") + FILE_SEP;;
+
 }
diff --git a/hotspot/test/compiler/native/TestDirtyInt.java b/jaxp/test/javax/xml/jaxp/libs/jaxp/library/NetAccessPolicy.java
similarity index 63%
copy from hotspot/test/compiler/native/TestDirtyInt.java
copy to jaxp/test/javax/xml/jaxp/libs/jaxp/library/NetAccessPolicy.java
index 607fd2d..f7037cf 100644
--- a/hotspot/test/compiler/native/TestDirtyInt.java
+++ b/jaxp/test/javax/xml/jaxp/libs/jaxp/library/NetAccessPolicy.java
@@ -20,27 +20,24 @@
  * or visit www.oracle.com if you need additional information or have any
  * questions.
  */
+package jaxp.library;
 
-/* @test
- * @run main/native TestDirtyInt
+import java.net.SocketPermission;
+
+import org.testng.ITestContext;
+
+/**
+ * This policy can access network.
  */
-public class TestDirtyInt {
-    static {
-        System.loadLibrary("TestDirtyInt");
-    }
+public class NetAccessPolicy extends BasePolicy {
 
-    native static int test(int v);
-
-    static int compiled(int v) {
-        return test(v<<2);
-    }
-
-    static public void main(String[] args) {
-        for (int i = 0; i < 20000; i++) {
-            int res = compiled(Integer.MAX_VALUE);
-            if (res != 0x42) {
-                throw new RuntimeException("Test failed");
-            }
+    @Override
+    public void onStart(ITestContext arg0) {
+        // suppose to only run othervm mode
+        if (isRunWithSecurityManager()) {
+            JAXPPolicyManager policyManager = JAXPPolicyManager.getJAXPPolicyManager(true);
+            policyManager.addPermission(new SocketPermission("openjdk.java.net:80", "connect,resolve"));
+            policyManager.addPermission(new SocketPermission("www.w3.org:80", "connect,resolve"));
         }
     }
 }
diff --git a/jaxp/test/javax/xml/jaxp/libs/jaxp/library/TestPolicy.java b/jaxp/test/javax/xml/jaxp/libs/jaxp/library/TestPolicy.java
deleted file mode 100644
index 1aaebc3..0000000
--- a/jaxp/test/javax/xml/jaxp/libs/jaxp/library/TestPolicy.java
+++ /dev/null
@@ -1,153 +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.
- *
- * 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 jaxp.library;
-
-import java.security.AllPermission;
-import java.security.CodeSource;
-import java.security.Permission;
-import java.security.PermissionCollection;
-import java.security.Permissions;
-import java.security.Policy;
-import java.security.ProtectionDomain;
-import java.security.SecurityPermission;
-import java.util.Arrays;
-import java.util.Collections;
-import java.util.Enumeration;
-import java.util.PropertyPermission;
-import java.util.StringJoiner;
-
-
-/*
- * Simple Policy class that supports the required Permissions to validate the
- * JAXP concrete classes.
- * Note: permission can only be added. You may want to create a new TestPolicy
- *       instance if you need remove permissions.
- */
-public class TestPolicy extends Policy {
-    protected final PermissionCollection permissions = new Permissions();
-
-    private static Policy defaultPolicy = Policy.getPolicy();
-
-    /**
-     * Constructor which sets the minimum permissions by default allowing testNG
-     * to work with a SecurityManager.
-     */
-    public TestPolicy() {
-        setMinimalPermissions();
-    }
-
-    /**
-     * Construct an instance with the minimal permissions required by the test
-     * environment and additional permission(s) as specified.
-     * @param ps permissions to be added.
-     */
-    public TestPolicy(Permissions ps) {
-        setMinimalPermissions();
-        TestPolicy.this.addPermissions(ps);
-    }
-
-    /**
-     * Construct an instance with the minimal permissions required by the test
-     * environment and additional permission(s) as specified.
-     * @param ps permission array to be added.
-     */
-    public TestPolicy(Permission... ps) {
-        setMinimalPermissions();
-        addPermissions(ps);
-    }
-
-    /**
-     * Defines the minimal permissions required by testNG when running these
-     * tests
-     */
-    protected void setMinimalPermissions() {
-        permissions.add(new SecurityPermission("getPolicy"));
-        permissions.add(new SecurityPermission("setPolicy"));
-        permissions.add(new RuntimePermission("getClassLoader"));
-        permissions.add(new RuntimePermission("setSecurityManager"));
-        permissions.add(new RuntimePermission("createSecurityManager"));
-        permissions.add(new PropertyPermission("testng.show.stack.frames",
-                "read"));
-        permissions.add(new PropertyPermission("user.dir", "read"));
-        permissions.add(new PropertyPermission("test.src", "read"));
-        permissions.add(new PropertyPermission("fileStringBuffer", "read"));
-        permissions.add(new PropertyPermission("dataproviderthreadcount", "read"));
-    }
-
-    /*
-     * Add permissions for your tests.
-     * @param permissions to be added.
-     */
-    private void addPermissions(Permissions ps) {
-        Collections.list(ps.elements()).forEach(p -> permissions.add(p));
-    }
-
-
-    /*
-     * Add permissions for your tests.
-     * @param permissions to be added.
-     */
-    private void addPermissions(Permission[] ps) {
-        Arrays.stream(ps).forEach(p -> permissions.add(p));
-    }
-
-    /**
-     * Set all permissions. Caution: this should not called carefully unless
-     * it's really needed.
-     */
-    private void setAllPermissions() {
-        permissions.add(new AllPermission());
-    }
-
-    /*
-     * Overloaded methods from the Policy class.
-     */
-    @Override
-    public String toString() {
-        StringJoiner sj = new StringJoiner("\n", "policy: ", "");
-        Enumeration<Permission> perms = permissions.elements();
-        while (perms.hasMoreElements()) {
-            sj.add(perms.nextElement().toString());
-        }
-        return sj.toString();
-
-    }
-
-    @Override
-    public PermissionCollection getPermissions(ProtectionDomain domain) {
-        return permissions;
-    }
-
-    @Override
-    public PermissionCollection getPermissions(CodeSource codesource) {
-        return permissions;
-    }
-
-    @Override
-    public boolean implies(ProtectionDomain domain, Permission perm) {
-        if (defaultPolicy.implies(domain, perm))
-            return true;
-
-        return permissions.implies(perm);
-    }
-}
diff --git a/jaxp/test/javax/xml/jaxp/libs/test/astro/DOML3InputSourceFactoryImpl.java b/jaxp/test/javax/xml/jaxp/libs/test/astro/DOML3InputSourceFactoryImpl.java
index 6978900..2f4170b 100644
--- a/jaxp/test/javax/xml/jaxp/libs/test/astro/DOML3InputSourceFactoryImpl.java
+++ b/jaxp/test/javax/xml/jaxp/libs/test/astro/DOML3InputSourceFactoryImpl.java
@@ -23,6 +23,7 @@
 package test.astro;
 
 import static jaxp.library.JAXPTestUtilities.filenameToURL;
+import static jaxp.library.JAXPTestUtilities.USER_DIR;
 import static org.w3c.dom.ls.DOMImplementationLS.MODE_SYNCHRONOUS;
 import static org.w3c.dom.traversal.NodeFilter.SHOW_ELEMENT;
 
@@ -81,7 +82,7 @@
 
         // Use DOM L3 LSSerializer (previously called a DOMWriter)
         // to serialize the xml doc DOM to a file stream.
-        String tmpCatalog = Files.createTempFile(Paths.get("").toAbsolutePath(), "catalog.xml", null).toString();
+        String tmpCatalog = Files.createTempFile(Paths.get(USER_DIR), "catalog.xml", null).toString();
 
         LSSerializer domserializer = impl.createLSSerializer();
         domserializer.setFilter(new MyDOMWriterFilter());
diff --git a/jaxp/test/javax/xml/jaxp/module/TEST.properties b/jaxp/test/javax/xml/jaxp/module/TEST.properties
deleted file mode 100644
index 85a3ae5..0000000
--- a/jaxp/test/javax/xml/jaxp/module/TEST.properties
+++ /dev/null
@@ -1,5 +0,0 @@
-# Tests that must run in othervm mode
-othervm.dirs= .
-
-# Declare module dependency
-modules=java.xml
diff --git a/jaxp/test/javax/xml/jaxp/unittest/TEST.properties b/jaxp/test/javax/xml/jaxp/unittest/TEST.properties
index b6e235b..1e8f464 100644
--- a/jaxp/test/javax/xml/jaxp/unittest/TEST.properties
+++ b/jaxp/test/javax/xml/jaxp/unittest/TEST.properties
@@ -1,9 +1,8 @@
-# jaxp test uses TestNG
-TestNG.dirs = .
-
-lib.dirs = /javax/xml/jaxp/libs
-
 # Declare module dependency
 modules=java.xml/com.sun.org.apache.xerces.internal.impl \
         java.xml/com.sun.org.apache.xerces.internal.jaxp \
-        java.xml/com.sun.org.apache.xml.internal.serialize
+        java.xml/com.sun.org.apache.xml.internal.serialize \
+        java.xml/com.sun.org.apache.bcel.internal.classfile \
+        java.xml/com.sun.org.apache.bcel.internal.generic \
+        java.xml/com.sun.org.apache.xalan.internal.xsltc.trax \
+        java.xml/com.sun.org.apache.xml.internal.utils
diff --git a/jaxp/test/javax/xml/jaxp/unittest/catalog/CatalogSupport.java b/jaxp/test/javax/xml/jaxp/unittest/catalog/CatalogSupport.java
index 1e88b68..f8dbda9 100644
--- a/jaxp/test/javax/xml/jaxp/unittest/catalog/CatalogSupport.java
+++ b/jaxp/test/javax/xml/jaxp/unittest/catalog/CatalogSupport.java
@@ -25,20 +25,27 @@
 
 import java.io.File;
 import java.io.StringReader;
+
 import javax.xml.transform.Source;
 import javax.xml.transform.URIResolver;
 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.annotations.BeforeClass;
 import org.testng.annotations.DataProvider;
+import org.testng.annotations.Listeners;
 import org.testng.annotations.Test;
 import org.w3c.dom.ls.LSResourceResolver;
 import org.xml.sax.InputSource;
 
 /**
+ * @test
  * @bug 8158084 8162438 8162442
+ * @library /javax/xml/jaxp/libs /javax/xml/jaxp/unittest
+ * @run testng/othervm -DrunSecMngr=true catalog.CatalogSupport
+ * @run testng/othervm catalog.CatalogSupport
  * @summary verifies the use of Catalog in SAX/DOM/StAX/Validation/Transform.
  * The two main scenarios for all processors are:
  * A custom resolver is used whether or not there's a Catalog;
@@ -60,6 +67,7 @@
  *
  * @author huizhe.wang@oracle.com
  */
+@Listeners({jaxp.library.FilePolicy.class, jaxp.library.NetAccessPolicy.class})
 public class CatalogSupport extends CatalogSupportBase {
     /*
      * Initializing fields
@@ -159,7 +167,7 @@
        Data: set use_catalog, use_catalog, catalog file, xml file, handler, expected result string
      */
     @DataProvider(name = "data_SAXA")
-    Object[][] getDataSAX() {
+    public Object[][] getDataSAX() {
         String[] systemIds = {"system.xsd"};
         InputSource[] returnValues = {new InputSource(new StringReader(dtd_systemResolved))};
         MyEntityHandler entityHandler = new MyEntityHandler(systemIds, returnValues, elementInSystem);
@@ -175,7 +183,7 @@
        Data: set use_catalog, use_catalog, catalog file, xml file, handler, expected result string
      */
     @DataProvider(name = "data_XIA")
-    Object[][] getDataXI() {
+    public Object[][] getDataXI() {
         String[] systemIds = {"XI_simple.xml"};
         InputSource[] returnValues = {new InputSource(xml_xIncludeSimple)};
         MyEntityHandler entityHandler = new MyEntityHandler(systemIds, returnValues, elementInXISimple);
@@ -191,7 +199,7 @@
        Data: set use_catalog, use_catalog, catalog file, xml file, handler, expected result string
      */
     @DataProvider(name = "data_DOMA")
-    Object[][] getDataDOM() {
+    public Object[][] getDataDOM() {
         String[] systemIds = {"system.xsd"};
         InputSource[] returnValues = {new InputSource(new StringReader(dtd_systemResolved))};
         MyEntityHandler entityHandler = new MyEntityHandler(systemIds, returnValues, elementInSystem);
@@ -213,7 +221,7 @@
        Data: set use_catalog, use_catalog, catalog file, xsd file, a LSResourceResolver
      */
     @DataProvider(name = "data_SchemaA")
-    Object[][] getDataSchema() {
+    public Object[][] getDataSchema() {
         String[] systemIds = {"pathto/XMLSchema.dtd", "datatypes.dtd"};
         XmlInput[] returnValues = {new XmlInput(null, dtd_xmlSchema, null), new XmlInput(null, dtd_datatypes, null)};
         LSResourceResolver resolver = new SourceResolver(null, systemIds, returnValues);
@@ -248,7 +256,7 @@
        Data: source, resolver1, resolver2, catalog1, a catalog2
      */
     @DataProvider(name = "data_ValidatorA")
-    Object[][] getDataValidator() {
+    public Object[][] getDataValidator() {
         DOMSource ds = getDOMSource(xml_val_test, xml_val_test_id, false, true, xml_catalog);
 
         SAXSource ss = new SAXSource(new InputSource(xml_val_test));
@@ -289,7 +297,7 @@
        Data: set use_catalog, use_catalog, catalog file, xsl file, xml file, a URIResolver, expected result
      */
     @DataProvider(name = "data_XSLA")
-    Object[][] getDataXSL() {
+    public Object[][] getDataXSL() {
         // XSLInclude.xsl has one import XSLImport_html.xsl and two includes,
         // XSLInclude_header.xsl and XSLInclude_footer.xsl;
         String[] hrefs = {"XSLImport_html.xsl", "XSLInclude_header.xsl", "XSLInclude_footer.xsl"};
@@ -319,3 +327,4 @@
         };
     }
 }
+
diff --git a/jaxp/test/javax/xml/jaxp/unittest/catalog/CatalogSupport1.java b/jaxp/test/javax/xml/jaxp/unittest/catalog/CatalogSupport1.java
index 40961d2..cac5e33 100644
--- a/jaxp/test/javax/xml/jaxp/unittest/catalog/CatalogSupport1.java
+++ b/jaxp/test/javax/xml/jaxp/unittest/catalog/CatalogSupport1.java
@@ -23,8 +23,12 @@
 
 package catalog;
 
+import static jaxp.library.JAXPTestUtilities.clearSystemProperty;
+import static jaxp.library.JAXPTestUtilities.setSystemProperty;
+
 import java.io.File;
 import java.io.StringReader;
+
 import javax.xml.catalog.CatalogFeatures.Feature;
 import javax.xml.transform.Source;
 import javax.xml.transform.URIResolver;
@@ -32,15 +36,21 @@
 import javax.xml.transform.sax.SAXSource;
 import javax.xml.transform.stax.StAXSource;
 import javax.xml.transform.stream.StreamSource;
+
 import org.testng.annotations.AfterClass;
 import org.testng.annotations.BeforeClass;
 import org.testng.annotations.DataProvider;
+import org.testng.annotations.Listeners;
 import org.testng.annotations.Test;
 import org.w3c.dom.ls.LSResourceResolver;
 import org.xml.sax.InputSource;
 
 /*
+ * @test
  * @bug 8158084 8162438 8162442
+ * @library /javax/xml/jaxp/libs /javax/xml/jaxp/unittest
+ * @run testng/othervm -DrunSecMngr=true catalog.CatalogSupport1
+ * @run testng/othervm catalog.CatalogSupport1
  * @summary extends CatalogSupport, verifies that the catalog file can be set
  * using the System property.
  */
@@ -51,6 +61,7 @@
  *
  * @author huizhe.wang@oracle.com
  */
+@Listeners({jaxp.library.FilePolicy.class})
 public class CatalogSupport1 extends CatalogSupportBase {
     /*
      * Initializing fields
@@ -58,12 +69,12 @@
     @BeforeClass
     public void setUpClass() throws Exception {
         setUp();
-        System.setProperty(Feature.FILES.getPropertyName(), xml_catalog);
+        setSystemProperty(Feature.FILES.getPropertyName(), xml_catalog);
     }
 
     @AfterClass
     public void tearDownClass() throws Exception {
-        System.clearProperty(Feature.FILES.getPropertyName());
+        clearSystemProperty(Feature.FILES.getPropertyName());
     }
 
     /*
@@ -149,7 +160,7 @@
        Data: set use_catalog, use_catalog, catalog file, xml file, handler, expected result string
      */
     @DataProvider(name = "data_SAXC")
-    Object[][] getDataSAXC() {
+    public Object[][] getDataSAXC() {
         return new Object[][]{
             {false, true, null, xml_system, new MyHandler(elementInSystem), expectedWCatalog}
 
@@ -161,7 +172,7 @@
        Data: set use_catalog, use_catalog, catalog file, xml file, handler, expected result string
      */
     @DataProvider(name = "data_XIC")
-    Object[][] getDataXIC() {
+    public Object[][] getDataXIC() {
         return new Object[][]{
             {false, true, null, xml_xInclude, new MyHandler(elementInXISimple), contentInUIutf8Catalog},
         };
@@ -172,7 +183,7 @@
        Data: set use_catalog, use_catalog, catalog file, xml file, handler, expected result string
      */
     @DataProvider(name = "data_DOMC")
-    Object[][] getDataDOMC() {
+    public Object[][] getDataDOMC() {
         return new Object[][]{
             {false, true, null, xml_system, new MyHandler(elementInSystem), expectedWCatalog}
         };
@@ -183,7 +194,7 @@
        Data: set use_catalog, use_catalog, catalog file, xsd file, a LSResourceResolver
      */
     @DataProvider(name = "data_SchemaC")
-    Object[][] getDataSchemaC() {
+    public Object[][] getDataSchemaC() {
 
         return new Object[][]{
             // for resolving DTD in xsd
@@ -201,7 +212,7 @@
        Data: source, resolver1, resolver2, catalog1, a catalog2
      */
     @DataProvider(name = "data_ValidatorC")
-    Object[][] getDataValidator() {
+    public Object[][] getDataValidator() {
         DOMSource ds = getDOMSource(xml_val_test, xml_val_test_id, false, true, null);
 
         SAXSource ss = new SAXSource(new InputSource(xml_val_test));
@@ -242,7 +253,7 @@
        Data: set use_catalog, use_catalog, catalog file, xsl file, xml file, a URIResolver, expected
      */
     @DataProvider(name = "data_XSLC")
-    Object[][] getDataXSLC() {
+    public Object[][] getDataXSLC() {
         SAXSource xslSourceDTD = new SAXSource(new InputSource(new StringReader(xsl_includeDTD)));
         StreamSource xmlSourceDTD = new StreamSource(new StringReader(xml_xslDTD));
 
@@ -257,3 +268,4 @@
     }
 
 }
+
diff --git a/jaxp/test/javax/xml/jaxp/unittest/catalog/CatalogSupport2.java b/jaxp/test/javax/xml/jaxp/unittest/catalog/CatalogSupport2.java
index 3368599..50cb26e 100644
--- a/jaxp/test/javax/xml/jaxp/unittest/catalog/CatalogSupport2.java
+++ b/jaxp/test/javax/xml/jaxp/unittest/catalog/CatalogSupport2.java
@@ -23,10 +23,15 @@
 
 package catalog;
 
+import static jaxp.library.JAXPTestUtilities.clearSystemProperty;
+import static jaxp.library.JAXPTestUtilities.getSystemProperty;
+import static jaxp.library.JAXPTestUtilities.setSystemProperty;
+
 import java.io.File;
 import java.io.FileNotFoundException;
 import java.io.StringReader;
 import java.net.SocketTimeoutException;
+
 import javax.xml.transform.Source;
 import javax.xml.transform.TransformerException;
 import javax.xml.transform.URIResolver;
@@ -34,9 +39,11 @@
 import javax.xml.transform.sax.SAXSource;
 import javax.xml.transform.stax.StAXSource;
 import javax.xml.transform.stream.StreamSource;
+
 import org.testng.annotations.AfterClass;
 import org.testng.annotations.BeforeClass;
 import org.testng.annotations.DataProvider;
+import org.testng.annotations.Listeners;
 import org.testng.annotations.Test;
 import org.w3c.dom.ls.LSResourceResolver;
 import org.xml.sax.InputSource;
@@ -44,7 +51,11 @@
 import org.xml.sax.SAXParseException;
 
 /*
+ * @test
  * @bug 8158084 8162438 8162442
+ * @library /javax/xml/jaxp/libs /javax/xml/jaxp/unittest
+ * @run testng/othervm -DrunSecMngr=true catalog.CatalogSupport2
+ * @run testng/othervm catalog.CatalogSupport2
  * @summary extends CatalogSupport tests, verifies that the use of the Catalog may
  * be disabled through the System property.
  */
@@ -56,11 +67,12 @@
  *
  * @author huizhe.wang@oracle.com
  */
+@Listeners({jaxp.library.FilePolicy.class, jaxp.library.NetAccessPolicy.class})
 public class CatalogSupport2 extends CatalogSupportBase {
     static final String TTIMEOUTREAD = "sun.net.client.defaultReadTimeout";
     static final String TIMEOUTCONNECT = "sun.net.client.defaultConnectTimeout";
-    static String timeoutRead = System.getProperty(TTIMEOUTREAD);
-    static String timeoutConnect = System.getProperty(TIMEOUTCONNECT);
+    static String timeoutRead = getSystemProperty(TTIMEOUTREAD);
+    static String timeoutConnect = getSystemProperty(TIMEOUTCONNECT);
 
     /*
      * Initializing fields
@@ -68,18 +80,18 @@
     @BeforeClass
     public void setUpClass() throws Exception {
         setUp();
-        System.setProperty(SP_USE_CATALOG, "false");
-        timeoutRead = System.getProperty(TTIMEOUTREAD);
-        timeoutConnect = System.getProperty(TIMEOUTCONNECT);
-        System.setProperty(TTIMEOUTREAD, "1000");
-        System.setProperty(TIMEOUTCONNECT, "1000");
+        setSystemProperty(SP_USE_CATALOG, "false");
+        timeoutRead = getSystemProperty(TTIMEOUTREAD);
+        timeoutConnect = getSystemProperty(TIMEOUTCONNECT);
+        setSystemProperty(TTIMEOUTREAD, "1000");
+        setSystemProperty(TIMEOUTCONNECT, "1000");
     }
 
     @AfterClass
     public void tearDownClass() throws Exception {
-        System.clearProperty(SP_USE_CATALOG);
-        System.setProperty(TIMEOUTCONNECT, "-1");
-        System.setProperty(TTIMEOUTREAD, "-1");
+        clearSystemProperty(SP_USE_CATALOG);
+        setSystemProperty(TIMEOUTCONNECT, "-1");
+        setSystemProperty(TTIMEOUTREAD, "-1");
     }
 
     /*
@@ -165,7 +177,7 @@
        Data: set use_catalog, use_catalog, catalog file, xml file, handler, expected result string
      */
     @DataProvider(name = "data_SAXC")
-    Object[][] getDataSAXC() {
+    public Object[][] getDataSAXC() {
         return new Object[][]{
             {false, true, xml_catalog, xml_system, new MyHandler(elementInSystem), expectedWCatalog}
 
@@ -177,7 +189,7 @@
        Data: set use_catalog, use_catalog, catalog file, xml file, handler, expected result string
      */
     @DataProvider(name = "data_XIC")
-    Object[][] getDataXIC() {
+    public Object[][] getDataXIC() {
         return new Object[][]{
             {false, true, xml_catalog, xml_xInclude, new MyHandler(elementInXISimple), contentInUIutf8Catalog},
         };
@@ -188,7 +200,7 @@
        Data: set use_catalog, use_catalog, catalog file, xml file, handler, expected result string
      */
     @DataProvider(name = "data_DOMC")
-    Object[][] getDataDOMC() {
+    public Object[][] getDataDOMC() {
         return new Object[][]{
             {false, true, xml_catalog, xml_system, new MyHandler(elementInSystem), expectedWCatalog}
         };
@@ -199,7 +211,7 @@
        Data: set use_catalog, use_catalog, catalog file, xsd file, a LSResourceResolver
      */
     @DataProvider(name = "data_SchemaC")
-    Object[][] getDataSchemaC() {
+    public Object[][] getDataSchemaC() {
 
         return new Object[][]{
             // for resolving DTD in xsd
@@ -217,7 +229,7 @@
        Data: source, resolver1, resolver2, catalog1, a catalog2
      */
     @DataProvider(name = "data_ValidatorC")
-    Object[][] getDataValidator() {
+    public Object[][] getDataValidator() {
         DOMSource ds = getDOMSource(xml_val_test, xml_val_test_id, true, true, xml_catalog);
 
         SAXSource ss = new SAXSource(new InputSource(xml_val_test));
@@ -246,7 +258,7 @@
        Data: set use_catalog, use_catalog, catalog file, xsl file, xml file, a URIResolver, expected
      */
     @DataProvider(name = "data_XSLC")
-    Object[][] getDataXSLC() {
+    public Object[][] getDataXSLC() {
         SAXSource xslSourceDTD = new SAXSource(new InputSource(new StringReader(xsl_includeDTD)));
         StreamSource xmlSourceDTD = new StreamSource(new StringReader(xml_xslDTD));
 
@@ -260,3 +272,4 @@
         };
     }
 }
+
diff --git a/jaxp/test/javax/xml/jaxp/unittest/catalog/CatalogSupport3.java b/jaxp/test/javax/xml/jaxp/unittest/catalog/CatalogSupport3.java
index 193713b..6a9b04d 100644
--- a/jaxp/test/javax/xml/jaxp/unittest/catalog/CatalogSupport3.java
+++ b/jaxp/test/javax/xml/jaxp/unittest/catalog/CatalogSupport3.java
@@ -23,10 +23,14 @@
 
 package catalog;
 
+import static jaxp.library.JAXPTestUtilities.getSystemProperty;
+import static jaxp.library.JAXPTestUtilities.setSystemProperty;
+
 import java.io.File;
 import java.io.FileNotFoundException;
 import java.io.StringReader;
 import java.net.SocketTimeoutException;
+
 import javax.xml.transform.Source;
 import javax.xml.transform.TransformerException;
 import javax.xml.transform.URIResolver;
@@ -34,9 +38,11 @@
 import javax.xml.transform.sax.SAXSource;
 import javax.xml.transform.stax.StAXSource;
 import javax.xml.transform.stream.StreamSource;
+
 import org.testng.annotations.AfterClass;
 import org.testng.annotations.BeforeClass;
 import org.testng.annotations.DataProvider;
+import org.testng.annotations.Listeners;
 import org.testng.annotations.Test;
 import org.w3c.dom.ls.LSResourceResolver;
 import org.xml.sax.InputSource;
@@ -44,7 +50,11 @@
 import org.xml.sax.SAXParseException;
 
 /*
+ * @test
  * @bug 8158084 8162438 8162442
+ * @library /javax/xml/jaxp/libs /javax/xml/jaxp/unittest
+ * @run testng/othervm -DrunSecMngr=true catalog.CatalogSupport3
+ * @run testng/othervm catalog.CatalogSupport3
  * @summary extends CatalogSupport tests, verifies that the use of the Catalog may
  * be disabled through the API property.
  */
@@ -56,27 +66,28 @@
  *
  * @author huizhe.wang@oracle.com
  */
+@Listeners({jaxp.library.FilePolicy.class, jaxp.library.NetAccessPolicy.class})
 public class CatalogSupport3 extends CatalogSupportBase {
     static final String TTIMEOUTREAD = "sun.net.client.defaultReadTimeout";
     static final String TIMEOUTCONNECT = "sun.net.client.defaultConnectTimeout";
-    static String timeoutRead = System.getProperty(TTIMEOUTREAD);
-    static String timeoutConnect = System.getProperty(TIMEOUTCONNECT);
+    static String timeoutRead = getSystemProperty(TTIMEOUTREAD);
+    static String timeoutConnect = getSystemProperty(TIMEOUTCONNECT);
     /*
      * Initializing fields
      */
     @BeforeClass
     public void setUpClass() throws Exception {
         setUp();
-        timeoutRead = System.getProperty(TTIMEOUTREAD);
-        timeoutConnect = System.getProperty(TIMEOUTCONNECT);
-        System.setProperty(TTIMEOUTREAD, "1000");
-        System.setProperty(TIMEOUTCONNECT, "1000");
+        timeoutRead = getSystemProperty(TTIMEOUTREAD);
+        timeoutConnect = getSystemProperty(TIMEOUTCONNECT);
+        setSystemProperty(TTIMEOUTREAD, "1000");
+        setSystemProperty(TIMEOUTCONNECT, "1000");
     }
 
     @AfterClass
     public void tearDownClass() throws Exception {
-        System.setProperty(TIMEOUTCONNECT, "-1");
-        System.setProperty(TTIMEOUTREAD, "-1");
+        setSystemProperty(TIMEOUTCONNECT, "-1");
+        setSystemProperty(TTIMEOUTREAD, "-1");
     }
 
     /*
@@ -167,7 +178,7 @@
        Data: set use_catalog, use_catalog, catalog file, xml file, handler, expected result string
      */
     @DataProvider(name = "data_SAXC")
-    Object[][] getDataSAXC() {
+    public Object[][] getDataSAXC() {
         return new Object[][]{
             {true, false, xml_catalog, xml_system, new MyHandler(elementInSystem), expectedWCatalog}
 
@@ -179,7 +190,7 @@
        Data: set use_catalog, use_catalog, catalog file, xml file, handler, expected result string
      */
     @DataProvider(name = "data_XIC")
-    Object[][] getDataXIC() {
+    public Object[][] getDataXIC() {
         return new Object[][]{
             {true, false, xml_catalog, xml_xInclude, new MyHandler(elementInXISimple), contentInUIutf8Catalog},
         };
@@ -190,7 +201,7 @@
        Data: set use_catalog, use_catalog, catalog file, xml file, handler, expected result string
      */
     @DataProvider(name = "data_DOMC")
-    Object[][] getDataDOMC() {
+    public Object[][] getDataDOMC() {
         return new Object[][]{
             {true, false, xml_catalog, xml_system, new MyHandler(elementInSystem), expectedWCatalog}
         };
@@ -201,7 +212,7 @@
        Data: set use_catalog, use_catalog, catalog file, xsd file, a LSResourceResolver
      */
     @DataProvider(name = "data_SchemaC")
-    Object[][] getDataSchemaC() {
+    public Object[][] getDataSchemaC() {
 
         return new Object[][]{
             // for resolving DTD in xsd
@@ -219,7 +230,7 @@
        Data: source, resolver1, resolver2, catalog1, a catalog2
      */
     @DataProvider(name = "data_ValidatorC")
-    Object[][] getDataValidator() {
+    public Object[][] getDataValidator() {
         DOMSource ds = getDOMSource(xml_val_test, xml_val_test_id, false, true, xml_catalog);
 
         SAXSource ss = new SAXSource(new InputSource(xml_val_test));
@@ -257,7 +268,7 @@
        Data: set use_catalog, use_catalog, catalog file, xsl file, xml file, a URIResolver, expected
      */
     @DataProvider(name = "data_XSLC")
-    Object[][] getDataXSLC() {
+    public Object[][] getDataXSLC() {
         SAXSource xslSourceDTD = new SAXSource(new InputSource(new StringReader(xsl_includeDTD)));
         StreamSource xmlSourceDTD = new StreamSource(new StringReader(xml_xslDTD));
 
@@ -271,3 +282,4 @@
         };
     }
 }
+
diff --git a/jaxp/test/javax/xml/jaxp/unittest/catalog/CatalogSupport4.java b/jaxp/test/javax/xml/jaxp/unittest/catalog/CatalogSupport4.java
index fc905a6..12b15e6 100644
--- a/jaxp/test/javax/xml/jaxp/unittest/catalog/CatalogSupport4.java
+++ b/jaxp/test/javax/xml/jaxp/unittest/catalog/CatalogSupport4.java
@@ -23,23 +23,33 @@
 
 package catalog;
 
+import static jaxp.library.JAXPTestUtilities.clearSystemProperty;
+import static jaxp.library.JAXPTestUtilities.setSystemProperty;
+
 import java.io.File;
 import java.io.StringReader;
+
 import javax.xml.transform.Source;
 import javax.xml.transform.URIResolver;
 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.annotations.AfterClass;
 import org.testng.annotations.BeforeClass;
 import org.testng.annotations.DataProvider;
+import org.testng.annotations.Listeners;
 import org.testng.annotations.Test;
 import org.w3c.dom.ls.LSResourceResolver;
 import org.xml.sax.InputSource;
 
 /**
+ * @test
  * @bug 8158084 8162438 8162442
+ * @library /javax/xml/jaxp/libs /javax/xml/jaxp/unittest
+ * @run testng/othervm -DrunSecMngr=true catalog.CatalogSupport4
+ * @run testng/othervm catalog.CatalogSupport4
  * @summary verifies the overriding over of the USE_CATALOG feature. Extending
  * CatalogSupport tests, the USE_CATALOG is turned off system-wide, however,
  * a JAXP processor may decide to use Catalog by enabling it through the factory
@@ -54,6 +64,7 @@
  *
  * @author huizhe.wang@oracle.com
  */
+@Listeners({jaxp.library.FilePolicy.class, jaxp.library.NetAccessPolicy.class})
 public class CatalogSupport4 extends CatalogSupportBase {
     /*
      * Initializing fields
@@ -62,12 +73,12 @@
     public void setUpClass() throws Exception {
         setUp();
         //turn off USE_CATALOG system-wide
-        System.setProperty(SP_USE_CATALOG, "false");
+        setSystemProperty(SP_USE_CATALOG, "false");
     }
 
     @AfterClass
     public void tearDownClass() throws Exception {
-        System.clearProperty(SP_USE_CATALOG);
+        clearSystemProperty(SP_USE_CATALOG);
     }
 
     /*
@@ -160,7 +171,7 @@
        Data: set use_catalog, use_catalog, catalog file, xml file, handler, expected result string
      */
     @DataProvider(name = "data_SAXA")
-    Object[][] getDataSAX() {
+    public Object[][] getDataSAX() {
         return new Object[][]{
             {true, true, xml_catalog, xml_system, new MyHandler(elementInSystem), expectedWCatalog},
         };
@@ -171,7 +182,7 @@
        Data: set use_catalog, use_catalog, catalog file, xml file, handler, expected result string
      */
     @DataProvider(name = "data_XIA")
-    Object[][] getDataXI() {
+    public Object[][] getDataXI() {
         return new Object[][]{
             {true, true, xml_catalog, xml_xInclude, new MyHandler(elementInXISimple), contentInUIutf8Catalog},
         };
@@ -182,7 +193,7 @@
        Data: set use_catalog, use_catalog, catalog file, xml file, handler, expected result string
      */
     @DataProvider(name = "data_DOMA")
-    Object[][] getDataDOM() {
+    public Object[][] getDataDOM() {
         return new Object[][]{
             {true, true, xml_catalog, xml_system, new MyHandler(elementInSystem), expectedWCatalog},
         };
@@ -197,7 +208,7 @@
        Data: set use_catalog, use_catalog, catalog file, xsd file, a LSResourceResolver
      */
     @DataProvider(name = "data_SchemaA")
-    Object[][] getDataSchema() {
+    public Object[][] getDataSchema() {
         return new Object[][]{
             // for resolving DTD in xsd
             {true, true, xml_catalog, xsd_xmlSchema, null},
@@ -213,7 +224,7 @@
        Data: source, resolver1, resolver2, catalog1, a catalog2
      */
     @DataProvider(name = "data_ValidatorA")
-    Object[][] getDataValidator() {
+    public Object[][] getDataValidator() {
         DOMSource ds = getDOMSource(xml_val_test, xml_val_test_id, true, true, xml_catalog);
 
         SAXSource ss = new SAXSource(new InputSource(xml_val_test));
@@ -242,7 +253,7 @@
        Data: set use_catalog, use_catalog, catalog file, xsl file, xml file, a URIResolver, expected result
      */
     @DataProvider(name = "data_XSLA")
-    Object[][] getDataXSL() {
+    public Object[][] getDataXSL() {
         // XSLInclude.xsl has one import XSLImport_html.xsl and two includes,
         // XSLInclude_header.xsl and XSLInclude_footer.xsl;
         SAXSource xslSourceDTD = new SAXSource(new InputSource(new StringReader(xsl_includeDTD)));
@@ -258,3 +269,4 @@
         };
     }
 }
+
diff --git a/jaxp/test/javax/xml/jaxp/unittest/catalog/CatalogSupportBase.java b/jaxp/test/javax/xml/jaxp/unittest/catalog/CatalogSupportBase.java
index 3e0d725..83a1520 100644
--- a/jaxp/test/javax/xml/jaxp/unittest/catalog/CatalogSupportBase.java
+++ b/jaxp/test/javax/xml/jaxp/unittest/catalog/CatalogSupportBase.java
@@ -23,6 +23,8 @@
 
 package catalog;
 
+import static jaxp.library.JAXPTestUtilities.getSystemProperty;
+
 import java.io.ByteArrayInputStream;
 import java.io.File;
 import java.io.FileInputStream;
@@ -33,6 +35,7 @@
 import java.io.StringReader;
 import java.io.StringWriter;
 import java.io.UnsupportedEncodingException;
+
 import javax.xml.XMLConstants;
 import javax.xml.catalog.CatalogFeatures;
 import javax.xml.parsers.DocumentBuilder;
@@ -58,8 +61,8 @@
 import javax.xml.validation.Schema;
 import javax.xml.validation.SchemaFactory;
 import javax.xml.validation.Validator;
+
 import org.testng.Assert;
-import org.testng.annotations.Test;
 import org.w3c.dom.Document;
 import org.w3c.dom.Node;
 import org.w3c.dom.ls.LSInput;
@@ -89,7 +92,7 @@
 
     protected void setUp() {
         String file1 = getClass().getResource("CatalogSupport.xml").getFile();
-        if (System.getProperty("os.name").contains("Windows")) {
+        if (getSystemProperty("os.name").contains("Windows")) {
             filepath = file1.substring(1, file1.lastIndexOf("/") + 1);
             slash = "/";
         } else {
@@ -932,3 +935,4 @@
         }
     }
 }
+
diff --git a/jaxp/test/javax/xml/jaxp/unittest/catalog/CatalogTest.java b/jaxp/test/javax/xml/jaxp/unittest/catalog/CatalogTest.java
index 9d49258..4c00ef6 100644
--- a/jaxp/test/javax/xml/jaxp/unittest/catalog/CatalogTest.java
+++ b/jaxp/test/javax/xml/jaxp/unittest/catalog/CatalogTest.java
@@ -22,8 +22,15 @@
  */
 package catalog;
 
+import static jaxp.library.JAXPTestUtilities.clearSystemProperty;
+import static jaxp.library.JAXPTestUtilities.getSystemProperty;
+import static jaxp.library.JAXPTestUtilities.setSystemProperty;
+
+import java.io.FilePermission;
 import java.io.IOException;
 import java.nio.file.Paths;
+import java.util.PropertyPermission;
+
 import javax.xml.catalog.Catalog;
 import javax.xml.catalog.CatalogException;
 import javax.xml.catalog.CatalogFeatures;
@@ -35,9 +42,13 @@
 import javax.xml.parsers.SAXParser;
 import javax.xml.parsers.SAXParserFactory;
 import javax.xml.transform.Source;
+
+import jaxp.library.JAXPTestUtilities;
+
 import org.testng.Assert;
 import org.testng.annotations.BeforeClass;
 import org.testng.annotations.DataProvider;
+import org.testng.annotations.Listeners;
 import org.testng.annotations.Test;
 import org.xml.sax.Attributes;
 import org.xml.sax.ErrorHandler;
@@ -47,9 +58,14 @@
 import org.xml.sax.ext.DefaultHandler2;
 
 /*
- * @bug 8081248, 8144966, 8146606, 8146237, 8151154, 8150969, 8151162, 8152527, 8154220
+ * @test
+ * @bug 8081248 8144966 8146606 8146237 8151154 8150969 8151162 8152527 8154220
+ * @library /javax/xml/jaxp/libs /javax/xml/jaxp/unittest
+ * @run testng/othervm -DrunSecMngr=true catalog.CatalogTest
+ * @run testng/othervm catalog.CatalogTest
  * @summary Tests basic Catalog functions.
  */
+@Listeners({jaxp.library.FilePolicy.class})
 public class CatalogTest {
     static final String KEY_FILES = "javax.xml.catalog.files";
 
@@ -61,7 +77,7 @@
     @BeforeClass
     public void setUpClass() throws Exception {
         String file1 = getClass().getResource("first_cat.xml").getFile();
-        if (System.getProperty("os.name").contains("Windows")) {
+        if (getSystemProperty("os.name").contains("Windows")) {
             filepath = file1.substring(1, file1.lastIndexOf("/") + 1);
         } else {
             filepath = file1.substring(0, file1.lastIndexOf("/") + 1);
@@ -112,12 +128,12 @@
         String files = file1 + ";" + file2;
 
         try {
-            System.setProperty(KEY_FILES, files);
+            setSystemProperty(KEY_FILES, files);
             CatalogResolver catalogResolver = CatalogManager.catalogResolver(CatalogFeatures.defaults());
             String sysId = catalogResolver.resolveEntity(null, systemId).getSystemId();
             Assert.assertEquals(sysId, Paths.get(filepath + expectedUri).toUri().toString().replace("///", "/"), "System ID match not right");
         } finally {
-            System.clearProperty(KEY_FILES);
+            clearSystemProperty(KEY_FILES);
         }
 
     }
@@ -203,9 +219,12 @@
      */
     @Test(dataProvider = "invalidPaths", expectedExceptions = IllegalArgumentException.class)
     public void testFileInput(String file) {
+        JAXPTestUtilities.runWithTmpPermission(() -> {
             CatalogFeatures features = CatalogFeatures.builder()
                 .with(CatalogFeatures.Feature.FILES, file)
                 .build();
+        }, new FilePermission("/../../..", "read"), new FilePermission("c:\\te:t", "read"),
+                new FilePermission("c:\\te?t", "read"), new PropertyPermission("user.dir", "read"));
     }
 
     /**
@@ -371,7 +390,7 @@
         This DataProvider is copied from JCK ResolveTests' dataMatch1
      */
     @DataProvider(name = "resolveUri")
-    Object[][] getDataForUriResolver() {
+    public Object[][] getDataForUriResolver() {
         return new Object[][]{
             {"uri.xml", "urn:publicid:-:Acme,+Inc.:DTD+Book+Version+1.0", null, "http://local/base/dtd/book.dtd", "Uri in publicId namespace is incorrectly unwrapped"},
         };
@@ -382,7 +401,7 @@
     hierarchyOfCatFiles2.
      */
     @DataProvider(name = "hierarchyOfCatFilesData")
-    Object[][] getHierarchyOfCatFilesData() {
+    public Object[][] getHierarchyOfCatFilesData() {
         return new Object[][]{
             {"http://www.oracle.com/sequence.dtd", "first.dtd"},
             {"http://www.oracle.com/sequence_next.dtd", "next.dtd"},
@@ -396,7 +415,7 @@
         catalog, prefer, systemId, publicId, expectedUri, expectedFile, msg
      */
     @DataProvider(name = "resolveEntity")
-    Object[][] getDataForMatchingBothIds() {
+    public Object[][] getDataForMatchingBothIds() {
         String expected = "http://www.groupxmlbase.com/dtds/rewrite.dtd";
         return new Object[][]{
             {"rewriteSystem_id.xml", "system", "http://www.sys00test.com/rewrite.dtd", "PUB-404", expected, expected, "Relative rewriteSystem with xml:base at group level failed"},
@@ -411,7 +430,7 @@
         prefer, catalog, publicId, systemId, expected result
      */
     @DataProvider(name = "matchWithPrefer")
-    Object[][] getDataForMatch() {
+    public Object[][] getDataForMatch() {
         return new Object[][]{
             {"public", "pubOnly.xml", id, "", "http://local/base/dtd/public.dtd"},
             {"public", "sysOnly.xml", id, "", null},
@@ -435,7 +454,7 @@
         prefer, catalog, publicId, systemId, expected result
      */
     @DataProvider(name = "resolveWithPrefer")
-    Object[][] getDataForResolve() {
+    public Object[][] getDataForResolve() {
         return new Object[][]{
             {"system", "pubOnly.xml", id, "", "http://local/base/dtd/public.dtd"},
             {"system", "pubOnly.xml", "", id, null},
@@ -462,7 +481,7 @@
                      The defer attribute is set to false.
      */
     @DataProvider(name = "invalidAltCatalogs")
-    Object[][] getCatalogs() {
+    public Object[][] getCatalogs() {
         return new Object[][]{
             {"defer_false_2.xml"},
             {"defer_del_false.xml"}
@@ -474,7 +493,7 @@
                      the CatalogFeatures builder
      */
     @DataProvider(name = "invalidPaths")
-    Object[][] getFiles() {
+    public Object[][] getFiles() {
         return new Object[][]{
             {null},
             {""},
@@ -493,7 +512,7 @@
        document.
      */
     @DataProvider(name = "catalog")
-    Object[][] getCatalog() {
+    public Object[][] getCatalog() {
         return new Object[][]{
             {"testSystem", "Test system entry", "catalog.xml", "system.xml", getParser()},
             {"testRewriteSystem", "Test rewritesystem entry", "catalog.xml", "rewritesystem.xml", getParser()},
@@ -517,7 +536,6 @@
         return saxParser;
     }
 
-
     /**
      * SAX handler
      */
@@ -536,7 +554,8 @@
         }
 
         @Override
-        public void startElement(String uri, String localName, String qName, Attributes attributes) throws SAXException {
+        public void startElement(String uri, String localName, String qName, Attributes attributes)
+                throws SAXException {
             textContent.delete(0, textContent.length());
             try {
                 System.out.println("Element: " + uri + ":" + localName + " " + qName);
@@ -552,3 +571,4 @@
         }
     }
 }
+
diff --git a/jaxp/test/javax/xml/jaxp/unittest/common/Bug6350682.java b/jaxp/test/javax/xml/jaxp/unittest/common/Bug6350682.java
index e955df4..210db35 100644
--- a/jaxp/test/javax/xml/jaxp/unittest/common/Bug6350682.java
+++ b/jaxp/test/javax/xml/jaxp/unittest/common/Bug6350682.java
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2014, 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2014, 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
@@ -23,23 +23,31 @@
 
 package common;
 
+import static jaxp.library.JAXPTestUtilities.runWithAllPerm;
+
 import javax.xml.parsers.SAXParserFactory;
 import javax.xml.transform.TransformerFactory;
 import javax.xml.transform.TransformerFactoryConfigurationError;
 
 import org.testng.Assert;
+import org.testng.annotations.Listeners;
 import org.testng.annotations.Test;
 
 /*
+ * @test
  * @bug 6350682
+ * @library /javax/xml/jaxp/libs /javax/xml/jaxp/unittest
+ * @run testng/othervm -DrunSecMngr=true common.Bug6350682
+ * @run testng/othervm common.Bug6350682
  * @summary Test SAXParserFactory and TransformerFactory can newInstance when setContextClassLoader(null).
  */
+@Listeners({jaxp.library.BasePolicy.class})
 public class Bug6350682 {
 
     @Test
     public void testSAXParserFactory() {
         try {
-            Thread.currentThread().setContextClassLoader(null);
+            runWithAllPerm(() -> Thread.currentThread().setContextClassLoader(null));
             if (Bug6350682.class.getClassLoader() == null)
                 System.out.println("this class loader is NULL");
             else
@@ -55,7 +63,7 @@
     @Test
     public void testTransformerFactory() {
         try {
-            Thread.currentThread().setContextClassLoader(null);
+            runWithAllPerm(() -> Thread.currentThread().setContextClassLoader(null));
             TransformerFactory factory = TransformerFactory.newInstance();
             Assert.assertTrue(factory != null, "Failed to get an instance of a TransformerFactory");
         } catch (Exception e) {
@@ -67,3 +75,4 @@
         }
     }
 }
+
diff --git a/jaxp/test/javax/xml/jaxp/unittest/common/Bug6723276Test.java b/jaxp/test/javax/xml/jaxp/unittest/common/Bug6723276Test.java
index 63ac73d..8763290 100644
--- a/jaxp/test/javax/xml/jaxp/unittest/common/Bug6723276Test.java
+++ b/jaxp/test/javax/xml/jaxp/unittest/common/Bug6723276Test.java
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2014, 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2014, 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
@@ -23,6 +23,7 @@
 
 package common;
 
+import org.testng.annotations.Listeners;
 import org.testng.annotations.Test;
 import org.testng.Assert;
 import java.net.URL;
@@ -31,9 +32,14 @@
 import javax.xml.parsers.SAXParserFactory;
 
 /*
+ * @test
  * @bug 6723276
+ * @library /javax/xml/jaxp/libs /javax/xml/jaxp/unittest
+ * @run testng/othervm -DrunSecMngr=true common.Bug6723276Test
+ * @run testng/othervm common.Bug6723276Test
  * @summary Test JAXP class can be loaded by bootstrap classloader.
  */
+@Listeners({jaxp.library.BasePolicy.class})
 public class Bug6723276Test {
 
     @Test
@@ -62,3 +68,4 @@
     }
 
 }
+
diff --git a/jaxp/test/javax/xml/jaxp/unittest/common/Bug6941169Test.java b/jaxp/test/javax/xml/jaxp/unittest/common/Bug6941169Test.java
index 8f03995..8bf9ea4 100644
--- a/jaxp/test/javax/xml/jaxp/unittest/common/Bug6941169Test.java
+++ b/jaxp/test/javax/xml/jaxp/unittest/common/Bug6941169Test.java
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2014, 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2014, 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
@@ -23,11 +23,13 @@
 
 package common;
 
+import static jaxp.library.JAXPTestUtilities.clearSystemProperty;
+import static jaxp.library.JAXPTestUtilities.getSystemProperty;
+import static jaxp.library.JAXPTestUtilities.setSystemProperty;
+
+import java.io.FilePermission;
 import java.io.InputStream;
 import java.io.StringWriter;
-import java.security.AllPermission;
-import java.security.Permission;
-import java.security.Permissions;
 
 import javax.xml.XMLConstants;
 import javax.xml.parsers.DocumentBuilder;
@@ -44,15 +46,24 @@
 import javax.xml.xpath.XPath;
 import javax.xml.xpath.XPathFactory;
 
+import jaxp.library.JAXPTestUtilities;
+
 import org.testng.Assert;
+import org.testng.annotations.Listeners;
 import org.testng.annotations.Test;
 import org.w3c.dom.Document;
 import org.xml.sax.InputSource;
 
 /*
+ * @test
  * @bug 6941169
+ * @library /javax/xml/jaxp/libs /javax/xml/jaxp/unittest
+ * @run testng/othervm -DrunSecMngr=true common.Bug6941169Test
+ * @run testng/othervm common.Bug6941169Test
  * @summary Test use-service-mechanism feature.
  */
+@Test(singleThreaded = true)
+@Listeners({ jaxp.library.FilePolicy.class })
 public class Bug6941169Test {
     static final String SCHEMA_LANGUAGE = "http://java.sun.com/xml/jaxp/properties/schemaLanguage";
     static final String SCHEMA_SOURCE = "http://java.sun.com/xml/jaxp/properties/schemaSource";
@@ -71,7 +82,7 @@
         System.out.println("Validation using SAX Source;  Service mechnism is turned off;  SAX Impl should be the default:");
         InputSource is = new InputSource(Bug6941169Test.class.getResourceAsStream("Bug6941169.xml"));
         SAXSource ss = new SAXSource(is);
-        System.setProperty(SAX_FACTORY_ID, "MySAXFactoryImpl");
+        setSystemProperty(SAX_FACTORY_ID, "MySAXFactoryImpl");
         long start = System.currentTimeMillis();
         try {
             SchemaFactory factory = SchemaFactory.newInstance(XMLConstants.W3C_XML_SCHEMA_NS_URI);
@@ -94,7 +105,7 @@
         long end = System.currentTimeMillis();
         double elapsedTime = ((end - start));
         System.out.println("Time elapsed: " + elapsedTime);
-        System.clearProperty(SAX_FACTORY_ID);
+        clearSystemProperty(SAX_FACTORY_ID);
     }
 
     @Test
@@ -102,7 +113,7 @@
         System.out.println("Validation using SAX Source. Using service mechnism (by default) to find SAX Impl:");
         InputSource is = new InputSource(Bug6941169Test.class.getResourceAsStream("Bug6941169.xml"));
         SAXSource ss = new SAXSource(is);
-        System.setProperty(SAX_FACTORY_ID, "MySAXFactoryImpl");
+        setSystemProperty(SAX_FACTORY_ID, "MySAXFactoryImpl");
         long start = System.currentTimeMillis();
         try {
             SchemaFactory factory = SchemaFactory.newInstance(XMLConstants.W3C_XML_SCHEMA_NS_URI);
@@ -121,18 +132,18 @@
         long end = System.currentTimeMillis();
         double elapsedTime = ((end - start));
         System.out.println("Time elapsed: " + elapsedTime);
-        System.clearProperty(SAX_FACTORY_ID);
+        clearSystemProperty(SAX_FACTORY_ID);
     }
 
     @Test
-    public void testValidation_SAX_withSM() {
+    public void testValidation_SAX_withSM() throws Exception {
+        if(System.getSecurityManager() == null)
+            return;
+
         System.out.println("Validation using SAX Source with security manager:");
         InputSource is = new InputSource(Bug6941169Test.class.getResourceAsStream("Bug6941169.xml"));
         SAXSource ss = new SAXSource(is);
-        System.setProperty(SAX_FACTORY_ID, "MySAXFactoryImpl");
-        Permissions granted = new java.security.Permissions();
-        granted.add(new AllPermission());
-        System.setSecurityManager(new MySM(granted));
+        setSystemProperty(SAX_FACTORY_ID, "MySAXFactoryImpl");
 
         long start = System.currentTimeMillis();
         try {
@@ -152,13 +163,11 @@
             // System.out.println(e.getMessage());
 
         } finally {
-            System.clearProperty(SAX_FACTORY_ID);
-            System.setSecurityManager(null);
+            clearSystemProperty(SAX_FACTORY_ID);
         }
         long end = System.currentTimeMillis();
         double elapsedTime = ((end - start));
         System.out.println("Time elapsed: " + elapsedTime);
-        System.setSecurityManager(null);
 
     }
 
@@ -170,7 +179,7 @@
 
         // DOMSource domSource = new
         // DOMSource(getDocument(Bug6941169Test.class.getResourceAsStream("Bug6941169.xml")));
-        System.setProperty(DOM_FACTORY_ID, "MyDOMFactoryImpl");
+        setSystemProperty(DOM_FACTORY_ID, "MyDOMFactoryImpl");
         long start = System.currentTimeMillis();
         try {
             TransformerFactory factory = TransformerFactory.newInstance();
@@ -210,7 +219,7 @@
         long end = System.currentTimeMillis();
         double elapsedTime = ((end - start));
         System.out.println("Time elapsed: " + elapsedTime);
-        System.clearProperty(DOM_FACTORY_ID);
+        clearSystemProperty(DOM_FACTORY_ID);
     }
 
     /** this is by default */
@@ -222,7 +231,7 @@
 
         // DOMSource domSource = new
         // DOMSource(getDocument(Bug6941169Test.class.getResourceAsStream("Bug6941169.xml")));
-        System.setProperty(DOM_FACTORY_ID, "MyDOMFactoryImpl");
+        setSystemProperty(DOM_FACTORY_ID, "MyDOMFactoryImpl");
         long start = System.currentTimeMillis();
         try {
             TransformerFactory factory = TransformerFactory.newInstance();
@@ -254,21 +263,20 @@
         long end = System.currentTimeMillis();
         double elapsedTime = ((end - start));
         System.out.println("Time elapsed: " + elapsedTime);
-        System.clearProperty(DOM_FACTORY_ID);
+        clearSystemProperty(DOM_FACTORY_ID);
     }
 
     @Test
-    public void testTransform_DOM_withSM() {
+    public void testTransform_DOM_withSM() throws Exception {
+        if(System.getSecurityManager() == null)
+            return;
         System.out.println("Transform using DOM Source;  Security Manager is set:");
         DOMSource domSource = new DOMSource();
         domSource.setSystemId(_xml);
 
         // DOMSource domSource = new
         // DOMSource(getDocument(Bug6941169Test.class.getResourceAsStream("Bug6941169.xml")));
-        Permissions granted = new java.security.Permissions();
-        granted.add(new AllPermission());
-        System.setSecurityManager(new MySM(granted));
-        System.setProperty(DOM_FACTORY_ID, "MyDOMFactoryImpl");
+        setSystemProperty(DOM_FACTORY_ID, "MyDOMFactoryImpl");
         long start = System.currentTimeMillis();
         try {
             TransformerFactory factory = TransformerFactory.newInstance("com.sun.org.apache.xalan.internal.xsltc.trax.TransformerFactoryImpl",
@@ -301,13 +309,12 @@
             // System.out.println(e.getMessage());
 
         } finally {
-            System.clearProperty(DOM_FACTORY_ID);
-            System.setSecurityManager(null);
+            clearSystemProperty(DOM_FACTORY_ID);
         }
         long end = System.currentTimeMillis();
         double elapsedTime = ((end - start));
         System.out.println("Time elapsed: " + elapsedTime);
-        System.clearProperty(DOM_FACTORY_ID);
+
     }
 
     @Test
@@ -315,7 +322,7 @@
         final String XPATH_EXPRESSION = "/fooTest";
         System.out.println("Evaluate DOM Source;  Service mechnism is turned off;  Default DOM Impl should be used:");
         Document doc = getDocument(Bug6941169Test.class.getResourceAsStream("Bug6941169.xml"));
-        System.setProperty(DOM_FACTORY_ID, "MyDOMFactoryImpl");
+        setSystemProperty(DOM_FACTORY_ID, "MyDOMFactoryImpl");
         long start = System.currentTimeMillis();
         try {
             XPathFactory xPathFactory = XPathFactory.newInstance();
@@ -352,7 +359,7 @@
         long end = System.currentTimeMillis();
         double elapsedTime = ((end - start));
         System.out.println("Time elapsed: " + elapsedTime);
-        System.clearProperty(DOM_FACTORY_ID);
+        clearSystemProperty(DOM_FACTORY_ID);
     }
 
     @Test
@@ -361,7 +368,7 @@
         System.out.println("Evaluate DOM Source;  Service mechnism is on by default;  It would try to use MyDOMFactoryImpl:");
         InputStream input = getClass().getResourceAsStream("Bug6941169.xml");
         InputSource source = new InputSource(input);
-        System.setProperty(DOM_FACTORY_ID, "MyDOMFactoryImpl");
+        setSystemProperty(DOM_FACTORY_ID, "MyDOMFactoryImpl");
         long start = System.currentTimeMillis();
         try {
             XPathFactory xPathFactory = XPathFactory.newInstance();
@@ -400,19 +407,18 @@
         long end = System.currentTimeMillis();
         double elapsedTime = ((end - start));
         System.out.println("Time elapsed: " + elapsedTime);
-        System.clearProperty(DOM_FACTORY_ID);
+        clearSystemProperty(DOM_FACTORY_ID);
     }
 
     @Test
-    public void testXPath_DOM_withSM() {
+    public void testXPath_DOM_withSM() throws Exception {
+        if(System.getSecurityManager() == null)
+            return;
         final String XPATH_EXPRESSION = "/fooTest";
         System.out.println("Evaluate DOM Source;  Security Manager is set:");
-        Permissions granted = new java.security.Permissions();
-        granted.add(new AllPermission());
-        System.setSecurityManager(new MySM(granted));
         InputStream input = getClass().getResourceAsStream("Bug6941169.xml");
         InputSource source = new InputSource(input);
-        System.setProperty(DOM_FACTORY_ID, "MyDOMFactoryImpl");
+        setSystemProperty(DOM_FACTORY_ID, "MyDOMFactoryImpl");
         long start = System.currentTimeMillis();
         try {
             XPathFactory xPathFactory = XPathFactory.newInstance("http://java.sun.com/jaxp/xpath/dom",
@@ -445,13 +451,12 @@
             // System.out.println(e.getMessage());
 
         } finally {
-            System.clearProperty(DOM_FACTORY_ID);
-            System.setSecurityManager(null);
+            clearSystemProperty(DOM_FACTORY_ID);
         }
         long end = System.currentTimeMillis();
         double elapsedTime = ((end - start));
         System.out.println("Time elapsed: " + elapsedTime);
-        System.clearProperty(DOM_FACTORY_ID);
+
     }
 
     @Test
@@ -480,22 +485,5 @@
 
         return document;
     }
-
-    class MySM extends SecurityManager {
-        Permissions granted;
-
-        public MySM(Permissions perms) {
-            granted = perms;
-        }
-
-        @Override
-        public void checkPermission(Permission perm) {
-            if (granted.implies(perm)) {
-                return;
-            }
-            super.checkPermission(perm);
-        }
-
-    }
-
 }
+
diff --git a/jaxp/test/javax/xml/jaxp/unittest/common/Bug7143711Test.java b/jaxp/test/javax/xml/jaxp/unittest/common/Bug7143711Test.java
index 5074da2..2414288 100644
--- a/jaxp/test/javax/xml/jaxp/unittest/common/Bug7143711Test.java
+++ b/jaxp/test/javax/xml/jaxp/unittest/common/Bug7143711Test.java
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2014, 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2014, 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
@@ -23,9 +23,8 @@
 
 package common;
 
-import java.security.AllPermission;
-import java.security.Permission;
-import java.security.Permissions;
+import static jaxp.library.JAXPTestUtilities.clearSystemProperty;
+import static jaxp.library.JAXPTestUtilities.setSystemProperty;
 
 import javax.xml.XMLConstants;
 import javax.xml.transform.TransformerFactory;
@@ -33,12 +32,18 @@
 import javax.xml.xpath.XPathFactory;
 
 import org.testng.Assert;
+import org.testng.annotations.Listeners;
 import org.testng.annotations.Test;
 
 /*
+ * @test
  * @bug 7143711
+ * @library /javax/xml/jaxp/libs /javax/xml/jaxp/unittest
+ * @run testng/othervm -DrunSecMngr=true common.Bug7143711Test
  * @summary Test set use-service-mechanism shall not override what's set by the constructor in secure mode.
  */
+@Listeners({ jaxp.library.BasePolicy.class })
+@Test(singleThreaded = true)
 public class Bug7143711Test {
     static final String SCHEMA_LANGUAGE = "http://java.sun.com/xml/jaxp/properties/schemaLanguage";
     static final String SCHEMA_SOURCE = "http://java.sun.com/xml/jaxp/properties/schemaSource";
@@ -52,10 +57,7 @@
     @Test
     public void testValidation_SAX_withSM() {
         System.out.println("Validation using SAX Source with security manager:");
-        System.setProperty(SAX_FACTORY_ID, "MySAXFactoryImpl");
-        Permissions granted = new java.security.Permissions();
-        granted.add(new AllPermission());
-        System.setSecurityManager(new MySM(granted));
+        setSystemProperty(SAX_FACTORY_ID, "MySAXFactoryImpl");
 
         try {
             SchemaFactory factory = SchemaFactory.newInstance(XMLConstants.W3C_XML_SCHEMA_NS_URI);
@@ -68,22 +70,14 @@
             Assert.fail(e.getMessage());
 
         } finally {
-            System.clearProperty(SAX_FACTORY_ID);
-            System.setSecurityManager(null);
+            clearSystemProperty(SAX_FACTORY_ID);
         }
-
-        System.setSecurityManager(null);
-
     }
 
     @Test(enabled=false) //skipped due to bug JDK-8080097
     public void testTransform_DOM_withSM() {
         System.out.println("Transform using DOM Source;  Security Manager is set:");
-
-        Permissions granted = new java.security.Permissions();
-        granted.add(new AllPermission());
-        System.setSecurityManager(new MySM(granted));
-        System.setProperty(DOM_FACTORY_ID, "MyDOMFactoryImpl");
+        setSystemProperty(DOM_FACTORY_ID, "MyDOMFactoryImpl");
 
         try {
             TransformerFactory factory = TransformerFactory.newInstance("com.sun.org.apache.xalan.internal.xsltc.trax.TransformerFactoryImpl",
@@ -96,20 +90,14 @@
         } catch (Exception e) {
             Assert.fail(e.getMessage());
         } finally {
-            System.clearProperty(DOM_FACTORY_ID);
-            System.setSecurityManager(null);
+            clearSystemProperty(DOM_FACTORY_ID);
         }
-
-        System.clearProperty(DOM_FACTORY_ID);
     }
 
     @Test
     public void testXPath_DOM_withSM() {
         System.out.println("Evaluate DOM Source;  Security Manager is set:");
-        Permissions granted = new java.security.Permissions();
-        granted.add(new AllPermission());
-        System.setSecurityManager(new MySM(granted));
-        System.setProperty(DOM_FACTORY_ID, "MyDOMFactoryImpl");
+        setSystemProperty(DOM_FACTORY_ID, "MyDOMFactoryImpl");
 
         try {
             XPathFactory xPathFactory = XPathFactory.newInstance("http://java.sun.com/jaxp/xpath/dom",
@@ -122,38 +110,8 @@
         } catch (Exception e) {
             Assert.fail(e.getMessage());
         } finally {
-            System.clearProperty(DOM_FACTORY_ID);
-            System.setSecurityManager(null);
-        }
-
-        System.clearProperty(DOM_FACTORY_ID);
-    }
-
-    @Test
-    public void testSM() {
-        SecurityManager sm = System.getSecurityManager();
-        if (System.getSecurityManager() != null) {
-            System.out.println("Security manager not cleared: " + sm.toString());
-        } else {
-            System.out.println("Security manager cleared: ");
+            clearSystemProperty(DOM_FACTORY_ID);
         }
     }
-
-    class MySM extends SecurityManager {
-        Permissions granted;
-
-        public MySM(Permissions perms) {
-            granted = perms;
-        }
-
-        @Override
-        public void checkPermission(Permission perm) {
-            if (granted.implies(perm)) {
-                return;
-            }
-            super.checkPermission(perm);
-        }
-
-    }
-
 }
+
diff --git a/jaxp/test/javax/xml/jaxp/unittest/common/Sources.java b/jaxp/test/javax/xml/jaxp/unittest/common/Sources.java
index f3deba6..ec09062 100644
--- a/jaxp/test/javax/xml/jaxp/unittest/common/Sources.java
+++ b/jaxp/test/javax/xml/jaxp/unittest/common/Sources.java
@@ -22,11 +22,15 @@
  */
 package common;
 
+import static jaxp.library.JAXPTestUtilities.runWithTmpPermission;
+
 import java.io.ByteArrayInputStream;
 import java.io.File;
 import java.io.StringReader;
 import java.io.UnsupportedEncodingException;
 import java.net.URISyntaxException;
+import java.util.PropertyPermission;
+
 import javax.xml.parsers.DocumentBuilderFactory;
 import javax.xml.parsers.ParserConfigurationException;
 import javax.xml.parsers.SAXParserFactory;
@@ -39,8 +43,10 @@
 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.Listeners;
 import org.testng.annotations.Test;
 import org.w3c.dom.Document;
 import org.xml.sax.InputSource;
@@ -48,10 +54,15 @@
 import org.xml.sax.XMLReader;
 
 /*
+ * @test
  * @bug 8144967
+ * @library /javax/xml/jaxp/libs /javax/xml/jaxp/unittest
+ * @run testng/othervm -DrunSecMngr=true common.Sources
+ * @run testng/othervm common.Sources
  * @summary Tests related to the javax.xml.transform.Source
  * and org.xml.sax.InputSource
  */
+@Listeners({jaxp.library.FilePolicy.class})
 public class Sources {
 
     /**
@@ -88,7 +99,7 @@
      * DataProvider: sources that are empty
      */
     @DataProvider(name = "emptySources")
-    Object[][] getSources() throws URISyntaxException {
+    public Object[][] getSources() throws URISyntaxException {
 
         return new Object[][]{
             {new DOMSource()},
@@ -108,27 +119,29 @@
      * DataProvider: sources that are not empty
      */
     @DataProvider(name = "nonEmptySources")
-    Object[][] getSourcesEx() throws URISyntaxException {
+    public Object[][] getSourcesEx() {
         StAXSource ss = null;
         try {
             ss = new StAXSource(getXMLEventReader());
-        } catch (XMLStreamException ex) {}
+        } 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}
-        };
+        return new Object[][] {
+            // This will set a non-null systemId on the resulting
+            // StreamSource
+            { runWithTmpPermission(() -> new StreamSource(new File("")), new PropertyPermission("user.dir", "read")) },
+            // 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 {
+    public Object[][] getInputSources() throws URISyntaxException {
         byte[] utf8Bytes = null;
         try {
             utf8Bytes = "".getBytes("UTF8");
@@ -200,3 +213,4 @@
         return r;
     }
 }
+
diff --git a/jaxp/test/javax/xml/jaxp/unittest/common/TestSAXDriver.java b/jaxp/test/javax/xml/jaxp/unittest/common/TestSAXDriver.java
index 033bbde..1745e46 100644
--- a/jaxp/test/javax/xml/jaxp/unittest/common/TestSAXDriver.java
+++ b/jaxp/test/javax/xml/jaxp/unittest/common/TestSAXDriver.java
@@ -56,3 +56,4 @@
 
     private static final String ENT_EXP_LIMIT_PROP = "http://www.oracle.com/xml/jaxp/properties/entityExpansionLimit";
 }
+
diff --git a/jaxp/test/javax/xml/jaxp/unittest/common/TransformationWarningsTest.java b/jaxp/test/javax/xml/jaxp/unittest/common/TransformationWarningsTest.java
index 26659a0..310d1a4 100644
--- a/jaxp/test/javax/xml/jaxp/unittest/common/TransformationWarningsTest.java
+++ b/jaxp/test/javax/xml/jaxp/unittest/common/TransformationWarningsTest.java
@@ -23,29 +23,37 @@
 
 package common;
 
+import static jaxp.library.JAXPTestUtilities.setSystemProperty;
+
 import java.io.StringReader;
 import java.io.StringWriter;
+
 import javax.xml.transform.Source;
 import javax.xml.transform.Transformer;
 import javax.xml.transform.TransformerFactory;
 import javax.xml.transform.stream.StreamResult;
 import javax.xml.transform.stream.StreamSource;
-import org.testng.annotations.Test;
+
 import org.testng.annotations.BeforeClass;
+import org.testng.annotations.Listeners;
+import org.testng.annotations.Test;
 
 /*
  * @test
- * @modules javax.xml/com.sun.org.apache.xerces.internal.jaxp
  * @bug 8144593
+ * @library /javax/xml/jaxp/libs /javax/xml/jaxp/unittest
+ * @run testng/othervm -DrunSecMngr=true common.TransformationWarningsTest
+ * @run testng/othervm common.TransformationWarningsTest
  * @summary Check that warnings about unsupported properties from parsers
  * are suppressed during the transformation process.
  */
+@Listeners({jaxp.library.BasePolicy.class})
 public class TransformationWarningsTest extends WarningsTestBase {
 
     @BeforeClass
     public void setup() {
         //Set test SAX driver implementation.
-        System.setProperty("org.xml.sax.driver", "common.TestSAXDriver");
+        setSystemProperty("org.xml.sax.driver", "common.TestSAXDriver");
     }
 
     @Test
@@ -91,3 +99,4 @@
             + "</xsl:stylesheet>";
     private static final String xml = "<?xml version=\"1.0\" encoding=\"UTF-8\"?><root></root>";
 }
+
diff --git a/jaxp/test/javax/xml/jaxp/unittest/common/ValidationWarningsTest.java b/jaxp/test/javax/xml/jaxp/unittest/common/ValidationWarningsTest.java
index 4c3e9de..3b4a945 100644
--- a/jaxp/test/javax/xml/jaxp/unittest/common/ValidationWarningsTest.java
+++ b/jaxp/test/javax/xml/jaxp/unittest/common/ValidationWarningsTest.java
@@ -23,8 +23,11 @@
 
 package common;
 
+import static jaxp.library.JAXPTestUtilities.setSystemProperty;
+
 import java.io.ByteArrayInputStream;
 import java.io.StringReader;
+
 import javax.xml.XMLConstants;
 import javax.xml.transform.Source;
 import javax.xml.transform.sax.SAXSource;
@@ -32,24 +35,29 @@
 import javax.xml.validation.Schema;
 import javax.xml.validation.SchemaFactory;
 import javax.xml.validation.Validator;
-import org.testng.annotations.Test;
+
 import org.testng.annotations.BeforeClass;
+import org.testng.annotations.Listeners;
+import org.testng.annotations.Test;
 import org.xml.sax.InputSource;
 
 /*
  * @test
  * @bug 8144593
  * @key intermittent
- * @modules javax.xml/com.sun.org.apache.xerces.internal.jaxp
+ * @library /javax/xml/jaxp/libs /javax/xml/jaxp/unittest
+ * @run testng/othervm -DrunSecMngr=true common.ValidationWarningsTest
+ * @run testng/othervm common.ValidationWarningsTest
  * @summary Check that warnings about unsupported properties from SAX
  *  parsers are suppressed during the xml validation process.
  */
+@Listeners({jaxp.library.InternalAPIPolicy.class})
 public class ValidationWarningsTest extends WarningsTestBase {
 
     @BeforeClass
     public void setup() {
         //Set test SAX driver implementation.
-        System.setProperty("org.xml.sax.driver", "common.TestSAXDriver");
+        setSystemProperty("org.xml.sax.driver", "common.TestSAXDriver");
     }
 
     @Test
@@ -76,3 +84,4 @@
     private static final String xml = "<?xml version='1.0'?><test>Element</test>";
 
 }
+
diff --git a/jaxp/test/javax/xml/jaxp/unittest/datatype/Bug6320118.java b/jaxp/test/javax/xml/jaxp/unittest/datatype/Bug6320118.java
index 87d3829..5f92bd0 100644
--- a/jaxp/test/javax/xml/jaxp/unittest/datatype/Bug6320118.java
+++ b/jaxp/test/javax/xml/jaxp/unittest/datatype/Bug6320118.java
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2014, 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2014, 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
@@ -28,12 +28,18 @@
 import javax.xml.datatype.XMLGregorianCalendar;
 
 import org.testng.Assert;
+import org.testng.annotations.Listeners;
 import org.testng.annotations.Test;
 
 /*
+ * @test
  * @bug 6320118
+ * @library /javax/xml/jaxp/libs /javax/xml/jaxp/unittest
+ * @run testng/othervm -DrunSecMngr=true datatype.Bug6320118
+ * @run testng/othervm datatype.Bug6320118
  * @summary Test xml datatype XMLGregorianCalendar.
  */
+@Listeners({jaxp.library.BasePolicy.class})
 public class Bug6320118 {
 
     DatatypeFactory df;
@@ -102,3 +108,4 @@
     }
 
 }
+
diff --git a/jaxp/test/javax/xml/jaxp/unittest/datatype/Bug6937951Test.java b/jaxp/test/javax/xml/jaxp/unittest/datatype/Bug6937951Test.java
index 161f127..1c86bad 100644
--- a/jaxp/test/javax/xml/jaxp/unittest/datatype/Bug6937951Test.java
+++ b/jaxp/test/javax/xml/jaxp/unittest/datatype/Bug6937951Test.java
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2014, 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2014, 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
@@ -28,12 +28,18 @@
 import javax.xml.datatype.XMLGregorianCalendar;
 
 import org.testng.Assert;
+import org.testng.annotations.Listeners;
 import org.testng.annotations.Test;
 
 /*
+ * @test
  * @bug 6937951
+ * @library /javax/xml/jaxp/libs /javax/xml/jaxp/unittest
+ * @run testng/othervm -DrunSecMngr=true datatype.Bug6937951Test
+ * @run testng/othervm datatype.Bug6937951Test
  * @summary Test midnight is same as the start of the next day in XMLGregorianCalendar.
  */
+@Listeners({jaxp.library.BasePolicy.class})
 public class Bug6937951Test {
 
     @Test
@@ -51,3 +57,4 @@
     }
 
 }
+
diff --git a/jaxp/test/javax/xml/jaxp/unittest/datatype/Bug6937964Test.java b/jaxp/test/javax/xml/jaxp/unittest/datatype/Bug6937964Test.java
index 73ea293..9caf929 100644
--- a/jaxp/test/javax/xml/jaxp/unittest/datatype/Bug6937964Test.java
+++ b/jaxp/test/javax/xml/jaxp/unittest/datatype/Bug6937964Test.java
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2014, 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2014, 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
@@ -33,12 +33,18 @@
 import javax.xml.namespace.QName;
 
 import org.testng.Assert;
+import org.testng.annotations.Listeners;
 import org.testng.annotations.Test;
 
 /*
+ * @test
  * @bug 6937964
+ * @library /javax/xml/jaxp/libs /javax/xml/jaxp/unittest
+ * @run testng/othervm -DrunSecMngr=true datatype.Bug6937964Test
+ * @run testng/othervm datatype.Bug6937964Test
  * @summary Test Duration is normalized.
  */
+@Listeners({jaxp.library.BasePolicy.class})
 public class Bug6937964Test {
     /**
      * Print debugging to System.err.
@@ -264,3 +270,4 @@
 
     }
 }
+
diff --git a/jaxp/test/javax/xml/jaxp/unittest/datatype/Bug7042647Test.java b/jaxp/test/javax/xml/jaxp/unittest/datatype/Bug7042647Test.java
index 3bf98f6..f680336 100644
--- a/jaxp/test/javax/xml/jaxp/unittest/datatype/Bug7042647Test.java
+++ b/jaxp/test/javax/xml/jaxp/unittest/datatype/Bug7042647Test.java
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2014, 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2014, 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
@@ -31,12 +31,18 @@
 import javax.xml.datatype.XMLGregorianCalendar;
 
 import org.testng.Assert;
+import org.testng.annotations.Listeners;
 import org.testng.annotations.Test;
 
 /*
+ * @test
  * @bug 7042647
+ * @library /javax/xml/jaxp/libs /javax/xml/jaxp/unittest
+ * @run testng/othervm -DrunSecMngr=true datatype.Bug7042647Test
+ * @run testng/othervm datatype.Bug7042647Test
  * @summary Test getFirstDayOfWeek is correct after converting XMLGregorianCalendar to a GregorianCalendar.
  */
+@Listeners({jaxp.library.BasePolicy.class})
 public class Bug7042647Test {
 
     @Test
@@ -54,3 +60,4 @@
     }
 
 }
+
diff --git a/jaxp/test/javax/xml/jaxp/unittest/datatype/DatatypeFactoryTest.java b/jaxp/test/javax/xml/jaxp/unittest/datatype/DatatypeFactoryTest.java
index c6977e9..6ca2985 100644
--- a/jaxp/test/javax/xml/jaxp/unittest/datatype/DatatypeFactoryTest.java
+++ b/jaxp/test/javax/xml/jaxp/unittest/datatype/DatatypeFactoryTest.java
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2014, 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2014, 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,11 +34,17 @@
 import javax.xml.namespace.QName;
 
 import org.testng.Assert;
+import org.testng.annotations.Listeners;
 import org.testng.annotations.Test;
 
 /*
+ * @test
+ * @library /javax/xml/jaxp/libs /javax/xml/jaxp/unittest
+ * @run testng/othervm -DrunSecMngr=true datatype.DatatypeFactoryTest
+ * @run testng/othervm datatype.DatatypeFactoryTest
  * @summary Test DatatypeFactory.
  */
+@Listeners({jaxp.library.BasePolicy.class})
 public class DatatypeFactoryTest {
 
     private static final boolean DEBUG = false;
@@ -634,3 +640,4 @@
         }
     }
 }
+
diff --git a/jaxp/test/javax/xml/jaxp/unittest/datatype/DurationTest.java b/jaxp/test/javax/xml/jaxp/unittest/datatype/DurationTest.java
index ece77ad..7602352 100644
--- a/jaxp/test/javax/xml/jaxp/unittest/datatype/DurationTest.java
+++ b/jaxp/test/javax/xml/jaxp/unittest/datatype/DurationTest.java
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2014, 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2014, 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
@@ -39,11 +39,17 @@
 import org.testng.Assert;
 import org.testng.AssertJUnit;
 import org.testng.annotations.BeforeMethod;
+import org.testng.annotations.Listeners;
 import org.testng.annotations.Test;
 
 /*
+ * @test
+ * @library /javax/xml/jaxp/libs /javax/xml/jaxp/unittest
+ * @run testng/othervm -DrunSecMngr=true datatype.DurationTest
+ * @run testng/othervm datatype.DurationTest
  * @summary Test Duration.
  */
+@Listeners({jaxp.library.BasePolicy.class})
 public class DurationTest {
 
     private final static boolean DEBUG = true;
@@ -51,7 +57,7 @@
     protected Duration duration = null;
 
     @BeforeMethod
-    protected void setUp() {
+    public void setUp() {
         try {
             duration = DatatypeFactory.newInstance().newDuration(100);
         } catch (DatatypeConfigurationException dce) {
@@ -478,3 +484,4 @@
 
     }
 }
+
diff --git a/jaxp/test/javax/xml/jaxp/unittest/datatype/FactoryFindTest.java b/jaxp/test/javax/xml/jaxp/unittest/datatype/FactoryFindTest.java
index 87e4637..915a63c 100644
--- a/jaxp/test/javax/xml/jaxp/unittest/datatype/FactoryFindTest.java
+++ b/jaxp/test/javax/xml/jaxp/unittest/datatype/FactoryFindTest.java
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2014, 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2014, 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
@@ -23,45 +23,45 @@
 
 package datatype;
 
+import static jaxp.library.JAXPTestUtilities.runWithAllPerm;
+
 import java.net.URL;
 import java.net.URLClassLoader;
 
 import javax.xml.datatype.DatatypeFactory;
 
 import org.testng.Assert;
+import org.testng.annotations.Listeners;
 import org.testng.annotations.Test;
 
 /*
+ * @test
+ * @library /javax/xml/jaxp/libs /javax/xml/jaxp/unittest
+ * @run testng/othervm -DrunSecMngr=true datatype.FactoryFindTest
+ * @run testng/othervm datatype.FactoryFindTest
  * @summary Test Classloader for DatatypeFactory.
  */
+@Listeners({jaxp.library.BasePolicy.class})
 public class FactoryFindTest {
 
     boolean myClassLoaderUsed = false;
 
-    public FactoryFindTest(String name) {
-    }
-
     @Test
-    public void testFactoryFind() {
-        try {
-            // System.setProperty("jaxp.debug", "true");
+    public void testFactoryFind() throws Exception {
+        DatatypeFactory factory = DatatypeFactory.newInstance();
+        Assert.assertTrue(factory.getClass().getClassLoader() == null);
 
-            DatatypeFactory factory = DatatypeFactory.newInstance();
-            Assert.assertTrue(factory.getClass().getClassLoader() == null);
+        runWithAllPerm(() -> Thread.currentThread().setContextClassLoader(null));
 
-            Thread.currentThread().setContextClassLoader(null);
-            factory = DatatypeFactory.newInstance();
-            Assert.assertTrue(factory.getClass().getClassLoader() == null);
+        factory = DatatypeFactory.newInstance();
+        Assert.assertTrue(factory.getClass().getClassLoader() == null);
 
-            Thread.currentThread().setContextClassLoader(new MyClassLoader());
-            factory = DatatypeFactory.newInstance();
-            if (System.getSecurityManager() == null)
-                Assert.assertTrue(myClassLoaderUsed);
-            else
-                Assert.assertFalse(myClassLoaderUsed);
-        } catch (Exception ex) {
-        }
-
+        runWithAllPerm(() -> Thread.currentThread().setContextClassLoader(new MyClassLoader()));
+        factory = DatatypeFactory.newInstance();
+        if (System.getSecurityManager() == null)
+            Assert.assertTrue(myClassLoaderUsed);
+        else
+            Assert.assertFalse(myClassLoaderUsed);
     }
 
     class MyClassLoader extends URLClassLoader {
@@ -76,3 +76,4 @@
         }
     }
 }
+
diff --git a/jaxp/test/javax/xml/jaxp/unittest/datatype/JDK8068839Test.java b/jaxp/test/javax/xml/jaxp/unittest/datatype/JDK8068839Test.java
index 636cf68..dd0720d 100644
--- a/jaxp/test/javax/xml/jaxp/unittest/datatype/JDK8068839Test.java
+++ b/jaxp/test/javax/xml/jaxp/unittest/datatype/JDK8068839Test.java
@@ -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,12 +27,18 @@
 import javax.xml.datatype.Duration;
 
 import org.testng.Assert;
+import org.testng.annotations.Listeners;
 import org.testng.annotations.Test;
 
 /*
+ * @test
  * @bug 8068839
+ * @library /javax/xml/jaxp/libs /javax/xml/jaxp/unittest
+ * @run testng/othervm -DrunSecMngr=true datatype.JDK8068839Test
+ * @run testng/othervm datatype.JDK8068839Test
  * @summary Verifies that Duration's edge cases
  */
+@Listeners({jaxp.library.BasePolicy.class})
 public class JDK8068839Test {
 
     @Test
@@ -45,3 +51,4 @@
     }
 
 }
+
diff --git a/jaxp/test/javax/xml/jaxp/unittest/datatype/XMLGregorianCalendarTest.java b/jaxp/test/javax/xml/jaxp/unittest/datatype/XMLGregorianCalendarTest.java
index 4c3deb9..89c5fc6 100644
--- a/jaxp/test/javax/xml/jaxp/unittest/datatype/XMLGregorianCalendarTest.java
+++ b/jaxp/test/javax/xml/jaxp/unittest/datatype/XMLGregorianCalendarTest.java
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2014, 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2014, 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,11 +30,17 @@
 
 import org.testng.Assert;
 import org.testng.annotations.BeforeMethod;
+import org.testng.annotations.Listeners;
 import org.testng.annotations.Test;
 
 /*
+ * @test
+ * @library /javax/xml/jaxp/libs /javax/xml/jaxp/unittest
+ * @run testng/othervm -DrunSecMngr=true datatype.XMLGregorianCalendarTest
+ * @run testng/othervm datatype.XMLGregorianCalendarTest
  * @summary Test XMLGregorianCalendar.
  */
+@Listeners({jaxp.library.BasePolicy.class})
 public class XMLGregorianCalendarTest {
 
     private static final boolean DEBUG = false;
@@ -46,7 +52,7 @@
     private XMLGregorianCalendar calendar;
 
     @BeforeMethod
-    protected void setUp() {
+    public void setUp() {
         try {
             calendar = DatatypeFactory.newInstance().newXMLGregorianCalendar();
         } catch (DatatypeConfigurationException dce) {
@@ -222,3 +228,4 @@
         }
     }
 }
+
diff --git a/jaxp/test/javax/xml/jaxp/unittest/dom/Bug4915524.java b/jaxp/test/javax/xml/jaxp/unittest/dom/Bug4915524.java
index 3540089..791146e 100644
--- a/jaxp/test/javax/xml/jaxp/unittest/dom/Bug4915524.java
+++ b/jaxp/test/javax/xml/jaxp/unittest/dom/Bug4915524.java
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2014, 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2014, 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
@@ -29,16 +29,22 @@
 import javax.xml.parsers.DocumentBuilderFactory;
 
 import org.testng.Assert;
+import org.testng.annotations.Listeners;
 import org.testng.annotations.Test;
 import org.w3c.dom.Document;
 import org.w3c.dom.Node;
 import org.xml.sax.InputSource;
 
 /*
+ * @test
  * @bug 4915524
+ * @library /javax/xml/jaxp/libs /javax/xml/jaxp/unittest
+ * @run testng/othervm -DrunSecMngr=true dom.Bug4915524
+ * @run testng/othervm dom.Bug4915524
  * @summary Test Document.adoptNode() shall not throw Exception when the source document object is created from different implementation.
  */
 
+@Listeners({jaxp.library.BasePolicy.class})
 public class Bug4915524 {
 
     String data = "<?xml version=\"1.0\" ?>" + "<!DOCTYPE root [" + "<!ELEMENT root ANY>" + "<!ATTLIST root attr1 ID #FIXED 'xxx'"
@@ -75,3 +81,4 @@
         return docBuilder.parse(source);
     }
 }
+
diff --git a/jaxp/test/javax/xml/jaxp/unittest/dom/Bug4915748.java b/jaxp/test/javax/xml/jaxp/unittest/dom/Bug4915748.java
index 8c8f717..e2186da 100644
--- a/jaxp/test/javax/xml/jaxp/unittest/dom/Bug4915748.java
+++ b/jaxp/test/javax/xml/jaxp/unittest/dom/Bug4915748.java
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2014, 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2014, 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,6 +27,7 @@
 import javax.xml.parsers.DocumentBuilderFactory;
 
 import org.testng.Assert;
+import org.testng.annotations.Listeners;
 import org.testng.annotations.Test;
 import org.w3c.dom.CDATASection;
 import org.w3c.dom.DOMConfiguration;
@@ -35,9 +36,14 @@
 import org.w3c.dom.Document;
 
 /*
+ * @test
  * @bug 4915748
+ * @library /javax/xml/jaxp/libs /javax/xml/jaxp/unittest
+ * @run testng/othervm -DrunSecMngr=true dom.Bug4915748
+ * @run testng/othervm dom.Bug4915748
  * @summary Test DOMErrorHandler is called in case CDATA section is split by termination marker ']]>'.
  */
+@Listeners({jaxp.library.BasePolicy.class})
 public class Bug4915748 {
 
     @Test
@@ -68,3 +74,4 @@
         Assert.assertTrue(hadError[0]);
     }
 }
+
diff --git a/jaxp/test/javax/xml/jaxp/unittest/dom/Bug4966082.java b/jaxp/test/javax/xml/jaxp/unittest/dom/Bug4966082.java
index b18f809..b24e9d5 100644
--- a/jaxp/test/javax/xml/jaxp/unittest/dom/Bug4966082.java
+++ b/jaxp/test/javax/xml/jaxp/unittest/dom/Bug4966082.java
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2014, 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2014, 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,13 +26,19 @@
 import javax.xml.parsers.DocumentBuilderFactory;
 
 import org.testng.Assert;
+import org.testng.annotations.Listeners;
 import org.testng.annotations.Test;
 import org.w3c.dom.Document;
 
 /*
+ * @test
  * @bug 4966082
+ * @library /javax/xml/jaxp/libs /javax/xml/jaxp/unittest
+ * @run testng/othervm -DrunSecMngr=true dom.Bug4966082
+ * @run testng/othervm dom.Bug4966082
  * @summary Test Element.getSchemaTypeInfo() returns an instance of TypeInfo instead of null when the document's schema is an XML DTD.
  */
+@Listeners({jaxp.library.FilePolicy.class})
 public class Bug4966082 {
 
     @Test
@@ -47,3 +53,4 @@
         }
     }
 }
+
diff --git a/jaxp/test/javax/xml/jaxp/unittest/dom/Bug4966138.java b/jaxp/test/javax/xml/jaxp/unittest/dom/Bug4966138.java
index 5244112..43f1e1a 100644
--- a/jaxp/test/javax/xml/jaxp/unittest/dom/Bug4966138.java
+++ b/jaxp/test/javax/xml/jaxp/unittest/dom/Bug4966138.java
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2014, 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2014, 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,20 @@
 import javax.xml.parsers.DocumentBuilderFactory;
 
 import org.testng.Assert;
+import org.testng.annotations.Listeners;
 import org.testng.annotations.Test;
 import org.w3c.dom.Document;
 import org.w3c.dom.TypeInfo;
 
 /*
+ * @test
  * @bug 4966138
+ * @library /javax/xml/jaxp/libs /javax/xml/jaxp/unittest
+ * @run testng/othervm -DrunSecMngr=true dom.Bug4966138
+ * @run testng/othervm dom.Bug4966138
  * @summary Test Element's TypeInfo.getTypeName() returns a name instead of null in case the element is declared using anonymous simple type.
  */
+@Listeners({jaxp.library.FilePolicy.class})
 public class Bug4966138 {
 
     static final String SCHEMA_LANGUAGE = "http://java.sun.com/xml/jaxp/properties/schemaLanguage";
@@ -63,3 +69,4 @@
         Assert.assertTrue(typeNs.length() != 0, "returned typeNamespace shouldn't be empty");
     }
 }
+
diff --git a/jaxp/test/javax/xml/jaxp/unittest/dom/Bug4966142.java b/jaxp/test/javax/xml/jaxp/unittest/dom/Bug4966142.java
index 890ada5..5bd158e 100644
--- a/jaxp/test/javax/xml/jaxp/unittest/dom/Bug4966142.java
+++ b/jaxp/test/javax/xml/jaxp/unittest/dom/Bug4966142.java
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2014, 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2014, 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,20 @@
 import javax.xml.parsers.DocumentBuilderFactory;
 
 import org.testng.Assert;
+import org.testng.annotations.Listeners;
 import org.testng.annotations.Test;
 import org.w3c.dom.Document;
 import org.w3c.dom.TypeInfo;
 
 /*
+ * @test
  * @bug 4966142
+ * @library /javax/xml/jaxp/libs /javax/xml/jaxp/unittest
+ * @run testng/othervm -DrunSecMngr=true dom.Bug4966142
+ * @run testng/othervm dom.Bug4966142
  * @summary Test TypeInfo.isDerivedFrom(...) works instead of throws UnsupportedOperationException when the TypeInfo instance refers to a simple type.
  */
+@Listeners({jaxp.library.FilePolicy.class})
 public class Bug4966142 {
 
     static final String SCHEMA_LANGUAGE = "http://java.sun.com/xml/jaxp/properties/schemaLanguage";
@@ -55,3 +61,4 @@
         Assert.assertFalse(type.isDerivedFrom("testNS", "Test", TypeInfo.DERIVATION_UNION));
     }
 }
+
diff --git a/jaxp/test/javax/xml/jaxp/unittest/dom/Bug4966143.java b/jaxp/test/javax/xml/jaxp/unittest/dom/Bug4966143.java
index 9cf87b2..1cdbb46 100644
--- a/jaxp/test/javax/xml/jaxp/unittest/dom/Bug4966143.java
+++ b/jaxp/test/javax/xml/jaxp/unittest/dom/Bug4966143.java
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2014, 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2014, 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,15 +27,21 @@
 import javax.xml.parsers.DocumentBuilderFactory;
 
 import org.testng.Assert;
+import org.testng.annotations.Listeners;
 import org.testng.annotations.Test;
 import org.w3c.dom.Document;
 import org.w3c.dom.TypeInfo;
 
 /*
+ * @test
  * @bug 4966143
+ * @library /javax/xml/jaxp/libs /javax/xml/jaxp/unittest
+ * @run testng/othervm -DrunSecMngr=true dom.Bug4966143
+ * @run testng/othervm dom.Bug4966143
  * @summary Test isDerivedFrom(...) returns true only if the parameter is DERIVATION_EXTENSION,
  * in case TypeInfo instance refers to a complex type derived from another complex type by extension.
  */
+@Listeners({jaxp.library.FilePolicy.class})
 public class Bug4966143 {
 
     static final String SCHEMA_LANGUAGE = "http://java.sun.com/xml/jaxp/properties/schemaLanguage";
@@ -60,3 +66,4 @@
         Assert.assertTrue(type.isDerivedFrom("testNS", "Test", 0));
     }
 }
+
diff --git a/jaxp/test/javax/xml/jaxp/unittest/dom/Bug6339023.java b/jaxp/test/javax/xml/jaxp/unittest/dom/Bug6339023.java
index 7b611bd..df2eaf3 100644
--- a/jaxp/test/javax/xml/jaxp/unittest/dom/Bug6339023.java
+++ b/jaxp/test/javax/xml/jaxp/unittest/dom/Bug6339023.java
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2014, 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2014, 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,6 +27,7 @@
 import javax.xml.parsers.DocumentBuilderFactory;
 
 import org.testng.Assert;
+import org.testng.annotations.Listeners;
 import org.testng.annotations.Test;
 import org.w3c.dom.DOMConfiguration;
 import org.w3c.dom.DOMImplementation;
@@ -36,9 +37,14 @@
 import org.w3c.dom.ls.LSSerializer;
 
 /*
+ * @test
  * @bug 6339023
+ * @library /javax/xml/jaxp/libs /javax/xml/jaxp/unittest
+ * @run testng/othervm -DrunSecMngr=true dom.Bug6339023
+ * @run testng/othervm dom.Bug6339023
  * @summary Test normalize-characters.
  */
+@Listeners({jaxp.library.BasePolicy.class})
 public class Bug6339023 {
 
     /*
@@ -133,3 +139,4 @@
     }
 
 }
+
diff --git a/jaxp/test/javax/xml/jaxp/unittest/dom/Bug6355326.java b/jaxp/test/javax/xml/jaxp/unittest/dom/Bug6355326.java
index cea41cc..d265669 100644
--- a/jaxp/test/javax/xml/jaxp/unittest/dom/Bug6355326.java
+++ b/jaxp/test/javax/xml/jaxp/unittest/dom/Bug6355326.java
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2014, 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2014, 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,6 +34,7 @@
 
 import org.testng.Assert;
 import org.testng.annotations.BeforeMethod;
+import org.testng.annotations.Listeners;
 import org.testng.annotations.Test;
 import org.w3c.dom.DOMImplementation;
 import org.w3c.dom.Document;
@@ -43,16 +44,21 @@
 import org.xml.sax.SAXException;
 
 /*
+ * @test
  * @bug 6355326
+ * @library /javax/xml/jaxp/libs /javax/xml/jaxp/unittest
+ * @run testng/othervm -DrunSecMngr=true dom.Bug6355326
+ * @run testng/othervm dom.Bug6355326
  * @summary Test DOM implementation encoding.
  */
+@Listeners({jaxp.library.BasePolicy.class})
 public class Bug6355326 {
 
     DOMImplementationLS implLS = null;
     String encodingXML = "<?xml version=\"1.0\" encoding=\"UTF-8\"?><encodingXML/>";
 
     @BeforeMethod
-    protected void setUp() {
+    public void setUp() {
         Document doc = null;
         DocumentBuilder parser = null;
         String xml1 = "<?xml version=\"1.0\"?><ROOT></ROOT>";
@@ -112,3 +118,4 @@
         return p;
     }
 }
+
diff --git a/jaxp/test/javax/xml/jaxp/unittest/dom/Bug6367542.java b/jaxp/test/javax/xml/jaxp/unittest/dom/Bug6367542.java
index c0a3e16..b1ce0a1 100644
--- a/jaxp/test/javax/xml/jaxp/unittest/dom/Bug6367542.java
+++ b/jaxp/test/javax/xml/jaxp/unittest/dom/Bug6367542.java
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2014, 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2014, 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
@@ -24,14 +24,20 @@
 package dom;
 
 import org.testng.Assert;
+import org.testng.annotations.Listeners;
 import org.testng.annotations.Test;
 import org.w3c.dom.DOMImplementation;
 import org.w3c.dom.bootstrap.DOMImplementationRegistry;
 
 /*
+ * @test
  * @bug 6367542
+ * @library /javax/xml/jaxp/libs /javax/xml/jaxp/unittest
+ * @run testng/othervm -DrunSecMngr=true dom.Bug6367542
+ * @run testng/othervm dom.Bug6367542
  * @summary Test DOMImplementationRegistry.getDOMImplementation("XML") returns a DOMImplementation instance.
  */
+@Listeners({jaxp.library.BasePolicy.class})
 public class Bug6367542 {
 
     @Test
@@ -46,3 +52,4 @@
         }
     }
 }
+
diff --git a/jaxp/test/javax/xml/jaxp/unittest/dom/Bug6520131.java b/jaxp/test/javax/xml/jaxp/unittest/dom/Bug6520131.java
index 982d481..b1381c0 100644
--- a/jaxp/test/javax/xml/jaxp/unittest/dom/Bug6520131.java
+++ b/jaxp/test/javax/xml/jaxp/unittest/dom/Bug6520131.java
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2014, 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2014, 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
@@ -28,6 +28,7 @@
 import javax.xml.parsers.ParserConfigurationException;
 
 import org.testng.Assert;
+import org.testng.annotations.Listeners;
 import org.testng.annotations.Test;
 import org.w3c.dom.DOMConfiguration;
 import org.w3c.dom.DOMError;
@@ -37,9 +38,14 @@
 import org.w3c.dom.Text;
 
 /*
+ * @test
  * @bug 6520131
+ * @library /javax/xml/jaxp/libs /javax/xml/jaxp/unittest
+ * @run testng/othervm -DrunSecMngr=true dom.Bug6520131
+ * @run testng/othervm dom.Bug6520131
  * @summary Test DOMErrorHandler reports an error for invalid character.
  */
+@Listeners({jaxp.library.BasePolicy.class})
 public class Bug6520131 {
 
     @Test
@@ -77,3 +83,4 @@
         }
     }
 }
+
diff --git a/jaxp/test/javax/xml/jaxp/unittest/dom/Bug6521260.java b/jaxp/test/javax/xml/jaxp/unittest/dom/Bug6521260.java
index 3c9a9764..300bde2 100644
--- a/jaxp/test/javax/xml/jaxp/unittest/dom/Bug6521260.java
+++ b/jaxp/test/javax/xml/jaxp/unittest/dom/Bug6521260.java
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2014, 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2014, 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
@@ -31,15 +31,21 @@
 import javax.xml.parsers.ParserConfigurationException;
 
 import org.testng.Assert;
+import org.testng.annotations.Listeners;
 import org.testng.annotations.Test;
 import org.w3c.dom.Document;
 import org.w3c.dom.Element;
 import org.xml.sax.SAXException;
 
 /*
+ * @test
  * @bug 6521260
+ * @library /javax/xml/jaxp/libs /javax/xml/jaxp/unittest
+ * @run testng/othervm -DrunSecMngr=true dom.Bug6521260
+ * @run testng/othervm dom.Bug6521260
  * @summary Test setAttributeNS doesn't result in an unsorted internal list of attributes.
  */
+@Listeners({jaxp.library.BasePolicy.class})
 public class Bug6521260 {
 
     @Test
@@ -71,3 +77,4 @@
         Assert.assertEquals(systemId, systemId2);
     }
 }
+
diff --git a/jaxp/test/javax/xml/jaxp/unittest/dom/Bug6582545Test.java b/jaxp/test/javax/xml/jaxp/unittest/dom/Bug6582545Test.java
index fec67cd..9108af3 100644
--- a/jaxp/test/javax/xml/jaxp/unittest/dom/Bug6582545Test.java
+++ b/jaxp/test/javax/xml/jaxp/unittest/dom/Bug6582545Test.java
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2014, 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2014, 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
@@ -23,6 +23,8 @@
 
 package dom;
 
+import static jaxp.library.JAXPTestUtilities.getSystemProperty;
+
 import java.io.File;
 import java.io.IOException;
 
@@ -30,7 +32,10 @@
 import javax.xml.parsers.DocumentBuilderFactory;
 import javax.xml.parsers.ParserConfigurationException;
 
+import jaxp.library.JAXPTestUtilities;
+
 import org.testng.Assert;
+import org.testng.annotations.Listeners;
 import org.testng.annotations.Test;
 import org.w3c.dom.Document;
 import org.w3c.dom.NamedNodeMap;
@@ -38,9 +43,14 @@
 import org.xml.sax.SAXException;
 
 /*
+ * @test
  * @bug 6582545
+ * @library /javax/xml/jaxp/libs /javax/xml/jaxp/unittest
+ * @run testng/othervm -DrunSecMngr=true dom.Bug6582545Test
+ * @run testng/othervm dom.Bug6582545Test
  * @summary Test the value is correct when iterating attributes.
  */
+@Listeners({jaxp.library.FilePolicy.class})
 public class Bug6582545Test {
     private DocumentBuilder xmlParser = null;
     private Document document = null;
@@ -90,7 +100,7 @@
         }
 
         // Test specifique a node
-        String javaSpecificationVersion = System.getProperty("java.specification.version");
+        String javaSpecificationVersion = getSystemProperty("java.specification.version");
         for (int k = 0; k < attributes.getLength(); k++) {
             name = attributes.item(k).getNodeName();
             value = attributes.item(k).getNodeValue();
@@ -113,3 +123,4 @@
     }
 
 }
+
diff --git a/jaxp/test/javax/xml/jaxp/unittest/dom/Bug6879614Test.java b/jaxp/test/javax/xml/jaxp/unittest/dom/Bug6879614Test.java
index b19a28b..ff5cf2c 100644
--- a/jaxp/test/javax/xml/jaxp/unittest/dom/Bug6879614Test.java
+++ b/jaxp/test/javax/xml/jaxp/unittest/dom/Bug6879614Test.java
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2014, 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2014, 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,14 +30,20 @@
 import javax.xml.parsers.DocumentBuilderFactory;
 import javax.xml.parsers.ParserConfigurationException;
 
+import org.testng.annotations.Listeners;
 import org.testng.annotations.Test;
 import org.w3c.dom.Document;
 import org.xml.sax.SAXException;
 
 /*
+ * @test
  * @bug 6879614
+ * @library /javax/xml/jaxp/libs /javax/xml/jaxp/unittest
+ * @run testng/othervm -DrunSecMngr=true dom.Bug6879614Test
+ * @run testng/othervm dom.Bug6879614Test
  * @summary Test DocumentBuilder can parse the certain xml.
  */
+@Listeners({jaxp.library.FilePolicy.class})
 public class Bug6879614Test {
 
     @Test
@@ -72,3 +78,4 @@
         }
     }
 }
+
diff --git a/jaxp/test/javax/xml/jaxp/unittest/dom/CR6333993Test.java b/jaxp/test/javax/xml/jaxp/unittest/dom/CR6333993Test.java
index 84c06b8..f407e26 100644
--- a/jaxp/test/javax/xml/jaxp/unittest/dom/CR6333993Test.java
+++ b/jaxp/test/javax/xml/jaxp/unittest/dom/CR6333993Test.java
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2014, 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2014, 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
@@ -33,14 +33,20 @@
 import javax.xml.xpath.XPathFactory;
 
 import org.testng.Assert;
+import org.testng.annotations.Listeners;
 import org.testng.annotations.Test;
 import org.w3c.dom.Document;
 import org.w3c.dom.NodeList;
 
 /*
+ * @test
  * @bug 6333993
+ * @library /javax/xml/jaxp/libs /javax/xml/jaxp/unittest
+ * @run testng/othervm -DrunSecMngr=true dom.CR6333993Test
+ * @run testng/othervm dom.CR6333993Test
  * @summary Test NodeList.item(valid index) returns value after NodeList.item(NodeList.getLength()).
  */
+@Listeners({jaxp.library.BasePolicy.class})
 public class CR6333993Test {
 
     @Test
@@ -82,3 +88,4 @@
     }
 
 }
+
diff --git a/jaxp/test/javax/xml/jaxp/unittest/dom/CR6517707Test.java b/jaxp/test/javax/xml/jaxp/unittest/dom/CR6517707Test.java
index 9bc2c6c..c8ee54a 100644
--- a/jaxp/test/javax/xml/jaxp/unittest/dom/CR6517707Test.java
+++ b/jaxp/test/javax/xml/jaxp/unittest/dom/CR6517707Test.java
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2014, 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2014, 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
@@ -32,6 +32,7 @@
 import javax.xml.parsers.ParserConfigurationException;
 
 import org.testng.Assert;
+import org.testng.annotations.Listeners;
 import org.testng.annotations.Test;
 import org.w3c.dom.DOMException;
 import org.w3c.dom.Document;
@@ -40,9 +41,14 @@
 import org.xml.sax.SAXException;
 
 /*
+ * @test
  * @bug 6517707
+ * @library /javax/xml/jaxp/libs /javax/xml/jaxp/unittest
+ * @run testng/othervm -DrunSecMngr=true dom.CR6517707Test
+ * @run testng/othervm dom.CR6517707Test
  * @summary Test Node.setNodeValue(value) shall throw DOMException.NO_MODIFICATION_ALLOWED_ERR if the node is read-only.
  */
+@Listeners({jaxp.library.BasePolicy.class})
 public class CR6517707Test {
 
     @Test
@@ -122,3 +128,4 @@
     }
 
 }
+
diff --git a/jaxp/test/javax/xml/jaxp/unittest/dom/CR6517717Test.java b/jaxp/test/javax/xml/jaxp/unittest/dom/CR6517717Test.java
index 44bab9c..0b5d2e6 100644
--- a/jaxp/test/javax/xml/jaxp/unittest/dom/CR6517717Test.java
+++ b/jaxp/test/javax/xml/jaxp/unittest/dom/CR6517717Test.java
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2014, 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2014, 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
@@ -31,6 +31,7 @@
 import javax.xml.parsers.ParserConfigurationException;
 
 import org.testng.Assert;
+import org.testng.annotations.Listeners;
 import org.testng.annotations.Test;
 import org.w3c.dom.DOMException;
 import org.w3c.dom.Document;
@@ -39,9 +40,14 @@
 import org.xml.sax.SAXException;
 
 /*
+ * @test
  * @bug 6517717
+ * @library /javax/xml/jaxp/libs /javax/xml/jaxp/unittest
+ * @run testng/othervm -DrunSecMngr=true dom.CR6517717Test
+ * @run testng/othervm dom.CR6517717Test
  * @summary Test Node.setPrefix(prefix) shall throw DOMException.NO_MODIFICATION_ALLOWED_ERR if the node is read-only.
  */
+@Listeners({jaxp.library.BasePolicy.class})
 public class CR6517717Test {
 
     @Test
@@ -80,3 +86,4 @@
 
     }
 }
+
diff --git a/jaxp/test/javax/xml/jaxp/unittest/dom/CR6909336Test.java b/jaxp/test/javax/xml/jaxp/unittest/dom/CR6909336Test.java
index 15dc963..4b46cf9 100644
--- a/jaxp/test/javax/xml/jaxp/unittest/dom/CR6909336Test.java
+++ b/jaxp/test/javax/xml/jaxp/unittest/dom/CR6909336Test.java
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2014, 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2014, 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
@@ -29,14 +29,20 @@
 import javax.xml.transform.dom.DOMResult;
 
 import org.testng.Assert;
+import org.testng.annotations.Listeners;
 import org.testng.annotations.Test;
 import org.w3c.dom.Document;
 import org.w3c.dom.bootstrap.DOMImplementationRegistry;
 
 /*
+ * @test
  * @bug 6909336
+ * @library /javax/xml/jaxp/libs /javax/xml/jaxp/unittest
+ * @run testng/othervm -DrunSecMngr=true dom.CR6909336Test
+ * @run testng/othervm dom.CR6909336Test
  * @summary Test DOM writer can write more that 20 nested elements.
  */
+@Listeners({jaxp.library.BasePolicy.class})
 public class CR6909336Test {
 
     @Test
@@ -66,3 +72,4 @@
     }
 
 }
+
diff --git a/jaxp/test/javax/xml/jaxp/unittest/dom/DOMConfigurationTest.java b/jaxp/test/javax/xml/jaxp/unittest/dom/DOMConfigurationTest.java
index 0bc4669..b434155 100644
--- a/jaxp/test/javax/xml/jaxp/unittest/dom/DOMConfigurationTest.java
+++ b/jaxp/test/javax/xml/jaxp/unittest/dom/DOMConfigurationTest.java
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2014, 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2014, 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
@@ -33,6 +33,7 @@
 import javax.xml.parsers.ParserConfigurationException;
 
 import org.testng.Assert;
+import org.testng.annotations.Listeners;
 import org.testng.annotations.Test;
 import org.w3c.dom.Attr;
 import org.w3c.dom.CDATASection;
@@ -56,8 +57,13 @@
 import org.xml.sax.SAXException;
 
 /*
+ * @test
+ * @library /javax/xml/jaxp/libs /javax/xml/jaxp/unittest
+ * @run testng/othervm -DrunSecMngr=true dom.DOMConfigurationTest
+ * @run testng/othervm dom.DOMConfigurationTest
  * @summary Test DOMConfiguration for supported properties.
  */
+@Listeners({jaxp.library.FilePolicy.class})
 public class DOMConfigurationTest {
 
     static class TestHandler implements DOMErrorHandler {
@@ -1622,3 +1628,4 @@
 
     }
 }
+
diff --git a/jaxp/test/javax/xml/jaxp/unittest/dom/DOMXPathTest.java b/jaxp/test/javax/xml/jaxp/unittest/dom/DOMXPathTest.java
index ebd97fa..672c38e 100644
--- a/jaxp/test/javax/xml/jaxp/unittest/dom/DOMXPathTest.java
+++ b/jaxp/test/javax/xml/jaxp/unittest/dom/DOMXPathTest.java
@@ -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
@@ -26,13 +26,19 @@
 import javax.xml.parsers.ParserConfigurationException;
 
 import org.testng.Assert;
+import org.testng.annotations.Listeners;
 import org.testng.annotations.Test;
 import org.w3c.dom.DOMImplementation;
 
 /*
+ * @test
  * @bug 8042244
+ * @library /javax/xml/jaxp/libs /javax/xml/jaxp/unittest
+ * @run testng/othervm -DrunSecMngr=true dom.DOMXPathTest
+ * @run testng/othervm dom.DOMXPathTest
  * @summary Verifies that the experimental DOM L3 XPath implementation is no longer available.
  */
+@Listeners({jaxp.library.BasePolicy.class})
 public class DOMXPathTest {
     /*
        Verifies that DOMImplementation::hasFeature returns false and getFeature
@@ -48,3 +54,4 @@
         Assert.assertEquals(domImpl.getFeature("+XPath", "3.0"), null);
     }
 }
+
diff --git a/jaxp/test/javax/xml/jaxp/unittest/dom/ElementTraversal.java b/jaxp/test/javax/xml/jaxp/unittest/dom/ElementTraversal.java
index 9227e8f..ef87815 100644
--- a/jaxp/test/javax/xml/jaxp/unittest/dom/ElementTraversal.java
+++ b/jaxp/test/javax/xml/jaxp/unittest/dom/ElementTraversal.java
@@ -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
@@ -29,6 +29,7 @@
 import javax.xml.parsers.ParserConfigurationException;
 import org.testng.Assert;
 import org.testng.annotations.DataProvider;
+import org.testng.annotations.Listeners;
 import org.testng.annotations.Test;
 import org.w3c.dom.Document;
 import org.w3c.dom.DOMImplementation;
@@ -36,10 +37,15 @@
 import org.xml.sax.SAXException;
 
 /*
+ * @test
  * @bug 8135283 8138721
+ * @library /javax/xml/jaxp/libs /javax/xml/jaxp/unittest
+ * @run testng/othervm -DrunSecMngr=true dom.ElementTraversal
+ * @run testng/othervm dom.ElementTraversal
  * @summary Tests for the Element Traversal interface.
  */
 
+@Listeners({jaxp.library.FilePolicy.class})
 public class ElementTraversal {
     /*
        Verifies that ElementTraversal is supported.
@@ -111,7 +117,7 @@
      * DataProvider: a Document object
      */
     @DataProvider(name = "doc")
-    Object[][] getXPath() {
+    public Object[][] getXPath() {
         return new Object[][]{{getDoc()}};
     }
     Document getDoc() {
@@ -129,3 +135,4 @@
         return doc;
     }
 }
+
diff --git a/jaxp/test/javax/xml/jaxp/unittest/dom/JdkXmlDomTest.java b/jaxp/test/javax/xml/jaxp/unittest/dom/JdkXmlDomTest.java
index 4c1269c..1952343 100644
--- a/jaxp/test/javax/xml/jaxp/unittest/dom/JdkXmlDomTest.java
+++ b/jaxp/test/javax/xml/jaxp/unittest/dom/JdkXmlDomTest.java
@@ -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
@@ -22,19 +22,28 @@
  */
 package dom;
 
+import static jaxp.library.JAXPTestUtilities.runWithAllPerm;
+
 import org.testng.Assert;
+import org.testng.annotations.Listeners;
 import org.testng.annotations.Test;
 
 /*
+ * @test
  * @bug 8078139
+ * @library /javax/xml/jaxp/libs /javax/xml/jaxp/unittest
+ * @run testng/othervm -DrunSecMngr=true dom.JdkXmlDomTest
+ * @run testng/othervm dom.JdkXmlDomTest
  * @summary Verifies that jdk.xml.dom classes are loaded by the ext class loader.
  */
+@Listeners({jaxp.library.BasePolicy.class})
 public class JdkXmlDomTest {
     @Test
     public void test() throws ClassNotFoundException {
-        ClassLoader cl = ClassLoader.getSystemClassLoader().getParent();
+        ClassLoader cl = runWithAllPerm(() -> ClassLoader.getSystemClassLoader().getParent());
         Class<?> cls = Class.forName("org.w3c.dom.xpath.XPathEvaluator", false, cl);
 
-        Assert.assertTrue(cls.getClassLoader() != null);
+        Assert.assertTrue(runWithAllPerm(() -> cls.getClassLoader()) != null);
     }
 }
+
diff --git a/jaxp/test/javax/xml/jaxp/unittest/dom/TCKEncodingTest.java b/jaxp/test/javax/xml/jaxp/unittest/dom/TCKEncodingTest.java
index 4f4ece1..6dc3a24 100644
--- a/jaxp/test/javax/xml/jaxp/unittest/dom/TCKEncodingTest.java
+++ b/jaxp/test/javax/xml/jaxp/unittest/dom/TCKEncodingTest.java
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2014, 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2014, 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
@@ -31,14 +31,20 @@
 import javax.xml.parsers.ParserConfigurationException;
 
 import org.testng.Assert;
+import org.testng.annotations.Listeners;
 import org.testng.annotations.Test;
 import org.w3c.dom.Document;
 import org.xml.sax.InputSource;
 import org.xml.sax.SAXException;
 
 /*
+ * @test
+ * @library /javax/xml/jaxp/libs /javax/xml/jaxp/unittest
+ * @run testng/othervm -DrunSecMngr=true dom.TCKEncodingTest
+ * @run testng/othervm dom.TCKEncodingTest
  * @summary Test Document.getInputEncoding().
  */
+@Listeners({jaxp.library.BasePolicy.class})
 public class TCKEncodingTest {
 
     /**
@@ -96,3 +102,4 @@
         System.out.println("OK");
     }
 }
+
diff --git a/jaxp/test/javax/xml/jaxp/unittest/dom/ls/Bug4973153.java b/jaxp/test/javax/xml/jaxp/unittest/dom/ls/Bug4973153.java
index b16d06c..42d8d24 100644
--- a/jaxp/test/javax/xml/jaxp/unittest/dom/ls/Bug4973153.java
+++ b/jaxp/test/javax/xml/jaxp/unittest/dom/ls/Bug4973153.java
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2014, 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2014, 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
@@ -36,6 +36,7 @@
 import org.testng.Assert;
 import org.testng.annotations.AfterMethod;
 import org.testng.annotations.BeforeMethod;
+import org.testng.annotations.Listeners;
 import org.testng.annotations.Test;
 import org.w3c.dom.DOMError;
 import org.w3c.dom.DOMErrorHandler;
@@ -49,9 +50,14 @@
 import org.xml.sax.SAXException;
 
 /*
+ * @test
  * @bug 4973153
+ * @library /javax/xml/jaxp/libs /javax/xml/jaxp/unittest
+ * @run testng/othervm -DrunSecMngr=true dom.ls.Bug4973153
+ * @run testng/othervm dom.ls.Bug4973153
  * @summary Test LSSerialiser.setEncoding() raises 'unsupported-encoding' error if encoding is invalid.
  */
+@Listeners({jaxp.library.BasePolicy.class})
 public class Bug4973153 {
 
     DOMImplementationLS implLS = null;
@@ -94,7 +100,7 @@
     }
 
     @BeforeMethod
-    protected void setUp() {
+    public void setUp() {
         Document doc = null;
         DocumentBuilder parser = null;
         try {
@@ -116,7 +122,7 @@
     }
 
     @AfterMethod
-    protected void tearDown() {
+    public void tearDown() {
         implLS = null;
     }
 
@@ -198,3 +204,4 @@
         return true;
     }
 }
+
diff --git a/jaxp/test/javax/xml/jaxp/unittest/dom/ls/Bug6290947.java b/jaxp/test/javax/xml/jaxp/unittest/dom/ls/Bug6290947.java
index 9ef9145..f874107 100644
--- a/jaxp/test/javax/xml/jaxp/unittest/dom/ls/Bug6290947.java
+++ b/jaxp/test/javax/xml/jaxp/unittest/dom/ls/Bug6290947.java
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2014, 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2014, 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 @@
 import javax.xml.parsers.ParserConfigurationException;
 
 import org.testng.Assert;
+import org.testng.annotations.Listeners;
 import org.testng.annotations.Test;
 import org.w3c.dom.DOMConfiguration;
 import org.w3c.dom.DOMImplementation;
@@ -43,10 +44,15 @@
 import org.w3c.dom.traversal.NodeFilter;
 
 /*
+ * @test
  * @bug 6290947
+ * @library /javax/xml/jaxp/libs /javax/xml/jaxp/unittest
+ * @run testng/othervm -DrunSecMngr=true dom.ls.Bug6290947
+ * @run testng/othervm dom.ls.Bug6290947
  * @summary Test LSSerializer writes the XML declaration when LSSerializerFilter is set that rejects all nodes and
  * LSSerializer's configuration set parameter "xml-declaration" to "true".
  */
+@Listeners({jaxp.library.FilePolicy.class})
 public class Bug6290947 {
 
     private static String XML_STRING = "<?xml version=\"1.0\"?><ROOT><ELEMENT1><CHILD1/><CHILD1><COC1/></CHILD1></ELEMENT1><ELEMENT2>test1<CHILD2/></ELEMENT2></ROOT>";
@@ -141,3 +147,4 @@
         return src;
     }
 }
+
diff --git a/jaxp/test/javax/xml/jaxp/unittest/dom/ls/Bug6354955.java b/jaxp/test/javax/xml/jaxp/unittest/dom/ls/Bug6354955.java
index cdaa0cf..f693e33 100644
--- a/jaxp/test/javax/xml/jaxp/unittest/dom/ls/Bug6354955.java
+++ b/jaxp/test/javax/xml/jaxp/unittest/dom/ls/Bug6354955.java
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2014, 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2014, 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,6 +27,7 @@
 import javax.xml.parsers.DocumentBuilderFactory;
 
 import org.testng.Assert;
+import org.testng.annotations.Listeners;
 import org.testng.annotations.Test;
 import org.w3c.dom.CDATASection;
 import org.w3c.dom.Comment;
@@ -40,9 +41,14 @@
 
 
 /*
+ * @test
  * @bug 6354955
+ * @library /javax/xml/jaxp/libs /javax/xml/jaxp/unittest
+ * @run testng/othervm -DrunSecMngr=true dom.ls.Bug6354955
+ * @run testng/othervm dom.ls.Bug6354955
  * @summary Test LSSerializer can writeToString on DOM Text node with white space.
  */
+@Listeners({jaxp.library.BasePolicy.class})
 public class Bug6354955 {
 
     @Test
@@ -136,3 +142,4 @@
         return documentBuilder.newDocument();
     }
 }
+
diff --git a/jaxp/test/javax/xml/jaxp/unittest/dom/ls/Bug6376823.java b/jaxp/test/javax/xml/jaxp/unittest/dom/ls/Bug6376823.java
index d4fcc32..afd0458 100644
--- a/jaxp/test/javax/xml/jaxp/unittest/dom/ls/Bug6376823.java
+++ b/jaxp/test/javax/xml/jaxp/unittest/dom/ls/Bug6376823.java
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2014, 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2014, 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 @@
 import javax.xml.parsers.ParserConfigurationException;
 
 import org.testng.Assert;
+import org.testng.annotations.Listeners;
 import org.testng.annotations.Test;
 import org.w3c.dom.DOMConfiguration;
 import org.w3c.dom.DOMImplementation;
@@ -43,9 +44,14 @@
 import org.w3c.dom.traversal.NodeFilter;
 
 /*
+ * @test
  * @bug 6376823
+ * @library /javax/xml/jaxp/libs /javax/xml/jaxp/unittest
+ * @run testng/othervm -DrunSecMngr=true dom.ls.Bug6376823
+ * @run testng/othervm dom.ls.Bug6376823
  * @summary Test LSSerializer works.
  */
+@Listeners({jaxp.library.BasePolicy.class})
 public class Bug6376823 {
 
     private static String XML_STRING = "<?xml version=\"1.0\"?><ROOT><ELEMENT1><CHILD1/><CHILD1><COC1/></CHILD1></ELEMENT1><ELEMENT2>test1<CHILD2/></ELEMENT2></ROOT>";
@@ -115,3 +121,4 @@
         return src;
     }
 }
+
diff --git a/jaxp/test/javax/xml/jaxp/unittest/dom/ls/Bug6710741Test.java b/jaxp/test/javax/xml/jaxp/unittest/dom/ls/Bug6710741Test.java
index d0b95b9..73584b3 100644
--- a/jaxp/test/javax/xml/jaxp/unittest/dom/ls/Bug6710741Test.java
+++ b/jaxp/test/javax/xml/jaxp/unittest/dom/ls/Bug6710741Test.java
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2014, 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2014, 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,6 +27,7 @@
 import javax.xml.parsers.ParserConfigurationException;
 
 import org.testng.Assert;
+import org.testng.annotations.Listeners;
 import org.testng.annotations.Test;
 import org.w3c.dom.Document;
 import org.w3c.dom.Element;
@@ -34,9 +35,14 @@
 import org.w3c.dom.ls.LSException;
 
 /*
+ * @test
  * @bug 6710741
+ * @library /javax/xml/jaxp/libs /javax/xml/jaxp/unittest
+ * @run testng/othervm -DrunSecMngr=true dom.ls.Bug6710741Test
+ * @run testng/othervm dom.ls.Bug6710741Test
  * @summary Test there should be stack trace information if LSSerializer().writeToString reports an exception.
  */
+@Listeners({jaxp.library.BasePolicy.class})
 public class Bug6710741Test {
 
     @Test
@@ -74,3 +80,4 @@
     }
 
 }
+
diff --git a/jaxp/test/javax/xml/jaxp/unittest/dom/ls/LSParserTCKTest.java b/jaxp/test/javax/xml/jaxp/unittest/dom/ls/LSParserTCKTest.java
index 8c609fc..3e4f876 100644
--- a/jaxp/test/javax/xml/jaxp/unittest/dom/ls/LSParserTCKTest.java
+++ b/jaxp/test/javax/xml/jaxp/unittest/dom/ls/LSParserTCKTest.java
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2014, 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2014, 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
@@ -31,6 +31,7 @@
 import javax.xml.parsers.ParserConfigurationException;
 
 import org.testng.Assert;
+import org.testng.annotations.Listeners;
 import org.testng.annotations.Test;
 import org.w3c.dom.Attr;
 import org.w3c.dom.DOMImplementation;
@@ -47,8 +48,13 @@
 import org.xml.sax.SAXException;
 
 /*
+ * @test
+ * @library /javax/xml/jaxp/libs /javax/xml/jaxp/unittest
+ * @run testng/othervm -DrunSecMngr=true dom.ls.LSParserTCKTest
+ * @run testng/othervm dom.ls.LSParserTCKTest
  * @summary Test Specifications and Descriptions for LSParser.
  */
+@Listeners({jaxp.library.BasePolicy.class})
 public class LSParserTCKTest {
 
     DOMImplementationLS implLS = null;
@@ -578,3 +584,4 @@
     }
 
 }
+
diff --git a/jaxp/test/javax/xml/jaxp/unittest/dom/ls/LSParserTest.java b/jaxp/test/javax/xml/jaxp/unittest/dom/ls/LSParserTest.java
index bf24b87..1a3c591 100644
--- a/jaxp/test/javax/xml/jaxp/unittest/dom/ls/LSParserTest.java
+++ b/jaxp/test/javax/xml/jaxp/unittest/dom/ls/LSParserTest.java
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2014, 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2014, 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,6 +27,7 @@
 import javax.xml.parsers.ParserConfigurationException;
 
 import org.testng.Assert;
+import org.testng.annotations.Listeners;
 import org.testng.annotations.Test;
 import org.w3c.dom.DOMConfiguration;
 import org.w3c.dom.DOMError;
@@ -39,8 +40,13 @@
 import org.w3c.dom.ls.LSResourceResolver;
 
 /*
+ * @test
+ * @library /javax/xml/jaxp/libs /javax/xml/jaxp/unittest
+ * @run testng/othervm -DrunSecMngr=true dom.ls.LSParserTest
+ * @run testng/othervm dom.ls.LSParserTest
  * @summary Test LSParser's DOMConfiguration for supported properties.
  */
+@Listeners({jaxp.library.BasePolicy.class})
 public class LSParserTest {
 
     @Test
@@ -103,3 +109,4 @@
         }
     }
 }
+
diff --git a/jaxp/test/javax/xml/jaxp/unittest/dom/ls/LSSerializerTest.java b/jaxp/test/javax/xml/jaxp/unittest/dom/ls/LSSerializerTest.java
index 172d329..d30baa8 100644
--- a/jaxp/test/javax/xml/jaxp/unittest/dom/ls/LSSerializerTest.java
+++ b/jaxp/test/javax/xml/jaxp/unittest/dom/ls/LSSerializerTest.java
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2014, 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2014, 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
@@ -33,6 +33,7 @@
 import javax.xml.parsers.ParserConfigurationException;
 
 import org.testng.Assert;
+import org.testng.annotations.Listeners;
 import org.testng.annotations.Test;
 import org.w3c.dom.DOMConfiguration;
 import org.w3c.dom.DOMError;
@@ -48,9 +49,14 @@
 
 
 /*
+ * @test
  * @bug 6439439 8080906
+ * @library /javax/xml/jaxp/libs /javax/xml/jaxp/unittest
+ * @run testng/othervm -DrunSecMngr=true dom.ls.LSSerializerTest
+ * @run testng/othervm dom.ls.LSSerializerTest
  * @summary Test LSSerializer.
  */
+@Listeners({jaxp.library.BasePolicy.class})
 public class LSSerializerTest {
     private static final String DOM_FORMAT_PRETTY_PRINT = "format-pretty-print";
 
@@ -313,3 +319,4 @@
         Assert.assertEquals(XML11_DOCUMENT_OUTPUT, defaultSerialization, "Invalid serialization of XML 1.1 document: ");
     }
 }
+
diff --git a/jaxp/test/javax/xml/jaxp/unittest/parsers/Bug4674384_MAX_OCCURS_Test.java b/jaxp/test/javax/xml/jaxp/unittest/parsers/Bug4674384_MAX_OCCURS_Test.java
index 5c8248a..c0e833e 100644
--- a/jaxp/test/javax/xml/jaxp/unittest/parsers/Bug4674384_MAX_OCCURS_Test.java
+++ b/jaxp/test/javax/xml/jaxp/unittest/parsers/Bug4674384_MAX_OCCURS_Test.java
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2014, 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2014, 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
@@ -29,13 +29,19 @@
 import javax.xml.parsers.SAXParserFactory;
 
 import org.testng.Assert;
+import org.testng.annotations.Listeners;
 import org.testng.annotations.Test;
 import org.xml.sax.helpers.DefaultHandler;
 
 /*
+ * @test
  * @bug 4674384
+ * @library /javax/xml/jaxp/libs /javax/xml/jaxp/unittest
+ * @run testng/othervm -DrunSecMngr=true parsers.Bug4674384_MAX_OCCURS_Test
+ * @run testng/othervm parsers.Bug4674384_MAX_OCCURS_Test
  * @summary Test large maxOccurs.
  */
+@Listeners({jaxp.library.FilePolicy.class})
 public class Bug4674384_MAX_OCCURS_Test {
 
     @Test
@@ -64,3 +70,4 @@
         System.out.println("Success: File " + XML_FILE_NAME + " was parsed with a large value of maxOccurs.");
     }
 }
+
diff --git a/jaxp/test/javax/xml/jaxp/unittest/parsers/Bug4934208.java b/jaxp/test/javax/xml/jaxp/unittest/parsers/Bug4934208.java
index 50f5514..6594339 100644
--- a/jaxp/test/javax/xml/jaxp/unittest/parsers/Bug4934208.java
+++ b/jaxp/test/javax/xml/jaxp/unittest/parsers/Bug4934208.java
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2014, 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2014, 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,6 +27,7 @@
 import javax.xml.parsers.SAXParserFactory;
 
 import org.testng.Assert;
+import org.testng.annotations.Listeners;
 import org.testng.annotations.Test;
 import org.xml.sax.InputSource;
 import org.xml.sax.SAXException;
@@ -35,9 +36,14 @@
 import util.DraconianErrorHandler;
 
 /*
+ * @test
  * @bug 4934208
+ * @library /javax/xml/jaxp/libs /javax/xml/jaxp/unittest
+ * @run testng/othervm -DrunSecMngr=true parsers.Bug4934208
+ * @run testng/othervm parsers.Bug4934208
  * @summary Test SAXParser can parse keyref constraint with a selector that is a union xpath expression selecting a node and its child.
  */
+@Listeners({jaxp.library.FilePolicy.class})
 public class Bug4934208 {
     @Test
     public void test1() throws Exception {
@@ -68,3 +74,4 @@
         r.parse(is);
     }
 }
+
diff --git a/jaxp/test/javax/xml/jaxp/unittest/parsers/Bug4967002.java b/jaxp/test/javax/xml/jaxp/unittest/parsers/Bug4967002.java
index 0843234..308b5b1 100644
--- a/jaxp/test/javax/xml/jaxp/unittest/parsers/Bug4967002.java
+++ b/jaxp/test/javax/xml/jaxp/unittest/parsers/Bug4967002.java
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2014, 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2014, 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
@@ -33,16 +33,22 @@
 import javax.xml.validation.SchemaFactory;
 
 import org.testng.Assert;
+import org.testng.annotations.Listeners;
 import org.testng.annotations.Test;
 import org.xml.sax.InputSource;
 
 /*
+ * @test
  * @bug 4967002
+ * @library /javax/xml/jaxp/libs /javax/xml/jaxp/unittest
+ * @run testng/othervm -DrunSecMngr=true parsers.Bug4967002
+ * @run testng/othervm parsers.Bug4967002
  * @summary Test DocumentBuilderFactory.newDocumentBuilder() throws ParserConfigurationException
  * when it uses the "http://java.sun.com/xml/jaxp/properties/schemaSource" property
  * and/or the "http://java.sun.com/xml/jaxp/properties/schemaLanguage" property
  * in conjunction with setting a Schema object.
  */
+@Listeners({jaxp.library.BasePolicy.class})
 public class Bug4967002 {
     String schemaSource = "<?xml version='1.0'?>\n" + "<xsd:schema xmlns:xsd='http://www.w3.org/2001/XMLSchema'>\n" + "  <xsd:element name='test101'>\n"
             + "    <xsd:complexType>\n" + "      <xsd:attribute name='attr'/>\n" + "      <xsd:attribute name='attr2' default='DEF'/>\n"
@@ -95,3 +101,4 @@
         }
     }
 }
+
diff --git a/jaxp/test/javax/xml/jaxp/unittest/parsers/Bug4985486.java b/jaxp/test/javax/xml/jaxp/unittest/parsers/Bug4985486.java
index c87f471..7cc3313 100644
--- a/jaxp/test/javax/xml/jaxp/unittest/parsers/Bug4985486.java
+++ b/jaxp/test/javax/xml/jaxp/unittest/parsers/Bug4985486.java
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2014, 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2014, 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,14 +26,20 @@
 import javax.xml.parsers.SAXParserFactory;
 
 import org.testng.Assert;
+import org.testng.annotations.Listeners;
 import org.testng.annotations.Test;
 import org.xml.sax.SAXException;
 import org.xml.sax.helpers.DefaultHandler;
 
 /*
+ * @test
  * @bug 4985486
+ * @library /javax/xml/jaxp/libs /javax/xml/jaxp/unittest
+ * @run testng/othervm -DrunSecMngr=true parsers.Bug4985486
+ * @run testng/othervm parsers.Bug4985486
  * @summary Test SAXParser can parse large characters(more than 10000).
  */
+@Listeners({jaxp.library.FilePolicy.class})
 public class Bug4985486 {
 
     @Test
@@ -62,3 +68,4 @@
 
     }
 }
+
diff --git a/jaxp/test/javax/xml/jaxp/unittest/parsers/Bug4991020.java b/jaxp/test/javax/xml/jaxp/unittest/parsers/Bug4991020.java
index 6a50919..189f5ef 100644
--- a/jaxp/test/javax/xml/jaxp/unittest/parsers/Bug4991020.java
+++ b/jaxp/test/javax/xml/jaxp/unittest/parsers/Bug4991020.java
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2014, 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2014, 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,12 +26,18 @@
 import javax.xml.parsers.SAXParser;
 import javax.xml.parsers.SAXParserFactory;
 
+import org.testng.annotations.Listeners;
 import org.testng.annotations.Test;
 
 /*
+ * @test
  * @bug 4991020
+ * @library /javax/xml/jaxp/libs /javax/xml/jaxp/unittest
+ * @run testng/othervm -DrunSecMngr=true parsers.Bug4991020
+ * @run testng/othervm parsers.Bug4991020
  * @summary Test XPath like "node_name/." can be parsed.
  */
+@Listeners({jaxp.library.FilePolicy.class})
 public class Bug4991020 {
 
     protected static SAXParser createParser() throws Exception {
@@ -50,3 +56,4 @@
         parser.parse(Bug4991020.class.getResource("Bug4991020.xml").toExternalForm(), new util.DraconianErrorHandler());
     }
 }
+
diff --git a/jaxp/test/javax/xml/jaxp/unittest/parsers/Bug4991946.java b/jaxp/test/javax/xml/jaxp/unittest/parsers/Bug4991946.java
index f48e0bd..a30cbd8 100644
--- a/jaxp/test/javax/xml/jaxp/unittest/parsers/Bug4991946.java
+++ b/jaxp/test/javax/xml/jaxp/unittest/parsers/Bug4991946.java
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2014, 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2014, 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,12 +26,18 @@
 import javax.xml.parsers.SAXParser;
 import javax.xml.parsers.SAXParserFactory;
 
+import org.testng.annotations.Listeners;
 import org.testng.annotations.Test;
 
 /*
+ * @test
  * @bug 4991946
+ * @library /javax/xml/jaxp/libs /javax/xml/jaxp/unittest
+ * @run testng/othervm -DrunSecMngr=true parsers.Bug4991946
+ * @run testng/othervm parsers.Bug4991946
  * @summary Can parse the element type is anyType in the schema and is substituted by the simple type via the 'xsi:type' attribute in xml document.
  */
+@Listeners({jaxp.library.FilePolicy.class})
 public class Bug4991946 {
 
     protected static SAXParser createParser() throws Exception {
@@ -50,3 +56,4 @@
         parser.parse(Bug4991946.class.getResource("Bug4991946.xml").toExternalForm(), new util.DraconianErrorHandler());
     }
 }
+
diff --git a/jaxp/test/javax/xml/jaxp/unittest/parsers/Bug5010072.java b/jaxp/test/javax/xml/jaxp/unittest/parsers/Bug5010072.java
index 68d9a17..786a222 100644
--- a/jaxp/test/javax/xml/jaxp/unittest/parsers/Bug5010072.java
+++ b/jaxp/test/javax/xml/jaxp/unittest/parsers/Bug5010072.java
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2014, 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2014, 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,15 +26,21 @@
 import javax.xml.validation.SchemaFactory;
 
 import org.testng.Assert;
+import org.testng.annotations.Listeners;
 import org.testng.annotations.Test;
 import org.xml.sax.SAXException;
 import org.xml.sax.SAXParseException;
 import org.xml.sax.helpers.DefaultHandler;
 
 /*
+ * @test
  * @bug 5010072
+ * @library /javax/xml/jaxp/libs /javax/xml/jaxp/unittest
+ * @run testng/othervm -DrunSecMngr=true parsers.Bug5010072
+ * @run testng/othervm parsers.Bug5010072
  * @summary Test SchemaFactory throws SAXException if xpath is "@".
  */
+@Listeners({jaxp.library.FilePolicy.class})
 public class Bug5010072 {
 
     protected static class ErrorHandler extends DefaultHandler {
@@ -71,3 +77,4 @@
         }
     }
 }
+
diff --git a/jaxp/test/javax/xml/jaxp/unittest/parsers/Bug5025825.java b/jaxp/test/javax/xml/jaxp/unittest/parsers/Bug5025825.java
index 9a87104..86d766b 100644
--- a/jaxp/test/javax/xml/jaxp/unittest/parsers/Bug5025825.java
+++ b/jaxp/test/javax/xml/jaxp/unittest/parsers/Bug5025825.java
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2014, 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2014, 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
@@ -33,15 +33,21 @@
 import javax.xml.validation.SchemaFactory;
 
 import org.testng.Assert;
+import org.testng.annotations.Listeners;
 import org.testng.annotations.Test;
 import org.xml.sax.InputSource;
 import org.xml.sax.SAXException;
 
 /*
+ * @test
  * @bug 5025825
+ * @library /javax/xml/jaxp/libs /javax/xml/jaxp/unittest
+ * @run testng/othervm -DrunSecMngr=true parsers.Bug5025825
+ * @run testng/othervm parsers.Bug5025825
  * @summary Test if SAXParserFactory set a Schema object, when SAXParser sets "http://java.sun.com/xml/jaxp/properties/schemaSource" property
  * and/or "http://java.sun.com/xml/jaxp/properties/schemaLanguage" property, it shall throw SAXException.
  */
+@Listeners({jaxp.library.BasePolicy.class})
 public class Bug5025825 {
 
     String schemaSource = "<?xml version='1.0'?>\n" + "<xsd:schema xmlns:xsd='http://www.w3.org/2001/XMLSchema'>\n" + "  <xsd:element name='test101'>\n"
@@ -83,3 +89,4 @@
         }
     }
 }
+
diff --git a/jaxp/test/javax/xml/jaxp/unittest/parsers/Bug6309988.java b/jaxp/test/javax/xml/jaxp/unittest/parsers/Bug6309988.java
index fc38d41..20e49c8 100644
--- a/jaxp/test/javax/xml/jaxp/unittest/parsers/Bug6309988.java
+++ b/jaxp/test/javax/xml/jaxp/unittest/parsers/Bug6309988.java
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2014, 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2014, 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
@@ -23,6 +23,9 @@
 
 package parsers;
 
+import static jaxp.library.JAXPTestUtilities.clearSystemProperty;
+import static jaxp.library.JAXPTestUtilities.setSystemProperty;
+
 import java.io.File;
 import java.io.InputStream;
 
@@ -33,31 +36,28 @@
 import javax.xml.parsers.SAXParserFactory;
 
 import org.testng.Assert;
+import org.testng.annotations.Listeners;
 import org.testng.annotations.Test;
 import org.w3c.dom.Document;
 import org.xml.sax.SAXParseException;
 
 /*
+ * @test
  * @bug 6309988
+ * @library /javax/xml/jaxp/libs /javax/xml/jaxp/unittest
+ * @run testng/othervm -DrunSecMngr=true parsers.Bug6309988
+ * @run testng/othervm parsers.Bug6309988
  * @summary Test elementAttributeLimit, maxOccurLimit, entityExpansionLimit.
  */
+@Test(singleThreaded = true)
+@Listeners({jaxp.library.FilePolicy.class})
 public class Bug6309988 {
 
     DocumentBuilderFactory dbf = null;
-    static boolean _isSecureMode = false;
-    static {
-        if (System.getSecurityManager() != null) {
-            _isSecureMode = true;
-            System.out.println("Security Manager is present");
-        } else {
-            System.out.println("Security Manager is NOT present");
-        }
-    }
 
     /*
      * Given XML document has more than 10000 attributes. Exception is expected
      */
-    @Test
     public void testDOMParserElementAttributeLimit() {
         try {
             dbf = DocumentBuilderFactory.newInstance();
@@ -75,7 +75,6 @@
      * Given XML document has more than 10000 attributes. It should report an
      * error.
      */
-    @Test
     public void testDOMNSParserElementAttributeLimit() {
         try {
             dbf = DocumentBuilderFactory.newInstance();
@@ -94,9 +93,8 @@
      * Given XML document has more than 10000 attributes. Parsing this XML
      * document in non-secure mode, should not report any error.
      */
-    @Test
     public void testDOMNSParserElementAttributeLimitWithoutSecureProcessing() {
-        if (_isSecureMode)
+        if (isSecureMode())
             return; // jaxp secure feature can not be turned off when security
                     // manager is present
         try {
@@ -121,16 +119,15 @@
      * test should be the same as
      * testSystemElementAttributeLimitWithSecureProcessing
      */
-    @Test
     public void testSystemElementAttributeLimitWithoutSecureProcessing() {
-        if (_isSecureMode)
+        if (isSecureMode())
             return; // jaxp secure feature can not be turned off when security
                     // manager is present
         try {
             dbf = DocumentBuilderFactory.newInstance();
             dbf.setFeature(XMLConstants.FEATURE_SECURE_PROCESSING, false);
             dbf.setNamespaceAware(true);
-            System.setProperty("elementAttributeLimit", "2");
+            setSystemProperty("elementAttributeLimit", "2");
             DocumentBuilder parser = dbf.newDocumentBuilder();
             Document doc = parser.parse(this.getClass().getResourceAsStream("DosTest3.xml"));
 
@@ -147,7 +144,7 @@
                 Assert.fail("Unexpected error: " + e.getMessage());
             }
         } finally {
-            System.clearProperty("elementAttributeLimit");
+            clearSystemProperty("elementAttributeLimit");
         }
     }
 
@@ -155,12 +152,11 @@
      * Given XML document has 3 attributes and System property is set to 2.
      * Parsing this XML document in secure mode, should report an error.
      */
-    @Test
     public void testSystemElementAttributeLimitWithSecureProcessing() {
         try {
             dbf = DocumentBuilderFactory.newInstance();
             dbf.setNamespaceAware(true);
-            System.setProperty("elementAttributeLimit", "2");
+            setSystemProperty("elementAttributeLimit", "2");
             DocumentBuilder parser = dbf.newDocumentBuilder();
             Document doc = parser.parse(this.getClass().getResourceAsStream("DosTest3.xml"));
             Assert.fail("SAXParserException is expected, as given XML document contains more than 2 attributes");
@@ -169,14 +165,13 @@
         } catch (Exception e) {
             Assert.fail("Exception " + e.getMessage());
         } finally {
-            System.setProperty("elementAttributeLimit", "");
+            setSystemProperty("elementAttributeLimit", "");
         }
     }
 
     /*
      * Default value for secure processing feature should be true.
      */
-    @Test
     public void testDOMSecureProcessingDefaultValue() {
         try {
             dbf = DocumentBuilderFactory.newInstance();
@@ -190,7 +185,6 @@
     /*
      * Default value for secure processing feature should be true.
      */
-    @Test
     public void testSAXSecureProcessingDefaultValue() {
         try {
             SAXParserFactory spf = SAXParserFactory.newInstance();
@@ -206,16 +200,15 @@
      * feature is off. Given doument contains more than 2 elements and hence an
      * error should be reported.
      */
-    @Test
     public void testSystemMaxOccurLimitWithoutSecureProcessing() {
-        if (_isSecureMode)
+        if (isSecureMode())
             return; // jaxp secure feature can not be turned off when security
                     // manager is present
         try {
             SAXParserFactory spf = SAXParserFactory.newInstance();
             spf.setFeature(XMLConstants.FEATURE_SECURE_PROCESSING, false);
             spf.setValidating(true);
-            System.setProperty("maxOccurLimit", "2");
+            setSystemProperty("maxOccurLimit", "2");
             // Set the properties for Schema Validation
             String SCHEMA_LANG = "http://java.sun.com/xml/jaxp/properties/schemaLanguage";
             String SCHEMA_TYPE = "http://www.w3.org/2001/XMLSchema";
@@ -230,7 +223,7 @@
             MyErrorHandler eh = new MyErrorHandler();
             parser.parse(is, eh);
             Assert.assertFalse(eh.errorOccured, "Not Expected Error");
-            System.setProperty("maxOccurLimit", "");
+            setSystemProperty("maxOccurLimit", "");
         } catch (Exception e) {
             Assert.fail("Exception occured: " + e.getMessage());
         }
@@ -242,9 +235,8 @@
      * maxOccur is '3002'. Since secure processing feature is off, document
      * should be parsed without any errors.
      */
-    @Test
     public void testValidMaxOccurLimitWithOutSecureProcessing() {
-        if (_isSecureMode)
+        if (isSecureMode())
             return; // jaxp secure feature can not be turned off when security
                     // manager is present
         try {
@@ -279,13 +271,12 @@
      * test should be the same as
      * testSystemElementAttributeLimitWithSecureProcessing
      */
-    @Test
     public void testSystemEntityExpansionLimitWithOutSecureProcessing() {
-        if (_isSecureMode)
+        if (isSecureMode())
             return; // jaxp secure feature can not be turned off when security
                     // manager is present
         try {
-            System.setProperty("entityExpansionLimit", "2");
+            setSystemProperty("entityExpansionLimit", "2");
             dbf = DocumentBuilderFactory.newInstance();
             dbf.setFeature(XMLConstants.FEATURE_SECURE_PROCESSING, false);
             dbf.setValidating(true);
@@ -304,7 +295,7 @@
                 Assert.fail("Unexpected error: " + e.getMessage());
             }
         } finally {
-            System.clearProperty("entityExpansionLimit");
+            clearSystemProperty("entityExpansionLimit");
         }
     }
 
@@ -312,12 +303,11 @@
      * System property is set to 2. Given XML document has more than 2 entity
      * references. Parsing this document in secure mode, should report an error.
      */
-    @Test
     public void testSystemEntityExpansionLimitWithSecureProcessing() {
         try {
             dbf = DocumentBuilderFactory.newInstance();
             dbf.setValidating(true);
-            System.setProperty("entityExpansionLimit", "2");
+            setSystemProperty("entityExpansionLimit", "2");
             DocumentBuilder parser = dbf.newDocumentBuilder();
             Document doc = parser.parse(this.getClass().getResourceAsStream("entity.xml"));
             Assert.fail("SAXParserException is expected, as given XML document contains more 2 entity references");
@@ -327,7 +317,7 @@
         } catch (Exception e) {
             Assert.fail("Exception " + e.getMessage());
         } finally {
-            System.setProperty("entityExpansionLimit", "");
+            setSystemProperty("entityExpansionLimit", "");
         }
     }
 
@@ -335,7 +325,6 @@
      * Given XML document has more than 64000 entity references. Parsing this
      * document in secure mode, should report an error.
      */
-    @Test
     public void testEntityExpansionLimitWithSecureProcessing() {
         try {
             dbf = DocumentBuilderFactory.newInstance();
@@ -349,7 +338,7 @@
         } catch (Exception e) {
             Assert.fail("Exception " + e.getMessage());
         } finally {
-            System.setProperty("entityExpansionLimit", "");
+            setSystemProperty("entityExpansionLimit", "");
         }
     }
 
@@ -357,9 +346,8 @@
      * Given XML document has more than 64000 entity references. Parsing this
      * document in non-secure mode, should not report any error.
      */
-    @Test
     public void testEntityExpansionLimitWithOutSecureProcessing() {
-        if (_isSecureMode)
+        if (isSecureMode())
             return; // jaxp secure feature can not be turned off when security
                     // manager is present
         try {
@@ -374,7 +362,12 @@
         } catch (Exception e) {
             Assert.fail("Exception " + e.getMessage());
         } finally {
-            System.setProperty("entityExpansionLimit", "");
+            setSystemProperty("entityExpansionLimit", "");
         }
     }
+
+    private boolean isSecureMode() {
+        return System.getSecurityManager() != null;
+    }
 }
+
diff --git a/jaxp/test/javax/xml/jaxp/unittest/parsers/Bug6341770.java b/jaxp/test/javax/xml/jaxp/unittest/parsers/Bug6341770.java
index 94873df..5a93c1a 100644
--- a/jaxp/test/javax/xml/jaxp/unittest/parsers/Bug6341770.java
+++ b/jaxp/test/javax/xml/jaxp/unittest/parsers/Bug6341770.java
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2014, 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2014, 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
@@ -23,29 +23,38 @@
 
 package parsers;
 
+import static jaxp.library.JAXPTestUtilities.tryRunWithTmpPermission;
+
 import java.io.File;
 import java.io.FileWriter;
 import java.io.PrintWriter;
+import java.util.PropertyPermission;
 
 import javax.xml.parsers.SAXParserFactory;
 
 import org.testng.Assert;
+import org.testng.annotations.Listeners;
 import org.testng.annotations.Test;
 import org.xml.sax.Attributes;
 import org.xml.sax.SAXException;
 import org.xml.sax.helpers.DefaultHandler;
 
 /*
+ * @test
  * @bug 6341770
+ * @library /javax/xml/jaxp/libs /javax/xml/jaxp/unittest
+ * @run testng/othervm -DrunSecMngr=true parsers.Bug6341770
+ * @run testng/othervm parsers.Bug6341770
  * @summary Test external entity linked to non-ASCII base URL.
  */
+@Listeners({jaxp.library.FilePolicy.class})
 public class Bug6341770 {
 
     // naming a file "aux" would fail on windows.
     @Test
     public void testNonAsciiURI() {
         try {
-            File dir = File.createTempFile("sko\u0159ice", null);
+            File dir = new File("sko\u0159ice");
             dir.delete();
             dir.mkdir();
             File main = new File(dir, "main.xml");
@@ -60,11 +69,13 @@
             w.flush();
             w.close();
             System.out.println("Parsing: " + main);
-            SAXParserFactory.newInstance().newSAXParser().parse(main, new DefaultHandler() {
-                public void startElement(String uri, String localname, String qname, Attributes attr) throws SAXException {
-                    System.out.println("encountered <" + qname + ">");
-                }
-            });
+            tryRunWithTmpPermission(
+                    () -> SAXParserFactory.newInstance().newSAXParser().parse(main, new DefaultHandler() {
+                        public void startElement(String uri, String localname, String qname, Attributes attr)
+                                throws SAXException {
+                            System.out.println("encountered <" + qname + ">");
+                        }
+                    }), new PropertyPermission("user.dir", "read"));
         } catch (Exception e) {
             e.printStackTrace();
             Assert.fail("Exception: " + e.getMessage());
@@ -72,3 +83,4 @@
         System.out.println("OK.");
     }
 }
+
diff --git a/jaxp/test/javax/xml/jaxp/unittest/parsers/Bug6361283.java b/jaxp/test/javax/xml/jaxp/unittest/parsers/Bug6361283.java
index f3bfb88..1e0e25a 100644
--- a/jaxp/test/javax/xml/jaxp/unittest/parsers/Bug6361283.java
+++ b/jaxp/test/javax/xml/jaxp/unittest/parsers/Bug6361283.java
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2014, 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2014, 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,18 @@
 import javax.xml.parsers.SAXParserFactory;
 
 import org.testng.Assert;
+import org.testng.annotations.Listeners;
 import org.testng.annotations.Test;
 
 /*
+ * @test
  * @bug 6361283
+ * @library /javax/xml/jaxp/libs /javax/xml/jaxp/unittest
+ * @run testng/othervm -DrunSecMngr=true parsers.Bug6361283
+ * @run testng/othervm parsers.Bug6361283
  * @summary Test SAXParser returns version as 1.1 for XML 1.1 document.
  */
+@Listeners({jaxp.library.FilePolicy.class})
 public class Bug6361283 {
 
     @Test
@@ -50,3 +56,4 @@
         }
     }
 }
+
diff --git a/jaxp/test/javax/xml/jaxp/unittest/parsers/Bug6506304Test.java b/jaxp/test/javax/xml/jaxp/unittest/parsers/Bug6506304Test.java
index a7e82d5..eab6d6d 100644
--- a/jaxp/test/javax/xml/jaxp/unittest/parsers/Bug6506304Test.java
+++ b/jaxp/test/javax/xml/jaxp/unittest/parsers/Bug6506304Test.java
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2014, 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2014, 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
@@ -23,21 +23,29 @@
 
 package parsers;
 
+import static jaxp.library.JAXPTestUtilities.getSystemProperty;
+
 import javax.xml.parsers.SAXParser;
 import javax.xml.parsers.SAXParserFactory;
 
 import org.testng.Assert;
+import org.testng.annotations.Listeners;
 import org.testng.annotations.Test;
 import org.xml.sax.XMLReader;
 
 /*
+ * @test
  * @bug 6506304
+ * @library /javax/xml/jaxp/libs /javax/xml/jaxp/unittest
+ * @run testng/othervm -DrunSecMngr=true parsers.Bug6506304Test
+ * @run testng/othervm parsers.Bug6506304Test
  * @summary Test MalformedURLException: unknown protocol won't be thrown when there is a space within the full path file name.
  */
+@Listeners({jaxp.library.BasePolicy.class})
 public class Bug6506304Test {
     public static boolean isWindows = false;
     static {
-        if (System.getProperty("os.name").indexOf("Windows") > -1) {
+        if (getSystemProperty("os.name").indexOf("Windows") > -1) {
             isWindows = true;
         }
     };
@@ -63,3 +71,4 @@
         }
     }
 }
+
diff --git a/jaxp/test/javax/xml/jaxp/unittest/parsers/Bug6518733.java b/jaxp/test/javax/xml/jaxp/unittest/parsers/Bug6518733.java
index c6a0354..ab23e37 100644
--- a/jaxp/test/javax/xml/jaxp/unittest/parsers/Bug6518733.java
+++ b/jaxp/test/javax/xml/jaxp/unittest/parsers/Bug6518733.java
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2014, 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2014, 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
@@ -29,15 +29,21 @@
 import javax.xml.parsers.SAXParserFactory;
 
 import org.testng.Assert;
+import org.testng.annotations.Listeners;
 import org.testng.annotations.Test;
 import org.xml.sax.Attributes;
 import org.xml.sax.InputSource;
 import org.xml.sax.SAXException;
 
 /*
+ * @test
  * @bug 6518733
+ * @library /javax/xml/jaxp/libs /javax/xml/jaxp/unittest
+ * @run testng/othervm -DrunSecMngr=true parsers.Bug6518733
+ * @run testng/othervm parsers.Bug6518733
  * @summary Test SAX parser handles several attributes that each contain a newline within the attribute value.
  */
+@Listeners({jaxp.library.FilePolicy.class})
 public class Bug6518733 {
 
     @Test
@@ -61,3 +67,4 @@
     }
 
 }
+
diff --git a/jaxp/test/javax/xml/jaxp/unittest/parsers/Bug6564400.java b/jaxp/test/javax/xml/jaxp/unittest/parsers/Bug6564400.java
index e7aa719..1ae8c81 100644
--- a/jaxp/test/javax/xml/jaxp/unittest/parsers/Bug6564400.java
+++ b/jaxp/test/javax/xml/jaxp/unittest/parsers/Bug6564400.java
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2014, 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2014, 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
@@ -38,6 +38,7 @@
 import javax.xml.validation.SchemaFactory;
 
 import org.testng.Assert;
+import org.testng.annotations.Listeners;
 import org.testng.annotations.Test;
 import org.w3c.dom.Document;
 import org.w3c.dom.Node;
@@ -46,9 +47,14 @@
 import org.xml.sax.helpers.DefaultHandler;
 
 /*
+ * @test
  * @bug 6564400
+ * @library /javax/xml/jaxp/libs /javax/xml/jaxp/unittest
+ * @run testng/othervm -DrunSecMngr=true parsers.Bug6564400
+ * @run testng/othervm parsers.Bug6564400
  * @summary Test ignorable whitespace handling with schema validation.
  */
+@Listeners({jaxp.library.FilePolicy.class})
 public class Bug6564400 {
     private boolean sawIgnorable = false;
     Schema schema = null;
@@ -174,3 +180,4 @@
         }
     }
 }
+
diff --git a/jaxp/test/javax/xml/jaxp/unittest/parsers/Bug6573786.java b/jaxp/test/javax/xml/jaxp/unittest/parsers/Bug6573786.java
index ff3d193..dd12ea5 100644
--- a/jaxp/test/javax/xml/jaxp/unittest/parsers/Bug6573786.java
+++ b/jaxp/test/javax/xml/jaxp/unittest/parsers/Bug6573786.java
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2014, 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2014, 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
@@ -29,12 +29,18 @@
 import javax.xml.parsers.SAXParser;
 import javax.xml.parsers.SAXParserFactory;
 import org.testng.Assert;
+import org.testng.annotations.Listeners;
 import org.testng.annotations.Test;
 
 /*
+ * @test
  * @bug 6573786
+ * @library /javax/xml/jaxp/libs /javax/xml/jaxp/unittest
+ * @run testng/othervm -DrunSecMngr=true parsers.Bug6573786
+ * @run testng/othervm parsers.Bug6573786
  * @summary Test parser error messages are formatted.
  */
+@Listeners({jaxp.library.BasePolicy.class})
 public class Bug6573786 {
     String _cache = "";
 
@@ -67,3 +73,4 @@
 
     }
 }
+
diff --git a/jaxp/test/javax/xml/jaxp/unittest/parsers/Bug6573786ErrorHandler.java b/jaxp/test/javax/xml/jaxp/unittest/parsers/Bug6573786ErrorHandler.java
index b938eb6..f459589 100644
--- a/jaxp/test/javax/xml/jaxp/unittest/parsers/Bug6573786ErrorHandler.java
+++ b/jaxp/test/javax/xml/jaxp/unittest/parsers/Bug6573786ErrorHandler.java
@@ -45,3 +45,4 @@
         System.out.println(e.getMessage());
     } // warning ()
 }
+
diff --git a/jaxp/test/javax/xml/jaxp/unittest/parsers/Bug6594813.java b/jaxp/test/javax/xml/jaxp/unittest/parsers/Bug6594813.java
index a89d834..411bdf7 100644
--- a/jaxp/test/javax/xml/jaxp/unittest/parsers/Bug6594813.java
+++ b/jaxp/test/javax/xml/jaxp/unittest/parsers/Bug6594813.java
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2014, 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2014, 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,14 +34,20 @@
 import javax.xml.transform.stream.StreamResult;
 
 import org.testng.Assert;
+import org.testng.annotations.Listeners;
 import org.testng.annotations.Test;
 import org.xml.sax.InputSource;
 import org.xml.sax.helpers.DefaultHandler;
 
 /*
+ * @test
  * @bug 6594813
+ * @library /javax/xml/jaxp/libs /javax/xml/jaxp/unittest
+ * @run testng/othervm -DrunSecMngr=true parsers.Bug6594813
+ * @run testng/othervm parsers.Bug6594813
  * @summary Test SAXParser output is wellformed with name space.
  */
+@Listeners({jaxp.library.BasePolicy.class})
 public class Bug6594813 {
 
     public Bug6594813(String name) {
@@ -169,3 +175,4 @@
     }
 
 }
+
diff --git a/jaxp/test/javax/xml/jaxp/unittest/parsers/Bug6608841.java b/jaxp/test/javax/xml/jaxp/unittest/parsers/Bug6608841.java
index db724d8..67f596b 100644
--- a/jaxp/test/javax/xml/jaxp/unittest/parsers/Bug6608841.java
+++ b/jaxp/test/javax/xml/jaxp/unittest/parsers/Bug6608841.java
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2014, 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2014, 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,14 +30,20 @@
 import javax.xml.parsers.SAXParser;
 import javax.xml.parsers.SAXParserFactory;
 
+import org.testng.annotations.Listeners;
 import org.testng.annotations.Test;
 import org.xml.sax.SAXException;
 import org.xml.sax.helpers.DefaultHandler;
 
 /*
+ * @test
  * @bug 6608841
+ * @library /javax/xml/jaxp/libs /javax/xml/jaxp/unittest
+ * @run testng/othervm -DrunSecMngr=true parsers.Bug6608841
+ * @run testng/othervm parsers.Bug6608841
  * @summary Test SAX parses external parameter entity.
  */
+@Listeners({jaxp.library.FilePolicy.class})
 public class Bug6608841 {
     public Bug6608841(String name) {
     }
@@ -53,3 +59,4 @@
     public class MyHandler extends DefaultHandler {
     }
 }
+
diff --git a/jaxp/test/javax/xml/jaxp/unittest/parsers/Bug6690015.java b/jaxp/test/javax/xml/jaxp/unittest/parsers/Bug6690015.java
index 25f536f..5d4359a 100644
--- a/jaxp/test/javax/xml/jaxp/unittest/parsers/Bug6690015.java
+++ b/jaxp/test/javax/xml/jaxp/unittest/parsers/Bug6690015.java
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2014, 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2014, 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
@@ -28,6 +28,7 @@
 import javax.xml.parsers.DocumentBuilderFactory;
 
 import org.testng.Assert;
+import org.testng.annotations.Listeners;
 import org.testng.annotations.Test;
 import org.w3c.dom.Document;
 import org.w3c.dom.Element;
@@ -37,9 +38,14 @@
 import org.xml.sax.InputSource;
 
 /*
+ * @test
  * @bug 6518733
+ * @library /javax/xml/jaxp/libs /javax/xml/jaxp/unittest
+ * @run testng/othervm -DrunSecMngr=true parsers.Bug6690015
+ * @run testng/othervm parsers.Bug6690015
  * @summary Test SAX parser handles several attributes with newlines.
  */
+@Listeners({jaxp.library.FilePolicy.class})
 public class Bug6690015 {
 
     public Bug6690015() {
@@ -81,3 +87,4 @@
     }
 
 }
+
diff --git a/jaxp/test/javax/xml/jaxp/unittest/parsers/Bug6760982.java b/jaxp/test/javax/xml/jaxp/unittest/parsers/Bug6760982.java
index cfd2fe2..9e6514a 100644
--- a/jaxp/test/javax/xml/jaxp/unittest/parsers/Bug6760982.java
+++ b/jaxp/test/javax/xml/jaxp/unittest/parsers/Bug6760982.java
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2014, 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2014, 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
@@ -31,6 +31,7 @@
 import javax.xml.parsers.DocumentBuilderFactory;
 
 import org.testng.Assert;
+import org.testng.annotations.Listeners;
 import org.testng.annotations.Test;
 import org.w3c.dom.Document;
 import org.w3c.dom.NamedNodeMap;
@@ -39,9 +40,14 @@
 import org.xml.sax.InputSource;
 
 /*
+ * @test
  * @bug 6518733
+ * @library /javax/xml/jaxp/libs /javax/xml/jaxp/unittest
+ * @run testng/othervm -DrunSecMngr=true parsers.Bug6760982
+ * @run testng/othervm parsers.Bug6760982
  * @summary Test SAX parser handles several attributes with containing "&gt;".
  */
+@Listeners({jaxp.library.FilePolicy.class})
 public class Bug6760982 {
 
     @Test
@@ -162,3 +168,4 @@
         }
     }
 }
+
diff --git a/jaxp/test/javax/xml/jaxp/unittest/parsers/Bug6849942Test.java b/jaxp/test/javax/xml/jaxp/unittest/parsers/Bug6849942Test.java
index c65bd1b..4c9f3c0 100644
--- a/jaxp/test/javax/xml/jaxp/unittest/parsers/Bug6849942Test.java
+++ b/jaxp/test/javax/xml/jaxp/unittest/parsers/Bug6849942Test.java
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2014, 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2014, 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
@@ -29,15 +29,21 @@
 import javax.xml.parsers.DocumentBuilderFactory;
 
 import org.testng.Assert;
+import org.testng.annotations.Listeners;
 import org.testng.annotations.Test;
 import org.w3c.dom.Document;
 import org.w3c.dom.ProcessingInstruction;
 import org.xml.sax.InputSource;
 
 /*
+ * @test
  * @bug 6849942
+ * @library /javax/xml/jaxp/libs /javax/xml/jaxp/unittest
+ * @run testng/othervm -DrunSecMngr=true parsers.Bug6849942Test
+ * @run testng/othervm parsers.Bug6849942Test
  * @summary Test parsing an XML that starts with a processing instruction and no prolog.
  */
+@Listeners({jaxp.library.BasePolicy.class})
 public class Bug6849942Test {
 
     @Test
@@ -75,3 +81,4 @@
         }
     }
 }
+
diff --git a/jaxp/test/javax/xml/jaxp/unittest/parsers/Bug7157608Test.java b/jaxp/test/javax/xml/jaxp/unittest/parsers/Bug7157608Test.java
index bd1e303..26f3f8a 100644
--- a/jaxp/test/javax/xml/jaxp/unittest/parsers/Bug7157608Test.java
+++ b/jaxp/test/javax/xml/jaxp/unittest/parsers/Bug7157608Test.java
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2014, 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2014, 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
@@ -23,6 +23,8 @@
 
 package parsers;
 
+import static jaxp.library.JAXPTestUtilities.getSystemProperty;
+
 import java.io.File;
 import java.io.IOException;
 
@@ -31,6 +33,7 @@
 
 import org.testng.Assert;
 import org.testng.annotations.BeforeMethod;
+import org.testng.annotations.Listeners;
 import org.testng.annotations.Test;
 import org.w3c.dom.Document;
 import org.xml.sax.InputSource;
@@ -39,13 +42,18 @@
 import org.xml.sax.helpers.DefaultHandler;
 
 /*
+ * @test
  * @bug 7157608
+ * @library /javax/xml/jaxp/libs /javax/xml/jaxp/unittest
+ * @run testng/othervm -DrunSecMngr=true parsers.Bug7157608Test
+ * @run testng/othervm parsers.Bug7157608Test
  * @summary Test feature standard-uri-conformant works.
  */
+@Listeners({jaxp.library.FilePolicy.class})
 public class Bug7157608Test {
     public static boolean isWindows = false;
     static {
-        if (System.getProperty("os.name").indexOf("Windows") > -1) {
+        if (getSystemProperty("os.name").indexOf("Windows") > -1) {
             isWindows = true;
         }
     };
@@ -53,7 +61,7 @@
     String xml1, xml2;
 
     @BeforeMethod
-    protected void setUp() throws IOException {
+    public void setUp() throws IOException {
         File file1 = new File(getClass().getResource("Bug7157608.xml").getFile());
         xml1 = file1.getPath().replace("\\", "\\\\");
         File file2 = new File(getClass().getResource("Bug7157608_1.xml").getFile());
@@ -210,3 +218,4 @@
         boolean validating = false;
     }
 }
+
diff --git a/jaxp/test/javax/xml/jaxp/unittest/parsers/Bug7166896Test.java b/jaxp/test/javax/xml/jaxp/unittest/parsers/Bug7166896Test.java
index 7230f9c..ed72706 100644
--- a/jaxp/test/javax/xml/jaxp/unittest/parsers/Bug7166896Test.java
+++ b/jaxp/test/javax/xml/jaxp/unittest/parsers/Bug7166896Test.java
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2014, 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2014, 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,14 +30,20 @@
 import javax.xml.parsers.ParserConfigurationException;
 
 import org.testng.Assert;
+import org.testng.annotations.Listeners;
 import org.testng.annotations.Test;
 import org.w3c.dom.Document;
 import org.xml.sax.SAXException;
 
 /*
+ * @test
  * @bug 7166896
+ * @library /javax/xml/jaxp/libs /javax/xml/jaxp/unittest
+ * @run testng/othervm -DrunSecMngr=true parsers.Bug7166896Test
+ * @run testng/othervm parsers.Bug7166896Test
  * @summary Test DocumentBuilder.parse(String uri) supports IPv6 format.
  */
+@Listeners({jaxp.library.BasePolicy.class})
 public class Bug7166896Test {
 
     @Test
@@ -74,3 +80,4 @@
 
     }
 }
+
diff --git a/jaxp/test/javax/xml/jaxp/unittest/parsers/Bug8003147Test.java b/jaxp/test/javax/xml/jaxp/unittest/parsers/Bug8003147Test.java
new file mode 100644
index 0000000..efa75ed
--- /dev/null
+++ b/jaxp/test/javax/xml/jaxp/unittest/parsers/Bug8003147Test.java
@@ -0,0 +1,96 @@
+/*
+ * Copyright (c) 2014, 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.
+ */
+
+/*
+ * @test
+ * @bug 8003147
+ * @library /javax/xml/jaxp/libs /javax/xml/jaxp/unittest
+ * @compile Bug8003147TestClass.java
+ * @run testng/othervm -DrunSecMngr=true parsers.Bug8003147Test
+ * @run testng/othervm parsers.Bug8003147Test
+ * @summary Test port fix for BCEL bug 39695.
+ */
+
+package parsers;
+
+import static jaxp.library.JAXPTestUtilities.getSystemProperty;
+
+import java.io.FileOutputStream;
+import java.io.FilePermission;
+
+import jaxp.library.JAXPTestUtilities;
+
+import org.testng.Assert;
+import org.testng.annotations.Listeners;
+import org.testng.annotations.Test;
+
+import com.sun.org.apache.bcel.internal.classfile.ClassParser;
+import com.sun.org.apache.bcel.internal.classfile.ConstantClass;
+import com.sun.org.apache.bcel.internal.classfile.ConstantPool;
+import com.sun.org.apache.bcel.internal.classfile.ConstantUtf8;
+import com.sun.org.apache.bcel.internal.classfile.JavaClass;
+import com.sun.org.apache.bcel.internal.classfile.Method;
+import com.sun.org.apache.bcel.internal.generic.ClassGen;
+import com.sun.org.apache.bcel.internal.generic.MethodGen;
+
+@Listeners({ jaxp.library.FilePolicy.class, jaxp.library.InternalAPIPolicy.class })
+public class Bug8003147Test {
+
+    @Test
+    public void test() throws Exception {
+        // Note: com.sun.org.apache.bcel.internal.classfile.JavaClass doesn't
+        // support InvokeDynamic, so can't use lambda, also can't use string1 +
+        // string2, because javac will generate a dynamic call where invoking
+        // string1.concat(string2), so create a separate Bug8003147TestClass
+        JAXPTestUtilities.tryRunWithTmpPermission(() -> {
+            String classfile = getSystemProperty("test.classes") + "/parsers/Bug8003147TestClass.class";
+            JavaClass jc = new ClassParser(classfile).parse();
+
+            // rename class
+            ConstantPool cp = jc.getConstantPool();
+            int cpIndex = ((ConstantClass) cp.getConstant(jc.getClassNameIndex())).getNameIndex();
+            cp.setConstant(cpIndex, new ConstantUtf8("parsers/Bug8003147TestClassPrime"));
+            ClassGen gen = new ClassGen(jc);
+            Method[] methods = jc.getMethods();
+            int index;
+            for (index = 0; index < methods.length; index++) {
+                if (methods[index].getName().equals("doSomething")) {
+                    break;
+                }
+            }
+            Method m = methods[index];
+            MethodGen mg = new MethodGen(m, gen.getClassName(), gen.getConstantPool());
+            gen.replaceMethod(m, mg.getMethod());
+            String path = classfile.replace("Bug8003147TestClass", "Bug8003147TestClassPrime");
+            gen.getJavaClass().dump(new FileOutputStream(path));
+
+            try {
+                Class.forName("parsers.Bug8003147TestClassPrime");
+            } catch (ClassFormatError cfe) {
+                cfe.printStackTrace();
+                Assert.fail("modified version of class does not pass verification");
+            }
+        }, new FilePermission(getSystemProperty("test.classes") + "/-", "read,write"));
+    }
+}
+
diff --git a/hotspot/test/compiler/native/libTestDirtyInt.c b/jaxp/test/javax/xml/jaxp/unittest/parsers/Bug8003147TestClass.java
similarity index 80%
copy from hotspot/test/compiler/native/libTestDirtyInt.c
copy to jaxp/test/javax/xml/jaxp/unittest/parsers/Bug8003147TestClass.java
index b688a36..f9da512 100644
--- a/hotspot/test/compiler/native/libTestDirtyInt.c
+++ b/jaxp/test/javax/xml/jaxp/unittest/parsers/Bug8003147TestClass.java
@@ -21,13 +21,15 @@
  * questions.
  */
 
-#include "jni.h"
-#include <stdio.h>
+package parsers;
 
-static int array = 0x42;
+import java.util.ArrayList;
 
-JNIEXPORT jint JNICALL Java_TestDirtyInt_test(JNIEnv* env, jclass jclazz, jint v)
-{
-  int* ptr = &array + v + 4;
-  return *ptr;
+/*
+ * Class for Bug8003147Test, includes a method, which has a generic argument
+ */
+public class Bug8003147TestClass {
+    public void doSomething(double d, ArrayList<Integer> list) {
+    }
 }
+
diff --git a/jaxp/test/javax/xml/jaxp/unittest/parsers/Bug8073385.java b/jaxp/test/javax/xml/jaxp/unittest/parsers/Bug8073385.java
index 5a034c3..eae5319 100644
--- a/jaxp/test/javax/xml/jaxp/unittest/parsers/Bug8073385.java
+++ b/jaxp/test/javax/xml/jaxp/unittest/parsers/Bug8073385.java
@@ -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
@@ -23,37 +23,46 @@
 
 package parsers;
 
+import static jaxp.library.JAXPTestUtilities.runWithAllPerm;
+import static org.testng.Assert.assertTrue;
+
 import java.io.StringReader;
 import java.util.Locale;
-import javax.xml.parsers.DocumentBuilderFactory;
+
 import javax.xml.parsers.DocumentBuilder;
-import org.xml.sax.SAXException;
-import org.xml.sax.InputSource;
+import javax.xml.parsers.DocumentBuilderFactory;
 
 import org.testng.annotations.AfterClass;
 import org.testng.annotations.BeforeClass;
 import org.testng.annotations.DataProvider;
+import org.testng.annotations.Listeners;
 import org.testng.annotations.Test;
-import static org.testng.Assert.assertTrue;
+import org.xml.sax.InputSource;
+import org.xml.sax.SAXException;
 
 /**
+ * @test
  * @bug 8073385
+ * @library /javax/xml/jaxp/libs /javax/xml/jaxp/unittest
+ * @run testng/othervm -DrunSecMngr=true parsers.Bug8073385
+ * @run testng/othervm parsers.Bug8073385
  * @summary test that invalid XML character exception string contains
  *     information about character value, element and attribute names
  */
+@Listeners({jaxp.library.BasePolicy.class})
 public class Bug8073385 {
 
     private Locale defLoc;
 
     @BeforeClass
-    private void setup() {
+    public void setup() {
         defLoc = Locale.getDefault();
-        Locale.setDefault(Locale.ENGLISH);
+        runWithAllPerm(() -> Locale.setDefault(Locale.ENGLISH));
     }
 
     @AfterClass
-    private void cleanup() {
-        Locale.setDefault(defLoc);
+    public void cleanup() {
+        runWithAllPerm(() -> Locale.setDefault(defLoc));
     }
 
     @DataProvider(name = "illegalCharactersData")
@@ -91,3 +100,4 @@
         assertTrue(exceptionText.contains("Unicode: " + hexString));
     }
 }
+
diff --git a/jaxp/test/javax/xml/jaxp/unittest/parsers/FactoryFindTest.java b/jaxp/test/javax/xml/jaxp/unittest/parsers/FactoryFindTest.java
index 031b0fe..2a4d7c1 100644
--- a/jaxp/test/javax/xml/jaxp/unittest/parsers/FactoryFindTest.java
+++ b/jaxp/test/javax/xml/jaxp/unittest/parsers/FactoryFindTest.java
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2014, 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2014, 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
@@ -23,42 +23,44 @@
 
 package parsers;
 
+import static jaxp.library.JAXPTestUtilities.runWithAllPerm;
+
 import java.net.URL;
 import java.net.URLClassLoader;
 
 import javax.xml.parsers.SAXParserFactory;
 
 import org.testng.Assert;
+import org.testng.annotations.Listeners;
 import org.testng.annotations.Test;
 
 /*
+ * @test
+ * @library /javax/xml/jaxp/libs /javax/xml/jaxp/unittest
+ * @run testng/othervm -DrunSecMngr=true parsers.FactoryFindTest
+ * @run testng/othervm parsers.FactoryFindTest
  * @summary Test Classloader for SAXParserFactory.
  */
+@Listeners({jaxp.library.BasePolicy.class})
 public class FactoryFindTest {
 
     boolean myClassLoaderUsed = false;
 
     @Test
     public void testFactoryFind() {
-        try {
-            // System.setProperty("jaxp.debug", "true");
+        SAXParserFactory factory = SAXParserFactory.newInstance();
+        Assert.assertTrue(factory.getClass().getClassLoader() == null);
 
-            SAXParserFactory factory = SAXParserFactory.newInstance();
-            Assert.assertTrue(factory.getClass().getClassLoader() == null);
+        runWithAllPerm(() -> Thread.currentThread().setContextClassLoader(null));
+        factory = SAXParserFactory.newInstance();
+        Assert.assertTrue(factory.getClass().getClassLoader() == null);
 
-            Thread.currentThread().setContextClassLoader(null);
-            factory = SAXParserFactory.newInstance();
-            Assert.assertTrue(factory.getClass().getClassLoader() == null);
-
-            Thread.currentThread().setContextClassLoader(new MyClassLoader());
-            factory = SAXParserFactory.newInstance();
-            if (System.getSecurityManager() == null)
-                Assert.assertTrue(myClassLoaderUsed);
-            else
-                Assert.assertFalse(myClassLoaderUsed);
-        } catch (Exception ex) {
-        }
-
+        runWithAllPerm(() -> Thread.currentThread().setContextClassLoader(new MyClassLoader()));
+        factory = SAXParserFactory.newInstance();
+        if (System.getSecurityManager() == null)
+            Assert.assertTrue(myClassLoaderUsed);
+        else
+            Assert.assertFalse(myClassLoaderUsed);
     }
 
     class MyClassLoader extends URLClassLoader {
@@ -73,3 +75,4 @@
         }
     }
 }
+
diff --git a/jaxp/test/javax/xml/jaxp/unittest/parsers/MyDefaultHandler.java b/jaxp/test/javax/xml/jaxp/unittest/parsers/MyDefaultHandler.java
index c690163..52874b9 100644
--- a/jaxp/test/javax/xml/jaxp/unittest/parsers/MyDefaultHandler.java
+++ b/jaxp/test/javax/xml/jaxp/unittest/parsers/MyDefaultHandler.java
@@ -45,3 +45,4 @@
     }
 
 }
+
diff --git a/jaxp/test/javax/xml/jaxp/unittest/parsers/MyErrorHandler.java b/jaxp/test/javax/xml/jaxp/unittest/parsers/MyErrorHandler.java
index 695c932..fb01c19 100644
--- a/jaxp/test/javax/xml/jaxp/unittest/parsers/MyErrorHandler.java
+++ b/jaxp/test/javax/xml/jaxp/unittest/parsers/MyErrorHandler.java
@@ -53,3 +53,4 @@
         errorOccured = true;
     }
 }
+
diff --git a/jaxp/test/javax/xml/jaxp/unittest/parsers/ParseEmptyStream.java b/jaxp/test/javax/xml/jaxp/unittest/parsers/ParseEmptyStream.java
index a6dafcc..079f253 100644
--- a/jaxp/test/javax/xml/jaxp/unittest/parsers/ParseEmptyStream.java
+++ b/jaxp/test/javax/xml/jaxp/unittest/parsers/ParseEmptyStream.java
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2014, 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2014, 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
@@ -29,13 +29,19 @@
 import javax.xml.parsers.SAXParserFactory;
 
 import org.testng.Assert;
+import org.testng.annotations.Listeners;
 import org.testng.annotations.Test;
 import org.xml.sax.InputSource;
 import org.xml.sax.helpers.DefaultHandler;
 
 /*
+ * @test
+ * @library /javax/xml/jaxp/libs /javax/xml/jaxp/unittest
+ * @run testng/othervm -DrunSecMngr=true parsers.ParseEmptyStream
+ * @run testng/othervm parsers.ParseEmptyStream
  * @summary Test SAXParser doesn't accept empty stream.
  */
+@Listeners({jaxp.library.BasePolicy.class})
 public class ParseEmptyStream {
 
     SAXParserFactory factory = null;
@@ -86,3 +92,4 @@
     }
 
 }
+
diff --git a/jaxp/test/javax/xml/jaxp/unittest/parsers/SupplementaryChars.java b/jaxp/test/javax/xml/jaxp/unittest/parsers/SupplementaryChars.java
index 7430e03..63e2371 100644
--- a/jaxp/test/javax/xml/jaxp/unittest/parsers/SupplementaryChars.java
+++ b/jaxp/test/javax/xml/jaxp/unittest/parsers/SupplementaryChars.java
@@ -5,18 +5,24 @@
 import javax.xml.parsers.SAXParserFactory;
 
 import org.testng.annotations.DataProvider;
+import org.testng.annotations.Listeners;
 import org.testng.annotations.Test;
 import org.xml.sax.SAXParseException;
 import org.xml.sax.helpers.DefaultHandler;
 
 /**
+ * @test
  * @bug 8072081
+ * @library /javax/xml/jaxp/libs /javax/xml/jaxp/unittest
+ * @run testng/othervm -DrunSecMngr=true parsers.SupplementaryChars
+ * @run testng/othervm parsers.SupplementaryChars
  * @summary verifies that supplementary characters are supported as character
  * data in xml 1.0, and also names in xml 1.1.
  *
  * Joe Wang (huizhe.wang@oracle.com)
  */
 
+@Listeners({jaxp.library.BasePolicy.class})
 public class SupplementaryChars {
 
     @Test(dataProvider = "supported")
@@ -34,7 +40,7 @@
     }
 
     @DataProvider(name = "supported")
-    private Object[][] supported() {
+    public Object[][] supported() {
 
         return new Object[][] {
             {"<?xml version=\"1.0\"?><tag>\uD840\uDC0B</tag>"},
@@ -47,7 +53,7 @@
     }
 
     @DataProvider(name = "unsupported")
-    private Object[][] unsupported() {
+    public Object[][] unsupported() {
         return new Object[][] {
             {"<?xml version=\"1.0\"?><tag\uD840\uDC0B>in tag name</tag\uD840\uDC0B>"},
             {"<?xml version=\"1.0\"?><tag attr\uD840\uDC0B=\"in attribute\">in attribute name</tag>"}
@@ -65,3 +71,4 @@
         return parser;
     }
 }
+
diff --git a/jaxp/test/javax/xml/jaxp/unittest/parsers/xinclude/Bug6794483Test.java b/jaxp/test/javax/xml/jaxp/unittest/parsers/xinclude/Bug6794483Test.java
index 8411917..a1c83eb 100644
--- a/jaxp/test/javax/xml/jaxp/unittest/parsers/xinclude/Bug6794483Test.java
+++ b/jaxp/test/javax/xml/jaxp/unittest/parsers/xinclude/Bug6794483Test.java
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2014, 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2014, 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
@@ -37,15 +37,21 @@
 import javax.xml.transform.dom.DOMSource;
 import javax.xml.transform.stream.StreamResult;
 
+import org.testng.annotations.Listeners;
 import org.testng.annotations.Test;
 import org.w3c.dom.Document;
 import org.w3c.dom.NodeList;
 
 /*
+ * @test
  * @bug 6794483 8080908
+ * @library /javax/xml/jaxp/libs /javax/xml/jaxp/unittest
+ * @run testng/othervm -DrunSecMngr=true parsers.xinclude.Bug6794483Test
+ * @run testng/othervm parsers.xinclude.Bug6794483Test
  * @summary Test JAXP parser can resolve the included content properly if the
  * included xml contains an empty tag that ends with "/>", refer to XERCESJ-1134.
  */
+@Listeners({jaxp.library.FilePolicy.class})
 public class Bug6794483Test {
 
     @Test
@@ -101,3 +107,4 @@
 
     }
 }
+
diff --git a/jaxp/test/javax/xml/jaxp/unittest/policy/PolicyUtil.java b/jaxp/test/javax/xml/jaxp/unittest/policy/PolicyUtil.java
deleted file mode 100644
index 340f5de..0000000
--- a/jaxp/test/javax/xml/jaxp/unittest/policy/PolicyUtil.java
+++ /dev/null
@@ -1,35 +0,0 @@
-/*
- * Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-
-package policy;
-
-import java.security.Policy;
-
-public class PolicyUtil {
-
-    public static void changePolicy(String policyFile) {
-        System.setProperty("java.security.policy", policyFile);
-        Policy.getPolicy().refresh();
-    }
-
-}
diff --git a/jaxp/test/javax/xml/jaxp/unittest/policy/common.policy b/jaxp/test/javax/xml/jaxp/unittest/policy/common.policy
deleted file mode 100644
index 0ca5f74..0000000
--- a/jaxp/test/javax/xml/jaxp/unittest/policy/common.policy
+++ /dev/null
@@ -1,27 +0,0 @@
-grant {
-	permission java.lang.reflect.ReflectPermission "suppressAccessChecks";
-	permission java.lang.RuntimePermission "accessDeclaredMembers";
-	
-	permission java.io.FilePermission "${test.classes}/../../-", "read, write, delete";
-	permission java.io.FilePermission ".", "read, write, delete";
-	permission java.util.PropertyPermission "*", "read, write";
-	
-    permission java.lang.RuntimePermission "setSecurityManager";
-    permission java.lang.RuntimePermission "createSecurityManager";
-    permission java.lang.RuntimePermission "createClassLoader";
-    permission java.lang.RuntimePermission "setIO";
-	permission java.lang.RuntimePermission "setContextClassLoader"; 
-	permission java.security.SecurityPermission "getPolicy";
-    
-    permission java.io.FilePermission "${test.src}/-", "read, write, delete";
-    permission java.io.FilePermission "${user.dir}/-", "read, write, delete";
-    permission java.io.FilePermission "${java.io.tmpdir}/-", "read, write, delete";
-    
-    permission java.lang.RuntimePermission "accessClassInPackage.com.sun.org.apache.bcel.internal.classfile";
-    permission java.lang.RuntimePermission "accessClassInPackage.com.sun.org.apache.bcel.internal.generic";
-    permission java.lang.RuntimePermission "accessClassInPackage.com.sun.xml.internal.stream.writers";
-    permission java.lang.RuntimePermission "accessClassInPackage.com.sun.org.apache.xerces.internal.impl";
-    permission java.lang.RuntimePermission "accessClassInPackage.com.sun.org.apache.xalan.internal";
-    permission java.lang.RuntimePermission "accessClassInPackage.com.sun.org.apache.xalan.internal.xsltc.trax";
-	permission java.lang.RuntimePermission "accessClassInPackage.com.sun.org.apache.xalan.internal.xslt";
-};
diff --git a/jaxp/test/javax/xml/jaxp/unittest/sax/Attributes2ImplTest.java b/jaxp/test/javax/xml/jaxp/unittest/sax/Attributes2ImplTest.java
index e8a1bba..a792405 100644
--- a/jaxp/test/javax/xml/jaxp/unittest/sax/Attributes2ImplTest.java
+++ b/jaxp/test/javax/xml/jaxp/unittest/sax/Attributes2ImplTest.java
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2014, 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2014, 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
@@ -24,12 +24,18 @@
 package sax;
 
 import org.testng.Assert;
+import org.testng.annotations.Listeners;
 import org.testng.annotations.Test;
 import org.xml.sax.ext.Attributes2Impl;
 
 /*
+ * @test
+ * @library /javax/xml/jaxp/libs /javax/xml/jaxp/unittest
+ * @run testng/othervm -DrunSecMngr=true sax.Attributes2ImplTest
+ * @run testng/othervm sax.Attributes2ImplTest
  * @summary Test Attributes2Impl.
  */
+@Listeners({jaxp.library.BasePolicy.class})
 public class Attributes2ImplTest {
 
     @Test
@@ -147,3 +153,4 @@
         Assert.assertTrue(impl1.getQName(2).equals(impl3.getQName(2)));
     }
 }
+
diff --git a/jaxp/test/javax/xml/jaxp/unittest/sax/Bug6889654Test.java b/jaxp/test/javax/xml/jaxp/unittest/sax/Bug6889654Test.java
index e5043aa..651e804 100644
--- a/jaxp/test/javax/xml/jaxp/unittest/sax/Bug6889654Test.java
+++ b/jaxp/test/javax/xml/jaxp/unittest/sax/Bug6889654Test.java
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2014, 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2014, 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,15 +30,21 @@
 import javax.xml.parsers.SAXParserFactory;
 
 import org.testng.Assert;
+import org.testng.annotations.Listeners;
 import org.testng.annotations.Test;
 import org.xml.sax.InputSource;
 import org.xml.sax.SAXException;
 import org.xml.sax.helpers.DefaultHandler;
 
 /*
+ * @test
  * @bug 6889654
+ * @library /javax/xml/jaxp/libs /javax/xml/jaxp/unittest
+ * @run testng/othervm -DrunSecMngr=true sax.Bug6889654Test
+ * @run testng/othervm sax.Bug6889654Test
  * @summary Test SAXException includes whole information.
  */
+@Listeners({jaxp.library.BasePolicy.class})
 public class Bug6889654Test {
 
     final String MSG = "Failed to parse XML";
@@ -81,3 +87,4 @@
     }
 
 }
+
diff --git a/jaxp/test/javax/xml/jaxp/unittest/sax/Bug6925410Test.java b/jaxp/test/javax/xml/jaxp/unittest/sax/Bug6925410Test.java
index 5679ed6..9630304 100644
--- a/jaxp/test/javax/xml/jaxp/unittest/sax/Bug6925410Test.java
+++ b/jaxp/test/javax/xml/jaxp/unittest/sax/Bug6925410Test.java
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2014, 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2014, 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
@@ -25,14 +25,20 @@
 
 import javax.xml.datatype.DatatypeConfigurationException;
 
+import org.testng.annotations.Listeners;
 import org.testng.annotations.Test;
 import org.testng.Assert;
 import org.xml.sax.helpers.XMLReaderFactory;
 
 /*
+ * @test
  * @bug 6925410
+ * @library /javax/xml/jaxp/libs /javax/xml/jaxp/unittest
+ * @run testng/othervm -DrunSecMngr=true sax.Bug6925410Test
+ * @run testng/othervm sax.Bug6925410Test
  * @summary Test XMLReaderFactory can createXMLReader repeatedly.
  */
+@Listeners({jaxp.library.BasePolicy.class})
 public class Bug6925410Test {
 
     @Test
@@ -54,3 +60,4 @@
     }
 
 }
+
diff --git a/jaxp/test/javax/xml/jaxp/unittest/sax/Bug6949607Test.java b/jaxp/test/javax/xml/jaxp/unittest/sax/Bug6949607Test.java
index d8fd89c..7a6c861 100644
--- a/jaxp/test/javax/xml/jaxp/unittest/sax/Bug6949607Test.java
+++ b/jaxp/test/javax/xml/jaxp/unittest/sax/Bug6949607Test.java
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2014, 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2014, 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
@@ -29,15 +29,21 @@
 import javax.xml.parsers.SAXParserFactory;
 
 import org.testng.Assert;
+import org.testng.annotations.Listeners;
 import org.testng.annotations.Test;
 import org.xml.sax.Attributes;
 import org.xml.sax.SAXException;
 import org.xml.sax.helpers.DefaultHandler;
 
 /*
+ * @test
  * @bug 6949607
+ * @library /javax/xml/jaxp/libs /javax/xml/jaxp/unittest
+ * @run testng/othervm -DrunSecMngr=true sax.Bug6949607Test
+ * @run testng/othervm sax.Bug6949607Test
  * @summary Test Attributes.getValue returns null when parameter uri is empty.
  */
+@Listeners({jaxp.library.BasePolicy.class})
 public class Bug6949607Test {
 
     final String MSG = "Failed to parse XML";
@@ -75,3 +81,4 @@
     }
 
 }
+
diff --git a/jaxp/test/javax/xml/jaxp/unittest/sax/Bug6992561Test.java b/jaxp/test/javax/xml/jaxp/unittest/sax/Bug6992561Test.java
index d82fe10..47f0765 100644
--- a/jaxp/test/javax/xml/jaxp/unittest/sax/Bug6992561Test.java
+++ b/jaxp/test/javax/xml/jaxp/unittest/sax/Bug6992561Test.java
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2014, 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2014, 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
@@ -31,6 +31,7 @@
 import javax.xml.parsers.SAXParserFactory;
 
 import org.testng.Assert;
+import org.testng.annotations.Listeners;
 import org.testng.annotations.Test;
 import org.xml.sax.ContentHandler;
 import org.xml.sax.InputSource;
@@ -40,9 +41,14 @@
 import org.xml.sax.helpers.DefaultHandler;
 
 /*
+ * @test
  * @bug 6992561
+ * @library /javax/xml/jaxp/libs /javax/xml/jaxp/unittest
+ * @run testng/othervm -DrunSecMngr=true sax.Bug6992561Test
+ * @run testng/othervm sax.Bug6992561Test
  * @summary Test encoding of SystemId in Locator.
  */
+@Listeners({jaxp.library.BasePolicy.class})
 public class Bug6992561Test {
 
     @Test
@@ -80,3 +86,4 @@
     }
 
 }
+
diff --git a/jaxp/test/javax/xml/jaxp/unittest/sax/Bug7057778Test.java b/jaxp/test/javax/xml/jaxp/unittest/sax/Bug7057778Test.java
index 7780976..198ade3 100644
--- a/jaxp/test/javax/xml/jaxp/unittest/sax/Bug7057778Test.java
+++ b/jaxp/test/javax/xml/jaxp/unittest/sax/Bug7057778Test.java
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2014, 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2014, 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
@@ -23,6 +23,9 @@
 
 package sax;
 
+import static jaxp.library.JAXPTestUtilities.getSystemProperty;
+import static jaxp.library.JAXPTestUtilities.tryRunWithTmpPermission;
+
 import java.io.File;
 import java.io.FileInputStream;
 import java.io.FileNotFoundException;
@@ -33,13 +36,15 @@
 import java.io.OutputStreamWriter;
 import java.io.UnsupportedEncodingException;
 import java.io.Writer;
+import java.util.PropertyPermission;
 
 import javax.xml.parsers.ParserConfigurationException;
 import javax.xml.parsers.SAXParser;
 import javax.xml.parsers.SAXParserFactory;
 
-import org.testng.annotations.Test;
 import org.testng.Assert;
+import org.testng.annotations.Listeners;
+import org.testng.annotations.Test;
 import org.xml.sax.Attributes;
 import org.xml.sax.ErrorHandler;
 import org.xml.sax.SAXException;
@@ -48,9 +53,14 @@
 import org.xml.sax.ext.DefaultHandler2;
 
 /*
+ * @test
  * @bug 7057778
+ * @library /javax/xml/jaxp/libs /javax/xml/jaxp/unittest
+ * @run testng/othervm -DrunSecMngr=true sax.Bug7057778Test
+ * @run testng/othervm sax.Bug7057778Test
  * @summary Test the file can be deleted after SAXParser.parse(File, DefaultHandler).
  */
+@Listeners({jaxp.library.FilePolicy.class})
 public class Bug7057778Test {
 
     static final String xml = "Bug7057778.xml";
@@ -59,20 +69,22 @@
     @Test
     public void testParse() {
         File src = new File(getClass().getResource(xml).getFile());
-        File dst = new File(src.getParent() + File.separator + xml1);
+        File dst = new File(xml1);
         try {
             copyFile(src, dst);
             SAXParserFactory spf = SAXParserFactory.newInstance();
             SAXParser parser = spf.newSAXParser();
             XMLReader xmlReader = parser.getXMLReader();
             xmlReader.setProperty("http://xml.org/sax/properties/lexical-handler", new MyHandler1());
-            parser.parse(dst, new MyHandler1());
+            tryRunWithTmpPermission(() -> parser.parse(dst, new MyHandler1()),
+                    new PropertyPermission("user.dir", "read"));
         } catch (SAXException ex) {
             ex.printStackTrace();
         } catch (IOException ex) {
             // shouldn't happen
         } catch (ParserConfigurationException ex) {
             // shouldn't happen
+        } catch (Exception ex) {
         }
         if (dst != null) {
             if (dst.delete()) {
@@ -173,7 +185,7 @@
         // Start a new line
         // and indent the next line appropriately
         private void nl() throws SAXException {
-            String lineEnd = System.getProperty("line.separator");
+            String lineEnd = getSystemProperty("line.separator");
 
             try {
                 out.write(lineEnd);
@@ -187,3 +199,4 @@
 
     }
 }
+
diff --git a/jaxp/test/javax/xml/jaxp/unittest/sax/DefaultHandler2Test.java b/jaxp/test/javax/xml/jaxp/unittest/sax/DefaultHandler2Test.java
index 15205d7..7d3ff8c 100644
--- a/jaxp/test/javax/xml/jaxp/unittest/sax/DefaultHandler2Test.java
+++ b/jaxp/test/javax/xml/jaxp/unittest/sax/DefaultHandler2Test.java
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2014, 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2014, 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
@@ -31,6 +31,7 @@
 
 import org.testng.Assert;
 import org.testng.AssertJUnit;
+import org.testng.annotations.Listeners;
 import org.testng.annotations.Test;
 import org.xml.sax.SAXException;
 import org.xml.sax.SAXNotRecognizedException;
@@ -42,8 +43,13 @@
 import org.xml.sax.helpers.XMLReaderFactory;
 
 /*
+ * @test
+ * @library /javax/xml/jaxp/libs /javax/xml/jaxp/unittest
+ * @run testng/othervm -DrunSecMngr=true sax.DefaultHandler2Test
+ * @run testng/othervm sax.DefaultHandler2Test
  * @summary Test DefaultHandler2.
  */
+@Listeners({jaxp.library.FilePolicy.class})
 public class DefaultHandler2Test {
 
     @Test
@@ -245,3 +251,4 @@
         }
     }
 }
+
diff --git a/jaxp/test/javax/xml/jaxp/unittest/sax/IssueTracker56Test.java b/jaxp/test/javax/xml/jaxp/unittest/sax/IssueTracker56Test.java
index b5a4647..6c52f6d 100644
--- a/jaxp/test/javax/xml/jaxp/unittest/sax/IssueTracker56Test.java
+++ b/jaxp/test/javax/xml/jaxp/unittest/sax/IssueTracker56Test.java
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2014, 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2014, 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
@@ -31,6 +31,7 @@
 import javax.xml.parsers.SAXParserFactory;
 
 import org.testng.Assert;
+import org.testng.annotations.Listeners;
 import org.testng.annotations.Test;
 import org.xml.sax.Attributes;
 import org.xml.sax.ErrorHandler;
@@ -39,9 +40,14 @@
 import org.xml.sax.helpers.DefaultHandler;
 
 /*
+ * @test
  * @bug 6809409
+ * @library /javax/xml/jaxp/libs /javax/xml/jaxp/unittest
+ * @run testng/othervm -DrunSecMngr=true sax.IssueTracker56Test
+ * @run testng/othervm sax.IssueTracker56Test
  * @summary Test SAXException has Cause.
  */
+@Listeners({jaxp.library.BasePolicy.class})
 public class IssueTracker56Test {
 
     @Test
@@ -136,3 +142,4 @@
 
     }
 }
+
diff --git a/jaxp/test/javax/xml/jaxp/unittest/sax/MyDefaultHandler2.java b/jaxp/test/javax/xml/jaxp/unittest/sax/MyDefaultHandler2.java
index 44ac9fd..b36ae9a 100644
--- a/jaxp/test/javax/xml/jaxp/unittest/sax/MyDefaultHandler2.java
+++ b/jaxp/test/javax/xml/jaxp/unittest/sax/MyDefaultHandler2.java
@@ -198,3 +198,4 @@
     }
 
 }
+
diff --git a/jaxp/test/javax/xml/jaxp/unittest/sax/NSSupportTest.java b/jaxp/test/javax/xml/jaxp/unittest/sax/NSSupportTest.java
index c04ecc7..4ade4a8 100644
--- a/jaxp/test/javax/xml/jaxp/unittest/sax/NSSupportTest.java
+++ b/jaxp/test/javax/xml/jaxp/unittest/sax/NSSupportTest.java
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2014, 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2014, 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,18 @@
 
 import org.testng.Assert;
 import org.testng.AssertJUnit;
+import org.testng.annotations.Listeners;
 import org.testng.annotations.Test;
 import org.xml.sax.helpers.NamespaceSupport;
 
 /*
+ * @test
+ * @library /javax/xml/jaxp/libs /javax/xml/jaxp/unittest
+ * @run testng/othervm -DrunSecMngr=true sax.NSSupportTest
+ * @run testng/othervm sax.NSSupportTest
  * @summary Test NamespaceSupport.
  */
+@Listeners({jaxp.library.BasePolicy.class})
 public class NSSupportTest {
 
     @Test
@@ -226,3 +232,4 @@
         Assert.assertNull(nssupport.getURI(""));
     }
 }
+
diff --git a/jaxp/test/javax/xml/jaxp/unittest/sax/SAXExceptionExt.java b/jaxp/test/javax/xml/jaxp/unittest/sax/SAXExceptionExt.java
index 9b9800d..a4c0e18 100644
--- a/jaxp/test/javax/xml/jaxp/unittest/sax/SAXExceptionExt.java
+++ b/jaxp/test/javax/xml/jaxp/unittest/sax/SAXExceptionExt.java
@@ -38,3 +38,4 @@
     }
 
 }
+
diff --git a/jaxp/test/javax/xml/jaxp/unittest/sax/XMLReaderTest.java b/jaxp/test/javax/xml/jaxp/unittest/sax/XMLReaderTest.java
index 5b01204..73c92da 100644
--- a/jaxp/test/javax/xml/jaxp/unittest/sax/XMLReaderTest.java
+++ b/jaxp/test/javax/xml/jaxp/unittest/sax/XMLReaderTest.java
@@ -23,18 +23,27 @@
 
 package sax;
 
+import static jaxp.library.JAXPTestUtilities.clearSystemProperty;
+import static jaxp.library.JAXPTestUtilities.setSystemProperty;
 
 import javax.xml.parsers.ParserConfigurationException;
 import javax.xml.parsers.SAXParserFactory;
+
 import org.testng.annotations.AfterClass;
+import org.testng.annotations.Listeners;
 import org.testng.annotations.Test;
 import org.xml.sax.SAXException;
 import org.xml.sax.helpers.XMLReaderAdapter;
 
 /*
+ * @test
  * @bug 8158246
+ * @library /javax/xml/jaxp/libs /javax/xml/jaxp/unittest
+ * @run testng/othervm -DrunSecMngr=true sax.XMLReaderTest
+ * @run testng/othervm sax.XMLReaderTest
  * @summary This class contains tests that cover the creation of XMLReader.
  */
+@Listeners({jaxp.library.BasePolicy.class})
 public class XMLReaderTest {
     private final String SAX_PROPNAME = "org.xml.sax.driver";
 
@@ -43,7 +52,7 @@
      */
     @AfterClass
     public void cleanUp() throws Exception {
-        System.clearProperty(SAX_PROPNAME);
+        clearSystemProperty(SAX_PROPNAME);
     }
 
     /*
@@ -57,7 +66,8 @@
     public void testcreateXMLReader() throws SAXException, ParserConfigurationException {
         String className = SAXParserFactory.newInstance().newSAXParser()
                             .getXMLReader().getClass().getName();
-        System.setProperty(SAX_PROPNAME, className + "nosuch");
+        setSystemProperty(SAX_PROPNAME, className + "nosuch");
         XMLReaderAdapter adapter = new XMLReaderAdapter();
     }
 }
+
diff --git a/jaxp/test/javax/xml/jaxp/unittest/stream/AttributeLocalNameTest/AttributeLocalNameTest.java b/jaxp/test/javax/xml/jaxp/unittest/stream/AttributeLocalNameTest/AttributeLocalNameTest.java
index 01d54e0..f9dbc0d 100644
--- a/jaxp/test/javax/xml/jaxp/unittest/stream/AttributeLocalNameTest/AttributeLocalNameTest.java
+++ b/jaxp/test/javax/xml/jaxp/unittest/stream/AttributeLocalNameTest/AttributeLocalNameTest.java
@@ -30,11 +30,17 @@
 import javax.xml.stream.XMLStreamReader;
 
 import org.testng.Assert;
+import org.testng.annotations.Listeners;
 import org.testng.annotations.Test;
 
 /*
+ * @test
+ * @library /javax/xml/jaxp/libs /javax/xml/jaxp/unittest
+ * @run testng/othervm -DrunSecMngr=true stream.AttributeLocalNameTest.AttributeLocalNameTest
+ * @run testng/othervm stream.AttributeLocalNameTest.AttributeLocalNameTest
  * @summary Test XMLStreamReader.getAttributeLocalName().
  */
+@Listeners({jaxp.library.BasePolicy.class})
 public class AttributeLocalNameTest {
 
     static final String XML = "<?xml version=\"1.0\"?>" + "<S:Envelope foo=\"bar\" xmlns:S=\"http://schemas.xmlsoap.org/soap/envelope/\"></S:Envelope>";
@@ -60,3 +66,4 @@
         }
     }
 }
+
diff --git a/jaxp/test/javax/xml/jaxp/unittest/stream/Bug6370703.java b/jaxp/test/javax/xml/jaxp/unittest/stream/Bug6370703.java
index f386e5d..97cf829 100644
--- a/jaxp/test/javax/xml/jaxp/unittest/stream/Bug6370703.java
+++ b/jaxp/test/javax/xml/jaxp/unittest/stream/Bug6370703.java
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2014, 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2014, 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,18 @@
 import javax.xml.stream.XMLStreamReader;
 
 import org.testng.Assert;
+import org.testng.annotations.Listeners;
 import org.testng.annotations.Test;
 
 /*
+ * @test
  * @bug 6370703
+ * @library /javax/xml/jaxp/libs /javax/xml/jaxp/unittest
+ * @run testng/othervm -DrunSecMngr=true stream.Bug6370703
+ * @run testng/othervm stream.Bug6370703
  * @summary Test StAX parser can parse attribute default value when START_ELEMENT.
  */
+@Listeners({jaxp.library.FilePolicy.class})
 public class Bug6370703 {
 
     private static String INPUT_FILE = "sgml.xml";
@@ -63,3 +69,4 @@
     }
 
 }
+
diff --git a/jaxp/test/javax/xml/jaxp/unittest/stream/Bug6378422.java b/jaxp/test/javax/xml/jaxp/unittest/stream/Bug6378422.java
index f273d1f..8848cb4 100644
--- a/jaxp/test/javax/xml/jaxp/unittest/stream/Bug6378422.java
+++ b/jaxp/test/javax/xml/jaxp/unittest/stream/Bug6378422.java
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2014, 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2014, 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,12 +26,18 @@
 import javax.xml.stream.XMLInputFactory;
 
 import org.testng.Assert;
+import org.testng.annotations.Listeners;
 import org.testng.annotations.Test;
 
 /*
+ * @test
  * @bug 6378422
+ * @library /javax/xml/jaxp/libs /javax/xml/jaxp/unittest
+ * @run testng/othervm -DrunSecMngr=true stream.Bug6378422
+ * @run testng/othervm stream.Bug6378422
  * @summary Test setting reuse-instance property on StAX factory.
  */
+@Listeners({jaxp.library.BasePolicy.class})
 public class Bug6378422 {
 
     @Test
@@ -45,3 +51,4 @@
         }
     }
 }
+
diff --git a/jaxp/test/javax/xml/jaxp/unittest/stream/Bug6380870.java b/jaxp/test/javax/xml/jaxp/unittest/stream/Bug6380870.java
index 8eb6a7f..6ad9bfc 100644
--- a/jaxp/test/javax/xml/jaxp/unittest/stream/Bug6380870.java
+++ b/jaxp/test/javax/xml/jaxp/unittest/stream/Bug6380870.java
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2014, 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2014, 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,18 @@
 import javax.xml.stream.XMLStreamReader;
 
 import org.testng.Assert;
+import org.testng.annotations.Listeners;
 import org.testng.annotations.Test;
 
 /*
+ * @test
  * @bug 6380870
+ * @library /javax/xml/jaxp/libs /javax/xml/jaxp/unittest
+ * @run testng/othervm -DrunSecMngr=true stream.Bug6380870
+ * @run testng/othervm stream.Bug6380870
  * @summary Test StAX parser can parse VoiceXML DTD.
  */
+@Listeners({jaxp.library.FilePolicy.class})
 public class Bug6380870 {
 
     private static String INPUT_FILE = "basic-form.vxml";
@@ -52,3 +58,4 @@
         }
     }
 }
+
diff --git a/jaxp/test/javax/xml/jaxp/unittest/stream/Bug6489502.java b/jaxp/test/javax/xml/jaxp/unittest/stream/Bug6489502.java
index 9cc264a..39cdcb0 100644
--- a/jaxp/test/javax/xml/jaxp/unittest/stream/Bug6489502.java
+++ b/jaxp/test/javax/xml/jaxp/unittest/stream/Bug6489502.java
@@ -30,12 +30,18 @@
 import javax.xml.stream.XMLStreamReader;
 
 import org.testng.Assert;
+import org.testng.annotations.Listeners;
 import org.testng.annotations.Test;
 
 /*
+ * @test
  * @bug 6489502
+ * @library /javax/xml/jaxp/libs /javax/xml/jaxp/unittest
+ * @run testng/othervm -DrunSecMngr=true stream.Bug6489502
+ * @run testng/othervm stream.Bug6489502
  * @summary Test XMLInputFactory works correctly in case it repeats to create reader.
  */
+@Listeners({jaxp.library.BasePolicy.class})
 public class Bug6489502 {
 
     public java.io.File input;
@@ -77,3 +83,4 @@
         }
     }
 }
+
diff --git a/jaxp/test/javax/xml/jaxp/unittest/stream/Bug6509774.java b/jaxp/test/javax/xml/jaxp/unittest/stream/Bug6509774.java
index b92f4bf..54eeb8b 100644
--- a/jaxp/test/javax/xml/jaxp/unittest/stream/Bug6509774.java
+++ b/jaxp/test/javax/xml/jaxp/unittest/stream/Bug6509774.java
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2014, 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2014, 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
@@ -28,12 +28,18 @@
 import javax.xml.stream.XMLStreamReader;
 
 import org.testng.Assert;
+import org.testng.annotations.Listeners;
 import org.testng.annotations.Test;
 
 /*
+ * @test
  * @bug 6509774
+ * @library /javax/xml/jaxp/libs /javax/xml/jaxp/unittest
+ * @run testng/othervm -DrunSecMngr=true stream.Bug6509774
+ * @run testng/othervm stream.Bug6509774
  * @summary Test Property javax.xml.stream.supportDTD, DTD events are now returned even if supportDTD=false.
  */
+@Listeners({jaxp.library.FilePolicy.class})
 public class Bug6509774 {
 
     @Test
@@ -168,3 +174,4 @@
     }
 
 }
+
diff --git a/jaxp/test/javax/xml/jaxp/unittest/stream/Bug6688002Test.java b/jaxp/test/javax/xml/jaxp/unittest/stream/Bug6688002Test.java
index 57bb97e..dca27be 100644
--- a/jaxp/test/javax/xml/jaxp/unittest/stream/Bug6688002Test.java
+++ b/jaxp/test/javax/xml/jaxp/unittest/stream/Bug6688002Test.java
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2014, 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2014, 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,12 +34,18 @@
 import javax.xml.stream.XMLStreamWriter;
 
 import org.testng.Assert;
+import org.testng.annotations.Listeners;
 import org.testng.annotations.Test;
 
 /*
+ * @test
  * @bug 6688002
+ * @library /javax/xml/jaxp/libs /javax/xml/jaxp/unittest
+ * @run testng/othervm -DrunSecMngr=true stream.Bug6688002Test
+ * @run testng/othervm stream.Bug6688002Test
  * @summary Test single instance of XMLOutputFactory/XMLInputFactory create multiple Writer/Readers in parallel.
  */
+@Listeners({jaxp.library.FilePolicy.class})
 public class Bug6688002Test {
 
     private static final XMLOutputFactory outputFactory = XMLOutputFactory.newInstance();
@@ -107,3 +113,4 @@
     }
 
 }
+
diff --git a/jaxp/test/javax/xml/jaxp/unittest/stream/Bug6976938Test.java b/jaxp/test/javax/xml/jaxp/unittest/stream/Bug6976938Test.java
index ac31746..a3f09aa 100644
--- a/jaxp/test/javax/xml/jaxp/unittest/stream/Bug6976938Test.java
+++ b/jaxp/test/javax/xml/jaxp/unittest/stream/Bug6976938Test.java
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2014, 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2014, 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
@@ -31,12 +31,18 @@
 import javax.xml.stream.events.XMLEvent;
 
 import org.testng.Assert;
+import org.testng.annotations.Listeners;
 import org.testng.annotations.Test;
 
 /*
+ * @test
  * @bug 6976938
+ * @library /javax/xml/jaxp/libs /javax/xml/jaxp/unittest
+ * @run testng/othervm -DrunSecMngr=true stream.Bug6976938Test
+ * @run testng/othervm stream.Bug6976938Test
  * @summary Test StAX parser won't throw StackOverflowError while reading valid XML file, in case the text content of an XML element contains many lines like "&lt; ... &gt;".
  */
+@Listeners({jaxp.library.FilePolicy.class})
 public class Bug6976938Test {
 
     private static final String INPUT_FILE = "Bug6976938.xml";
@@ -94,3 +100,4 @@
     }
 
 }
+
diff --git a/jaxp/test/javax/xml/jaxp/unittest/stream/CoalesceTest/CoalesceTest.java b/jaxp/test/javax/xml/jaxp/unittest/stream/CoalesceTest/CoalesceTest.java
index 70f286c..0b00c3c6 100644
--- a/jaxp/test/javax/xml/jaxp/unittest/stream/CoalesceTest/CoalesceTest.java
+++ b/jaxp/test/javax/xml/jaxp/unittest/stream/CoalesceTest/CoalesceTest.java
@@ -32,11 +32,17 @@
 import javax.xml.stream.XMLStreamReader;
 
 import org.testng.Assert;
+import org.testng.annotations.Listeners;
 import org.testng.annotations.Test;
 
 /*
+ * @test
+ * @library /javax/xml/jaxp/libs /javax/xml/jaxp/unittest
+ * @run testng/othervm -DrunSecMngr=true stream.CoalesceTest.CoalesceTest
+ * @run testng/othervm stream.CoalesceTest.CoalesceTest
  * @summary Test Coalesce property works.
  */
+@Listeners({jaxp.library.FilePolicy.class})
 public class CoalesceTest {
 
     String countryElementContent = "START India  CS}}}}}} India END";
@@ -104,3 +110,4 @@
     }
 
 }
+
diff --git a/jaxp/test/javax/xml/jaxp/unittest/stream/EntitiesTest/EntityTest.java b/jaxp/test/javax/xml/jaxp/unittest/stream/EntitiesTest/EntityTest.java
index aa72e3f..b7947fd 100644
--- a/jaxp/test/javax/xml/jaxp/unittest/stream/EntitiesTest/EntityTest.java
+++ b/jaxp/test/javax/xml/jaxp/unittest/stream/EntitiesTest/EntityTest.java
@@ -37,18 +37,24 @@
 import org.testng.Assert;
 import org.testng.annotations.AfterMethod;
 import org.testng.annotations.BeforeMethod;
+import org.testng.annotations.Listeners;
 import org.testng.annotations.Test;
 
 /*
+ * @test
+ * @library /javax/xml/jaxp/libs /javax/xml/jaxp/unittest
+ * @run testng/othervm -DrunSecMngr=true stream.EntitiesTest.EntityTest
+ * @run testng/othervm stream.EntitiesTest.EntityTest
  * @summary Test StAX parses entity.
  */
+@Listeners({jaxp.library.FilePolicy.class})
 public class EntityTest {
 
     XMLInputFactory factory = null;
     String output = "";
 
     @BeforeMethod
-    protected void setUp() {
+    public void setUp() {
         try {
             factory = XMLInputFactory.newInstance();
         } catch (Exception ex) {
@@ -57,7 +63,7 @@
     }
 
     @AfterMethod
-    protected void tearDown() {
+    public void tearDown() {
         factory = null;
     }
 
@@ -173,3 +179,4 @@
         return true;
     }
 }
+
diff --git a/jaxp/test/javax/xml/jaxp/unittest/stream/EventReaderDelegateTest.java b/jaxp/test/javax/xml/jaxp/unittest/stream/EventReaderDelegateTest.java
index b314ff7..87246eb 100644
--- a/jaxp/test/javax/xml/jaxp/unittest/stream/EventReaderDelegateTest.java
+++ b/jaxp/test/javax/xml/jaxp/unittest/stream/EventReaderDelegateTest.java
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2014, 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2014, 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
@@ -23,6 +23,7 @@
 
 package stream;
 
+import org.testng.annotations.Listeners;
 import org.testng.annotations.Test;
 import org.testng.Assert;
 
@@ -39,8 +40,13 @@
 import javax.xml.stream.util.EventReaderDelegate;
 
 /*
+ * @test
+ * @library /javax/xml/jaxp/libs /javax/xml/jaxp/unittest
+ * @run testng/othervm -DrunSecMngr=true stream.EventReaderDelegateTest
+ * @run testng/othervm stream.EventReaderDelegateTest
  * @summary Test EventReaderDelegate.
  */
+@Listeners({jaxp.library.FilePolicy.class})
 public class EventReaderDelegateTest {
 
     public EventReaderDelegateTest(String name) {
@@ -225,3 +231,4 @@
 
     }
 }
+
diff --git a/jaxp/test/javax/xml/jaxp/unittest/stream/EventsTest/Issue41Test.java b/jaxp/test/javax/xml/jaxp/unittest/stream/EventsTest/Issue41Test.java
index 738f4e33..56f97c5 100644
--- a/jaxp/test/javax/xml/jaxp/unittest/stream/EventsTest/Issue41Test.java
+++ b/jaxp/test/javax/xml/jaxp/unittest/stream/EventsTest/Issue41Test.java
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2014, 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2014, 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,18 @@
 import javax.xml.stream.events.XMLEvent;
 
 import org.testng.Assert;
+import org.testng.annotations.Listeners;
 import org.testng.annotations.Test;
 
 /*
+ * @test
  * @bug 6631268
+ * @library /javax/xml/jaxp/libs /javax/xml/jaxp/unittest
+ * @run testng/othervm -DrunSecMngr=true stream.EventsTest.Issue41Test
+ * @run testng/othervm stream.EventsTest.Issue41Test
  * @summary Test XMLEvent.writeAsEncodedUnicode can output the event content.
  */
+@Listeners({jaxp.library.BasePolicy.class})
 public class Issue41Test {
 
     public java.io.File input;
@@ -172,3 +178,4 @@
         System.out.println(sw.toString());
     }
 }
+
diff --git a/jaxp/test/javax/xml/jaxp/unittest/stream/EventsTest/Issue48Test.java b/jaxp/test/javax/xml/jaxp/unittest/stream/EventsTest/Issue48Test.java
index b567302..4d3b144 100644
--- a/jaxp/test/javax/xml/jaxp/unittest/stream/EventsTest/Issue48Test.java
+++ b/jaxp/test/javax/xml/jaxp/unittest/stream/EventsTest/Issue48Test.java
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2014, 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2014, 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
@@ -37,12 +37,18 @@
 import javax.xml.stream.events.XMLEvent;
 
 import org.testng.Assert;
+import org.testng.annotations.Listeners;
 import org.testng.annotations.Test;
 
 /*
+ * @test
  * @bug 6620632
+ * @library /javax/xml/jaxp/libs /javax/xml/jaxp/unittest
+ * @run testng/othervm -DrunSecMngr=true stream.EventsTest.Issue48Test
+ * @run testng/othervm stream.EventsTest.Issue48Test
  * @summary Test XMLEventReader can parse notation and entity information from DTD Event.
  */
+@Listeners({jaxp.library.BasePolicy.class})
 public class Issue48Test {
 
     public java.io.File input;
@@ -109,3 +115,4 @@
     }
 
 }
+
diff --git a/jaxp/test/javax/xml/jaxp/unittest/stream/EventsTest/Issue53Test.java b/jaxp/test/javax/xml/jaxp/unittest/stream/EventsTest/Issue53Test.java
index 7193d27..1e30efb 100644
--- a/jaxp/test/javax/xml/jaxp/unittest/stream/EventsTest/Issue53Test.java
+++ b/jaxp/test/javax/xml/jaxp/unittest/stream/EventsTest/Issue53Test.java
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2014, 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2014, 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,11 +27,17 @@
 import javax.xml.stream.events.StartDocument;
 
 import org.testng.Assert;
+import org.testng.annotations.Listeners;
 import org.testng.annotations.Test;
 
 /*
+ * @test
+ * @library /javax/xml/jaxp/libs /javax/xml/jaxp/unittest
+ * @run testng/othervm -DrunSecMngr=true stream.EventsTest.Issue53Test
+ * @run testng/othervm stream.EventsTest.Issue53Test
  * @summary Test encodingSet/standaloneSet returns correct result in case encoding/standalone is set when constructing StartDocument.
  */
+@Listeners({jaxp.library.BasePolicy.class})
 public class Issue53Test {
 
     @Test
@@ -65,3 +71,4 @@
     }
 
 }
+
diff --git a/jaxp/test/javax/xml/jaxp/unittest/stream/EventsTest/Issue58Test.java b/jaxp/test/javax/xml/jaxp/unittest/stream/EventsTest/Issue58Test.java
index 3c46741..8e00999 100644
--- a/jaxp/test/javax/xml/jaxp/unittest/stream/EventsTest/Issue58Test.java
+++ b/jaxp/test/javax/xml/jaxp/unittest/stream/EventsTest/Issue58Test.java
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2014, 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2014, 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
@@ -32,11 +32,17 @@
 import javax.xml.stream.events.XMLEvent;
 
 import org.testng.Assert;
+import org.testng.annotations.Listeners;
 import org.testng.annotations.Test;
 
 /*
+ * @test
+ * @library /javax/xml/jaxp/libs /javax/xml/jaxp/unittest
+ * @run testng/othervm -DrunSecMngr=true stream.EventsTest.Issue58Test
+ * @run testng/othervm stream.EventsTest.Issue58Test
  * @summary Test XMLEvent.getLocation() returns a non-volatile Location.
  */
+@Listeners({jaxp.library.BasePolicy.class})
 public class Issue58Test {
 
     public java.io.File input;
@@ -78,3 +84,4 @@
     }
 
 }
+
diff --git a/jaxp/test/javax/xml/jaxp/unittest/stream/FactoryFindTest.java b/jaxp/test/javax/xml/jaxp/unittest/stream/FactoryFindTest.java
index f016df3..8e908b0 100644
--- a/jaxp/test/javax/xml/jaxp/unittest/stream/FactoryFindTest.java
+++ b/jaxp/test/javax/xml/jaxp/unittest/stream/FactoryFindTest.java
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2014, 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2014, 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
@@ -23,6 +23,9 @@
 
 package stream;
 
+import static jaxp.library.JAXPTestUtilities.getSystemProperty;
+import static jaxp.library.JAXPTestUtilities.runWithAllPerm;
+
 import java.io.File;
 import java.io.FileInputStream;
 import java.io.FileNotFoundException;
@@ -36,33 +39,38 @@
 import javax.xml.stream.XMLOutputFactory;
 
 import org.testng.Assert;
-import org.testng.annotations.BeforeClass;
+import org.testng.annotations.Listeners;
 import org.testng.annotations.Test;
 
 /*
+ * @test
+ * @library /javax/xml/jaxp/libs /javax/xml/jaxp/unittest
+ * @run testng/othervm -DrunSecMngr=true stream.FactoryFindTest
+ * @run testng/othervm stream.FactoryFindTest
  * @summary Test SaTX factory using factory property and using ContextClassLoader.
  */
+@Listeners({jaxp.library.FilePolicy.class})
 public class FactoryFindTest {
 
     boolean myClassLoaderUsed = false;
 
     final static String FACTORY_KEY = "javax.xml.stream.XMLInputFactory";
 
-    @BeforeClass
-    public void setup(){
-        policy.PolicyUtil.changePolicy(getClass().getResource("FactoryFindTest.policy").getFile());
-    }
+//    @BeforeClass
+//    public void setup(){
+//        policy.PolicyUtil.changePolicy(getClass().getResource("FactoryFindTest.policy").getFile());
+//    }
 
-    @Test
+    @Test(enabled=false) // due to 8156508
     public void testFactoryFindUsingStaxProperties() {
         // If property is defined, will take precendence so this test
         // is ignored :(
-        if (System.getProperty(FACTORY_KEY) != null) {
+        if (getSystemProperty(FACTORY_KEY) != null) {
             return;
         }
 
         Properties props = new Properties();
-        String configFile = System.getProperty("java.home") + File.separator + "lib" + File.separator + "stax.properties";
+        String configFile = getSystemProperty("java.home") + File.separator + "lib" + File.separator + "stax.properties";
 
         File f = new File(configFile);
         if (f.exists()) {
@@ -96,17 +104,18 @@
     @Test
     public void testFactoryFind() {
         try {
-            // System.setProperty("jaxp.debug", "true");
+            // setSystemProperty("jaxp.debug", "true");
 
             XMLInputFactory factory = XMLInputFactory.newInstance();
             Assert.assertTrue(factory.getClass().getClassLoader() == null);
 
-            Thread.currentThread().setContextClassLoader(null);
+            runWithAllPerm(() -> Thread.currentThread().setContextClassLoader(null));
             factory = XMLInputFactory.newInstance();
             Assert.assertTrue(factory.getClass().getClassLoader() == null);
 
-            Thread.currentThread().setContextClassLoader(new MyClassLoader());
+            runWithAllPerm(() -> Thread.currentThread().setContextClassLoader(new MyClassLoader()));
             factory = XMLInputFactory.newInstance();
+            // because it's decided by having sm or not in FactoryFind code
             if (System.getSecurityManager() == null)
                 Assert.assertTrue(myClassLoaderUsed);
             else
@@ -115,11 +124,11 @@
             XMLOutputFactory ofactory = XMLOutputFactory.newInstance();
             Assert.assertTrue(ofactory.getClass().getClassLoader() == null);
 
-            Thread.currentThread().setContextClassLoader(null);
+            runWithAllPerm(() -> Thread.currentThread().setContextClassLoader(null));
             ofactory = XMLOutputFactory.newInstance();
             Assert.assertTrue(ofactory.getClass().getClassLoader() == null);
 
-            Thread.currentThread().setContextClassLoader(new MyClassLoader());
+            runWithAllPerm(() -> Thread.currentThread().setContextClassLoader(new MyClassLoader()));
             ofactory = XMLOutputFactory.newInstance();
             if (System.getSecurityManager() == null)
                 Assert.assertTrue(myClassLoaderUsed);
@@ -142,3 +151,4 @@
         }
     }
 }
+
diff --git a/jaxp/test/javax/xml/jaxp/unittest/stream/IgnoreExternalDTDTest.java b/jaxp/test/javax/xml/jaxp/unittest/stream/IgnoreExternalDTDTest.java
index 5475cba..44708b2 100644
--- a/jaxp/test/javax/xml/jaxp/unittest/stream/IgnoreExternalDTDTest.java
+++ b/jaxp/test/javax/xml/jaxp/unittest/stream/IgnoreExternalDTDTest.java
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2014, 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2014, 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,11 +30,17 @@
 import javax.xml.stream.XMLStreamException;
 import javax.xml.stream.XMLStreamReader;
 
+import org.testng.annotations.Listeners;
 import org.testng.annotations.Test;
 
 /*
+ * @test
+ * @library /javax/xml/jaxp/libs /javax/xml/jaxp/unittest
+ * @run testng/othervm -DrunSecMngr=true stream.IgnoreExternalDTDTest
+ * @run testng/othervm stream.IgnoreExternalDTDTest
  * @summary Test feature ignore-external-dtd.
  */
+@Listeners({jaxp.library.FilePolicy.class})
 public class IgnoreExternalDTDTest {
 
     final static String FACTORY_KEY = "javax.xml.stream.XMLInputFactory";
@@ -71,3 +77,4 @@
     }
 
 }
+
diff --git a/jaxp/test/javax/xml/jaxp/unittest/stream/ProcessingInstructionTest/ProcessingInstructionTest.java b/jaxp/test/javax/xml/jaxp/unittest/stream/ProcessingInstructionTest/ProcessingInstructionTest.java
index 1234a37..44a7dea 100644
--- a/jaxp/test/javax/xml/jaxp/unittest/stream/ProcessingInstructionTest/ProcessingInstructionTest.java
+++ b/jaxp/test/javax/xml/jaxp/unittest/stream/ProcessingInstructionTest/ProcessingInstructionTest.java
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2014, 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2014, 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,11 +30,17 @@
 import javax.xml.stream.XMLStreamReader;
 
 import org.testng.Assert;
+import org.testng.annotations.Listeners;
 import org.testng.annotations.Test;
 
 /*
+ * @test
+ * @library /javax/xml/jaxp/libs /javax/xml/jaxp/unittest
+ * @run testng/othervm -DrunSecMngr=true stream.ProcessingInstructionTest.ProcessingInstructionTest
+ * @run testng/othervm stream.ProcessingInstructionTest.ProcessingInstructionTest
  * @summary Test XMLStreamReader parses Processing Instruction.
  */
+@Listeners({jaxp.library.BasePolicy.class})
 public class ProcessingInstructionTest {
 
     @Test
@@ -61,3 +67,4 @@
     }
 
 }
+
diff --git a/jaxp/test/javax/xml/jaxp/unittest/stream/StreamReaderDelegateTest.java b/jaxp/test/javax/xml/jaxp/unittest/stream/StreamReaderDelegateTest.java
index d7f9f48..0568bca 100644
--- a/jaxp/test/javax/xml/jaxp/unittest/stream/StreamReaderDelegateTest.java
+++ b/jaxp/test/javax/xml/jaxp/unittest/stream/StreamReaderDelegateTest.java
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2014, 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2014, 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
@@ -38,11 +38,17 @@
 import javax.xml.stream.util.StreamReaderDelegate;
 
 import org.testng.Assert;
+import org.testng.annotations.Listeners;
 import org.testng.annotations.Test;
 
 /*
+ * @test
+ * @library /javax/xml/jaxp/libs /javax/xml/jaxp/unittest
+ * @run testng/othervm -DrunSecMngr=true stream.StreamReaderDelegateTest
+ * @run testng/othervm stream.StreamReaderDelegateTest
  * @summary Test StreamReaderDelegate.
  */
+@Listeners({jaxp.library.FilePolicy.class})
 public class StreamReaderDelegateTest {
 
     /**
@@ -377,3 +383,4 @@
         }
     }
 }
+
diff --git a/jaxp/test/javax/xml/jaxp/unittest/stream/XMLEventLocationTest.java b/jaxp/test/javax/xml/jaxp/unittest/stream/XMLEventLocationTest.java
index 6c76038..75bb795 100644
--- a/jaxp/test/javax/xml/jaxp/unittest/stream/XMLEventLocationTest.java
+++ b/jaxp/test/javax/xml/jaxp/unittest/stream/XMLEventLocationTest.java
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2014, 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2014, 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
@@ -28,11 +28,17 @@
 import javax.xml.stream.events.XMLEvent;
 
 import org.testng.Assert;
+import org.testng.annotations.Listeners;
 import org.testng.annotations.Test;
 
 /*
+ * @test
+ * @library /javax/xml/jaxp/libs /javax/xml/jaxp/unittest
+ * @run testng/othervm -DrunSecMngr=true stream.XMLEventLocationTest
+ * @run testng/othervm stream.XMLEventLocationTest
  * @summary Test XMLEvent Location.
  */
+@Listeners({jaxp.library.BasePolicy.class})
 public class XMLEventLocationTest {
 
     @Test
@@ -76,3 +82,4 @@
         }
     }
 }
+
diff --git a/jaxp/test/javax/xml/jaxp/unittest/stream/XMLEventReaderTest/Bug6489890.java b/jaxp/test/javax/xml/jaxp/unittest/stream/XMLEventReaderTest/Bug6489890.java
index 0d55480..5ac6f1a 100644
--- a/jaxp/test/javax/xml/jaxp/unittest/stream/XMLEventReaderTest/Bug6489890.java
+++ b/jaxp/test/javax/xml/jaxp/unittest/stream/XMLEventReaderTest/Bug6489890.java
@@ -29,12 +29,18 @@
 import javax.xml.stream.events.XMLEvent;
 
 import org.testng.Assert;
+import org.testng.annotations.Listeners;
 import org.testng.annotations.Test;
 
 /*
+ * @test
  * @bug 6489890
+ * @library /javax/xml/jaxp/libs /javax/xml/jaxp/unittest
+ * @run testng/othervm -DrunSecMngr=true stream.XMLEventReaderTest.Bug6489890
+ * @run testng/othervm stream.XMLEventReaderTest.Bug6489890
  * @summary Test XMLEventReader's initial state is an undefined state, and nextEvent() is START_DOCUMENT.
  */
+@Listeners({jaxp.library.FilePolicy.class})
 public class Bug6489890 {
 
     @Test
@@ -71,3 +77,4 @@
     }
 
 }
+
diff --git a/jaxp/test/javax/xml/jaxp/unittest/stream/XMLEventReaderTest/Bug6555001.java b/jaxp/test/javax/xml/jaxp/unittest/stream/XMLEventReaderTest/Bug6555001.java
index 566186c..7953344 100644
--- a/jaxp/test/javax/xml/jaxp/unittest/stream/XMLEventReaderTest/Bug6555001.java
+++ b/jaxp/test/javax/xml/jaxp/unittest/stream/XMLEventReaderTest/Bug6555001.java
@@ -22,6 +22,7 @@
  */
 package stream.XMLEventReaderTest;
 
+import java.io.FilePermission;
 import java.io.StringReader;
 
 import javax.xml.stream.XMLEventReader;
@@ -29,76 +30,90 @@
 import javax.xml.stream.events.EntityReference;
 import javax.xml.stream.events.XMLEvent;
 
+import jaxp.library.JAXPTestUtilities;
+
 import org.testng.Assert;
+import org.testng.annotations.Listeners;
 import org.testng.annotations.Test;
 
 /*
+ * @test
  * @bug 6555001
+ * @library /javax/xml/jaxp/libs /javax/xml/jaxp/unittest
+ * @run testng/othervm -DrunSecMngr=true stream.XMLEventReaderTest.Bug6555001
+ * @run testng/othervm stream.XMLEventReaderTest.Bug6555001
  * @summary Test StAX parser replaces the entity reference as setting.
  */
+@Listeners({ jaxp.library.BasePolicy.class })
 public class Bug6555001 {
-    private static final String XML = "" + "<!DOCTYPE doc SYSTEM 'file:///tmp/this/does/not/exist/but/that/is/ok' [" + "<!ENTITY def '<para/>'>" + "]>"
-            + "<doc>&def;&undef;</doc>";
+    private static final String XML = ""
+            + "<!DOCTYPE doc SYSTEM 'file:///tmp/this/does/not/exist/but/that/is/ok' ["
+            + "<!ENTITY def '<para/>'>" + "]>" + "<doc>&def;&undef;</doc>";
 
     @Test
     public void testReplacing() throws Exception {
-        XMLInputFactory factory = XMLInputFactory.newInstance();
-        factory.setProperty("javax.xml.stream.isReplacingEntityReferences", true);
+        JAXPTestUtilities.tryRunWithTmpPermission(() -> {
+            XMLInputFactory factory = XMLInputFactory.newInstance();
+            factory.setProperty("javax.xml.stream.isReplacingEntityReferences", true);
 
-        StringReader sr = new StringReader(XML);
-        XMLEventReader reader = factory.createXMLEventReader(sr);
+            StringReader sr = new StringReader(XML);
+            XMLEventReader reader = factory.createXMLEventReader(sr);
 
-        boolean sawUndef = false;
-        boolean sawDef = false;
+            boolean sawUndef = false;
+            boolean sawDef = false;
 
-        while (reader.hasNext()) {
-            XMLEvent event = reader.nextEvent();
-            // System.out.println("Event: " + event);
-            if (event.isEntityReference()) {
-                EntityReference ref = (EntityReference) event;
-                if ("def".equals(ref.getName())) {
-                    sawDef = true;
-                } else if ("undef".equals(ref.getName())) {
-                    sawUndef = true;
-                } else {
-                    throw new IllegalArgumentException("Unexpected entity name");
+            while (reader.hasNext()) {
+                XMLEvent event = reader.nextEvent();
+                // System.out.println("Event: " + event);
+                if (event.isEntityReference()) {
+                    EntityReference ref = (EntityReference) event;
+                    if ("def".equals(ref.getName())) {
+                        sawDef = true;
+                    } else if ("undef".equals(ref.getName())) {
+                        sawUndef = true;
+                    } else {
+                        throw new IllegalArgumentException("Unexpected entity name");
+                    }
                 }
             }
-        }
 
-        Assert.assertEquals(false, sawDef);
-        Assert.assertEquals(true, sawUndef);
-        reader.close();
+            Assert.assertEquals(false, sawDef);
+            Assert.assertEquals(true, sawUndef);
+            reader.close();
+        }, new FilePermission("/tmp/this/does/not/exist/but/that/is/ok", "read"));
     }
 
     @Test
     public void testNotReplacing() throws Exception {
-        XMLInputFactory factory = XMLInputFactory.newInstance();
-        factory.setProperty("javax.xml.stream.isReplacingEntityReferences", false);
+        JAXPTestUtilities.tryRunWithTmpPermission(() -> {
+            XMLInputFactory factory = XMLInputFactory.newInstance();
+            factory.setProperty("javax.xml.stream.isReplacingEntityReferences", false);
 
-        StringReader sr = new StringReader(XML);
-        XMLEventReader reader = factory.createXMLEventReader(sr);
+            StringReader sr = new StringReader(XML);
+            XMLEventReader reader = factory.createXMLEventReader(sr);
 
-        boolean sawUndef = false;
-        boolean sawDef = false;
+            boolean sawUndef = false;
+            boolean sawDef = false;
 
-        while (reader.hasNext()) {
-            XMLEvent event = reader.nextEvent();
-            // System.out.println("Event: " + event);
-            if (event.isEntityReference()) {
-                EntityReference ref = (EntityReference) event;
-                if ("def".equals(ref.getName())) {
-                    sawDef = true;
-                } else if ("undef".equals(ref.getName())) {
-                    sawUndef = true;
-                } else {
-                    throw new IllegalArgumentException("Unexpected entity name");
+            while (reader.hasNext()) {
+                XMLEvent event = reader.nextEvent();
+                // System.out.println("Event: " + event);
+                if (event.isEntityReference()) {
+                    EntityReference ref = (EntityReference) event;
+                    if ("def".equals(ref.getName())) {
+                        sawDef = true;
+                    } else if ("undef".equals(ref.getName())) {
+                        sawUndef = true;
+                    } else {
+                        throw new IllegalArgumentException("Unexpected entity name");
+                    }
                 }
             }
-        }
 
-        Assert.assertEquals(true, sawDef);
-        Assert.assertEquals(true, sawUndef);
-        reader.close();
+            Assert.assertEquals(true, sawDef);
+            Assert.assertEquals(true, sawUndef);
+            reader.close();
+        }, new FilePermission("/tmp/this/does/not/exist/but/that/is/ok", "read"));
     }
 }
+
diff --git a/jaxp/test/javax/xml/jaxp/unittest/stream/XMLEventReaderTest/Bug6586466Test.java b/jaxp/test/javax/xml/jaxp/unittest/stream/XMLEventReaderTest/Bug6586466Test.java
index 319c50a..86f2437 100644
--- a/jaxp/test/javax/xml/jaxp/unittest/stream/XMLEventReaderTest/Bug6586466Test.java
+++ b/jaxp/test/javax/xml/jaxp/unittest/stream/XMLEventReaderTest/Bug6586466Test.java
@@ -23,6 +23,7 @@
 
 package stream.XMLEventReaderTest;
 
+import org.testng.annotations.Listeners;
 import org.testng.annotations.Test;
 import org.testng.Assert;
 import java.io.ByteArrayInputStream;
@@ -33,9 +34,14 @@
 import javax.xml.stream.events.XMLEvent;
 
 /*
+ * @test
  * @bug 6586466
+ * @library /javax/xml/jaxp/libs /javax/xml/jaxp/unittest
+ * @run testng/othervm -DrunSecMngr=true stream.XMLEventReaderTest.Bug6586466Test
+ * @run testng/othervm stream.XMLEventReaderTest.Bug6586466Test
  * @summary Test XMLEventReader.nextTag() shall update internal event state.
  */
+@Listeners({jaxp.library.BasePolicy.class})
 public class Bug6586466Test {
 
     @Test
@@ -60,3 +66,4 @@
     }
 
 }
+
diff --git a/jaxp/test/javax/xml/jaxp/unittest/stream/XMLEventReaderTest/Bug6613059Test.java b/jaxp/test/javax/xml/jaxp/unittest/stream/XMLEventReaderTest/Bug6613059Test.java
index 88d0be0..43e8a61 100644
--- a/jaxp/test/javax/xml/jaxp/unittest/stream/XMLEventReaderTest/Bug6613059Test.java
+++ b/jaxp/test/javax/xml/jaxp/unittest/stream/XMLEventReaderTest/Bug6613059Test.java
@@ -23,6 +23,7 @@
 
 package stream.XMLEventReaderTest;
 
+import org.testng.annotations.Listeners;
 import org.testng.annotations.Test;
 import org.testng.Assert;
 import javax.xml.namespace.QName;
@@ -33,9 +34,14 @@
 import javax.xml.stream.events.XMLEvent;
 
 /*
+ * @test
  * @bug 6613059
+ * @library /javax/xml/jaxp/libs /javax/xml/jaxp/unittest
+ * @run testng/othervm -DrunSecMngr=true stream.XMLEventReaderTest.Bug6613059Test
+ * @run testng/othervm stream.XMLEventReaderTest.Bug6613059Test
  * @summary Test XMLEventReader.nextTag() shall update internal event state, same as 6586466.
  */
+@Listeners({jaxp.library.FilePolicy.class})
 public class Bug6613059Test {
 
     @Test
@@ -83,3 +89,4 @@
         }
     }
 }
+
diff --git a/jaxp/test/javax/xml/jaxp/unittest/stream/XMLEventReaderTest/Bug6668115Test.java b/jaxp/test/javax/xml/jaxp/unittest/stream/XMLEventReaderTest/Bug6668115Test.java
index 188d003..0730946 100644
--- a/jaxp/test/javax/xml/jaxp/unittest/stream/XMLEventReaderTest/Bug6668115Test.java
+++ b/jaxp/test/javax/xml/jaxp/unittest/stream/XMLEventReaderTest/Bug6668115Test.java
@@ -30,12 +30,18 @@
 import javax.xml.stream.XMLOutputFactory;
 
 import org.testng.Assert;
+import org.testng.annotations.Listeners;
 import org.testng.annotations.Test;
 
 /*
+ * @test
  * @bug 6668115
+ * @library /javax/xml/jaxp/libs /javax/xml/jaxp/unittest
+ * @run testng/othervm -DrunSecMngr=true stream.XMLEventReaderTest.Bug6668115Test
+ * @run testng/othervm stream.XMLEventReaderTest.Bug6668115Test
  * @summary Test XMLEventReader.getElementText() shall update last event even if no peek.
  */
+@Listeners({jaxp.library.FilePolicy.class})
 public class Bug6668115Test {
 
     public java.io.File input;
@@ -94,3 +100,4 @@
     }
 
 }
+
diff --git a/jaxp/test/javax/xml/jaxp/unittest/stream/XMLEventReaderTest/Bug6846133Test.java b/jaxp/test/javax/xml/jaxp/unittest/stream/XMLEventReaderTest/Bug6846133Test.java
index 16bf959..a89b976 100644
--- a/jaxp/test/javax/xml/jaxp/unittest/stream/XMLEventReaderTest/Bug6846133Test.java
+++ b/jaxp/test/javax/xml/jaxp/unittest/stream/XMLEventReaderTest/Bug6846133Test.java
@@ -26,12 +26,18 @@
 import javax.xml.stream.XMLStreamException;
 
 import org.testng.Assert;
+import org.testng.annotations.Listeners;
 import org.testng.annotations.Test;
 
 /*
+ * @test
  * @bug 6846133
+ * @library /javax/xml/jaxp/libs /javax/xml/jaxp/unittest
+ * @run testng/othervm -DrunSecMngr=true stream.XMLEventReaderTest.Bug6846133Test
+ * @run testng/othervm stream.XMLEventReaderTest.Bug6846133Test
  * @summary Test method getDocumentTypeDeclaration() of DTD Event returns a valid value.
  */
+@Listeners({jaxp.library.BasePolicy.class})
 public class Bug6846133Test {
     private static final String xml = "<!DOCTYPE html PUBLIC \"-//W3C//DTDXHTML 1.0 Transitional//EN\" "
             + "\"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd\">" + "<html><body><p>I am some simple html</p></body> </html>";
@@ -77,3 +83,4 @@
     }
 
 }
+
diff --git a/jaxp/test/javax/xml/jaxp/unittest/stream/XMLEventReaderTest/Bug8153781.java b/jaxp/test/javax/xml/jaxp/unittest/stream/XMLEventReaderTest/Bug8153781.java
index f973b3b..2ac0159 100644
--- a/jaxp/test/javax/xml/jaxp/unittest/stream/XMLEventReaderTest/Bug8153781.java
+++ b/jaxp/test/javax/xml/jaxp/unittest/stream/XMLEventReaderTest/Bug8153781.java
@@ -31,15 +31,21 @@
 import javax.xml.stream.events.XMLEvent;
 
 import org.testng.Assert;
+import org.testng.annotations.Listeners;
 import org.testng.annotations.Test;
 
 import com.sun.org.apache.xerces.internal.impl.XMLEntityManager;
 
 /*
+ * @test
  * @bug 8153781
+ * @library /javax/xml/jaxp/libs /javax/xml/jaxp/unittest
+ * @run testng/othervm -DrunSecMngr=true stream.XMLEventReaderTest.Bug8153781
+ * @run testng/othervm stream.XMLEventReaderTest.Bug8153781
  * @summary Test if method skipDTD of class XMLDTDScannerImpl will correctly skip the DTD section,
  *          even if a call to XMLEntityScanner.scanData for skipping to the closing ']' returns true.
  */
+@Listeners({jaxp.library.BasePolicy.class})
 public class Bug8153781 {
     public static int DOCTYPE_SECTION_LENGTH = XMLEntityManager.DEFAULT_BUFFER_SIZE * 2;
     public static int DOCUMENT_LENGTH = DOCTYPE_SECTION_LENGTH + 4096;
@@ -88,3 +94,4 @@
         }
     }
 }
+
diff --git a/jaxp/test/javax/xml/jaxp/unittest/stream/XMLEventReaderTest/Issue40Test.java b/jaxp/test/javax/xml/jaxp/unittest/stream/XMLEventReaderTest/Issue40Test.java
index 161b6e6..4c6e0c0 100644
--- a/jaxp/test/javax/xml/jaxp/unittest/stream/XMLEventReaderTest/Issue40Test.java
+++ b/jaxp/test/javax/xml/jaxp/unittest/stream/XMLEventReaderTest/Issue40Test.java
@@ -32,11 +32,17 @@
 import javax.xml.stream.events.XMLEvent;
 
 import org.testng.Assert;
+import org.testng.annotations.Listeners;
 import org.testng.annotations.Test;
 
 /*
+ * @test
+ * @library /javax/xml/jaxp/libs /javax/xml/jaxp/unittest
+ * @run testng/othervm -DrunSecMngr=true stream.XMLEventReaderTest.Issue40Test
+ * @run testng/othervm stream.XMLEventReaderTest.Issue40Test
  * @summary Test XMLEventReader.getElementText() works after calling peek().
  */
+@Listeners({jaxp.library.FilePolicy.class})
 public class Issue40Test {
 
     public java.io.File input;
@@ -94,3 +100,4 @@
     }
 
 }
+
diff --git a/jaxp/test/javax/xml/jaxp/unittest/stream/XMLEventWriterTest/ReaderToWriterTest.java b/jaxp/test/javax/xml/jaxp/unittest/stream/XMLEventWriterTest/ReaderToWriterTest.java
index 1805e99..d96eea1 100644
--- a/jaxp/test/javax/xml/jaxp/unittest/stream/XMLEventWriterTest/ReaderToWriterTest.java
+++ b/jaxp/test/javax/xml/jaxp/unittest/stream/XMLEventWriterTest/ReaderToWriterTest.java
@@ -40,11 +40,17 @@
 import javax.xml.stream.events.XMLEvent;
 
 import org.testng.Assert;
+import org.testng.annotations.Listeners;
 import org.testng.annotations.Test;
 
 /*
+ * @test
+ * @library /javax/xml/jaxp/libs /javax/xml/jaxp/unittest
+ * @run testng/othervm -DrunSecMngr=true stream.XMLEventWriterTest.ReaderToWriterTest
+ * @run testng/othervm stream.XMLEventWriterTest.ReaderToWriterTest
  * @summary Test XMLEventWriter.
  */
+@Listeners({jaxp.library.FilePolicy.class})
 public class ReaderToWriterTest {
 
     private static final XMLEventFactory XML_EVENT_FACTORY = XMLEventFactory.newInstance();
@@ -208,3 +214,4 @@
     }
 
 }
+
diff --git a/jaxp/test/javax/xml/jaxp/unittest/stream/XMLEventWriterTest/XMLEventWriterTest.java b/jaxp/test/javax/xml/jaxp/unittest/stream/XMLEventWriterTest/XMLEventWriterTest.java
index ab076f2..e04a349 100644
--- a/jaxp/test/javax/xml/jaxp/unittest/stream/XMLEventWriterTest/XMLEventWriterTest.java
+++ b/jaxp/test/javax/xml/jaxp/unittest/stream/XMLEventWriterTest/XMLEventWriterTest.java
@@ -36,11 +36,17 @@
 import javax.xml.transform.stream.StreamSource;
 
 import org.testng.Assert;
+import org.testng.annotations.Listeners;
 import org.testng.annotations.Test;
 
 /*
+ * @test
+ * @library /javax/xml/jaxp/libs /javax/xml/jaxp/unittest
+ * @run testng/othervm -DrunSecMngr=true stream.XMLEventWriterTest.XMLEventWriterTest
+ * @run testng/othervm stream.XMLEventWriterTest.XMLEventWriterTest
  * @summary Test XMLEventWriter.
  */
+@Listeners({jaxp.library.FilePolicy.class})
 public class XMLEventWriterTest {
 
     /**
@@ -150,3 +156,4 @@
         }
     }
 }
+
diff --git a/jaxp/test/javax/xml/jaxp/unittest/stream/XMLInputFactoryTest/Bug6756677Test.java b/jaxp/test/javax/xml/jaxp/unittest/stream/XMLInputFactoryTest/Bug6756677Test.java
index 17604ac..3ba9ca7 100644
--- a/jaxp/test/javax/xml/jaxp/unittest/stream/XMLInputFactoryTest/Bug6756677Test.java
+++ b/jaxp/test/javax/xml/jaxp/unittest/stream/XMLInputFactoryTest/Bug6756677Test.java
@@ -23,30 +23,42 @@
 
 package stream.XMLInputFactoryTest;
 
+import static jaxp.library.JAXPTestUtilities.runWithTmpPermission;
+import static jaxp.library.JAXPTestUtilities.setSystemProperty;
+
+import java.util.PropertyPermission;
+
 import javax.xml.stream.XMLInputFactory;
 
 import org.testng.Assert;
+import org.testng.annotations.Listeners;
 import org.testng.annotations.Test;
 
 /*
+ * @test
  * @bug 6756677
+ * @library /javax/xml/jaxp/libs /javax/xml/jaxp/unittest
+ * @compile MyInputFactory.java
+ * @run testng/othervm -DrunSecMngr=true stream.XMLInputFactoryTest.Bug6756677Test
+ * @run testng/othervm stream.XMLInputFactoryTest.Bug6756677Test
  * @summary Test XMLInputFactory.newFactory(String factoryId, ClassLoader classLoader).
  */
+@Listeners({jaxp.library.BasePolicy.class})
 public class Bug6756677Test {
 
     @Test
     public void testNewInstance() {
         String myFactory = "stream.XMLInputFactoryTest.MyInputFactory";
         try {
-            System.setProperty("MyInputFactory", myFactory);
-            XMLInputFactory xif = XMLInputFactory.newInstance("MyInputFactory", null);
+            setSystemProperty("MyInputFactory", myFactory);
+            XMLInputFactory xif = runWithTmpPermission(() -> XMLInputFactory.newInstance("MyInputFactory", null),
+                    new PropertyPermission("MyInputFactory", "read"));
             System.out.println(xif.getClass().getName());
             Assert.assertTrue(xif.getClass().getName().equals(myFactory));
 
         } catch (UnsupportedOperationException oe) {
             Assert.fail(oe.getMessage());
         }
-
     }
 
     // newFactory was added in StAX 1.2
@@ -55,36 +67,22 @@
         String myFactory = "stream.XMLInputFactoryTest.MyInputFactory";
         ClassLoader cl = null;
         try {
-            System.setProperty("MyInputFactory", myFactory);
-            XMLInputFactory xif = XMLInputFactory.newFactory("MyInputFactory", cl);
+            setSystemProperty("MyInputFactory", myFactory);
+            XMLInputFactory xif = runWithTmpPermission(() -> XMLInputFactory.newFactory("MyInputFactory", cl),
+                    new PropertyPermission("MyInputFactory", "read"));
             System.out.println(xif.getClass().getName());
             Assert.assertTrue(xif.getClass().getName().equals(myFactory));
 
         } catch (UnsupportedOperationException oe) {
             Assert.fail(oe.getMessage());
         }
-
     }
 
-    String Temp_Result = "";
-    boolean PASSED = true;
-    boolean FAILED = false;
 
     String XMLInputFactoryClassName = "com.sun.xml.internal.stream.XMLInputFactoryImpl";
     String XMLInputFactoryID = "javax.xml.stream.XMLInputFactory";
     ClassLoader CL = null;
 
-    // jaxp-test jaxp-product-tests javax.xml.jaxp14.ptests.FactoryTest
-    @Test
-    public void test() {
-        if (!test29()) {
-            Assert.fail(Temp_Result);
-        }
-        if (!test31()) {
-            Assert.fail(Temp_Result);
-        }
-    }
-
     /*
      * test for XMLInputFactory.newInstance(java.lang.String factoryClassName,
      * java.lang.ClassLoader classLoader) classloader is null and
@@ -93,27 +91,10 @@
      * XMLInputFactory
      */
     @Test
-    public boolean test29() {
-        try {
-            System.setProperty(XMLInputFactoryID, XMLInputFactoryClassName);
-            XMLInputFactory xif = XMLInputFactory.newInstance(XMLInputFactoryID, CL);
-            if (xif instanceof XMLInputFactory) {
-                System.out.println(" test29() passed");
-                return PASSED;
-            } else {
-                System.out.println(" test29() failed");
-                Temp_Result = "test29() failed: xif not an instance of XMLInputFactory ";
-                return FAILED;
-            }
-        } catch (javax.xml.stream.FactoryConfigurationError fce) {
-            System.out.println("Failed : FactoryConfigurationError in test29 " + fce);
-            Temp_Result = "test29() failed ";
-            return FAILED;
-        } catch (Exception e) {
-            System.out.println("Failed : Exception in test29 " + e);
-            Temp_Result = "test29() failed ";
-            return FAILED;
-        }
+    public void test29() throws Exception {
+        setSystemProperty(XMLInputFactoryID, XMLInputFactoryClassName);
+        XMLInputFactory xif = XMLInputFactory.newInstance(XMLInputFactoryID, CL);
+        Assert.assertTrue(xif instanceof XMLInputFactory, "xif should be an instance of XMLInputFactory");
     }
 
     /*
@@ -124,28 +105,12 @@
      * newInstance of XMLInputFactory
      */
     @Test
-    public boolean test31() {
-        try {
-            Bug6756677Test test3 = new Bug6756677Test();
-            ClassLoader cl = (test3.getClass()).getClassLoader();
-            System.setProperty(XMLInputFactoryID, XMLInputFactoryClassName);
-            XMLInputFactory xif = XMLInputFactory.newInstance(XMLInputFactoryID, cl);
-            if (xif instanceof XMLInputFactory) {
-                System.out.println(" test31() passed");
-                return PASSED;
-            } else {
-                System.out.println(" test31() failed");
-                Temp_Result = "test31() failed: xif not an instance of XMLInputFactory ";
-                return FAILED;
-            }
-        } catch (javax.xml.stream.FactoryConfigurationError fce) {
-            System.out.println("Failed : FactoryConfigurationError in test31 " + fce);
-            Temp_Result = "test31() failed ";
-            return FAILED;
-        } catch (Exception e) {
-            System.out.println("Failed : Exception in test31 " + e);
-            Temp_Result = "test31() failed ";
-            return FAILED;
-        }
+    public void test31() throws Exception {
+        Bug6756677Test test3 = new Bug6756677Test();
+        ClassLoader cl = (test3.getClass()).getClassLoader();
+        setSystemProperty(XMLInputFactoryID, XMLInputFactoryClassName);
+        XMLInputFactory xif = XMLInputFactory.newInstance(XMLInputFactoryID, cl);
+        Assert.assertTrue(xif instanceof XMLInputFactory, "xif should be an instance of XMLInputFactory");
     }
 }
+
diff --git a/jaxp/test/javax/xml/jaxp/unittest/stream/XMLInputFactoryTest/Bug6909759Test.java b/jaxp/test/javax/xml/jaxp/unittest/stream/XMLInputFactoryTest/Bug6909759Test.java
index 36cc136..d2e2971 100644
--- a/jaxp/test/javax/xml/jaxp/unittest/stream/XMLInputFactoryTest/Bug6909759Test.java
+++ b/jaxp/test/javax/xml/jaxp/unittest/stream/XMLInputFactoryTest/Bug6909759Test.java
@@ -29,12 +29,18 @@
 import javax.xml.transform.stream.StreamSource;
 
 import org.testng.Assert;
+import org.testng.annotations.Listeners;
 import org.testng.annotations.Test;
 
 /*
+ * @test
  * @bug 6909759
+ * @library /javax/xml/jaxp/libs /javax/xml/jaxp/unittest
+ * @run testng/othervm -DrunSecMngr=true stream.XMLInputFactoryTest.Bug6909759Test
+ * @run testng/othervm stream.XMLInputFactoryTest.Bug6909759Test
  * @summary Test createXMLStreamReader with StreamSource.
  */
+@Listeners({jaxp.library.FilePolicy.class})
 public class Bug6909759Test {
 
 
@@ -60,3 +66,4 @@
         }
     }
 }
+
diff --git a/jaxp/test/javax/xml/jaxp/unittest/stream/XMLInputFactoryTest/IssueTracker38.java b/jaxp/test/javax/xml/jaxp/unittest/stream/XMLInputFactoryTest/IssueTracker38.java
index 448a854..dea8f73 100644
--- a/jaxp/test/javax/xml/jaxp/unittest/stream/XMLInputFactoryTest/IssueTracker38.java
+++ b/jaxp/test/javax/xml/jaxp/unittest/stream/XMLInputFactoryTest/IssueTracker38.java
@@ -31,11 +31,17 @@
 import javax.xml.transform.sax.SAXSource;
 
 import org.testng.Assert;
+import org.testng.annotations.Listeners;
 import org.testng.annotations.Test;
 
 /*
+ * @test
+ * @library /javax/xml/jaxp/libs /javax/xml/jaxp/unittest
+ * @run testng/othervm -DrunSecMngr=true stream.XMLInputFactoryTest.IssueTracker38
+ * @run testng/othervm stream.XMLInputFactoryTest.IssueTracker38
  * @summary Test createXMLEventReader from DOM or SAX source is unsupported.
  */
+@Listeners({jaxp.library.BasePolicy.class})
 public class IssueTracker38 {
 
     @Test
@@ -86,3 +92,4 @@
 
 
 }
+
diff --git a/jaxp/test/javax/xml/jaxp/unittest/stream/XMLInputFactoryTest/MyInputFactory.java b/jaxp/test/javax/xml/jaxp/unittest/stream/XMLInputFactoryTest/MyInputFactory.java
index 551d3f0..d9db7a0 100644
--- a/jaxp/test/javax/xml/jaxp/unittest/stream/XMLInputFactoryTest/MyInputFactory.java
+++ b/jaxp/test/javax/xml/jaxp/unittest/stream/XMLInputFactoryTest/MyInputFactory.java
@@ -158,3 +158,4 @@
         throw new UnsupportedOperationException("Not supported yet.");
     }
 }
+
diff --git a/jaxp/test/javax/xml/jaxp/unittest/stream/XMLOutputFactoryTest/Bug6846132Test.java b/jaxp/test/javax/xml/jaxp/unittest/stream/XMLOutputFactoryTest/Bug6846132Test.java
index 15afdaf..fa764c1 100644
--- a/jaxp/test/javax/xml/jaxp/unittest/stream/XMLOutputFactoryTest/Bug6846132Test.java
+++ b/jaxp/test/javax/xml/jaxp/unittest/stream/XMLOutputFactoryTest/Bug6846132Test.java
@@ -29,13 +29,19 @@
 import javax.xml.transform.sax.SAXResult;
 
 import org.testng.Assert;
+import org.testng.annotations.Listeners;
 import org.testng.annotations.Test;
 import org.xml.sax.helpers.DefaultHandler;
 
 /*
+ * @test
  * @bug 6846132
+ * @library /javax/xml/jaxp/libs /javax/xml/jaxp/unittest
+ * @run testng/othervm -DrunSecMngr=true stream.XMLOutputFactoryTest.Bug6846132Test
+ * @run testng/othervm stream.XMLOutputFactoryTest.Bug6846132Test
  * @summary Test createXMLStreamWriter with SAXResult won't throw a NullPointerException.
  */
+@Listeners({jaxp.library.BasePolicy.class})
 public class Bug6846132Test {
 
     @Test
@@ -83,3 +89,4 @@
     }
 
 }
+
diff --git a/jaxp/test/javax/xml/jaxp/unittest/stream/XMLOutputFactoryTest/DuplicateNSDeclarationTest.java b/jaxp/test/javax/xml/jaxp/unittest/stream/XMLOutputFactoryTest/DuplicateNSDeclarationTest.java
index 884c923..8fec5b1 100644
--- a/jaxp/test/javax/xml/jaxp/unittest/stream/XMLOutputFactoryTest/DuplicateNSDeclarationTest.java
+++ b/jaxp/test/javax/xml/jaxp/unittest/stream/XMLOutputFactoryTest/DuplicateNSDeclarationTest.java
@@ -31,11 +31,17 @@
 import javax.xml.transform.stream.StreamResult;
 
 import org.testng.Assert;
+import org.testng.annotations.Listeners;
 import org.testng.annotations.Test;
 
 /*
+ * @test
+ * @library /javax/xml/jaxp/libs /javax/xml/jaxp/unittest
+ * @run testng/othervm -DrunSecMngr=true stream.XMLOutputFactoryTest.DuplicateNSDeclarationTest
+ * @run testng/othervm stream.XMLOutputFactoryTest.DuplicateNSDeclarationTest
  * @summary Test the writing of duplicate namespace declarations when IS_REPAIRING_NAMESPACES is ture.
  */
+@Listeners({jaxp.library.BasePolicy.class})
 public class DuplicateNSDeclarationTest {
 
     @Test
@@ -77,3 +83,4 @@
         Assert.assertEquals(EXPECTED_OUTPUT, buffer.toString());
     }
 }
+
diff --git a/jaxp/test/javax/xml/jaxp/unittest/stream/XMLOutputFactoryTest/StreamResultTest.java b/jaxp/test/javax/xml/jaxp/unittest/stream/XMLOutputFactoryTest/StreamResultTest.java
index 96d928c..e44a20c 100644
--- a/jaxp/test/javax/xml/jaxp/unittest/stream/XMLOutputFactoryTest/StreamResultTest.java
+++ b/jaxp/test/javax/xml/jaxp/unittest/stream/XMLOutputFactoryTest/StreamResultTest.java
@@ -23,6 +23,8 @@
 
 package stream.XMLOutputFactoryTest;
 
+import static jaxp.library.JAXPTestUtilities.getSystemProperty;
+
 import java.io.ByteArrayOutputStream;
 
 import javax.xml.stream.XMLEventFactory;
@@ -33,11 +35,17 @@
 import javax.xml.transform.stream.StreamResult;
 
 import org.testng.Assert;
+import org.testng.annotations.Listeners;
 import org.testng.annotations.Test;
 
 /*
+ * @test
+ * @library /javax/xml/jaxp/libs /javax/xml/jaxp/unittest
+ * @run testng/othervm -DrunSecMngr=true stream.XMLOutputFactoryTest.StreamResultTest
+ * @run testng/othervm stream.XMLOutputFactoryTest.StreamResultTest
  * @summary Test create XMLWriter with variant Result.
  */
+@Listeners({jaxp.library.BasePolicy.class})
 public class StreamResultTest {
 
     @Test
@@ -85,7 +93,7 @@
     @Test
     public void testEventWriterWithStAXResultNStreamWriter() {
         String encoding = "";
-        if (System.getProperty("file.encoding").equals("UTF-8")) {
+        if (getSystemProperty("file.encoding").equals("UTF-8")) {
             encoding = " encoding=\"UTF-8\"";
         }
         final String EXPECTED_OUTPUT = "<?xml version=\"1.0\"" + encoding + "?><root></root>";
@@ -114,7 +122,7 @@
     @Test
     public void testEventWriterWithStAXResultNEventWriter() {
         String encoding = "";
-        if (System.getProperty("file.encoding").equals("UTF-8")) {
+        if (getSystemProperty("file.encoding").equals("UTF-8")) {
             encoding = " encoding=\"UTF-8\"";
         }
         final String EXPECTED_OUTPUT = "<?xml version=\"1.0\"" + encoding + "?><root></root>";
@@ -154,3 +162,4 @@
         }
     }
 }
+
diff --git a/jaxp/test/javax/xml/jaxp/unittest/stream/XMLResolverTest/XMLResolverTest.java b/jaxp/test/javax/xml/jaxp/unittest/stream/XMLResolverTest/XMLResolverTest.java
index 1a07803..12e7e9a 100644
--- a/jaxp/test/javax/xml/jaxp/unittest/stream/XMLResolverTest/XMLResolverTest.java
+++ b/jaxp/test/javax/xml/jaxp/unittest/stream/XMLResolverTest/XMLResolverTest.java
@@ -34,11 +34,17 @@
 import javax.xml.stream.XMLStreamReader;
 
 import org.testng.Assert;
+import org.testng.annotations.Listeners;
 import org.testng.annotations.Test;
 
 /*
+ * @test
+ * @library /javax/xml/jaxp/libs /javax/xml/jaxp/unittest
+ * @run testng/othervm -DrunSecMngr=true stream.XMLResolverTest.XMLResolverTest
+ * @run testng/othervm stream.XMLResolverTest.XMLResolverTest
  * @summary Test XMLResolver.
  */
+@Listeners({jaxp.library.FilePolicy.class})
 public class XMLResolverTest {
 
     @Test
@@ -90,3 +96,4 @@
 
     }
 }
+
diff --git a/jaxp/test/javax/xml/jaxp/unittest/stream/XMLStreamExceptionTest/ExceptionTest.java b/jaxp/test/javax/xml/jaxp/unittest/stream/XMLStreamExceptionTest/ExceptionTest.java
index 3e0dda7..403c609 100644
--- a/jaxp/test/javax/xml/jaxp/unittest/stream/XMLStreamExceptionTest/ExceptionTest.java
+++ b/jaxp/test/javax/xml/jaxp/unittest/stream/XMLStreamExceptionTest/ExceptionTest.java
@@ -28,11 +28,17 @@
 import javax.xml.stream.XMLStreamException;
 
 import org.testng.Assert;
+import org.testng.annotations.Listeners;
 import org.testng.annotations.Test;
 
 /*
+ * @test
+ * @library /javax/xml/jaxp/libs /javax/xml/jaxp/unittest
+ * @run testng/othervm -DrunSecMngr=true stream.XMLStreamExceptionTest.ExceptionTest
+ * @run testng/othervm stream.XMLStreamExceptionTest.ExceptionTest
  * @summary Test XMLStreamException contains the message of the wrapped exception.
  */
+@Listeners({jaxp.library.BasePolicy.class})
 public class ExceptionTest {
 
     @Test
@@ -47,3 +53,4 @@
         }
     }
 }
+
diff --git a/jaxp/test/javax/xml/jaxp/unittest/stream/XMLStreamFilterTest/Bug6481615.java b/jaxp/test/javax/xml/jaxp/unittest/stream/XMLStreamFilterTest/Bug6481615.java
index 1aa2219..5ab83c9 100644
--- a/jaxp/test/javax/xml/jaxp/unittest/stream/XMLStreamFilterTest/Bug6481615.java
+++ b/jaxp/test/javax/xml/jaxp/unittest/stream/XMLStreamFilterTest/Bug6481615.java
@@ -30,12 +30,18 @@
 import javax.xml.stream.XMLStreamReader;
 
 import org.testng.Assert;
+import org.testng.annotations.Listeners;
 import org.testng.annotations.Test;
 
 /*
+ * @test
  * @bug 6481615
+ * @library /javax/xml/jaxp/libs /javax/xml/jaxp/unittest
+ * @run testng/othervm -DrunSecMngr=true stream.XMLStreamFilterTest.Bug6481615
+ * @run testng/othervm stream.XMLStreamFilterTest.Bug6481615
  * @summary Test Filtered XMLStreamReader can return the event type if current state is START_ELEMENT.
  */
+@Listeners({jaxp.library.BasePolicy.class})
 public class Bug6481615 {
 
     static final String XML = "<?xml version=\"1.0\"?>" + "<S:Envelope foo=\"bar\" xmlns:S=\"http://schemas.xmlsoap.org/soap/envelope/\"></S:Envelope>";
@@ -62,3 +68,4 @@
         }
     }
 }
+
diff --git a/jaxp/test/javax/xml/jaxp/unittest/stream/XMLStreamFilterTest/Bug6481678.java b/jaxp/test/javax/xml/jaxp/unittest/stream/XMLStreamFilterTest/Bug6481678.java
index 9b3273a..ea79d53 100644
--- a/jaxp/test/javax/xml/jaxp/unittest/stream/XMLStreamFilterTest/Bug6481678.java
+++ b/jaxp/test/javax/xml/jaxp/unittest/stream/XMLStreamFilterTest/Bug6481678.java
@@ -35,12 +35,18 @@
 import javax.xml.stream.events.XMLEvent;
 
 import org.testng.Assert;
+import org.testng.annotations.Listeners;
 import org.testng.annotations.Test;
 
 /*
+ * @test
  * @bug 6481678
+ * @library /javax/xml/jaxp/libs /javax/xml/jaxp/unittest
+ * @run testng/othervm -DrunSecMngr=true stream.XMLStreamFilterTest.Bug6481678
+ * @run testng/othervm stream.XMLStreamFilterTest.Bug6481678
  * @summary Test Filtered XMLStreamReader parses namespace correctly.
  */
+@Listeners({jaxp.library.BasePolicy.class})
 public class Bug6481678 {
 
     String rootElement = "fruits";
@@ -219,3 +225,4 @@
         }
     }
 }
+
diff --git a/jaxp/test/javax/xml/jaxp/unittest/stream/XMLStreamFilterTest/HasNextTest.java b/jaxp/test/javax/xml/jaxp/unittest/stream/XMLStreamFilterTest/HasNextTest.java
index 3df73ae..c573a8d 100644
--- a/jaxp/test/javax/xml/jaxp/unittest/stream/XMLStreamFilterTest/HasNextTest.java
+++ b/jaxp/test/javax/xml/jaxp/unittest/stream/XMLStreamFilterTest/HasNextTest.java
@@ -30,11 +30,17 @@
 import javax.xml.stream.events.XMLEvent;
 
 import org.testng.Assert;
+import org.testng.annotations.Listeners;
 import org.testng.annotations.Test;
 
 /*
+ * @test
+ * @library /javax/xml/jaxp/libs /javax/xml/jaxp/unittest
+ * @run testng/othervm -DrunSecMngr=true stream.XMLStreamFilterTest.HasNextTest
+ * @run testng/othervm stream.XMLStreamFilterTest.HasNextTest
  * @summary Test Filtered XMLStreamReader hasNext() always return the correct value if repeat to call it.
  */
+@Listeners({jaxp.library.FilePolicy.class})
 public class HasNextTest {
 
     private static String INPUT_FILE = "HasNextTest.xml";
@@ -139,3 +145,4 @@
         }
     }
 }
+
diff --git a/jaxp/test/javax/xml/jaxp/unittest/stream/XMLStreamFilterTest/HasNextTypeFilter.java b/jaxp/test/javax/xml/jaxp/unittest/stream/XMLStreamFilterTest/HasNextTypeFilter.java
index 1fd6e20..19748b3 100644
--- a/jaxp/test/javax/xml/jaxp/unittest/stream/XMLStreamFilterTest/HasNextTypeFilter.java
+++ b/jaxp/test/javax/xml/jaxp/unittest/stream/XMLStreamFilterTest/HasNextTypeFilter.java
@@ -47,3 +47,4 @@
         return types[r.getEventType()];
     }
 }
+
diff --git a/jaxp/test/javax/xml/jaxp/unittest/stream/XMLStreamReaderTest/BOMTest.java b/jaxp/test/javax/xml/jaxp/unittest/stream/XMLStreamReaderTest/BOMTest.java
index b253e95..3fa5bec 100644
--- a/jaxp/test/javax/xml/jaxp/unittest/stream/XMLStreamReaderTest/BOMTest.java
+++ b/jaxp/test/javax/xml/jaxp/unittest/stream/XMLStreamReaderTest/BOMTest.java
@@ -27,12 +27,18 @@
 import javax.xml.stream.XMLStreamReader;
 
 import org.testng.Assert;
+import org.testng.annotations.Listeners;
 import org.testng.annotations.Test;
 
 /*
+ * @test
  * @bug 6218794
+ * @library /javax/xml/jaxp/libs /javax/xml/jaxp/unittest
+ * @run testng/othervm -DrunSecMngr=true stream.XMLStreamReaderTest.BOMTest
+ * @run testng/othervm stream.XMLStreamReaderTest.BOMTest
  * @summary Test XMLStreamReader parses BOM UTF-8 and BOM UTF-16 big endian stream.
  */
+@Listeners({jaxp.library.FilePolicy.class})
 public class BOMTest {
     // UTF-8 BOM test file
     private static final String INPUT_FILE1 = "UTF8-BOM.xml.data";
@@ -61,3 +67,4 @@
         }
     }
 }
+
diff --git a/jaxp/test/javax/xml/jaxp/unittest/stream/XMLStreamReaderTest/Bug6388460.java b/jaxp/test/javax/xml/jaxp/unittest/stream/XMLStreamReaderTest/Bug6388460.java
index c73348c..a981ba1 100644
--- a/jaxp/test/javax/xml/jaxp/unittest/stream/XMLStreamReaderTest/Bug6388460.java
+++ b/jaxp/test/javax/xml/jaxp/unittest/stream/XMLStreamReaderTest/Bug6388460.java
@@ -35,13 +35,19 @@
 import javax.xml.transform.stream.StreamSource;
 
 import org.testng.Assert;
+import org.testng.annotations.Listeners;
 import org.testng.annotations.Test;
 import org.xml.sax.InputSource;
 
 /*
+ * @test
  * @bug 6388460
+ * @library /javax/xml/jaxp/libs /javax/xml/jaxp/unittest
+ * @run testng/othervm -DrunSecMngr=true stream.XMLStreamReaderTest.Bug6388460
+ * @run testng/othervm stream.XMLStreamReaderTest.Bug6388460
  * @summary Test StAX parser can parse UTF-16 wsdl.
  */
+@Listeners({jaxp.library.FilePolicy.class})
 public class Bug6388460 {
 
     @Test
@@ -70,3 +76,4 @@
         }
     }
 }
+
diff --git a/jaxp/test/javax/xml/jaxp/unittest/stream/XMLStreamReaderTest/Bug6472982Test.java b/jaxp/test/javax/xml/jaxp/unittest/stream/XMLStreamReaderTest/Bug6472982Test.java
index c22dde7..cd08335 100644
--- a/jaxp/test/javax/xml/jaxp/unittest/stream/XMLStreamReaderTest/Bug6472982Test.java
+++ b/jaxp/test/javax/xml/jaxp/unittest/stream/XMLStreamReaderTest/Bug6472982Test.java
@@ -30,12 +30,18 @@
 import javax.xml.stream.XMLStreamReader;
 
 import org.testng.Assert;
+import org.testng.annotations.Listeners;
 import org.testng.annotations.Test;
 
 /*
+ * @test
  * @bug 6472982
+ * @library /javax/xml/jaxp/libs /javax/xml/jaxp/unittest
+ * @run testng/othervm -DrunSecMngr=true stream.XMLStreamReaderTest.Bug6472982Test
+ * @run testng/othervm stream.XMLStreamReaderTest.Bug6472982Test
  * @summary Test XMLStreamReader.getNamespaceContext().getPrefix("") won't throw IllegalArgumentException.
  */
+@Listeners({jaxp.library.BasePolicy.class})
 public class Bug6472982Test {
     String namespaceURI = "foobar.com";
     String rootElement = "foo";
@@ -73,3 +79,4 @@
         return sbuffer.toString();
     }
 }
+
diff --git a/jaxp/test/javax/xml/jaxp/unittest/stream/XMLStreamReaderTest/Bug6767322Test.java b/jaxp/test/javax/xml/jaxp/unittest/stream/XMLStreamReaderTest/Bug6767322Test.java
index b9ffde7..5a4c0be 100644
--- a/jaxp/test/javax/xml/jaxp/unittest/stream/XMLStreamReaderTest/Bug6767322Test.java
+++ b/jaxp/test/javax/xml/jaxp/unittest/stream/XMLStreamReaderTest/Bug6767322Test.java
@@ -29,12 +29,18 @@
 import javax.xml.stream.XMLStreamReader;
 
 import org.testng.Assert;
+import org.testng.annotations.Listeners;
 import org.testng.annotations.Test;
 
 /*
+ * @test
  * @bug 6767322
+ * @library /javax/xml/jaxp/libs /javax/xml/jaxp/unittest
+ * @run testng/othervm -DrunSecMngr=true stream.XMLStreamReaderTest.Bug6767322Test
+ * @run testng/othervm stream.XMLStreamReaderTest.Bug6767322Test
  * @summary Test XMLStreamReader.getVersion() returns null if a version isn't declared.
  */
+@Listeners({jaxp.library.FilePolicy.class})
 public class Bug6767322Test {
     private static final String INPUT_FILE = "Bug6767322.xml";
 
@@ -70,3 +76,4 @@
         }
     }
 }
+
diff --git a/jaxp/test/javax/xml/jaxp/unittest/stream/XMLStreamReaderTest/Bug6847819Test.java b/jaxp/test/javax/xml/jaxp/unittest/stream/XMLStreamReaderTest/Bug6847819Test.java
index 2480b72..cfe1ade 100644
--- a/jaxp/test/javax/xml/jaxp/unittest/stream/XMLStreamReaderTest/Bug6847819Test.java
+++ b/jaxp/test/javax/xml/jaxp/unittest/stream/XMLStreamReaderTest/Bug6847819Test.java
@@ -23,6 +23,7 @@
 
 package stream.XMLStreamReaderTest;
 
+import org.testng.annotations.Listeners;
 import org.testng.annotations.Test;
 import org.testng.Assert;
 import java.io.StringReader;
@@ -31,9 +32,14 @@
 import javax.xml.stream.XMLStreamException;
 
 /*
+ * @test
  * @bug 6847819
+ * @library /javax/xml/jaxp/libs /javax/xml/jaxp/unittest
+ * @run testng/othervm -DrunSecMngr=true stream.XMLStreamReaderTest.Bug6847819Test
+ * @run testng/othervm stream.XMLStreamReaderTest.Bug6847819Test
  * @summary Test StAX parser shall throw XMLStreamException for illegal xml declaration.
  */
+@Listeners({jaxp.library.BasePolicy.class})
 public class Bug6847819Test {
 
     @Test
@@ -63,3 +69,4 @@
     }
 
 }
+
diff --git a/jaxp/test/javax/xml/jaxp/unittest/stream/XMLStreamReaderTest/BugTest.java b/jaxp/test/javax/xml/jaxp/unittest/stream/XMLStreamReaderTest/BugTest.java
index 15e01a2..a2cf3c2 100644
--- a/jaxp/test/javax/xml/jaxp/unittest/stream/XMLStreamReaderTest/BugTest.java
+++ b/jaxp/test/javax/xml/jaxp/unittest/stream/XMLStreamReaderTest/BugTest.java
@@ -30,11 +30,17 @@
 import javax.xml.stream.XMLStreamReader;
 
 import org.testng.Assert;
+import org.testng.annotations.Listeners;
 import org.testng.annotations.Test;
 
 /*
+ * @test
+ * @library /javax/xml/jaxp/libs /javax/xml/jaxp/unittest
+ * @run testng/othervm -DrunSecMngr=true stream.XMLStreamReaderTest.BugTest
+ * @run testng/othervm stream.XMLStreamReaderTest.BugTest
  * @summary Test StAX parser can parse xml without declaration.
  */
+@Listeners({jaxp.library.BasePolicy.class})
 public class BugTest {
 
     @Test
@@ -45,3 +51,4 @@
         Assert.assertEquals(XMLStreamConstants.START_DOCUMENT, r.getEventType());
     }
 }
+
diff --git a/jaxp/test/javax/xml/jaxp/unittest/stream/XMLStreamReaderTest/DefaultAttributeTest.java b/jaxp/test/javax/xml/jaxp/unittest/stream/XMLStreamReaderTest/DefaultAttributeTest.java
index 6ce3bd4..10db94b 100644
--- a/jaxp/test/javax/xml/jaxp/unittest/stream/XMLStreamReaderTest/DefaultAttributeTest.java
+++ b/jaxp/test/javax/xml/jaxp/unittest/stream/XMLStreamReaderTest/DefaultAttributeTest.java
@@ -34,11 +34,17 @@
 import javax.xml.stream.events.XMLEvent;
 
 import org.testng.Assert;
+import org.testng.annotations.Listeners;
 import org.testng.annotations.Test;
 
 /*
+ * @test
+ * @library /javax/xml/jaxp/libs /javax/xml/jaxp/unittest
+ * @run testng/othervm -DrunSecMngr=true stream.XMLStreamReaderTest.DefaultAttributeTest
+ * @run testng/othervm stream.XMLStreamReaderTest.DefaultAttributeTest
  * @summary Test StAX parses namespace and attribute.
  */
+@Listeners({jaxp.library.FilePolicy.class})
 public class DefaultAttributeTest {
 
     private static final String INPUT_FILE = "ExternalDTD.xml";
@@ -102,3 +108,4 @@
         }
     }
 }
+
diff --git a/jaxp/test/javax/xml/jaxp/unittest/stream/XMLStreamReaderTest/DoubleXmlnsTest.java b/jaxp/test/javax/xml/jaxp/unittest/stream/XMLStreamReaderTest/DoubleXmlnsTest.java
index df1ced6..493d6b3 100644
--- a/jaxp/test/javax/xml/jaxp/unittest/stream/XMLStreamReaderTest/DoubleXmlnsTest.java
+++ b/jaxp/test/javax/xml/jaxp/unittest/stream/XMLStreamReaderTest/DoubleXmlnsTest.java
@@ -30,11 +30,17 @@
 import javax.xml.stream.XMLStreamReader;
 
 import org.testng.Assert;
+import org.testng.annotations.Listeners;
 import org.testng.annotations.Test;
 
 /*
+ * @test
+ * @library /javax/xml/jaxp/libs /javax/xml/jaxp/unittest
+ * @run testng/othervm -DrunSecMngr=true stream.XMLStreamReaderTest.DoubleXmlnsTest
+ * @run testng/othervm stream.XMLStreamReaderTest.DoubleXmlnsTest
  * @summary Test double namespaces and nested namespaces.
  */
+@Listeners({jaxp.library.BasePolicy.class})
 public class DoubleXmlnsTest {
 
     @Test
@@ -112,3 +118,4 @@
         }
     }
 }
+
diff --git a/jaxp/test/javax/xml/jaxp/unittest/stream/XMLStreamReaderTest/IsValidatingTest.java b/jaxp/test/javax/xml/jaxp/unittest/stream/XMLStreamReaderTest/IsValidatingTest.java
index 06dc266..1f44792 100644
--- a/jaxp/test/javax/xml/jaxp/unittest/stream/XMLStreamReaderTest/IsValidatingTest.java
+++ b/jaxp/test/javax/xml/jaxp/unittest/stream/XMLStreamReaderTest/IsValidatingTest.java
@@ -28,12 +28,18 @@
 import javax.xml.stream.events.XMLEvent;
 
 import org.testng.Assert;
+import org.testng.annotations.Listeners;
 import org.testng.annotations.Test;
 
 /*
+ * @test
  * @bug 6440324
+ * @library /javax/xml/jaxp/libs /javax/xml/jaxp/unittest
+ * @run testng/othervm -DrunSecMngr=true stream.XMLStreamReaderTest.IsValidatingTest
+ * @run testng/othervm stream.XMLStreamReaderTest.IsValidatingTest
  * @summary Test StAX can accept non-existent DTD if IS_VALIDATING if false.
  */
+@Listeners({jaxp.library.FilePolicy.class})
 public class IsValidatingTest {
 
     /**
@@ -159,3 +165,4 @@
         }
     }
 }
+
diff --git a/jaxp/test/javax/xml/jaxp/unittest/stream/XMLStreamReaderTest/Issue44Test.java b/jaxp/test/javax/xml/jaxp/unittest/stream/XMLStreamReaderTest/Issue44Test.java
index 082aa87..9ef51e6 100644
--- a/jaxp/test/javax/xml/jaxp/unittest/stream/XMLStreamReaderTest/Issue44Test.java
+++ b/jaxp/test/javax/xml/jaxp/unittest/stream/XMLStreamReaderTest/Issue44Test.java
@@ -27,12 +27,18 @@
 import javax.xml.stream.XMLStreamReader;
 
 import org.testng.Assert;
+import org.testng.annotations.Listeners;
 import org.testng.annotations.Test;
 
 /*
+ * @test
  * @bug 6631262
+ * @library /javax/xml/jaxp/libs /javax/xml/jaxp/unittest
+ * @run testng/othervm -DrunSecMngr=true stream.XMLStreamReaderTest.Issue44Test
+ * @run testng/othervm stream.XMLStreamReaderTest.Issue44Test
  * @summary Test XMLStreamReader.getName() shall throw IllegalStateException if current event is not start/end element.
  */
+@Listeners({jaxp.library.FilePolicy.class})
 public class Issue44Test {
 
     @Test
@@ -53,3 +59,4 @@
         }
     }
 }
+
diff --git a/jaxp/test/javax/xml/jaxp/unittest/stream/XMLStreamReaderTest/Issue47Test.java b/jaxp/test/javax/xml/jaxp/unittest/stream/XMLStreamReaderTest/Issue47Test.java
index 7d86842..ad2d8dc 100644
--- a/jaxp/test/javax/xml/jaxp/unittest/stream/XMLStreamReaderTest/Issue47Test.java
+++ b/jaxp/test/javax/xml/jaxp/unittest/stream/XMLStreamReaderTest/Issue47Test.java
@@ -30,12 +30,18 @@
 
 import org.testng.Assert;
 import org.testng.AssertJUnit;
+import org.testng.annotations.Listeners;
 import org.testng.annotations.Test;
 
 /*
+ * @test
  * @bug 6631265
+ * @library /javax/xml/jaxp/libs /javax/xml/jaxp/unittest
+ * @run testng/othervm -DrunSecMngr=true stream.XMLStreamReaderTest.Issue47Test
+ * @run testng/othervm stream.XMLStreamReaderTest.Issue47Test
  * @summary Test XMLStreamReader.standaloneSet() presents if input document has a value for "standalone" attribute in xml declaration.
  */
+@Listeners({jaxp.library.BasePolicy.class})
 public class Issue47Test {
 
     @Test
@@ -83,3 +89,4 @@
         }
     }
 }
+
diff --git a/jaxp/test/javax/xml/jaxp/unittest/stream/XMLStreamReaderTest/IssueTracker24.java b/jaxp/test/javax/xml/jaxp/unittest/stream/XMLStreamReaderTest/IssueTracker24.java
index dd0fb1a..b259576 100644
--- a/jaxp/test/javax/xml/jaxp/unittest/stream/XMLStreamReaderTest/IssueTracker24.java
+++ b/jaxp/test/javax/xml/jaxp/unittest/stream/XMLStreamReaderTest/IssueTracker24.java
@@ -29,11 +29,17 @@
 import javax.xml.stream.XMLStreamReader;
 
 import org.testng.Assert;
+import org.testng.annotations.Listeners;
 import org.testng.annotations.Test;
 
 /*
+ * @test
+ * @library /javax/xml/jaxp/libs /javax/xml/jaxp/unittest
+ * @run testng/othervm -DrunSecMngr=true stream.XMLStreamReaderTest.IssueTracker24
+ * @run testng/othervm stream.XMLStreamReaderTest.IssueTracker24
  * @summary Test no prefix is represented by "", not null.
  */
+@Listeners({jaxp.library.BasePolicy.class})
 public class IssueTracker24 {
 
     @Test
@@ -55,3 +61,4 @@
     }
 
 }
+
diff --git a/jaxp/test/javax/xml/jaxp/unittest/stream/XMLStreamReaderTest/IssueTracker35.java b/jaxp/test/javax/xml/jaxp/unittest/stream/XMLStreamReaderTest/IssueTracker35.java
index 1aa8d6b..d98e249 100644
--- a/jaxp/test/javax/xml/jaxp/unittest/stream/XMLStreamReaderTest/IssueTracker35.java
+++ b/jaxp/test/javax/xml/jaxp/unittest/stream/XMLStreamReaderTest/IssueTracker35.java
@@ -30,11 +30,17 @@
 import javax.xml.stream.XMLStreamReader;
 
 import org.testng.Assert;
+import org.testng.annotations.Listeners;
 import org.testng.annotations.Test;
 
 /*
+ * @test
+ * @library /javax/xml/jaxp/libs /javax/xml/jaxp/unittest
+ * @run testng/othervm -DrunSecMngr=true stream.XMLStreamReaderTest.IssueTracker35
+ * @run testng/othervm stream.XMLStreamReaderTest.IssueTracker35
  * @summary Test StAX parse xsd document including external DTD.
  */
+@Listeners({jaxp.library.FilePolicy.class})
 public class IssueTracker35 {
 
     @Test
@@ -53,3 +59,4 @@
         }
     }
 }
+
diff --git a/jaxp/test/javax/xml/jaxp/unittest/stream/XMLStreamReaderTest/IssueTracker70.java b/jaxp/test/javax/xml/jaxp/unittest/stream/XMLStreamReaderTest/IssueTracker70.java
index c616a3a..33cc4b8 100644
--- a/jaxp/test/javax/xml/jaxp/unittest/stream/XMLStreamReaderTest/IssueTracker70.java
+++ b/jaxp/test/javax/xml/jaxp/unittest/stream/XMLStreamReaderTest/IssueTracker70.java
@@ -31,11 +31,17 @@
 import javax.xml.stream.XMLStreamReader;
 
 import org.testng.Assert;
+import org.testng.annotations.Listeners;
 import org.testng.annotations.Test;
 
 /*
+ * @test
+ * @library /javax/xml/jaxp/libs /javax/xml/jaxp/unittest
+ * @run testng/othervm -DrunSecMngr=true stream.XMLStreamReaderTest.IssueTracker70
+ * @run testng/othervm stream.XMLStreamReaderTest.IssueTracker70
  * @summary Test it can retrieve attribute with null or empty name space.
  */
+@Listeners({jaxp.library.FilePolicy.class})
 public class IssueTracker70 {
 
     static private final File testFile = new File(IssueTracker70.class.getResource("IssueTracker70.xml").getFile());
@@ -70,3 +76,4 @@
         Assert.assertNotNull(value, "should have attribute value");
     }
 }
+
diff --git a/jaxp/test/javax/xml/jaxp/unittest/stream/XMLStreamReaderTest/Jsr173MR1Req5Test.java b/jaxp/test/javax/xml/jaxp/unittest/stream/XMLStreamReaderTest/Jsr173MR1Req5Test.java
index 50dfed8..3505fd5 100644
--- a/jaxp/test/javax/xml/jaxp/unittest/stream/XMLStreamReaderTest/Jsr173MR1Req5Test.java
+++ b/jaxp/test/javax/xml/jaxp/unittest/stream/XMLStreamReaderTest/Jsr173MR1Req5Test.java
@@ -28,11 +28,17 @@
 import javax.xml.stream.XMLStreamReader;
 
 import org.testng.Assert;
+import org.testng.annotations.Listeners;
 import org.testng.annotations.Test;
 
 /*
+ * @test
+ * @library /javax/xml/jaxp/libs /javax/xml/jaxp/unittest
+ * @run testng/othervm -DrunSecMngr=true stream.XMLStreamReaderTest.Jsr173MR1Req5Test
+ * @run testng/othervm stream.XMLStreamReaderTest.Jsr173MR1Req5Test
  * @summary Test XMLStreamReader parses namespace declaration within element when NamespaceAware turns off and on.
  */
+@Listeners({jaxp.library.FilePolicy.class})
 public class Jsr173MR1Req5Test {
 
     private static final String INPUT_FILE1 = "Jsr173MR1Req5.xml";
@@ -85,3 +91,4 @@
         }
     }
 }
+
diff --git a/jaxp/test/javax/xml/jaxp/unittest/stream/XMLStreamReaderTest/Jsr173MR1Req8Test.java b/jaxp/test/javax/xml/jaxp/unittest/stream/XMLStreamReaderTest/Jsr173MR1Req8Test.java
index d1c0074..b6e703e 100644
--- a/jaxp/test/javax/xml/jaxp/unittest/stream/XMLStreamReaderTest/Jsr173MR1Req8Test.java
+++ b/jaxp/test/javax/xml/jaxp/unittest/stream/XMLStreamReaderTest/Jsr173MR1Req8Test.java
@@ -28,11 +28,17 @@
 import javax.xml.stream.XMLStreamReader;
 
 import org.testng.Assert;
+import org.testng.annotations.Listeners;
 import org.testng.annotations.Test;
 
 /*
+ * @test
+ * @library /javax/xml/jaxp/libs /javax/xml/jaxp/unittest
+ * @run testng/othervm -DrunSecMngr=true stream.XMLStreamReaderTest.Jsr173MR1Req8Test
+ * @run testng/othervm stream.XMLStreamReaderTest.Jsr173MR1Req8Test
  * @summary Test XMLStreamReader parses attribute with namespace aware.
  */
+@Listeners({jaxp.library.FilePolicy.class})
 public class Jsr173MR1Req8Test {
 
     private static final String INPUT_FILE1 = "Jsr173MR1Req8.xml";
@@ -63,3 +69,4 @@
     }
 
 }
+
diff --git a/jaxp/test/javax/xml/jaxp/unittest/stream/XMLStreamReaderTest/NamespaceTest.java b/jaxp/test/javax/xml/jaxp/unittest/stream/XMLStreamReaderTest/NamespaceTest.java
index 5c9440d..2ea93e9 100644
--- a/jaxp/test/javax/xml/jaxp/unittest/stream/XMLStreamReaderTest/NamespaceTest.java
+++ b/jaxp/test/javax/xml/jaxp/unittest/stream/XMLStreamReaderTest/NamespaceTest.java
@@ -32,11 +32,17 @@
 import javax.xml.stream.XMLStreamReader;
 
 import org.testng.Assert;
+import org.testng.annotations.Listeners;
 import org.testng.annotations.Test;
 
 /*
+ * @test
+ * @library /javax/xml/jaxp/libs /javax/xml/jaxp/unittest
+ * @run testng/othervm -DrunSecMngr=true stream.XMLStreamReaderTest.NamespaceTest
+ * @run testng/othervm stream.XMLStreamReaderTest.NamespaceTest
  * @summary Test StAX parser processes namespace.
  */
+@Listeners({jaxp.library.BasePolicy.class})
 public class NamespaceTest {
 
     String namespaceURI = "foobar.com";
@@ -147,3 +153,4 @@
     }
 
 }
+
diff --git a/jaxp/test/javax/xml/jaxp/unittest/stream/XMLStreamReaderTest/StreamReaderTest.java b/jaxp/test/javax/xml/jaxp/unittest/stream/XMLStreamReaderTest/StreamReaderTest.java
index cbaa378..cc01f89 100644
--- a/jaxp/test/javax/xml/jaxp/unittest/stream/XMLStreamReaderTest/StreamReaderTest.java
+++ b/jaxp/test/javax/xml/jaxp/unittest/stream/XMLStreamReaderTest/StreamReaderTest.java
@@ -28,11 +28,17 @@
 import javax.xml.stream.XMLStreamReader;
 
 import org.testng.Assert;
+import org.testng.annotations.Listeners;
 import org.testng.annotations.Test;
 
 /*
+ * @test
+ * @library /javax/xml/jaxp/libs /javax/xml/jaxp/unittest
+ * @run testng/othervm -DrunSecMngr=true stream.XMLStreamReaderTest.StreamReaderTest
+ * @run testng/othervm stream.XMLStreamReaderTest.StreamReaderTest
  * @summary Test XMLStreamReader.hasName() returns false for ENTITY_REFERENCE.
  */
+@Listeners({jaxp.library.FilePolicy.class})
 public class StreamReaderTest {
 
     /**
@@ -56,3 +62,4 @@
     }
 
 }
+
diff --git a/jaxp/test/javax/xml/jaxp/unittest/stream/XMLStreamReaderTest/SupportDTDTest.java b/jaxp/test/javax/xml/jaxp/unittest/stream/XMLStreamReaderTest/SupportDTDTest.java
index 1a2e325..ca51c6e 100644
--- a/jaxp/test/javax/xml/jaxp/unittest/stream/XMLStreamReaderTest/SupportDTDTest.java
+++ b/jaxp/test/javax/xml/jaxp/unittest/stream/XMLStreamReaderTest/SupportDTDTest.java
@@ -38,9 +38,14 @@
 import javax.xml.stream.events.XMLEvent;
 
 import org.testng.Assert;
+import org.testng.annotations.Listeners;
 import org.testng.annotations.Test;
 
 /*
+ * @test
+ * @library /javax/xml/jaxp/libs /javax/xml/jaxp/unittest
+ * @run testng/othervm -DrunSecMngr=true stream.XMLStreamReaderTest.SupportDTDTest
+ * @run testng/othervm stream.XMLStreamReaderTest.SupportDTDTest
  * @summary Test SUPPORT_DTD and IS_REPLACING_ENTITY_REFERENCES.
  */
 
@@ -72,6 +77,7 @@
 *       The current jaxp implementation actually throws a nullpointexception. A better error message could be used.
 *
 */
+@Listeners({jaxp.library.FilePolicy.class})
 public class SupportDTDTest {
     final boolean DEBUG = false;
     final String _file = "ExternalDTD.xml";
@@ -282,3 +288,4 @@
     }
 
 }
+
diff --git a/jaxp/test/javax/xml/jaxp/unittest/stream/XMLStreamReaderTest/VoiceXMLDTDTest.java b/jaxp/test/javax/xml/jaxp/unittest/stream/XMLStreamReaderTest/VoiceXMLDTDTest.java
index 5befcb7..216bf0d 100644
--- a/jaxp/test/javax/xml/jaxp/unittest/stream/XMLStreamReaderTest/VoiceXMLDTDTest.java
+++ b/jaxp/test/javax/xml/jaxp/unittest/stream/XMLStreamReaderTest/VoiceXMLDTDTest.java
@@ -27,11 +27,17 @@
 import javax.xml.stream.XMLStreamReader;
 
 import org.testng.Assert;
+import org.testng.annotations.Listeners;
 import org.testng.annotations.Test;
 
 /*
+ * @test
+ * @library /javax/xml/jaxp/libs /javax/xml/jaxp/unittest
+ * @run testng/othervm -DrunSecMngr=true stream.XMLStreamReaderTest.VoiceXMLDTDTest
+ * @run testng/othervm stream.XMLStreamReaderTest.VoiceXMLDTDTest
  * @summary Test parsing Voice XML DTD.
  */
+@Listeners({jaxp.library.FilePolicy.class})
 public class VoiceXMLDTDTest {
 
     private static final String INPUT_FILE1 = "voicexml.xml";
@@ -52,3 +58,4 @@
         }
     }
 }
+
diff --git a/jaxp/test/javax/xml/jaxp/unittest/stream/XMLStreamReaderTest/XML11Test.java b/jaxp/test/javax/xml/jaxp/unittest/stream/XMLStreamReaderTest/XML11Test.java
index ac98279..f69166a 100644
--- a/jaxp/test/javax/xml/jaxp/unittest/stream/XMLStreamReaderTest/XML11Test.java
+++ b/jaxp/test/javax/xml/jaxp/unittest/stream/XMLStreamReaderTest/XML11Test.java
@@ -27,11 +27,17 @@
 import javax.xml.stream.XMLInputFactory;
 
 import org.testng.Assert;
+import org.testng.annotations.Listeners;
 import org.testng.annotations.Test;
 
 /*
+ * @test
+ * @library /javax/xml/jaxp/libs /javax/xml/jaxp/unittest
+ * @run testng/othervm -DrunSecMngr=true stream.XMLStreamReaderTest.XML11Test
+ * @run testng/othervm stream.XMLStreamReaderTest.XML11Test
  * @summary Test parsing xml 1.1.
  */
+@Listeners({jaxp.library.FilePolicy.class})
 public class XML11Test {
 
     @Test
@@ -48,3 +54,4 @@
         }
     }
 }
+
diff --git a/jaxp/test/javax/xml/jaxp/unittest/stream/XMLStreamWriterTest/AttributeEscapeTest.java b/jaxp/test/javax/xml/jaxp/unittest/stream/XMLStreamWriterTest/AttributeEscapeTest.java
index 7a426c9..811f0bf 100644
--- a/jaxp/test/javax/xml/jaxp/unittest/stream/XMLStreamWriterTest/AttributeEscapeTest.java
+++ b/jaxp/test/javax/xml/jaxp/unittest/stream/XMLStreamWriterTest/AttributeEscapeTest.java
@@ -34,13 +34,19 @@
 import javax.xml.stream.XMLStreamWriter;
 
 import org.testng.Assert;
+import org.testng.annotations.Listeners;
 import org.testng.annotations.Test;
 import org.xml.sax.InputSource;
 import org.xml.sax.SAXException;
 
 /*
+ * @test
+ * @library /javax/xml/jaxp/libs /javax/xml/jaxp/unittest
+ * @run testng/othervm -DrunSecMngr=true stream.XMLStreamWriterTest.AttributeEscapeTest
+ * @run testng/othervm stream.XMLStreamWriterTest.AttributeEscapeTest
  * @summary Test XMLStreamWriter shall escape the illegal characters.
  */
+@Listeners({jaxp.library.BasePolicy.class})
 public class AttributeEscapeTest {
 
     /**
@@ -97,3 +103,4 @@
         }
     }
 }
+
diff --git a/jaxp/test/javax/xml/jaxp/unittest/stream/XMLStreamWriterTest/Bug6452107.java b/jaxp/test/javax/xml/jaxp/unittest/stream/XMLStreamWriterTest/Bug6452107.java
index b3148c6..595c58d 100644
--- a/jaxp/test/javax/xml/jaxp/unittest/stream/XMLStreamWriterTest/Bug6452107.java
+++ b/jaxp/test/javax/xml/jaxp/unittest/stream/XMLStreamWriterTest/Bug6452107.java
@@ -31,12 +31,18 @@
 import javax.xml.stream.XMLStreamWriter;
 
 import org.testng.Assert;
+import org.testng.annotations.Listeners;
 import org.testng.annotations.Test;
 
 /*
+ * @test
  * @bug 6452107
+ * @library /javax/xml/jaxp/libs /javax/xml/jaxp/unittest
+ * @run testng/othervm -DrunSecMngr=true stream.XMLStreamWriterTest.Bug6452107
+ * @run testng/othervm stream.XMLStreamWriterTest.Bug6452107
  * @summary Test StAX can write ISO-8859-1 encoding XML.
  */
+@Listeners({jaxp.library.BasePolicy.class})
 public class Bug6452107 {
 
     /**
@@ -58,3 +64,4 @@
         }
     }
 }
+
diff --git a/jaxp/test/javax/xml/jaxp/unittest/stream/XMLStreamWriterTest/Bug6600882Test.java b/jaxp/test/javax/xml/jaxp/unittest/stream/XMLStreamWriterTest/Bug6600882Test.java
index f34b559..f8cb256 100644
--- a/jaxp/test/javax/xml/jaxp/unittest/stream/XMLStreamWriterTest/Bug6600882Test.java
+++ b/jaxp/test/javax/xml/jaxp/unittest/stream/XMLStreamWriterTest/Bug6600882Test.java
@@ -29,12 +29,18 @@
 import javax.xml.stream.XMLStreamWriter;
 
 import org.testng.Assert;
+import org.testng.annotations.Listeners;
 import org.testng.annotations.Test;
 
 /*
+ * @test
  * @bug 6600882
+ * @library /javax/xml/jaxp/libs /javax/xml/jaxp/unittest
+ * @run testng/othervm -DrunSecMngr=true stream.XMLStreamWriterTest.Bug6600882Test
+ * @run testng/othervm stream.XMLStreamWriterTest.Bug6600882Test
  * @summary Test toString(), hashCode() of XMLStreamWriter .
  */
+@Listeners({jaxp.library.BasePolicy.class})
 public class Bug6600882Test {
 
 
@@ -53,3 +59,4 @@
     }
 
 }
+
diff --git a/jaxp/test/javax/xml/jaxp/unittest/stream/XMLStreamWriterTest/Bug6675332Test.java b/jaxp/test/javax/xml/jaxp/unittest/stream/XMLStreamWriterTest/Bug6675332Test.java
index e52fb4a..25cd932 100644
--- a/jaxp/test/javax/xml/jaxp/unittest/stream/XMLStreamWriterTest/Bug6675332Test.java
+++ b/jaxp/test/javax/xml/jaxp/unittest/stream/XMLStreamWriterTest/Bug6675332Test.java
@@ -30,14 +30,20 @@
 import javax.xml.stream.XMLStreamWriter;
 
 import org.testng.Assert;
+import org.testng.annotations.Listeners;
 import org.testng.annotations.Test;
 
 import util.BaseStAXUT;
 
 /*
+ * @test
  * @bug 6675332
+ * @library /javax/xml/jaxp/libs /javax/xml/jaxp/unittest
+ * @run testng/othervm -DrunSecMngr=true stream.XMLStreamWriterTest.Bug6675332Test
+ * @run testng/othervm stream.XMLStreamWriterTest.Bug6675332Test
  * @summary Test XMLStreamWriter writeAttribute when IS_REPAIRING_NAMESPACES is true.
  */
+@Listeners({jaxp.library.BasePolicy.class})
 public class Bug6675332Test extends BaseStAXUT {
 
     private static final XMLOutputFactory XML_OUTPUT_FACTORY = XMLOutputFactory.newInstance();
@@ -158,3 +164,4 @@
     }
 
 }
+
diff --git a/jaxp/test/javax/xml/jaxp/unittest/stream/XMLStreamWriterTest/Bug7037352Test.java b/jaxp/test/javax/xml/jaxp/unittest/stream/XMLStreamWriterTest/Bug7037352Test.java
index 7c1e502..a157d7c 100644
--- a/jaxp/test/javax/xml/jaxp/unittest/stream/XMLStreamWriterTest/Bug7037352Test.java
+++ b/jaxp/test/javax/xml/jaxp/unittest/stream/XMLStreamWriterTest/Bug7037352Test.java
@@ -30,12 +30,18 @@
 import javax.xml.transform.stream.StreamResult;
 
 import org.testng.Assert;
+import org.testng.annotations.Listeners;
 import org.testng.annotations.Test;
 
 /*
+ * @test
  * @bug 7037352
+ * @library /javax/xml/jaxp/libs /javax/xml/jaxp/unittest
+ * @run testng/othervm -DrunSecMngr=true stream.XMLStreamWriterTest.Bug7037352Test
+ * @run testng/othervm stream.XMLStreamWriterTest.Bug7037352Test
  * @summary Test XMLStreamWriter.getNamespaceContext().getPrefix with XML_NS_URI and XMLNS_ATTRIBUTE_NS_URI.
  */
+@Listeners({jaxp.library.BasePolicy.class})
 public class Bug7037352Test {
 
     @Test
@@ -59,3 +65,4 @@
     }
 
 }
+
diff --git a/jaxp/test/javax/xml/jaxp/unittest/stream/XMLStreamWriterTest/DOMUtil.java b/jaxp/test/javax/xml/jaxp/unittest/stream/XMLStreamWriterTest/DOMUtil.java
index f59ef01..929cbda 100644
--- a/jaxp/test/javax/xml/jaxp/unittest/stream/XMLStreamWriterTest/DOMUtil.java
+++ b/jaxp/test/javax/xml/jaxp/unittest/stream/XMLStreamWriterTest/DOMUtil.java
@@ -221,3 +221,4 @@
     }
 
 }
+
diff --git a/jaxp/test/javax/xml/jaxp/unittest/stream/XMLStreamWriterTest/DomUtilTest.java b/jaxp/test/javax/xml/jaxp/unittest/stream/XMLStreamWriterTest/DomUtilTest.java
index d2c2491..466a51c 100644
--- a/jaxp/test/javax/xml/jaxp/unittest/stream/XMLStreamWriterTest/DomUtilTest.java
+++ b/jaxp/test/javax/xml/jaxp/unittest/stream/XMLStreamWriterTest/DomUtilTest.java
@@ -41,18 +41,23 @@
 import javax.xml.transform.dom.DOMSource;
 import javax.xml.transform.stream.StreamResult;
 
+import org.testng.annotations.Listeners;
 import org.testng.annotations.Test;
 import org.w3c.dom.Element;
 import org.w3c.dom.Node;
 import org.xml.sax.SAXException;
 
 /*
+ * @test
+ * @library /javax/xml/jaxp/libs /javax/xml/jaxp/unittest
+ * @run testng/othervm -DrunSecMngr=true stream.XMLStreamWriterTest.DomUtilTest
+ * @run testng/othervm stream.XMLStreamWriterTest.DomUtilTest
  * @summary Test XMLStreamWriter writes a soap message.
  */
+@Listeners({jaxp.library.FilePolicy.class})
 public class DomUtilTest {
 
     private XMLOutputFactory staxOut;
-    final File folder = new File(System.getProperty("tempdir") + "/classes/soapmessages");
     private static final String INPUT_FILE1 = "message_12.xml";
 
     public void setup() {
@@ -119,3 +124,4 @@
     }
 
 }
+
diff --git a/jaxp/test/javax/xml/jaxp/unittest/stream/XMLStreamWriterTest/EmptyElementTest.java b/jaxp/test/javax/xml/jaxp/unittest/stream/XMLStreamWriterTest/EmptyElementTest.java
index b813ef5..be4cc62 100644
--- a/jaxp/test/javax/xml/jaxp/unittest/stream/XMLStreamWriterTest/EmptyElementTest.java
+++ b/jaxp/test/javax/xml/jaxp/unittest/stream/XMLStreamWriterTest/EmptyElementTest.java
@@ -29,11 +29,17 @@
 import javax.xml.stream.XMLStreamWriter;
 
 import org.testng.Assert;
+import org.testng.annotations.Listeners;
 import org.testng.annotations.Test;
 
 /*
+ * @test
+ * @library /javax/xml/jaxp/libs /javax/xml/jaxp/unittest
+ * @run testng/othervm -DrunSecMngr=true stream.XMLStreamWriterTest.EmptyElementTest
+ * @run testng/othervm stream.XMLStreamWriterTest.EmptyElementTest
  * @summary Test XMLStreamWriter writes namespace and attribute after writeEmptyElement.
  */
+@Listeners({jaxp.library.BasePolicy.class})
 public class EmptyElementTest {
 
     // expected output
@@ -79,3 +85,4 @@
         }
     }
 }
+
diff --git a/jaxp/test/javax/xml/jaxp/unittest/stream/XMLStreamWriterTest/EncodingTest.java b/jaxp/test/javax/xml/jaxp/unittest/stream/XMLStreamWriterTest/EncodingTest.java
index 5097315..deff9cc 100644
--- a/jaxp/test/javax/xml/jaxp/unittest/stream/XMLStreamWriterTest/EncodingTest.java
+++ b/jaxp/test/javax/xml/jaxp/unittest/stream/XMLStreamWriterTest/EncodingTest.java
@@ -29,11 +29,17 @@
 import javax.xml.stream.XMLStreamWriter;
 
 import org.testng.Assert;
+import org.testng.annotations.Listeners;
 import org.testng.annotations.Test;
 
 /*
+ * @test
+ * @library /javax/xml/jaxp/libs /javax/xml/jaxp/unittest
+ * @run testng/othervm -DrunSecMngr=true stream.XMLStreamWriterTest.EncodingTest
+ * @run testng/othervm stream.XMLStreamWriterTest.EncodingTest
  * @summary Test XMLStreamWriter writes a document with encoding setting.
  */
+@Listeners({jaxp.library.BasePolicy.class})
 public class EncodingTest {
 
     private static final XMLOutputFactory XML_OUTPUT_FACTORY = XMLOutputFactory.newInstance();
@@ -104,3 +110,4 @@
         }
     }
 }
+
diff --git a/jaxp/test/javax/xml/jaxp/unittest/stream/XMLStreamWriterTest/NamespaceTest.java b/jaxp/test/javax/xml/jaxp/unittest/stream/XMLStreamWriterTest/NamespaceTest.java
index 24d89a0..04ad1d7 100644
--- a/jaxp/test/javax/xml/jaxp/unittest/stream/XMLStreamWriterTest/NamespaceTest.java
+++ b/jaxp/test/javax/xml/jaxp/unittest/stream/XMLStreamWriterTest/NamespaceTest.java
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2014, 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2014, 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
@@ -32,11 +32,17 @@
 
 import org.testng.Assert;
 import org.testng.annotations.BeforeMethod;
+import org.testng.annotations.Listeners;
 import org.testng.annotations.Test;
 
 /*
+ * @test
+ * @library /javax/xml/jaxp/libs /javax/xml/jaxp/unittest
+ * @run testng/othervm -DrunSecMngr=true stream.XMLStreamWriterTest.NamespaceTest
+ * @run testng/othervm stream.XMLStreamWriterTest.NamespaceTest
  * @summary Test the writing of Namespaces.
  */
+@Listeners({jaxp.library.BasePolicy.class})
 public class NamespaceTest {
 
     /** debug output? */
@@ -1428,3 +1434,4 @@
         }
     }
 }
+
diff --git a/jaxp/test/javax/xml/jaxp/unittest/stream/XMLStreamWriterTest/NullUriDetectionTest.java b/jaxp/test/javax/xml/jaxp/unittest/stream/XMLStreamWriterTest/NullUriDetectionTest.java
index 3eb0222..e4d0bfc 100644
--- a/jaxp/test/javax/xml/jaxp/unittest/stream/XMLStreamWriterTest/NullUriDetectionTest.java
+++ b/jaxp/test/javax/xml/jaxp/unittest/stream/XMLStreamWriterTest/NullUriDetectionTest.java
@@ -28,12 +28,18 @@
 import javax.xml.stream.XMLOutputFactory;
 import javax.xml.stream.XMLStreamWriter;
 
+import org.testng.annotations.Listeners;
 import org.testng.annotations.Test;
 
 /*
+ * @test
  * @bug 6391922
+ * @library /javax/xml/jaxp/libs /javax/xml/jaxp/unittest
+ * @run testng/othervm -DrunSecMngr=true stream.XMLStreamWriterTest.NullUriDetectionTest
+ * @run testng/othervm stream.XMLStreamWriterTest.NullUriDetectionTest
  * @summary Test XMLStreamWriter can writeDefaultNamespace(null).
  */
+@Listeners({jaxp.library.BasePolicy.class})
 public class NullUriDetectionTest {
     @Test
     public void test1() throws Exception {
@@ -48,3 +54,4 @@
         w.writeCharacters("---");
     }
 }
+
diff --git a/jaxp/test/javax/xml/jaxp/unittest/stream/XMLStreamWriterTest/SqeLinuxTest.java b/jaxp/test/javax/xml/jaxp/unittest/stream/XMLStreamWriterTest/SqeLinuxTest.java
index 90ca0f3..a5d7649 100644
--- a/jaxp/test/javax/xml/jaxp/unittest/stream/XMLStreamWriterTest/SqeLinuxTest.java
+++ b/jaxp/test/javax/xml/jaxp/unittest/stream/XMLStreamWriterTest/SqeLinuxTest.java
@@ -29,11 +29,17 @@
 import javax.xml.stream.XMLStreamWriter;
 
 import org.testng.Assert;
+import org.testng.annotations.Listeners;
 import org.testng.annotations.Test;
 
 /*
+ * @test
+ * @library /javax/xml/jaxp/libs /javax/xml/jaxp/unittest
+ * @run testng/othervm -DrunSecMngr=true stream.XMLStreamWriterTest.SqeLinuxTest
+ * @run testng/othervm stream.XMLStreamWriterTest.SqeLinuxTest
  * @summary Test XMLStreamWriter can output multiple declarations if IS_REPAIRING_NAMESPACES is false.
  */
+@Listeners({jaxp.library.BasePolicy.class})
 public class SqeLinuxTest {
 
     // note that expected output will have multiple declarations,
@@ -82,3 +88,4 @@
         }
     }
 }
+
diff --git a/jaxp/test/javax/xml/jaxp/unittest/stream/XMLStreamWriterTest/SurrogatesTest.java b/jaxp/test/javax/xml/jaxp/unittest/stream/XMLStreamWriterTest/SurrogatesTest.java
index a24c6b8..4208cc9 100644
--- a/jaxp/test/javax/xml/jaxp/unittest/stream/XMLStreamWriterTest/SurrogatesTest.java
+++ b/jaxp/test/javax/xml/jaxp/unittest/stream/XMLStreamWriterTest/SurrogatesTest.java
@@ -38,6 +38,7 @@
 import javax.xml.stream.XMLStreamWriter;
 
 import org.testng.Assert;
+import org.testng.annotations.Listeners;
 import org.testng.annotations.Test;
 import org.testng.annotations.DataProvider;
 
@@ -45,10 +46,15 @@
  * @test
  * @bug 8145974
  * @modules javax.xml
+ * @test
+ * @library /javax/xml/jaxp/libs /javax/xml/jaxp/unittest
+ * @run testng/othervm -DrunSecMngr=true stream.XMLStreamWriterTest.SurrogatesTest
+ * @run testng/othervm stream.XMLStreamWriterTest.SurrogatesTest
  * @summary Check that XMLStreamWriter generates valid xml with surrogate pair
  *  used within element text
  */
 
+@Listeners({jaxp.library.BasePolicy.class})
 public class SurrogatesTest {
 
     // Test that valid surrogate characters can be written/readen by xml stream
@@ -152,7 +158,7 @@
     }
 
     @DataProvider(name = "validData")
-    Object[][] getValidData() {
+    public Object[][] getValidData() {
         return new Object[][] {
             {"Don't Worry Be \uD83D\uDE0A"},
             {"BMP characters \uE000\uFFFD"},
@@ -161,7 +167,7 @@
     }
 
     @DataProvider(name = "invalidData")
-    Object[][] getInvalidData() {
+    public Object[][] getInvalidData() {
         return new Object[][] {
             {"Unbalanced surrogate \uD83D"},
             {"Unbalanced surrogate \uD83Dis here"},
@@ -169,3 +175,4 @@
         };
     }
 }
+
diff --git a/jaxp/test/javax/xml/jaxp/unittest/stream/XMLStreamWriterTest/UnprefixedNameTest.java b/jaxp/test/javax/xml/jaxp/unittest/stream/XMLStreamWriterTest/UnprefixedNameTest.java
index 5e05fd8..95bb896 100644
--- a/jaxp/test/javax/xml/jaxp/unittest/stream/XMLStreamWriterTest/UnprefixedNameTest.java
+++ b/jaxp/test/javax/xml/jaxp/unittest/stream/XMLStreamWriterTest/UnprefixedNameTest.java
@@ -28,12 +28,18 @@
 import javax.xml.stream.XMLStreamWriter;
 
 import org.testng.Assert;
+import org.testng.annotations.Listeners;
 import org.testng.annotations.Test;
 
 /*
+ * @test
  * @bug 6394074
+ * @library /javax/xml/jaxp/libs /javax/xml/jaxp/unittest
+ * @run testng/othervm -DrunSecMngr=true stream.XMLStreamWriterTest.UnprefixedNameTest
+ * @run testng/othervm stream.XMLStreamWriterTest.UnprefixedNameTest
  * @summary Test XMLStreamWriter namespace prefix with writeDefaultNamespace.
  */
+@Listeners({jaxp.library.BasePolicy.class})
 public class UnprefixedNameTest {
 
     @Test
@@ -119,3 +125,4 @@
         }
     }
 }
+
diff --git a/jaxp/test/javax/xml/jaxp/unittest/stream/XMLStreamWriterTest/WriterTest.java b/jaxp/test/javax/xml/jaxp/unittest/stream/XMLStreamWriterTest/WriterTest.java
index adb43d9..c7148ed 100644
--- a/jaxp/test/javax/xml/jaxp/unittest/stream/XMLStreamWriterTest/WriterTest.java
+++ b/jaxp/test/javax/xml/jaxp/unittest/stream/XMLStreamWriterTest/WriterTest.java
@@ -40,11 +40,17 @@
 import org.testng.Assert;
 import org.testng.annotations.AfterMethod;
 import org.testng.annotations.BeforeMethod;
+import org.testng.annotations.Listeners;
 import org.testng.annotations.Test;
 
 /*
+ * @test
+ * @library /javax/xml/jaxp/libs /javax/xml/jaxp/unittest
+ * @run testng/othervm -DrunSecMngr=true stream.XMLStreamWriterTest.WriterTest
+ * @run testng/othervm stream.XMLStreamWriterTest.WriterTest
  * @summary Test XMLStreamWriter functionality.
  */
+@Listeners({jaxp.library.FilePolicy.class})
 public class WriterTest {
 
     final String ENCODING = "UTF-8";
@@ -57,7 +63,7 @@
     String output = "";
 
     @BeforeMethod
-    protected void setUp() {
+    public void setUp() {
         try {
             outputFactory = XMLOutputFactory.newInstance();
             inputFactory = XMLInputFactory.newInstance();
@@ -67,7 +73,7 @@
     }
 
     @AfterMethod
-    protected void tearDown() {
+    public void tearDown() {
         outputFactory = null;
         inputFactory = null;
     }
@@ -778,3 +784,4 @@
         }
     }
 }
+
diff --git a/jaxp/test/javax/xml/jaxp/unittest/stream/XMLStreamWriterTest/XMLStreamWriterTest.java b/jaxp/test/javax/xml/jaxp/unittest/stream/XMLStreamWriterTest/XMLStreamWriterTest.java
index 2bc71a3..0d06304 100644
--- a/jaxp/test/javax/xml/jaxp/unittest/stream/XMLStreamWriterTest/XMLStreamWriterTest.java
+++ b/jaxp/test/javax/xml/jaxp/unittest/stream/XMLStreamWriterTest/XMLStreamWriterTest.java
@@ -29,24 +29,20 @@
 import javax.xml.stream.XMLStreamWriter;
 
 import org.testng.Assert;
-import org.testng.annotations.AfterMethod;
-import org.testng.annotations.BeforeMethod;
+import org.testng.annotations.Listeners;
 import org.testng.annotations.Test;
 
 /*
+ * @test
  * @bug 6347190
+ * @library /javax/xml/jaxp/libs /javax/xml/jaxp/unittest
+ * @run testng/othervm -DrunSecMngr=true stream.XMLStreamWriterTest.XMLStreamWriterTest
+ * @run testng/othervm stream.XMLStreamWriterTest.XMLStreamWriterTest
  * @summary Test StAX Writer won't insert comment into element inside.
  */
+@Listeners({jaxp.library.BasePolicy.class})
 public class XMLStreamWriterTest {
 
-    @BeforeMethod
-    protected void setUp() throws Exception {
-    }
-
-    @AfterMethod
-    protected void tearDown() throws Exception {
-    }
-
     /**
      * Test of main method, of class TestXMLStreamWriter.
      */
@@ -77,3 +73,4 @@
     }
 
 }
+
diff --git a/jaxp/test/javax/xml/jaxp/unittest/transform/Bug4693341Test.java b/jaxp/test/javax/xml/jaxp/unittest/transform/Bug4693341Test.java
index 8daef2e..63869af 100644
--- a/jaxp/test/javax/xml/jaxp/unittest/transform/Bug4693341Test.java
+++ b/jaxp/test/javax/xml/jaxp/unittest/transform/Bug4693341Test.java
@@ -37,14 +37,20 @@
 import javax.xml.transform.stream.StreamSource;
 
 import org.testng.Assert;
+import org.testng.annotations.Listeners;
 import org.testng.annotations.Test;
 import org.xml.sax.InputSource;
 import org.xml.sax.helpers.DefaultHandler;
 
 /*
+ * @test
  * @bug 4693341
+ * @library /javax/xml/jaxp/libs /javax/xml/jaxp/unittest
+ * @run testng/othervm -DrunSecMngr=true transform.Bug4693341Test
+ * @run testng/othervm transform.Bug4693341Test
  * @summary Test transform with external dtd.
  */
+@Listeners({jaxp.library.FilePolicy.class})
 public class Bug4693341Test {
     // save dtd file to current working directory to avoid writing into source repository
     public void copyDTDtoWorkDir() throws IOException {
@@ -88,3 +94,4 @@
         }
     }
 }
+
diff --git a/jaxp/test/javax/xml/jaxp/unittest/transform/Bug4892774.java b/jaxp/test/javax/xml/jaxp/unittest/transform/Bug4892774.java
index e65bdaf..ed34888 100644
--- a/jaxp/test/javax/xml/jaxp/unittest/transform/Bug4892774.java
+++ b/jaxp/test/javax/xml/jaxp/unittest/transform/Bug4892774.java
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2014, 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2014, 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
@@ -36,6 +36,7 @@
 import org.testng.Assert;
 import org.testng.annotations.AfterMethod;
 import org.testng.annotations.BeforeMethod;
+import org.testng.annotations.Listeners;
 import org.testng.annotations.Test;
 
 import transform.util.DOMUtil;
@@ -44,10 +45,15 @@
 import transform.util.StreamUtil;
 
 /*
+ * @test
  * @bug 4892774
+ * @library /javax/xml/jaxp/libs /javax/xml/jaxp/unittest
+ * @run testng/othervm -DrunSecMngr=true transform.Bug4892774
+ * @run testng/othervm transform.Bug4892774
  * @summary Test identity transformer with all possible types of Source and Result combinations for doucment version and encoding information.
  */
 
+@Listeners({jaxp.library.FilePolicy.class})
 public class Bug4892774 {
 
     private final String XML_FILE = "catalog.xml";
@@ -62,7 +68,7 @@
     private static StAXUtil staxUtil = null;
 
     @BeforeMethod
-    protected void setUp() {
+    public void setUp() {
         File tmpFile = new File(TEMP_FILE);
         if (tmpFile.exists())
             tmpFile.delete();
@@ -81,7 +87,7 @@
     }
 
     @AfterMethod
-    protected void tearDown() {
+    public void tearDown() {
         File tmpFile = new File(TEMP_FILE);
         if (tmpFile.exists())
             tmpFile.delete();
@@ -371,3 +377,4 @@
         }
     }
 }
+
diff --git a/jaxp/test/javax/xml/jaxp/unittest/transform/Bug5073477.java b/jaxp/test/javax/xml/jaxp/unittest/transform/Bug5073477.java
index 4d40674..750f38c 100644
--- a/jaxp/test/javax/xml/jaxp/unittest/transform/Bug5073477.java
+++ b/jaxp/test/javax/xml/jaxp/unittest/transform/Bug5073477.java
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2014, 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2014, 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,13 +27,19 @@
 import javax.xml.parsers.DocumentBuilderFactory;
 import javax.xml.transform.dom.DOMResult;
 
+import org.testng.annotations.Listeners;
 import org.testng.annotations.Test;
 import org.w3c.dom.Document;
 
 /*
+ * @test
  * @bug 5073477
+ * @library /javax/xml/jaxp/libs /javax/xml/jaxp/unittest
+ * @run testng/othervm -DrunSecMngr=true transform.Bug5073477
+ * @run testng/othervm transform.Bug5073477
  * @summary Test DOMResult.setNextSibling works correctly.
  */
+@Listeners({jaxp.library.FilePolicy.class})
 public class Bug5073477 {
 
     @Test
@@ -49,3 +55,4 @@
         r.setNextSibling(r.getNode().getFirstChild());
     }
 }
+
diff --git a/jaxp/test/javax/xml/jaxp/unittest/transform/Bug6175602.java b/jaxp/test/javax/xml/jaxp/unittest/transform/Bug6175602.java
index bb3c7d6..0cfcfa0 100644
--- a/jaxp/test/javax/xml/jaxp/unittest/transform/Bug6175602.java
+++ b/jaxp/test/javax/xml/jaxp/unittest/transform/Bug6175602.java
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2014, 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2014, 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
@@ -29,12 +29,18 @@
 import javax.xml.transform.TransformerFactory;
 import javax.xml.transform.stream.StreamSource;
 
+import org.testng.annotations.Listeners;
 import org.testng.annotations.Test;
 
 /*
+ * @test
  * @bug 6175602
+ * @library /javax/xml/jaxp/libs /javax/xml/jaxp/unittest
+ * @run testng/othervm -DrunSecMngr=true transform.Bug6175602
+ * @run testng/othervm transform.Bug6175602
  * @summary Test compilation of MsWordXMLImport.xsl.
  */
+@Listeners({jaxp.library.FilePolicy.class})
 public class Bug6175602 {
 
     public Bug6175602() {
@@ -48,3 +54,4 @@
     }
 
 }
+
diff --git a/jaxp/test/javax/xml/jaxp/unittest/transform/Bug6206491.java b/jaxp/test/javax/xml/jaxp/unittest/transform/Bug6206491.java
index eaaa3f7..1947d7e 100644
--- a/jaxp/test/javax/xml/jaxp/unittest/transform/Bug6206491.java
+++ b/jaxp/test/javax/xml/jaxp/unittest/transform/Bug6206491.java
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2014, 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2014, 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
@@ -39,15 +39,21 @@
 import javax.xml.transform.stream.StreamSource;
 
 import org.testng.Assert;
+import org.testng.annotations.Listeners;
 import org.testng.annotations.Test;
 import org.w3c.dom.Document;
 import org.xml.sax.SAXException;
 import org.xml.sax.SAXParseException;
 
 /*
+ * @test
  * @bug 6206491
+ * @library /javax/xml/jaxp/libs /javax/xml/jaxp/unittest
+ * @run testng/othervm -DrunSecMngr=true transform.Bug6206491
+ * @run testng/othervm transform.Bug6206491
  * @summary Test key searches over more than one document.
  */
+@Listeners({jaxp.library.FilePolicy.class})
 public class Bug6206491 {
 
     private String getResource(String s) {
@@ -128,3 +134,4 @@
     }
 
 }
+
diff --git a/jaxp/test/javax/xml/jaxp/unittest/transform/Bug6216226Test.java b/jaxp/test/javax/xml/jaxp/unittest/transform/Bug6216226Test.java
index 275fd8c..291eb37 100644
--- a/jaxp/test/javax/xml/jaxp/unittest/transform/Bug6216226Test.java
+++ b/jaxp/test/javax/xml/jaxp/unittest/transform/Bug6216226Test.java
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2014, 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2014, 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
@@ -23,8 +23,11 @@
 
 package transform;
 
+import static jaxp.library.JAXPTestUtilities.runWithTmpPermission;
+
 import java.io.File;
 import java.io.StringReader;
+import java.util.PropertyPermission;
 
 import javax.xml.transform.Transformer;
 import javax.xml.transform.TransformerFactory;
@@ -32,12 +35,18 @@
 import javax.xml.transform.stream.StreamSource;
 
 import org.testng.Assert;
+import org.testng.annotations.Listeners;
 import org.testng.annotations.Test;
 
 /*
+ * @test
  * @bug 6216226
+ * @library /javax/xml/jaxp/libs /javax/xml/jaxp/unittest
+ * @run testng/othervm -DrunSecMngr=true transform.Bug6216226Test
+ * @run testng/othervm transform.Bug6216226Test
  * @summary Test StreamResult(File) is closed after transform().
  */
+@Listeners({jaxp.library.FilePolicy.class})
 public class Bug6216226Test {
 
     @Test
@@ -48,7 +57,7 @@
             Transformer xformer = tf.newTransformer();
             StringReader st = new StringReader("<?xml version=\"1.0\" encoding=\"UTF-8\"?><doc></doc>");
             StreamSource s = new StreamSource(st);
-            StreamResult r = new StreamResult(test);
+            StreamResult r = runWithTmpPermission(() -> new StreamResult(test), new PropertyPermission("user.dir", "read"));
             xformer.transform(s, r);
             if (!test.delete()) {
                 Assert.fail("cannot delete file: " + test.getPath());
@@ -60,3 +69,4 @@
         }
     }
 }
+
diff --git a/jaxp/test/javax/xml/jaxp/unittest/transform/Bug6311448.java b/jaxp/test/javax/xml/jaxp/unittest/transform/Bug6311448.java
index db6925d..adc49f1 100644
--- a/jaxp/test/javax/xml/jaxp/unittest/transform/Bug6311448.java
+++ b/jaxp/test/javax/xml/jaxp/unittest/transform/Bug6311448.java
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2014, 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2014, 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
@@ -33,14 +33,20 @@
 import javax.xml.transform.stream.StreamResult;
 
 import org.testng.Assert;
+import org.testng.annotations.Listeners;
 import org.testng.annotations.Test;
 import org.w3c.dom.Document;
 import org.w3c.dom.Element;
 
 /*
+ * @test
  * @bug 6311448
+ * @library /javax/xml/jaxp/libs /javax/xml/jaxp/unittest
+ * @run testng/othervm -DrunSecMngr=true transform.Bug6311448
+ * @run testng/othervm transform.Bug6311448
  * @summary Test XML transformer can output Unicode surrorate pair.
  */
+@Listeners({jaxp.library.BasePolicy.class})
 public class Bug6311448 {
 
     @Test
@@ -79,3 +85,4 @@
     }
 
 }
+
diff --git a/jaxp/test/javax/xml/jaxp/unittest/transform/Bug6384805.java b/jaxp/test/javax/xml/jaxp/unittest/transform/Bug6384805.java
index 680398b..3e7bc97 100644
--- a/jaxp/test/javax/xml/jaxp/unittest/transform/Bug6384805.java
+++ b/jaxp/test/javax/xml/jaxp/unittest/transform/Bug6384805.java
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2014, 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2014, 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
@@ -35,12 +35,18 @@
 import javax.xml.xpath.XPathFactory;
 
 import org.testng.Assert;
+import org.testng.annotations.Listeners;
 import org.testng.annotations.Test;
 
 /*
+ * @test
  * @bug 6384805
+ * @library /javax/xml/jaxp/libs /javax/xml/jaxp/unittest
+ * @run testng/othervm -DrunSecMngr=true transform.Bug6384805
+ * @run testng/othervm transform.Bug6384805
  * @summary Test XSLTC can parse XML namespace when nodeset is created within a template.
  */
+@Listeners({jaxp.library.FilePolicy.class})
 public class Bug6384805 {
 
     @Test
@@ -88,3 +94,4 @@
     }
 
 }
+
diff --git a/jaxp/test/javax/xml/jaxp/unittest/transform/Bug6465722.java b/jaxp/test/javax/xml/jaxp/unittest/transform/Bug6465722.java
index 80d5139..881bd80 100644
--- a/jaxp/test/javax/xml/jaxp/unittest/transform/Bug6465722.java
+++ b/jaxp/test/javax/xml/jaxp/unittest/transform/Bug6465722.java
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2014, 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2014, 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,13 +34,19 @@
 import javax.xml.transform.stream.StreamSource;
 
 import org.testng.Assert;
+import org.testng.annotations.Listeners;
 import org.testng.annotations.Test;
 import org.w3c.dom.Document;
 
 /*
+ * @test
  * @bug 6465722
+ * @library /javax/xml/jaxp/libs /javax/xml/jaxp/unittest
+ * @run testng/othervm -DrunSecMngr=true transform.Bug6465722
+ * @run testng/othervm transform.Bug6465722
  * @summary Test Transformer can transform the node attribute prefixed with a namespace.
  */
+@Listeners({jaxp.library.BasePolicy.class})
 public class Bug6465722 {
 
     public Bug6465722(String name) {
@@ -66,3 +72,4 @@
     }
 
 }
+
diff --git a/jaxp/test/javax/xml/jaxp/unittest/transform/Bug6467808.java b/jaxp/test/javax/xml/jaxp/unittest/transform/Bug6467808.java
index 7a7fb1a..86f9436 100644
--- a/jaxp/test/javax/xml/jaxp/unittest/transform/Bug6467808.java
+++ b/jaxp/test/javax/xml/jaxp/unittest/transform/Bug6467808.java
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2014, 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2014, 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
@@ -33,12 +33,18 @@
 import javax.xml.transform.stream.StreamSource;
 
 import org.testng.Assert;
+import org.testng.annotations.Listeners;
 import org.testng.annotations.Test;
 
 /*
+ * @test
  * @bug 6467808
+ * @library /javax/xml/jaxp/libs /javax/xml/jaxp/unittest
+ * @run testng/othervm -DrunSecMngr=true transform.Bug6467808
+ * @run testng/othervm transform.Bug6467808
  * @summary Test Transformer can parse re-declare prefixed namespace mappings.
  */
+@Listeners({jaxp.library.BasePolicy.class})
 public class Bug6467808 {
 
     private static final String TESTXML = "<?xml version='1.0' ?>\n"
@@ -70,3 +76,4 @@
         }
     }
 }
+
diff --git a/jaxp/test/javax/xml/jaxp/unittest/transform/Bug6490380.java b/jaxp/test/javax/xml/jaxp/unittest/transform/Bug6490380.java
index 4385fb2..7301108 100644
--- a/jaxp/test/javax/xml/jaxp/unittest/transform/Bug6490380.java
+++ b/jaxp/test/javax/xml/jaxp/unittest/transform/Bug6490380.java
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2014, 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2014, 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
@@ -32,12 +32,18 @@
 import javax.xml.transform.stream.StreamSource;
 
 import org.testng.Assert;
+import org.testng.annotations.Listeners;
 import org.testng.annotations.Test;
 
 /*
+ * @test
  * @bug 6490380
+ * @library /javax/xml/jaxp/libs /javax/xml/jaxp/unittest
+ * @run testng/othervm -DrunSecMngr=true transform.Bug6490380
+ * @run testng/othervm transform.Bug6490380
  * @summary Test only a single DOCTYPE declaration is generated through transforming.
  */
+@Listeners({jaxp.library.FilePolicy.class})
 public class Bug6490380 {
 
     @Test
@@ -55,3 +61,4 @@
         }
     }
 }
+
diff --git a/jaxp/test/javax/xml/jaxp/unittest/transform/Bug6490921.java b/jaxp/test/javax/xml/jaxp/unittest/transform/Bug6490921.java
index 38f72d5..759467c 100644
--- a/jaxp/test/javax/xml/jaxp/unittest/transform/Bug6490921.java
+++ b/jaxp/test/javax/xml/jaxp/unittest/transform/Bug6490921.java
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2014, 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2014, 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
@@ -23,6 +23,8 @@
 
 package transform;
 
+import static jaxp.library.JAXPTestUtilities.setSystemProperty;
+
 import java.io.IOException;
 import java.io.StringReader;
 import java.io.StringWriter;
@@ -37,15 +39,21 @@
 import javax.xml.transform.stream.StreamResult;
 
 import org.testng.Assert;
+import org.testng.annotations.Listeners;
 import org.testng.annotations.Test;
 import org.xml.sax.InputSource;
 import org.xml.sax.SAXException;
 import org.xml.sax.helpers.XMLFilterImpl;
 
 /*
+ * @test
  * @bug 6490921
+ * @library /javax/xml/jaxp/libs /javax/xml/jaxp/unittest
+ * @run testng/othervm -DrunSecMngr=true transform.Bug6490921
+ * @run testng/othervm transform.Bug6490921
  * @summary Test property org.xml.sax.driver is always applied in transformer API.
  */
+@Listeners({jaxp.library.BasePolicy.class})
 public class Bug6490921 {
 
     public static class ReaderStub extends XMLFilterImpl {
@@ -71,7 +79,7 @@
     public void test01() {
         String xml = "<?xml version='1.0'?><root/>";
         ReaderStub.used = false;
-        System.setProperty("org.xml.sax.driver", "");
+        setSystemProperty("org.xml.sax.driver", "");
 
         // Don't set 'org.xml.sax.driver' here, just use default
         try {
@@ -91,7 +99,7 @@
     public void test02() {
         String xml = "<?xml version='1.0'?><root/>";
         ReaderStub.used = false;
-        System.setProperty("org.xml.sax.driver", ReaderStub.class.getName());
+        setSystemProperty("org.xml.sax.driver", ReaderStub.class.getName());
         try {
             TransformerFactory transFactory = TransformerFactory.newInstance();
             Transformer transformer = transFactory.newTransformer();
@@ -111,7 +119,7 @@
                 + "   <xsl:template match='/'>Hello World!</xsl:template>\n" + "</xsl:stylesheet>\n";
 
         ReaderStub.used = false;
-        System.setProperty("org.xml.sax.driver", ReaderStub.class.getName());
+        setSystemProperty("org.xml.sax.driver", ReaderStub.class.getName());
         try {
             TransformerFactory transFactory = TransformerFactory.newInstance();
             if (transFactory.getFeature(SAXTransformerFactory.FEATURE) == false) {
@@ -137,3 +145,4 @@
         }
     }
 }
+
diff --git a/jaxp/test/javax/xml/jaxp/unittest/transform/Bug6513892.java b/jaxp/test/javax/xml/jaxp/unittest/transform/Bug6513892.java
index da26d64..26a51f3 100644
--- a/jaxp/test/javax/xml/jaxp/unittest/transform/Bug6513892.java
+++ b/jaxp/test/javax/xml/jaxp/unittest/transform/Bug6513892.java
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2014, 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2014, 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,13 +34,19 @@
 
 import org.testng.Assert;
 import org.testng.annotations.BeforeClass;
+import org.testng.annotations.Listeners;
 import org.testng.annotations.Test;
 import org.w3c.dom.Document;
 
 /*
+ * @test
  * @bug 6513892
+ * @library /javax/xml/jaxp/libs /javax/xml/jaxp/unittest
+ * @run testng/othervm -DrunSecMngr=true transform.Bug6513892
+ * @run testng/othervm transform.Bug6513892
  * @summary Test the output encoding of the transform is the same as that of the redirect extension.
  */
+@Listeners({jaxp.library.FilePolicy.class})
 public class Bug6513892 {
     @BeforeClass
     public void setup(){
@@ -71,3 +77,4 @@
     }
 
 }
+
diff --git a/jaxp/test/javax/xml/jaxp/unittest/transform/Bug6537167.java b/jaxp/test/javax/xml/jaxp/unittest/transform/Bug6537167.java
index c75ff71..b77ec5d 100644
--- a/jaxp/test/javax/xml/jaxp/unittest/transform/Bug6537167.java
+++ b/jaxp/test/javax/xml/jaxp/unittest/transform/Bug6537167.java
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2014, 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2014, 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
@@ -32,12 +32,18 @@
 import javax.xml.transform.stream.StreamResult;
 import javax.xml.transform.stream.StreamSource;
 
+import org.testng.annotations.Listeners;
 import org.testng.annotations.Test;
 
 /*
+ * @test
  * @bug 6537167
+ * @library /javax/xml/jaxp/libs /javax/xml/jaxp/unittest
+ * @run testng/othervm -DrunSecMngr=true transform.Bug6537167
+ * @run testng/othervm transform.Bug6537167
  * @summary Test transforming for particular xsl files.
  */
+@Listeners({jaxp.library.FilePolicy.class})
 public class Bug6537167 {
 
     @Test
@@ -79,3 +85,4 @@
     }
 
 }
+
diff --git a/jaxp/test/javax/xml/jaxp/unittest/transform/Bug6540545.java b/jaxp/test/javax/xml/jaxp/unittest/transform/Bug6540545.java
index 2c76ad6..90cbfcc 100644
--- a/jaxp/test/javax/xml/jaxp/unittest/transform/Bug6540545.java
+++ b/jaxp/test/javax/xml/jaxp/unittest/transform/Bug6540545.java
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2014, 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2014, 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
@@ -31,12 +31,18 @@
 import javax.xml.transform.stream.StreamSource;
 
 import org.testng.Assert;
+import org.testng.annotations.Listeners;
 import org.testng.annotations.Test;
 
 /*
+ * @test
  * @bug 6540545
+ * @library /javax/xml/jaxp/libs /javax/xml/jaxp/unittest
+ * @run testng/othervm -DrunSecMngr=true transform.Bug6540545
+ * @run testng/othervm transform.Bug6540545
  * @summary Test XSLT as expected.
  */
+@Listeners({jaxp.library.FilePolicy.class})
 public class Bug6540545 {
 
     @Test
@@ -58,3 +64,4 @@
     }
 
 }
+
diff --git a/jaxp/test/javax/xml/jaxp/internaltest/javax/xml/transform/bug6551616/Bug6551616.java b/jaxp/test/javax/xml/jaxp/unittest/transform/Bug6551616.java
similarity index 85%
rename from jaxp/test/javax/xml/jaxp/internaltest/javax/xml/transform/bug6551616/Bug6551616.java
rename to jaxp/test/javax/xml/jaxp/unittest/transform/Bug6551616.java
index 6a07257..3bd1e7a 100644
--- a/jaxp/test/javax/xml/jaxp/internaltest/javax/xml/transform/bug6551616/Bug6551616.java
+++ b/jaxp/test/javax/xml/jaxp/unittest/transform/Bug6551616.java
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2014, 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2014, 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
@@ -23,21 +23,27 @@
 
 /*
  * @test
- * @modules java.xml/com.sun.org.apache.xalan.internal.xsltc.trax
  * @bug 6551616
+ * @library /javax/xml/jaxp/libs /javax/xml/jaxp/unittest
+ * @run testng/othervm -DrunSecMngr=true transform.Bug6551616
+ * @run testng/othervm transform.Bug6551616
  * @summary Test SAX2StAXEventWriter.
  */
 
+package transform;
+
 import java.io.InputStream;
 import java.io.StringBufferInputStream;
 
 import javax.xml.stream.XMLEventWriter;
 import javax.xml.stream.XMLOutputFactory;
 
+import org.testng.annotations.Listeners;
 import org.testng.annotations.Test;
 
 import com.sun.org.apache.xalan.internal.xsltc.trax.SAX2StAXEventWriter;
 
+@Listeners({jaxp.library.InternalAPIPolicy.class})
 public class Bug6551616 {
     String _cache = "";
 
@@ -62,3 +68,4 @@
         // if it doesn't blow up, it succeeded.
     }
 }
+
diff --git a/jaxp/test/javax/xml/jaxp/unittest/transform/Bug6559595.java b/jaxp/test/javax/xml/jaxp/unittest/transform/Bug6559595.java
index 162c92a..05a5e1c 100644
--- a/jaxp/test/javax/xml/jaxp/unittest/transform/Bug6559595.java
+++ b/jaxp/test/javax/xml/jaxp/unittest/transform/Bug6559595.java
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2014, 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2014, 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
@@ -35,12 +35,18 @@
 import javax.xml.transform.stream.StreamSource;
 
 import org.testng.Assert;
+import org.testng.annotations.Listeners;
 import org.testng.annotations.Test;
 
 /*
+ * @test
  * @bug 6559595
+ * @library /javax/xml/jaxp/libs /javax/xml/jaxp/unittest
+ * @run testng/othervm -DrunSecMngr=true transform.Bug6559595
+ * @run testng/othervm transform.Bug6559595
  * @summary Test ampersand in href attribute is not handled specially even if output is set to HTML.
  */
+@Listeners({jaxp.library.BasePolicy.class})
 public class Bug6559595 {
 
     @Test
@@ -64,3 +70,4 @@
     }
 
 }
+
diff --git a/jaxp/test/javax/xml/jaxp/unittest/transform/Bug6565260.java b/jaxp/test/javax/xml/jaxp/unittest/transform/Bug6565260.java
index 3b0f636..6a56d55 100644
--- a/jaxp/test/javax/xml/jaxp/unittest/transform/Bug6565260.java
+++ b/jaxp/test/javax/xml/jaxp/unittest/transform/Bug6565260.java
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2014, 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2014, 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
@@ -31,12 +31,18 @@
 import javax.xml.transform.stream.StreamSource;
 
 import org.testng.Assert;
+import org.testng.annotations.Listeners;
 import org.testng.annotations.Test;
 
 /*
+ * @test
  * @bug 6565260
+ * @library /javax/xml/jaxp/libs /javax/xml/jaxp/unittest
+ * @run testng/othervm -DrunSecMngr=true transform.Bug6565260
+ * @run testng/othervm transform.Bug6565260
  * @summary Test use-attribute-sets attribute is not used for the root node.
  */
+@Listeners({jaxp.library.FilePolicy.class})
 public class Bug6565260 {
 
     @Test
@@ -58,3 +64,4 @@
     }
 
 }
+
diff --git a/jaxp/test/javax/xml/jaxp/unittest/transform/Bug6940416.java b/jaxp/test/javax/xml/jaxp/unittest/transform/Bug6940416.java
index 41f7279..628310c 100644
--- a/jaxp/test/javax/xml/jaxp/unittest/transform/Bug6940416.java
+++ b/jaxp/test/javax/xml/jaxp/unittest/transform/Bug6940416.java
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2014, 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2014, 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
@@ -39,12 +39,18 @@
 import javax.xml.transform.stream.StreamSource;
 
 import org.testng.Assert;
+import org.testng.annotations.Listeners;
 import org.testng.annotations.Test;
 
 /*
+ * @test
  * @bug 6940416
+ * @library /javax/xml/jaxp/libs /javax/xml/jaxp/unittest
+ * @run testng/othervm -DrunSecMngr=true transform.Bug6940416
+ * @run testng/othervm transform.Bug6940416
  * @summary Test transforming correctly.
  */
+@Listeners({jaxp.library.FilePolicy.class})
 public class Bug6940416 {
 
     @Test
@@ -109,3 +115,4 @@
     }
 
 }
+
diff --git a/jaxp/test/javax/xml/jaxp/unittest/transform/BugDB12665704Test.java b/jaxp/test/javax/xml/jaxp/unittest/transform/BugDB12665704Test.java
index 5f5fa0e..e411070 100644
--- a/jaxp/test/javax/xml/jaxp/unittest/transform/BugDB12665704Test.java
+++ b/jaxp/test/javax/xml/jaxp/unittest/transform/BugDB12665704Test.java
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2014, 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2014, 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
@@ -43,12 +43,18 @@
 import javax.xml.transform.stream.StreamSource;
 
 import org.testng.Assert;
+import org.testng.annotations.Listeners;
 import org.testng.annotations.Test;
 
 /*
+ * @test
  * @bug 6935697
+ * @library /javax/xml/jaxp/libs /javax/xml/jaxp/unittest
+ * @run testng/othervm -DrunSecMngr=true transform.BugDB12665704Test
+ * @run testng/othervm transform.BugDB12665704Test
  * @summary Test Transformer can compile large xsl file.
  */
+@Listeners({jaxp.library.FilePolicy.class})
 public class BugDB12665704Test {
 
     @Test
@@ -151,3 +157,4 @@
         return sb.toString();
     }
 }
+
diff --git a/jaxp/test/javax/xml/jaxp/internaltest/javax/xml/transform/cli/CLITest.java b/jaxp/test/javax/xml/jaxp/unittest/transform/CLITest.java
similarity index 63%
rename from jaxp/test/javax/xml/jaxp/internaltest/javax/xml/transform/cli/CLITest.java
rename to jaxp/test/javax/xml/jaxp/unittest/transform/CLITest.java
index 7401f50..e72fc26 100644
--- a/jaxp/test/javax/xml/jaxp/internaltest/javax/xml/transform/cli/CLITest.java
+++ b/jaxp/test/javax/xml/jaxp/unittest/transform/CLITest.java
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2014, 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2014, 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
@@ -23,23 +23,31 @@
 
 /*
  * @test
- * @modules java.xml/com.sun.org.apache.xml.internal.utils
+ * @library /javax/xml/jaxp/libs /javax/xml/jaxp/unittest
+ * @run testng/othervm -DrunSecMngr=true transform.CLITest
+ * @run testng/othervm transform.CLITest
  * @summary Test internal transform CLI.
  */
 
-import org.testng.Assert;
+package transform;
+
+import java.util.PropertyPermission;
+
+import jaxp.library.JAXPTestUtilities;
+
+import org.testng.annotations.Listeners;
 import org.testng.annotations.Test;
 
+@Listeners({ jaxp.library.FilePolicy.class })
 public class CLITest {
 
     @Test
-    public void testCLI() {
-        try {
-            String[] args = new String[] { "-XSLTC", "-XSL", getClass().getResource("tigertest.xsl").toString(), "-IN",
-                    getClass().getResource("tigertest-in.xml").toString(), };
+    public void testCLI() throws Exception {
+        JAXPTestUtilities.tryRunWithTmpPermission(() -> {
+            String[] args = new String[] { "-XSLTC", "-XSL", getClass().getResource("tigertest.xsl").toString(),
+                "-IN", getClass().getResource("tigertest-in.xml").toString(), };
             ProcessXSLT.main(args);
-        } catch (Exception e) {
-            Assert.fail(e.getMessage());
-        }
+        }, new PropertyPermission("*", "read,write"));
     }
 }
+
diff --git a/jaxp/test/javax/xml/jaxp/unittest/transform/CR6401137Test.java b/jaxp/test/javax/xml/jaxp/unittest/transform/CR6401137Test.java
index 7a2c542..b7af4a5 100644
--- a/jaxp/test/javax/xml/jaxp/unittest/transform/CR6401137Test.java
+++ b/jaxp/test/javax/xml/jaxp/unittest/transform/CR6401137Test.java
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2014, 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2014, 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
@@ -37,12 +37,18 @@
 import javax.xml.transform.stream.StreamSource;
 
 import org.testng.Assert;
+import org.testng.annotations.Listeners;
 import org.testng.annotations.Test;
 
 /*
+ * @test
  * @bug 6401137
+ * @library /javax/xml/jaxp/libs /javax/xml/jaxp/unittest
+ * @run testng/othervm -DrunSecMngr=true transform.CR6401137Test
+ * @run testng/othervm transform.CR6401137Test
  * @summary Test transform certain xsl.
  */
+@Listeners({jaxp.library.FilePolicy.class})
 public class CR6401137Test {
 
     @Test
@@ -88,3 +94,4 @@
         }
     }
 }
+
diff --git a/jaxp/test/javax/xml/jaxp/unittest/transform/CR6551600.policy b/jaxp/test/javax/xml/jaxp/unittest/transform/CR6551600.policy
deleted file mode 100644
index 381c067..0000000
--- a/jaxp/test/javax/xml/jaxp/unittest/transform/CR6551600.policy
+++ /dev/null
@@ -1,22 +0,0 @@
-grant {
-	permission java.lang.reflect.ReflectPermission "suppressAccessChecks";
-	permission java.lang.RuntimePermission "accessDeclaredMembers";
-	
-	permission java.io.FilePermission "${test.classes}/../../-", "read, write, delete";
-	permission java.io.FilePermission ".", "read, write, delete";
-	permission java.util.PropertyPermission "*", "read, write";
-	
-    permission java.lang.RuntimePermission "setSecurityManager";
-    permission java.lang.RuntimePermission "createSecurityManager";
-    permission java.lang.RuntimePermission "createClassLoader";
-    permission java.lang.RuntimePermission "setIO";
-	permission java.lang.RuntimePermission "setContextClassLoader"; 
-	permission java.security.SecurityPermission "getPolicy";
-    
-    permission java.io.FilePermission "${test.src}/-", "read, write, delete";
-    permission java.io.FilePermission "${user.dir}/-", "read, write, delete";
-    permission java.io.FilePermission "${java.io.tmpdir}/-", "read, write, delete";
-    
-    permission java.io.FilePermission "//localhost/C$/xslt_unc_test.xml", "read, write, delete";
-    
-};
diff --git a/jaxp/test/javax/xml/jaxp/unittest/transform/CR6551600Test.java b/jaxp/test/javax/xml/jaxp/unittest/transform/CR6551600Test.java
index f364f5d..d08dddf 100644
--- a/jaxp/test/javax/xml/jaxp/unittest/transform/CR6551600Test.java
+++ b/jaxp/test/javax/xml/jaxp/unittest/transform/CR6551600Test.java
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2014, 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2014, 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
@@ -23,7 +23,10 @@
 
 package transform;
 
+import static jaxp.library.JAXPTestUtilities.getSystemProperty;
+
 import java.io.File;
+import java.io.FilePermission;
 
 import javax.xml.parsers.DocumentBuilder;
 import javax.xml.parsers.DocumentBuilderFactory;
@@ -32,57 +35,63 @@
 import javax.xml.transform.dom.DOMSource;
 import javax.xml.transform.stream.StreamResult;
 
+import jaxp.library.JAXPTestUtilities;
+
 import org.testng.Assert;
+import org.testng.annotations.Listeners;
 import org.testng.annotations.Test;
 import org.w3c.dom.Document;
 import org.w3c.dom.Element;
 
 /*
+ * @test
  * @bug 6551600
+ * @library /javax/xml/jaxp/libs /javax/xml/jaxp/unittest
+ * @run testng/othervm -DrunSecMngr=true transform.CR6551600Test
+ * @run testng/othervm transform.CR6551600Test
  * @summary Test using UNC path as StreamResult.
  */
+@Listeners({ jaxp.library.BasePolicy.class })
 public class CR6551600Test {
 
     @Test
     public final void testUNCPath() {
-        String hostName = "";
-        try {
-            hostName = java.net.InetAddress.getLocalHost().getHostName();
-        } catch (java.net.UnknownHostException e) {
-            // falls through
-        }
+        boolean isWindows = getSystemProperty("os.name").contains("Windows");
+        JAXPTestUtilities.runWithTmpPermission(() -> {
+            String hostName = "";
+            try {
+                hostName = java.net.InetAddress.getLocalHost().getHostName();
+            } catch (java.net.UnknownHostException e) {
+                // falls through
+            }
 
-        String path = "\\\\" + hostName + "\\C$\\xslt_unc_test.xml";
-        String os = System.getProperty("os.name");
-        if (os.indexOf("Windows") < 0) {
-            path = "///tmp/test.xml";
-        }
-        else {
-                policy.PolicyUtil.changePolicy(getClass().getResource("CR6551600.policy").getFile());
-        }
+            String path = isWindows ? "\\\\" + hostName + "\\C$\\xslt_unc_test.xml" : "///tmp/test.xml";
 
-        try {
-            DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance();
-            DocumentBuilder builder = factory.newDocumentBuilder();
-            Document doc = builder.newDocument();
-            Element root = doc.createElement("test");
-            doc.appendChild(root);
-            // create an identity transform
-            Transformer t = TransformerFactory.newInstance().newTransformer();
-            File f = new File(path);
-            StreamResult result = new StreamResult(f);
-            DOMSource source = new DOMSource(doc);
-            System.out.println("Writing to " + f);
-            t.transform(source, result);
-        } catch (Exception e) {
-            // unexpected failure
-            e.printStackTrace();
-            Assert.fail(e.toString());
-        }
+            try {
+                DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance();
+                DocumentBuilder builder = factory.newDocumentBuilder();
+                Document doc = builder.newDocument();
+                Element root = doc.createElement("test");
+                doc.appendChild(root);
+                // create an identity transform
+                Transformer t = TransformerFactory.newInstance().newTransformer();
+                File f = new File(path);
+                StreamResult result = new StreamResult(f);
+                DOMSource source = new DOMSource(doc);
+                System.out.println("Writing to " + f);
+                t.transform(source, result);
+            } catch (Exception e) {
+                // unexpected failure
+                e.printStackTrace();
+                Assert.fail(e.toString());
+            }
 
-        File file = new File(path);
-        if (file.exists()) {
-            file.deleteOnExit();
-        }
+            File file = new File(path);
+            if (file.exists()) {
+                file.deleteOnExit();
+            }
+        }, isWindows ? new FilePermission("//localhost/C$/xslt_unc_test.xml", "read,write,delete")
+                : new FilePermission("///tmp/test.xml", "read,write,delete"));
     }
 }
+
diff --git a/jaxp/test/javax/xml/jaxp/unittest/transform/CR6577667Test.java b/jaxp/test/javax/xml/jaxp/unittest/transform/CR6577667Test.java
index 70767a4..3602f80 100644
--- a/jaxp/test/javax/xml/jaxp/unittest/transform/CR6577667Test.java
+++ b/jaxp/test/javax/xml/jaxp/unittest/transform/CR6577667Test.java
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2014, 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2014, 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,12 +30,18 @@
 import javax.xml.transform.stream.StreamSource;
 
 import org.testng.Assert;
+import org.testng.annotations.Listeners;
 import org.testng.annotations.Test;
 
 /*
+ * @test
  * @bug 6577667
+ * @library /javax/xml/jaxp/libs /javax/xml/jaxp/unittest
+ * @run testng/othervm -DrunSecMngr=true transform.CR6577667Test
+ * @run testng/othervm transform.CR6577667Test
  * @summary Test XSLT can parse statement "not(preceding-sibling::* or following-sibling::*)" in stylesheet file.
  */
+@Listeners({jaxp.library.FilePolicy.class})
 public class CR6577667Test {
 
     @Test
@@ -53,3 +59,4 @@
 
     }
 }
+
diff --git a/jaxp/test/javax/xml/jaxp/unittest/transform/CR6652519Test.java b/jaxp/test/javax/xml/jaxp/unittest/transform/CR6652519Test.java
index 9be065f..0572385 100644
--- a/jaxp/test/javax/xml/jaxp/unittest/transform/CR6652519Test.java
+++ b/jaxp/test/javax/xml/jaxp/unittest/transform/CR6652519Test.java
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2014, 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2014, 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
@@ -33,13 +33,19 @@
 import javax.xml.transform.stream.StreamSource;
 
 import org.testng.Assert;
+import org.testng.annotations.Listeners;
 import org.testng.annotations.Test;
 import org.w3c.dom.Document;
 
 /*
+ * @test
  * @bug 6652519
+ * @library /javax/xml/jaxp/libs /javax/xml/jaxp/unittest
+ * @run testng/othervm -DrunSecMngr=true transform.CR6652519Test
+ * @run testng/othervm transform.CR6652519Test
  * @summary Test transfoming from StreamSource to DOMResult.
  */
+@Listeners({jaxp.library.FilePolicy.class})
 public class CR6652519Test {
 
     @Test
@@ -73,3 +79,4 @@
     }
 
 }
+
diff --git a/jaxp/test/javax/xml/jaxp/unittest/transform/CR6689809Test.java b/jaxp/test/javax/xml/jaxp/unittest/transform/CR6689809Test.java
index 91da2f6..cdfcae7 100644
--- a/jaxp/test/javax/xml/jaxp/unittest/transform/CR6689809Test.java
+++ b/jaxp/test/javax/xml/jaxp/unittest/transform/CR6689809Test.java
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2014, 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2014, 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,12 +30,18 @@
 import javax.xml.transform.stream.StreamSource;
 
 import org.testng.Assert;
+import org.testng.annotations.Listeners;
 import org.testng.annotations.Test;
 
 /*
+ * @test
  * @bug 6689809
+ * @library /javax/xml/jaxp/libs /javax/xml/jaxp/unittest
+ * @run testng/othervm -DrunSecMngr=true transform.CR6689809Test
+ * @run testng/othervm transform.CR6689809Test
  * @summary Test Transformer can handle XPath predicates in xsl:key elements.
  */
+@Listeners({jaxp.library.FilePolicy.class})
 public class CR6689809Test {
 
     @Test
@@ -58,3 +64,4 @@
         }
     }
 }
+
diff --git a/jaxp/test/javax/xml/jaxp/unittest/transform/CR6905829Test.java b/jaxp/test/javax/xml/jaxp/unittest/transform/CR6905829Test.java
index 60de73f..33f9957 100644
--- a/jaxp/test/javax/xml/jaxp/unittest/transform/CR6905829Test.java
+++ b/jaxp/test/javax/xml/jaxp/unittest/transform/CR6905829Test.java
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2014, 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2014, 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
@@ -32,12 +32,18 @@
 import javax.xml.transform.stream.StreamSource;
 
 import org.testng.Assert;
+import org.testng.annotations.Listeners;
 import org.testng.annotations.Test;
 
 /*
+ * @test
  * @bug 6905829
+ * @library /javax/xml/jaxp/libs /javax/xml/jaxp/unittest
+ * @run testng/othervm -DrunSecMngr=true transform.CR6905829Test
+ * @run testng/othervm transform.CR6905829Test
  * @summary Test XSLT can parse certain xsl.
  */
+@Listeners({jaxp.library.FilePolicy.class})
 public class CR6905829Test {
 
     @Test
@@ -59,3 +65,4 @@
         }
     }
 }
+
diff --git a/jaxp/test/javax/xml/jaxp/unittest/transform/CR6935697Test.java b/jaxp/test/javax/xml/jaxp/unittest/transform/CR6935697Test.java
index 6742d3f..3db8bc3 100644
--- a/jaxp/test/javax/xml/jaxp/unittest/transform/CR6935697Test.java
+++ b/jaxp/test/javax/xml/jaxp/unittest/transform/CR6935697Test.java
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2014, 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2014, 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,12 +34,18 @@
 import javax.xml.transform.stream.StreamSource;
 
 import org.testng.Assert;
+import org.testng.annotations.Listeners;
 import org.testng.annotations.Test;
 
 /*
+ * @test
  * @bug 6935697
+ * @library /javax/xml/jaxp/libs /javax/xml/jaxp/unittest
+ * @run testng/othervm -DrunSecMngr=true transform.CR6935697Test
+ * @run testng/othervm transform.CR6935697Test
  * @summary Test XSLT can parse the certain xsl.
  */
+@Listeners({jaxp.library.FilePolicy.class})
 public class CR6935697Test {
 
     @Test
@@ -71,3 +77,4 @@
         }
     }
 }
+
diff --git a/jaxp/test/javax/xml/jaxp/unittest/transform/CR6941869Test.java b/jaxp/test/javax/xml/jaxp/unittest/transform/CR6941869Test.java
index 07a18b6..8fd8925 100644
--- a/jaxp/test/javax/xml/jaxp/unittest/transform/CR6941869Test.java
+++ b/jaxp/test/javax/xml/jaxp/unittest/transform/CR6941869Test.java
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2014, 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2014, 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
@@ -32,12 +32,18 @@
 import javax.xml.transform.stream.StreamSource;
 
 import org.testng.Assert;
+import org.testng.annotations.Listeners;
 import org.testng.annotations.Test;
 
 /*
+ * @test
  * @bug 6941869
+ * @library /javax/xml/jaxp/libs /javax/xml/jaxp/unittest
+ * @run testng/othervm -DrunSecMngr=true transform.CR6941869Test
+ * @run testng/othervm transform.CR6941869Test
  * @summary Test XSLT evaluate "count(.|key('props', d/e)[1])" correctly.
  */
+@Listeners({jaxp.library.FilePolicy.class})
 public class CR6941869Test {
 
     @Test
@@ -70,3 +76,4 @@
         }
     }
 }
+
diff --git a/jaxp/test/javax/xml/jaxp/unittest/transform/CR6957215Test.java b/jaxp/test/javax/xml/jaxp/unittest/transform/CR6957215Test.java
index 3d9a740..4e4e7dd 100644
--- a/jaxp/test/javax/xml/jaxp/unittest/transform/CR6957215Test.java
+++ b/jaxp/test/javax/xml/jaxp/unittest/transform/CR6957215Test.java
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2014, 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2014, 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
@@ -39,12 +39,18 @@
 import javax.xml.transform.stream.StreamSource;
 
 import org.testng.Assert;
+import org.testng.annotations.Listeners;
 import org.testng.annotations.Test;
 
 /*
+ * @test
  * @bug 6957215
+ * @library /javax/xml/jaxp/libs /javax/xml/jaxp/unittest
+ * @run testng/othervm -DrunSecMngr=true transform.CR6957215Test
+ * @run testng/othervm transform.CR6957215Test
  * @summary Test XSLT generates the element content using xsl:attribute instructions.
  */
+@Listeners({jaxp.library.FilePolicy.class})
 public class CR6957215Test {
 
     @Test
@@ -93,3 +99,4 @@
         }
     }
 }
+
diff --git a/jaxp/test/javax/xml/jaxp/unittest/transform/CR7098746Test.java b/jaxp/test/javax/xml/jaxp/unittest/transform/CR7098746Test.java
index d67a58a..c84a512 100644
--- a/jaxp/test/javax/xml/jaxp/unittest/transform/CR7098746Test.java
+++ b/jaxp/test/javax/xml/jaxp/unittest/transform/CR7098746Test.java
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2014, 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2014, 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,12 +34,18 @@
 import javax.xml.transform.stream.StreamSource;
 
 import org.testng.Assert;
+import org.testng.annotations.Listeners;
 import org.testng.annotations.Test;
 
 /*
+ * @test
  * @bug 7098746
+ * @library /javax/xml/jaxp/libs /javax/xml/jaxp/unittest
+ * @run testng/othervm -DrunSecMngr=true transform.CR7098746Test
+ * @run testng/othervm transform.CR7098746Test
  * @summary Test transforming as expected.
  */
+@Listeners({jaxp.library.FilePolicy.class})
 public class CR7098746Test {
 
     @Test
@@ -84,3 +90,4 @@
         }
     }
 }
+
diff --git a/jaxp/test/javax/xml/jaxp/unittest/transform/DOMResultTest.java b/jaxp/test/javax/xml/jaxp/unittest/transform/DOMResultTest.java
index b21fadd..bf46190 100644
--- a/jaxp/test/javax/xml/jaxp/unittest/transform/DOMResultTest.java
+++ b/jaxp/test/javax/xml/jaxp/unittest/transform/DOMResultTest.java
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2014, 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2014, 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
@@ -23,6 +23,7 @@
 
 package transform;
 
+import org.testng.annotations.Listeners;
 import org.testng.annotations.Test;
 import org.testng.Assert;
 
@@ -46,8 +47,13 @@
 import org.xml.sax.SAXException;
 
 /*
+ * @test
+ * @library /javax/xml/jaxp/libs /javax/xml/jaxp/unittest
+ * @run testng/othervm -DrunSecMngr=true transform.DOMResultTest
+ * @run testng/othervm transform.DOMResultTest
  * @summary Test DOMResult.
  */
+@Listeners({jaxp.library.FilePolicy.class})
 public class DOMResultTest {
 
     @Test
@@ -209,3 +215,4 @@
     }
 
 }
+
diff --git a/jaxp/test/javax/xml/jaxp/unittest/transform/DocumentExtFunc.java b/jaxp/test/javax/xml/jaxp/unittest/transform/DocumentExtFunc.java
index 81227c7..f9a9351 100644
--- a/jaxp/test/javax/xml/jaxp/unittest/transform/DocumentExtFunc.java
+++ b/jaxp/test/javax/xml/jaxp/unittest/transform/DocumentExtFunc.java
@@ -33,3 +33,4 @@
         return "["+node.getNodeName() + ":" + node.getTextContent()+"]";
     }
 }
+
diff --git a/jaxp/test/javax/xml/jaxp/unittest/transform/FactoryFindTest.java b/jaxp/test/javax/xml/jaxp/unittest/transform/FactoryFindTest.java
index c0f17b8..56eff40 100644
--- a/jaxp/test/javax/xml/jaxp/unittest/transform/FactoryFindTest.java
+++ b/jaxp/test/javax/xml/jaxp/unittest/transform/FactoryFindTest.java
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2014, 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2014, 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
@@ -23,43 +23,44 @@
 
 package transform;
 
+import static jaxp.library.JAXPTestUtilities.runWithAllPerm;
+
 import java.net.URL;
 import java.net.URLClassLoader;
 
 import javax.xml.transform.TransformerFactory;
 
 import org.testng.Assert;
+import org.testng.annotations.Listeners;
 import org.testng.annotations.Test;
 
 /*
+ * @test
+ * @library /javax/xml/jaxp/libs /javax/xml/jaxp/unittest
+ * @run testng/othervm -DrunSecMngr=true transform.FactoryFindTest
+ * @run testng/othervm transform.FactoryFindTest
  * @summary Test creating TransformerFactory with ContextClassLoader.
  */
+@Listeners({jaxp.library.BasePolicy.class})
 public class FactoryFindTest {
 
     boolean myClassLoaderUsed = false;
 
     @Test
-    public void testFactoryFind() {
-        try {
-            // System.setProperty("jaxp.debug", "true");
+    public void testFactoryFind() throws Exception {
+        TransformerFactory factory = TransformerFactory.newInstance();
+        Assert.assertTrue(factory.getClass().getClassLoader() == null);
 
-            TransformerFactory factory = TransformerFactory.newInstance();
-            Assert.assertTrue(factory.getClass().getClassLoader() == null);
+        runWithAllPerm(() -> Thread.currentThread().setContextClassLoader(null));
+        factory = TransformerFactory.newInstance();
+        Assert.assertTrue(factory.getClass().getClassLoader() == null);
 
-            Thread.currentThread().setContextClassLoader(null);
-            factory = TransformerFactory.newInstance();
-            Assert.assertTrue(factory.getClass().getClassLoader() == null);
-
-            Thread.currentThread().setContextClassLoader(new MyClassLoader());
-            factory = TransformerFactory.newInstance();
-            if (System.getSecurityManager() == null)
-                Assert.assertTrue(myClassLoaderUsed);
-            else
-                Assert.assertFalse(myClassLoaderUsed);
-        } catch (Exception ex) {
-            Assert.fail(ex.toString());
-        }
-
+        runWithAllPerm(() -> Thread.currentThread().setContextClassLoader(new MyClassLoader()));
+        factory = TransformerFactory.newInstance();
+        if (System.getSecurityManager() == null)
+            Assert.assertTrue(myClassLoaderUsed);
+        else
+            Assert.assertFalse(myClassLoaderUsed);
     }
 
     class MyClassLoader extends URLClassLoader {
@@ -74,3 +75,4 @@
         }
     }
 }
+
diff --git a/jaxp/test/javax/xml/jaxp/unittest/transform/Issue2204Test.java b/jaxp/test/javax/xml/jaxp/unittest/transform/Issue2204Test.java
index b0912eb..52f41c4 100644
--- a/jaxp/test/javax/xml/jaxp/unittest/transform/Issue2204Test.java
+++ b/jaxp/test/javax/xml/jaxp/unittest/transform/Issue2204Test.java
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2014, 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2014, 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
@@ -31,12 +31,18 @@
 import javax.xml.transform.stream.StreamSource;
 
 import org.testng.Assert;
+import org.testng.annotations.Listeners;
 import org.testng.annotations.Test;
 
 /*
+ * @test
  * @bug 6905829
+ * @library /javax/xml/jaxp/libs /javax/xml/jaxp/unittest
+ * @run testng/othervm -DrunSecMngr=true transform.Issue2204Test
+ * @run testng/othervm transform.Issue2204Test
  * @summary Test XSLT can work against the certain xsl.
  */
+@Listeners({jaxp.library.FilePolicy.class})
 public class Issue2204Test {
 
     @Test
@@ -61,3 +67,4 @@
         }
     }
 }
+
diff --git a/jaxp/test/javax/xml/jaxp/unittest/transform/Issue2290Test.java b/jaxp/test/javax/xml/jaxp/unittest/transform/Issue2290Test.java
index b2be968..10ba861 100644
--- a/jaxp/test/javax/xml/jaxp/unittest/transform/Issue2290Test.java
+++ b/jaxp/test/javax/xml/jaxp/unittest/transform/Issue2290Test.java
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2014, 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2014, 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
@@ -41,11 +41,17 @@
 import org.w3c.dom.DocumentFragment;
 
 import org.testng.Assert;
+import org.testng.annotations.Listeners;
 import org.testng.annotations.Test;
 
 /*
+ * @test
+ * @library /javax/xml/jaxp/libs /javax/xml/jaxp/unittest
+ * @run testng/othervm -DrunSecMngr=true transform.Issue2290Test
+ * @run testng/othervm transform.Issue2290Test
  * @summary Test XSL extension for RTF works, for https://issues.apache.org/jira/i#browse/XALANJ-2290.
  */
+@Listeners({jaxp.library.FilePolicy.class})
 public class Issue2290Test {
 
     @Test
@@ -90,3 +96,4 @@
 
     }
 }
+
diff --git a/jaxp/test/javax/xml/jaxp/unittest/transform/OpenJDK100017Test.java b/jaxp/test/javax/xml/jaxp/unittest/transform/OpenJDK100017Test.java
index abe964f..4fceeaa 100644
--- a/jaxp/test/javax/xml/jaxp/unittest/transform/OpenJDK100017Test.java
+++ b/jaxp/test/javax/xml/jaxp/unittest/transform/OpenJDK100017Test.java
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2014, 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2014, 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
@@ -32,13 +32,19 @@
 import javax.xml.transform.stream.StreamResult;
 
 import org.testng.Assert;
+import org.testng.annotations.Listeners;
 import org.testng.annotations.Test;
 import org.xml.sax.SAXException;
 
 /*
+ * @test
  * @bug 6883209
+ * @library /javax/xml/jaxp/libs /javax/xml/jaxp/unittest
+ * @run testng/othervm -DrunSecMngr=true transform.OpenJDK100017Test
+ * @run testng/othervm transform.OpenJDK100017Test
  * @summary Test XSLT won't cause StackOverflow when it handle many characters.
  */
+@Listeners({jaxp.library.BasePolicy.class})
 public class OpenJDK100017Test {
 
     @Test
@@ -60,3 +66,4 @@
         }
     }
 }
+
diff --git a/jaxp/test/javax/xml/jaxp/internaltest/javax/xml/transform/cli/ProcessXSLT.java b/jaxp/test/javax/xml/jaxp/unittest/transform/ProcessXSLT.java
similarity index 99%
rename from jaxp/test/javax/xml/jaxp/internaltest/javax/xml/transform/cli/ProcessXSLT.java
rename to jaxp/test/javax/xml/jaxp/unittest/transform/ProcessXSLT.java
index 323d940..3425585 100644
--- a/jaxp/test/javax/xml/jaxp/internaltest/javax/xml/transform/cli/ProcessXSLT.java
+++ b/jaxp/test/javax/xml/jaxp/unittest/transform/ProcessXSLT.java
@@ -31,18 +31,29 @@
 // We however don't have a hard dependency on it. We will use
 // our own ErrorHandler if the default one is not accessible.
 //
+
+package transform;
+
+import static jaxp.library.JAXPTestUtilities.getSystemProperty;
+
 import java.io.FileOutputStream;
 import java.io.FileWriter;
 import java.io.PrintWriter;
 import java.io.StringReader;
+import java.lang.reflect.Constructor;
+import java.lang.reflect.Method;
+import java.util.ArrayList;
+import java.util.List;
 import java.util.Properties;
 
 import javax.xml.XMLConstants;
 import javax.xml.parsers.DocumentBuilder;
 import javax.xml.parsers.DocumentBuilderFactory;
 import javax.xml.parsers.ParserConfigurationException;
+import javax.xml.transform.ErrorListener;
 import javax.xml.transform.OutputKeys;
 import javax.xml.transform.Source;
+import javax.xml.transform.SourceLocator;
 import javax.xml.transform.Templates;
 import javax.xml.transform.Transformer;
 import javax.xml.transform.TransformerConfigurationException;
@@ -58,16 +69,9 @@
 import javax.xml.transform.sax.TransformerHandler;
 import javax.xml.transform.stream.StreamResult;
 import javax.xml.transform.stream.StreamSource;
-import java.lang.reflect.Constructor;
-import java.lang.reflect.Method;
-import java.util.ArrayList;
-import java.util.List;
-import javax.xml.transform.ErrorListener;
-import javax.xml.transform.SourceLocator;
 
 import org.w3c.dom.Document;
 import org.w3c.dom.Node;
-
 import org.xml.sax.ContentHandler;
 import org.xml.sax.EntityResolver;
 import org.xml.sax.ErrorHandler;
@@ -267,7 +271,7 @@
 
                 } else if ("-V".equalsIgnoreCase(argv[i])) {
                     diagnosticsWriter.println(">>>>>>> Java Version "
-                            + System.getProperty("java.version") + ", "
+                            + getSystemProperty("java.version") + ", "
                             + /* xmlProcessorLiaison.getParserDescription()+ */ "<<<<<<<");
                 } // J2SE does not support Xalan interpretive
                 /*
diff --git a/jaxp/test/javax/xml/jaxp/unittest/transform/SAX2DOMTest.java b/jaxp/test/javax/xml/jaxp/unittest/transform/SAX2DOMTest.java
index 6e3a9af..1dc5cfb 100644
--- a/jaxp/test/javax/xml/jaxp/unittest/transform/SAX2DOMTest.java
+++ b/jaxp/test/javax/xml/jaxp/unittest/transform/SAX2DOMTest.java
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2014, 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2014, 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
@@ -31,6 +31,7 @@
 import javax.xml.transform.sax.SAXSource;
 import javax.xml.transform.stream.StreamSource;
 
+import org.testng.annotations.Listeners;
 import org.testng.annotations.Test;
 import org.w3c.dom.Document;
 import org.w3c.dom.Element;
@@ -45,8 +46,13 @@
 import org.xml.sax.helpers.XMLFilterImpl;
 
 /*
+ * @test
+ * @library /javax/xml/jaxp/libs /javax/xml/jaxp/unittest
+ * @run testng/othervm -DrunSecMngr=true transform.SAX2DOMTest
+ * @run testng/othervm transform.SAX2DOMTest
  * @summary Test Transforming from SAX to DOM.
  */
+@Listeners({jaxp.library.FilePolicy.class})
 public class SAX2DOMTest {
 
     @Test
@@ -192,3 +198,4 @@
         }
     }
 }
+
diff --git a/jaxp/test/javax/xml/jaxp/unittest/transform/SecureProcessingTest.java b/jaxp/test/javax/xml/jaxp/unittest/transform/SecureProcessingTest.java
index 888f278..27a03bf 100644
--- a/jaxp/test/javax/xml/jaxp/unittest/transform/SecureProcessingTest.java
+++ b/jaxp/test/javax/xml/jaxp/unittest/transform/SecureProcessingTest.java
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2014, 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2014, 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
@@ -23,14 +23,10 @@
 
 package transform;
 
-import java.io.IOException;
 import java.io.InputStream;
 import java.io.StringWriter;
 
 import javax.xml.XMLConstants;
-import javax.xml.parsers.DocumentBuilder;
-import javax.xml.parsers.DocumentBuilderFactory;
-import javax.xml.parsers.ParserConfigurationException;
 import javax.xml.transform.Transformer;
 import javax.xml.transform.TransformerConfigurationException;
 import javax.xml.transform.TransformerException;
@@ -39,29 +35,19 @@
 import javax.xml.transform.stream.StreamSource;
 
 import org.testng.Assert;
-import org.testng.annotations.Test;
-import org.w3c.dom.Document;
-import org.xml.sax.SAXException;
+import org.testng.annotations.Listeners;
 
 /*
+ * @test
+ * @library /javax/xml/jaxp/libs /javax/xml/jaxp/unittest
+ * @run testng/othervm -DrunSecMngr=true transform.SecureProcessingTest
+ * @run testng/othervm transform.SecureProcessingTest
  * @summary Test XSLT shall report TransformerException for unsafe xsl when FEATURE_SECURE_PROCESSING is true.
  */
+@Listeners({jaxp.library.FilePolicy.class})
 public class SecureProcessingTest {
-    static boolean _isSecureMode = false;
-    static {
-        if (System.getSecurityManager() != null) {
-            _isSecureMode = true;
-            System.out.println("Security Manager is present");
-        } else {
-            System.out.println("Security Manager is NOT present");
-        }
-    }
-
-
-
-    @Test
-    public final void testSecureProcessing() {
-
+    public void testSecureProcessing() {
+        boolean _isSecureMode = System.getSecurityManager() != null;
         // SECURE_PROCESSING == false
 
         // the style sheet
@@ -149,3 +135,4 @@
         }
     }
 }
+
diff --git a/jaxp/test/javax/xml/jaxp/unittest/transform/SourceTest.java b/jaxp/test/javax/xml/jaxp/unittest/transform/SourceTest.java
index d0e7ae3..76507bf 100644
--- a/jaxp/test/javax/xml/jaxp/unittest/transform/SourceTest.java
+++ b/jaxp/test/javax/xml/jaxp/unittest/transform/SourceTest.java
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2014, 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2014, 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
@@ -35,11 +35,17 @@
 import javax.xml.transform.stream.StreamSource;
 
 import org.testng.Assert;
+import org.testng.annotations.Listeners;
 import org.testng.annotations.Test;
 
 /*
+ * @test
+ * @library /javax/xml/jaxp/libs /javax/xml/jaxp/unittest
+ * @run testng/othervm -DrunSecMngr=true transform.SourceTest
+ * @run testng/othervm transform.SourceTest
  * @summary Test Sources.
  */
+@Listeners({jaxp.library.FilePolicy.class})
 public class SourceTest {
 
     @Test
@@ -142,3 +148,4 @@
         }
     }
 }
+
diff --git a/jaxp/test/javax/xml/jaxp/unittest/transform/StAXSourceTest.java b/jaxp/test/javax/xml/jaxp/unittest/transform/StAXSourceTest.java
index dc149f4..cfa20d1 100644
--- a/jaxp/test/javax/xml/jaxp/unittest/transform/StAXSourceTest.java
+++ b/jaxp/test/javax/xml/jaxp/unittest/transform/StAXSourceTest.java
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2014, 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2014, 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
@@ -40,11 +40,17 @@
 import javax.xml.transform.stax.StAXSource;
 
 import org.testng.Assert;
+import org.testng.annotations.Listeners;
 import org.testng.annotations.Test;
 
 /*
+ * @test
+ * @library /javax/xml/jaxp/libs /javax/xml/jaxp/unittest
+ * @run testng/othervm -DrunSecMngr=true transform.StAXSourceTest
+ * @run testng/othervm transform.StAXSourceTest
  * @summary Test parsing from StAXSource.
  */
+@Listeners({jaxp.library.FilePolicy.class})
 public class StAXSourceTest {
 
     @Test
@@ -123,3 +129,4 @@
         }
     }
 }
+
diff --git a/jaxp/test/javax/xml/jaxp/unittest/transform/TemplatesTest.java b/jaxp/test/javax/xml/jaxp/unittest/transform/TemplatesTest.java
index 19509ed..e2a4fc2 100644
--- a/jaxp/test/javax/xml/jaxp/unittest/transform/TemplatesTest.java
+++ b/jaxp/test/javax/xml/jaxp/unittest/transform/TemplatesTest.java
@@ -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
@@ -29,11 +29,17 @@
 import javax.xml.transform.*;
 import javax.xml.transform.stream.StreamSource;
 import org.testng.annotations.DataProvider;
+import org.testng.annotations.Listeners;
 import org.testng.annotations.Test;
 
 /*
+ * @test
+ * @library /javax/xml/jaxp/libs /javax/xml/jaxp/unittest
+ * @run testng/othervm -DrunSecMngr=true transform.TemplatesTest
+ * @run testng/othervm transform.TemplatesTest
  * @summary This class contains tests for Templates.
  */
+@Listeners({jaxp.library.BasePolicy.class})
 public class TemplatesTest {
 
     /**
@@ -60,7 +66,7 @@
      * DataProvider: Templates
      */
     @DataProvider(name = "templates")
-    Object[][] getTemplates() throws Exception {
+    public Object[][] getTemplates() throws Exception {
         return new Object[][]{{TransformerFactory.newInstance().
                 newTemplates(new StreamSource(new StringReader(XSL)))}};
     }
@@ -77,3 +83,4 @@
             + "      contains($validAffectsRelClasses, @Class)]/@OBID)\"/>"
             + "</xsl:stylesheet>";
 }
+
diff --git a/jaxp/test/javax/xml/jaxp/unittest/transform/TransformerFactoryTest.java b/jaxp/test/javax/xml/jaxp/unittest/transform/TransformerFactoryTest.java
index 62b8497..2d6dfbf 100644
--- a/jaxp/test/javax/xml/jaxp/unittest/transform/TransformerFactoryTest.java
+++ b/jaxp/test/javax/xml/jaxp/unittest/transform/TransformerFactoryTest.java
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2014, 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2014, 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
@@ -42,13 +42,19 @@
 import javax.xml.transform.stream.StreamSource;
 
 import org.testng.Assert;
+import org.testng.annotations.Listeners;
 import org.testng.annotations.Test;
 import org.w3c.dom.Document;
 import org.xml.sax.SAXException;
 
 /*
+ * @test
+ * @library /javax/xml/jaxp/libs /javax/xml/jaxp/unittest
+ * @run testng/othervm -DrunSecMngr=true transform.TransformerFactoryTest
+ * @run testng/othervm transform.TransformerFactoryTest
  * @summary Test TransformerFactory.
  */
+@Listeners({jaxp.library.FilePolicy.class})
 public class TransformerFactoryTest {
 
     private static URIResolver resolver = new URIResolver() {
@@ -147,3 +153,4 @@
     }
 
 }
+
diff --git a/jaxp/test/javax/xml/jaxp/unittest/transform/TransformerTest.java b/jaxp/test/javax/xml/jaxp/unittest/transform/TransformerTest.java
index 6511a1b..199a4ba 100644
--- a/jaxp/test/javax/xml/jaxp/unittest/transform/TransformerTest.java
+++ b/jaxp/test/javax/xml/jaxp/unittest/transform/TransformerTest.java
@@ -23,8 +23,7 @@
 
 package transform;
 
-import com.sun.org.apache.xml.internal.serialize.OutputFormat;
-import com.sun.org.apache.xml.internal.serialize.XMLSerializer;
+import static jaxp.library.JAXPTestUtilities.getSystemProperty;
 
 import java.io.BufferedReader;
 import java.io.ByteArrayInputStream;
@@ -45,6 +44,7 @@
 
 import org.testng.Assert;
 import org.testng.AssertJUnit;
+import org.testng.annotations.Listeners;
 import org.testng.annotations.Test;
 import org.w3c.dom.Document;
 import org.w3c.dom.Node;
@@ -60,10 +60,18 @@
 import org.xml.sax.XMLReader;
 import org.xml.sax.helpers.AttributesImpl;
 
+import com.sun.org.apache.xml.internal.serialize.OutputFormat;
+import com.sun.org.apache.xml.internal.serialize.XMLSerializer;
+
 /*
+ * @test
+ * @library /javax/xml/jaxp/libs /javax/xml/jaxp/unittest
+ * @run testng/othervm -DrunSecMngr=true transform.TransformerTest
+ * @run testng/othervm transform.TransformerTest
  * @summary Transformer Tests
  * @bug 6272879 6305029 6505031 8150704 8162598
  */
+@Listeners({jaxp.library.FilePolicy.class})
 public class TransformerTest {
     private Transformer createTransformer() throws TransformerException {
         return TransformerFactory.newInstance().newTransformer();
@@ -245,7 +253,7 @@
      */
     @Test
     public final void testBug6272879() throws IOException, TransformerException {
-        final String LINE_SEPARATOR = System.getProperty("line.separator");
+        final String LINE_SEPARATOR = getSystemProperty("line.separator");
 
         final String xsl =
                 "<?xml version=\"1.0\" encoding=\"ISO-8859-1\"?>" + LINE_SEPARATOR +
@@ -380,7 +388,7 @@
      */
     @Test
     public final void testBug8162598() throws IOException, TransformerException {
-        final String LINE_SEPARATOR = System.getProperty("line.separator");
+        final String LINE_SEPARATOR = getSystemProperty("line.separator");
 
         final String xsl =
             "<?xml version=\"1.0\" encoding=\"UTF-8\"?>" + LINE_SEPARATOR +
@@ -431,3 +439,4 @@
         Assert.assertNull(document.getElementsByTagName("test6").item(0).getNamespaceURI(), "unexpected namespace for test6");
     }
 }
+
diff --git a/jaxp/test/javax/xml/jaxp/unittest/transform/TransformerUtilFactory.java b/jaxp/test/javax/xml/jaxp/unittest/transform/TransformerUtilFactory.java
index 793dd7a..dade0b6 100644
--- a/jaxp/test/javax/xml/jaxp/unittest/transform/TransformerUtilFactory.java
+++ b/jaxp/test/javax/xml/jaxp/unittest/transform/TransformerUtilFactory.java
@@ -56,3 +56,4 @@
             return null;
     }
 }
+
diff --git a/jaxp/test/javax/xml/jaxp/unittest/transform/VersionDefaultHandler.java b/jaxp/test/javax/xml/jaxp/unittest/transform/VersionDefaultHandler.java
index ff8fbfe..f79ecd6 100644
--- a/jaxp/test/javax/xml/jaxp/unittest/transform/VersionDefaultHandler.java
+++ b/jaxp/test/javax/xml/jaxp/unittest/transform/VersionDefaultHandler.java
@@ -62,3 +62,4 @@
         return encoding;
     }
 }
+
diff --git a/jaxp/test/javax/xml/jaxp/unittest/transform/VersionEventWriter.java b/jaxp/test/javax/xml/jaxp/unittest/transform/VersionEventWriter.java
index 51ff18c..e7fe77b 100644
--- a/jaxp/test/javax/xml/jaxp/unittest/transform/VersionEventWriter.java
+++ b/jaxp/test/javax/xml/jaxp/unittest/transform/VersionEventWriter.java
@@ -82,3 +82,4 @@
         return encoding;
     }
 }
+
diff --git a/jaxp/test/javax/xml/jaxp/unittest/transform/XSLTFunctionsTest.java b/jaxp/test/javax/xml/jaxp/unittest/transform/XSLTFunctionsTest.java
index fbc602c..51df591 100644
--- a/jaxp/test/javax/xml/jaxp/unittest/transform/XSLTFunctionsTest.java
+++ b/jaxp/test/javax/xml/jaxp/unittest/transform/XSLTFunctionsTest.java
@@ -35,14 +35,21 @@
 import javax.xml.transform.stream.StreamSource;
 
 import org.testng.annotations.DataProvider;
+import org.testng.annotations.Listeners;
 import org.testng.annotations.Test;
 
 import static org.testng.Assert.assertEquals;
 
 /*
+ * @test
+ * @library /javax/xml/jaxp/libs /javax/xml/jaxp/unittest
+ * @compile DocumentExtFunc.java
+ * @run testng/othervm -DrunSecMngr=true transform.XSLTFunctionsTest
+ * @run testng/othervm transform.XSLTFunctionsTest
  * @summary This class contains tests for XSLT functions.
  */
 
+//@Listeners({jaxp.library.BasePolicy.class}) //uncomment this line after 8161454 is resolved
 public class XSLTFunctionsTest {
 
     /**
@@ -65,6 +72,7 @@
 
         // Create factory and transformer
         TransformerFactory tf = TransformerFactory.newInstance();
+        tf.setFeature("http://www.oracle.com/xml/jaxp/properties/enableExtensionFunctions", true);
         Transformer t = tf.newTransformer( xslsrc );
         t.setErrorListener(tf.getErrorListener());
 
@@ -126,3 +134,4 @@
     static final String documentTesteExpectedResult = "<?xml version=\"1.0\" encoding=\"UTF-8\"?>"
                                                     + "<root>[Test:Doc][Test:External Doc]</root>";
 }
+
diff --git a/jaxp/test/javax/xml/jaxp/unittest/transform/sax/Bug6451633.java b/jaxp/test/javax/xml/jaxp/unittest/transform/sax/Bug6451633.java
index a299656..662c20b 100644
--- a/jaxp/test/javax/xml/jaxp/unittest/transform/sax/Bug6451633.java
+++ b/jaxp/test/javax/xml/jaxp/unittest/transform/sax/Bug6451633.java
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2014, 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2014, 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
@@ -29,14 +29,20 @@
 import javax.xml.transform.sax.TransformerHandler;
 
 import org.testng.Assert;
+import org.testng.annotations.Listeners;
 import org.testng.annotations.Test;
 import org.w3c.dom.Document;
 import org.xml.sax.helpers.AttributesImpl;
 
 /*
+ * @test
  * @bug 6451633
+ * @library /javax/xml/jaxp/libs /javax/xml/jaxp/unittest
+ * @run testng/othervm -DrunSecMngr=true transform.sax.Bug6451633
+ * @run testng/othervm transform.sax.Bug6451633
  * @summary Test TransformerHandler ignores empty text node.
  */
+@Listeners({jaxp.library.BasePolicy.class})
 public class Bug6451633 {
 
     @Test
@@ -56,3 +62,4 @@
         Assert.assertEquals(0, ((Document) result.getNode()).getDocumentElement().getChildNodes().getLength());
     }
 }
+
diff --git a/jaxp/test/javax/xml/jaxp/unittest/transform/util/DOMUtil.java b/jaxp/test/javax/xml/jaxp/unittest/transform/util/DOMUtil.java
index 988da74..832c10f 100644
--- a/jaxp/test/javax/xml/jaxp/unittest/transform/util/DOMUtil.java
+++ b/jaxp/test/javax/xml/jaxp/unittest/transform/util/DOMUtil.java
@@ -68,3 +68,4 @@
         Assert.assertTrue(version.equals(resultVersion), "Expected XML Version is 1.1, but actual version " + resultVersion);
     }
 }
+
diff --git a/jaxp/test/javax/xml/jaxp/unittest/transform/util/SAXUtil.java b/jaxp/test/javax/xml/jaxp/unittest/transform/util/SAXUtil.java
index 9e257eb..5bee601 100644
--- a/jaxp/test/javax/xml/jaxp/unittest/transform/util/SAXUtil.java
+++ b/jaxp/test/javax/xml/jaxp/unittest/transform/util/SAXUtil.java
@@ -70,3 +70,4 @@
         Assert.assertTrue(encoding.equals(resultEncoding), "Expected XML Version is " + encoding + " , but actual  encoding " + resultEncoding);
     }
 }
+
diff --git a/jaxp/test/javax/xml/jaxp/unittest/transform/util/StAXUtil.java b/jaxp/test/javax/xml/jaxp/unittest/transform/util/StAXUtil.java
index 26374d7..91423da 100644
--- a/jaxp/test/javax/xml/jaxp/unittest/transform/util/StAXUtil.java
+++ b/jaxp/test/javax/xml/jaxp/unittest/transform/util/StAXUtil.java
@@ -92,3 +92,4 @@
         ((StreamUtil) TransformerUtilFactory.getUtil(TransformerUtilFactory.STREAM)).checkStream(new FileInputStream(TEMP_FILE), version);
     }
 }
+
diff --git a/jaxp/test/javax/xml/jaxp/unittest/transform/util/StreamUtil.java b/jaxp/test/javax/xml/jaxp/unittest/transform/util/StreamUtil.java
index 019c2f1..91a37a9 100644
--- a/jaxp/test/javax/xml/jaxp/unittest/transform/util/StreamUtil.java
+++ b/jaxp/test/javax/xml/jaxp/unittest/transform/util/StreamUtil.java
@@ -23,10 +23,14 @@
 
 package transform.util;
 
+import static jaxp.library.JAXPTestUtilities.runWithTmpPermission;
+import static jaxp.library.JAXPTestUtilities.tryRunWithTmpPermission;
+
 import java.io.File;
 import java.io.FileInputStream;
 import java.io.FileOutputStream;
 import java.io.InputStream;
+import java.util.PropertyPermission;
 
 import javax.xml.parsers.DocumentBuilder;
 import javax.xml.parsers.SAXParser;
@@ -65,7 +69,7 @@
 
     public Result prepareResult() throws Exception {
         FileOutputStream fos = new FileOutputStream(TEMP_FILE);
-        return new StreamResult(fos);
+        return runWithTmpPermission(() -> new StreamResult(fos), new PropertyPermission("user.dir", "read"));
     }
 
     public void checkResult(Result result, String inputVersion) throws Exception {
@@ -85,8 +89,9 @@
         // use sax parser, as encoding info cannot be set on DOM document
         SAXParser parser = SAXParserFactory.newInstance().newSAXParser();
         VersionDefaultHandler dh = new VersionDefaultHandler();
-        parser.parse(new File(TEMP_FILE), dh);
+        tryRunWithTmpPermission(() -> parser.parse(new File(TEMP_FILE), dh), new PropertyPermission("user.dir", "read"));
         Assert.assertTrue(dh.getVersion().equals(version), "Expected version is " + version + " actual version " + dh.getVersion());
         Assert.assertTrue(dh.getEncoding().equals(encoding), "Expected version is " + encoding + " actual version " + dh.getEncoding());
     }
 }
+
diff --git a/jaxp/test/javax/xml/jaxp/unittest/util/BOMInputStream.java b/jaxp/test/javax/xml/jaxp/unittest/util/BOMInputStream.java
index 2088452..d142b7a 100644
--- a/jaxp/test/javax/xml/jaxp/unittest/util/BOMInputStream.java
+++ b/jaxp/test/javax/xml/jaxp/unittest/util/BOMInputStream.java
@@ -78,3 +78,4 @@
         }
 
 }
+
diff --git a/jaxp/test/javax/xml/jaxp/unittest/util/BaseStAXUT.java b/jaxp/test/javax/xml/jaxp/unittest/util/BaseStAXUT.java
index 86a5433..c3211c5 100644
--- a/jaxp/test/javax/xml/jaxp/unittest/util/BaseStAXUT.java
+++ b/jaxp/test/javax/xml/jaxp/unittest/util/BaseStAXUT.java
@@ -557,3 +557,4 @@
         System.err.println("Skipping " + clsName + "#" + method + ": entity expansion does not seem to be functioning properly" + msg + ".");
     }
 }
+
diff --git a/jaxp/test/javax/xml/jaxp/unittest/validation/6773084.policy b/jaxp/test/javax/xml/jaxp/unittest/validation/6773084.policy
deleted file mode 100644
index b454793..0000000
--- a/jaxp/test/javax/xml/jaxp/unittest/validation/6773084.policy
+++ /dev/null
@@ -1,23 +0,0 @@
-grant {
-	permission java.lang.reflect.ReflectPermission "suppressAccessChecks";
-	permission java.lang.RuntimePermission "accessDeclaredMembers";
-	
-	permission java.io.FilePermission "${test.classes}/../../-", "read, write, delete";
-	permission java.io.FilePermission ".", "read, write, delete";
-	permission java.util.PropertyPermission "*", "read, write";
-	
-    permission java.lang.RuntimePermission "setSecurityManager";
-    permission java.lang.RuntimePermission "createSecurityManager";
-    permission java.lang.RuntimePermission "createClassLoader";
-    permission java.lang.RuntimePermission "setIO";
-	permission java.lang.RuntimePermission "setContextClassLoader"; 
-	permission java.security.SecurityPermission "getPolicy";
-    
-    permission java.io.FilePermission "${test.src}/-", "read, write, delete";
-    permission java.io.FilePermission "${user.dir}/-", "read, write, delete";
-    permission java.io.FilePermission "${java.io.tmpdir}/-", "read, write, delete";
-    
-    
-    permission java.lang.RuntimePermission "modifyThread";
-
-};
diff --git a/jaxp/test/javax/xml/jaxp/unittest/validation/AnyElementTest.java b/jaxp/test/javax/xml/jaxp/unittest/validation/AnyElementTest.java
index a1218b1..8c615c5 100644
--- a/jaxp/test/javax/xml/jaxp/unittest/validation/AnyElementTest.java
+++ b/jaxp/test/javax/xml/jaxp/unittest/validation/AnyElementTest.java
@@ -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
@@ -23,7 +23,11 @@
 package validation;
 
 /*
+ * @test
  * @bug 8080907
+ * @library /javax/xml/jaxp/libs /javax/xml/jaxp/unittest
+ * @run testng/othervm -DrunSecMngr=true validation.AnyElementTest
+ * @run testng/othervm validation.AnyElementTest
  * @summary Test processContents attribute of any element
  */
 import static javax.xml.XMLConstants.W3C_XML_SCHEMA_NS_URI;
@@ -35,10 +39,12 @@
 import javax.xml.validation.Validator;
 
 import org.testng.annotations.BeforeClass;
+import org.testng.annotations.Listeners;
 import org.testng.annotations.Test;
 import org.xml.sax.SAXException;
 import org.xml.sax.SAXParseException;
 
+@Listeners({jaxp.library.FilePolicy.class})
 public class AnyElementTest {
     @BeforeClass
     public void setup() throws URISyntaxException, SAXException {
@@ -79,3 +85,4 @@
 
     private Validator validator;
 }
+
diff --git a/jaxp/test/javax/xml/jaxp/unittest/validation/Bug4966232.java b/jaxp/test/javax/xml/jaxp/unittest/validation/Bug4966232.java
index 1e9d473..3c0c6db 100644
--- a/jaxp/test/javax/xml/jaxp/unittest/validation/Bug4966232.java
+++ b/jaxp/test/javax/xml/jaxp/unittest/validation/Bug4966232.java
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2014, 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2014, 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,14 +30,20 @@
 import javax.xml.validation.SchemaFactory;
 
 import org.testng.Assert;
+import org.testng.annotations.Listeners;
 import org.testng.annotations.Test;
 import org.w3c.dom.Document;
 import org.xml.sax.InputSource;
 
 /*
+ * @test
  * @bug 4966232
+ * @library /javax/xml/jaxp/libs /javax/xml/jaxp/unittest
+ * @run testng/othervm -DrunSecMngr=true validation.Bug4966232
+ * @run testng/othervm validation.Bug4966232
  * @summary Test SchemaFactory.newSchema(Source) returns a Schema instance for DOMSource & SAXSource.
  */
+@Listeners({jaxp.library.FilePolicy.class})
 public class Bug4966232 {
 
     // test for W3C XML Schema 1.0 - newSchema(Source schema)
@@ -69,3 +75,4 @@
         Assert.assertNotNull(s);
     }
 }
+
diff --git a/jaxp/test/javax/xml/jaxp/unittest/validation/Bug4966254.java b/jaxp/test/javax/xml/jaxp/unittest/validation/Bug4966254.java
index e081f37..4eafe25 100644
--- a/jaxp/test/javax/xml/jaxp/unittest/validation/Bug4966254.java
+++ b/jaxp/test/javax/xml/jaxp/unittest/validation/Bug4966254.java
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2014, 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2014, 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
@@ -29,15 +29,21 @@
 import javax.xml.validation.Validator;
 
 import org.testng.Assert;
+import org.testng.annotations.Listeners;
 import org.testng.annotations.Test;
 import org.xml.sax.SAXException;
 
 import util.DraconianErrorHandler;
 
 /*
+ * @test
  * @bug 4966254
+ * @library /javax/xml/jaxp/libs /javax/xml/jaxp/unittest
+ * @run testng/othervm -DrunSecMngr=true validation.Bug4966254
+ * @run testng/othervm validation.Bug4966254
  * @summary Test validate(StreamSource) & validate(StreamSource,null) works instead of throws IOException.
  */
+@Listeners({jaxp.library.FilePolicy.class})
 public class Bug4966254 {
 
     static final String SCHEMA_LANGUAGE = "http://java.sun.com/xml/jaxp/properties/schemaLanguage";
@@ -72,3 +78,4 @@
         return s;
     }
 }
+
diff --git a/jaxp/test/javax/xml/jaxp/unittest/validation/Bug4969042.java b/jaxp/test/javax/xml/jaxp/unittest/validation/Bug4969042.java
index d04395e..31770d1 100644
--- a/jaxp/test/javax/xml/jaxp/unittest/validation/Bug4969042.java
+++ b/jaxp/test/javax/xml/jaxp/unittest/validation/Bug4969042.java
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2014, 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2014, 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,6 +34,7 @@
 import javax.xml.validation.ValidatorHandler;
 
 import org.testng.Assert;
+import org.testng.annotations.Listeners;
 import org.testng.annotations.Test;
 import org.xml.sax.InputSource;
 import org.xml.sax.SAXException;
@@ -41,10 +42,15 @@
 import org.xml.sax.helpers.DefaultHandler;
 
 /*
+ * @test
  * @bug 4969042
+ * @library /javax/xml/jaxp/libs /javax/xml/jaxp/unittest
+ * @run testng/othervm -DrunSecMngr=true validation.Bug4969042
+ * @run testng/othervm validation.Bug4969042
  * @summary Test ValidationHandler shall invoke ignorableWhitespace() of the
  * user-defined ContentHandler once the validator detects any ignorable whitespaces.
  */
+@Listeners({jaxp.library.BasePolicy.class})
 public class Bug4969042 {
 
     public static final String XSD = "<?xml version='1.0'?>\n" + "<schema xmlns='http://www.w3.org/2001/XMLSchema'\n" + "        xmlns:test='jaxp13_test'\n"
@@ -105,3 +111,4 @@
         Assert.assertTrue(invoked[1], "Method characters() was not invoked.");
     }
 }
+
diff --git a/jaxp/test/javax/xml/jaxp/unittest/validation/Bug4969089.java b/jaxp/test/javax/xml/jaxp/unittest/validation/Bug4969089.java
index 4b7f0b5..1f7e75f 100644
--- a/jaxp/test/javax/xml/jaxp/unittest/validation/Bug4969089.java
+++ b/jaxp/test/javax/xml/jaxp/unittest/validation/Bug4969089.java
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2014, 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2014, 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,16 +30,22 @@
 import javax.xml.validation.SchemaFactory;
 
 import org.testng.Assert;
+import org.testng.annotations.Listeners;
 import org.testng.annotations.Test;
 import org.xml.sax.SAXException;
 import org.xml.sax.SAXParseException;
 import org.xml.sax.helpers.DefaultHandler;
 
 /*
+ * @test
  * @bug 4969089
+ * @library /javax/xml/jaxp/libs /javax/xml/jaxp/unittest
+ * @run testng/othervm -DrunSecMngr=true validation.Bug4969089
+ * @run testng/othervm validation.Bug4969089
  * @summary Test when an ErrorHandler is set for a SchemaFactory, SchemaFactory.newSchema(Source[])
  * method throws an exception that is not equal to the exception thrown from the ErrorHandler.
  */
+@Listeners({jaxp.library.BasePolicy.class})
 public class Bug4969089 {
 
     @Test
@@ -70,3 +76,4 @@
         }
     }
 }
+
diff --git a/jaxp/test/javax/xml/jaxp/unittest/validation/Bug4969110.java b/jaxp/test/javax/xml/jaxp/unittest/validation/Bug4969110.java
index ace534e..637aefd 100644
--- a/jaxp/test/javax/xml/jaxp/unittest/validation/Bug4969110.java
+++ b/jaxp/test/javax/xml/jaxp/unittest/validation/Bug4969110.java
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2014, 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2014, 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,15 +27,21 @@
 import javax.xml.validation.ValidatorHandler;
 
 import org.testng.Assert;
+import org.testng.annotations.Listeners;
 import org.testng.annotations.Test;
 import org.xml.sax.SAXException;
 import org.xml.sax.SAXNotRecognizedException;
 
 /*
+ * @test
  * @bug 4969110
+ * @library /javax/xml/jaxp/libs /javax/xml/jaxp/unittest
+ * @run testng/othervm -DrunSecMngr=true validation.Bug4969110
+ * @run testng/othervm validation.Bug4969110
  * @summary Test ValidationHandler.set/getProperty() throws a correct exception
  * instead of a sun internal exception in case the "property name" parameter is invalid.
  */
+@Listeners({jaxp.library.BasePolicy.class})
 public class Bug4969110 {
 
     SchemaFactory schemaFactory = SchemaFactory.newInstance("http://www.w3.org/2001/XMLSchema");
@@ -73,3 +79,4 @@
         validatorHandler.setProperty(name, "123");
     }
 }
+
diff --git a/jaxp/test/javax/xml/jaxp/unittest/validation/Bug4969689.java b/jaxp/test/javax/xml/jaxp/unittest/validation/Bug4969689.java
index 85cc249..a3973ba 100644
--- a/jaxp/test/javax/xml/jaxp/unittest/validation/Bug4969689.java
+++ b/jaxp/test/javax/xml/jaxp/unittest/validation/Bug4969689.java
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2014, 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2014, 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,16 +26,22 @@
 import javax.xml.validation.SchemaFactory;
 
 import org.testng.Assert;
+import org.testng.annotations.Listeners;
 import org.testng.annotations.Test;
 import org.xml.sax.SAXNotRecognizedException;
 import org.xml.sax.SAXNotSupportedException;
 
 
 /*
+ * @test
  * @bug 4969689
+ * @library /javax/xml/jaxp/libs /javax/xml/jaxp/unittest
+ * @run testng/othervm -DrunSecMngr=true validation.Bug4969689
+ * @run testng/othervm validation.Bug4969689
  * @summary Test SchemaFactory.get/setFeature() throw NullPointerException
  * instead of SAXNotRecognizedException in case the "feature name" parameter is null.
  */
+@Listeners({jaxp.library.BasePolicy.class})
 public class Bug4969689 {
 
     SchemaFactory schemaFactory = SchemaFactory.newInstance("http://www.w3.org/2001/XMLSchema");
@@ -60,3 +66,4 @@
         }
     }
 }
+
diff --git a/jaxp/test/javax/xml/jaxp/unittest/validation/Bug4969692.java b/jaxp/test/javax/xml/jaxp/unittest/validation/Bug4969692.java
index 2e14612..cafb7dc 100644
--- a/jaxp/test/javax/xml/jaxp/unittest/validation/Bug4969692.java
+++ b/jaxp/test/javax/xml/jaxp/unittest/validation/Bug4969692.java
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2014, 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2014, 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,20 @@
 import javax.xml.validation.Validator;
 
 import org.testng.Assert;
+import org.testng.annotations.Listeners;
 import org.testng.annotations.Test;
 import org.xml.sax.SAXException;
 
 /*
+ * @test
  * @bug 4969692
+ * @library /javax/xml/jaxp/libs /javax/xml/jaxp/unittest
+ * @run testng/othervm -DrunSecMngr=true validation.Bug4969692
+ * @run testng/othervm validation.Bug4969692
  * @summary Test Validator.get/setFeature() throw NullPointerException
  * instead of SAXNotRecognizedException in case the "feature name" parameter is null.
  */
+@Listeners({jaxp.library.BasePolicy.class})
 public class Bug4969692 {
 
     SchemaFactory schemaFactory = SchemaFactory.newInstance("http://www.w3.org/2001/XMLSchema");
@@ -61,3 +67,4 @@
         }
     }
 }
+
diff --git a/jaxp/test/javax/xml/jaxp/unittest/validation/Bug4969693.java b/jaxp/test/javax/xml/jaxp/unittest/validation/Bug4969693.java
index 18512dd..8cfe3f8 100644
--- a/jaxp/test/javax/xml/jaxp/unittest/validation/Bug4969693.java
+++ b/jaxp/test/javax/xml/jaxp/unittest/validation/Bug4969693.java
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2014, 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2014, 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,20 @@
 import javax.xml.validation.Validator;
 
 import org.testng.Assert;
+import org.testng.annotations.Listeners;
 import org.testng.annotations.Test;
 import org.xml.sax.SAXException;
 
 /*
+ * @test
  * @bug 4969693
+ * @library /javax/xml/jaxp/libs /javax/xml/jaxp/unittest
+ * @run testng/othervm -DrunSecMngr=true validation.Bug4969693
+ * @run testng/othervm validation.Bug4969693
  * @summary Test Validator.get/setProperty() throw NullPointerException
  * instead of SAXNotRecognizedException in case the "property name" parameter is null.
  */
+@Listeners({jaxp.library.BasePolicy.class})
 public class Bug4969693 {
 
     SchemaFactory schemaFactory = SchemaFactory.newInstance("http://www.w3.org/2001/XMLSchema");
@@ -61,3 +67,4 @@
         }
     }
 }
+
diff --git a/jaxp/test/javax/xml/jaxp/unittest/validation/Bug4969695.java b/jaxp/test/javax/xml/jaxp/unittest/validation/Bug4969695.java
index db69416..dbc3346 100644
--- a/jaxp/test/javax/xml/jaxp/unittest/validation/Bug4969695.java
+++ b/jaxp/test/javax/xml/jaxp/unittest/validation/Bug4969695.java
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2014, 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2014, 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,15 +26,21 @@
 import javax.xml.validation.SchemaFactory;
 
 import org.testng.Assert;
+import org.testng.annotations.Listeners;
 import org.testng.annotations.Test;
 import org.xml.sax.SAXNotRecognizedException;
 import org.xml.sax.SAXNotSupportedException;
 
 /*
+ * @test
  * @bug 4969695
+ * @library /javax/xml/jaxp/libs /javax/xml/jaxp/unittest
+ * @run testng/othervm -DrunSecMngr=true validation.Bug4969695
+ * @run testng/othervm validation.Bug4969695
  * @summary Test SchemaFactory.get/setProperty() throw NullPointerException
  * instead of SAXNotRecognizedException in case the "property name" parameter is null.
  */
+@Listeners({jaxp.library.BasePolicy.class})
 public class Bug4969695 {
 
     SchemaFactory schemaFactory = SchemaFactory.newInstance("http://www.w3.org/2001/XMLSchema");
@@ -59,3 +65,4 @@
         }
     }
 }
+
diff --git a/jaxp/test/javax/xml/jaxp/unittest/validation/Bug4969732.java b/jaxp/test/javax/xml/jaxp/unittest/validation/Bug4969732.java
index 3fe2dcf..b633c96 100644
--- a/jaxp/test/javax/xml/jaxp/unittest/validation/Bug4969732.java
+++ b/jaxp/test/javax/xml/jaxp/unittest/validation/Bug4969732.java
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2014, 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2014, 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
@@ -33,6 +33,7 @@
 import javax.xml.validation.ValidatorHandler;
 
 import org.testng.Assert;
+import org.testng.annotations.Listeners;
 import org.testng.annotations.Test;
 import org.xml.sax.InputSource;
 import org.xml.sax.SAXException;
@@ -40,10 +41,15 @@
 import org.xml.sax.helpers.DefaultHandler;
 
 /*
+ * @test
  * @bug 4969732
+ * @library /javax/xml/jaxp/libs /javax/xml/jaxp/unittest
+ * @run testng/othervm -DrunSecMngr=true validation.Bug4969732
+ * @run testng/othervm validation.Bug4969732
  * @summary Test TypeInfoProvider.getElementTypeInfo() throws IllegalStateException
  * in case the method is not called from method startElement() or endElement().
  */
+@Listeners({jaxp.library.BasePolicy.class})
 public class Bug4969732 {
 
     public static final String XSD = "<?xml version='1.0'?>\n" + "<schema xmlns='http://www.w3.org/2001/XMLSchema'\n" + "        xmlns:test='jaxp13_test'\n"
@@ -106,3 +112,4 @@
         parse(xmlReader, XML);
     }
 }
+
diff --git a/jaxp/test/javax/xml/jaxp/unittest/validation/Bug4970380.java b/jaxp/test/javax/xml/jaxp/unittest/validation/Bug4970380.java
index b9d0555..8046b8d 100644
--- a/jaxp/test/javax/xml/jaxp/unittest/validation/Bug4970380.java
+++ b/jaxp/test/javax/xml/jaxp/unittest/validation/Bug4970380.java
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2014, 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2014, 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,13 +27,19 @@
 import javax.xml.validation.ValidatorHandler;
 
 import org.testng.Assert;
+import org.testng.annotations.Listeners;
 import org.testng.annotations.Test;
 import org.xml.sax.SAXNotRecognizedException;
 
 /*
+ * @test
  * @bug 4970380
+ * @library /javax/xml/jaxp/libs /javax/xml/jaxp/unittest
+ * @run testng/othervm -DrunSecMngr=true validation.Bug4970380
+ * @run testng/othervm validation.Bug4970380
  * @summary Test validatorHandler.getFeature(...) with unknown name and "http://xml.org/sax/features/namespace-prefixes".
  */
+@Listeners({jaxp.library.BasePolicy.class})
 public class Bug4970380 {
 
     @Test
@@ -56,3 +62,4 @@
         }
     }
 }
+
diff --git a/jaxp/test/javax/xml/jaxp/unittest/validation/Bug4970383.java b/jaxp/test/javax/xml/jaxp/unittest/validation/Bug4970383.java
index f536153..354a3c1 100644
--- a/jaxp/test/javax/xml/jaxp/unittest/validation/Bug4970383.java
+++ b/jaxp/test/javax/xml/jaxp/unittest/validation/Bug4970383.java
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2014, 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2014, 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,18 @@
 import javax.xml.validation.ValidatorHandler;
 
 import org.testng.Assert;
+import org.testng.annotations.Listeners;
 import org.testng.annotations.Test;
 
 /*
+ * @test
  * @bug 4970383
+ * @library /javax/xml/jaxp/libs /javax/xml/jaxp/unittest
+ * @run testng/othervm -DrunSecMngr=true validation.Bug4970383
+ * @run testng/othervm validation.Bug4970383
  * @summary Test validatorHandler.setFeature throws NullPointerException if name parameter is null.
  */
+@Listeners({jaxp.library.BasePolicy.class})
 public class Bug4970383 {
 
     @Test
@@ -47,3 +53,4 @@
         }
     }
 }
+
diff --git a/jaxp/test/javax/xml/jaxp/unittest/validation/Bug4970400.java b/jaxp/test/javax/xml/jaxp/unittest/validation/Bug4970400.java
index c457567..d6de921 100644
--- a/jaxp/test/javax/xml/jaxp/unittest/validation/Bug4970400.java
+++ b/jaxp/test/javax/xml/jaxp/unittest/validation/Bug4970400.java
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2014, 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2014, 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,12 +26,18 @@
 import javax.xml.validation.SchemaFactory;
 import javax.xml.validation.ValidatorHandler;
 
+import org.testng.annotations.Listeners;
 import org.testng.annotations.Test;
 
 /*
+ * @test
  * @bug 4970400
+ * @library /javax/xml/jaxp/libs /javax/xml/jaxp/unittest
+ * @run testng/othervm -DrunSecMngr=true validation.Bug4970400
+ * @run testng/othervm validation.Bug4970400
  * @summary Test ValidatorHandler recognizes namespace-prefixes feature.
  */
+@Listeners({jaxp.library.BasePolicy.class})
 public class Bug4970400 {
 
     @Test
@@ -42,3 +48,4 @@
         validatorHandler.setFeature("http://xml.org/sax/features/namespace-prefixes", true);
     }
 }
+
diff --git a/jaxp/test/javax/xml/jaxp/unittest/validation/Bug4970402.java b/jaxp/test/javax/xml/jaxp/unittest/validation/Bug4970402.java
index e66e010..c31fc8d 100644
--- a/jaxp/test/javax/xml/jaxp/unittest/validation/Bug4970402.java
+++ b/jaxp/test/javax/xml/jaxp/unittest/validation/Bug4970402.java
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2014, 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2014, 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
@@ -35,6 +35,7 @@
 import javax.xml.validation.ValidatorHandler;
 
 import org.testng.Assert;
+import org.testng.annotations.Listeners;
 import org.testng.annotations.Test;
 import org.xml.sax.Attributes;
 import org.xml.sax.InputSource;
@@ -43,9 +44,14 @@
 import org.xml.sax.helpers.DefaultHandler;
 
 /*
+ * @test
  * @bug 4970402
+ * @library /javax/xml/jaxp/libs /javax/xml/jaxp/unittest
+ * @run testng/othervm -DrunSecMngr=true validation.Bug4970402
+ * @run testng/othervm validation.Bug4970402
  * @summary Test TypeInfoProvider's attribute accessing methods throw IndexOutOfBoundsException when index parameter is invalid.
  */
+@Listeners({jaxp.library.BasePolicy.class})
 public class Bug4970402 {
 
     public static final String XSD = "<?xml version='1.0'?>\n" + "<schema xmlns='http://www.w3.org/2001/XMLSchema'\n" + "        xmlns:test='jaxp13_test'\n"
@@ -117,3 +123,4 @@
         parse(xmlReader, XML);
     }
 }
+
diff --git a/jaxp/test/javax/xml/jaxp/unittest/validation/Bug4970951.java b/jaxp/test/javax/xml/jaxp/unittest/validation/Bug4970951.java
index e033d49..2c4dfe9 100644
--- a/jaxp/test/javax/xml/jaxp/unittest/validation/Bug4970951.java
+++ b/jaxp/test/javax/xml/jaxp/unittest/validation/Bug4970951.java
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2014, 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2014, 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
@@ -35,6 +35,7 @@
 import javax.xml.validation.ValidatorHandler;
 
 import org.testng.Assert;
+import org.testng.annotations.Listeners;
 import org.testng.annotations.Test;
 import org.xml.sax.Attributes;
 import org.xml.sax.InputSource;
@@ -43,9 +44,14 @@
 import org.xml.sax.helpers.DefaultHandler;
 
 /*
+ * @test
  * @bug 4970951
+ * @library /javax/xml/jaxp/libs /javax/xml/jaxp/unittest
+ * @run testng/othervm -DrunSecMngr=true validation.Bug4970951
+ * @run testng/othervm validation.Bug4970951
  * @summary Test TypeInfoProvider.isSpecified(...) return true if the attribute was originally present.
  */
+@Listeners({jaxp.library.BasePolicy.class})
 public class Bug4970951 {
 
     public static final String XSD = "<?xml version='1.0'?>\n" + "<schema xmlns='http://www.w3.org/2001/XMLSchema'\n" + "        xmlns:test='jaxp13_test'\n"
@@ -120,3 +126,4 @@
         parse(xmlReader, XML);
     }
 }
+
diff --git a/jaxp/test/javax/xml/jaxp/unittest/validation/Bug4971605.java b/jaxp/test/javax/xml/jaxp/unittest/validation/Bug4971605.java
index 566f17c..8ca323f 100644
--- a/jaxp/test/javax/xml/jaxp/unittest/validation/Bug4971605.java
+++ b/jaxp/test/javax/xml/jaxp/unittest/validation/Bug4971605.java
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2014, 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2014, 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
@@ -33,14 +33,20 @@
 import javax.xml.validation.SchemaFactory;
 
 import org.testng.Assert;
+import org.testng.annotations.Listeners;
 import org.testng.annotations.Test;
 import org.w3c.dom.Node;
 import org.xml.sax.InputSource;
 
 /*
+ * @test
  * @bug 4971605
+ * @library /javax/xml/jaxp/libs /javax/xml/jaxp/unittest
+ * @run testng/othervm -DrunSecMngr=true validation.Bug4971605
+ * @run testng/othervm validation.Bug4971605
  * @summary Test SchemaFactory.newSchema(Source) returns a Schema instance for DOMSource.
  */
+@Listeners({jaxp.library.BasePolicy.class})
 public class Bug4971605 {
 
     @Test
@@ -60,3 +66,4 @@
         Assert.assertNotNull(schema, "Failed: newSchema returned null.");
     }
 }
+
diff --git a/jaxp/test/javax/xml/jaxp/unittest/validation/Bug4971607.java b/jaxp/test/javax/xml/jaxp/unittest/validation/Bug4971607.java
index 870e7a7..6ee9bca 100644
--- a/jaxp/test/javax/xml/jaxp/unittest/validation/Bug4971607.java
+++ b/jaxp/test/javax/xml/jaxp/unittest/validation/Bug4971607.java
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2014, 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2014, 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,18 @@
 import javax.xml.validation.ValidatorHandler;
 
 import org.testng.Assert;
+import org.testng.annotations.Listeners;
 import org.testng.annotations.Test;
 
 /*
+ * @test
  * @bug 4971607
+ * @library /javax/xml/jaxp/libs /javax/xml/jaxp/unittest
+ * @run testng/othervm -DrunSecMngr=true validation.Bug4971607
+ * @run testng/othervm validation.Bug4971607
  * @summary Test ValidatorHandler.getFeature(...) throws NullPointerException when name parameter is null.
  */
+@Listeners({jaxp.library.BasePolicy.class})
 public class Bug4971607 {
 
     @Test
@@ -50,3 +56,4 @@
         }
     }
 }
+
diff --git a/jaxp/test/javax/xml/jaxp/unittest/validation/Bug4972882.java b/jaxp/test/javax/xml/jaxp/unittest/validation/Bug4972882.java
index 8b3ce66..8c84351 100644
--- a/jaxp/test/javax/xml/jaxp/unittest/validation/Bug4972882.java
+++ b/jaxp/test/javax/xml/jaxp/unittest/validation/Bug4972882.java
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2014, 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2014, 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
@@ -28,15 +28,21 @@
 import javax.xml.parsers.DocumentBuilderFactory;
 
 import org.testng.Assert;
+import org.testng.annotations.Listeners;
 import org.testng.annotations.Test;
 import org.xml.sax.SAXException;
 
 import util.DraconianErrorHandler;
 
 /*
+ * @test
  * @bug 4972882
+ * @library /javax/xml/jaxp/libs /javax/xml/jaxp/unittest
+ * @run testng/othervm -DrunSecMngr=true validation.Bug4972882
+ * @run testng/othervm validation.Bug4972882
  * @summary Test Validator throws Exception when two identity-constraints are defined with the same {name} and {target namespace}.
  */
+@Listeners({jaxp.library.FilePolicy.class})
 public class Bug4972882 {
 
     static final String SCHEMA_LANGUAGE = "http://java.sun.com/xml/jaxp/properties/schemaLanguage";
@@ -61,3 +67,4 @@
         }
     }
 }
+
diff --git a/jaxp/test/javax/xml/jaxp/unittest/validation/Bug4986844.java b/jaxp/test/javax/xml/jaxp/unittest/validation/Bug4986844.java
index f98f6d5..a4dfc4c 100644
--- a/jaxp/test/javax/xml/jaxp/unittest/validation/Bug4986844.java
+++ b/jaxp/test/javax/xml/jaxp/unittest/validation/Bug4986844.java
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2014, 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2014, 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,13 +26,19 @@
 import javax.xml.validation.SchemaFactory;
 
 import org.testng.Assert;
+import org.testng.annotations.Listeners;
 import org.testng.annotations.Test;
 import org.xml.sax.SAXException;
 
 /*
+ * @test
  * @bug 4986844
+ * @library /javax/xml/jaxp/libs /javax/xml/jaxp/unittest
+ * @run testng/othervm -DrunSecMngr=true validation.Bug4986844
+ * @run testng/othervm validation.Bug4986844
  * @summary Test SchemaFactory can detect particle restriction.
  */
+@Listeners({jaxp.library.FilePolicy.class})
 public class Bug4986844 {
 
     @Test
@@ -50,3 +56,4 @@
         }
     }
 }
+
diff --git a/jaxp/test/javax/xml/jaxp/unittest/validation/Bug4987574.java b/jaxp/test/javax/xml/jaxp/unittest/validation/Bug4987574.java
index d479455..a5f0c52 100644
--- a/jaxp/test/javax/xml/jaxp/unittest/validation/Bug4987574.java
+++ b/jaxp/test/javax/xml/jaxp/unittest/validation/Bug4987574.java
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2014, 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2014, 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
@@ -23,24 +23,33 @@
 
 package validation;
 
+import static jaxp.library.JAXPTestUtilities.USER_DIR;
+
 import java.io.File;
 import java.io.FileWriter;
 import java.io.PrintWriter;
+import java.nio.file.Paths;
 
 import javax.xml.validation.SchemaFactory;
 
+import org.testng.annotations.Listeners;
 import org.testng.annotations.Test;
 
 /*
+ * @test
  * @bug 4987574
+ * @library /javax/xml/jaxp/libs /javax/xml/jaxp/unittest
+ * @run testng/othervm -DrunSecMngr=true validation.Bug4987574
+ * @run testng/othervm validation.Bug4987574
  * @summary Test schemaFactory.newSchema doesn't throw NullPointerExceptio for empty schema.
  */
+@Listeners({jaxp.library.FilePolicy.class})
 public class Bug4987574 {
 
     @Test
     public void test1() throws Exception {
         SchemaFactory schemaFactory = SchemaFactory.newInstance("http://www.w3.org/2001/XMLSchema");
-        File tmpFile = File.createTempFile("jaxpri", "bug");
+        File tmpFile = File.createTempFile("jaxpri", "bug", Paths.get(USER_DIR).toFile());
         tmpFile.deleteOnExit();
         {
             PrintWriter pw = new PrintWriter(new FileWriter(tmpFile));
@@ -51,3 +60,4 @@
         schemaFactory.newSchema(tmpFile);
     }
 }
+
diff --git a/jaxp/test/javax/xml/jaxp/unittest/validation/Bug4988267.java b/jaxp/test/javax/xml/jaxp/unittest/validation/Bug4988267.java
index ef57585..51f735c 100644
--- a/jaxp/test/javax/xml/jaxp/unittest/validation/Bug4988267.java
+++ b/jaxp/test/javax/xml/jaxp/unittest/validation/Bug4988267.java
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2014, 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2014, 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,13 +26,19 @@
 import javax.xml.validation.SchemaFactory;
 
 import org.testng.Assert;
+import org.testng.annotations.Listeners;
 import org.testng.annotations.Test;
 import org.xml.sax.SAXException;
 
 /*
+ * @test
  * @bug 4988267
+ * @library /javax/xml/jaxp/libs /javax/xml/jaxp/unittest
+ * @run testng/othervm -DrunSecMngr=true validation.Bug4988267
+ * @run testng/othervm validation.Bug4988267
  * @summary Test SchemaFactory can detect particle restriction.
  */
+@Listeners({jaxp.library.FilePolicy.class})
 public class Bug4988267 {
 
     @Test
@@ -50,3 +56,4 @@
         }
     }
 }
+
diff --git a/jaxp/test/javax/xml/jaxp/unittest/validation/Bug4988268.java b/jaxp/test/javax/xml/jaxp/unittest/validation/Bug4988268.java
index 0005f17..8512993 100644
--- a/jaxp/test/javax/xml/jaxp/unittest/validation/Bug4988268.java
+++ b/jaxp/test/javax/xml/jaxp/unittest/validation/Bug4988268.java
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2014, 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2014, 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
@@ -25,12 +25,18 @@
 
 import javax.xml.validation.SchemaFactory;
 
+import org.testng.annotations.Listeners;
 import org.testng.annotations.Test;
 
 /*
+ * @test
  * @bug 4988268
+ * @library /javax/xml/jaxp/libs /javax/xml/jaxp/unittest
+ * @run testng/othervm -DrunSecMngr=true validation.Bug4988268
+ * @run testng/othervm validation.Bug4988268
  * @summary Test the schema is valid.
  */
+@Listeners({jaxp.library.FilePolicy.class})
 public class Bug4988268 {
 
     @Test
@@ -40,3 +46,4 @@
         schemaFactory.newSchema(Bug4988268.class.getResource("Bug4988268.xsd"));
     }
 }
+
diff --git a/jaxp/test/javax/xml/jaxp/unittest/validation/Bug4988387.java b/jaxp/test/javax/xml/jaxp/unittest/validation/Bug4988387.java
index b7b889b..c5c2434 100644
--- a/jaxp/test/javax/xml/jaxp/unittest/validation/Bug4988387.java
+++ b/jaxp/test/javax/xml/jaxp/unittest/validation/Bug4988387.java
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2014, 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2014, 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,13 +26,19 @@
 import javax.xml.validation.SchemaFactory;
 
 import org.testng.Assert;
+import org.testng.annotations.Listeners;
 import org.testng.annotations.Test;
 import org.xml.sax.SAXException;
 
 /*
+ * @test
  * @bug 4988387
+ * @library /javax/xml/jaxp/libs /javax/xml/jaxp/unittest
+ * @run testng/othervm -DrunSecMngr=true validation.Bug4988387
+ * @run testng/othervm validation.Bug4988387
  * @summary Test SchemaFactory can detect invalid XPath expressions.
  */
+@Listeners({jaxp.library.FilePolicy.class})
 public class Bug4988387 {
 
     @Test
@@ -47,3 +53,4 @@
         }
     }
 }
+
diff --git a/jaxp/test/javax/xml/jaxp/unittest/validation/Bug4996446.java b/jaxp/test/javax/xml/jaxp/unittest/validation/Bug4996446.java
index 4ea0afe..e27b80a 100644
--- a/jaxp/test/javax/xml/jaxp/unittest/validation/Bug4996446.java
+++ b/jaxp/test/javax/xml/jaxp/unittest/validation/Bug4996446.java
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2014, 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2014, 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,26 +30,32 @@
 import org.testng.Assert;
 import org.testng.annotations.AfterMethod;
 import org.testng.annotations.BeforeMethod;
+import org.testng.annotations.Listeners;
 import org.testng.annotations.Test;
 import org.xml.sax.SAXException;
 import org.xml.sax.SAXParseException;
 import org.xml.sax.helpers.DefaultHandler;
 
 /*
+ * @test
  * @bug 4996446
+ * @library /javax/xml/jaxp/libs /javax/xml/jaxp/unittest
+ * @run testng/othervm -DrunSecMngr=true validation.Bug4996446
+ * @run testng/othervm validation.Bug4996446
  * @summary Test SchemaFactory can detect violations of the "Schema Component Constraint: Element Declarations Consistent".
  */
+@Listeners({jaxp.library.FilePolicy.class})
 public class Bug4996446 {
 
     SchemaFactory schemaFactory = null;
 
     @BeforeMethod
-    protected void setUp() {
+    public void setUp() {
         schemaFactory = SchemaFactory.newInstance("http://www.w3.org/2001/XMLSchema");
     }
 
     @AfterMethod
-    protected void tearDown() {
+    public void tearDown() {
         schemaFactory = null;
     }
 
@@ -84,3 +90,4 @@
         errorCounter++;
     }
 }
+
diff --git a/jaxp/test/javax/xml/jaxp/unittest/validation/Bug4997818.java b/jaxp/test/javax/xml/jaxp/unittest/validation/Bug4997818.java
index b46bf36..d39c239 100644
--- a/jaxp/test/javax/xml/jaxp/unittest/validation/Bug4997818.java
+++ b/jaxp/test/javax/xml/jaxp/unittest/validation/Bug4997818.java
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2014, 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2014, 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,15 +30,21 @@
 import javax.xml.validation.SchemaFactory;
 
 import org.testng.Assert;
+import org.testng.annotations.Listeners;
 import org.testng.annotations.Test;
 import org.w3c.dom.ls.LSInput;
 import org.w3c.dom.ls.LSResourceResolver;
 
 /*
+ * @test
  * @bug 4997818
+ * @library /javax/xml/jaxp/libs /javax/xml/jaxp/unittest
+ * @run testng/othervm -DrunSecMngr=true validation.Bug4997818
+ * @run testng/othervm validation.Bug4997818
  * @summary Test SchemaFactory.newSchema(...) throws an exception, which is thrown from LSResourceResolver.
  */
 
+@Listeners({jaxp.library.BasePolicy.class})
 public class Bug4997818 {
 
     @Test
@@ -75,3 +81,4 @@
         }
     }
 }
+
diff --git a/jaxp/test/javax/xml/jaxp/unittest/validation/Bug5011500.java b/jaxp/test/javax/xml/jaxp/unittest/validation/Bug5011500.java
index 6d79fb2..f8444a5 100644
--- a/jaxp/test/javax/xml/jaxp/unittest/validation/Bug5011500.java
+++ b/jaxp/test/javax/xml/jaxp/unittest/validation/Bug5011500.java
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2014, 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2014, 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,15 +34,21 @@
 import javax.xml.validation.ValidatorHandler;
 
 import org.testng.annotations.BeforeMethod;
+import org.testng.annotations.Listeners;
 import org.testng.annotations.Test;
 import org.xml.sax.InputSource;
 import org.xml.sax.XMLReader;
 import org.xml.sax.helpers.DefaultHandler;
 
 /*
+ * @test
  * @bug 5011500
+ * @library /javax/xml/jaxp/libs /javax/xml/jaxp/unittest
+ * @run testng/othervm -DrunSecMngr=true validation.Bug5011500
+ * @run testng/othervm validation.Bug5011500
  * @summary Test ValidatorHanlder and Validator can work for the xml document.
  */
+@Listeners({jaxp.library.BasePolicy.class})
 public class Bug5011500 {
 
     public static final String XSD = "<?xml version='1.0'?>\n" + "<schema xmlns='http://www.w3.org/2001/XMLSchema'\n" + "        xmlns:test='jaxp13_test'\n"
@@ -102,3 +108,4 @@
         validator.validate(xmlSource);
     }
 }
+
diff --git a/jaxp/test/javax/xml/jaxp/unittest/validation/Bug5072946.java b/jaxp/test/javax/xml/jaxp/unittest/validation/Bug5072946.java
index 9769d1d..ff58fd7 100644
--- a/jaxp/test/javax/xml/jaxp/unittest/validation/Bug5072946.java
+++ b/jaxp/test/javax/xml/jaxp/unittest/validation/Bug5072946.java
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2014, 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2014, 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
@@ -36,6 +36,7 @@
 import javax.xml.validation.Validator;
 
 import org.testng.Assert;
+import org.testng.annotations.Listeners;
 import org.testng.annotations.Test;
 import org.w3c.dom.Document;
 import org.w3c.dom.Element;
@@ -45,9 +46,14 @@
 import org.xml.sax.helpers.XMLReaderFactory;
 
 /*
+ * @test
  * @bug 5072946
+ * @library /javax/xml/jaxp/libs /javax/xml/jaxp/unittest
+ * @run testng/othervm -DrunSecMngr=true validation.Bug5072946
+ * @run testng/othervm validation.Bug5072946
  * @summary Test Validator.validate(DOMSource,DOMResult) outputs to the result.
  */
+@Listeners({jaxp.library.FilePolicy.class})
 public class Bug5072946 {
 
     @Test
@@ -119,3 +125,4 @@
         Assert.assertSame(r.getNode(), n);
     }
 }
+
diff --git a/jaxp/test/javax/xml/jaxp/unittest/validation/Bug6378043.java b/jaxp/test/javax/xml/jaxp/unittest/validation/Bug6378043.java
index c561bb1..344ff0f 100644
--- a/jaxp/test/javax/xml/jaxp/unittest/validation/Bug6378043.java
+++ b/jaxp/test/javax/xml/jaxp/unittest/validation/Bug6378043.java
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2014, 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2014, 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,18 @@
 import javax.xml.validation.SchemaFactory;
 
 import org.testng.Assert;
+import org.testng.annotations.Listeners;
 import org.testng.annotations.Test;
 
 /*
+ * @test
  * @bug 6378043
+ * @library /javax/xml/jaxp/libs /javax/xml/jaxp/unittest
+ * @run testng/othervm -DrunSecMngr=true validation.Bug6378043
+ * @run testng/othervm validation.Bug6378043
  * @summary Test XPath expression "child::" can be parsed.
  */
+@Listeners({jaxp.library.FilePolicy.class})
 public class Bug6378043 {
 
     static String SCHEMA_LANG = "http://www.w3.org/2001/XMLSchema";
@@ -47,3 +53,4 @@
         }
     }
 }
+
diff --git a/jaxp/test/javax/xml/jaxp/unittest/validation/Bug6449797.java b/jaxp/test/javax/xml/jaxp/unittest/validation/Bug6449797.java
index 3b797ed..4ae313d 100644
--- a/jaxp/test/javax/xml/jaxp/unittest/validation/Bug6449797.java
+++ b/jaxp/test/javax/xml/jaxp/unittest/validation/Bug6449797.java
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2014, 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2014, 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
@@ -25,13 +25,19 @@
 import javax.xml.XMLConstants;
 import javax.xml.validation.SchemaFactory;
 
+import org.testng.annotations.Listeners;
 import org.testng.annotations.Test;
 import org.xml.sax.SAXException;
 
 /*
+ * @test
  * @bug 6449797
+ * @library /javax/xml/jaxp/libs /javax/xml/jaxp/unittest
+ * @run testng/othervm -DrunSecMngr=true validation.Bug6449797
+ * @run testng/othervm validation.Bug6449797
  * @summary Test SchemaFactory can parse the specified attribute value with a specified namespace.
  */
+@Listeners({jaxp.library.FilePolicy.class})
 public class Bug6449797 {
 
     @Test
@@ -40,3 +46,4 @@
         SchemaFactory.newInstance(XMLConstants.W3C_XML_SCHEMA_NS_URI).newSchema(getClass().getResource("Bug6449797.xsd"));
     }
 }
+
diff --git a/jaxp/test/javax/xml/jaxp/unittest/validation/Bug6457662.java b/jaxp/test/javax/xml/jaxp/unittest/validation/Bug6457662.java
index 3518a0e..60181d6 100644
--- a/jaxp/test/javax/xml/jaxp/unittest/validation/Bug6457662.java
+++ b/jaxp/test/javax/xml/jaxp/unittest/validation/Bug6457662.java
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2014, 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2014, 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
@@ -23,12 +23,15 @@
 
 package validation;
 
+import static jaxp.library.JAXPTestUtilities.USER_DIR;
+
 import java.io.File;
 import java.io.FileOutputStream;
 import java.io.IOException;
 import java.io.OutputStream;
 import java.io.OutputStreamWriter;
 import java.io.StringReader;
+import java.nio.file.Paths;
 
 import javax.xml.XMLConstants;
 import javax.xml.transform.stream.StreamSource;
@@ -36,13 +39,18 @@
 import javax.xml.validation.SchemaFactory;
 import javax.xml.validation.Validator;
 
-import org.testng.Assert;
+import org.testng.annotations.Listeners;
 import org.testng.annotations.Test;
 
 /*
+ * @test
  * @bug 6457662
+ * @library /javax/xml/jaxp/libs /javax/xml/jaxp/unittest
+ * @run testng/othervm -DrunSecMngr=true validation.Bug6457662
+ * @run testng/othervm validation.Bug6457662
  * @summary Test a Validator checks sequence maxOccurs correctly when it validates document repeatedly.
  */
+@Listeners({jaxp.library.FilePolicy.class})
 public class Bug6457662 {
 
     public static final String xml = "<ACL xmlns:xsi='http://www.w3.org/2001/XMLSchema-instance'>" + "<Tokens access=\"full\">" + "<Token>CheetahTech</Token>"
@@ -59,21 +67,17 @@
     private static final SchemaFactory factory = SchemaFactory.newInstance(XMLConstants.W3C_XML_SCHEMA_NS_URI);
 
     @Test
-    public void test() {
-        try {
-            final Schema sc = factory.newSchema(writeSchema());
-            final Validator validator = sc.newValidator();
-            validator.validate(new StreamSource(new StringReader(xml)));
-            validator.validate(new StreamSource(new StringReader(xml)));
-            validator.validate(new StreamSource(new StringReader(xml)));
-            validator.validate(new StreamSource(new StringReader(xml)));
-        } catch (Throwable ex) {
-            Assert.fail("Exception: " + ex.getMessage());
-        }
+    public void test() throws Exception {
+        final Schema sc = factory.newSchema(writeSchema());
+        final Validator validator = sc.newValidator();
+        validator.validate(new StreamSource(new StringReader(xml)));
+        validator.validate(new StreamSource(new StringReader(xml)));
+        validator.validate(new StreamSource(new StringReader(xml)));
+        validator.validate(new StreamSource(new StringReader(xml)));
     }
 
     private File writeSchema() throws IOException {
-        final File rtn = File.createTempFile("scheam", "xsd");
+        final File rtn = File.createTempFile("scheam", "xsd", Paths.get(USER_DIR).toFile());
         final OutputStream out = new FileOutputStream(rtn);
         final OutputStreamWriter writer = new OutputStreamWriter(out, "UTF-8");
         writer.write(schema);
@@ -82,3 +86,4 @@
         return rtn;
     }
 }
+
diff --git a/jaxp/test/javax/xml/jaxp/unittest/validation/Bug6467424Test.java b/jaxp/test/javax/xml/jaxp/unittest/validation/Bug6467424Test.java
index 4ebce56..b5ebcb6 100644
--- a/jaxp/test/javax/xml/jaxp/unittest/validation/Bug6467424Test.java
+++ b/jaxp/test/javax/xml/jaxp/unittest/validation/Bug6467424Test.java
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2014, 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2014, 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
@@ -43,14 +43,20 @@
 import javax.xml.validation.Validator;
 
 import org.testng.Assert;
+import org.testng.annotations.Listeners;
 import org.testng.annotations.Test;
 import org.w3c.dom.Document;
 import org.xml.sax.SAXException;
 
 /*
+ * @test
  * @bug 6467424
+ * @library /javax/xml/jaxp/libs /javax/xml/jaxp/unittest
+ * @run testng/othervm -DrunSecMngr=true validation.Bug6467424Test
+ * @run testng/othervm validation.Bug6467424Test
  * @summary Test Validator augments the default delement value if feature element-default is on.
  */
+@Listeners({jaxp.library.FilePolicy.class})
 public class Bug6467424Test {
     static final String SCHEMA_LANGUAGE = "http://java.sun.com/xml/jaxp/properties/schemaLanguage";
     static final String SCHEMA_SOURCE = "http://java.sun.com/xml/jaxp/properties/schemaSource";
@@ -199,3 +205,4 @@
         }
     }
 }
+
diff --git a/jaxp/test/javax/xml/jaxp/unittest/validation/Bug6483188.java b/jaxp/test/javax/xml/jaxp/unittest/validation/Bug6483188.java
index f594713..ceebedf 100644
--- a/jaxp/test/javax/xml/jaxp/unittest/validation/Bug6483188.java
+++ b/jaxp/test/javax/xml/jaxp/unittest/validation/Bug6483188.java
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2014, 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2014, 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
@@ -31,29 +31,25 @@
 import javax.xml.validation.Validator;
 
 import org.testng.Assert;
+import org.testng.annotations.Listeners;
 import org.testng.annotations.Test;
 import org.xml.sax.SAXParseException;
 
 /*
+ * @test
  * @bug 6483188
+ * @library /javax/xml/jaxp/libs /javax/xml/jaxp/unittest
+ * @run testng/othervm -DrunSecMngr=true validation.Bug6483188
+ * @run testng/othervm validation.Bug6483188
  * @summary Test Schema Validator can handle element with having large maxOccurs, but doesn't accept sequence with having large maxOccurs in FEATURE_SECURE_PROCESSING mode.
  */
+@Test(singleThreaded = true)
+@Listeners({jaxp.library.FilePolicy.class})
 public class Bug6483188 {
-    static boolean _isSecureMode = false;
-    static {
-        if (System.getSecurityManager() != null) {
-            _isSecureMode = true;
-            System.out.println("Security Manager is present");
-        } else {
-            System.out.println("Security Manager is NOT present");
-        }
-    }
-
     SchemaFactory sf = SchemaFactory.newInstance(XMLConstants.W3C_XML_SCHEMA_NS_URI);
 
-    @Test
     public void testLargeElementNoSecurity() {
-        if (_isSecureMode)
+        if (System.getSecurityManager() != null)
             return; // jaxp secure feature can not be turned off when security
                     // manager is present
         try {
@@ -66,7 +62,6 @@
         }
     }
 
-    @Test
     public void testLargeElementWithSecurity() {
         try {
             sf.setFeature(XMLConstants.FEATURE_SECURE_PROCESSING, Boolean.TRUE);
@@ -78,7 +73,6 @@
         }
     }
 
-    @Test
     public void testLargeSequenceWithSecurity() {
         try {
             sf.setFeature(XMLConstants.FEATURE_SECURE_PROCESSING, Boolean.TRUE);
@@ -94,3 +88,4 @@
     }
 
 }
+
diff --git a/jaxp/test/javax/xml/jaxp/unittest/validation/Bug6493687.java b/jaxp/test/javax/xml/jaxp/unittest/validation/Bug6493687.java
index 2da6c45..ed79006 100644
--- a/jaxp/test/javax/xml/jaxp/unittest/validation/Bug6493687.java
+++ b/jaxp/test/javax/xml/jaxp/unittest/validation/Bug6493687.java
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2014, 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2014, 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
@@ -23,13 +23,19 @@
 
 package validation;
 
+import org.testng.annotations.Listeners;
 import org.testng.annotations.Test;
 import org.w3c.dom.Document;
 
 /*
+ * @test
  * @bug 6493687
+ * @library /javax/xml/jaxp/libs /javax/xml/jaxp/unittest
+ * @run testng/othervm -DrunSecMngr=true validation.Bug6493687
+ * @run testng/othervm validation.Bug6493687
  * @summary Test validator.validate(new DOMSource(node)) without any exception.
  */
+@Listeners({jaxp.library.FilePolicy.class})
 public class Bug6493687 {
 
     @Test
@@ -42,3 +48,4 @@
         System.out.println("Got here3");
     }
 }
+
diff --git a/jaxp/test/javax/xml/jaxp/unittest/validation/Bug6509668.java b/jaxp/test/javax/xml/jaxp/unittest/validation/Bug6509668.java
index 2c9906c..8e32d70 100644
--- a/jaxp/test/javax/xml/jaxp/unittest/validation/Bug6509668.java
+++ b/jaxp/test/javax/xml/jaxp/unittest/validation/Bug6509668.java
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2014, 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2014, 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
@@ -36,6 +36,7 @@
 import javax.xml.validation.ValidatorHandler;
 
 import org.testng.Assert;
+import org.testng.annotations.Listeners;
 import org.testng.annotations.Test;
 import org.w3c.dom.TypeInfo;
 import org.xml.sax.Attributes;
@@ -45,9 +46,14 @@
 import org.xml.sax.helpers.DefaultHandler;
 
 /*
+ * @test
  * @bug 6509668
+ * @library /javax/xml/jaxp/libs /javax/xml/jaxp/unittest
+ * @run testng/othervm -DrunSecMngr=true validation.Bug6509668
+ * @run testng/othervm validation.Bug6509668
  * @summary Test TypeInfoProvider.getElementTypeInfo() for union type when startElement and endElement.
  */
+@Listeners({jaxp.library.BasePolicy.class})
 public class Bug6509668 {
 
     public static final String XSD = "<?xml version='1.0'?>\n" + "<schema xmlns='http://www.w3.org/2001/XMLSchema'\n"
@@ -135,3 +141,4 @@
         parse(xmlReader, XML);
     }
 }
+
diff --git a/jaxp/test/javax/xml/jaxp/unittest/validation/Bug6526547.java b/jaxp/test/javax/xml/jaxp/unittest/validation/Bug6526547.java
index e737d75..0ee1219 100644
--- a/jaxp/test/javax/xml/jaxp/unittest/validation/Bug6526547.java
+++ b/jaxp/test/javax/xml/jaxp/unittest/validation/Bug6526547.java
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2014, 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2014, 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,14 +34,20 @@
 import javax.xml.validation.Validator;
 
 import org.testng.Assert;
+import org.testng.annotations.Listeners;
 import org.testng.annotations.Test;
 import org.w3c.dom.Document;
 import org.xml.sax.SAXException;
 
 /*
+ * @test
  * @bug 6526547
+ * @library /javax/xml/jaxp/libs /javax/xml/jaxp/unittest
+ * @run testng/othervm -DrunSecMngr=true validation.Bug6526547
+ * @run testng/othervm validation.Bug6526547
  * @summary Test document parsed without setting NamespaceAware can be validated with a Schema.
  */
+@Listeners({jaxp.library.FilePolicy.class})
 public class Bug6526547 {
 
     @Test
@@ -76,3 +82,4 @@
         }
     }
 }
+
diff --git a/jaxp/test/javax/xml/jaxp/unittest/validation/Bug6531160.java b/jaxp/test/javax/xml/jaxp/unittest/validation/Bug6531160.java
index 53cea01..01b5e86 100644
--- a/jaxp/test/javax/xml/jaxp/unittest/validation/Bug6531160.java
+++ b/jaxp/test/javax/xml/jaxp/unittest/validation/Bug6531160.java
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2014, 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2014, 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
@@ -33,14 +33,20 @@
 import javax.xml.validation.SchemaFactory;
 
 import org.testng.Assert;
+import org.testng.annotations.Listeners;
 import org.testng.annotations.Test;
 import org.w3c.dom.Document;
 import org.xml.sax.SAXParseException;
 
 /*
+ * @test
  * @bug 6531160
+ * @library /javax/xml/jaxp/libs /javax/xml/jaxp/unittest
+ * @run testng/othervm -DrunSecMngr=true validation.Bug6531160
+ * @run testng/othervm validation.Bug6531160
  * @summary Test document generated by newDocument() can be validated with a Schema.
  */
+@Listeners({jaxp.library.BasePolicy.class})
 public class Bug6531160 {
 
     private static final String XSD = "<xs:schema xmlns:xs='http://www.w3.org/2001/XMLSchema'>\n" + "  <xs:element name='root' type='xs:string'/>\n"
@@ -64,3 +70,4 @@
     }
 
 }
+
diff --git a/jaxp/test/javax/xml/jaxp/unittest/validation/Bug6695843Test.java b/jaxp/test/javax/xml/jaxp/unittest/validation/Bug6695843Test.java
index e70dbff..c0f85a3 100644
--- a/jaxp/test/javax/xml/jaxp/unittest/validation/Bug6695843Test.java
+++ b/jaxp/test/javax/xml/jaxp/unittest/validation/Bug6695843Test.java
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2014, 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2014, 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
@@ -35,14 +35,20 @@
 import javax.xml.validation.Validator;
 
 import org.testng.Assert;
+import org.testng.annotations.Listeners;
 import org.testng.annotations.Test;
 import org.w3c.dom.Document;
 import org.xml.sax.SAXException;
 
 /*
+ * @test
  * @bug 6695843
+ * @library /javax/xml/jaxp/libs /javax/xml/jaxp/unittest
+ * @run testng/othervm -DrunSecMngr=true validation.Bug6695843Test
+ * @run testng/othervm validation.Bug6695843Test
  * @summary Test Validator should report accurate element type if there is a violation on a complexType with simpleContent that extends a base complexType.
  */
+@Listeners({jaxp.library.FilePolicy.class})
 public class Bug6695843Test {
     static final String SCHEMA_LANGUAGE = "http://java.sun.com/xml/jaxp/properties/schemaLanguage";
     static final String SCHEMA_SOURCE = "http://java.sun.com/xml/jaxp/properties/schemaSource";
@@ -76,3 +82,4 @@
     }
 
 }
+
diff --git a/jaxp/test/javax/xml/jaxp/unittest/validation/Bug6773084Test.java b/jaxp/test/javax/xml/jaxp/unittest/validation/Bug6773084Test.java
index 98737ed..4ac7b5b 100644
--- a/jaxp/test/javax/xml/jaxp/unittest/validation/Bug6773084Test.java
+++ b/jaxp/test/javax/xml/jaxp/unittest/validation/Bug6773084Test.java
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2014, 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2014, 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
@@ -23,6 +23,8 @@
 
 package validation;
 
+import static jaxp.library.JAXPTestUtilities.runWithAllPerm;
+
 import java.io.File;
 import java.io.FileFilter;
 import java.io.IOException;
@@ -43,7 +45,7 @@
 import javax.xml.validation.Validator;
 
 import org.testng.Assert;
-import org.testng.annotations.BeforeClass;
+import org.testng.annotations.Listeners;
 import org.testng.annotations.Test;
 import org.w3c.dom.Document;
 import org.xml.sax.ErrorHandler;
@@ -51,9 +53,14 @@
 import org.xml.sax.SAXParseException;
 
 /*
+ * @test
  * @bug 6773084
+ * @library /javax/xml/jaxp/libs /javax/xml/jaxp/unittest
+ * @run testng/othervm -DrunSecMngr=true validation.Bug6773084Test
+ * @run testng/othervm validation.Bug6773084Test
  * @summary Test Schema object is thread safe.
  */
+@Listeners({jaxp.library.FilePolicy.class})
 public class Bug6773084Test {
     static final String SCHEMA_LANGUAGE = "http://java.sun.com/xml/jaxp/properties/schemaLanguage";
     static final String SCHEMA_SOURCE = "http://java.sun.com/xml/jaxp/properties/schemaSource";
@@ -68,11 +75,6 @@
 
     private static Schema schema;
 
-    @BeforeClass
-    public void setup(){
-        policy.PolicyUtil.changePolicy(getClass().getResource("6773084.policy").getFile());
-    }
-
     @Test
     public void test() throws Exception {
         SchemaFactory factory = SchemaFactory.newInstance(XMLConstants.W3C_XML_SCHEMA_NS_URI);
@@ -94,7 +96,7 @@
         for (int i = 0; i < files.length; i++) {
             EXEC.execute(new XMLValiddator(files[i], i));
         }
-        EXEC.shutdown();
+        runWithAllPerm(() -> EXEC.shutdown());
 
     }
 
@@ -164,3 +166,4 @@
     }
 
 }
+
diff --git a/jaxp/test/javax/xml/jaxp/unittest/validation/Bug6859210.java b/jaxp/test/javax/xml/jaxp/unittest/validation/Bug6859210.java
index 1bb0d04..aafc297 100644
--- a/jaxp/test/javax/xml/jaxp/unittest/validation/Bug6859210.java
+++ b/jaxp/test/javax/xml/jaxp/unittest/validation/Bug6859210.java
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2014, 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2014, 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
@@ -32,15 +32,21 @@
 import javax.xml.validation.SchemaFactory;
 
 import org.testng.Assert;
+import org.testng.annotations.Listeners;
 import org.testng.annotations.Test;
 import org.xml.sax.ErrorHandler;
 import org.xml.sax.SAXException;
 import org.xml.sax.SAXParseException;
 
 /*
+ * @test
  * @bug 6859210
+ * @library /javax/xml/jaxp/libs /javax/xml/jaxp/unittest
+ * @run testng/othervm -DrunSecMngr=true validation.Bug6859210
+ * @run testng/othervm validation.Bug6859210
  * @summary Test Schema Validator can parse xml when maxOccurs is large.
  */
+@Listeners({jaxp.library.FilePolicy.class})
 public class Bug6859210 {
 
     boolean errorFound;
@@ -94,3 +100,4 @@
     }
 
 }
+
diff --git a/jaxp/test/javax/xml/jaxp/unittest/validation/Bug6925531Test.java b/jaxp/test/javax/xml/jaxp/unittest/validation/Bug6925531Test.java
index b3fad32..cc36b1e 100644
--- a/jaxp/test/javax/xml/jaxp/unittest/validation/Bug6925531Test.java
+++ b/jaxp/test/javax/xml/jaxp/unittest/validation/Bug6925531Test.java
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2014, 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2014, 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
@@ -40,6 +40,7 @@
 import javax.xml.validation.Validator;
 
 import org.testng.Assert;
+import org.testng.annotations.Listeners;
 import org.testng.annotations.Test;
 import org.xml.sax.InputSource;
 import org.xml.sax.SAXException;
@@ -47,9 +48,14 @@
 import org.xml.sax.SAXNotSupportedException;
 
 /*
+ * @test
  * @bug 6925531
+ * @library /javax/xml/jaxp/libs /javax/xml/jaxp/unittest
+ * @run testng/othervm -DrunSecMngr=true validation.Bug6925531Test
+ * @run testng/othervm validation.Bug6925531Test
  * @summary Test Validator can validate SAXSource when SecurityManager is set or FEATURE_SECURE_PROCESSING is on.
  */
+@Listeners({jaxp.library.BasePolicy.class})
 public class Bug6925531Test {
     static final String SCHEMA_LANGUAGE = "http://java.sun.com/xml/jaxp/properties/schemaLanguage";
     static final String SCHEMA_SOURCE = "http://java.sun.com/xml/jaxp/properties/schemaSource";
@@ -204,3 +210,4 @@
 
     }
 }
+
diff --git a/jaxp/test/javax/xml/jaxp/unittest/validation/Bug6946312Test.java b/jaxp/test/javax/xml/jaxp/unittest/validation/Bug6946312Test.java
index 5f0b19d..e5dda82 100644
--- a/jaxp/test/javax/xml/jaxp/unittest/validation/Bug6946312Test.java
+++ b/jaxp/test/javax/xml/jaxp/unittest/validation/Bug6946312Test.java
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2014, 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2014, 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
@@ -35,6 +35,7 @@
 import javax.xml.validation.SchemaFactory;
 
 import org.testng.Assert;
+import org.testng.annotations.Listeners;
 import org.testng.annotations.Test;
 import org.xml.sax.Attributes;
 import org.xml.sax.ContentHandler;
@@ -44,9 +45,14 @@
 import org.xml.sax.XMLReader;
 
 /*
+ * @test
  * @bug 6946312
+ * @library /javax/xml/jaxp/libs /javax/xml/jaxp/unittest
+ * @run testng/othervm -DrunSecMngr=true validation.Bug6946312Test
+ * @run testng/othervm validation.Bug6946312Test
  * @summary Test XML parser shall callback to ContentHandler when receiving characters data.
  */
+@Listeners({jaxp.library.FilePolicy.class})
 public class Bug6946312Test {
     static final String SCHEMA_LANGUAGE = "http://java.sun.com/xml/jaxp/properties/schemaLanguage";
     static final String SCHEMA_SOURCE = "http://java.sun.com/xml/jaxp/properties/schemaSource";
@@ -122,3 +128,4 @@
     }
 
 }
+
diff --git a/jaxp/test/javax/xml/jaxp/unittest/validation/Bug6954738_Test.java b/jaxp/test/javax/xml/jaxp/unittest/validation/Bug6954738_Test.java
index 5118754..38eebc1 100644
--- a/jaxp/test/javax/xml/jaxp/unittest/validation/Bug6954738_Test.java
+++ b/jaxp/test/javax/xml/jaxp/unittest/validation/Bug6954738_Test.java
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2014, 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2014, 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
@@ -31,15 +31,21 @@
 import javax.xml.validation.SchemaFactory;
 import javax.xml.validation.Validator;
 
+import org.testng.annotations.Listeners;
 import org.testng.annotations.Test;
 import org.xml.sax.ErrorHandler;
 import org.xml.sax.SAXException;
 import org.xml.sax.SAXParseException;
 
 /*
+ * @test
  * @bug 6954738
+ * @library /javax/xml/jaxp/libs /javax/xml/jaxp/unittest
+ * @run testng/othervm -DrunSecMngr=true validation.Bug6954738_Test
+ * @run testng/othervm validation.Bug6954738_Test
  * @summary Test Validator can process a XML document containing an element with 8000 characters.
  */
+@Listeners({jaxp.library.FilePolicy.class})
 public class Bug6954738_Test {
     static final String SCHEMA_LANGUAGE = "http://java.sun.com/xml/jaxp/properties/schemaLanguage";
     static final String SCHEMA_SOURCE = "http://java.sun.com/xml/jaxp/properties/schemaSource";
@@ -77,3 +83,4 @@
     }
 
 }
+
diff --git a/jaxp/test/javax/xml/jaxp/unittest/validation/CR6708840Test.java b/jaxp/test/javax/xml/jaxp/unittest/validation/CR6708840Test.java
index 7c9b0bd..8221278 100644
--- a/jaxp/test/javax/xml/jaxp/unittest/validation/CR6708840Test.java
+++ b/jaxp/test/javax/xml/jaxp/unittest/validation/CR6708840Test.java
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2014, 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2014, 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
@@ -38,12 +38,18 @@
 import javax.xml.validation.Validator;
 
 import org.testng.Assert;
+import org.testng.annotations.Listeners;
 import org.testng.annotations.Test;
 
 /*
+ * @test
  * @bug 6708840
+ * @library /javax/xml/jaxp/libs /javax/xml/jaxp/unittest
+ * @run testng/othervm -DrunSecMngr=true validation.CR6708840Test
+ * @run testng/othervm validation.CR6708840Test
  * @summary Test Validator can process StAXSource.
  */
+@Listeners({jaxp.library.FilePolicy.class})
 public class CR6708840Test {
 
     @Test
@@ -134,3 +140,4 @@
         }
     }
 }
+
diff --git a/jaxp/test/javax/xml/jaxp/unittest/validation/CR6740048.java b/jaxp/test/javax/xml/jaxp/unittest/validation/CR6740048.java
index 26a239b..31af92f 100644
--- a/jaxp/test/javax/xml/jaxp/unittest/validation/CR6740048.java
+++ b/jaxp/test/javax/xml/jaxp/unittest/validation/CR6740048.java
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2014, 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2014, 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 @@
 import javax.xml.parsers.DocumentBuilderFactory;
 import javax.xml.parsers.ParserConfigurationException;
 
+import org.testng.annotations.Listeners;
 import org.testng.annotations.Test;
 import org.testng.Assert;
 import org.w3c.dom.Document;
@@ -38,9 +39,14 @@
 import org.xml.sax.SAXParseException;
 
 /*
+ * @test
  * @bug 6740048
+ * @library /javax/xml/jaxp/libs /javax/xml/jaxp/unittest
+ * @run testng/othervm -DrunSecMngr=true validation.CR6740048
+ * @run testng/othervm validation.CR6740048
  * @summary Test DocumentBuilder can be reused when the DocumentBuilderFactory sets schema.
  */
+@Listeners({jaxp.library.FilePolicy.class})
 public class CR6740048 {
     private static final String TAG_INFO = "containerInfo";
     private static final String SCHEMA_LANGUAGE_URL = "http://java.sun.com/xml/jaxp/properties/schemaLanguage";
@@ -51,9 +57,6 @@
     public final void testReusingDocumentBuilder() {
 
         try {
-            //ClassLoader loader = CR6740048.class.getClassLoader();
-
-            // Object xsd = loader.getResourceAsStream("CR6740048.xsd");
             InputStream xsd = this.getClass().getResourceAsStream("CR6740048.xsd");
             // create document builder
             DocumentBuilderFactory docBuilderFactory = DocumentBuilderFactory.newInstance();
@@ -128,3 +131,4 @@
     }
 
 }
+
diff --git a/jaxp/test/javax/xml/jaxp/unittest/validation/ErrorHandlerImpl.java b/jaxp/test/javax/xml/jaxp/unittest/validation/ErrorHandlerImpl.java
index 95806ed..775fdd0 100644
--- a/jaxp/test/javax/xml/jaxp/unittest/validation/ErrorHandlerImpl.java
+++ b/jaxp/test/javax/xml/jaxp/unittest/validation/ErrorHandlerImpl.java
@@ -45,3 +45,4 @@
     }
 
 }
+
diff --git a/jaxp/test/javax/xml/jaxp/unittest/validation/Issue682Test.java b/jaxp/test/javax/xml/jaxp/unittest/validation/Issue682Test.java
index e1753f0..943f23d 100644
--- a/jaxp/test/javax/xml/jaxp/unittest/validation/Issue682Test.java
+++ b/jaxp/test/javax/xml/jaxp/unittest/validation/Issue682Test.java
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2014, 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2014, 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
@@ -32,6 +32,7 @@
 import javax.xml.validation.Schema;
 import javax.xml.validation.SchemaFactory;
 
+import org.testng.annotations.Listeners;
 import org.testng.annotations.Test;
 import org.testng.Assert;
 import org.xml.sax.InputSource;
@@ -39,8 +40,13 @@
 import org.xml.sax.helpers.DefaultHandler;
 
 /*
+ * @test
+ * @library /javax/xml/jaxp/libs /javax/xml/jaxp/unittest
+ * @run testng/othervm -DrunSecMngr=true validation.Issue682Test
+ * @run testng/othervm validation.Issue682Test
  * @summary Test comination of fields in <xsd:unique>, for https://issues.apache.org/jira/browse/XERCESJ-682.
  */
+@Listeners({jaxp.library.FilePolicy.class})
 public class Issue682Test {
     static final String SCHEMA_LANGUAGE = "http://java.sun.com/xml/jaxp/properties/schemaLanguage";
     static final String SCHEMA_SOURCE = "http://java.sun.com/xml/jaxp/properties/schemaSource";
@@ -72,3 +78,4 @@
     }
 
 }
+
diff --git a/jaxp/test/javax/xml/jaxp/unittest/validation/IssueTracker30.java b/jaxp/test/javax/xml/jaxp/unittest/validation/IssueTracker30.java
index 765fa13..68ba8c1 100644
--- a/jaxp/test/javax/xml/jaxp/unittest/validation/IssueTracker30.java
+++ b/jaxp/test/javax/xml/jaxp/unittest/validation/IssueTracker30.java
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2014, 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2014, 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
@@ -32,14 +32,20 @@
 import javax.xml.validation.SchemaFactory;
 
 import org.testng.Assert;
+import org.testng.annotations.Listeners;
 import org.testng.annotations.Test;
 import org.xml.sax.ErrorHandler;
 import org.xml.sax.SAXException;
 import org.xml.sax.SAXParseException;
 
 /*
+ * @test
+ * @library /javax/xml/jaxp/libs /javax/xml/jaxp/unittest
+ * @run testng/othervm -DrunSecMngr=true validation.IssueTracker30
+ * @run testng/othervm validation.IssueTracker30
  * @summary Test maxOccurs validation.
  */
+@Listeners({jaxp.library.FilePolicy.class})
 public class IssueTracker30 {
 
     boolean errorFound;
@@ -126,3 +132,4 @@
     }
 
 }
+
diff --git a/jaxp/test/javax/xml/jaxp/unittest/validation/JaxpIssue43Test.java b/jaxp/test/javax/xml/jaxp/unittest/validation/JaxpIssue43Test.java
index e590b22..4b50668 100644
--- a/jaxp/test/javax/xml/jaxp/unittest/validation/JaxpIssue43Test.java
+++ b/jaxp/test/javax/xml/jaxp/unittest/validation/JaxpIssue43Test.java
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2014, 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2014, 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
@@ -38,15 +38,21 @@
 import javax.xml.validation.SchemaFactory;
 import javax.xml.validation.Validator;
 
+import org.testng.annotations.Listeners;
 import org.testng.annotations.Test;
 import org.w3c.dom.Document;
 import org.w3c.dom.Element;
 import org.w3c.dom.NodeList;
 
 /*
+ * @test
  * @bug 6631318
+ * @library /javax/xml/jaxp/libs /javax/xml/jaxp/unittest
+ * @run testng/othervm -DrunSecMngr=true validation.JaxpIssue43Test
+ * @run testng/othervm validation.JaxpIssue43Test
  * @summary Test creating schema from a DOM fragment with namespace.
  */
+@Listeners({jaxp.library.FilePolicy.class})
 public class JaxpIssue43Test {
 
     @Test
@@ -78,3 +84,4 @@
         return list.toArray(new Source[list.size()]);
     }
 }
+
diff --git a/jaxp/test/javax/xml/jaxp/unittest/validation/JaxpIssue49.java b/jaxp/test/javax/xml/jaxp/unittest/validation/JaxpIssue49.java
index aec3631..b53a10e 100644
--- a/jaxp/test/javax/xml/jaxp/unittest/validation/JaxpIssue49.java
+++ b/jaxp/test/javax/xml/jaxp/unittest/validation/JaxpIssue49.java
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2014, 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2014, 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
@@ -38,13 +38,19 @@
 import javax.xml.validation.Validator;
 
 import org.testng.Assert;
+import org.testng.annotations.Listeners;
 import org.testng.annotations.Test;
 import org.w3c.dom.Node;
 
 /*
+ * @test
  * @bug 6684227
+ * @library /javax/xml/jaxp/libs /javax/xml/jaxp/unittest
+ * @run testng/othervm -DrunSecMngr=true validation.JaxpIssue49
+ * @run testng/othervm validation.JaxpIssue49
  * @summary Test property current-element-node works.
  */
+@Listeners({jaxp.library.FilePolicy.class})
 public class JaxpIssue49 {
 
     private Schema schema;
@@ -88,3 +94,4 @@
     }
 
 }
+
diff --git a/jaxp/test/javax/xml/jaxp/unittest/validation/LargeMaxOccursTest.java b/jaxp/test/javax/xml/jaxp/unittest/validation/LargeMaxOccursTest.java
index d783227..6681ab7 100644
--- a/jaxp/test/javax/xml/jaxp/unittest/validation/LargeMaxOccursTest.java
+++ b/jaxp/test/javax/xml/jaxp/unittest/validation/LargeMaxOccursTest.java
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2014, 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2014, 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
@@ -31,11 +31,17 @@
 import javax.xml.validation.Validator;
 
 import org.testng.Assert;
+import org.testng.annotations.Listeners;
 import org.testng.annotations.Test;
 
 /*
+ * @test
+ * @library /javax/xml/jaxp/libs /javax/xml/jaxp/unittest
+ * @run testng/othervm -DrunSecMngr=true validation.LargeMaxOccursTest
+ * @run testng/othervm validation.LargeMaxOccursTest
  * @summary Test Validator shall report error for maxOccurs > 5000 when FEATURE_SECURE_PROCESSING is on, except the schema can be applied for constant-space algorithm.
  */
+@Listeners({jaxp.library.FilePolicy.class})
 public class LargeMaxOccursTest {
 
     @Test
@@ -103,3 +109,4 @@
         }
     }
 }
+
diff --git a/jaxp/test/javax/xml/jaxp/unittest/validation/MultiOccursTest.java b/jaxp/test/javax/xml/jaxp/unittest/validation/MultiOccursTest.java
index 014e8af..33340dd 100644
--- a/jaxp/test/javax/xml/jaxp/unittest/validation/MultiOccursTest.java
+++ b/jaxp/test/javax/xml/jaxp/unittest/validation/MultiOccursTest.java
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2014, 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2014, 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
@@ -32,14 +32,20 @@
 import javax.xml.validation.SchemaFactory;
 
 import org.testng.Assert;
+import org.testng.annotations.Listeners;
 import org.testng.annotations.Test;
 import org.xml.sax.ErrorHandler;
 import org.xml.sax.SAXException;
 import org.xml.sax.SAXParseException;
 
 /*
+ * @test
+ * @library /javax/xml/jaxp/libs /javax/xml/jaxp/unittest
+ * @run testng/othervm -DrunSecMngr=true validation.MultiOccursTest
+ * @run testng/othervm validation.MultiOccursTest
  * @summary Test Schema Validator can parse multiple or unbounded occurs.
  */
+@Listeners({jaxp.library.FilePolicy.class})
 public class MultiOccursTest {
 
     boolean errorFound;
@@ -141,3 +147,4 @@
     }
 
 }
+
diff --git a/jaxp/test/javax/xml/jaxp/unittest/validation/MultiOccursUnboundedTest.java b/jaxp/test/javax/xml/jaxp/unittest/validation/MultiOccursUnboundedTest.java
index b6069c2..8330ac5 100644
--- a/jaxp/test/javax/xml/jaxp/unittest/validation/MultiOccursUnboundedTest.java
+++ b/jaxp/test/javax/xml/jaxp/unittest/validation/MultiOccursUnboundedTest.java
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2014, 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2014, 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
@@ -32,14 +32,20 @@
 import javax.xml.validation.SchemaFactory;
 
 import org.testng.Assert;
+import org.testng.annotations.Listeners;
 import org.testng.annotations.Test;
 import org.xml.sax.ErrorHandler;
 import org.xml.sax.SAXException;
 import org.xml.sax.SAXParseException;
 
 /*
+ * @test
+ * @library /javax/xml/jaxp/libs /javax/xml/jaxp/unittest
+ * @run testng/othervm -DrunSecMngr=true validation.MultiOccursUnboundedTest
+ * @run testng/othervm validation.MultiOccursUnboundedTest
  * @summary Test Schema Validator can parse multiple or unbounded occurs.
  */
+@Listeners({jaxp.library.FilePolicy.class})
 public class MultiOccursUnboundedTest {
 
     boolean errorFound;
@@ -109,3 +115,4 @@
     }
 
 }
+
diff --git a/jaxp/test/javax/xml/jaxp/unittest/validation/OccursTest.java b/jaxp/test/javax/xml/jaxp/unittest/validation/OccursTest.java
index 0cb9177..bce2b0d 100644
--- a/jaxp/test/javax/xml/jaxp/unittest/validation/OccursTest.java
+++ b/jaxp/test/javax/xml/jaxp/unittest/validation/OccursTest.java
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2014, 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2014, 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
@@ -32,14 +32,20 @@
 import javax.xml.validation.SchemaFactory;
 
 import org.testng.Assert;
+import org.testng.annotations.Listeners;
 import org.testng.annotations.Test;
 import org.xml.sax.ErrorHandler;
 import org.xml.sax.SAXException;
 import org.xml.sax.SAXParseException;
 
 /*
+ * @test
+ * @library /javax/xml/jaxp/libs /javax/xml/jaxp/unittest
+ * @run testng/othervm -DrunSecMngr=true validation.OccursTest
+ * @run testng/othervm validation.OccursTest
  * @summary Test Schema Validator can parse multiple or unbounded occurs.
  */
+@Listeners({jaxp.library.FilePolicy.class})
 public class OccursTest {
 
     boolean errorFound;
@@ -141,3 +147,4 @@
     }
 
 }
+
diff --git a/jaxp/test/javax/xml/jaxp/unittest/validation/OccursUnboundedTest.java b/jaxp/test/javax/xml/jaxp/unittest/validation/OccursUnboundedTest.java
index df0e078..a986cc1 100644
--- a/jaxp/test/javax/xml/jaxp/unittest/validation/OccursUnboundedTest.java
+++ b/jaxp/test/javax/xml/jaxp/unittest/validation/OccursUnboundedTest.java
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2014, 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2014, 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
@@ -32,14 +32,20 @@
 import javax.xml.validation.SchemaFactory;
 
 import org.testng.Assert;
+import org.testng.annotations.Listeners;
 import org.testng.annotations.Test;
 import org.xml.sax.ErrorHandler;
 import org.xml.sax.SAXException;
 import org.xml.sax.SAXParseException;
 
 /*
+ * @test
+ * @library /javax/xml/jaxp/libs /javax/xml/jaxp/unittest
+ * @run testng/othervm -DrunSecMngr=true validation.OccursUnboundedTest
+ * @run testng/othervm validation.OccursUnboundedTest
  * @summary Test Schema Validator can parse multiple or unbounded occurs.
  */
+@Listeners({jaxp.library.FilePolicy.class})
 public class OccursUnboundedTest {
 
     boolean errorFound;
@@ -109,3 +115,4 @@
     }
 
 }
+
diff --git a/jaxp/test/javax/xml/jaxp/unittest/validation/OccursWildcardTest.java b/jaxp/test/javax/xml/jaxp/unittest/validation/OccursWildcardTest.java
index 36b97cf..649dcd2 100644
--- a/jaxp/test/javax/xml/jaxp/unittest/validation/OccursWildcardTest.java
+++ b/jaxp/test/javax/xml/jaxp/unittest/validation/OccursWildcardTest.java
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2014, 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2014, 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
@@ -32,14 +32,20 @@
 import javax.xml.validation.SchemaFactory;
 
 import org.testng.Assert;
+import org.testng.annotations.Listeners;
 import org.testng.annotations.Test;
 import org.xml.sax.ErrorHandler;
 import org.xml.sax.SAXException;
 import org.xml.sax.SAXParseException;
 
 /*
+ * @test
+ * @library /javax/xml/jaxp/libs /javax/xml/jaxp/unittest
+ * @run testng/othervm -DrunSecMngr=true validation.OccursWildcardTest
+ * @run testng/othervm validation.OccursWildcardTest
  * @summary Test Schema Validator can parse multiple or unbounded occurs.
  */
+@Listeners({jaxp.library.FilePolicy.class})
 public class OccursWildcardTest {
 
     boolean errorFound;
@@ -141,3 +147,4 @@
     }
 
 }
+
diff --git a/jaxp/test/javax/xml/jaxp/unittest/validation/OccursWildcardUnbounded.java b/jaxp/test/javax/xml/jaxp/unittest/validation/OccursWildcardUnbounded.java
index b454db97..ee82f52 100644
--- a/jaxp/test/javax/xml/jaxp/unittest/validation/OccursWildcardUnbounded.java
+++ b/jaxp/test/javax/xml/jaxp/unittest/validation/OccursWildcardUnbounded.java
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2014, 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2014, 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
@@ -32,14 +32,20 @@
 import javax.xml.validation.SchemaFactory;
 
 import org.testng.Assert;
+import org.testng.annotations.Listeners;
 import org.testng.annotations.Test;
 import org.xml.sax.ErrorHandler;
 import org.xml.sax.SAXException;
 import org.xml.sax.SAXParseException;
 
 /*
+ * @test
+ * @library /javax/xml/jaxp/libs /javax/xml/jaxp/unittest
+ * @run testng/othervm -DrunSecMngr=true validation.OccursWildcardUnbounded
+ * @run testng/othervm validation.OccursWildcardUnbounded
  * @summary Test Schema Validator can parse multiple or unbounded occurs.
  */
+@Listeners({jaxp.library.FilePolicy.class})
 public class OccursWildcardUnbounded {
 
     boolean errorFound;
@@ -109,3 +115,4 @@
     }
 
 }
+
diff --git a/jaxp/test/javax/xml/jaxp/unittest/validation/ParticlesId005Test.java b/jaxp/test/javax/xml/jaxp/unittest/validation/ParticlesId005Test.java
index 74169f4..aa9540d 100644
--- a/jaxp/test/javax/xml/jaxp/unittest/validation/ParticlesId005Test.java
+++ b/jaxp/test/javax/xml/jaxp/unittest/validation/ParticlesId005Test.java
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2014, 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2014, 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
@@ -32,14 +32,20 @@
 import javax.xml.validation.SchemaFactory;
 
 import org.testng.Assert;
+import org.testng.annotations.Listeners;
 import org.testng.annotations.Test;
 import org.xml.sax.ErrorHandler;
 import org.xml.sax.SAXException;
 import org.xml.sax.SAXParseException;
 
 /*
+ * @test
+ * @library /javax/xml/jaxp/libs /javax/xml/jaxp/unittest
+ * @run testng/othervm -DrunSecMngr=true validation.ParticlesId005Test
+ * @run testng/othervm validation.ParticlesId005Test
  * @summary Test Schema Validator can parse multiple or unbounded occurs.
  */
+@Listeners({jaxp.library.FilePolicy.class})
 public class ParticlesId005Test {
 
     boolean errorFound;
@@ -93,3 +99,4 @@
     }
 
 }
+
diff --git a/jaxp/test/javax/xml/jaxp/unittest/validation/ParticlesIg004Test.java b/jaxp/test/javax/xml/jaxp/unittest/validation/ParticlesIg004Test.java
index 2fe1a30..f08dbad 100644
--- a/jaxp/test/javax/xml/jaxp/unittest/validation/ParticlesIg004Test.java
+++ b/jaxp/test/javax/xml/jaxp/unittest/validation/ParticlesIg004Test.java
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2014, 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2014, 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
@@ -31,11 +31,17 @@
 import javax.xml.validation.Validator;
 
 import org.testng.Assert;
+import org.testng.annotations.Listeners;
 import org.testng.annotations.Test;
 
 /*
+ * @test
+ * @library /javax/xml/jaxp/libs /javax/xml/jaxp/unittest
+ * @run testng/othervm -DrunSecMngr=true validation.ParticlesIg004Test
+ * @run testng/othervm validation.ParticlesIg004Test
  * @summary Test particlesIg004.xsd.
  */
+@Listeners({jaxp.library.FilePolicy.class})
 public class ParticlesIg004Test {
 
     @Test
@@ -51,3 +57,4 @@
         }
     }
 }
+
diff --git a/jaxp/test/javax/xml/jaxp/unittest/validation/ParticlesQ013Test.java b/jaxp/test/javax/xml/jaxp/unittest/validation/ParticlesQ013Test.java
index 33e73d5..05d727f 100644
--- a/jaxp/test/javax/xml/jaxp/unittest/validation/ParticlesQ013Test.java
+++ b/jaxp/test/javax/xml/jaxp/unittest/validation/ParticlesQ013Test.java
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2014, 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2014, 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
@@ -32,14 +32,20 @@
 import javax.xml.validation.SchemaFactory;
 
 import org.testng.Assert;
+import org.testng.annotations.Listeners;
 import org.testng.annotations.Test;
 import org.xml.sax.ErrorHandler;
 import org.xml.sax.SAXException;
 import org.xml.sax.SAXParseException;
 
 /*
+ * @test
+ * @library /javax/xml/jaxp/libs /javax/xml/jaxp/unittest
+ * @run testng/othervm -DrunSecMngr=true validation.ParticlesQ013Test
+ * @run testng/othervm validation.ParticlesQ013Test
  * @summary Test Schema Validator can parse multiple or unbounded occurs.
  */
+@Listeners({jaxp.library.FilePolicy.class})
 public class ParticlesQ013Test {
 
     boolean errorFound;
@@ -92,3 +98,4 @@
     }
 
 }
+
diff --git a/jaxp/test/javax/xml/jaxp/unittest/validation/SchemaTest.java b/jaxp/test/javax/xml/jaxp/unittest/validation/SchemaTest.java
index f8a5e62..ef2bf37 100644
--- a/jaxp/test/javax/xml/jaxp/unittest/validation/SchemaTest.java
+++ b/jaxp/test/javax/xml/jaxp/unittest/validation/SchemaTest.java
@@ -28,12 +28,18 @@
 import javax.xml.XMLConstants;
 import javax.xml.validation.SchemaFactory;
 
+import org.testng.annotations.Listeners;
 import org.testng.annotations.Test;
 
 /*
+ * @test
+ * @library /javax/xml/jaxp/libs /javax/xml/jaxp/unittest
+ * @run testng/othervm -DrunSecMngr=true validation.SchemaTest
+ * @run testng/othervm validation.SchemaTest
  * @summary Test Schema creation
  * @bug 8149915
  */
+@Listeners({jaxp.library.FilePolicy.class})
 public class SchemaTest {
 
     /*
@@ -48,3 +54,4 @@
         factory.newSchema(new File(getClass().getResource("Bug8149915.xsd").getFile()));
     }
 }
+
diff --git a/jaxp/test/javax/xml/jaxp/unittest/validation/TCKGroupA008Test.java b/jaxp/test/javax/xml/jaxp/unittest/validation/TCKGroupA008Test.java
index c88c09b..79fecdc 100644
--- a/jaxp/test/javax/xml/jaxp/unittest/validation/TCKGroupA008Test.java
+++ b/jaxp/test/javax/xml/jaxp/unittest/validation/TCKGroupA008Test.java
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2014, 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2014, 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,12 +30,18 @@
 import javax.xml.validation.Validator;
 
 import org.testng.Assert;
+import org.testng.annotations.Listeners;
 import org.testng.annotations.Test;
 import org.xml.sax.SAXException;
 
 /*
+ * @test
+ * @library /javax/xml/jaxp/libs /javax/xml/jaxp/unittest
+ * @run testng/othervm -DrunSecMngr=true validation.TCKGroupA008Test
+ * @run testng/othervm validation.TCKGroupA008Test
  * @summary Test groupA008.xsd.
  */
+@Listeners({jaxp.library.FilePolicy.class})
 public class TCKGroupA008Test {
     static final String SCHEMA_LANGUAGE = "http://java.sun.com/xml/jaxp/properties/schemaLanguage";
     static final String SCHEMA_SOURCE = "http://java.sun.com/xml/jaxp/properties/schemaSource";
@@ -54,3 +60,4 @@
     }
 
 }
+
diff --git a/jaxp/test/javax/xml/jaxp/unittest/validation/ValidatorTest.java b/jaxp/test/javax/xml/jaxp/unittest/validation/ValidatorTest.java
index 9dd421a..720164f 100644
--- a/jaxp/test/javax/xml/jaxp/unittest/validation/ValidatorTest.java
+++ b/jaxp/test/javax/xml/jaxp/unittest/validation/ValidatorTest.java
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2014, 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2014, 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
@@ -23,9 +23,12 @@
 
 package validation;
 
+import static jaxp.library.JAXPTestUtilities.runWithTmpPermission;
+
 import java.io.File;
 import java.io.FileInputStream;
 import java.io.FileWriter;
+import java.util.PropertyPermission;
 
 import javax.xml.XMLConstants;
 import javax.xml.stream.XMLEventReader;
@@ -39,12 +42,18 @@
 import javax.xml.validation.Validator;
 
 import org.testng.Assert;
+import org.testng.annotations.Listeners;
 import org.testng.annotations.Test;
 import org.xml.sax.ErrorHandler;
 
 /*
+ * @test
+ * @library /javax/xml/jaxp/libs /javax/xml/jaxp/unittest
+ * @run testng/othervm -DrunSecMngr=true validation.ValidatorTest
+ * @run testng/othervm validation.ValidatorTest
  * @summary Test Validator.validate(Source, Result).
  */
+@Listeners({jaxp.library.FilePolicy.class})
 public class ValidatorTest {
 
     @Test
@@ -83,10 +92,11 @@
             if (resultFile.exists()) {
                 resultFile.delete();
             }
-
             // Validate this instance document against the
             // Instance document supplied
-            Result xmlResult = new javax.xml.transform.stream.StreamResult(resultFile);
+            File resultAlias = resultFile;
+            Result xmlResult = runWithTmpPermission(() -> new javax.xml.transform.stream.StreamResult(
+                    resultAlias), new PropertyPermission("user.dir", "read"));
             Source xmlSource = new javax.xml.transform.stream.StreamSource(new File(ValidatorTest.class.getResource("toys.xml").toURI()));
 
             validate("toys.xsd", xmlSource, xmlResult);
@@ -114,7 +124,9 @@
 
             // Validate this instance document against the
             // Instance document supplied
-            Result xmlResult = new javax.xml.transform.stream.StreamResult(resultFile);
+            File resultAlias = resultFile;
+            Result xmlResult = runWithTmpPermission(() -> new javax.xml.transform.stream.StreamResult(
+                    resultAlias), new PropertyPermission("user.dir", "read"));
             Source xmlSource = new javax.xml.transform.stream.StreamSource(new File(ValidatorTest.class.getResource("gMonths.xml").toURI()));
 
             validate("gMonths.xsd", xmlSource, xmlResult);
@@ -196,3 +208,4 @@
         return xmlr;
     }
 }
+
diff --git a/jaxp/test/javax/xml/jaxp/unittest/validation/XMLDocBuilder.java b/jaxp/test/javax/xml/jaxp/unittest/validation/XMLDocBuilder.java
index de9b0d9..bdd8107 100644
--- a/jaxp/test/javax/xml/jaxp/unittest/validation/XMLDocBuilder.java
+++ b/jaxp/test/javax/xml/jaxp/unittest/validation/XMLDocBuilder.java
@@ -141,3 +141,4 @@
         }
     }
 }
+
diff --git a/jaxp/test/javax/xml/jaxp/unittest/validation/XMLSchemaValidator.java b/jaxp/test/javax/xml/jaxp/unittest/validation/XMLSchemaValidator.java
index beb05e5..b09a6b7 100644
--- a/jaxp/test/javax/xml/jaxp/unittest/validation/XMLSchemaValidator.java
+++ b/jaxp/test/javax/xml/jaxp/unittest/validation/XMLSchemaValidator.java
@@ -59,3 +59,4 @@
         validator.validate(new DOMSource(node));
     }
 }
+
diff --git a/jaxp/test/javax/xml/jaxp/unittest/validation/tck/Bug6943252Test.java b/jaxp/test/javax/xml/jaxp/unittest/validation/tck/Bug6943252Test.java
index 67dbb9a..286094e 100644
--- a/jaxp/test/javax/xml/jaxp/unittest/validation/tck/Bug6943252Test.java
+++ b/jaxp/test/javax/xml/jaxp/unittest/validation/tck/Bug6943252Test.java
@@ -31,13 +31,19 @@
 import javax.xml.validation.SchemaFactory;
 
 import org.testng.Assert;
+import org.testng.annotations.Listeners;
 import org.testng.annotations.Test;
 import org.xml.sax.SAXException;
 
 /*
+ * @test
  * @bug 6943252
+ * @library /javax/xml/jaxp/libs /javax/xml/jaxp/unittest
+ * @run testng/othervm -DrunSecMngr=true validation.tck.Bug6943252Test
+ * @run testng/othervm validation.tck.Bug6943252Test
  * @summary Test Schema doesn't allow to use value more than allowed by base type.
  */
+@Listeners({jaxp.library.FilePolicy.class})
 public class Bug6943252Test {
     static final String SCHEMA_LANGUAGE = "http://java.sun.com/xml/jaxp/properties/schemaLanguage";
     static final String SCHEMA_SOURCE = "http://java.sun.com/xml/jaxp/properties/schemaSource";
@@ -63,3 +69,4 @@
     }
 
 }
+
diff --git a/jaxp/test/javax/xml/jaxp/unittest/validation/tck/Bug6963124Test.java b/jaxp/test/javax/xml/jaxp/unittest/validation/tck/Bug6963124Test.java
index 1734c53..969c66d 100644
--- a/jaxp/test/javax/xml/jaxp/unittest/validation/tck/Bug6963124Test.java
+++ b/jaxp/test/javax/xml/jaxp/unittest/validation/tck/Bug6963124Test.java
@@ -29,13 +29,19 @@
 import javax.xml.validation.SchemaFactory;
 
 import org.testng.Assert;
+import org.testng.annotations.Listeners;
 import org.testng.annotations.Test;
 import org.xml.sax.SAXException;
 
 /*
+ * @test
  * @bug 6963124
+ * @library /javax/xml/jaxp/libs /javax/xml/jaxp/unittest
+ * @run testng/othervm -DrunSecMngr=true validation.tck.Bug6963124Test
+ * @run testng/othervm validation.tck.Bug6963124Test
  * @summary Test Schema doesn't allow maxOccurs > 1 for reference to all model group.
  */
+@Listeners({jaxp.library.FilePolicy.class})
 public class Bug6963124Test {
     static final String SCHEMA_LANGUAGE = "http://java.sun.com/xml/jaxp/properties/schemaLanguage";
     static final String SCHEMA_SOURCE = "http://java.sun.com/xml/jaxp/properties/schemaSource";
@@ -55,3 +61,4 @@
     }
 
 }
+
diff --git a/jaxp/test/javax/xml/jaxp/unittest/validation/tck/Bug6963468Test.java b/jaxp/test/javax/xml/jaxp/unittest/validation/tck/Bug6963468Test.java
index 269d7b3..ea2f089 100644
--- a/jaxp/test/javax/xml/jaxp/unittest/validation/tck/Bug6963468Test.java
+++ b/jaxp/test/javax/xml/jaxp/unittest/validation/tck/Bug6963468Test.java
@@ -36,6 +36,7 @@
 import javax.xml.validation.Validator;
 
 import org.testng.Assert;
+import org.testng.annotations.Listeners;
 import org.testng.annotations.Test;
 import org.xml.sax.ErrorHandler;
 import org.xml.sax.SAXException;
@@ -45,9 +46,14 @@
 import org.xml.sax.helpers.DefaultHandler;
 
 /*
+ * @test
  * @bug 6963468
+ * @library /javax/xml/jaxp/libs /javax/xml/jaxp/unittest
+ * @run testng/othervm -DrunSecMngr=true validation.tck.Bug6963468Test
+ * @run testng/othervm validation.tck.Bug6963468Test
  * @summary Test Validation allows element a is a union type and element b specifies a as its substitution group and b type is or is derived from one of the member types of the union.
  */
+@Listeners({jaxp.library.FilePolicy.class})
 public class Bug6963468Test {
     static final String SCHEMA_LANGUAGE = "http://java.sun.com/xml/jaxp/properties/schemaLanguage";
     static final String SCHEMA_SOURCE = "http://java.sun.com/xml/jaxp/properties/schemaSource";
@@ -142,3 +148,4 @@
     }
 
 }
+
diff --git a/jaxp/test/javax/xml/jaxp/unittest/validation/tck/Bug6964720Test.java b/jaxp/test/javax/xml/jaxp/unittest/validation/tck/Bug6964720Test.java
index ca0b650..0536cbe 100644
--- a/jaxp/test/javax/xml/jaxp/unittest/validation/tck/Bug6964720Test.java
+++ b/jaxp/test/javax/xml/jaxp/unittest/validation/tck/Bug6964720Test.java
@@ -29,13 +29,19 @@
 import javax.xml.validation.SchemaFactory;
 
 import org.testng.Assert;
+import org.testng.annotations.Listeners;
 import org.testng.annotations.Test;
 import org.xml.sax.SAXException;
 
 /*
+ * @test
  * @bug 6964720
+ * @library /javax/xml/jaxp/libs /javax/xml/jaxp/unittest
+ * @run testng/othervm -DrunSecMngr=true validation.tck.Bug6964720Test
+ * @run testng/othervm validation.tck.Bug6964720Test
  * @summary Test Schema doesn't allow the inexpressible union of two attribute wildcards.
  */
+@Listeners({jaxp.library.FilePolicy.class})
 public class Bug6964720Test {
     static final String SCHEMA_LANGUAGE = "http://java.sun.com/xml/jaxp/properties/schemaLanguage";
     static final String SCHEMA_SOURCE = "http://java.sun.com/xml/jaxp/properties/schemaSource";
@@ -52,3 +58,4 @@
     }
 
 }
+
diff --git a/jaxp/test/javax/xml/jaxp/unittest/validation/tck/Bug6967214Test.java b/jaxp/test/javax/xml/jaxp/unittest/validation/tck/Bug6967214Test.java
index 66d2e0b..06e4ce8 100644
--- a/jaxp/test/javax/xml/jaxp/unittest/validation/tck/Bug6967214Test.java
+++ b/jaxp/test/javax/xml/jaxp/unittest/validation/tck/Bug6967214Test.java
@@ -31,13 +31,19 @@
 import javax.xml.validation.SchemaFactory;
 
 import org.testng.Assert;
+import org.testng.annotations.Listeners;
 import org.testng.annotations.Test;
 import org.xml.sax.SAXException;
 
 /*
+ * @test
  * @bug 6967214
+ * @library /javax/xml/jaxp/libs /javax/xml/jaxp/unittest
+ * @run testng/othervm -DrunSecMngr=true validation.tck.Bug6967214Test
+ * @run testng/othervm validation.tck.Bug6967214Test
  * @summary Test Schema doesn't allow unpaired parenthesises in regex.
  */
+@Listeners({jaxp.library.FilePolicy.class})
 public class Bug6967214Test {
     static final String SCHEMA_LANGUAGE = "http://java.sun.com/xml/jaxp/properties/schemaLanguage";
     static final String SCHEMA_SOURCE = "http://java.sun.com/xml/jaxp/properties/schemaSource";
@@ -64,3 +70,4 @@
     }
 
 }
+
diff --git a/jaxp/test/javax/xml/jaxp/unittest/validation/tck/Bug6970890Test.java b/jaxp/test/javax/xml/jaxp/unittest/validation/tck/Bug6970890Test.java
index 460989a..3e3afac 100644
--- a/jaxp/test/javax/xml/jaxp/unittest/validation/tck/Bug6970890Test.java
+++ b/jaxp/test/javax/xml/jaxp/unittest/validation/tck/Bug6970890Test.java
@@ -29,13 +29,19 @@
 import javax.xml.validation.SchemaFactory;
 
 import org.testng.Assert;
+import org.testng.annotations.Listeners;
 import org.testng.annotations.Test;
 import org.xml.sax.SAXException;
 
 /*
+ * @test
  * @bug 6970890
+ * @library /javax/xml/jaxp/libs /javax/xml/jaxp/unittest
+ * @run testng/othervm -DrunSecMngr=true validation.tck.Bug6970890Test
+ * @run testng/othervm validation.tck.Bug6970890Test
  * @summary Test Schema allows [-] in regex.
  */
+@Listeners({jaxp.library.FilePolicy.class})
 public class Bug6970890Test {
     static final String SCHEMA_LANGUAGE = "http://java.sun.com/xml/jaxp/properties/schemaLanguage";
     static final String SCHEMA_SOURCE = "http://java.sun.com/xml/jaxp/properties/schemaSource";
@@ -66,3 +72,4 @@
     }
 
 }
+
diff --git a/jaxp/test/javax/xml/jaxp/unittest/validation/tck/Bug6971190Test.java b/jaxp/test/javax/xml/jaxp/unittest/validation/tck/Bug6971190Test.java
index 89e1c3d..ca73394 100644
--- a/jaxp/test/javax/xml/jaxp/unittest/validation/tck/Bug6971190Test.java
+++ b/jaxp/test/javax/xml/jaxp/unittest/validation/tck/Bug6971190Test.java
@@ -32,13 +32,19 @@
 import javax.xml.validation.Validator;
 
 import org.testng.Assert;
+import org.testng.annotations.Listeners;
 import org.testng.annotations.Test;
 import org.xml.sax.SAXException;
 
 /*
+ * @test
  * @bug 6971190
+ * @library /javax/xml/jaxp/libs /javax/xml/jaxp/unittest
+ * @run testng/othervm -DrunSecMngr=true validation.tck.Bug6971190Test
+ * @run testng/othervm validation.tck.Bug6971190Test
  * @summary Test Validation accepts UTF lexical presentation.
  */
+@Listeners({jaxp.library.FilePolicy.class})
 public class Bug6971190Test {
     static final String SCHEMA_LANGUAGE = "http://java.sun.com/xml/jaxp/properties/schemaLanguage";
     static final String SCHEMA_SOURCE = "http://java.sun.com/xml/jaxp/properties/schemaSource";
@@ -96,3 +102,4 @@
     }
 
 }
+
diff --git a/jaxp/test/javax/xml/jaxp/unittest/validation/tck/Bug6974551Test.java b/jaxp/test/javax/xml/jaxp/unittest/validation/tck/Bug6974551Test.java
index f2248a4..f4d3581 100644
--- a/jaxp/test/javax/xml/jaxp/unittest/validation/tck/Bug6974551Test.java
+++ b/jaxp/test/javax/xml/jaxp/unittest/validation/tck/Bug6974551Test.java
@@ -34,15 +34,21 @@
 import javax.xml.validation.Validator;
 
 import org.testng.Assert;
+import org.testng.annotations.Listeners;
 import org.testng.annotations.Test;
 import org.xml.sax.SAXException;
 import org.xml.sax.SAXParseException;
 import org.xml.sax.helpers.DefaultHandler;
 
 /*
+ * @test
  * @bug 6974551
+ * @library /javax/xml/jaxp/libs /javax/xml/jaxp/unittest
+ * @run testng/othervm -DrunSecMngr=true validation.tck.Bug6974551Test
+ * @run testng/othervm validation.tck.Bug6974551Test
  * @summary Test Validation for SAXParser can expose whitespace facet for xs:anySimpleType.
  */
+@Listeners({jaxp.library.FilePolicy.class})
 public class Bug6974551Test {
     static final String SCHEMA_LANGUAGE = "http://java.sun.com/xml/jaxp/properties/schemaLanguage";
     static final String SCHEMA_SOURCE = "http://java.sun.com/xml/jaxp/properties/schemaSource";
@@ -116,3 +122,4 @@
     }
 
 }
+
diff --git a/jaxp/test/javax/xml/jaxp/unittest/validation/tck/Bug6975265Test.java b/jaxp/test/javax/xml/jaxp/unittest/validation/tck/Bug6975265Test.java
index 2a5f557..12ed826 100644
--- a/jaxp/test/javax/xml/jaxp/unittest/validation/tck/Bug6975265Test.java
+++ b/jaxp/test/javax/xml/jaxp/unittest/validation/tck/Bug6975265Test.java
@@ -31,13 +31,19 @@
 import javax.xml.validation.SchemaFactory;
 
 import org.testng.Assert;
+import org.testng.annotations.Listeners;
 import org.testng.annotations.Test;
 import org.xml.sax.SAXException;
 
 /*
+ * @test
  * @bug 6975265
+ * @library /javax/xml/jaxp/libs /javax/xml/jaxp/unittest
+ * @run testng/othervm -DrunSecMngr=true validation.tck.Bug6975265Test
+ * @run testng/othervm validation.tck.Bug6975265Test
  * @summary Test Schema doesn't allow some Element Information Items contain other element information item.
  */
+@Listeners({jaxp.library.FilePolicy.class})
 public class Bug6975265Test {
     static final String SCHEMA_LANGUAGE = "http://java.sun.com/xml/jaxp/properties/schemaLanguage";
     static final String SCHEMA_SOURCE = "http://java.sun.com/xml/jaxp/properties/schemaSource";
@@ -65,3 +71,4 @@
     }
 
 }
+
diff --git a/jaxp/test/javax/xml/jaxp/unittest/validation/tck/Bug6977201Test.java b/jaxp/test/javax/xml/jaxp/unittest/validation/tck/Bug6977201Test.java
index f5b6e49..df77551 100644
--- a/jaxp/test/javax/xml/jaxp/unittest/validation/tck/Bug6977201Test.java
+++ b/jaxp/test/javax/xml/jaxp/unittest/validation/tck/Bug6977201Test.java
@@ -30,12 +30,18 @@
 import javax.xml.validation.Validator;
 
 import org.testng.Assert;
+import org.testng.annotations.Listeners;
 import org.testng.annotations.Test;
 
 /*
+ * @test
  * @bug 6977201
+ * @library /javax/xml/jaxp/libs /javax/xml/jaxp/unittest
+ * @run testng/othervm -DrunSecMngr=true validation.tck.Bug6977201Test
+ * @run testng/othervm validation.tck.Bug6977201Test
  * @summary Test Validator interprets regex "" correctly.
  */
+@Listeners({jaxp.library.FilePolicy.class})
 public class Bug6977201Test {
     static final String SCHEMA_LANGUAGE = "http://java.sun.com/xml/jaxp/properties/schemaLanguage";
     static final String SCHEMA_SOURCE = "http://java.sun.com/xml/jaxp/properties/schemaSource";
@@ -65,3 +71,4 @@
     }
 
 }
+
diff --git a/jaxp/test/javax/xml/jaxp/unittest/validation/tck/Bug6989956Test.java b/jaxp/test/javax/xml/jaxp/unittest/validation/tck/Bug6989956Test.java
index 94682bb..d1be119 100644
--- a/jaxp/test/javax/xml/jaxp/unittest/validation/tck/Bug6989956Test.java
+++ b/jaxp/test/javax/xml/jaxp/unittest/validation/tck/Bug6989956Test.java
@@ -36,6 +36,7 @@
 import javax.xml.validation.Validator;
 
 import org.testng.Assert;
+import org.testng.annotations.Listeners;
 import org.testng.annotations.Test;
 import org.xml.sax.ErrorHandler;
 import org.xml.sax.SAXException;
@@ -45,9 +46,14 @@
 import org.xml.sax.helpers.DefaultHandler;
 
 /*
+ * @test
  * @bug 6989956
+ * @library /javax/xml/jaxp/libs /javax/xml/jaxp/unittest
+ * @run testng/othervm -DrunSecMngr=true validation.tck.Bug6989956Test
+ * @run testng/othervm validation.tck.Bug6989956Test
  * @summary Test Validation can process correctly that maxOccurs in Choice less than maxOccurs in Elements contained in the Choice.
  */
+@Listeners({jaxp.library.FilePolicy.class})
 public class Bug6989956Test {
     static final String SCHEMA_LANGUAGE = "http://java.sun.com/xml/jaxp/properties/schemaLanguage";
     static final String SCHEMA_SOURCE = "http://java.sun.com/xml/jaxp/properties/schemaSource";
@@ -142,3 +148,4 @@
     }
 
 }
+
diff --git a/jaxp/test/javax/xml/jaxp/unittest/validation/tck/Bug7014246Test.java b/jaxp/test/javax/xml/jaxp/unittest/validation/tck/Bug7014246Test.java
index f6316c9..025c972 100644
--- a/jaxp/test/javax/xml/jaxp/unittest/validation/tck/Bug7014246Test.java
+++ b/jaxp/test/javax/xml/jaxp/unittest/validation/tck/Bug7014246Test.java
@@ -29,13 +29,19 @@
 import javax.xml.validation.SchemaFactory;
 
 import org.testng.Assert;
+import org.testng.annotations.Listeners;
 import org.testng.annotations.Test;
 import org.xml.sax.SAXException;
 
 /*
+ * @test
  * @bug 7014246
+ * @library /javax/xml/jaxp/libs /javax/xml/jaxp/unittest
+ * @run testng/othervm -DrunSecMngr=true validation.tck.Bug7014246Test
+ * @run testng/othervm validation.tck.Bug7014246Test
  * @summary Test Schema doesn't allow maxInclusive of derived time type greater than the base.
  */
+@Listeners({jaxp.library.FilePolicy.class})
 public class Bug7014246Test {
     static final String SCHEMA_LANGUAGE = "http://java.sun.com/xml/jaxp/properties/schemaLanguage";
     static final String SCHEMA_SOURCE = "http://java.sun.com/xml/jaxp/properties/schemaSource";
@@ -53,3 +59,4 @@
     }
 
 }
+
diff --git a/jaxp/test/javax/xml/jaxp/unittest/validation/tck/ParticleTest.java b/jaxp/test/javax/xml/jaxp/unittest/validation/tck/ParticleTest.java
index f82e4d2..19a9eb7 100644
--- a/jaxp/test/javax/xml/jaxp/unittest/validation/tck/ParticleTest.java
+++ b/jaxp/test/javax/xml/jaxp/unittest/validation/tck/ParticleTest.java
@@ -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
@@ -28,16 +28,22 @@
 import javax.xml.validation.Schema;
 import javax.xml.validation.SchemaFactory;
 import javax.xml.validation.Validator;
+import org.testng.annotations.Listeners;
 import org.testng.annotations.Test;
 import org.xml.sax.SAXException;
 
 
 /*
+ * @test
  * @bug 8142463
+ * @library /javax/xml/jaxp/libs /javax/xml/jaxp/unittest
+ * @run testng/othervm -DrunSecMngr=true validation.tck.ParticleTest
+ * @run testng/othervm validation.tck.ParticleTest
  * @summary Tests that verify bug fixes for Particles (http://www.w3.org/TR/xmlschema11-1/#cParticles)
 
  * @author Joe Wang (huizhe.wang@oracle.com)
  */
+@Listeners({jaxp.library.FilePolicy.class})
 public class ParticleTest {
     static final String SCHEMA_LANGUAGE = "http://java.sun.com/xml/jaxp/properties/schemaLanguage";
     static final String SCHEMA_SOURCE = "http://java.sun.com/xml/jaxp/properties/schemaSource";
@@ -57,3 +63,4 @@
         validator.validate(new StreamSource(ParticleTest.class.getResourceAsStream("upa01.xml")));
     }
 }
+
diff --git a/jaxp/test/javax/xml/jaxp/unittest/validation/tck/RegexWord.java b/jaxp/test/javax/xml/jaxp/unittest/validation/tck/RegexWord.java
index dd59b93..a46c7c7 100644
--- a/jaxp/test/javax/xml/jaxp/unittest/validation/tck/RegexWord.java
+++ b/jaxp/test/javax/xml/jaxp/unittest/validation/tck/RegexWord.java
@@ -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
@@ -28,15 +28,21 @@
 import javax.xml.validation.Schema;
 import javax.xml.validation.SchemaFactory;
 import javax.xml.validation.Validator;
+import org.testng.annotations.Listeners;
 import org.testng.annotations.Test;
 import org.xml.sax.SAXException;
 
 /*
+ * @test
  * @bug 8142900
+ * @library /javax/xml/jaxp/libs /javax/xml/jaxp/unittest
+ * @run testng/othervm -DrunSecMngr=true validation.tck.RegexWord
+ * @run testng/othervm validation.tck.RegexWord
  * @summary Verifies that all characters except the set of "punctuation",
  * "separator" and "other" characters are accepted by \w [#x0000-#x10FFFF]-[\p{P}\p{Z}\p{C}]
  * @author Joe Wang
  */
+@Listeners({jaxp.library.FilePolicy.class})
 public class RegexWord {
     static final String SCHEMA_LANGUAGE = "http://java.sun.com/xml/jaxp/properties/schemaLanguage";
     static final String SCHEMA_SOURCE = "http://java.sun.com/xml/jaxp/properties/schemaSource";
@@ -57,3 +63,4 @@
         validator.validate(new StreamSource(RegexWord.class.getResourceAsStream("reZ003vExc23082309.xml")));
     }
 }
+
diff --git a/jaxp/test/javax/xml/jaxp/unittest/xpath/Bug4991857.java b/jaxp/test/javax/xml/jaxp/unittest/xpath/Bug4991857.java
index aa37ec7..a8f65a2 100644
--- a/jaxp/test/javax/xml/jaxp/unittest/xpath/Bug4991857.java
+++ b/jaxp/test/javax/xml/jaxp/unittest/xpath/Bug4991857.java
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2014, 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2014, 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
@@ -29,14 +29,20 @@
 import javax.xml.xpath.XPathFactory;
 
 import org.testng.Assert;
+import org.testng.annotations.Listeners;
 import org.testng.annotations.Test;
 import org.w3c.dom.Document;
 
 
 /*
+ * @test
  * @bug 4991857
+ * @library /javax/xml/jaxp/libs /javax/xml/jaxp/unittest
+ * @run testng/othervm -DrunSecMngr=true xpath.Bug4991857
+ * @run testng/othervm xpath.Bug4991857
  * @summary XPath.evaluate(...) throws XPathExpressionException when context is null and expression refers to the context.
  */
+@Listeners({jaxp.library.BasePolicy.class})
 public class Bug4991857 {
 
     Document d = null;
@@ -86,3 +92,4 @@
         }
     }
 }
+
diff --git a/jaxp/test/javax/xml/jaxp/unittest/xpath/Bug4991939.java b/jaxp/test/javax/xml/jaxp/unittest/xpath/Bug4991939.java
index 206c6aa..d201f48 100644
--- a/jaxp/test/javax/xml/jaxp/unittest/xpath/Bug4991939.java
+++ b/jaxp/test/javax/xml/jaxp/unittest/xpath/Bug4991939.java
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2014, 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2014, 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
@@ -29,12 +29,18 @@
 import javax.xml.xpath.XPathFactory;
 
 import org.testng.Assert;
+import org.testng.annotations.Listeners;
 import org.testng.annotations.Test;
 
 /*
+ * @test
  * @bug 4991939
+ * @library /javax/xml/jaxp/libs /javax/xml/jaxp/unittest
+ * @run testng/othervm -DrunSecMngr=true xpath.Bug4991939
+ * @run testng/othervm xpath.Bug4991939
  * @summary XPath.evaluate(...) throws IllegalArgumentException if returnType is not one of the types defined in XPathConstants.
  */
+@Listeners({jaxp.library.BasePolicy.class})
 public class Bug4991939 {
 
     @Test
@@ -55,3 +61,4 @@
         }
     }
 }
+
diff --git a/jaxp/test/javax/xml/jaxp/unittest/xpath/Bug4992788.java b/jaxp/test/javax/xml/jaxp/unittest/xpath/Bug4992788.java
index 2b4f9c2..4da3e2d 100644
--- a/jaxp/test/javax/xml/jaxp/unittest/xpath/Bug4992788.java
+++ b/jaxp/test/javax/xml/jaxp/unittest/xpath/Bug4992788.java
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2014, 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2014, 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
@@ -31,13 +31,19 @@
 import javax.xml.xpath.XPathFactoryConfigurationException;
 
 import org.testng.Assert;
+import org.testng.annotations.Listeners;
 import org.testng.annotations.Test;
 import org.xml.sax.InputSource;
 
 /*
+ * @test
  * @bug 4992788
+ * @library /javax/xml/jaxp/libs /javax/xml/jaxp/unittest
+ * @run testng/othervm -DrunSecMngr=true xpath.Bug4992788
+ * @run testng/othervm xpath.Bug4992788
  * @summary Test XPath.evaluate(expression,source,returnType) throws NPE if source is null.
  */
+@Listeners({jaxp.library.BasePolicy.class})
 public class Bug4992788 {
 
     private static String expression = "/widgets/widget[@name='a']/@quantity";
@@ -76,3 +82,4 @@
         return xpath;
     }
 }
+
diff --git a/jaxp/test/javax/xml/jaxp/unittest/xpath/Bug4992793.java b/jaxp/test/javax/xml/jaxp/unittest/xpath/Bug4992793.java
index 5810cd6..2e4a412 100644
--- a/jaxp/test/javax/xml/jaxp/unittest/xpath/Bug4992793.java
+++ b/jaxp/test/javax/xml/jaxp/unittest/xpath/Bug4992793.java
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2014, 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2014, 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
@@ -33,13 +33,19 @@
 import javax.xml.xpath.XPathFactoryConfigurationException;
 
 import org.testng.Assert;
+import org.testng.annotations.Listeners;
 import org.testng.annotations.Test;
 import org.xml.sax.InputSource;
 
 /*
+ * @test
  * @bug 4992793
+ * @library /javax/xml/jaxp/libs /javax/xml/jaxp/unittest
+ * @run testng/othervm -DrunSecMngr=true xpath.Bug4992793
+ * @run testng/othervm xpath.Bug4992793
  * @summary Test XPath.evaluate(expression,source,returnType) throws NPE if expression is null.
  */
+@Listeners({jaxp.library.BasePolicy.class})
 public class Bug4992793 {
 
 
@@ -77,3 +83,4 @@
         return xpath;
     }
 }
+
diff --git a/jaxp/test/javax/xml/jaxp/unittest/xpath/Bug4992805.java b/jaxp/test/javax/xml/jaxp/unittest/xpath/Bug4992805.java
index b847feb..97a9abf 100644
--- a/jaxp/test/javax/xml/jaxp/unittest/xpath/Bug4992805.java
+++ b/jaxp/test/javax/xml/jaxp/unittest/xpath/Bug4992805.java
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2014, 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2014, 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
@@ -32,13 +32,19 @@
 import javax.xml.xpath.XPathFactoryConfigurationException;
 
 import org.testng.Assert;
+import org.testng.annotations.Listeners;
 import org.testng.annotations.Test;
 import org.xml.sax.InputSource;
 
 /*
+ * @test
  * @bug 4992805
+ * @library /javax/xml/jaxp/libs /javax/xml/jaxp/unittest
+ * @run testng/othervm -DrunSecMngr=true xpath.Bug4992805
+ * @run testng/othervm xpath.Bug4992805
  * @summary Test XPath.evaluate(expression,source,returnType) throws NPE if returnType is null.
  */
+@Listeners({jaxp.library.BasePolicy.class})
 public class Bug4992805 {
 
     private static String expression = "/widgets/widget[@name='a']/@quantity";
@@ -64,3 +70,4 @@
         return xpath;
     }
 }
+
diff --git a/jaxp/test/javax/xml/jaxp/unittest/xpath/ClassLoaderTest.java b/jaxp/test/javax/xml/jaxp/unittest/xpath/ClassLoaderTest.java
index 9a3a66a..d5a52bd 100644
--- a/jaxp/test/javax/xml/jaxp/unittest/xpath/ClassLoaderTest.java
+++ b/jaxp/test/javax/xml/jaxp/unittest/xpath/ClassLoaderTest.java
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2014, 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2014, 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
@@ -23,21 +23,29 @@
 
 package xpath;
 
+import static jaxp.library.JAXPTestUtilities.runWithAllPerm;
+
 import javax.xml.xpath.XPathFactory;
 
 import org.testng.Assert;
+import org.testng.annotations.Listeners;
 import org.testng.annotations.Test;
 
 /*
+ * @test
  * @bug 6354969
+ * @library /javax/xml/jaxp/libs /javax/xml/jaxp/unittest
+ * @run testng/othervm -DrunSecMngr=true xpath.ClassLoaderTest
+ * @run testng/othervm xpath.ClassLoaderTest
  * @summary Test XPathFactory newInstance() with ContextClassLoader.
  */
+@Listeners({jaxp.library.BasePolicy.class})
 public class ClassLoaderTest {
 
     @Test
     public void testClassLoader() {
-        MyClassLoader cl = new MyClassLoader();
-        Thread.currentThread().setContextClassLoader(cl);
+        MyClassLoader cl = runWithAllPerm(() -> new MyClassLoader());
+        runWithAllPerm(() -> Thread.currentThread().setContextClassLoader(cl));
         XPathFactory xPathFactory = XPathFactory.newInstance();
 
         if (!cl.isCalled()) {
@@ -46,3 +54,4 @@
 
     }
 }
+
diff --git a/jaxp/test/javax/xml/jaxp/unittest/xpath/MyClassLoader.java b/jaxp/test/javax/xml/jaxp/unittest/xpath/MyClassLoader.java
index d333e70..39a0d72 100644
--- a/jaxp/test/javax/xml/jaxp/unittest/xpath/MyClassLoader.java
+++ b/jaxp/test/javax/xml/jaxp/unittest/xpath/MyClassLoader.java
@@ -47,3 +47,4 @@
         return isCalled;
     }
 }
+
diff --git a/jaxp/test/javax/xml/jaxp/unittest/xpath/SecureProcessingTest.java b/jaxp/test/javax/xml/jaxp/unittest/xpath/SecureProcessingTest.java
index cbd44e9..a78c1e1 100644
--- a/jaxp/test/javax/xml/jaxp/unittest/xpath/SecureProcessingTest.java
+++ b/jaxp/test/javax/xml/jaxp/unittest/xpath/SecureProcessingTest.java
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2014, 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2014, 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
@@ -43,26 +43,23 @@
 import javax.xml.xpath.XPathFunctionResolver;
 
 import org.testng.Assert;
+import org.testng.annotations.Listeners;
 import org.testng.annotations.Test;
 import org.w3c.dom.Document;
 import org.xml.sax.SAXException;
 
 /*
+ * @test
+ * @library /javax/xml/jaxp/libs /javax/xml/jaxp/unittest
+ * @run testng/othervm -DrunSecMngr=true xpath.SecureProcessingTest
+ * @run testng/othervm xpath.SecureProcessingTest
  * @summary Test when FEATURE_SECURE_PROCESSING is true, calling an external function will cause XPathFunctionException.
  */
+@Test
+@Listeners({jaxp.library.FilePolicy.class})
 public class SecureProcessingTest {
-    static boolean _isSecureMode = false;
-    static {
-        if (System.getSecurityManager() != null) {
-            _isSecureMode = true;
-            System.out.println("Security Manager is present");
-        } else {
-            System.out.println("Security Manager is NOT present");
-        }
-    }
-
-    @Test
     public final void testSecureProcessing() {
+        boolean _isSecureMode = System.getSecurityManager() != null;
 
         final String XPATH_EXPRESSION = "ext:helloWorld()";
 
@@ -150,7 +147,7 @@
         }
     }
 
-    public class MyXPathFunctionResolver implements XPathFunctionResolver {
+    private class MyXPathFunctionResolver implements XPathFunctionResolver {
 
         public XPathFunction resolveFunction(QName functionName, int arity) {
 
@@ -159,7 +156,7 @@
         }
     }
 
-    public class MyXPathFunction implements XPathFunction {
+    private class MyXPathFunction implements XPathFunction {
 
         public Object evaluate(List list) throws XPathFunctionException {
 
@@ -167,7 +164,7 @@
         }
     }
 
-    public class MyNamespaceContext implements NamespaceContext {
+    private class MyNamespaceContext implements NamespaceContext {
 
         public String getNamespaceURI(String prefix) {
             if (prefix == null) {
@@ -199,3 +196,4 @@
         }
     }
 }
+
diff --git a/jaxp/test/javax/xml/jaxp/unittest/xpath/XPathAnyTypeTest.java b/jaxp/test/javax/xml/jaxp/unittest/xpath/XPathAnyTypeTest.java
index c42101a..6ba9ceb 100644
--- a/jaxp/test/javax/xml/jaxp/unittest/xpath/XPathAnyTypeTest.java
+++ b/jaxp/test/javax/xml/jaxp/unittest/xpath/XPathAnyTypeTest.java
@@ -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
@@ -32,15 +32,21 @@
 import static org.testng.Assert.assertEquals;
 import static org.testng.Assert.assertTrue;
 
+import org.testng.annotations.Listeners;
 import org.testng.annotations.Test;
 import org.w3c.dom.Document;
 import org.w3c.dom.Node;
 
 /*
+ * @test
  * @bug 8054196
+ * @library /javax/xml/jaxp/libs /javax/xml/jaxp/unittest
+ * @run testng/othervm -DrunSecMngr=true xpath.XPathAnyTypeTest
+ * @run testng/othervm xpath.XPathAnyTypeTest
  * @summary Test for the project XPath: support any type. This test covers the new
  * evaluateExpression methods of XPath, as well as XPathNodes and XPathEvaluationResult.
  */
+@Listeners({jaxp.library.BasePolicy.class})
 public class XPathAnyTypeTest extends XPathTestBase {
     /*
      Test for resolveFunction(QName functionName,int arity); evaluate throws
@@ -194,3 +200,4 @@
         verifyResult(result, "Customer");
     }
 }
+
diff --git a/jaxp/test/javax/xml/jaxp/unittest/xpath/XPathExpAnyTypeTest.java b/jaxp/test/javax/xml/jaxp/unittest/xpath/XPathExpAnyTypeTest.java
index ab97507..f661fe9 100644
--- a/jaxp/test/javax/xml/jaxp/unittest/xpath/XPathExpAnyTypeTest.java
+++ b/jaxp/test/javax/xml/jaxp/unittest/xpath/XPathExpAnyTypeTest.java
@@ -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
@@ -34,15 +34,21 @@
 import static org.testng.Assert.assertEquals;
 import static org.testng.Assert.assertTrue;
 
+import org.testng.annotations.Listeners;
 import org.testng.annotations.Test;
 import org.w3c.dom.Document;
 import org.w3c.dom.Node;
 
 /*
+ * @test
  * @bug 8054196
+ * @library /javax/xml/jaxp/libs /javax/xml/jaxp/unittest
+ * @run testng/othervm -DrunSecMngr=true xpath.XPathExpAnyTypeTest
+ * @run testng/othervm xpath.XPathExpAnyTypeTest
  * @summary Test for the project XPath: support any type. This test covers the new
  * evaluateExpression methods of XPathExpression.
  */
+@Listeners({jaxp.library.BasePolicy.class})
 public class XPathExpAnyTypeTest extends XPathTestBase {
 
     /*
@@ -181,3 +187,4 @@
     }
 
 }
+
diff --git a/jaxp/test/javax/xml/jaxp/unittest/xpath/XPathTest.java b/jaxp/test/javax/xml/jaxp/unittest/xpath/XPathTest.java
index ee66879..a6c8054 100644
--- a/jaxp/test/javax/xml/jaxp/unittest/xpath/XPathTest.java
+++ b/jaxp/test/javax/xml/jaxp/unittest/xpath/XPathTest.java
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2014, 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2014, 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,18 @@
 import javax.xml.xpath.XPath;
 import javax.xml.xpath.XPathFactory;
 
+import org.testng.annotations.Listeners;
 import org.testng.annotations.Test;
 
 /*
+ * @test
  * @bug 6376058
+ * @library /javax/xml/jaxp/libs /javax/xml/jaxp/unittest
+ * @run testng/othervm -DrunSecMngr=true xpath.XPathTest
+ * @run testng/othervm xpath.XPathTest
  * @summary Test XPath.getNamespaceContext() is supported.
  */
+@Listeners({jaxp.library.BasePolicy.class})
 public class XPathTest {
 
     @Test
@@ -45,3 +51,4 @@
 
     }
 }
+
diff --git a/jaxp/test/javax/xml/jaxp/unittest/xpath/XPathTestBase.java b/jaxp/test/javax/xml/jaxp/unittest/xpath/XPathTestBase.java
index 4d9666a..8ee45de 100644
--- a/jaxp/test/javax/xml/jaxp/unittest/xpath/XPathTestBase.java
+++ b/jaxp/test/javax/xml/jaxp/unittest/xpath/XPathTestBase.java
@@ -115,7 +115,7 @@
      * DataProvider: XPath object
      */
     @DataProvider(name = "xpath")
-    Object[][] getXPath() {
+    public Object[][] getXPath() {
         return new Object[][]{{XPathFactory.newInstance().newXPath()}};
     }
 
@@ -123,7 +123,7 @@
      * DataProvider: Numeric types not supported
      */
     @DataProvider(name = "invalidNumericTypes")
-    Object[][] getInvalidNumericTypes() {
+    public Object[][] getInvalidNumericTypes() {
         XPath xpath = XPathFactory.newInstance().newXPath();
         return new Object[][]{{xpath, AtomicInteger.class},
             {xpath, AtomicInteger.class},
@@ -140,7 +140,7 @@
      * DataProvider: XPath and Document objects
      */
     @DataProvider(name = "document")
-    Object[][] getDocument() throws Exception {
+    public Object[][] getDocument() throws Exception {
         DocumentBuilderFactory dBF = DocumentBuilderFactory.newInstance();
         dBF.setValidating(false);
         dBF.setNamespaceAware(true);
diff --git a/jaxws/.hgtags b/jaxws/.hgtags
index 751e702..0d23a61 100644
--- a/jaxws/.hgtags
+++ b/jaxws/.hgtags
@@ -375,3 +375,4 @@
 06d706c70634775418dc79a2671780ba1c624fd2 jdk-9+127
 fe4e11bd2423635dc0f5f5cb9a64eb2f2cce7f4c jdk-9+128
 46a02f57218e4a8c334dbccf656fb048f823f163 jdk-9+129
+39c6293131d91aec7f2f5120395e070a937b8858 jdk-9+130
diff --git a/jaxws/src/java.xml.bind/share/classes/javax/xml/bind/ValidationEvent.java b/jaxws/src/java.xml.bind/share/classes/javax/xml/bind/ValidationEvent.java
index 979cd43..367a82a 100644
--- a/jaxws/src/java.xml.bind/share/classes/javax/xml/bind/ValidationEvent.java
+++ b/jaxws/src/java.xml.bind/share/classes/javax/xml/bind/ValidationEvent.java
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2003, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2003, 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
@@ -60,8 +60,8 @@
      * Retrieve the severity code for this warning/error.
      *
      * <p>
-     * Must be one of {@code ValidationError.WARNING},
-     * {@code ValidationError.ERROR}, or {@code ValidationError.FATAL_ERROR}.
+     * Must be one of {@code ValidationEvent.WARNING},
+     * {@code ValidationEvent.ERROR}, or {@code ValidationEvent.FATAL_ERROR}.
      *
      * @return the severity code for this warning/error
      */
diff --git a/jdk/.hgtags b/jdk/.hgtags
index cad3e22..4dbe1d4 100644
--- a/jdk/.hgtags
+++ b/jdk/.hgtags
@@ -372,3 +372,4 @@
 7a97b89ba83077ca62e4aa5a05437adc8f315343 jdk-9+127
 9446c534f0222b4eecfd9d9e25ab37c4fd4400a5 jdk-9+128
 47699aa2e69ec2702542dc73eb01de3bfb61aea0 jdk-9+129
+6c827500e34587061af97ad6fef0e859280255c5 jdk-9+130
diff --git a/jdk/make/launcher/Launcher-jdk.hotspot.agent.gmk b/jdk/make/launcher/Launcher-jdk.hotspot.agent.gmk
index 9acc6ea..cbf04bf 100644
--- a/jdk/make/launcher/Launcher-jdk.hotspot.agent.gmk
+++ b/jdk/make/launcher/Launcher-jdk.hotspot.agent.gmk
@@ -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
@@ -25,12 +25,6 @@
 
 include LauncherCommon.gmk
 
-$(eval $(call SetupBuildLauncher, jsadebugd, \
-    MAIN_CLASS := sun.jvm.hotspot.jdi.SADebugServer, \
-    MACOSX_SIGNED := true, \
-))
-
-
 $(eval $(call SetupBuildLauncher, jhsdb, \
     MAIN_CLASS := sun.jvm.hotspot.SALauncher, \
     MACOSX_SIGNED := true, \
diff --git a/jdk/make/lib/Awt2dLibraries.gmk b/jdk/make/lib/Awt2dLibraries.gmk
index 85e46e0..c7d296b 100644
--- a/jdk/make/lib/Awt2dLibraries.gmk
+++ b/jdk/make/lib/Awt2dLibraries.gmk
@@ -56,9 +56,6 @@
     OPTIMIZATION := HIGHEST, \
     CFLAGS := $(CFLAGS_JDKLIB) \
         $(BUILD_LIBMLIB_CFLAGS), \
-    DISABLED_WARNINGS_gcc := parentheses array-bounds, \
-    DISABLED_WARNINGS_clang := parentheses, \
-    DISABLED_WARNINGS_solstudio := E_STATEMENT_NOT_REACHED, \
     MAPFILE := $(BUILD_LIBMLIB_IMAGE_MAPFILE), \
     LDFLAGS := $(LDFLAGS_JDKLIB) \
         $(call SET_SHARED_LIBRARY_ORIGIN), \
@@ -119,7 +116,6 @@
       CFLAGS := -xarch=sparcvis \
           $(LIBMLIB_IMAGE_V_CFLAGS) \
           $(CFLAGS_JDKLIB), \
-      DISABLED_WARNINGS_solstudio := E_STATEMENT_NOT_REACHED, \
       MAPFILE := $(BUILD_LIBMLIB_IMAGE_MAPFILE), \
       LDFLAGS := $(LDFLAGS_JDKLIB) \
           $(call SET_SHARED_LIBRARY_ORIGIN), \
@@ -147,8 +143,6 @@
 
 ifeq ($(OPENJDK_TARGET_OS), windows)
   LIBAWT_DIRS += $(JDK_TOPDIR)/src/java.desktop/share/native/common/awt/utility
-else
-  LIBAWT_EXFILES := java2d/ShaderList.c
 endif
 
 ifneq ($(filter $(OPENJDK_TARGET_OS), solaris linux macosx aix), )
@@ -350,8 +344,6 @@
       BUILD_LIBAWT_XAWT_awt_Font.c_CFLAGS := -w
       # initializing a declared 'extern'
       BUILD_LIBAWT_XAWT_debug_mem.c_CFLAGS := -w
-      # decimal constant is unsigned only in ISO C90 (JAVASE_EMBEDDED)
-      BUILD_LIBAWT_XAWT_XToolkit.c_CFLAGS := -w
    endif
 
     $(eval $(call SetupNativeCompilation,BUILD_LIBAWT_XAWT, \
@@ -498,9 +490,7 @@
     CFLAGS := $(CFLAGS_JDKLIB) $(BUILD_LIBJAVAJPEG_HEADERS) \
         $(LIBJAVA_HEADER_FLAGS) \
         -I$(SUPPORT_OUTPUTDIR)/headers/java.desktop, \
-    DISABLED_WARNINGS_gcc := clobbered parentheses array-bounds shift-negative-value, \
-    DISABLED_WARNINGS_clang := logical-op-parentheses, \
-    DISABLED_WARNINGS_microsoft := 4267, \
+    DISABLED_WARNINGS_gcc := clobbered, \
     MAPFILE := $(JDK_TOPDIR)/make/mapfiles/libjpeg/mapfile-vers, \
     LDFLAGS := $(LDFLAGS_JDKLIB) \
         $(call SET_SHARED_LIBRARY_ORIGIN), \
diff --git a/jdk/src/demo/share/jvmti/compiledMethodLoad/sample.makefile.txt b/jdk/src/demo/share/jvmti/compiledMethodLoad/sample.makefile.txt
index 3c4c5de..3da8383 100644
--- a/jdk/src/demo/share/jvmti/compiledMethodLoad/sample.makefile.txt
+++ b/jdk/src/demo/share/jvmti/compiledMethodLoad/sample.makefile.txt
@@ -1,5 +1,5 @@
 #
-# Copyright (c) 2010, 2012, Oracle and/or its affiliates. All rights reserved.
+# Copyright (c) 2010, 2016, Oracle and/or its affiliates. All rights reserved.
 #
 # Redistribution and use in source and binary forms, with or without
 # modification, are permitted provided that the following conditions
@@ -45,12 +45,12 @@
 LIBNAME=compiledMethodLoad
 SOURCES=compiledMethodLoad.c ../agent_util/agent_util.c
 
-# Solaris Sun C Compiler Version 5.5
+# Solaris Studio C Compiler Version 12.4
 ifeq ($(OSNAME), solaris)
     # Sun Solaris Compiler options needed
     COMMON_FLAGS=-mt -KPIC
     # Options that help find errors
-    COMMON_FLAGS+= -Xa -v -xstrconst -xc99=%none
+    COMMON_FLAGS+= -Xa -v -xc99=%none
     # Check LIBARCH for any special compiler options
     LIBARCH=$(shell uname -p)
     ifeq ($(LIBARCH), sparc)
diff --git a/jdk/src/demo/share/jvmti/gctest/sample.makefile.txt b/jdk/src/demo/share/jvmti/gctest/sample.makefile.txt
index 5e5d072..46afeb4 100644
--- a/jdk/src/demo/share/jvmti/gctest/sample.makefile.txt
+++ b/jdk/src/demo/share/jvmti/gctest/sample.makefile.txt
@@ -1,5 +1,5 @@
 #
-# Copyright (c) 2004, 2012, Oracle and/or its affiliates. All rights reserved.
+# Copyright (c) 2004, 2016, Oracle and/or its affiliates. All rights reserved.
 #
 # Redistribution and use in source and binary forms, with or without
 # modification, are permitted provided that the following conditions
@@ -45,12 +45,12 @@
 LIBNAME=gctest
 SOURCES=gctest.c ../agent_util/agent_util.c
 
-# Solaris Sun C Compiler Version 5.5
+# Solaris Studio C Compiler Version 12.4
 ifeq ($(OSNAME), solaris)
     # Sun Solaris Compiler options needed
     COMMON_FLAGS=-mt -KPIC
     # Options that help find errors
-    COMMON_FLAGS+= -Xa -v -xstrconst -xc99=%none
+    COMMON_FLAGS+= -Xa -v -xc99=%none
     # Check LIBARCH for any special compiler options
     LIBARCH=$(shell uname -p)
     ifeq ($(LIBARCH), sparc)
diff --git a/jdk/src/demo/share/jvmti/heapTracker/sample.makefile.txt b/jdk/src/demo/share/jvmti/heapTracker/sample.makefile.txt
index d6e964f..e094bc8 100644
--- a/jdk/src/demo/share/jvmti/heapTracker/sample.makefile.txt
+++ b/jdk/src/demo/share/jvmti/heapTracker/sample.makefile.txt
@@ -1,5 +1,5 @@
 #
-# Copyright (c) 2004, 2012, Oracle and/or its affiliates. All rights reserved.
+# Copyright (c) 2004, 2016, Oracle and/or its affiliates. All rights reserved.
 #
 # Redistribution and use in source and binary forms, with or without
 # modification, are permitted provided that the following conditions
@@ -49,12 +49,12 @@
 # Name of jar file that needs to be created
 JARFILE=heapTracker.jar
 
-# Solaris Sun C Compiler Version 5.5
+# Solaris Studio C Compiler Version 12.4
 ifeq ($(OSNAME), solaris)
     # Sun Solaris Compiler options needed
     COMMON_FLAGS=-mt -KPIC
     # Options that help find errors
-    COMMON_FLAGS+= -Xa -v -xstrconst -xc99=%none
+    COMMON_FLAGS+= -Xa -v -xc99=%none
     # Check LIBARCH for any special compiler options
     LIBARCH=$(shell uname -p)
     ifeq ($(LIBARCH), sparc)
diff --git a/jdk/src/demo/share/jvmti/heapViewer/sample.makefile.txt b/jdk/src/demo/share/jvmti/heapViewer/sample.makefile.txt
index a18c9d1..59693c2 100644
--- a/jdk/src/demo/share/jvmti/heapViewer/sample.makefile.txt
+++ b/jdk/src/demo/share/jvmti/heapViewer/sample.makefile.txt
@@ -1,5 +1,5 @@
 #
-# Copyright (c) 2004, 2012, Oracle and/or its affiliates. All rights reserved.
+# Copyright (c) 2004, 2016, Oracle and/or its affiliates. All rights reserved.
 #
 # Redistribution and use in source and binary forms, with or without
 # modification, are permitted provided that the following conditions
@@ -45,12 +45,12 @@
 LIBNAME=heapViewer
 SOURCES=heapViewer.c ../agent_util/agent_util.c
 
-# Solaris Sun C Compiler Version 5.5
+# Solaris Studio C Compiler Version 12.4
 ifeq ($(OSNAME), solaris)
     # Sun Solaris Compiler options needed
     COMMON_FLAGS=-mt -KPIC
     # Options that help find errors
-    COMMON_FLAGS+= -Xa -v -xstrconst -xc99=%none
+    COMMON_FLAGS+= -Xa -v -xc99=%none
     # Check LIBARCH for any special compiler options
     LIBARCH=$(shell uname -p)
     ifeq ($(LIBARCH), sparc)
diff --git a/jdk/src/demo/share/jvmti/java_crw_demo/sample.makefile.txt b/jdk/src/demo/share/jvmti/java_crw_demo/sample.makefile.txt
index 35dbbe4..81ce079 100644
--- a/jdk/src/demo/share/jvmti/java_crw_demo/sample.makefile.txt
+++ b/jdk/src/demo/share/jvmti/java_crw_demo/sample.makefile.txt
@@ -1,5 +1,5 @@
 #
-# Copyright (c) 2004, 2012, Oracle and/or its affiliates. All rights reserved.
+# Copyright (c) 2004, 2016, Oracle and/or its affiliates. All rights reserved.
 #
 # Redistribution and use in source and binary forms, with or without
 # modification, are permitted provided that the following conditions
@@ -45,12 +45,12 @@
 LIBNAME=java_crw_demo
 SOURCES=java_crw_demo.c
 
-# Solaris Sun C Compiler Version 5.5
+# Solaris Studio C Compiler Version 12.4
 ifeq ($(OSNAME), solaris)
     # Sun Solaris Compiler options needed
     COMMON_FLAGS=-mt -KPIC
     # Options that help find errors
-    COMMON_FLAGS+= -Xa -v -xstrconst -xc99=%none
+    COMMON_FLAGS+= -Xa -v -xc99=%none
     # Check LIBARCH for any special compiler options
     LIBARCH=$(shell uname -p)
     ifeq ($(LIBARCH), sparc)
diff --git a/jdk/src/demo/share/jvmti/minst/sample.makefile.txt b/jdk/src/demo/share/jvmti/minst/sample.makefile.txt
index 94bb4c5..5c8f422 100644
--- a/jdk/src/demo/share/jvmti/minst/sample.makefile.txt
+++ b/jdk/src/demo/share/jvmti/minst/sample.makefile.txt
@@ -1,5 +1,5 @@
 #
-# Copyright (c) 2006, 2012, Oracle and/or its affiliates. All rights reserved.
+# Copyright (c) 2006, 2016, Oracle and/or its affiliates. All rights reserved.
 #
 # Redistribution and use in source and binary forms, with or without
 # modification, are permitted provided that the following conditions
@@ -49,12 +49,12 @@
 # Name of jar file that needs to be created
 JARFILE=minst.jar
 
-# Solaris Sun C Compiler Version 5.5
+# Solaris Studio C Compiler Version 12.4
 ifeq ($(OSNAME), solaris)
     # Sun Solaris Compiler options needed
     COMMON_FLAGS=-mt -KPIC
     # Options that help find errors
-    COMMON_FLAGS+= -Xa -v -xstrconst -xc99=%none
+    COMMON_FLAGS+= -Xa -v -xc99=%none
     # Check LIBARCH for any special compiler options
     LIBARCH=$(shell uname -p)
     ifeq ($(LIBARCH), sparc)
diff --git a/jdk/src/demo/share/jvmti/mtrace/sample.makefile.txt b/jdk/src/demo/share/jvmti/mtrace/sample.makefile.txt
index 46ceb7e..b342e78 100644
--- a/jdk/src/demo/share/jvmti/mtrace/sample.makefile.txt
+++ b/jdk/src/demo/share/jvmti/mtrace/sample.makefile.txt
@@ -1,5 +1,5 @@
 #
-# Copyright (c) 2004, 2012, Oracle and/or its affiliates. All rights reserved.
+# Copyright (c) 2004, 2016, Oracle and/or its affiliates. All rights reserved.
 #
 # Redistribution and use in source and binary forms, with or without
 # modification, are permitted provided that the following conditions
@@ -49,12 +49,12 @@
 # Name of jar file that needs to be created
 JARFILE=mtrace.jar
 
-# Solaris Sun C Compiler Version 5.5
+# Solaris Studio C Compiler Version 12.4
 ifeq ($(OSNAME), solaris)
     # Sun Solaris Compiler options needed
     COMMON_FLAGS=-mt -KPIC
     # Options that help find errors
-    COMMON_FLAGS+= -Xa -v -xstrconst -xc99=%none
+    COMMON_FLAGS+= -Xa -v -xc99=%none
     # Check LIBARCH for any special compiler options
     LIBARCH=$(shell uname -p)
     ifeq ($(LIBARCH), sparc)
diff --git a/jdk/src/demo/share/jvmti/versionCheck/sample.makefile.txt b/jdk/src/demo/share/jvmti/versionCheck/sample.makefile.txt
index 7a586ed..0124033 100644
--- a/jdk/src/demo/share/jvmti/versionCheck/sample.makefile.txt
+++ b/jdk/src/demo/share/jvmti/versionCheck/sample.makefile.txt
@@ -1,5 +1,5 @@
 #
-# Copyright (c) 2004, 2012, Oracle and/or its affiliates. All rights reserved.
+# Copyright (c) 2004, 2016, Oracle and/or its affiliates. All rights reserved.
 #
 # Redistribution and use in source and binary forms, with or without
 # modification, are permitted provided that the following conditions
@@ -45,12 +45,12 @@
 LIBNAME=versionCheck
 SOURCES=versionCheck.c ../agent_util/agent_util.c
 
-# Solaris Sun C Compiler Version 5.5
+# Solaris Studio C Compiler Version 12.4
 ifeq ($(OSNAME), solaris)
     # Sun Solaris Compiler options needed
     COMMON_FLAGS=-mt -KPIC
     # Options that help find errors
-    COMMON_FLAGS+= -Xa -v -xstrconst -xc99=%none
+    COMMON_FLAGS+= -Xa -v -xc99=%none
     # Check LIBARCH for any special compiler options
     LIBARCH=$(shell uname -p)
     ifeq ($(LIBARCH), sparc)
diff --git a/jdk/src/java.base/linux/native/libjava/ProcessHandleImpl_linux.c b/jdk/src/java.base/linux/native/libjava/ProcessHandleImpl_linux.c
index cae982e..7792569 100644
--- a/jdk/src/java.base/linux/native/libjava/ProcessHandleImpl_linux.c
+++ b/jdk/src/java.base/linux/native/libjava/ProcessHandleImpl_linux.c
@@ -146,6 +146,7 @@
     snprintf(fn, sizeof fn, "/proc/%d", pid);
     if (stat(fn, &stat_buf) == 0) {
         unix_getUserInfo(env, jinfo, stat_buf.st_uid);
+        JNU_CHECK_EXCEPTION(env);
     }
 
     /*
diff --git a/jdk/src/java.base/share/classes/java/lang/Class.java b/jdk/src/java.base/share/classes/java/lang/Class.java
index 7ac3d50..25d4a3b 100644
--- a/jdk/src/java.base/share/classes/java/lang/Class.java
+++ b/jdk/src/java.base/share/classes/java/lang/Class.java
@@ -70,6 +70,7 @@
 import jdk.internal.reflect.ConstantPool;
 import jdk.internal.reflect.Reflection;
 import jdk.internal.reflect.ReflectionFactory;
+import jdk.internal.vm.annotation.ForceInline;
 import sun.reflect.generics.factory.CoreReflectionFactory;
 import sun.reflect.generics.factory.GenericsFactory;
 import sun.reflect.generics.repository.ClassRepository;
@@ -802,6 +803,7 @@
      * @see java.lang.RuntimePermission
      */
     @CallerSensitive
+    @ForceInline // to ensure Reflection.getCallerClass optimization
     public ClassLoader getClassLoader() {
         ClassLoader cl = getClassLoader0();
         if (cl == null)
diff --git a/jdk/src/java.base/share/classes/java/lang/VersionProps.java.template b/jdk/src/java.base/share/classes/java/lang/VersionProps.java.template
index a51702f..d3c86a2 100644
--- a/jdk/src/java.base/share/classes/java/lang/VersionProps.java.template
+++ b/jdk/src/java.base/share/classes/java/lang/VersionProps.java.template
@@ -166,10 +166,6 @@
 
         ps.print(java_runtime_name + " (" + jdk_debug_level + "build " + java_runtime_version);
 
-        if (java_runtime_name.indexOf("Embedded") != -1 && isHeadless) {
-            // embedded builds report headless state
-            ps.print(", headless");
-        }
         ps.println(')');
 
         /* Third line: JVM information. */
diff --git a/jdk/src/java.base/share/classes/java/lang/invoke/DirectMethodHandle.java b/jdk/src/java.base/share/classes/java/lang/invoke/DirectMethodHandle.java
index fe77e01..c980fb8 100644
--- a/jdk/src/java.base/share/classes/java/lang/invoke/DirectMethodHandle.java
+++ b/jdk/src/java.base/share/classes/java/lang/invoke/DirectMethodHandle.java
@@ -27,6 +27,7 @@
 
 import jdk.internal.misc.Unsafe;
 import jdk.internal.vm.annotation.ForceInline;
+import jdk.internal.vm.annotation.Stable;
 import sun.invoke.util.ValueConversions;
 import sun.invoke.util.VerifyAccess;
 import sun.invoke.util.VerifyType;
@@ -198,6 +199,7 @@
         case LF_NEWINVSPECIAL: linkerName = "linkToSpecial";    lambdaName = "DMH.newInvokeSpecial"; break;
         default:  throw new InternalError("which="+which);
         }
+
         MethodType mtypeWithArg = mtype.appendParameterTypes(MemberName.class);
         if (doesAlloc)
             mtypeWithArg = mtypeWithArg
@@ -240,11 +242,26 @@
         names[LINKER_CALL] = new Name(linker, outArgs);
         lambdaName += "_" + shortenSignature(basicTypeSignature(mtype));
         LambdaForm lform = new LambdaForm(lambdaName, ARG_LIMIT, names, result);
+
         // This is a tricky bit of code.  Don't send it through the LF interpreter.
-        lform.compileToBytecode();
+        lform.compileToBytecode(Holder.class);
         return lform;
     }
 
+    /*
+     * NOTE: This method acts as an API hook for use by the
+     * GenerateJLIClassesPlugin to generate a class wrapping DirectMethodHandle
+     * methods for an array of method types.
+     */
+    static byte[] generateDMHClassBytes(String className, MethodType[] methodTypes, int[] types) {
+        LambdaForm[] forms = new LambdaForm[methodTypes.length];
+        for (int i = 0; i < forms.length; i++) {
+            forms[i] = makePreparedLambdaForm(methodTypes[i], types[i]);
+            methodTypes[i] = forms[i].methodType();
+        }
+        return InvokerBytecodeGenerator.generateCodeBytesForMultiple(className, forms, methodTypes);
+    }
+
     static Object findDirectMethodHandle(Name name) {
         if (name.function == NF_internalMemberName ||
             name.function == NF_internalMemberNameEnsureInit ||
@@ -487,7 +504,7 @@
     }
 
     // Caching machinery for field accessors:
-    private static byte
+    private static final byte
             AF_GETFIELD        = 0,
             AF_PUTFIELD        = 1,
             AF_GETSTATIC       = 2,
@@ -497,7 +514,7 @@
             AF_LIMIT           = 6;
     // Enumerate the different field kinds using Wrapper,
     // with an extra case added for checked references.
-    private static int
+    private static final int
             FT_LAST_WRAPPER    = Wrapper.values().length-1,
             FT_UNCHECKED_REF   = Wrapper.OBJECT.ordinal(),
             FT_CHECKED_REF     = FT_LAST_WRAPPER+1,
@@ -507,6 +524,7 @@
                 + (isVolatile ? FT_LIMIT : 0)
                 + ftypeKind);
     }
+    @Stable
     private static final LambdaForm[] ACCESSOR_FORMS
             = new LambdaForm[afIndex(AF_LIMIT, false, 0)];
     private static int ftypeKind(Class<?> ftype) {
@@ -549,10 +567,11 @@
         return lform;
     }
     private static LambdaForm preparedFieldLambdaForm(byte formOp, boolean isVolatile, Class<?> ftype) {
-        int afIndex = afIndex(formOp, isVolatile, ftypeKind(ftype));
+        int ftypeKind = ftypeKind(ftype);
+        int afIndex = afIndex(formOp, isVolatile, ftypeKind);
         LambdaForm lform = ACCESSOR_FORMS[afIndex];
         if (lform != null)  return lform;
-        lform = makePreparedFieldLambdaForm(formOp, isVolatile, ftypeKind(ftype));
+        lform = makePreparedFieldLambdaForm(formOp, isVolatile, ftypeKind);
         ACCESSOR_FORMS[afIndex] = lform;  // don't bother with a CAS
         return lform;
     }
@@ -682,4 +701,15 @@
             throw newInternalError(ex);
         }
     }
+
+    static {
+        // The DMH class will contain pre-generated DirectMethodHandles resolved
+        // speculatively using MemberName.getFactory().resolveOrNull. However, that
+        // doesn't initialize the class, which subtly breaks inlining etc. By forcing
+        // initialization of the Holder class we avoid these issues.
+        UNSAFE.ensureClassInitialized(Holder.class);
+    }
+
+    /* Placeholder class for DirectMethodHandles generated ahead of time */
+    private final class Holder {}
 }
diff --git a/jdk/src/java.base/share/classes/java/lang/invoke/InvokerBytecodeGenerator.java b/jdk/src/java.base/share/classes/java/lang/invoke/InvokerBytecodeGenerator.java
index d42bad6..507bcdb 100644
--- a/jdk/src/java.base/share/classes/java/lang/invoke/InvokerBytecodeGenerator.java
+++ b/jdk/src/java.base/share/classes/java/lang/invoke/InvokerBytecodeGenerator.java
@@ -70,7 +70,7 @@
     private static final String LLV_SIG = "(L" + OBJ + ";L" + OBJ + ";)V";
 
     /** Name of its super class*/
-    private static final String superName = OBJ;
+    private static final String INVOKER_SUPER_NAME = OBJ;
 
     /** Name of new class */
     private final String className;
@@ -296,12 +296,15 @@
     /**
      * Set up class file generation.
      */
-    private void classFilePrologue() {
+    private ClassWriter classFilePrologue() {
         final int NOT_ACC_PUBLIC = 0;  // not ACC_PUBLIC
         cw = new ClassWriter(ClassWriter.COMPUTE_MAXS + ClassWriter.COMPUTE_FRAMES);
-        cw.visit(Opcodes.V1_8, NOT_ACC_PUBLIC + Opcodes.ACC_FINAL + Opcodes.ACC_SUPER, className, null, superName, null);
+        cw.visit(Opcodes.V1_8, NOT_ACC_PUBLIC + Opcodes.ACC_FINAL + Opcodes.ACC_SUPER, className, null, INVOKER_SUPER_NAME, null);
         cw.visitSource(sourceFile, null);
+        return cw;
+    }
 
+    private void methodPrologue() {
         String invokerDesc = invokerType.toMethodDescriptorString();
         mv = cw.visitMethod(Opcodes.ACC_STATIC, invokerName, invokerDesc, null, null);
     }
@@ -309,7 +312,7 @@
     /**
      * Tear down class file generation.
      */
-    private void classFileEpilogue() {
+    private void methodEpilogue() {
         mv.visitMaxs(0, 0);
         mv.visitEnd();
     }
@@ -644,6 +647,44 @@
      */
     private byte[] generateCustomizedCodeBytes() {
         classFilePrologue();
+        addMethod();
+        bogusMethod(lambdaForm);
+
+        final byte[] classFile = toByteArray();
+        maybeDump(className, classFile);
+        return classFile;
+    }
+
+    /*
+     * NOTE: This is used from GenerateJLIClassesPlugin via
+     * DirectMethodHandle::generateDMHClassBytes.
+     *
+     * Generate customized code for a set of LambdaForms of specified types into
+     * a class with a specified name.
+     */
+    static byte[] generateCodeBytesForMultiple(String className,
+            LambdaForm[] forms, MethodType[] types) {
+        assert(forms.length == types.length);
+
+        ClassWriter cw = new ClassWriter(ClassWriter.COMPUTE_MAXS + ClassWriter.COMPUTE_FRAMES);
+        cw.visit(Opcodes.V1_8, Opcodes.ACC_PRIVATE + Opcodes.ACC_FINAL + Opcodes.ACC_SUPER,
+                className, null, INVOKER_SUPER_NAME, null);
+        cw.visitSource(className.substring(className.lastIndexOf('/') + 1), null);
+        for (int i = 0; i < forms.length; i++) {
+            InvokerBytecodeGenerator g
+                    = new InvokerBytecodeGenerator(className, forms[i], types[i]);
+            g.setClassWriter(cw);
+            g.addMethod();
+        }
+        return cw.toByteArray();
+    }
+
+    private void setClassWriter(ClassWriter cw) {
+        this.cw = cw;
+    }
+
+    private void addMethod() {
+        methodPrologue();
 
         // Suppress this method in backtraces displayed to the user.
         mv.visitAnnotation(LF_HIDDEN_SIG, true);
@@ -748,19 +789,19 @@
         // return statement
         emitReturn(onStack);
 
-        classFileEpilogue();
-        bogusMethod(lambdaForm);
+        methodEpilogue();
+    }
 
-        final byte[] classFile;
+    /*
+     * @throws BytecodeGenerationException if something goes wrong when
+     *         generating the byte code
+     */
+    private byte[] toByteArray() {
         try {
-            classFile = cw.toByteArray();
+            return cw.toByteArray();
         } catch (RuntimeException e) {
-            // ASM throws RuntimeException if something goes wrong - capture these and wrap them in a meaningful
-            // exception to support falling back to LambdaForm interpretation
             throw new BytecodeGenerationException(e);
         }
-        maybeDump(className, classFile);
-        return classFile;
     }
 
     @SuppressWarnings("serial")
@@ -1607,6 +1648,7 @@
 
     private byte[] generateLambdaFormInterpreterEntryPointBytes() {
         classFilePrologue();
+        methodPrologue();
 
         // Suppress this method in backtraces displayed to the user.
         mv.visitAnnotation(LF_HIDDEN_SIG, true);
@@ -1645,7 +1687,7 @@
         // return statement
         emitReturnInsn(basicType(rtype));
 
-        classFileEpilogue();
+        methodEpilogue();
         bogusMethod(invokerType);
 
         final byte[] classFile = cw.toByteArray();
@@ -1666,6 +1708,7 @@
     private byte[] generateNamedFunctionInvokerImpl(MethodTypeForm typeForm) {
         MethodType dstType = typeForm.erasedType();
         classFilePrologue();
+        methodPrologue();
 
         // Suppress this method in backtraces displayed to the user.
         mv.visitAnnotation(LF_HIDDEN_SIG, true);
@@ -1685,7 +1728,6 @@
             // Maybe unbox
             Class<?> dptype = dstType.parameterType(i);
             if (dptype.isPrimitive()) {
-                Class<?> sptype = dstType.basicType().wrap().parameterType(i);
                 Wrapper dstWrapper = Wrapper.forBasicType(dptype);
                 Wrapper srcWrapper = dstWrapper.isSubwordOrInt() ? Wrapper.INT : dstWrapper;  // narrow subword from int
                 emitUnboxing(srcWrapper);
@@ -1713,7 +1755,7 @@
         }
         emitReturnInsn(L_TYPE);  // NOTE: NamedFunction invokers always return a reference value.
 
-        classFileEpilogue();
+        methodEpilogue();
         bogusMethod(dstType);
 
         final byte[] classFile = cw.toByteArray();
diff --git a/jdk/src/java.base/share/classes/java/lang/invoke/LambdaForm.java b/jdk/src/java.base/share/classes/java/lang/invoke/LambdaForm.java
index 2a722db..535c0fb 100644
--- a/jdk/src/java.base/share/classes/java/lang/invoke/LambdaForm.java
+++ b/jdk/src/java.base/share/classes/java/lang/invoke/LambdaForm.java
@@ -773,6 +773,28 @@
         }
     }
 
+    /**
+     * Generate optimizable bytecode for this form after first looking for a
+     * pregenerated version in a specified class.
+     */
+    void compileToBytecode(Class<?> lookupClass) {
+        if (vmentry != null && isCompiled) {
+            return;  // already compiled somehow
+        }
+        MethodType invokerType = methodType();
+        assert(vmentry == null || vmentry.getMethodType().basicType().equals(invokerType));
+        int dot = debugName.indexOf('.');
+        String methodName = (dot > 0) ? debugName.substring(dot + 1) : debugName;
+        MemberName member = new MemberName(lookupClass, methodName, invokerType, REF_invokeStatic);
+        MemberName resolvedMember = MemberName.getFactory().resolveOrNull(REF_invokeStatic, member, lookupClass);
+        if (resolvedMember != null) {
+            vmentry = resolvedMember;
+            isCompiled = true;
+        } else {
+            compileToBytecode();
+        }
+    }
+
     private static void computeInitialPreparedForms() {
         // Find all predefined invokers and associate them with canonical empty lambda forms.
         for (MemberName m : MemberName.getFactory().getMethods(LambdaForm.class, false, null, null, null)) {
diff --git a/jdk/src/java.base/share/classes/java/lang/invoke/MethodHandleImpl.java b/jdk/src/java.base/share/classes/java/lang/invoke/MethodHandleImpl.java
index adaca60..6702a89 100644
--- a/jdk/src/java.base/share/classes/java/lang/invoke/MethodHandleImpl.java
+++ b/jdk/src/java.base/share/classes/java/lang/invoke/MethodHandleImpl.java
@@ -30,6 +30,7 @@
 import jdk.internal.org.objectweb.asm.MethodVisitor;
 import jdk.internal.reflect.CallerSensitive;
 import jdk.internal.reflect.Reflection;
+import jdk.internal.vm.annotation.ForceInline;
 import jdk.internal.vm.annotation.Stable;
 import sun.invoke.empty.Empty;
 import sun.invoke.util.ValueConversions;
@@ -44,7 +45,6 @@
 import java.util.Iterator;
 import java.util.List;
 import java.util.function.Function;
-import java.util.stream.Collectors;
 import java.util.stream.Stream;
 
 import static java.lang.invoke.LambdaForm.*;
@@ -1246,6 +1246,7 @@
         }
 
         @CallerSensitive
+        @ForceInline // to ensure Reflection.getCallerClass optimization
         private static boolean checkCallerClass(Class<?> expected) {
             // This method is called via MH_checkCallerClass and so it's correct to ask for the immediate caller here.
             Class<?> actual = Reflection.getCallerClass();
diff --git a/jdk/src/java.base/share/classes/java/lang/invoke/MethodHandles.java b/jdk/src/java.base/share/classes/java/lang/invoke/MethodHandles.java
index 14f7d32..60077a8 100644
--- a/jdk/src/java.base/share/classes/java/lang/invoke/MethodHandles.java
+++ b/jdk/src/java.base/share/classes/java/lang/invoke/MethodHandles.java
@@ -29,6 +29,7 @@
 import jdk.internal.org.objectweb.asm.Opcodes;
 import jdk.internal.reflect.CallerSensitive;
 import jdk.internal.reflect.Reflection;
+import jdk.internal.vm.annotation.ForceInline;
 import sun.invoke.util.ValueConversions;
 import sun.invoke.util.VerifyAccess;
 import sun.invoke.util.Wrapper;
@@ -104,6 +105,7 @@
      * @return a lookup object for the caller of this method, with private access
      */
     @CallerSensitive
+    @ForceInline // to ensure Reflection.getCallerClass optimization
     public static Lookup lookup() {
         return new Lookup(Reflection.getCallerClass());
     }
diff --git a/jdk/src/java.base/share/classes/java/lang/reflect/Constructor.java b/jdk/src/java.base/share/classes/java/lang/reflect/Constructor.java
index af5fd1d..c8d93cf 100644
--- a/jdk/src/java.base/share/classes/java/lang/reflect/Constructor.java
+++ b/jdk/src/java.base/share/classes/java/lang/reflect/Constructor.java
@@ -29,6 +29,7 @@
 import jdk.internal.reflect.CallerSensitive;
 import jdk.internal.reflect.ConstructorAccessor;
 import jdk.internal.reflect.Reflection;
+import jdk.internal.vm.annotation.ForceInline;
 import sun.reflect.annotation.TypeAnnotation;
 import sun.reflect.annotation.TypeAnnotationParser;
 import sun.reflect.generics.repository.ConstructorRepository;
@@ -435,6 +436,7 @@
      *              by this method fails.
      */
     @CallerSensitive
+    @ForceInline // to ensure Reflection.getCallerClass optimization
     public T newInstance(Object ... initargs)
         throws InstantiationException, IllegalAccessException,
                IllegalArgumentException, InvocationTargetException
diff --git a/jdk/src/java.base/share/classes/java/lang/reflect/Field.java b/jdk/src/java.base/share/classes/java/lang/reflect/Field.java
index 7474f59..853d1cf 100644
--- a/jdk/src/java.base/share/classes/java/lang/reflect/Field.java
+++ b/jdk/src/java.base/share/classes/java/lang/reflect/Field.java
@@ -29,6 +29,7 @@
 import jdk.internal.reflect.CallerSensitive;
 import jdk.internal.reflect.FieldAccessor;
 import jdk.internal.reflect.Reflection;
+import jdk.internal.vm.annotation.ForceInline;
 import sun.reflect.generics.repository.FieldRepository;
 import sun.reflect.generics.factory.CoreReflectionFactory;
 import sun.reflect.generics.factory.GenericsFactory;
@@ -396,6 +397,7 @@
      *              by this method fails.
      */
     @CallerSensitive
+    @ForceInline // to ensure Reflection.getCallerClass optimization
     public Object get(Object obj)
         throws IllegalArgumentException, IllegalAccessException
     {
@@ -429,6 +431,7 @@
      * @see       Field#get
      */
     @CallerSensitive
+    @ForceInline // to ensure Reflection.getCallerClass optimization
     public boolean getBoolean(Object obj)
         throws IllegalArgumentException, IllegalAccessException
     {
@@ -462,6 +465,7 @@
      * @see       Field#get
      */
     @CallerSensitive
+    @ForceInline // to ensure Reflection.getCallerClass optimization
     public byte getByte(Object obj)
         throws IllegalArgumentException, IllegalAccessException
     {
@@ -497,6 +501,7 @@
      * @see Field#get
      */
     @CallerSensitive
+    @ForceInline // to ensure Reflection.getCallerClass optimization
     public char getChar(Object obj)
         throws IllegalArgumentException, IllegalAccessException
     {
@@ -532,6 +537,7 @@
      * @see       Field#get
      */
     @CallerSensitive
+    @ForceInline // to ensure Reflection.getCallerClass optimization
     public short getShort(Object obj)
         throws IllegalArgumentException, IllegalAccessException
     {
@@ -567,6 +573,7 @@
      * @see       Field#get
      */
     @CallerSensitive
+    @ForceInline // to ensure Reflection.getCallerClass optimization
     public int getInt(Object obj)
         throws IllegalArgumentException, IllegalAccessException
     {
@@ -602,6 +609,7 @@
      * @see       Field#get
      */
     @CallerSensitive
+    @ForceInline // to ensure Reflection.getCallerClass optimization
     public long getLong(Object obj)
         throws IllegalArgumentException, IllegalAccessException
     {
@@ -637,6 +645,7 @@
      * @see Field#get
      */
     @CallerSensitive
+    @ForceInline // to ensure Reflection.getCallerClass optimization
     public float getFloat(Object obj)
         throws IllegalArgumentException, IllegalAccessException
     {
@@ -672,6 +681,7 @@
      * @see       Field#get
      */
     @CallerSensitive
+    @ForceInline // to ensure Reflection.getCallerClass optimization
     public double getDouble(Object obj)
         throws IllegalArgumentException, IllegalAccessException
     {
@@ -749,6 +759,7 @@
      *              by this method fails.
      */
     @CallerSensitive
+    @ForceInline // to ensure Reflection.getCallerClass optimization
     public void set(Object obj, Object value)
         throws IllegalArgumentException, IllegalAccessException
     {
@@ -784,6 +795,7 @@
      * @see       Field#set
      */
     @CallerSensitive
+    @ForceInline // to ensure Reflection.getCallerClass optimization
     public void setBoolean(Object obj, boolean z)
         throws IllegalArgumentException, IllegalAccessException
     {
@@ -819,6 +831,7 @@
      * @see       Field#set
      */
     @CallerSensitive
+    @ForceInline // to ensure Reflection.getCallerClass optimization
     public void setByte(Object obj, byte b)
         throws IllegalArgumentException, IllegalAccessException
     {
@@ -854,6 +867,7 @@
      * @see       Field#set
      */
     @CallerSensitive
+    @ForceInline // to ensure Reflection.getCallerClass optimization
     public void setChar(Object obj, char c)
         throws IllegalArgumentException, IllegalAccessException
     {
@@ -889,6 +903,7 @@
      * @see       Field#set
      */
     @CallerSensitive
+    @ForceInline // to ensure Reflection.getCallerClass optimization
     public void setShort(Object obj, short s)
         throws IllegalArgumentException, IllegalAccessException
     {
@@ -924,6 +939,7 @@
      * @see       Field#set
      */
     @CallerSensitive
+    @ForceInline // to ensure Reflection.getCallerClass optimization
     public void setInt(Object obj, int i)
         throws IllegalArgumentException, IllegalAccessException
     {
@@ -959,6 +975,7 @@
      * @see       Field#set
      */
     @CallerSensitive
+    @ForceInline // to ensure Reflection.getCallerClass optimization
     public void setLong(Object obj, long l)
         throws IllegalArgumentException, IllegalAccessException
     {
@@ -994,6 +1011,7 @@
      * @see       Field#set
      */
     @CallerSensitive
+    @ForceInline // to ensure Reflection.getCallerClass optimization
     public void setFloat(Object obj, float f)
         throws IllegalArgumentException, IllegalAccessException
     {
@@ -1029,6 +1047,7 @@
      * @see       Field#set
      */
     @CallerSensitive
+    @ForceInline // to ensure Reflection.getCallerClass optimization
     public void setDouble(Object obj, double d)
         throws IllegalArgumentException, IllegalAccessException
     {
diff --git a/jdk/src/java.base/share/classes/java/lang/reflect/Method.java b/jdk/src/java.base/share/classes/java/lang/reflect/Method.java
index 0476c52..54d373f 100644
--- a/jdk/src/java.base/share/classes/java/lang/reflect/Method.java
+++ b/jdk/src/java.base/share/classes/java/lang/reflect/Method.java
@@ -30,6 +30,7 @@
 import jdk.internal.reflect.CallerSensitive;
 import jdk.internal.reflect.MethodAccessor;
 import jdk.internal.reflect.Reflection;
+import jdk.internal.vm.annotation.ForceInline;
 import sun.reflect.annotation.ExceptionProxy;
 import sun.reflect.annotation.TypeNotPresentExceptionProxy;
 import sun.reflect.generics.repository.MethodRepository;
@@ -517,6 +518,7 @@
      * provoked by this method fails.
      */
     @CallerSensitive
+    @ForceInline // to ensure Reflection.getCallerClass optimization
     @HotSpotIntrinsicCandidate
     public Object invoke(Object obj, Object... args)
         throws IllegalAccessException, IllegalArgumentException,
diff --git a/jdk/src/java.base/share/classes/java/net/Inet4Address.java b/jdk/src/java.base/share/classes/java/net/Inet4Address.java
index 1a2f7b6..a79a178 100644
--- a/jdk/src/java.base/share/classes/java/net/Inet4Address.java
+++ b/jdk/src/java.base/share/classes/java/net/Inet4Address.java
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2000, 2013, 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
@@ -164,7 +164,7 @@
     }
 
     /**
-     * Utility routine to check if the InetAddress in a wildcard address.
+     * Utility routine to check if the InetAddress is a wildcard address.
      * @return a {@code boolean} indicating if the Inetaddress is
      *         a wildcard address.
      * @since 1.4
diff --git a/jdk/src/java.base/share/classes/java/net/Inet6Address.java b/jdk/src/java.base/share/classes/java/net/Inet6Address.java
index 0daac2f..8584db6 100644
--- a/jdk/src/java.base/share/classes/java/net/Inet6Address.java
+++ b/jdk/src/java.base/share/classes/java/net/Inet6Address.java
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2000, 2014, 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
@@ -691,7 +691,7 @@
     }
 
     /**
-     * Utility routine to check if the InetAddress in a wildcard address.
+     * Utility routine to check if the InetAddress is a wildcard address.
      *
      * @return a {@code boolean} indicating if the Inetaddress is
      *         a wildcard address.
diff --git a/jdk/src/java.base/share/classes/java/net/InetAddress.java b/jdk/src/java.base/share/classes/java/net/InetAddress.java
index 33e70ea..4a59099 100644
--- a/jdk/src/java.base/share/classes/java/net/InetAddress.java
+++ b/jdk/src/java.base/share/classes/java/net/InetAddress.java
@@ -361,7 +361,7 @@
     }
 
     /**
-     * Utility routine to check if the InetAddress in a wildcard address.
+     * Utility routine to check if the InetAddress is a wildcard address.
      * @return a {@code boolean} indicating if the Inetaddress is
      *         a wildcard address.
      * @since 1.4
diff --git a/jdk/src/java.base/share/classes/java/net/Socket.java b/jdk/src/java.base/share/classes/java/net/Socket.java
index 47971df..b875ce7 100644
--- a/jdk/src/java.base/share/classes/java/net/Socket.java
+++ b/jdk/src/java.base/share/classes/java/net/Socket.java
@@ -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
@@ -907,7 +907,6 @@
             throw new SocketException("Socket is not connected");
         if (isInputShutdown())
             throw new SocketException("Socket input is shutdown");
-        final Socket s = this;
         InputStream is = null;
         try {
             is = AccessController.doPrivileged(
@@ -947,7 +946,6 @@
             throw new SocketException("Socket is not connected");
         if (isOutputShutdown())
             throw new SocketException("Socket output is shutdown");
-        final Socket s = this;
         OutputStream os = null;
         try {
             os = AccessController.doPrivileged(
diff --git a/jdk/src/java.base/share/classes/java/net/URLConnection.java b/jdk/src/java.base/share/classes/java/net/URLConnection.java
index 4ad051c..7a125fa 100644
--- a/jdk/src/java.base/share/classes/java/net/URLConnection.java
+++ b/jdk/src/java.base/share/classes/java/net/URLConnection.java
@@ -291,12 +291,7 @@
    /**
     * @since   1.1
     */
-    private static FileNameMap fileNameMap;
-
-    /**
-     * @since 1.2.2
-     */
-    private static boolean fileNameMapLoaded = false;
+    private static volatile FileNameMap fileNameMap;
 
     /**
      * Loads filename map (a mimetable) from a data file. It will
@@ -308,18 +303,21 @@
      * @since 1.2
      * @see #setFileNameMap(java.net.FileNameMap)
      */
-    public static synchronized FileNameMap getFileNameMap() {
-        if ((fileNameMap == null) && !fileNameMapLoaded) {
-            fileNameMap = sun.net.www.MimeTable.loadTable();
-            fileNameMapLoaded = true;
+    public static FileNameMap getFileNameMap() {
+        FileNameMap map = fileNameMap;
+
+        if (map == null) {
+            fileNameMap = map = new FileNameMap() {
+                private FileNameMap internalMap =
+                    sun.net.www.MimeTable.loadTable();
+
+                public String getContentTypeFor(String fileName) {
+                    return internalMap.getContentTypeFor(fileName);
+                }
+            };
         }
 
-        return new FileNameMap() {
-            private FileNameMap map = fileNameMap;
-            public String getContentTypeFor(String fileName) {
-                return map.getContentTypeFor(fileName);
-            }
-        };
+        return map;
     }
 
     /**
diff --git a/jdk/src/java.base/share/classes/java/nio/Bits.java b/jdk/src/java.base/share/classes/java/nio/Bits.java
index d8b3024..8a7dcf7 100644
--- a/jdk/src/java.base/share/classes/java/nio/Bits.java
+++ b/jdk/src/java.base/share/classes/java/nio/Bits.java
@@ -25,14 +25,14 @@
 
 package java.nio;
 
-import java.util.concurrent.atomic.AtomicLong;
-
-import jdk.internal.misc.JavaNioAccess;
 import jdk.internal.misc.JavaLangRefAccess;
+import jdk.internal.misc.JavaNioAccess;
 import jdk.internal.misc.SharedSecrets;
 import jdk.internal.misc.Unsafe;
 import jdk.internal.misc.VM;
 
+import java.util.concurrent.atomic.AtomicLong;
+
 /**
  * Access to bits, native and otherwise.
  */
@@ -61,504 +61,10 @@
     }
 
 
-    // -- get/put char --
-
-    private static char makeChar(byte b1, byte b0) {
-        return (char)((b1 << 8) | (b0 & 0xff));
-    }
-
-    static char getCharL(ByteBuffer bb, int bi) {
-        return makeChar(bb._get(bi + 1),
-                        bb._get(bi    ));
-    }
-
-    static char getCharL(long a) {
-        return makeChar(_get(a + 1),
-                        _get(a    ));
-    }
-
-    static char getCharB(ByteBuffer bb, int bi) {
-        return makeChar(bb._get(bi    ),
-                        bb._get(bi + 1));
-    }
-
-    static char getCharB(long a) {
-        return makeChar(_get(a    ),
-                        _get(a + 1));
-    }
-
-    static char getChar(ByteBuffer bb, int bi, boolean bigEndian) {
-        return bigEndian ? getCharB(bb, bi) : getCharL(bb, bi);
-    }
-
-    static char getChar(long a, boolean bigEndian) {
-        return bigEndian ? getCharB(a) : getCharL(a);
-    }
-
-    private static byte char1(char x) { return (byte)(x >> 8); }
-    private static byte char0(char x) { return (byte)(x     ); }
-
-    static void putCharL(ByteBuffer bb, int bi, char x) {
-        bb._put(bi    , char0(x));
-        bb._put(bi + 1, char1(x));
-    }
-
-    static void putCharL(long a, char x) {
-        _put(a    , char0(x));
-        _put(a + 1, char1(x));
-    }
-
-    static void putCharB(ByteBuffer bb, int bi, char x) {
-        bb._put(bi    , char1(x));
-        bb._put(bi + 1, char0(x));
-    }
-
-    static void putCharB(long a, char x) {
-        _put(a    , char1(x));
-        _put(a + 1, char0(x));
-    }
-
-    static void putChar(ByteBuffer bb, int bi, char x, boolean bigEndian) {
-        if (bigEndian)
-            putCharB(bb, bi, x);
-        else
-            putCharL(bb, bi, x);
-    }
-
-    static void putChar(long a, char x, boolean bigEndian) {
-        if (bigEndian)
-            putCharB(a, x);
-        else
-            putCharL(a, x);
-    }
-
-
-    // -- get/put short --
-
-    private static short makeShort(byte b1, byte b0) {
-        return (short)((b1 << 8) | (b0 & 0xff));
-    }
-
-    static short getShortL(ByteBuffer bb, int bi) {
-        return makeShort(bb._get(bi + 1),
-                         bb._get(bi    ));
-    }
-
-    static short getShortL(long a) {
-        return makeShort(_get(a + 1),
-                         _get(a    ));
-    }
-
-    static short getShortB(ByteBuffer bb, int bi) {
-        return makeShort(bb._get(bi    ),
-                         bb._get(bi + 1));
-    }
-
-    static short getShortB(long a) {
-        return makeShort(_get(a    ),
-                         _get(a + 1));
-    }
-
-    static short getShort(ByteBuffer bb, int bi, boolean bigEndian) {
-        return bigEndian ? getShortB(bb, bi) : getShortL(bb, bi);
-    }
-
-    static short getShort(long a, boolean bigEndian) {
-        return bigEndian ? getShortB(a) : getShortL(a);
-    }
-
-    private static byte short1(short x) { return (byte)(x >> 8); }
-    private static byte short0(short x) { return (byte)(x     ); }
-
-    static void putShortL(ByteBuffer bb, int bi, short x) {
-        bb._put(bi    , short0(x));
-        bb._put(bi + 1, short1(x));
-    }
-
-    static void putShortL(long a, short x) {
-        _put(a    , short0(x));
-        _put(a + 1, short1(x));
-    }
-
-    static void putShortB(ByteBuffer bb, int bi, short x) {
-        bb._put(bi    , short1(x));
-        bb._put(bi + 1, short0(x));
-    }
-
-    static void putShortB(long a, short x) {
-        _put(a    , short1(x));
-        _put(a + 1, short0(x));
-    }
-
-    static void putShort(ByteBuffer bb, int bi, short x, boolean bigEndian) {
-        if (bigEndian)
-            putShortB(bb, bi, x);
-        else
-            putShortL(bb, bi, x);
-    }
-
-    static void putShort(long a, short x, boolean bigEndian) {
-        if (bigEndian)
-            putShortB(a, x);
-        else
-            putShortL(a, x);
-    }
-
-
-    // -- get/put int --
-
-    private static int makeInt(byte b3, byte b2, byte b1, byte b0) {
-        return (((b3       ) << 24) |
-                ((b2 & 0xff) << 16) |
-                ((b1 & 0xff) <<  8) |
-                ((b0 & 0xff)      ));
-    }
-
-    static int getIntL(ByteBuffer bb, int bi) {
-        return makeInt(bb._get(bi + 3),
-                       bb._get(bi + 2),
-                       bb._get(bi + 1),
-                       bb._get(bi    ));
-    }
-
-    static int getIntL(long a) {
-        return makeInt(_get(a + 3),
-                       _get(a + 2),
-                       _get(a + 1),
-                       _get(a    ));
-    }
-
-    static int getIntB(ByteBuffer bb, int bi) {
-        return makeInt(bb._get(bi    ),
-                       bb._get(bi + 1),
-                       bb._get(bi + 2),
-                       bb._get(bi + 3));
-    }
-
-    static int getIntB(long a) {
-        return makeInt(_get(a    ),
-                       _get(a + 1),
-                       _get(a + 2),
-                       _get(a + 3));
-    }
-
-    static int getInt(ByteBuffer bb, int bi, boolean bigEndian) {
-        return bigEndian ? getIntB(bb, bi) : getIntL(bb, bi) ;
-    }
-
-    static int getInt(long a, boolean bigEndian) {
-        return bigEndian ? getIntB(a) : getIntL(a) ;
-    }
-
-    private static byte int3(int x) { return (byte)(x >> 24); }
-    private static byte int2(int x) { return (byte)(x >> 16); }
-    private static byte int1(int x) { return (byte)(x >>  8); }
-    private static byte int0(int x) { return (byte)(x      ); }
-
-    static void putIntL(ByteBuffer bb, int bi, int x) {
-        bb._put(bi + 3, int3(x));
-        bb._put(bi + 2, int2(x));
-        bb._put(bi + 1, int1(x));
-        bb._put(bi    , int0(x));
-    }
-
-    static void putIntL(long a, int x) {
-        _put(a + 3, int3(x));
-        _put(a + 2, int2(x));
-        _put(a + 1, int1(x));
-        _put(a    , int0(x));
-    }
-
-    static void putIntB(ByteBuffer bb, int bi, int x) {
-        bb._put(bi    , int3(x));
-        bb._put(bi + 1, int2(x));
-        bb._put(bi + 2, int1(x));
-        bb._put(bi + 3, int0(x));
-    }
-
-    static void putIntB(long a, int x) {
-        _put(a    , int3(x));
-        _put(a + 1, int2(x));
-        _put(a + 2, int1(x));
-        _put(a + 3, int0(x));
-    }
-
-    static void putInt(ByteBuffer bb, int bi, int x, boolean bigEndian) {
-        if (bigEndian)
-            putIntB(bb, bi, x);
-        else
-            putIntL(bb, bi, x);
-    }
-
-    static void putInt(long a, int x, boolean bigEndian) {
-        if (bigEndian)
-            putIntB(a, x);
-        else
-            putIntL(a, x);
-    }
-
-
-    // -- get/put long --
-
-    private static long makeLong(byte b7, byte b6, byte b5, byte b4,
-                                 byte b3, byte b2, byte b1, byte b0)
-    {
-        return ((((long)b7       ) << 56) |
-                (((long)b6 & 0xff) << 48) |
-                (((long)b5 & 0xff) << 40) |
-                (((long)b4 & 0xff) << 32) |
-                (((long)b3 & 0xff) << 24) |
-                (((long)b2 & 0xff) << 16) |
-                (((long)b1 & 0xff) <<  8) |
-                (((long)b0 & 0xff)      ));
-    }
-
-    static long getLongL(ByteBuffer bb, int bi) {
-        return makeLong(bb._get(bi + 7),
-                        bb._get(bi + 6),
-                        bb._get(bi + 5),
-                        bb._get(bi + 4),
-                        bb._get(bi + 3),
-                        bb._get(bi + 2),
-                        bb._get(bi + 1),
-                        bb._get(bi    ));
-    }
-
-    static long getLongL(long a) {
-        return makeLong(_get(a + 7),
-                        _get(a + 6),
-                        _get(a + 5),
-                        _get(a + 4),
-                        _get(a + 3),
-                        _get(a + 2),
-                        _get(a + 1),
-                        _get(a    ));
-    }
-
-    static long getLongB(ByteBuffer bb, int bi) {
-        return makeLong(bb._get(bi    ),
-                        bb._get(bi + 1),
-                        bb._get(bi + 2),
-                        bb._get(bi + 3),
-                        bb._get(bi + 4),
-                        bb._get(bi + 5),
-                        bb._get(bi + 6),
-                        bb._get(bi + 7));
-    }
-
-    static long getLongB(long a) {
-        return makeLong(_get(a    ),
-                        _get(a + 1),
-                        _get(a + 2),
-                        _get(a + 3),
-                        _get(a + 4),
-                        _get(a + 5),
-                        _get(a + 6),
-                        _get(a + 7));
-    }
-
-    static long getLong(ByteBuffer bb, int bi, boolean bigEndian) {
-        return bigEndian ? getLongB(bb, bi) : getLongL(bb, bi);
-    }
-
-    static long getLong(long a, boolean bigEndian) {
-        return bigEndian ? getLongB(a) : getLongL(a);
-    }
-
-    private static byte long7(long x) { return (byte)(x >> 56); }
-    private static byte long6(long x) { return (byte)(x >> 48); }
-    private static byte long5(long x) { return (byte)(x >> 40); }
-    private static byte long4(long x) { return (byte)(x >> 32); }
-    private static byte long3(long x) { return (byte)(x >> 24); }
-    private static byte long2(long x) { return (byte)(x >> 16); }
-    private static byte long1(long x) { return (byte)(x >>  8); }
-    private static byte long0(long x) { return (byte)(x      ); }
-
-    static void putLongL(ByteBuffer bb, int bi, long x) {
-        bb._put(bi + 7, long7(x));
-        bb._put(bi + 6, long6(x));
-        bb._put(bi + 5, long5(x));
-        bb._put(bi + 4, long4(x));
-        bb._put(bi + 3, long3(x));
-        bb._put(bi + 2, long2(x));
-        bb._put(bi + 1, long1(x));
-        bb._put(bi    , long0(x));
-    }
-
-    static void putLongL(long a, long x) {
-        _put(a + 7, long7(x));
-        _put(a + 6, long6(x));
-        _put(a + 5, long5(x));
-        _put(a + 4, long4(x));
-        _put(a + 3, long3(x));
-        _put(a + 2, long2(x));
-        _put(a + 1, long1(x));
-        _put(a    , long0(x));
-    }
-
-    static void putLongB(ByteBuffer bb, int bi, long x) {
-        bb._put(bi    , long7(x));
-        bb._put(bi + 1, long6(x));
-        bb._put(bi + 2, long5(x));
-        bb._put(bi + 3, long4(x));
-        bb._put(bi + 4, long3(x));
-        bb._put(bi + 5, long2(x));
-        bb._put(bi + 6, long1(x));
-        bb._put(bi + 7, long0(x));
-    }
-
-    static void putLongB(long a, long x) {
-        _put(a    , long7(x));
-        _put(a + 1, long6(x));
-        _put(a + 2, long5(x));
-        _put(a + 3, long4(x));
-        _put(a + 4, long3(x));
-        _put(a + 5, long2(x));
-        _put(a + 6, long1(x));
-        _put(a + 7, long0(x));
-    }
-
-    static void putLong(ByteBuffer bb, int bi, long x, boolean bigEndian) {
-        if (bigEndian)
-            putLongB(bb, bi, x);
-        else
-            putLongL(bb, bi, x);
-    }
-
-    static void putLong(long a, long x, boolean bigEndian) {
-        if (bigEndian)
-            putLongB(a, x);
-        else
-            putLongL(a, x);
-    }
-
-
-    // -- get/put float --
-
-    static float getFloatL(ByteBuffer bb, int bi) {
-        return Float.intBitsToFloat(getIntL(bb, bi));
-    }
-
-    static float getFloatL(long a) {
-        return Float.intBitsToFloat(getIntL(a));
-    }
-
-    static float getFloatB(ByteBuffer bb, int bi) {
-        return Float.intBitsToFloat(getIntB(bb, bi));
-    }
-
-    static float getFloatB(long a) {
-        return Float.intBitsToFloat(getIntB(a));
-    }
-
-    static float getFloat(ByteBuffer bb, int bi, boolean bigEndian) {
-        return bigEndian ? getFloatB(bb, bi) : getFloatL(bb, bi);
-    }
-
-    static float getFloat(long a, boolean bigEndian) {
-        return bigEndian ? getFloatB(a) : getFloatL(a);
-    }
-
-    static void putFloatL(ByteBuffer bb, int bi, float x) {
-        putIntL(bb, bi, Float.floatToRawIntBits(x));
-    }
-
-    static void putFloatL(long a, float x) {
-        putIntL(a, Float.floatToRawIntBits(x));
-    }
-
-    static void putFloatB(ByteBuffer bb, int bi, float x) {
-        putIntB(bb, bi, Float.floatToRawIntBits(x));
-    }
-
-    static void putFloatB(long a, float x) {
-        putIntB(a, Float.floatToRawIntBits(x));
-    }
-
-    static void putFloat(ByteBuffer bb, int bi, float x, boolean bigEndian) {
-        if (bigEndian)
-            putFloatB(bb, bi, x);
-        else
-            putFloatL(bb, bi, x);
-    }
-
-    static void putFloat(long a, float x, boolean bigEndian) {
-        if (bigEndian)
-            putFloatB(a, x);
-        else
-            putFloatL(a, x);
-    }
-
-
-    // -- get/put double --
-
-    static double getDoubleL(ByteBuffer bb, int bi) {
-        return Double.longBitsToDouble(getLongL(bb, bi));
-    }
-
-    static double getDoubleL(long a) {
-        return Double.longBitsToDouble(getLongL(a));
-    }
-
-    static double getDoubleB(ByteBuffer bb, int bi) {
-        return Double.longBitsToDouble(getLongB(bb, bi));
-    }
-
-    static double getDoubleB(long a) {
-        return Double.longBitsToDouble(getLongB(a));
-    }
-
-    static double getDouble(ByteBuffer bb, int bi, boolean bigEndian) {
-        return bigEndian ? getDoubleB(bb, bi) : getDoubleL(bb, bi);
-    }
-
-    static double getDouble(long a, boolean bigEndian) {
-        return bigEndian ? getDoubleB(a) : getDoubleL(a);
-    }
-
-    static void putDoubleL(ByteBuffer bb, int bi, double x) {
-        putLongL(bb, bi, Double.doubleToRawLongBits(x));
-    }
-
-    static void putDoubleL(long a, double x) {
-        putLongL(a, Double.doubleToRawLongBits(x));
-    }
-
-    static void putDoubleB(ByteBuffer bb, int bi, double x) {
-        putLongB(bb, bi, Double.doubleToRawLongBits(x));
-    }
-
-    static void putDoubleB(long a, double x) {
-        putLongB(a, Double.doubleToRawLongBits(x));
-    }
-
-    static void putDouble(ByteBuffer bb, int bi, double x, boolean bigEndian) {
-        if (bigEndian)
-            putDoubleB(bb, bi, x);
-        else
-            putDoubleL(bb, bi, x);
-    }
-
-    static void putDouble(long a, double x, boolean bigEndian) {
-        if (bigEndian)
-            putDoubleB(a, x);
-        else
-            putDoubleL(a, x);
-    }
-
-
     // -- Unsafe access --
 
     private static final Unsafe unsafe = Unsafe.getUnsafe();
 
-    private static byte _get(long a) {
-        return unsafe.getByte(a);
-    }
-
-    private static void _put(long a, byte b) {
-        unsafe.putByte(a, b);
-    }
-
     static Unsafe unsafe() {
         return unsafe;
     }
diff --git a/jdk/src/java.base/share/classes/java/nio/ByteBufferAs-X-Buffer.java.template b/jdk/src/java.base/share/classes/java/nio/ByteBufferAs-X-Buffer.java.template
index bae6225..3ceb412 100644
--- a/jdk/src/java.base/share/classes/java/nio/ByteBufferAs-X-Buffer.java.template
+++ b/jdk/src/java.base/share/classes/java/nio/ByteBufferAs-X-Buffer.java.template
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2000, 2013, 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
@@ -27,6 +27,8 @@
 
 package java.nio;
 
+import jdk.internal.misc.Unsafe;
+
 
 class ByteBufferAs$Type$Buffer$RW$$BO$                  // package-private
     extends {#if[ro]?ByteBufferAs}$Type$Buffer{#if[ro]?$BO$}
@@ -34,8 +36,10 @@
 
 #if[rw]
 
+    // Cached unsafe-access object
+    private static final Unsafe unsafe = Bits.unsafe();
+
     protected final ByteBuffer bb;
-    protected final int offset;
 
 #end[rw]
 
@@ -50,7 +54,7 @@
         this.limit(cap);
         int pos = this.position();
         assert (pos <= cap);
-        offset = pos;
+        address = bb.address;
 #else[rw]
         super(bb);
 #end[rw]
@@ -58,14 +62,15 @@
 
     ByteBufferAs$Type$Buffer$RW$$BO$(ByteBuffer bb,
                                      int mark, int pos, int lim, int cap,
-                                     int off)
+                                     long addr)
     {
 #if[rw]
         super(mark, pos, lim, cap);
         this.bb = bb;
-        offset = off;
+        address = addr;
+        assert address >= bb.address;
 #else[rw]
-        super(bb, mark, pos, lim, cap, off);
+        super(bb, mark, pos, lim, cap, addr);
 #end[rw]
     }
 
@@ -74,9 +79,8 @@
         int lim = this.limit();
         assert (pos <= lim);
         int rem = (pos <= lim ? lim - pos : 0);
-        int off = (pos << $LG_BYTES_PER_VALUE$) + offset;
-        assert (off >= 0);
-        return new ByteBufferAs$Type$Buffer$RW$$BO$(bb, -1, 0, rem, rem, off);
+        long addr = byteOffset(pos);
+        return new ByteBufferAs$Type$Buffer$RW$$BO$(bb, -1, 0, rem, rem, addr);
     }
 
     public $Type$Buffer duplicate() {
@@ -85,7 +89,7 @@
                                                     this.position(),
                                                     this.limit(),
                                                     this.capacity(),
-                                                    offset);
+                                                    address);
     }
 
     public $Type$Buffer asReadOnlyBuffer() {
@@ -95,7 +99,7 @@
                                                  this.position(),
                                                  this.limit(),
                                                  this.capacity(),
-                                                 offset);
+                                                 address);
 #else[rw]
         return duplicate();
 #end[rw]
@@ -103,21 +107,32 @@
 
 #if[rw]
 
-    protected int ix(int i) {
-        return (i << $LG_BYTES_PER_VALUE$) + offset;
+    private int ix(int i) {
+        int off = (int) (address - bb.address);
+        return (i << $LG_BYTES_PER_VALUE$) + off;
+    }
+
+    protected long byteOffset(long i) {
+        return (i << $LG_BYTES_PER_VALUE$) + address;
     }
 
     public $type$ get() {
-        return Bits.get$Type$$BO$(bb, ix(nextGetIndex()));
+        $memtype$ x = unsafe.get$Memtype$Unaligned(bb.hb, byteOffset(nextGetIndex()),
+            {#if[boB]?true:false});
+        return $fromBits$(x);
     }
 
     public $type$ get(int i) {
-        return Bits.get$Type$$BO$(bb, ix(checkIndex(i)));
+        $memtype$ x = unsafe.get$Memtype$Unaligned(bb.hb, byteOffset(checkIndex(i)),
+            {#if[boB]?true:false});
+        return $fromBits$(x);
     }
 
 #if[streamableType]
    $type$ getUnchecked(int i) {
-        return Bits.get$Type$$BO$(bb, ix(i));
+        $memtype$ x = unsafe.get$Memtype$Unaligned(bb.hb, byteOffset(i),
+            {#if[boB]?true:false});
+        return $fromBits$(x);
     }
 #end[streamableType]
 
@@ -125,7 +140,9 @@
 
     public $Type$Buffer put($type$ x) {
 #if[rw]
-        Bits.put$Type$$BO$(bb, ix(nextPutIndex()), x);
+        $memtype$ y = $toBits$(x);
+        unsafe.put$Memtype$Unaligned(bb.hb, byteOffset(nextPutIndex()), y,
+            {#if[boB]?true:false});
         return this;
 #else[rw]
         throw new ReadOnlyBufferException();
@@ -134,7 +151,9 @@
 
     public $Type$Buffer put(int i, $type$ x) {
 #if[rw]
-        Bits.put$Type$$BO$(bb, ix(checkIndex(i)), x);
+        $memtype$ y = $toBits$(x);
+        unsafe.put$Memtype$Unaligned(bb.hb, byteOffset(checkIndex(i)), y,
+            {#if[boB]?true:false});
         return this;
 #else[rw]
         throw new ReadOnlyBufferException();
@@ -207,7 +226,7 @@
                                                   pos + start,
                                                   pos + end,
                                                   capacity(),
-                                                  offset);
+                                                  address);
     }
 
 #end[char]
diff --git a/jdk/src/java.base/share/classes/java/nio/Direct-X-Buffer-bin.java.template b/jdk/src/java.base/share/classes/java/nio/Direct-X-Buffer-bin.java.template
index 538bd5f..6179776 100644
--- a/jdk/src/java.base/share/classes/java/nio/Direct-X-Buffer-bin.java.template
+++ b/jdk/src/java.base/share/classes/java/nio/Direct-X-Buffer-bin.java.template
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2000, 2003, 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
@@ -32,11 +32,8 @@
 #if[rw]
 
     private $type$ get$Type$(long a) {
-        if (unaligned) {
-            $memtype$ x = unsafe.get$Memtype$(a);
-            return $fromBits$(nativeByteOrder ? x : Bits.swap(x));
-        }
-        return Bits.get$Type$(a, bigEndian);
+        $memtype$ x = unsafe.get$Memtype$Unaligned(null, a, bigEndian);
+        return $fromBits$(x);
     }
 
     public $type$ get$Type$() {
@@ -51,12 +48,8 @@
 
     private ByteBuffer put$Type$(long a, $type$ x) {
 #if[rw]
-        if (unaligned) {
-            $memtype$ y = $toBits$(x);
-            unsafe.put$Memtype$(a, (nativeByteOrder ? y : Bits.swap(y)));
-        } else {
-            Bits.put$Type$(a, x, bigEndian);
-        }
+        $memtype$ y = $toBits$(x);
+        unsafe.put$Memtype$Unaligned(null, a, y, bigEndian);
         return this;
 #else[rw]
         throw new ReadOnlyBufferException();
@@ -95,13 +88,13 @@
                                                                        0,
                                                                        size,
                                                                        size,
-                                                                       off))
+                                                                       address + off))
                     : ($Type$Buffer)(new ByteBufferAs$Type$Buffer$RW$L(this,
                                                                        -1,
                                                                        0,
                                                                        size,
                                                                        size,
-                                                                       off)));
+                                                                       address + off)));
         } else {
             return (nativeByteOrder
                     ? ($Type$Buffer)(new Direct$Type$Buffer$RW$U(this,
diff --git a/jdk/src/java.base/share/classes/java/nio/Heap-X-Buffer.java.template b/jdk/src/java.base/share/classes/java/nio/Heap-X-Buffer.java.template
index 65f6cb3..69e65a0 100644
--- a/jdk/src/java.base/share/classes/java/nio/Heap-X-Buffer.java.template
+++ b/jdk/src/java.base/share/classes/java/nio/Heap-X-Buffer.java.template
@@ -325,20 +325,20 @@
 
     public CharBuffer asCharBuffer() {
         int size = this.remaining() >> 1;
-        int off = offset + position();
+        long addr = address + position();
         return (bigEndian
                 ? (CharBuffer)(new ByteBufferAsCharBuffer$RW$B(this,
                                                                -1,
                                                                0,
                                                                size,
                                                                size,
-                                                               off))
+                                                               addr))
                 : (CharBuffer)(new ByteBufferAsCharBuffer$RW$L(this,
                                                                -1,
                                                                0,
                                                                size,
                                                                size,
-                                                               off)));
+                                                               addr)));
     }
 
 
@@ -376,20 +376,20 @@
 
     public ShortBuffer asShortBuffer() {
         int size = this.remaining() >> 1;
-        int off = offset + position();
+        long addr = address + position();
         return (bigEndian
                 ? (ShortBuffer)(new ByteBufferAsShortBuffer$RW$B(this,
                                                                  -1,
                                                                  0,
                                                                  size,
                                                                  size,
-                                                                 off))
+                                                                 addr))
                 : (ShortBuffer)(new ByteBufferAsShortBuffer$RW$L(this,
                                                                  -1,
                                                                  0,
                                                                  size,
                                                                  size,
-                                                                 off)));
+                                                                 addr)));
     }
 
 
@@ -427,20 +427,20 @@
 
     public IntBuffer asIntBuffer() {
         int size = this.remaining() >> 2;
-        int off = offset + position();
+        long addr = address + position();
         return (bigEndian
                 ? (IntBuffer)(new ByteBufferAsIntBuffer$RW$B(this,
                                                              -1,
                                                              0,
                                                              size,
                                                              size,
-                                                             off))
+                                                             addr))
                 : (IntBuffer)(new ByteBufferAsIntBuffer$RW$L(this,
                                                              -1,
                                                              0,
                                                              size,
                                                              size,
-                                                             off)));
+                                                             addr)));
     }
 
 
@@ -478,20 +478,20 @@
 
     public LongBuffer asLongBuffer() {
         int size = this.remaining() >> 3;
-        int off = offset + position();
+        long addr = address + position();
         return (bigEndian
                 ? (LongBuffer)(new ByteBufferAsLongBuffer$RW$B(this,
                                                                -1,
                                                                0,
                                                                size,
                                                                size,
-                                                               off))
+                                                               addr))
                 : (LongBuffer)(new ByteBufferAsLongBuffer$RW$L(this,
                                                                -1,
                                                                0,
                                                                size,
                                                                size,
-                                                               off)));
+                                                               addr)));
     }
 
 
@@ -533,20 +533,20 @@
 
     public FloatBuffer asFloatBuffer() {
         int size = this.remaining() >> 2;
-        int off = offset + position();
+        long addr = address + position();
         return (bigEndian
                 ? (FloatBuffer)(new ByteBufferAsFloatBuffer$RW$B(this,
                                                                  -1,
                                                                  0,
                                                                  size,
                                                                  size,
-                                                                 off))
+                                                                 addr))
                 : (FloatBuffer)(new ByteBufferAsFloatBuffer$RW$L(this,
                                                                  -1,
                                                                  0,
                                                                  size,
                                                                  size,
-                                                                 off)));
+                                                                 addr)));
     }
 
 
@@ -588,20 +588,20 @@
 
     public DoubleBuffer asDoubleBuffer() {
         int size = this.remaining() >> 3;
-        int off = offset + position();
+        long addr = address + position();
         return (bigEndian
                 ? (DoubleBuffer)(new ByteBufferAsDoubleBuffer$RW$B(this,
                                                                    -1,
                                                                    0,
                                                                    size,
                                                                    size,
-                                                                   off))
+                                                                   addr))
                 : (DoubleBuffer)(new ByteBufferAsDoubleBuffer$RW$L(this,
                                                                    -1,
                                                                    0,
                                                                    size,
                                                                    size,
-                                                                   off)));
+                                                                   addr)));
     }
 
 
diff --git a/jdk/src/java.base/share/classes/java/nio/file/FileTreeWalker.java b/jdk/src/java.base/share/classes/java/nio/file/FileTreeWalker.java
index b0cf0d3..13bb629 100644
--- a/jdk/src/java.base/share/classes/java/nio/file/FileTreeWalker.java
+++ b/jdk/src/java.base/share/classes/java/nio/file/FileTreeWalker.java
@@ -168,7 +168,7 @@
      * @throws  IllegalArgumentException
      *          if {@code maxDepth} is negative
      * @throws  ClassCastException
-     *          if (@code options} contains an element that is not a
+     *          if {@code options} contains an element that is not a
      *          {@code FileVisitOption}
      * @throws  NullPointerException
      *          if {@code options} is {@ocde null} or the options
diff --git a/jdk/src/java.base/share/classes/java/time/format/DateTimeFormatterBuilder.java b/jdk/src/java.base/share/classes/java/time/format/DateTimeFormatterBuilder.java
index e9187e4..9beb695 100644
--- a/jdk/src/java.base/share/classes/java/time/format/DateTimeFormatterBuilder.java
+++ b/jdk/src/java.base/share/classes/java/time/format/DateTimeFormatterBuilder.java
@@ -810,7 +810,7 @@
      * The localized decimal style is not used.
      * <p>
      * The instant is obtained using {@link ChronoField#INSTANT_SECONDS INSTANT_SECONDS}
-     * and optionally (@code NANO_OF_SECOND). The value of {@code INSTANT_SECONDS}
+     * and optionally {@code NANO_OF_SECOND}. The value of {@code INSTANT_SECONDS}
      * may be outside the maximum range of {@code LocalDateTime}.
      * <p>
      * The {@linkplain ResolverStyle resolver style} has no effect on instant parsing.
@@ -848,7 +848,7 @@
      * digits from zero to nine are accepted.
      * <p>
      * The instant is obtained using {@link ChronoField#INSTANT_SECONDS INSTANT_SECONDS}
-     * and optionally (@code NANO_OF_SECOND). The value of {@code INSTANT_SECONDS}
+     * and optionally {@code NANO_OF_SECOND}. The value of {@code INSTANT_SECONDS}
      * may be outside the maximum range of {@code LocalDateTime}.
      * <p>
      * The {@linkplain ResolverStyle resolver style} has no effect on instant parsing.
diff --git a/jdk/src/java.base/share/classes/jdk/internal/reflect/MethodAccessorGenerator.java b/jdk/src/java.base/share/classes/jdk/internal/reflect/MethodAccessorGenerator.java
index c4acdff..d0108b8 100644
--- a/jdk/src/java.base/share/classes/jdk/internal/reflect/MethodAccessorGenerator.java
+++ b/jdk/src/java.base/share/classes/jdk/internal/reflect/MethodAccessorGenerator.java
@@ -437,17 +437,6 @@
             cb.opc_new(targetClass);
             cb.opc_dup();
         } else {
-            // Setup before iterating down argument list
-            if (isPrimitive(returnType)) {
-                // new <boxing type for primitive type>
-                // dup
-                // ... (see below:)
-                // invokespecial <constructor for boxing type for primitive type>
-                // areturn
-                cb.opc_new(indexForPrimitiveType(returnType));
-                cb.opc_dup();
-            }
-
             // Get target object on operand stack if necessary.
 
             // We need to do an explicit null check here; we won't see
diff --git a/jdk/src/java.base/share/classes/sun/nio/fs/AbstractFileTypeDetector.java b/jdk/src/java.base/share/classes/sun/nio/fs/AbstractFileTypeDetector.java
index 4b4e623..7a92479 100644
--- a/jdk/src/java.base/share/classes/sun/nio/fs/AbstractFileTypeDetector.java
+++ b/jdk/src/java.base/share/classes/sun/nio/fs/AbstractFileTypeDetector.java
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2008, 2015, 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
@@ -25,6 +25,8 @@
 
 package sun.nio.fs;
 
+import java.net.FileNameMap;
+import java.net.URLConnection;
 import java.nio.file.Path;
 import java.nio.file.spi.FileTypeDetector;
 import java.util.Locale;
@@ -71,6 +73,16 @@
         if (file == null)
             throw new NullPointerException("'file' is null");
         String result = implProbeContentType(file);
+
+        // Fall back to content types property.
+        if (result == null) {
+            Path fileName = file.getFileName();
+            if (fileName != null) {
+                FileNameMap fileNameMap = URLConnection.getFileNameMap();
+                result = fileNameMap.getContentTypeFor(fileName.toString());
+            }
+        }
+
         return (result == null) ? null : parse(result);
     }
 
diff --git a/jdk/src/java.base/share/classes/sun/reflect/annotation/AnnotationInvocationHandler.java b/jdk/src/java.base/share/classes/sun/reflect/annotation/AnnotationInvocationHandler.java
index cd9dd9a..d3a58fe 100644
--- a/jdk/src/java.base/share/classes/sun/reflect/annotation/AnnotationInvocationHandler.java
+++ b/jdk/src/java.base/share/classes/sun/reflect/annotation/AnnotationInvocationHandler.java
@@ -30,7 +30,7 @@
 import java.lang.reflect.*;
 import java.io.Serializable;
 import java.util.*;
-import java.util.stream.Collectors;
+import java.util.stream.*;
 import java.security.AccessController;
 import java.security.PrivilegedAction;
 
@@ -163,47 +163,167 @@
      */
     private static String memberValueToString(Object value) {
         Class<?> type = value.getClass();
-        if (!type.isArray()) {   // primitive, string, class, enum const,
-                                 // or annotation
+        if (!type.isArray()) {
+            // primitive value, string, class, enum const, or annotation
             if (type == Class.class)
-                return classValueToString((Class<?>) value);
+                return toSourceString((Class<?>) value);
+            else if (type == String.class)
+                return  toSourceString((String) value);
+            if (type == Character.class)
+                return toSourceString((char) value);
+            else if (type == Double.class)
+                return  toSourceString((double) value);
+            else if (type == Float.class)
+                return  toSourceString((float) value);
+            else if (type == Long.class)
+                return  toSourceString((long) value);
             else
                 return value.toString();
-        }
+        } else {
+            Stream<String> stringStream;
+            if (type == byte[].class)
+                stringStream = convert((byte[]) value);
+            else if (type == char[].class)
+                stringStream = convert((char[]) value);
+            else if (type == double[].class)
+                stringStream = DoubleStream.of((double[]) value)
+                    .mapToObj(AnnotationInvocationHandler::toSourceString);
+            else if (type == float[].class)
+                stringStream = convert((float[]) value);
+            else if (type == int[].class)
+                stringStream = IntStream.of((int[]) value).mapToObj(String::valueOf);
+            else if (type == long[].class) {
+                stringStream = LongStream.of((long[]) value)
+                    .mapToObj(AnnotationInvocationHandler::toSourceString);
+            } else if (type == short[].class)
+                stringStream = convert((short[]) value);
+            else if (type == boolean[].class)
+                stringStream = convert((boolean[]) value);
+            else if (type == Class[].class)
+                stringStream =
+                    Arrays.stream((Class<?>[]) value).
+                    map(AnnotationInvocationHandler::toSourceString);
+            else if (type == String[].class)
+                stringStream =
+                    Arrays.stream((String[])value).
+                    map(AnnotationInvocationHandler::toSourceString);
+            else
+                stringStream = Arrays.stream((Object[])value).map(Objects::toString);
 
-        if (type == byte[].class)
-            return Arrays.toString((byte[]) value);
-        if (type == char[].class)
-            return Arrays.toString((char[]) value);
-        if (type == double[].class)
-            return Arrays.toString((double[]) value);
-        if (type == float[].class)
-            return Arrays.toString((float[]) value);
-        if (type == int[].class)
-            return Arrays.toString((int[]) value);
-        if (type == long[].class)
-            return Arrays.toString((long[]) value);
-        if (type == short[].class)
-            return Arrays.toString((short[]) value);
-        if (type == boolean[].class)
-            return Arrays.toString((boolean[]) value);
-        if (type == Class[].class)
-            return classArrayValueToString((Class<?>[])value);
-        return Arrays.toString((Object[]) value);
+            return stringStreamToString(stringStream);
+        }
     }
 
     /**
      * Translates a Class value to a form suitable for use in the
      * string representation of an annotation.
      */
-    private static String classValueToString(Class<?> clazz) {
-        return clazz.getName() + ".class" ;
+    private static String toSourceString(Class<?> clazz) {
+        Class<?> finalComponent = clazz;
+        StringBuilder arrayBackets = new StringBuilder();
+
+        while(finalComponent.isArray()) {
+            finalComponent = finalComponent.getComponentType();
+            arrayBackets.append("[]");
+        }
+
+        return finalComponent.getName() + arrayBackets.toString() + ".class" ;
     }
 
-    private static String classArrayValueToString(Class<?>[] classes) {
-        return Arrays.stream(classes)
-            .map(AnnotationInvocationHandler::classValueToString)
-            .collect(Collectors.joining(", ", "{", "}"));
+    private static String toSourceString(float f) {
+        if (Float.isFinite(f))
+            return Float.toString(f) + "f" ;
+        else {
+            if (Float.isInfinite(f)) {
+                return (f < 0.0f) ? "-1.0f/0.0f": "1.0f/0.0f";
+            } else
+                return "0.0f/0.0f";
+        }
+    }
+
+    private static String toSourceString(double d) {
+        if (Double.isFinite(d))
+            return Double.toString(d);
+        else {
+            if (Double.isInfinite(d)) {
+                return (d < 0.0f) ? "-1.0/0.0": "1.0/0.0";
+            } else
+                return "0.0/0.0";
+        }
+    }
+
+    private static String toSourceString(char c) {
+        StringBuilder sb = new StringBuilder();
+        sb.append("'");
+        if (c == '\'')
+            sb.append("\\'");
+        else
+            sb.append(c);
+        sb.append("'");
+        return sb.toString();
+    }
+
+    private static String toSourceString(long ell) {
+        return (Math.abs(ell) <= Integer.MAX_VALUE) ?
+            String.valueOf(ell) :
+            (String.valueOf(ell) + "L");
+    }
+
+    /**
+     * Return a string suitable for use in the string representation
+     * of an annotation.
+     */
+    private static String toSourceString(String s) {
+        StringBuilder sb = new StringBuilder();
+        sb.append('"');
+        // Escape embedded quote characters, if present, but don't do
+        // anything more heroic.
+        if (s.indexOf('"') != -1) {
+            s = s.replace("\"", "\\\"");
+        }
+        sb.append(s);
+        sb.append('"');
+        return sb.toString();
+    }
+
+    private static Stream<String> convert(byte[] values) {
+        List<String> list = new ArrayList<>(values.length);
+        for (byte b : values)
+            list.add(Byte.toString(b));
+        return list.stream();
+    }
+
+    private static Stream<String> convert(char[] values) {
+        List<String> list = new ArrayList<>(values.length);
+        for (char c : values)
+            list.add(toSourceString(c));
+        return list.stream();
+    }
+
+    private static Stream<String> convert(float[] values) {
+        List<String> list = new ArrayList<>(values.length);
+        for (float f : values) {
+            list.add(toSourceString(f));
+        }
+        return list.stream();
+    }
+
+    private static Stream<String> convert(short[] values) {
+        List<String> list = new ArrayList<>(values.length);
+        for (short s : values)
+            list.add(Short.toString(s));
+        return list.stream();
+    }
+
+    private static Stream<String> convert(boolean[] values) {
+        List<String> list = new ArrayList<>(values.length);
+        for (boolean b : values)
+            list.add(Boolean.toString(b));
+        return list.stream();
+    }
+
+    private static String stringStreamToString(Stream<String> stream) {
+        return stream.collect(Collectors.joining(", ", "{", "}"));
     }
 
     /**
diff --git a/jdk/src/java.base/share/classes/sun/util/locale/LocaleMatcher.java b/jdk/src/java.base/share/classes/sun/util/locale/LocaleMatcher.java
index 9e62b2e..3af00e4 100644
--- a/jdk/src/java.base/share/classes/sun/util/locale/LocaleMatcher.java
+++ b/jdk/src/java.base/share/classes/sun/util/locale/LocaleMatcher.java
@@ -28,16 +28,12 @@
 import java.util.ArrayList;
 import java.util.Collection;
 import java.util.HashMap;
-import java.util.Iterator;
-import java.util.LinkedHashMap;
-import java.util.LinkedList;
 import java.util.List;
 import java.util.Locale;
 import java.util.Locale.*;
 import static java.util.Locale.FilteringMode.*;
 import static java.util.Locale.LanguageRange.*;
 import java.util.Map;
-import java.util.Set;
 
 /**
  * Implementation for BCP47 Locale matching
@@ -111,10 +107,22 @@
 
     private static List<String> filterBasic(List<LanguageRange> priorityList,
                                             Collection<String> tags) {
+        int splitIndex = splitRanges(priorityList);
+        List<LanguageRange> nonZeroRanges;
+        List<LanguageRange> zeroRanges;
+        if (splitIndex != -1) {
+            nonZeroRanges = priorityList.subList(0, splitIndex);
+            zeroRanges = priorityList.subList(splitIndex, priorityList.size());
+        } else {
+            nonZeroRanges = priorityList;
+            zeroRanges = List.of();
+        }
+
         List<String> list = new ArrayList<>();
-        for (LanguageRange lr : priorityList) {
+        for (LanguageRange lr : nonZeroRanges) {
             String range = lr.getRange();
             if (range.equals("*")) {
+                tags = removeTagsMatchingBasicZeroRange(zeroRanges, tags);
                 return new ArrayList<String>(tags);
             } else {
                 for (String tag : tags) {
@@ -122,7 +130,8 @@
                     if (tag.startsWith(range)) {
                         int len = range.length();
                         if ((tag.length() == len || tag.charAt(len) == '-')
-                            && !list.contains(tag)) {
+                            && !list.contains(tag)
+                            && !shouldIgnoreFilterBasicMatch(zeroRanges, tag)) {
                             list.add(tag);
                         }
                     }
@@ -133,12 +142,76 @@
         return list;
     }
 
-    private static List<String> filterExtended(List<LanguageRange> priorityList,
-                                               Collection<String> tags) {
-        List<String> list = new ArrayList<>();
-        for (LanguageRange lr : priorityList) {
+    /**
+     * Removes the tag(s) which are falling in the basic exclusion range(s) i.e
+     * range(s) with q=0 and returns the updated collection. If the basic
+     * language ranges contains '*' as one of its non zero range then instead of
+     * returning all the tags, remove those which are matching the range with
+     * quality weight q=0.
+     */
+    private static Collection<String> removeTagsMatchingBasicZeroRange(
+            List<LanguageRange> zeroRange, Collection<String> tags) {
+        if (zeroRange.isEmpty()) {
+            return tags;
+        }
+
+        List<String> matchingTags = new ArrayList<>();
+        for (String tag : tags) {
+            tag = tag.toLowerCase(Locale.ROOT);
+            if (!shouldIgnoreFilterBasicMatch(zeroRange, tag)) {
+                matchingTags.add(tag);
+            }
+        }
+
+        return matchingTags;
+    }
+
+    /**
+     * The tag which is falling in the basic exclusion range(s) should not
+     * be considered as the matching tag. Ignores the tag matching with the
+     * non-zero ranges, if the tag also matches with one of the basic exclusion
+     * ranges i.e. range(s) having quality weight q=0
+     */
+    private static boolean shouldIgnoreFilterBasicMatch(
+            List<LanguageRange> zeroRange, String tag) {
+        if (zeroRange.isEmpty()) {
+            return false;
+        }
+
+        for (LanguageRange lr : zeroRange) {
             String range = lr.getRange();
             if (range.equals("*")) {
+                return true;
+            }
+            if (tag.startsWith(range)) {
+                int len = range.length();
+                if ((tag.length() == len || tag.charAt(len) == '-')) {
+                    return true;
+                }
+            }
+        }
+
+        return false;
+    }
+
+    private static List<String> filterExtended(List<LanguageRange> priorityList,
+                                               Collection<String> tags) {
+        int splitIndex = splitRanges(priorityList);
+        List<LanguageRange> nonZeroRanges;
+        List<LanguageRange> zeroRanges;
+        if (splitIndex != -1) {
+            nonZeroRanges = priorityList.subList(0, splitIndex);
+            zeroRanges = priorityList.subList(splitIndex, priorityList.size());
+        } else {
+            nonZeroRanges = priorityList;
+            zeroRanges = List.of();
+        }
+
+        List<String> list = new ArrayList<>();
+        for (LanguageRange lr : nonZeroRanges) {
+            String range = lr.getRange();
+            if (range.equals("*")) {
+                tags = removeTagsMatchingExtendedZeroRange(zeroRanges, tags);
                 return new ArrayList<String>(tags);
             }
             String[] rangeSubtags = range.split("-");
@@ -150,33 +223,101 @@
                     continue;
                 }
 
-                int rangeIndex = 1;
-                int tagIndex = 1;
-
-                while (rangeIndex < rangeSubtags.length
-                       && tagIndex < tagSubtags.length) {
-                   if (rangeSubtags[rangeIndex].equals("*")) {
-                       rangeIndex++;
-                   } else if (rangeSubtags[rangeIndex].equals(tagSubtags[tagIndex])) {
-                       rangeIndex++;
-                       tagIndex++;
-                   } else if (tagSubtags[tagIndex].length() == 1
-                              && !tagSubtags[tagIndex].equals("*")) {
-                       break;
-                   } else {
-                       tagIndex++;
-                   }
-               }
-
-               if (rangeSubtags.length == rangeIndex && !list.contains(tag)) {
-                   list.add(tag);
-               }
+                int rangeIndex = matchFilterExtendedSubtags(rangeSubtags,
+                        tagSubtags);
+                if (rangeSubtags.length == rangeIndex && !list.contains(tag)
+                        && !shouldIgnoreFilterExtendedMatch(zeroRanges, tag)) {
+                    list.add(tag);
+                }
             }
         }
 
         return list;
     }
 
+    /**
+     * Removes the tag(s) which are falling in the extended exclusion range(s)
+     * i.e range(s) with q=0 and returns the updated collection. If the extended
+     * language ranges contains '*' as one of its non zero range then instead of
+     * returning all the tags, remove those which are matching the range with
+     * quality weight q=0.
+     */
+    private static Collection<String> removeTagsMatchingExtendedZeroRange(
+            List<LanguageRange> zeroRange, Collection<String> tags) {
+        if (zeroRange.isEmpty()) {
+            return tags;
+        }
+
+        List<String> matchingTags = new ArrayList<>();
+        for (String tag : tags) {
+            tag = tag.toLowerCase(Locale.ROOT);
+            if (!shouldIgnoreFilterExtendedMatch(zeroRange, tag)) {
+                matchingTags.add(tag);
+            }
+        }
+
+        return matchingTags;
+    }
+
+    /**
+     * The tag which is falling in the extended exclusion range(s) should
+     * not be considered as the matching tag. Ignores the tag matching with the
+     * non zero range(s), if the tag also matches with one of the extended
+     * exclusion range(s) i.e. range(s) having quality weight q=0
+     */
+    private static boolean shouldIgnoreFilterExtendedMatch(
+            List<LanguageRange> zeroRange, String tag) {
+        if (zeroRange.isEmpty()) {
+            return false;
+        }
+
+        String[] tagSubtags = tag.split("-");
+        for (LanguageRange lr : zeroRange) {
+            String range = lr.getRange();
+            if (range.equals("*")) {
+                return true;
+            }
+
+            String[] rangeSubtags = range.split("-");
+
+            if (!rangeSubtags[0].equals(tagSubtags[0])
+                    && !rangeSubtags[0].equals("*")) {
+                continue;
+            }
+
+            int rangeIndex = matchFilterExtendedSubtags(rangeSubtags,
+                    tagSubtags);
+            if (rangeSubtags.length == rangeIndex) {
+                return true;
+            }
+        }
+
+        return false;
+    }
+
+    private static int matchFilterExtendedSubtags(String[] rangeSubtags,
+            String[] tagSubtags) {
+        int rangeIndex = 1;
+        int tagIndex = 1;
+
+        while (rangeIndex < rangeSubtags.length
+                && tagIndex < tagSubtags.length) {
+            if (rangeSubtags[rangeIndex].equals("*")) {
+                rangeIndex++;
+            } else if (rangeSubtags[rangeIndex]
+                    .equals(tagSubtags[tagIndex])) {
+                rangeIndex++;
+                tagIndex++;
+            } else if (tagSubtags[tagIndex].length() == 1
+                    && !tagSubtags[tagIndex].equals("*")) {
+                break;
+            } else {
+                tagIndex++;
+            }
+        }
+        return rangeIndex;
+    }
+
     public static Locale lookup(List<LanguageRange> priorityList,
                                 Collection<Locale> locales) {
         if (priorityList.isEmpty() || locales.isEmpty()) {
@@ -205,7 +346,18 @@
             return null;
         }
 
-        for (LanguageRange lr : priorityList) {
+        int splitIndex = splitRanges(priorityList);
+        List<LanguageRange> nonZeroRanges;
+        List<LanguageRange> zeroRanges;
+        if (splitIndex != -1) {
+            nonZeroRanges = priorityList.subList(0, splitIndex);
+            zeroRanges = priorityList.subList(splitIndex, priorityList.size());
+        } else {
+            nonZeroRanges = priorityList;
+            zeroRanges = List.of();
+        }
+
+        for (LanguageRange lr : nonZeroRanges) {
             String range = lr.getRange();
 
             // Special language range ("*") is ignored in lookup.
@@ -217,31 +369,83 @@
             while (rangeForRegex.length() > 0) {
                 for (String tag : tags) {
                     tag = tag.toLowerCase(Locale.ROOT);
-                    if (tag.matches(rangeForRegex)) {
+                    if (tag.matches(rangeForRegex)
+                            && !shouldIgnoreLookupMatch(zeroRanges, tag)) {
                         return tag;
                     }
                 }
 
                 // Truncate from the end....
-                int index = rangeForRegex.lastIndexOf('-');
-                if (index >= 0) {
-                    rangeForRegex = rangeForRegex.substring(0, index);
-
-                    // if range ends with an extension key, truncate it.
-                    index = rangeForRegex.lastIndexOf('-');
-                    if (index >= 0 && index == rangeForRegex.length()-2) {
-                        rangeForRegex =
-                            rangeForRegex.substring(0, rangeForRegex.length()-2);
-                    }
-                } else {
-                    rangeForRegex = "";
-                }
+                rangeForRegex = truncateRange(rangeForRegex);
             }
         }
 
         return null;
     }
 
+    /**
+     * The tag which is falling in the exclusion range(s) should not be
+     * considered as the matching tag. Ignores the tag matching with the
+     * non zero range(s), if the tag also matches with one of the exclusion
+     * range(s) i.e. range(s) having quality weight q=0.
+     */
+    private static boolean shouldIgnoreLookupMatch(List<LanguageRange> zeroRange,
+            String tag) {
+        for (LanguageRange lr : zeroRange) {
+            String range = lr.getRange();
+
+            // Special language range ("*") is ignored in lookup.
+            if (range.equals("*")) {
+                continue;
+            }
+
+            String rangeForRegex = range.replaceAll("\\x2A", "\\\\p{Alnum}*");
+            while (rangeForRegex.length() > 0) {
+                if (tag.matches(rangeForRegex)) {
+                    return true;
+                }
+                // Truncate from the end....
+                rangeForRegex = truncateRange(rangeForRegex);
+            }
+        }
+
+        return false;
+    }
+
+    /* Truncate the range from end during the lookup match */
+    private static String truncateRange(String rangeForRegex) {
+        int index = rangeForRegex.lastIndexOf('-');
+        if (index >= 0) {
+            rangeForRegex = rangeForRegex.substring(0, index);
+
+            // if range ends with an extension key, truncate it.
+            index = rangeForRegex.lastIndexOf('-');
+            if (index >= 0 && index == rangeForRegex.length() - 2) {
+                rangeForRegex
+                        = rangeForRegex.substring(0, rangeForRegex.length() - 2);
+            }
+        } else {
+            rangeForRegex = "";
+        }
+
+        return rangeForRegex;
+    }
+
+    /* Returns the split index of the priority list, if it contains
+     * language range(s) with quality weight as 0 i.e. q=0, else -1
+     */
+    private static int splitRanges(List<LanguageRange> priorityList) {
+        int size = priorityList.size();
+        for (int index = 0; index < size; index++) {
+            LanguageRange range = priorityList.get(index);
+            if (range.getWeight() == 0) {
+                return index;
+            }
+        }
+
+        return -1; // no q=0 range exists
+    }
+
     public static List<LanguageRange> parse(String ranges) {
         ranges = ranges.replaceAll(" ", "").toLowerCase(Locale.ROOT);
         if (ranges.startsWith("accept-language:")) {
diff --git a/jdk/src/java.base/unix/classes/sun/net/www/content-types.properties b/jdk/src/java.base/unix/classes/sun/net/www/content-types.properties
index 025e790..c02dfa6 100644
--- a/jdk/src/java.base/unix/classes/sun/net/www/content-types.properties
+++ b/jdk/src/java.base/unix/classes/sun/net/www/content-types.properties
@@ -144,6 +144,10 @@
 	file_extensions=.ustar;\
 	action=save
 
+audio/aac: \
+	description=Advanced Audio Coding Audio;\
+	file_extensions=.aac
+
 audio/basic: \
 	description=Basic Audio;\
 	file_extensions=.snd,.au;\
@@ -151,6 +155,22 @@
 	action=application;\
 	application=audiotool %s
 
+audio/flac: \
+	description=Free Lossless Audio Codec Audio;\
+	file_extensions=.flac
+
+audio/mp4: \
+	description=MPEG-4 Audio;\
+	file_extensions=.m4a
+
+audio/mpeg: \
+	description=MPEG Audio;\
+	file_extensions=.mp2,.mp3
+
+audio/ogg: \
+	description=Ogg Audio;\
+	file_extensions=.oga,.ogg,.opus,.spx
+
 audio/x-aiff: \
 	description=Audio Interchange Format File;\
 	file_extensions=.aifc,.aif,.aiff;\
@@ -178,6 +198,10 @@
 	action=browser;\
 	application=imagetool %s
 
+image/svg+xml: \
+	description=Scalable Vector Graphics;\
+	file_extensions=.svg,.svgz
+
 image/tiff: \
 	description=TIFF Image;\
 	file_extensions=.tif,.tiff;\
@@ -248,6 +272,10 @@
 	description=Structure Enhanced Text;\
 	file_extensions=.etx
 
+video/mp4: \
+	description=MPEG-4 Video;\
+	file_extensions=.m4v,.mp4
+
 video/mpeg: \
 	description=MPEG Video Clip;\
 	file_extensions=.mpg,.mpe,.mpeg;\
@@ -255,10 +283,18 @@
 	action=application;\
 	application=mpeg_play %s
 
+video/ogg: \
+	description=Ogg Video;\
+	file_extensions=.ogv
+
 video/quicktime: \
 	description=QuickTime Video Clip;\
 	file_extensions=.mov,.qt
 
+video/webm: \
+	description=WebM Video;\
+	file_extensions=.webm
+
 application/x-troff-msvideo: \
 	description=AVI Video;\
 	file_extensions=.avi;\
diff --git a/jdk/src/java.base/unix/native/libjava/ProcessHandleImpl_unix.c b/jdk/src/java.base/unix/native/libjava/ProcessHandleImpl_unix.c
index afbe1e2..6c0e1cc 100644
--- a/jdk/src/java.base/unix/native/libjava/ProcessHandleImpl_unix.c
+++ b/jdk/src/java.base/unix/native/libjava/ProcessHandleImpl_unix.c
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2014, 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2014, 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,6 @@
 #include <stdio.h>
 #include <errno.h>
 #include <fcntl.h>
-#include <pwd.h>
 #include <signal.h>
 #include <stdlib.h>
 #include <unistd.h>
@@ -46,6 +45,12 @@
 #include <sys/stat.h>
 #include <sys/wait.h>
 
+/* For POSIX-compliant getpwuid_r on Solaris */
+#if defined(__solaris__)
+#define _POSIX_PTHREAD_SEMANTICS
+#endif
+#include <pwd.h>
+
 #ifdef _AIX
 #include <sys/procfs.h>
 #endif
@@ -429,7 +434,9 @@
 
     if (nargs >= 1) {
         // Create a String array for nargs-1 elements
-        argsArray = (*env)->NewObjectArray(env, nargs - 1, JNU_ClassString(env), NULL);
+        jclass clazzString = JNU_ClassString(env);
+        CHECK_NULL(clazzString);
+        argsArray = (*env)->NewObjectArray(env, nargs - 1, clazzString, NULL);
         CHECK_NULL(argsArray);
 
         for (i = 0; i < nargs - 1; i++) {
@@ -468,12 +475,7 @@
     } else {
         struct passwd pwent;
         struct passwd* p = NULL;
-
-#ifdef __solaris__
-        RESTARTABLE_RETURN_PTR(getpwuid_r(uid, &pwent, pwbuf, (size_t)getpw_buf_size), p);
-#else
         RESTARTABLE(getpwuid_r(uid, &pwent, pwbuf, (size_t)getpw_buf_size, &p), result);
-#endif
 
         // Create the Java String if a name was found
         if (result == 0 && p != NULL &&
diff --git a/jdk/src/java.base/unix/native/libjava/java_props_md.c b/jdk/src/java.base/unix/native/libjava/java_props_md.c
index b03bd6a..78e1b7b 100644
--- a/jdk/src/java.base/unix/native/libjava/java_props_md.c
+++ b/jdk/src/java.base/unix/native/libjava/java_props_md.c
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1998, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1998, 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
@@ -68,11 +68,6 @@
 #endif
 #endif /* !_ALLBSD_SOURCE */
 
-#ifdef JAVASE_EMBEDDED
-#include <dlfcn.h>
-#include <sys/stat.h>
-#endif
-
 /* Take an array of string pairs (map of key->value) and a string (key).
  * Examine each pair in the map to see if the first string (key) matches the
  * string.  If so, store the second string of the pair (value) in the value and
@@ -350,36 +345,6 @@
     return 1;
 }
 
-#ifdef JAVASE_EMBEDDED
-/* Determine the default embedded toolkit based on whether libawt_xawt
- * exists in the JRE. This can still be overridden by -Dawt.toolkit=XXX
- */
-static char* getEmbeddedToolkit() {
-    Dl_info dlinfo;
-    char buf[MAXPATHLEN];
-    int32_t len;
-    char *p;
-    struct stat statbuf;
-
-    /* Get address of this library and the directory containing it. */
-    dladdr((void *)getEmbeddedToolkit, &dlinfo);
-    realpath((char *)dlinfo.dli_fname, buf);
-    len = strlen(buf);
-    p = strrchr(buf, '/');
-    /* Default AWT Toolkit on Linux and Solaris is XAWT (libawt_xawt.so). */
-    strncpy(p, "/libawt_xawt.so", MAXPATHLEN-len-1);
-    /* Check if it exists */
-    if (stat(buf, &statbuf) == -1 && errno == ENOENT) {
-        /* No - this is a reduced-headless-jre so use special HToolkit */
-        return "sun.awt.HToolkit";
-    }
-    else {
-        /* Yes - this is a headful JRE so fallback to SE defaults */
-        return NULL;
-    }
-}
-#endif
-
 /* This function gets called very early, before VM_CALLS are setup.
  * Do not use any of the VM_CALLS entries!!!
  */
@@ -424,10 +389,6 @@
     sprops.awt_headless = isInAquaSession() ? NULL : "true";
 #else
     sprops.graphics_env = "sun.awt.X11GraphicsEnvironment";
-#ifdef JAVASE_EMBEDDED
-    sprops.awt_toolkit = getEmbeddedToolkit();
-    if (sprops.awt_toolkit == NULL) // default as below
-#endif
     sprops.awt_toolkit = "sun.awt.X11.XToolkit";
 #endif
 
diff --git a/jdk/src/java.base/unix/native/libnio/fs/UnixNativeDispatcher.c b/jdk/src/java.base/unix/native/libnio/fs/UnixNativeDispatcher.c
index fe203cd..81b37db 100644
--- a/jdk/src/java.base/unix/native/libnio/fs/UnixNativeDispatcher.c
+++ b/jdk/src/java.base/unix/native/libnio/fs/UnixNativeDispatcher.c
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2008, 2015, 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
@@ -29,8 +29,6 @@
 #include <fcntl.h>
 #include <dirent.h>
 #include <unistd.h>
-#include <pwd.h>
-#include <grp.h>
 #include <errno.h>
 #include <dlfcn.h>
 #include <sys/types.h>
@@ -43,6 +41,13 @@
 #endif
 #include <sys/time.h>
 
+/* For POSIX-compliant getpwuid_r, getgrgid_r on Solaris */
+#if defined(__solaris__)
+#define _POSIX_PTHREAD_SEMANTICS
+#endif
+#include <pwd.h>
+#include <grp.h>
+
 #ifdef __solaris__
 #include <strings.h>
 #endif
@@ -1022,11 +1027,7 @@
         int res = 0;
 
         errno = 0;
-        #ifdef __solaris__
-            RESTARTABLE_RETURN_PTR(getpwuid_r((uid_t)uid, &pwent, pwbuf, (size_t)buflen), p);
-        #else
-            RESTARTABLE(getpwuid_r((uid_t)uid, &pwent, pwbuf, (size_t)buflen, &p), res);
-        #endif
+        RESTARTABLE(getpwuid_r((uid_t)uid, &pwent, pwbuf, (size_t)buflen, &p), res);
 
         if (res != 0 || p == NULL || p->pw_name == NULL || *(p->pw_name) == '\0') {
             /* not found or error */
@@ -1071,11 +1072,7 @@
         }
 
         errno = 0;
-        #ifdef __solaris__
-            RESTARTABLE_RETURN_PTR(getgrgid_r((gid_t)gid, &grent, grbuf, (size_t)buflen), g);
-        #else
-            RESTARTABLE(getgrgid_r((gid_t)gid, &grent, grbuf, (size_t)buflen, &g), res);
-        #endif
+        RESTARTABLE(getgrgid_r((gid_t)gid, &grent, grbuf, (size_t)buflen, &g), res);
 
         retry = 0;
         if (res != 0 || g == NULL || g->gr_name == NULL || *(g->gr_name) == '\0') {
@@ -1126,11 +1123,7 @@
         const char* name = (const char*)jlong_to_ptr(nameAddress);
 
         errno = 0;
-        #ifdef __solaris__
-            RESTARTABLE_RETURN_PTR(getpwnam_r(name, &pwent, pwbuf, (size_t)buflen), p);
-        #else
-            RESTARTABLE(getpwnam_r(name, &pwent, pwbuf, (size_t)buflen, &p), res);
-        #endif
+        RESTARTABLE(getpwnam_r(name, &pwent, pwbuf, (size_t)buflen, &p), res);
 
         if (res != 0 || p == NULL || p->pw_name == NULL || *(p->pw_name) == '\0') {
             /* not found or error */
@@ -1171,11 +1164,7 @@
         }
 
         errno = 0;
-        #ifdef __solaris__
-            RESTARTABLE_RETURN_PTR(getgrnam_r(name, &grent, grbuf, (size_t)buflen), g);
-        #else
-            RESTARTABLE(getgrnam_r(name, &grent, grbuf, (size_t)buflen, &g), res);
-        #endif
+        RESTARTABLE(getgrnam_r(name, &grent, grbuf, (size_t)buflen, &g), res);
 
         retry = 0;
         if (res != 0 || g == NULL || g->gr_name == NULL || *(g->gr_name) == '\0') {
diff --git a/jdk/src/java.base/windows/classes/sun/net/www/content-types.properties b/jdk/src/java.base/windows/classes/sun/net/www/content-types.properties
index ace2f13..34e8286 100644
--- a/jdk/src/java.base/windows/classes/sun/net/www/content-types.properties
+++ b/jdk/src/java.base/windows/classes/sun/net/www/content-types.properties
@@ -142,11 +142,31 @@
 	file_extensions=.ustar;\
 	action=save
 
+audio/aac: \
+	description=Advanced Audio Coding Audio;\
+	file_extensions=.aac
+
 audio/basic: \
 	description=Basic Audio;\
 	file_extensions=.snd,.au;\
 	icon=audio
 
+audio/flac: \
+	description=Free Lossless Audio Codec Audio;\
+	file_extensions=.flac
+
+audio/mp4: \
+	description=MPEG-4 Audio;\
+	file_extensions=.m4a
+
+audio/mpeg: \
+	description=MPEG Audio;\
+	file_extensions=.mp2,.mp3
+
+audio/ogg: \
+	description=Ogg Audio;\
+	file_extensions=.oga,.ogg,.opus,.spx
+
 audio/x-aiff: \
 	description=Audio Interchange Format File;\
 	file_extensions=.aifc,.aif,.aiff;\
@@ -175,6 +195,10 @@
 	icon=jpeg;\
 	action=browser
 
+image/svg+xml: \
+	description=Scalable Vector Graphics;\
+	file_extensions=.svg,.svgz
+
 image/tiff: \
 	description=TIFF Image;\
 	file_extensions=.tif,.tiff;\
@@ -245,15 +269,27 @@
 	description=Structure Enhanced Text;\
 	file_extensions=.etx
 
+video/mp4: \
+	description=MPEG-4 Video;\
+	file_extensions=.m4v,.mp4
+
 video/mpeg: \
 	description=MPEG Video Clip;\
 	file_extensions=.mpg,.mpe,.mpeg;\
 	icon=mpeg
 
+video/ogg: \
+	description=Ogg Video;\
+	file_extensions=.ogv
+
 video/quicktime: \
 	description=QuickTime Video Clip;\
 	file_extensions=.mov,.qt
 
+video/webm: \
+	description=WebM Video;\
+	file_extensions=.webm
+
 application/x-troff-msvideo: \
 	description=AVI Video;\
 	file_extensions=.avi;\
diff --git a/jdk/src/java.desktop/share/classes/com/sun/imageio/plugins/jpeg/JPEGImageReader.java b/jdk/src/java.desktop/share/classes/com/sun/imageio/plugins/jpeg/JPEGImageReader.java
index e7911bb..6fe6987 100644
--- a/jdk/src/java.desktop/share/classes/com/sun/imageio/plugins/jpeg/JPEGImageReader.java
+++ b/jdk/src/java.desktop/share/classes/com/sun/imageio/plugins/jpeg/JPEGImageReader.java
@@ -561,6 +561,7 @@
                         throw new IOException("skipImage : Found extra SOI"
                                 + " marker before getting to EOI");
                     case 0:
+                    case 255:
                     // markers which doesn't contain length data
                     case JPEG.RST0:
                     case JPEG.RST1:
diff --git a/jdk/src/java.desktop/share/classes/com/sun/imageio/plugins/tiff/TIFFImageWriter.java b/jdk/src/java.desktop/share/classes/com/sun/imageio/plugins/tiff/TIFFImageWriter.java
index d0d5c3e..9b5e754 100644
--- a/jdk/src/java.desktop/share/classes/com/sun/imageio/plugins/tiff/TIFFImageWriter.java
+++ b/jdk/src/java.desktop/share/classes/com/sun/imageio/plugins/tiff/TIFFImageWriter.java
@@ -263,15 +263,15 @@
     }
 
     public void setOutput(Object output) {
-        super.setOutput(output);
-
         if (output != null) {
-            reset();
-
             if (!(output instanceof ImageOutputStream)) {
                 throw new IllegalArgumentException
                     ("output not an ImageOutputStream!");
             }
+
+            // reset() must precede setOutput() as it sets output to null
+            reset();
+
             this.stream = (ImageOutputStream)output;
 
             //
@@ -312,6 +312,8 @@
         } else {
             this.stream = null;
         }
+
+        super.setOutput(output);
     }
 
     public IIOMetadata
diff --git a/jdk/src/java.desktop/share/classes/com/sun/imageio/plugins/tiff/TIFFJPEGCompressor.java b/jdk/src/java.desktop/share/classes/com/sun/imageio/plugins/tiff/TIFFJPEGCompressor.java
index 7b6cfcf..b1f1453 100644
--- a/jdk/src/java.desktop/share/classes/com/sun/imageio/plugins/tiff/TIFFJPEGCompressor.java
+++ b/jdk/src/java.desktop/share/classes/com/sun/imageio/plugins/tiff/TIFFJPEGCompressor.java
@@ -79,10 +79,8 @@
 
         try {
             IIORegistry registry = IIORegistry.getDefaultInstance();
-            Class<?> imageReaderClass =
-                Class.forName("javax.imageio.spi.ImageReaderSpi");
             Iterator<?> readerSPIs =
-                registry.getServiceProviders(imageReaderClass,
+                registry.getServiceProviders(ImageReaderSpi.class,
                                              new JPEGSPIFilter(),
                                              true);
             if(readerSPIs.hasNext()) {
diff --git a/jdk/src/java.desktop/share/classes/com/sun/java/swing/plaf/gtk/GTKGraphicsUtils.java b/jdk/src/java.desktop/share/classes/com/sun/java/swing/plaf/gtk/GTKGraphicsUtils.java
index a8868ff..b1b30da 100644
--- a/jdk/src/java.desktop/share/classes/com/sun/java/swing/plaf/gtk/GTKGraphicsUtils.java
+++ b/jdk/src/java.desktop/share/classes/com/sun/java/swing/plaf/gtk/GTKGraphicsUtils.java
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2002, 2006, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2002, 2016, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -49,16 +49,18 @@
         int componentState = context.getComponentState();
         if ((componentState & SynthConstants.DISABLED) ==
                               SynthConstants.DISABLED){
-            Color orgColor = g.getColor();
-            g.setColor(context.getStyle().getColor(context,
-                                                   GTKColorType.WHITE));
-            x += 1;
-            y += 1;
-            super.paintText(context, g, text, x, y, mnemonicIndex);
+            if (!GTKLookAndFeel.is3()) {
+                Color orgColor = g.getColor();
+                g.setColor(context.getStyle().getColor(context,
+                        GTKColorType.WHITE));
+                x += 1;
+                y += 1;
+                super.paintText(context, g, text, x, y, mnemonicIndex);
 
-            g.setColor(orgColor);
-            x -= 1;
-            y -= 1;
+                g.setColor(orgColor);
+                x -= 1;
+                y -= 1;
+            }
             super.paintText(context, g, text, x, y, mnemonicIndex);
         }
         else {
diff --git a/jdk/src/java.desktop/share/classes/com/sun/java/swing/plaf/gtk/GTKIconFactory.java b/jdk/src/java.desktop/share/classes/com/sun/java/swing/plaf/gtk/GTKIconFactory.java
index f19ac21..46f8d3f 100644
--- a/jdk/src/java.desktop/share/classes/com/sun/java/swing/plaf/gtk/GTKIconFactory.java
+++ b/jdk/src/java.desktop/share/classes/com/sun/java/swing/plaf/gtk/GTKIconFactory.java
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2002, 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2002, 2016, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -214,6 +214,18 @@
 
             Region region = context.getRegion();
             GTKStyle style = (GTKStyle) context.getStyle();
+            if (GTKLookAndFeel.is3() && region == Region.MENU) {
+                Object value = style.getClassSpecificValue("arrow-scaling");
+                if (value instanceof Number) {
+                    iconDimension = (int)(((Number) value).floatValue() *
+                            (style.getFont(context).getSize2D() +
+                            2 * style.getClassSpecificIntValue(context,
+                            "indicator-spacing", DEFAULT_ICON_SPACING)));
+                    if (iconDimension > 0) {
+                        return iconDimension;
+                    }
+                }
+            }
             iconDimension = style.getClassSpecificIntValue(context,
                     "indicator-size",
                     (region == Region.CHECK_BOX_MENU_ITEM ||
diff --git a/jdk/src/java.desktop/share/classes/com/sun/java/swing/plaf/gtk/GTKLookAndFeel.java b/jdk/src/java.desktop/share/classes/com/sun/java/swing/plaf/gtk/GTKLookAndFeel.java
index be422a6..fea2b08 100644
--- a/jdk/src/java.desktop/share/classes/com/sun/java/swing/plaf/gtk/GTKLookAndFeel.java
+++ b/jdk/src/java.desktop/share/classes/com/sun/java/swing/plaf/gtk/GTKLookAndFeel.java
@@ -65,12 +65,6 @@
      */
     static Map<Object, Object> aaTextInfo;
 
-    /**
-     * Solaris, or Linux with Sun JDS in a CJK Locale.
-     * Used to determine if Sun's high quality CJK fonts are present.
-     */
-    private static boolean isSunCJK;
-
     /*
      * Used to override if system (desktop) text anti-aliasing settings should
      * be used. The reasons for this are are is that currently its "off"
@@ -107,36 +101,6 @@
      */
     private static String gtkThemeName = "Default";
 
-    static {
-        String language = Locale.getDefault().getLanguage();
-        boolean cjkLocale =
-            (Locale.CHINESE.getLanguage().equals(language) ||
-             Locale.JAPANESE.getLanguage().equals(language) ||
-             Locale.KOREAN.getLanguage().equals(language));
-
-        if (cjkLocale) {
-            boolean isSunDesktop = false;
-            switch (OSInfo.getOSType()) {
-                case SOLARIS:
-                    isSunDesktop = true;
-                    break;
-
-                case LINUX:
-                    Boolean val = AccessController.doPrivileged(
-                                    new PrivilegedAction<Boolean>() {
-                                        public Boolean run() {
-                                            File f = new File("/etc/sun-release");
-                                            return Boolean.valueOf(f.exists());
-                                        }
-                                    });
-                    isSunDesktop = val.booleanValue();
-            }
-            if (isSunDesktop && !sun.java2d.SunGraphicsEnvironment.isOpenSolaris) {
-                isSunCJK = true;
-            }
-        }
-    }
-
     /**
      * Returns true if running on system containing at least 2.2.
      */
@@ -1474,19 +1438,10 @@
 
         /*
          * Check if system AA font settings should be used.
-         * Sun's JDS (for Linux and Solaris) ships with high quality CJK
-         * fonts and specifies via fontconfig that these be rendered in
-         * B&W to take advantage of the embedded bitmaps.
-         * If is a Sun CJK locale or remote display, indicate by the condition
-         * variable that in this case the L&F recommends ignoring desktop
-         * settings. On other Unixes (eg Linux) this doesn't apply.
-         * REMIND 1: The isSunCJK test is really just a place holder
-         * until we can properly query fontconfig and use the properties
-         * set for specific fonts.
-         * REMIND 2: See comment on isLocalDisplay() definition regarding
+         * REMIND: See comment on isLocalDisplay() definition regarding
          * XRender.
          */
-        gtkAAFontSettingsCond = !isSunCJK && SwingUtilities2.isLocalDisplay();
+        gtkAAFontSettingsCond = SwingUtilities2.isLocalDisplay();
         aaTextInfo = new HashMap<>(2);
         SwingUtilities2.putAATextInfo(gtkAAFontSettingsCond, aaTextInfo);
     }
diff --git a/jdk/src/java.desktop/share/classes/com/sun/java/swing/plaf/gtk/GTKPainter.java b/jdk/src/java.desktop/share/classes/com/sun/java/swing/plaf/gtk/GTKPainter.java
index 56ec905..9440891 100644
--- a/jdk/src/java.desktop/share/classes/com/sun/java/swing/plaf/gtk/GTKPainter.java
+++ b/jdk/src/java.desktop/share/classes/com/sun/java/swing/plaf/gtk/GTKPainter.java
@@ -649,10 +649,19 @@
             y += insets.top;
             if (orientation == JSeparator.HORIZONTAL) {
                 w -= (insets.left + insets.right);
-                detail = "hseparator";
             } else {
                 h -= (insets.top + insets.bottom);
-                detail = "vseparator";
+            }
+            if (GTKLookAndFeel.is3()) {
+                if (id == Region.POPUP_MENU_SEPARATOR) {
+                    detail = "menuitem";
+                    h -= (insets.top + insets.bottom);
+                } else {
+                    detail = "separator";
+                }
+            } else {
+                detail = orientation == JSeparator.HORIZONTAL ?
+                                                    "hseparator" : "vseparator";
             }
             synchronized (UNIXToolkit.GTK_LOCK) {
                 if (! ENGINE.paintCachedImage(g, x, y, w, h, id, state,
@@ -1381,8 +1390,13 @@
         if (gtkState == SynthConstants.MOUSE_OVER) {
             shadow = ShadowType.IN;
         }
+        if (!GTKLookAndFeel.is3()) {
+            x += 3;
+            y += 3;
+            w = h = 7;
+        }
         ENGINE.paintArrow(g, context, Region.MENU_ITEM, gtkState, shadow,
-                dir, "menuitem", x + 3, y + 3, 7, 7);
+                dir, "menuitem", x, y, w, h);
     }
 
     public void paintCheckBoxMenuItemCheckIcon(SynthContext context,
diff --git a/jdk/src/java.desktop/share/classes/java/awt/HeadlessException.java b/jdk/src/java.desktop/share/classes/java/awt/HeadlessException.java
index 5809ffd..55ba37b 100644
--- a/jdk/src/java.desktop/share/classes/java/awt/HeadlessException.java
+++ b/jdk/src/java.desktop/share/classes/java/awt/HeadlessException.java
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2000, 2014, 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
@@ -28,10 +28,14 @@
 /**
  * Thrown when code that is dependent on a keyboard, display, or mouse
  * is called in an environment that does not support a keyboard, display,
- * or mouse.
+ * or mouse. Any code that depends on any of those devices should firstly
+ * ensure their availability using the {@code GraphicsEnvironment.isHeadless()}
+ * method and throw {@code HeadlessException} if the latter returns
+ * {@code true}.
  *
  * @since 1.4
  * @author  Michael Martak
+ * @see GraphicsEnvironment#isHeadless
  */
 public class HeadlessException extends UnsupportedOperationException {
     /*
@@ -40,12 +44,24 @@
     private static final long serialVersionUID = 167183644944358563L;
 
     /**
-     * Constructs new {@code HeadlessException}
+     * Constructs new {@code HeadlessException} with empty message.
+     * For such {@code HeadlessException} the default headless error message
+     * may be auto-generated for some platforms.
+     * The text of the default headless message may depend on
+     * whether the GraphicsEnvironment is in fact headless.
+     * That is, the default headless message is both system and environmentally
+     * dependent.
      */
     public HeadlessException() {}
 
     /**
      * Create a new instance with the specified detailed error message.
+     * For some platforms the default headless error message may be
+     * added at the end of the specified message.
+     * The text of the default headless message may depend on
+     * whether the GraphicsEnvironment is in fact headless.
+     * That is, the default headless message is both system and environmentally
+     * dependent.
      *
      * @param  msg the error message
      */
@@ -54,7 +70,16 @@
     }
 
     /**
-     * {@inheritDoc}
+     * Returns the detail message string of this {@code HeadlessException}.
+     * Depending on the platform the message specified in the constructor may
+     * be followed by the default headless error message.
+     * The text of the default headless message may depend on
+     * whether the GraphicsEnvironment is in fact headless.
+     * That is, the default headless message is both system and environmentally
+     * dependent.
+     *
+     * @return  the detail message string of this {@code HeadlessException}
+     *          instance (which may be {@code null}).
      */
     public String getMessage() {
         String superMessage = super.getMessage();
diff --git a/jdk/src/java.desktop/share/classes/java/awt/TrayIcon.java b/jdk/src/java.desktop/share/classes/java/awt/TrayIcon.java
index 08ad08d..7c7a5f9 100644
--- a/jdk/src/java.desktop/share/classes/java/awt/TrayIcon.java
+++ b/jdk/src/java.desktop/share/classes/java/awt/TrayIcon.java
@@ -47,7 +47,8 @@
  * of the events by itself.  For example, by default, when the
  * right-mouse click is performed on the {@code TrayIcon} it
  * displays the specified popup menu.  When the mouse hovers
- * over the {@code TrayIcon} the tooltip is displayed.
+ * over the {@code TrayIcon} the tooltip is displayed (this behaviour is
+ * platform dependent).
  *
  * <p><strong>Note:</strong> When the {@code MouseEvent} is
  * dispatched to its registered listeners its {@code component}
@@ -174,7 +175,7 @@
 
     /**
      * Creates a {@code TrayIcon} with the specified image and
-     * tooltip text.
+     * tooltip text. Tooltip may be not visible on some platforms.
      *
      * @param image the {@code Image} to be used
      * @param tooltip the string to be used as tooltip text; if the
@@ -200,7 +201,7 @@
 
     /**
      * Creates a {@code TrayIcon} with the specified image,
-     * tooltip and popup menu.
+     * tooltip and popup menu. Tooltip may be not visible on some platforms.
      *
      * @param image the {@code Image} to be used
      * @param tooltip the string to be used as tooltip text; if the
@@ -330,8 +331,8 @@
     /**
      * Sets the tooltip string for this {@code TrayIcon}. The
      * tooltip is displayed automatically when the mouse hovers over
-     * the icon.  Setting the tooltip to {@code null} removes any
-     * tooltip text.
+     * the icon.  Tooltip may be not visible on some platforms.
+     * Setting the tooltip to {@code null} removes any tooltip text.
      *
      * When displayed, the tooltip string may be truncated on some platforms;
      * the number of characters that may be displayed is platform-dependent.
diff --git a/jdk/src/java.desktop/share/classes/java/awt/image/LookupOp.java b/jdk/src/java.desktop/share/classes/java/awt/image/LookupOp.java
index b83c100..2897c11 100644
--- a/jdk/src/java.desktop/share/classes/java/awt/image/LookupOp.java
+++ b/jdk/src/java.desktop/share/classes/java/awt/image/LookupOp.java
@@ -1,6 +1,6 @@
 
 /*
- * Copyright (c) 1997, 2014, 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
@@ -253,7 +253,6 @@
      */
     public final WritableRaster filter (Raster src, WritableRaster dst) {
         int numBands  = src.getNumBands();
-        int dstLength = dst.getNumBands();
         int height    = src.getHeight();
         int width     = src.getWidth();
         int srcPix[]  = new int[numBands];
@@ -268,7 +267,7 @@
                 IllegalArgumentException ("Width or height of Rasters do not "+
                                           "match");
         }
-        dstLength = dst.getNumBands();
+        int dstLength = dst.getNumBands();
 
         if (numBands != dstLength) {
             throw new
diff --git a/jdk/src/java.desktop/share/classes/javax/imageio/metadata/IIOMetadata.java b/jdk/src/java.desktop/share/classes/javax/imageio/metadata/IIOMetadata.java
index 76e28bc..c9ac737 100644
--- a/jdk/src/java.desktop/share/classes/javax/imageio/metadata/IIOMetadata.java
+++ b/jdk/src/java.desktop/share/classes/javax/imageio/metadata/IIOMetadata.java
@@ -414,14 +414,23 @@
         }
     }
 
+    // If updating this method also see the same in ImageReaderWriterSpi.java
     private Class<?> getMetadataFormatClass(String formatClassName) {
         Module thisModule = IIOMetadata.class.getModule();
         Module targetModule = this.getClass().getModule();
-        Class<?> c = Class.forName(targetModule, formatClassName);
+        Class<?> c = null;
+        try {
+            ClassLoader cl = this.getClass().getClassLoader();
+            c = Class.forName(formatClassName, false, cl);
+            if (!IIOMetadataFormat.class.isAssignableFrom(c)) {
+                return null;
+            }
+        } catch (ClassNotFoundException e) {
+        }
         if (thisModule.equals(targetModule) || c == null) {
             return c;
         }
-        if (thisModule.isNamed()) {
+        if (targetModule.isNamed()) {
             int i = formatClassName.lastIndexOf(".");
             String pn = i > 0 ? formatClassName.substring(0, i) : "";
             if (!targetModule.isExported(pn, thisModule)) {
diff --git a/jdk/src/java.desktop/share/classes/javax/imageio/plugins/tiff/TIFFField.java b/jdk/src/java.desktop/share/classes/javax/imageio/plugins/tiff/TIFFField.java
index 8a1fbf2..edcb086 100644
--- a/jdk/src/java.desktop/share/classes/javax/imageio/plugins/tiff/TIFFField.java
+++ b/jdk/src/java.desktop/share/classes/javax/imageio/plugins/tiff/TIFFField.java
@@ -517,18 +517,18 @@
      * @param count The number of data values.
      * @param data The actual data content of the field.
      *
-     * @throws NullPointerException if {@code tag&nbsp;==&nbsp;null}.
+     * @throws NullPointerException if {@code tag == null}.
      * @throws IllegalArgumentException if {@code type} is not
      * one of the {@code TIFFTag.TIFF_*} data type constants.
      * @throws IllegalArgumentException if {@code type} is an unacceptable
      * data type for the supplied {@code TIFFTag}.
-     * @throws IllegalArgumentException if {@code count&nbsp;&lt;&nbsp;0}.
-     * @throws IllegalArgumentException if {@code count&nbsp;&lt;&nbsp;1}
+     * @throws IllegalArgumentException if {@code count < 0}.
+     * @throws IllegalArgumentException if {@code count < 1}
      * and {@code type} is {@code TIFF_RATIONAL} or
      * {@code TIFF_SRATIONAL}.
-     * @throws IllegalArgumentException if {@code count&nbsp;&ne;&nbsp;1}
+     * @throws IllegalArgumentException if {@code count != 1}
      * and {@code type} is {@code TIFF_IFD_POINTER}.
-     * @throws NullPointerException if {@code data&nbsp;==&nbsp;null}.
+     * @throws NullPointerException if {@code data == null}.
      * @throws IllegalArgumentException if {@code data} is an instance of
      * a class incompatible with the specified type.
      * @throws IllegalArgumentException if the size of the data array is wrong.
@@ -632,12 +632,12 @@
      * @param type One of the {@code TIFFTag.TIFF_*} constants
      * indicating the data type of the field as written to the TIFF stream.
      * @param count The number of data values.
-     * @throws NullPointerException if {@code tag&nbsp;==&nbsp;null}.
+     * @throws NullPointerException if {@code tag == null}.
      * @throws IllegalArgumentException if {@code type} is not
      * one of the {@code TIFFTag.TIFF_*} data type constants.
      * @throws IllegalArgumentException if {@code type} is an unacceptable
      * data type for the supplied {@code TIFFTag}.
-     * @throws IllegalArgumentException if {@code count&nbsp;&lt;&nbsp;0}.
+     * @throws IllegalArgumentException if {@code count < 0}.
      * @see #TIFFField(TIFFTag,int,int,Object)
      */
     public TIFFField(TIFFTag tag, int type, int count) {
@@ -649,16 +649,16 @@
      * value.
      * The field will have type
      * {@link TIFFTag#TIFF_SHORT  TIFF_SHORT} if
-     * {@code val&nbsp;&lt;&nbsp;65536} and type
+     * {@code val < 65536} and type
      * {@link TIFFTag#TIFF_LONG TIFF_LONG} otherwise.  The count
      * of the field will be unity.
      *
      * @param tag The tag to associate with this field.
      * @param value The value to associate with this field.
-     * @throws NullPointerException if {@code tag&nbsp;==&nbsp;null}.
+     * @throws NullPointerException if {@code tag == null}.
      * @throws IllegalArgumentException if the derived type is unacceptable
      * for the supplied {@code TIFFTag}.
-     * @throws IllegalArgumentException if {@code value&nbsp;&lt;&nbsp;0}.
+     * @throws IllegalArgumentException if {@code value < 0}.
      */
     public TIFFField(TIFFTag tag, int value) {
         if(tag == null) {
@@ -705,19 +705,26 @@
      * @param offset The IFD offset.
      * @param dir The directory.
      *
-     * @throws NullPointerException if {@code tag&nbsp;==&nbsp;null}.
-     * @throws IllegalArgumentException if {@code type} is neither
-     * {@code TIFFTag.TIFF_LONG} nor {@code TIFFTag.TIFF_IFD_POINTER}.
+     * @throws NullPointerException if {@code tag == null}.
      * @throws IllegalArgumentException if {@code type} is an unacceptable
      * data type for the supplied {@code TIFFTag}.
-     * @throws IllegalArgumentException if {@code offset} is non-positive.
-     * @throws NullPointerException if {@code dir&nbsp;==&nbsp;null}.
+     * @throws IllegalArgumentException if {@code type} is neither
+     * {@code TIFFTag.TIFF_LONG} nor {@code TIFFTag.TIFF_IFD_POINTER}.
+     * @throws IllegalArgumentException if {@code offset <= 0}.
+     * @throws NullPointerException if {@code dir == null}.
      *
      * @see #TIFFField(TIFFTag,int,int,Object)
      */
     public TIFFField(TIFFTag tag, int type, long offset, TIFFDirectory dir) {
-        this(tag, type, 1, new long[] {offset});
-        if (type != TIFFTag.TIFF_LONG && type != TIFFTag.TIFF_IFD_POINTER) {
+        if (tag == null) {
+            throw new NullPointerException("tag == null!");
+        } else if (type < TIFFTag.MIN_DATATYPE || type > TIFFTag.MAX_DATATYPE) {
+            throw new IllegalArgumentException("Unknown data type "+type);
+        } else if (!tag.isDataTypeOK(type)) {
+            throw new IllegalArgumentException("Illegal data type " + type
+                + " for " + tag.getName() + " tag");
+        } else if (type != TIFFTag.TIFF_LONG
+                   && type != TIFFTag.TIFF_IFD_POINTER) {
             throw new IllegalArgumentException("type " + type
                 + " is neither TIFFTag.TIFF_LONG nor TIFFTag.TIFF_IFD_POINTER");
         } else if (offset <= 0) {
@@ -726,6 +733,13 @@
         } else if (dir == null) {
             throw new NullPointerException("dir == null");
         }
+
+        this.tag = tag;
+        this.tagNumber = tag.getNumber();
+        this.type = type;
+        this.count = 1;
+        this.data = new long[] {offset};
+
         this.dir = dir;
     }
 
@@ -739,7 +753,7 @@
     }
 
     /**
-     * Retrieves the tag number in the range {@code [0,&nbsp;65535]}.
+     * Retrieves the tag number in the range {@code [0,65535]}.
      *
      * @return The tag number.
      */
@@ -804,7 +818,7 @@
      *
      * @throws IllegalArgumentException if {@code dataType} is not
      * one of the {@code TIFFTag.TIFF_*} data type constants.
-     * @throws IllegalArgumentException if {@code count&nbsp;&lt;&nbsp;0}.
+     * @throws IllegalArgumentException if {@code count < 0}.
      */
     public static Object createArrayForType(int dataType, int count) {
         if(count < 0) {
diff --git a/jdk/src/java.desktop/share/classes/javax/imageio/plugins/tiff/TIFFTag.java b/jdk/src/java.desktop/share/classes/javax/imageio/plugins/tiff/TIFFTag.java
index c312bd5..33f88f9 100644
--- a/jdk/src/java.desktop/share/classes/javax/imageio/plugins/tiff/TIFFTag.java
+++ b/jdk/src/java.desktop/share/classes/javax/imageio/plugins/tiff/TIFFTag.java
@@ -334,8 +334,8 @@
      * an IFD pointer if and only if its {@code TIFFTagSet} is
      * non-{@code null} or the data type {@code TIFF_IFD_POINTER} is
      * legal. This condition will be satisfied if and only if either
-     * {@code getTagSet()&nbsp;!=&nbsp;null} or
-     * {@code isDataTypeOK(TIFF_IFD_POINTER)&nbsp;==&nbsp;true}.
+     * {@code getTagSet() != null} or
+     * {@code isDataTypeOK(TIFF_IFD_POINTER) == true}.
      *
      * <p>Many TIFF extensions use the IFD mechanism in order to limit the
      * number of new tags that may appear in the root IFD.</p>
diff --git a/jdk/src/java.desktop/share/classes/javax/imageio/spi/ImageReaderWriterSpi.java b/jdk/src/java.desktop/share/classes/javax/imageio/spi/ImageReaderWriterSpi.java
index d46711a..e5961b9 100644
--- a/jdk/src/java.desktop/share/classes/javax/imageio/spi/ImageReaderWriterSpi.java
+++ b/jdk/src/java.desktop/share/classes/javax/imageio/spi/ImageReaderWriterSpi.java
@@ -604,14 +604,23 @@
         }
     }
 
+    // If updating this method also see the same in IIOMetadata.java
     private Class<?> getMetadataFormatClass(String formatClassName) {
         Module thisModule = ImageReaderWriterSpi.class.getModule();
         Module targetModule = this.getClass().getModule();
-        Class<?> c = Class.forName(targetModule, formatClassName);
+        Class<?> c = null;
+        try {
+            ClassLoader cl = this.getClass().getClassLoader();
+            c = Class.forName(formatClassName, false, cl);
+            if (!IIOMetadataFormat.class.isAssignableFrom(c)) {
+                return null;
+            }
+        } catch (ClassNotFoundException e) {
+        }
         if (thisModule.equals(targetModule) || c == null) {
             return c;
         }
-        if (thisModule.isNamed()) {
+        if (targetModule.isNamed()) {
             int i = formatClassName.lastIndexOf(".");
             String pn = i > 0 ? formatClassName.substring(0, i) : "";
             if (!targetModule.isExported(pn, thisModule)) {
diff --git a/jdk/src/java.desktop/share/classes/javax/swing/event/TableModelEvent.java b/jdk/src/java.desktop/share/classes/javax/swing/event/TableModelEvent.java
index 508d7db..1ece19e 100644
--- a/jdk/src/java.desktop/share/classes/javax/swing/event/TableModelEvent.java
+++ b/jdk/src/java.desktop/share/classes/javax/swing/event/TableModelEvent.java
@@ -177,7 +177,7 @@
      * @param lastRow  the last row affected by this event
      * @param column the column index of cells changed; {@code ALL_COLUMNS}
      *        signifies all cells in the specified range of rows are changed.
-     * @param type the type of change signified by this even, @code INSERT},
+     * @param type the type of change signified by this even, {@code INSERT},
      *        {@code DELETE } or {@code UPDATE}
      */
     public TableModelEvent(TableModel source, int firstRow, int lastRow, int column, int type) {
diff --git a/jdk/src/java.desktop/share/classes/javax/swing/plaf/basic/BasicButtonListener.java b/jdk/src/java.desktop/share/classes/javax/swing/plaf/basic/BasicButtonListener.java
index 1fda40e..3a18833 100644
--- a/jdk/src/java.desktop/share/classes/javax/swing/plaf/basic/BasicButtonListener.java
+++ b/jdk/src/java.desktop/share/classes/javax/swing/plaf/basic/BasicButtonListener.java
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1997, 2014, 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
@@ -229,10 +229,13 @@
           AbstractButton b = (AbstractButton) e.getSource();
 
           if(b.contains(e.getX(), e.getY())) {
-              long multiClickThreshhold = b.getMultiClickThreshhold();
               long lastTime = lastPressedTimestamp;
-              long currentTime = lastPressedTimestamp = e.getWhen();
-              if (lastTime != -1 && currentTime - lastTime < multiClickThreshhold) {
+              lastPressedTimestamp = e.getWhen();
+              long timeSinceLastClick = lastPressedTimestamp - lastTime;
+              if (lastTime != -1 &&
+                  timeSinceLastClick > 0 &&
+                  timeSinceLastClick < b.getMultiClickThreshhold()) {
+
                   shouldDiscardRelease = true;
                   return;
               }
@@ -325,4 +328,4 @@
                     !((AbstractButton)sender).getModel().isEnabled());
         }
     }
-}
\ No newline at end of file
+}
diff --git a/jdk/src/java.desktop/share/classes/javax/swing/plaf/basic/BasicTextUI.java b/jdk/src/java.desktop/share/classes/javax/swing/plaf/basic/BasicTextUI.java
index 2941cc9..64894fb 100644
--- a/jdk/src/java.desktop/share/classes/javax/swing/plaf/basic/BasicTextUI.java
+++ b/jdk/src/java.desktop/share/classes/javax/swing/plaf/basic/BasicTextUI.java
@@ -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
@@ -940,9 +940,10 @@
                 rootView.setSize(d.width - i.left - i.right -
                         caretMargin, d.height - i.top - i.bottom);
             }
-            else if (d.width <= 0 || d.height <= 0) {
+            else if (!rootViewInitialized && (d.width <= 0 || d.height <= 0)) {
                 // Probably haven't been layed out yet, force some sort of
                 // initial sizing.
+                rootViewInitialized = true;
                 rootView.setSize(Integer.MAX_VALUE, Integer.MAX_VALUE);
             }
             d.width = (int) Math.min((long) rootView.getPreferredSpan(View.X_AXIS) +
@@ -1346,6 +1347,7 @@
     private static final Position.Bias[] discardBias = new Position.Bias[1];
     private DefaultCaret dropCaret;
     private int caretMargin;
+    private boolean rootViewInitialized;
 
     /**
      * Root view that acts as a gateway between the component
diff --git a/jdk/src/java.desktop/share/classes/sun/awt/FontConfiguration.java b/jdk/src/java.desktop/share/classes/sun/awt/FontConfiguration.java
index b4deece..d5190db 100644
--- a/jdk/src/java.desktop/share/classes/sun/awt/FontConfiguration.java
+++ b/jdk/src/java.desktop/share/classes/sun/awt/FontConfiguration.java
@@ -251,12 +251,24 @@
 
     private File findImpl(String fname) {
         File f = new File(fname + ".properties");
+        if (FontUtilities.debugFonts()) {
+            logger.info("Looking for text fontconfig file : " + f);
+        }
         if (f.canRead()) {
+            if (FontUtilities.debugFonts()) {
+                logger.info("Found file : " + f);
+            }
             isProperties = true;
             return f;
         }
         f = new File(fname + ".bfc");
+        if (FontUtilities.debugFonts()) {
+            logger.info("Looking for binary fontconfig file : " + f);
+        }
         if (f.canRead()) {
+            if (FontUtilities.debugFonts()) {
+                logger.info("Found file : " + f);
+            }
             isProperties = false;
             return f;
         }
@@ -305,6 +317,9 @@
         if (configFile != null) {
             return configFile;
         }
+        if (FontUtilities.debugFonts()) {
+            logger.info("Did not find a fontconfig file.");
+        }
         return null;
     }
 
diff --git a/jdk/src/java.desktop/share/classes/sun/awt/IconInfo.java b/jdk/src/java.desktop/share/classes/sun/awt/IconInfo.java
index 8473fde..4d3e044 100644
--- a/jdk/src/java.desktop/share/classes/sun/awt/IconInfo.java
+++ b/jdk/src/java.desktop/share/classes/sun/awt/IconInfo.java
@@ -25,10 +25,12 @@
 package sun.awt;
 import java.awt.*;
 import java.awt.color.*;
+import java.awt.geom.AffineTransform;
 import java.awt.image.*;
 import sun.awt.image.ToolkitImage;
 import sun.awt.image.ImageRepresentation;
 import java.util.Arrays;
+import sun.java2d.pipe.Region;
 
 public class IconInfo {
     /**
@@ -101,7 +103,7 @@
         }
         this.scaledWidth = width;
         this.scaledHeight = height;
-        this.rawLength = width * height + 2;
+        this.rawLength = getScaledRawLength();
     }
 
     /*
@@ -110,7 +112,27 @@
     public void setScaledSize(int width, int height) {
         this.scaledWidth = width;
         this.scaledHeight = height;
-        this.rawLength = width * height + 2;
+        this.rawLength = getScaledRawLength();
+    }
+
+    /*
+    * returns scaled raw length.
+     */
+    private int getScaledRawLength() {
+        int scaledWidthAndHeight[] = getScaledWidthAndHeight(width, height);
+        return scaledWidthAndHeight[0] * scaledWidthAndHeight[1] + 2;
+    }
+
+    /*
+    * returns the scaled width and height.
+     */
+    private static int[] getScaledWidthAndHeight(int width, int height) {
+        AffineTransform tx = GraphicsEnvironment.getLocalGraphicsEnvironment().
+                getDefaultScreenDevice().getDefaultConfiguration().
+                getDefaultTransform();
+        int w = Region.clipScale(width, tx.getScaleX());
+        int h = Region.clipScale(height, tx.getScaleY());
+        return new int[]{w, h};
     }
 
     public boolean isValid() {
@@ -215,6 +237,9 @@
             new DirectColorModel(ColorSpace.getInstance(ColorSpace.CS_sRGB), 32,
                                  0x00ff0000, 0x0000ff00, 0x000000ff, 0xff000000,
                                  false, DataBuffer.TYPE_INT);
+        int scaledWidthAndHeight[] = getScaledWidthAndHeight(width, height);
+        width = scaledWidthAndHeight[0];
+        height = scaledWidthAndHeight[1];
         DataBufferInt buffer = new DataBufferInt(width * height);
         WritableRaster raster =
             Raster.createPackedRaster(buffer, width, height,
diff --git a/jdk/src/java.desktop/share/classes/sun/awt/RequestFocusController.java b/jdk/src/java.desktop/share/classes/sun/awt/RequestFocusController.java
index 29c94c6..61a6191 100644
--- a/jdk/src/java.desktop/share/classes/sun/awt/RequestFocusController.java
+++ b/jdk/src/java.desktop/share/classes/sun/awt/RequestFocusController.java
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2006, 2016 Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2006, 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
diff --git a/jdk/src/java.desktop/share/classes/sun/font/FontUtilities.java b/jdk/src/java.desktop/share/classes/sun/font/FontUtilities.java
index bfbd455..0a243cd 100644
--- a/jdk/src/java.desktop/share/classes/sun/font/FontUtilities.java
+++ b/jdk/src/java.desktop/share/classes/sun/font/FontUtilities.java
@@ -50,12 +50,6 @@
 
     public static boolean isMacOSX;
 
-    public static boolean isSolaris8;
-
-    public static boolean isSolaris9;
-
-    public static boolean isOpenSolaris;
-
     public static boolean useT2K;
 
     public static boolean isWindows;
@@ -88,37 +82,6 @@
                 } else {
                     useT2K = false;
                 }
-                if (isSolaris) {
-                    String version = System.getProperty("os.version", "0.0");
-                    isSolaris8 = version.startsWith("5.8");
-                    isSolaris9 = version.startsWith("5.9");
-                    float ver = Float.parseFloat(version);
-                    if (ver > 5.10f) {
-                        File f = new File("/etc/release");
-                        String line = null;
-                        try {
-                            FileInputStream fis = new FileInputStream(f);
-                            InputStreamReader isr = new InputStreamReader(
-                                                            fis, "ISO-8859-1");
-                            BufferedReader br = new BufferedReader(isr);
-                            line = br.readLine();
-                            fis.close();
-                        } catch (Exception ex) {
-                            // Nothing to do here.
-                        }
-                        if (line != null && line.indexOf("OpenSolaris") >= 0) {
-                            isOpenSolaris = true;
-                        } else {
-                            isOpenSolaris = false;
-                        }
-                    } else {
-                        isOpenSolaris = false;
-                    }
-                } else {
-                    isSolaris8 = false;
-                    isSolaris9 = false;
-                    isOpenSolaris = false;
-                }
                 isWindows = osName.startsWith("Windows");
                 String jreLibDirName = System.getProperty("java.home", "")
                                                       + File.separator + "lib";
diff --git a/jdk/src/java.desktop/share/classes/sun/font/TrueTypeGlyphMapper.java b/jdk/src/java.desktop/share/classes/sun/font/TrueTypeGlyphMapper.java
index de79dbb..fee43f1 100644
--- a/jdk/src/java.desktop/share/classes/sun/font/TrueTypeGlyphMapper.java
+++ b/jdk/src/java.desktop/share/classes/sun/font/TrueTypeGlyphMapper.java
@@ -32,8 +32,6 @@
 
     static final char REVERSE_SOLIDUS = 0x005c; // the backslash char.
     static final char JA_YEN = 0x00a5;
-    static final char JA_FULLWIDTH_TILDE_CHAR = 0xff5e;
-    static final char JA_WAVE_DASH_CHAR = 0x301c;
 
     /* if running on Solaris and default Locale is ja_JP then
      * we map need to remap reverse solidus (backslash) to Yen as
@@ -41,7 +39,6 @@
      */
     static final boolean isJAlocale = Locale.JAPAN.equals(Locale.getDefault());
     private final boolean needsJAremapping;
-    private boolean remapJAWaveDash;
 
     TrueTypeFont font;
     CMap cmap;
@@ -66,10 +63,6 @@
         }
         if (FontUtilities.isSolaris && isJAlocale && font.supportsJA()) {
             needsJAremapping = true;
-            if (FontUtilities.isSolaris8 &&
-                getGlyphFromCMAP(JA_WAVE_DASH_CHAR) == missingGlyph) {
-                remapJAWaveDash = true;
-            }
         } else {
             needsJAremapping = false;
         }
@@ -113,35 +106,12 @@
         cmap = CMap.theNullCmap;
     }
 
-    @SuppressWarnings("fallthrough")
     private final char remapJAChar(char unicode) {
-        switch (unicode) {
-        case REVERSE_SOLIDUS:
-            return JA_YEN;
-            /* This is a workaround for bug 4533422.
-             * Japanese wave dash missing from Solaris JA TrueType fonts.
-             */
-        case JA_WAVE_DASH_CHAR:
-            if (remapJAWaveDash) {
-                return JA_FULLWIDTH_TILDE_CHAR;
-            }
-        default: return unicode;
-        }
+        return (unicode == REVERSE_SOLIDUS) ? JA_YEN : unicode;
     }
-    @SuppressWarnings("fallthrough")
+
     private final int remapJAIntChar(int unicode) {
-        switch (unicode) {
-        case REVERSE_SOLIDUS:
-            return JA_YEN;
-            /* This is a workaround for bug 4533422.
-             * Japanese wave dash missing from Solaris JA TrueType fonts.
-             */
-        case JA_WAVE_DASH_CHAR:
-            if (remapJAWaveDash) {
-                return JA_FULLWIDTH_TILDE_CHAR;
-            }
-        default: return unicode;
-        }
+        return (unicode == REVERSE_SOLIDUS) ? JA_YEN : unicode;
     }
 
     public int charToGlyph(char unicode) {
diff --git a/jdk/src/java.desktop/share/classes/sun/java2d/pipe/RenderingEngine.java b/jdk/src/java.desktop/share/classes/sun/java2d/pipe/RenderingEngine.java
index 146c11a..b8c3bc7 100644
--- a/jdk/src/java.desktop/share/classes/sun/java2d/pipe/RenderingEngine.java
+++ b/jdk/src/java.desktop/share/classes/sun/java2d/pipe/RenderingEngine.java
@@ -297,7 +297,7 @@
      * If {@code lw1} and {@code lw2} are both greater than zero, then
      * the parallelogram figure is doubled by both expanding and contracting
      * each delta vector by its corresponding {@code lw} value.
-     * If either (@code lw1) or {@code lw2} are also greater than 1, then
+     * If either {@code lw1} or {@code lw2} are also greater than 1, then
      * the inner (contracted) parallelogram disappears and the figure is
      * simply a single expanded parallelogram.
      * The {@code clip} parameter specifies the current clip in effect
diff --git a/jdk/src/java.desktop/share/classes/sun/print/PSPrinterJob.java b/jdk/src/java.desktop/share/classes/sun/print/PSPrinterJob.java
index 511fd3a..abe8bd9 100644
--- a/jdk/src/java.desktop/share/classes/sun/print/PSPrinterJob.java
+++ b/jdk/src/java.desktop/share/classes/sun/print/PSPrinterJob.java
@@ -105,6 +105,7 @@
 
 //REMIND: Remove use of this class when IPPPrintService is moved to share directory.
 import java.lang.reflect.Method;
+import javax.print.attribute.standard.JobSheets;
 
 /**
  * A class which initiates and executes a PostScript printer job.
@@ -1573,10 +1574,10 @@
 
     private String[] printExecCmd(String printer, String options,
                                   boolean noJobSheet,
-                                  String banner, int copies, String spoolFile) {
+                                  String jobTitle, int copies, String spoolFile) {
         int PRINTER = 0x1;
         int OPTIONS = 0x2;
-        int BANNER  = 0x4;
+        int JOBTITLE  = 0x4;
         int COPIES  = 0x8;
         int NOSHEET = 0x10;
         int pFlags = 0;
@@ -1592,8 +1593,8 @@
             pFlags |= OPTIONS;
             ncomps+=1;
         }
-        if (banner != null && !banner.equals("")) {
-            pFlags |= BANNER;
+        if (jobTitle != null && !jobTitle.equals("")) {
+            pFlags |= JOBTITLE;
             ncomps+=1;
         }
         if (copies > 1) {
@@ -1603,23 +1604,29 @@
         if (noJobSheet) {
             pFlags |= NOSHEET;
             ncomps+=1;
+        } else if (getPrintService().
+                        isAttributeCategorySupported(JobSheets.class)) {
+            ncomps+=1; // for jobsheet
         }
 
-       String osname = System.getProperty("os.name");
-       if (osname.equals("Linux") || osname.contains("OS X")) {
+        String osname = System.getProperty("os.name");
+        if (osname.equals("Linux") || osname.contains("OS X")) {
             execCmd = new String[ncomps];
             execCmd[n++] = "/usr/bin/lpr";
             if ((pFlags & PRINTER) != 0) {
                 execCmd[n++] = "-P" + printer;
             }
-            if ((pFlags & BANNER) != 0) {
-                execCmd[n++] = "-J"  + banner;
+            if ((pFlags & JOBTITLE) != 0) {
+                execCmd[n++] = "-J"  + jobTitle;
             }
             if ((pFlags & COPIES) != 0) {
                 execCmd[n++] = "-#" + copies;
             }
             if ((pFlags & NOSHEET) != 0) {
                 execCmd[n++] = "-h";
+            } else if (getPrintService().
+                        isAttributeCategorySupported(JobSheets.class)) {
+                execCmd[n++] = "-o job-sheets=standard";
             }
             if ((pFlags & OPTIONS) != 0) {
                 execCmd[n++] = new String(options);
@@ -1632,14 +1639,17 @@
             if ((pFlags & PRINTER) != 0) {
                 execCmd[n++] = "-d" + printer;
             }
-            if ((pFlags & BANNER) != 0) {
-                execCmd[n++] = "-t"  + banner;
+            if ((pFlags & JOBTITLE) != 0) {
+                execCmd[n++] = "-t"  + jobTitle;
             }
             if ((pFlags & COPIES) != 0) {
                 execCmd[n++] = "-n" + copies;
             }
             if ((pFlags & NOSHEET) != 0) {
                 execCmd[n++] = "-o nobanner";
+            } else if (getPrintService().
+                        isAttributeCategorySupported(JobSheets.class)) {
+                execCmd[n++] = "-o job-sheets=standard";
             }
             if ((pFlags & OPTIONS) != 0) {
                 execCmd[n++] = "-o" + options;
diff --git a/jdk/src/java.desktop/share/classes/sun/print/PSStreamPrintService.java b/jdk/src/java.desktop/share/classes/sun/print/PSStreamPrintService.java
index 3bfb757..20a3db3 100644
--- a/jdk/src/java.desktop/share/classes/sun/print/PSStreamPrintService.java
+++ b/jdk/src/java.desktop/share/classes/sun/print/PSStreamPrintService.java
@@ -283,7 +283,16 @@
         } else if (category == OrientationRequested.class) {
             if (flavor == null ||
                 flavor.equals(DocFlavor.SERVICE_FORMATTED.PAGEABLE) ||
-                flavor.equals(DocFlavor.SERVICE_FORMATTED.PRINTABLE)) {
+                flavor.equals(DocFlavor.SERVICE_FORMATTED.PRINTABLE) ||
+                flavor.equals(DocFlavor.INPUT_STREAM.GIF) ||
+                flavor.equals(DocFlavor.INPUT_STREAM.JPEG) ||
+                flavor.equals(DocFlavor.INPUT_STREAM.PNG) ||
+                flavor.equals(DocFlavor.BYTE_ARRAY.GIF) ||
+                flavor.equals(DocFlavor.BYTE_ARRAY.JPEG) ||
+                flavor.equals(DocFlavor.BYTE_ARRAY.PNG) ||
+                flavor.equals(DocFlavor.URL.GIF) ||
+                flavor.equals(DocFlavor.URL.JPEG) ||
+                flavor.equals(DocFlavor.URL.PNG)) {
                 OrientationRequested []arr = new OrientationRequested[3];
                 arr[0] = OrientationRequested.PORTRAIT;
                 arr[1] = OrientationRequested.LANDSCAPE;
diff --git a/jdk/src/java.desktop/share/classes/sun/print/RasterPrinterJob.java b/jdk/src/java.desktop/share/classes/sun/print/RasterPrinterJob.java
index cd6793a..e2813a5 100644
--- a/jdk/src/java.desktop/share/classes/sun/print/RasterPrinterJob.java
+++ b/jdk/src/java.desktop/share/classes/sun/print/RasterPrinterJob.java
@@ -1271,6 +1271,12 @@
         JobSheets jobSheets = (JobSheets)attributes.get(JobSheets.class);
         if (jobSheets != null) {
             noJobSheet = jobSheets == JobSheets.NONE;
+        } else {
+            JobSheets js = (JobSheets)getPrintService().
+                                      getDefaultAttributeValue(JobSheets.class);
+            if (js != null && js.equals(JobSheets.NONE)) {
+                noJobSheet = true;
+            }
         }
 
         JobName jobName = (JobName)attributes.get(JobName.class);
diff --git a/jdk/src/java.desktop/share/classes/sun/print/ServiceDialog.java b/jdk/src/java.desktop/share/classes/sun/print/ServiceDialog.java
index 58565e1..ba2f637 100644
--- a/jdk/src/java.desktop/share/classes/sun/print/ServiceDialog.java
+++ b/jdk/src/java.desktop/share/classes/sun/print/ServiceDialog.java
@@ -2759,10 +2759,10 @@
             if (js == null) {
                 js = (JobSheets)psCurrent.getDefaultAttributeValue(jsCategory);
                 if (js == null) {
-                    js = JobSheets.NONE;
+                    js = JobSheets.STANDARD;
                 }
             }
-            cbJobSheets.setSelected(js != JobSheets.NONE);
+            cbJobSheets.setSelected(js != JobSheets.NONE && jsSupported);
             cbJobSheets.setEnabled(jsSupported);
 
             // setup JobPriority spinner
diff --git a/jdk/src/java.desktop/share/native/libawt/java2d/loops/GraphicsPrimitiveMgr.c b/jdk/src/java.desktop/share/native/libawt/java2d/loops/GraphicsPrimitiveMgr.c
index 742dfeb..6a70d40 100644
--- a/jdk/src/java.desktop/share/native/libawt/java2d/loops/GraphicsPrimitiveMgr.c
+++ b/jdk/src/java.desktop/share/native/libawt/java2d/loops/GraphicsPrimitiveMgr.c
@@ -104,40 +104,47 @@
     {
         return;
     }
-    RegisterID = (*env)->GetStaticMethodID(env, GPMgr,
-                                           RegisterName, RegisterSig);
-    pNativePrimID = (*env)->GetFieldID(env, GP, "pNativePrim", "J");
-    pixelID = (*env)->GetFieldID(env, SG2D, "pixel", "I");
-    eargbID = (*env)->GetFieldID(env, SG2D, "eargb", "I");
-    clipRegionID = (*env)->GetFieldID(env, SG2D, "clipRegion",
-                                      "Lsun/java2d/pipe/Region;");
-    compositeID = (*env)->GetFieldID(env, SG2D, "composite",
-                                     "Ljava/awt/Composite;");
-    lcdTextContrastID =
-        (*env)->GetFieldID(env, SG2D, "lcdTextContrast", "I");
-    getRgbID = (*env)->GetMethodID(env, Color, "getRGB", "()I");
-    xorPixelID = (*env)->GetFieldID(env, XORComp, "xorPixel", "I");
-    xorColorID = (*env)->GetFieldID(env, XORComp, "xorColor",
-                                    "Ljava/awt/Color;");
-    alphaMaskID = (*env)->GetFieldID(env, XORComp, "alphaMask", "I");
-    ruleID = (*env)->GetFieldID(env, AlphaComp, "rule", "I");
-    extraAlphaID = (*env)->GetFieldID(env, AlphaComp, "extraAlpha", "F");
+    CHECK_NULL(RegisterID =
+        (*env)->GetStaticMethodID(env, GPMgr, RegisterName, RegisterSig));
+    CHECK_NULL(pNativePrimID = (*env)->GetFieldID(env, GP, "pNativePrim", "J"));
+    CHECK_NULL(pixelID = (*env)->GetFieldID(env, SG2D, "pixel", "I"));
+    CHECK_NULL(eargbID = (*env)->GetFieldID(env, SG2D, "eargb", "I"));
+    CHECK_NULL(clipRegionID =
+        (*env)->GetFieldID(env, SG2D, "clipRegion", "Lsun/java2d/pipe/Region;"));
+    CHECK_NULL(compositeID =
+        (*env)->GetFieldID(env, SG2D, "composite", "Ljava/awt/Composite;"));
+    CHECK_NULL(lcdTextContrastID =
+        (*env)->GetFieldID(env, SG2D, "lcdTextContrast", "I"));
+    CHECK_NULL(getRgbID = (*env)->GetMethodID(env, Color, "getRGB", "()I"));
+    CHECK_NULL(xorPixelID = (*env)->GetFieldID(env, XORComp, "xorPixel", "I"));
+    CHECK_NULL(xorColorID =
+        (*env)->GetFieldID(env, XORComp, "xorColor", "Ljava/awt/Color;"));
+    CHECK_NULL(alphaMaskID =
+        (*env)->GetFieldID(env, XORComp, "alphaMask", "I"));
+    CHECK_NULL(ruleID = (*env)->GetFieldID(env, AlphaComp, "rule", "I"));
+    CHECK_NULL(extraAlphaID =
+        (*env)->GetFieldID(env, AlphaComp, "extraAlpha", "F"));
 
 
-    m00ID = (*env)->GetFieldID(env, AT, "m00", "D");
-    m01ID = (*env)->GetFieldID(env, AT, "m01", "D");
-    m02ID = (*env)->GetFieldID(env, AT, "m02", "D");
-    m10ID = (*env)->GetFieldID(env, AT, "m10", "D");
-    m11ID = (*env)->GetFieldID(env, AT, "m11", "D");
-    m12ID = (*env)->GetFieldID(env, AT, "m12", "D");
+    CHECK_NULL(m00ID = (*env)->GetFieldID(env, AT, "m00", "D"));
+    CHECK_NULL(m01ID = (*env)->GetFieldID(env, AT, "m01", "D"));
+    CHECK_NULL(m02ID = (*env)->GetFieldID(env, AT, "m02", "D"));
+    CHECK_NULL(m10ID = (*env)->GetFieldID(env, AT, "m10", "D"));
+    CHECK_NULL(m11ID = (*env)->GetFieldID(env, AT, "m11", "D"));
+    CHECK_NULL(m12ID = (*env)->GetFieldID(env, AT, "m12", "D"));
 
-    path2DTypesID = (*env)->GetFieldID(env, Path2D, "pointTypes", "[B");
-    path2DNumTypesID = (*env)->GetFieldID(env, Path2D, "numTypes", "I");
-    path2DWindingRuleID = (*env)->GetFieldID(env, Path2D, "windingRule", "I");
-    path2DFloatCoordsID = (*env)->GetFieldID(env, Path2DFloat,
-                                             "floatCoords", "[F");
-    sg2dStrokeHintID = (*env)->GetFieldID(env, SG2D, "strokeHint", "I");
-    fid = (*env)->GetStaticFieldID(env, SHints, "INTVAL_STROKE_PURE", "I");
+    CHECK_NULL(path2DTypesID =
+        (*env)->GetFieldID(env, Path2D, "pointTypes", "[B"));
+    CHECK_NULL(path2DNumTypesID =
+        (*env)->GetFieldID(env, Path2D, "numTypes", "I"));
+    CHECK_NULL(path2DWindingRuleID =
+        (*env)->GetFieldID(env, Path2D, "windingRule", "I"));
+    CHECK_NULL(path2DFloatCoordsID =
+        (*env)->GetFieldID(env, Path2DFloat, "floatCoords", "[F"));
+    CHECK_NULL(sg2dStrokeHintID =
+        (*env)->GetFieldID(env, SG2D, "strokeHint", "I"));
+    CHECK_NULL(fid =
+        (*env)->GetStaticFieldID(env, SHints, "INTVAL_STROKE_PURE", "I"));
     sunHints_INTVAL_STROKE_PURE = (*env)->GetStaticIntField(env, SHints, fid);
 }
 
diff --git a/jdk/src/java.desktop/share/native/libfontmanager/HBShaper.c b/jdk/src/java.desktop/share/native/libfontmanager/HBShaper.c
index 00c6ee1..485c42a 100644
--- a/jdk/src/java.desktop/share/native/libfontmanager/HBShaper.c
+++ b/jdk/src/java.desktop/share/native/libfontmanager/HBShaper.c
@@ -278,6 +278,12 @@
      hb_buffer_set_direction(buffer, direction);
 
      chars = (*env)->GetCharArrayElements(env, text, NULL);
+     if ((*env)->ExceptionCheck(env)) {
+         hb_buffer_destroy(buffer);
+         hb_font_destroy(hbfont);
+         free((void*)jdkFontInfo);
+         return JNI_FALSE;
+     }
      len = (*env)->GetArrayLength(env, text);
 
      hb_buffer_add_utf16(buffer, chars, len, offset, limit-offset);
@@ -309,6 +315,7 @@
      hb_font_destroy(hbfont);
      free((void*)jdkFontInfo);
      if (features != NULL) free(features);
+     (*env)->ReleaseCharArrayElements(env, text, chars, JNI_ABORT);
 
      return JNI_TRUE;
 }
diff --git a/jdk/src/java.desktop/share/native/libjavajpeg/imageioJPEG.c b/jdk/src/java.desktop/share/native/libjavajpeg/imageioJPEG.c
index 81fe911..c872c52 100644
--- a/jdk/src/java.desktop/share/native/libjavajpeg/imageioJPEG.c
+++ b/jdk/src/java.desktop/share/native/libjavajpeg/imageioJPEG.c
@@ -952,7 +952,7 @@
                                 sb->hstreamBuffer, 0,
                                 sb->bufferLength);
     if ((ret > 0) && ((unsigned int)ret > sb->bufferLength)) {
-         ret = sb->bufferLength;
+         ret = (int)sb->bufferLength;
     }
     if ((*env)->ExceptionOccurred(env)
         || !GET_ARRAYS(env, data, &(src->next_input_byte))) {
@@ -1050,7 +1050,7 @@
                                 JPEGImageReader_readInputDataID,
                                 sb->hstreamBuffer,
                                 offset, buflen);
-    if ((ret > 0) && ((unsigned int)ret > buflen)) ret = buflen;
+    if ((ret > 0) && ((unsigned int)ret > buflen)) ret = (int)buflen;
     if ((*env)->ExceptionOccurred(env)
         || !GET_ARRAYS(env, data, &(src->next_input_byte))) {
         cinfo->err->error_exit((j_common_ptr) cinfo);
@@ -1774,8 +1774,8 @@
             v_samp1 = cinfo->comp_info[1].v_samp_factor;
             v_samp2 = cinfo->comp_info[2].v_samp_factor;
 
-            if ((h_samp1 > h_samp0) && (h_samp2 > h_samp0) ||
-                (v_samp1 > v_samp0) && (v_samp2 > v_samp0))
+            if (((h_samp1 > h_samp0) && (h_samp2 > h_samp0)) ||
+                ((v_samp1 > v_samp0) && (v_samp2 > v_samp0)))
             {
                 cinfo->jpeg_color_space = JCS_YCCK;
                 /* Leave the output space as CMYK */
@@ -1866,7 +1866,6 @@
     pixelBufferPtr pb;
     sun_jpeg_error_ptr jerr;
     boolean done;
-    boolean mustScale = FALSE;
     boolean progressive = FALSE;
     boolean orderedBands = TRUE;
     imageIODataPtr data = (imageIODataPtr)jlong_to_ptr(ptr);
@@ -2634,6 +2633,18 @@
     RELEASE_ARRAYS(env, data, NULL);
 }
 
+static void freeArray(UINT8** arr, jint size) {
+    int i;
+    if (arr != NULL) {
+        for (i = 0; i < size; i++) {
+            if (arr[i] != NULL) {
+                free(arr[i]);
+            }
+        }
+        free(arr);
+    }
+}
+
 JNIEXPORT jboolean JNICALL
 Java_com_sun_imageio_plugins_jpeg_JPEGImageWriter_writeImage
     (JNIEnv *env,
@@ -2742,6 +2753,8 @@
                 scale = (UINT8**) calloc(numBands, sizeof(UINT8*));
 
                 if (scale == NULL) {
+                    (*env)->ReleaseIntArrayElements(env, bandSizes,
+                                                    bandSize, JNI_ABORT);
                     JNU_ThrowByName( env, "java/lang/OutOfMemoryError",
                                      "Writing JPEG Stream");
                     return JNI_FALSE;
@@ -2758,6 +2771,8 @@
                     free(scale[j]);
                 }
                 free(scale);
+                (*env)->ReleaseIntArrayElements(env, bandSizes,
+                                                bandSize, JNI_ABORT);
                 JNU_ThrowByName( env, "java/lang/OutOfMemoryError",
                                  "Writing JPEG Stream");
                 return JNI_FALSE;
@@ -2782,21 +2797,14 @@
     pb = &data->pixelBuf;
 
     if (setPixelBuffer(env, pb, buffer) == NOT_OK) {
-        if (scale != NULL) {
-            for (i = 0; i < numBands; i++) {
-                if (scale[i] != NULL) {
-                    free(scale[i]);
-                }
-            }
-            free(scale);
-        }
+        freeArray(scale, numBands);
         return data->abortFlag;  // We already threw an out of memory exception
     }
 
     // Allocate a 1-scanline buffer
     scanLinePtr = (JSAMPROW)malloc(scanLineSize);
     if (scanLinePtr == NULL) {
-        RELEASE_ARRAYS(env, data, (const JOCTET *)(dest->next_output_byte));
+        freeArray(scale, numBands);
         JNU_ThrowByName( env,
                          "java/lang/OutOfMemoryError",
                          "Writing JPEG Stream");
@@ -2818,15 +2826,7 @@
             JNU_ThrowByName(env, "javax/imageio/IIOException", buffer);
         }
 
-        if (scale != NULL) {
-            for (i = 0; i < numBands; i++) {
-                if (scale[i] != NULL) {
-                    free(scale[i]);
-                }
-            }
-            free(scale);
-        }
-
+        freeArray(scale, numBands);
         free(scanLinePtr);
         return data->abortFlag;
     }
@@ -2874,7 +2874,11 @@
     if (qsels) {
         (*env)->ReleaseIntArrayElements(env, QtableSelectors, qsels, JNI_ABORT);
     }
-    if (!success) return data->abortFlag;
+    if (!success) {
+        freeArray(scale, numBands);
+        free(scanLinePtr);
+        return data->abortFlag;
+    }
 
     jpeg_suppress_tables(cinfo, TRUE);  // Disable writing any current
 
@@ -2892,6 +2896,8 @@
     if (GET_ARRAYS(env, data,
                    (const JOCTET **)(&dest->next_output_byte)) == NOT_OK) {
         (*env)->ExceptionClear(env);
+        freeArray(scale, numBands);
+        free(scanLinePtr);
         JNU_ThrowByName(env,
                         "javax/imageio/IIOException",
                         "Array pin failed");
@@ -2926,7 +2932,12 @@
             cinfo->scan_info = cinfo->script_space;
             scanptr = (int *) cinfo->script_space;
             scanData = (*env)->GetIntArrayElements(env, scanInfo, NULL);
-            CHECK_NULL_RETURN(scanData, data->abortFlag);
+            if (scanData == NULL) {
+                RELEASE_ARRAYS(env, data, (const JOCTET *)(dest->next_output_byte));
+                freeArray(scale, numBands);
+                free(scanLinePtr);
+                return data->abortFlag;
+            }
             // number of jints per scan is 9
             // We avoid a memcpy to handle different size ints
             for (i = 0; i < numScans*9; i++) {
@@ -3022,15 +3033,7 @@
         jpeg_abort((j_common_ptr)cinfo);
     }
 
-    if (scale != NULL) {
-        for (i = 0; i < numBands; i++) {
-            if (scale[i] != NULL) {
-                free(scale[i]);
-            }
-        }
-        free(scale);
-    }
-
+    freeArray(scale, numBands);
     free(scanLinePtr);
     RELEASE_ARRAYS(env, data, NULL);
     return data->abortFlag;
diff --git a/jdk/src/java.desktop/share/native/libjavajpeg/jpegdecoder.c b/jdk/src/java.desktop/share/native/libjavajpeg/jpegdecoder.c
index 1cd05ab..ea83cb3 100644
--- a/jdk/src/java.desktop/share/native/libjavajpeg/jpegdecoder.c
+++ b/jdk/src/java.desktop/share/native/libjavajpeg/jpegdecoder.c
@@ -358,7 +358,7 @@
     }
     ret = (*env)->CallIntMethod(env, src->hInputStream, InputStream_readID,
                                 src->hInputBuffer, offset, buflen);
-    if ((ret > 0) && ((unsigned int)ret > buflen)) ret = buflen;
+    if ((ret > 0) && ((unsigned int)ret > buflen)) ret = (int)buflen;
     if ((*env)->ExceptionOccurred(env) || !GET_ARRAYS(env, src)) {
         cinfo->err->error_exit((struct jpeg_common_struct *) cinfo);
     }
diff --git a/jdk/src/java.desktop/share/native/liblcms/cmsalpha.c b/jdk/src/java.desktop/share/native/liblcms/cmsalpha.c
new file mode 100644
index 0000000..277ed55
--- /dev/null
+++ b/jdk/src/java.desktop/share/native/liblcms/cmsalpha.c
@@ -0,0 +1,547 @@
+/*
+ * 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.
+ */
+
+// This file is available under and governed by the GNU General Public
+// License version 2 only, as published by the Free Software Foundation.
+// However, the following notice accompanied the original version of this
+// file:
+//
+//---------------------------------------------------------------------------------
+//
+//  Little Color Management System
+//  Copyright (c) 1998-2016 Marti Maria Saguer
+//
+// Permission is hereby granted, free of charge, to any person obtaining
+// a copy of this software and associated documentation files (the "Software"),
+// to deal in the Software without restriction, including without limitation
+// the rights to use, copy, modify, merge, publish, distribute, sublicense,
+// and/or sell copies of the Software, and to permit persons to whom the Software
+// is furnished to do so, subject to the following conditions:
+//
+// The above copyright notice and this permission notice shall be included in
+// all copies or substantial portions of the Software.
+//
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO
+// THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+//
+//---------------------------------------------------------------------------------
+//
+
+#include "lcms2_internal.h"
+
+
+// Alpha copy ------------------------------------------------------------------------------------------------------------------
+
+// Floor to byte, taking care of saturation
+cmsINLINE cmsUInt8Number _cmsQuickSaturateByte(cmsFloat64Number d)
+{
+       d += 0.5;
+       if (d <= 0) return 0;
+       if (d >= 255.0) return 255;
+
+       return (cmsUInt8Number) _cmsQuickFloorWord(d);
+}
+
+
+// Return the size in bytes of a given formatter
+static
+int trueBytesSize(cmsUInt32Number Format)
+{
+       int fmt_bytes = T_BYTES(Format);
+
+       // For double, the T_BYTES field returns zero
+       if (fmt_bytes == 0)
+              return sizeof(double);
+
+       // Otherwise, it is already correct for all formats
+       return fmt_bytes;
+}
+
+
+// Several format converters
+
+typedef void(*cmsFormatterAlphaFn)(void* dst, const void* src);
+
+
+// From 8
+
+static
+void copy8(void* dst, const void* src)
+{
+       memmove(dst, src, 1);
+}
+
+static
+void from8to16(void* dst, const void* src)
+{
+       cmsUInt8Number n = *(cmsUInt8Number*)src;
+       *(cmsUInt16Number*) dst = FROM_8_TO_16(n);
+}
+
+static
+void from8toFLT(void* dst, const void* src)
+{
+       *(cmsFloat32Number*)dst = (*(cmsUInt8Number*)src) / 255.0f;
+}
+
+static
+void from8toDBL(void* dst, const void* src)
+{
+       *(cmsFloat64Number*)dst = (*(cmsUInt8Number*)src) / 255.0;
+}
+
+static
+void from8toHLF(void* dst, const void* src)
+{
+       cmsFloat32Number n = (*(cmsUInt8Number*)src) / 255.0f;
+       *(cmsUInt16Number*)dst = _cmsFloat2Half(n);
+}
+
+// From 16
+
+static
+void from16to8(void* dst, const void* src)
+{
+       cmsUInt16Number n = *(cmsUInt16Number*)src;
+       *(cmsUInt8Number*) dst = FROM_16_TO_8(n);
+}
+
+static
+void copy16(void* dst, const void* src)
+{
+       memmove(dst, src, 2);
+}
+
+void from16toFLT(void* dst, const void* src)
+{
+       *(cmsFloat32Number*)dst = (*(cmsUInt16Number*)src) / 65535.0f;
+}
+
+void from16toDBL(void* dst, const void* src)
+{
+       *(cmsFloat64Number*)dst = (*(cmsUInt16Number*)src) / 65535.0f;
+}
+
+static
+void from16toHLF(void* dst, const void* src)
+{
+       cmsFloat32Number n = (*(cmsUInt16Number*)src) / 65535.0f;
+       *(cmsUInt16Number*)dst = _cmsFloat2Half(n);
+}
+
+// From Float
+
+static
+void fromFLTto8(void* dst, const void* src)
+{
+       cmsFloat32Number n = *(cmsFloat32Number*)src;
+       *(cmsUInt8Number*)dst = _cmsQuickSaturateByte(n * 255.0f);
+}
+
+static
+void fromFLTto16(void* dst, const void* src)
+{
+       cmsFloat32Number n = *(cmsFloat32Number*)src;
+       *(cmsUInt16Number*)dst = _cmsQuickSaturateWord(n * 65535.0f);
+}
+
+static
+void copy32(void* dst, const void* src)
+{
+       memmove(dst, src, sizeof(cmsFloat32Number));
+}
+
+static
+void fromFLTtoDBL(void* dst, const void* src)
+{
+       cmsFloat32Number n = *(cmsFloat32Number*)src;
+       *(cmsFloat64Number*)dst = (cmsFloat64Number)n;
+}
+
+static
+void fromFLTtoHLF(void* dst, const void* src)
+{
+       cmsFloat32Number n = *(cmsFloat32Number*)src;
+       *(cmsUInt16Number*)dst = _cmsFloat2Half(n);
+}
+
+
+// From HALF
+
+static
+void fromHLFto8(void* dst, const void* src)
+{
+       cmsFloat32Number n = _cmsHalf2Float(*(cmsUInt16Number*)src);
+       *(cmsUInt8Number*)dst = _cmsQuickSaturateByte(n * 255.0f);
+}
+
+static
+void fromHLFto16(void* dst, const void* src)
+{
+       cmsFloat32Number n = _cmsHalf2Float(*(cmsUInt16Number*)src);
+       *(cmsUInt16Number*)dst = _cmsQuickSaturateWord(n * 65535.0f);
+}
+
+static
+void fromHLFtoFLT(void* dst, const void* src)
+{
+       *(cmsFloat32Number*)dst = _cmsHalf2Float(*(cmsUInt16Number*)src);
+}
+
+static
+void fromHLFtoDBL(void* dst, const void* src)
+{
+       *(cmsFloat64Number*)dst = (cmsFloat64Number)_cmsHalf2Float(*(cmsUInt16Number*)src);
+}
+
+// From double
+static
+void fromDBLto8(void* dst, const void* src)
+{
+       cmsFloat64Number n = *(cmsFloat64Number*)src;
+       *(cmsUInt8Number*)dst = _cmsQuickSaturateByte(n * 255.0);
+}
+
+static
+void fromDBLto16(void* dst, const void* src)
+{
+       cmsFloat64Number n = *(cmsFloat64Number*)src;
+       *(cmsUInt16Number*)dst = _cmsQuickSaturateWord(n * 65535.0f);
+}
+
+static
+void fromDBLtoFLT(void* dst, const void* src)
+{
+       cmsFloat64Number n = *(cmsFloat64Number*)src;
+       *(cmsFloat32Number*)dst = (cmsFloat32Number) n;
+}
+
+static
+void fromDBLtoHLF(void* dst, const void* src)
+{
+       cmsFloat32Number n = (cmsFloat32Number) *(cmsFloat64Number*)src;
+       *(cmsUInt16Number*)dst = _cmsFloat2Half(n);
+}
+
+static
+void copy64(void* dst, const void* src)
+{
+       memmove(dst, src, sizeof(cmsFloat64Number));
+}
+
+
+// Returns the position (x or y) of the formatter in the table of functions
+static
+int FormatterPos(cmsUInt32Number frm)
+{
+       int  b = T_BYTES(frm);
+
+       if (b == 0 && T_FLOAT(frm))
+              return 4; // DBL
+       if (b == 2 && T_FLOAT(frm))
+              return 2; // HLF
+       if (b == 4 && T_FLOAT(frm))
+              return 3; // FLT
+       if (b == 2 && !T_FLOAT(frm))
+              return 1; // 16
+       if (b == 1 && !T_FLOAT(frm))
+              return 0; // 8
+
+       return -1; // not recognized
+
+}
+
+// Obtains a alpha-to-alpha funmction formatter
+static
+cmsFormatterAlphaFn _cmsGetFormatterAlpha(cmsContext id, cmsUInt32Number in, cmsUInt32Number out)
+{
+static cmsFormatterAlphaFn FormattersAlpha[5][5] = {
+
+       /* from 8 */  { copy8,      from8to16,   from8toHLF,   from8toFLT,   from8toDBL   },
+       /* from 16*/  { from16to8,  copy16,      from16toHLF,  from16toFLT,  from16toDBL  },
+       /* from HLF*/ { fromHLFto8, fromHLFto16, copy16,       fromHLFtoFLT, fromHLFtoDBL },
+       /* from FLT*/ { fromFLTto8, fromFLTto16, fromFLTtoHLF, copy32,       fromFLTtoDBL },
+       /* from DBL*/ { fromDBLto8, fromDBLto16, fromDBLtoHLF, fromDBLtoFLT, copy64 }};
+
+        int in_n  = FormatterPos(in);
+        int out_n = FormatterPos(out);
+
+        if (in_n < 0 || out_n < 0 || in_n > 4 || out_n > 4) {
+
+               cmsSignalError(id, cmsERROR_UNKNOWN_EXTENSION, "Unrecognized alpha channel width");
+               return NULL;
+        }
+
+        return FormattersAlpha[in_n][out_n];
+}
+
+
+
+// This function computes the distance from each component to the next one in bytes.
+static
+void ComputeIncrementsForChunky(cmsUInt32Number Format,
+                                cmsUInt32Number ComponentStartingOrder[],
+                                cmsUInt32Number ComponentPointerIncrements[])
+{
+       cmsUInt32Number channels[cmsMAXCHANNELS];
+       int extra = T_EXTRA(Format);
+       int nchannels = T_CHANNELS(Format);
+       int total_chans = nchannels + extra;
+       int i;
+       int channelSize = trueBytesSize(Format);
+       int pixelSize = channelSize * total_chans;
+
+           // Sanity check
+           if (total_chans <= 0 || total_chans >= cmsMAXCHANNELS)
+                   return;
+
+        memset(channels, 0, sizeof(channels));
+
+       // Separation is independent of starting point and only depends on channel size
+       for (i = 0; i < extra; i++)
+              ComponentPointerIncrements[i] = pixelSize;
+
+       // Handle do swap
+       for (i = 0; i < total_chans; i++)
+       {
+              if (T_DOSWAP(Format)) {
+                     channels[i] = total_chans - i - 1;
+              }
+              else {
+                     channels[i] = i;
+              }
+       }
+
+       // Handle swap first (ROL of positions), example CMYK -> KCMY | 0123 -> 3012
+       if (T_SWAPFIRST(Format) && total_chans > 1) {
+
+              cmsUInt32Number tmp = channels[0];
+              for (i = 0; i < total_chans-1; i++)
+                     channels[i] = channels[i + 1];
+
+              channels[total_chans - 1] = tmp;
+       }
+
+       // Handle size
+       if (channelSize > 1)
+              for (i = 0; i < total_chans; i++) {
+                     channels[i] *= channelSize;
+              }
+
+       for (i = 0; i < extra; i++)
+              ComponentStartingOrder[i] = channels[i + nchannels];
+}
+
+
+
+//  On planar configurations, the distance is the stride added to any non-negative
+static
+void ComputeIncrementsForPlanar(cmsUInt32Number Format,
+                                cmsUInt32Number BytesPerPlane,
+                                cmsUInt32Number ComponentStartingOrder[],
+                                cmsUInt32Number ComponentPointerIncrements[])
+{
+       cmsUInt32Number channels[cmsMAXCHANNELS];
+       int extra = T_EXTRA(Format);
+       int nchannels = T_CHANNELS(Format);
+       int total_chans = nchannels + extra;
+       int i;
+       int channelSize = trueBytesSize(Format);
+
+       // Sanity check
+       if (total_chans <= 0 || total_chans >= cmsMAXCHANNELS)
+           return;
+
+       memset(channels, 0, sizeof(channels));
+
+       // Separation is independent of starting point and only depends on channel size
+       for (i = 0; i < extra; i++)
+              ComponentPointerIncrements[i] = channelSize;
+
+       // Handle do swap
+       for (i = 0; i < total_chans; i++)
+       {
+              if (T_DOSWAP(Format)) {
+                     channels[i] = total_chans - i - 1;
+              }
+              else {
+                     channels[i] = i;
+              }
+       }
+
+       // Handle swap first (ROL of positions), example CMYK -> KCMY | 0123 -> 3012
+       if (T_SWAPFIRST(Format) && total_chans > 0) {
+
+              cmsUInt32Number tmp = channels[0];
+              for (i = 0; i < total_chans - 1; i++)
+                     channels[i] = channels[i + 1];
+
+              channels[total_chans - 1] = tmp;
+       }
+
+       // Handle size
+       for (i = 0; i < total_chans; i++) {
+              channels[i] *= BytesPerPlane;
+       }
+
+       for (i = 0; i < extra; i++)
+              ComponentStartingOrder[i] = channels[i + nchannels];
+}
+
+
+
+// Dispatcher por chunky and planar RGB
+static
+void  ComputeComponentIncrements(cmsUInt32Number Format,
+                                 cmsUInt32Number BytesPerPlane,
+                                 cmsUInt32Number ComponentStartingOrder[],
+                                 cmsUInt32Number ComponentPointerIncrements[])
+{
+       if (T_PLANAR(Format)) {
+
+              ComputeIncrementsForPlanar(Format,  BytesPerPlane, ComponentStartingOrder, ComponentPointerIncrements);
+       }
+       else {
+              ComputeIncrementsForChunky(Format,  ComponentStartingOrder, ComponentPointerIncrements);
+       }
+
+}
+
+
+
+// Handles extra channels copying alpha if requested by the flags
+void _cmsHandleExtraChannels(_cmsTRANSFORM* p, const void* in,
+                                               void* out,
+                                               cmsUInt32Number PixelsPerLine,
+                                               cmsUInt32Number LineCount,
+                                               const cmsStride* Stride)
+{
+    cmsUInt32Number i, j, k;
+    cmsUInt32Number nExtra;
+    cmsUInt32Number SourceStartingOrder[cmsMAXCHANNELS];
+    cmsUInt32Number SourceIncrements[cmsMAXCHANNELS];
+    cmsUInt32Number DestStartingOrder[cmsMAXCHANNELS];
+    cmsUInt32Number DestIncrements[cmsMAXCHANNELS];
+
+    cmsFormatterAlphaFn copyValueFn;
+
+    // Make sure we need some copy
+    if (!(p->dwOriginalFlags & cmsFLAGS_COPY_ALPHA))
+        return;
+
+    // Exit early if in-place color-management is occurring - no need to copy extra channels to themselves.
+    if (p->InputFormat == p->OutputFormat && in == out)
+        return;
+
+    // Make sure we have same number of alpha channels. If not, just return as this should be checked at transform creation time.
+    nExtra = T_EXTRA(p->InputFormat);
+    if (nExtra != T_EXTRA(p->OutputFormat))
+        return;
+
+    // Anything to do?
+    if (nExtra == 0)
+        return;
+
+    // Compute the increments
+    ComputeComponentIncrements(p->InputFormat, Stride->BytesPerPlaneIn, SourceStartingOrder, SourceIncrements);
+    ComputeComponentIncrements(p->OutputFormat, Stride->BytesPerPlaneOut, DestStartingOrder, DestIncrements);
+
+    // Check for conversions 8, 16, half, float, dbl
+    copyValueFn = _cmsGetFormatterAlpha(p->ContextID, p->InputFormat, p->OutputFormat);
+
+    if (nExtra == 1) { // Optimized routine for copying a single extra channel quickly
+
+        cmsUInt8Number* SourcePtr;
+        cmsUInt8Number* DestPtr;
+
+        cmsUInt32Number SourceStrideIncrement = 0;
+        cmsUInt32Number DestStrideIncrement = 0;
+
+        // The loop itself
+        for (i = 0; i < LineCount; i++) {
+
+            // Prepare pointers for the loop
+            SourcePtr = (cmsUInt8Number*)in + SourceStartingOrder[0] + SourceStrideIncrement;
+            DestPtr = (cmsUInt8Number*)out + DestStartingOrder[0] + DestStrideIncrement;
+
+            for (j = 0; j < PixelsPerLine; j++) {
+
+                copyValueFn(DestPtr, SourcePtr);
+
+                SourcePtr += SourceIncrements[0];
+                DestPtr += DestIncrements[0];
+            }
+
+            SourceStrideIncrement += Stride->BytesPerLineIn;
+            DestStrideIncrement += Stride->BytesPerLineOut;
+        }
+
+    }
+    else { // General case with more than one extra channel
+
+        cmsUInt8Number* SourcePtr[cmsMAXCHANNELS];
+        cmsUInt8Number* DestPtr[cmsMAXCHANNELS];
+
+        cmsUInt32Number SourceStrideIncrements[cmsMAXCHANNELS];
+        cmsUInt32Number DestStrideIncrements[cmsMAXCHANNELS];
+
+        memset(SourceStrideIncrements, 0, sizeof(SourceStrideIncrements));
+        memset(DestStrideIncrements, 0, sizeof(DestStrideIncrements));
+
+        // The loop itself
+        for (i = 0; i < LineCount; i++) {
+
+            // Prepare pointers for the loop
+            for (j = 0; j < nExtra; j++) {
+
+                SourcePtr[j] = (cmsUInt8Number*)in + SourceStartingOrder[j] + SourceStrideIncrements[j];
+                DestPtr[j] = (cmsUInt8Number*)out + DestStartingOrder[j] + DestStrideIncrements[j];
+            }
+
+            for (j = 0; j < PixelsPerLine; j++) {
+
+                for (k = 0; k < nExtra; k++) {
+
+                    copyValueFn(DestPtr[k], SourcePtr[k]);
+
+                    SourcePtr[k] += SourceIncrements[k];
+                    DestPtr[k] += DestIncrements[k];
+                }
+            }
+
+            for (j = 0; j < nExtra; j++) {
+
+                SourceStrideIncrements[j] += Stride->BytesPerLineIn;
+                DestStrideIncrements[j] += Stride->BytesPerLineOut;
+            }
+        }
+    }
+}
+
+
diff --git a/jdk/src/java.desktop/share/native/liblcms/cmscam02.c b/jdk/src/java.desktop/share/native/liblcms/cmscam02.c
index 86ec167..ae7038c 100644
--- a/jdk/src/java.desktop/share/native/liblcms/cmscam02.c
+++ b/jdk/src/java.desktop/share/native/liblcms/cmscam02.c
@@ -30,7 +30,7 @@
 //---------------------------------------------------------------------------------
 //
 //  Little Color Management System
-//  Copyright (c) 1998-2012 Marti Maria Saguer
+//  Copyright (c) 1998-2016 Marti Maria Saguer
 //
 // Permission is hereby granted, free of charge, to any person obtaining
 // a copy of this software and associated documentation files (the "Software"),
diff --git a/jdk/src/java.desktop/share/native/liblcms/cmscgats.c b/jdk/src/java.desktop/share/native/liblcms/cmscgats.c
index 664a3c9..9e03316 100644
--- a/jdk/src/java.desktop/share/native/liblcms/cmscgats.c
+++ b/jdk/src/java.desktop/share/native/liblcms/cmscgats.c
@@ -30,7 +30,7 @@
 //---------------------------------------------------------------------------------
 //
 //  Little Color Management System
-//  Copyright (c) 1998-2012 Marti Maria Saguer
+//  Copyright (c) 1998-2016 Marti Maria Saguer
 //
 // Permission is hereby granted, free of charge, to any person obtaining
 // a copy of this software and associated documentation files (the "Software"),
@@ -625,7 +625,7 @@
 }
 
 // Parses a float number
-// This can not call directly atof because it uses locale dependant
+// This can not call directly atof because it uses locale dependent
 // parsing, while CCMX files always use . as decimal separator
 static
 cmsFloat64Number ParseFloatNumber(const char *Buffer)
@@ -830,11 +830,11 @@
 
                     if (it8 ->sy == SINUM) {
 
-                        sprintf(it8->id, "%d", it8->inum);
+                        snprintf(it8->id, 127, "%d", it8->inum);
                     }
                     else {
 
-                        sprintf(it8->id, it8 ->DoubleFormatter, it8->dnum);
+                        snprintf(it8->id, 127, it8 ->DoubleFormatter, it8->dnum);
                     }
 
                     k = (int) strlen(it8 ->id);
@@ -1392,7 +1392,7 @@
     cmsIT8* it8 = (cmsIT8*) hIT8;
     char Buffer[1024];
 
-    sprintf(Buffer, it8->DoubleFormatter, Val);
+    snprintf(Buffer, 1023, it8->DoubleFormatter, Val);
 
     return AddToList(it8, &GetTable(it8)->HeaderList, cProp, NULL, Buffer, WRITE_UNCOOKED) != NULL;
 }
@@ -1402,7 +1402,7 @@
     cmsIT8* it8 = (cmsIT8*) hIT8;
     char Buffer[1024];
 
-    sprintf(Buffer, "%u", Val);
+    snprintf(Buffer, 1023, "%u", Val);
 
     return AddToList(it8, &GetTable(it8)->HeaderList, cProp, NULL, Buffer, WRITE_HEXADECIMAL) != NULL;
 }
@@ -1846,7 +1846,7 @@
 }
 
 
-// -------------------------------------------------------------- Higer level parsing
+// -------------------------------------------------------------- Higher level parsing
 
 static
 cmsBool DataFormatSection(cmsIT8* it8)
@@ -2149,7 +2149,7 @@
 
 
 
-// Init usefull pointers
+// Init useful pointers
 
 static
 void CookPointers(cmsIT8* it8)
@@ -2546,9 +2546,9 @@
 
         fld = GetDataFormat(it8, i);
         if (fld != NULL) {
-        if (cmsstrcasecmp(fld, cSample) == 0)
-            return i;
-    }
+            if (cmsstrcasecmp(fld, cSample) == 0)
+                return i;
+        }
     }
 
     return -1;
@@ -2606,7 +2606,7 @@
 
     _cmsAssert(hIT8 != NULL);
 
-    sprintf(Buff, it8->DoubleFormatter, Val);
+    snprintf(Buff, 255, it8->DoubleFormatter, Val);
 
     return SetData(it8, row, col, Buff);
 }
diff --git a/jdk/src/java.desktop/share/native/liblcms/cmscnvrt.c b/jdk/src/java.desktop/share/native/liblcms/cmscnvrt.c
index f6ef06c..2ac99be 100644
--- a/jdk/src/java.desktop/share/native/liblcms/cmscnvrt.c
+++ b/jdk/src/java.desktop/share/native/liblcms/cmscnvrt.c
@@ -30,7 +30,7 @@
 //---------------------------------------------------------------------------------
 //
 //  Little Color Management System
-//  Copyright (c) 1998-2012 Marti Maria Saguer
+//  Copyright (c) 1998-2016 Marti Maria Saguer
 //
 // Permission is hereby granted, free of charge, to any person obtaining
 // a copy of this software and associated documentation files (the "Software"),
@@ -136,7 +136,7 @@
 };
 
 
-// A pointer to the begining of the list
+// A pointer to the beginning of the list
 _cmsIntentsPluginChunkType _cmsIntentsPluginChunk = { NULL };
 
 // Duplicates the zone of memory used by the plug-in in the new context
@@ -299,6 +299,7 @@
     cmsMAT3 Scale, m1, m2, m3, m4;
 
     // TODO: Follow Marc Mahy's recommendation to check if CHAD is same by using M1*M2 == M2*M1. If so, do nothing.
+    // TODO: Add support for ArgyllArts tag
 
     // Adaptation state
     if (AdaptationState == 1.0) {
@@ -917,7 +918,7 @@
         return TRUE;
     }
 
-    // Make sure to pass thru K (which now is fixed)
+    // Make sure to pass through K (which now is fixed)
     Outf[3] = LabK[3];
 
     // Apply TAC if needed
@@ -985,7 +986,7 @@
     memset(&bp, 0, sizeof(bp));
 
     // We need the input LUT of the last profile, assuming this one is responsible of
-    // black generation. This LUT will be seached in inverse order.
+    // black generation. This LUT will be searched in inverse order.
     bp.LabK2cmyk = _cmsReadInputLUT(hProfiles[nProfiles-1], INTENT_RELATIVE_COLORIMETRIC);
     if (bp.LabK2cmyk == NULL) goto Cleanup;
 
diff --git a/jdk/src/java.desktop/share/native/liblcms/cmserr.c b/jdk/src/java.desktop/share/native/liblcms/cmserr.c
index a708997..fc74aa7 100644
--- a/jdk/src/java.desktop/share/native/liblcms/cmserr.c
+++ b/jdk/src/java.desktop/share/native/liblcms/cmserr.c
@@ -30,7 +30,7 @@
 //---------------------------------------------------------------------------------
 //
 //  Little Color Management System
-//  Copyright (c) 1998-2015 Marti Maria Saguer
+//  Copyright (c) 1998-2016 Marti Maria Saguer
 //
 // Permission is hereby granted, free of charge, to any person obtaining
 // a copy of this software and associated documentation files (the "Software"),
@@ -227,7 +227,7 @@
     }
 }
 
-// Auxiliar to fill memory management functions from plugin (or context 0 defaults)
+// Auxiliary to fill memory management functions from plugin (or context 0 defaults)
 void _cmsInstallAllocFunctions(cmsPluginMemHandler* Plugin, _cmsMemPluginChunkType* ptr)
 {
     if (Plugin == NULL) {
@@ -459,14 +459,14 @@
 
 // Error logging ******************************************************************
 
-// There is no error handling at all. When a funtion fails, it returns proper value.
+// There is no error handling at all. When a function fails, it returns proper value.
 // For example, all create functions does return NULL on failure. Other return FALSE
 // It may be interesting, for the developer, to know why the function is failing.
 // for that reason, lcms2 does offer a logging function. This function does recive
 // a ENGLISH string with some clues on what is going wrong. You can show this
 // info to the end user, or just create some sort of log.
 // The logging function should NOT terminate the program, as this obviously can leave
-// resources. It is the programmer's responsability to check each function return code
+// resources. It is the programmer's responsibility to check each function return code
 // to make sure it didn't fail.
 
 // Error messages are limited to MAX_ERROR_MESSAGE_LEN
diff --git a/jdk/src/java.desktop/share/native/liblcms/cmsgamma.c b/jdk/src/java.desktop/share/native/liblcms/cmsgamma.c
index e68f258..e940fe2 100644
--- a/jdk/src/java.desktop/share/native/liblcms/cmsgamma.c
+++ b/jdk/src/java.desktop/share/native/liblcms/cmsgamma.c
@@ -596,7 +596,7 @@
     return Val;
 }
 
-// Evaluate a segmented funtion for a single value. Return -1 if no valid segment found .
+// Evaluate a segmented function for a single value. Return -1 if no valid segment found .
 // If fn type is 0, perform an interpolation on the table
 static
 cmsFloat64Number EvalSegmentedFn(const cmsToneCurve *g, cmsFloat64Number R)
diff --git a/jdk/src/java.desktop/share/native/liblcms/cmsgmt.c b/jdk/src/java.desktop/share/native/liblcms/cmsgmt.c
index 0be9173..81254c2 100644
--- a/jdk/src/java.desktop/share/native/liblcms/cmsgmt.c
+++ b/jdk/src/java.desktop/share/native/liblcms/cmsgmt.c
@@ -30,7 +30,7 @@
 //---------------------------------------------------------------------------------
 //
 //  Little Color Management System
-//  Copyright (c) 1998-2012 Marti Maria Saguer
+//  Copyright (c) 1998-2016 Marti Maria Saguer
 //
 // Permission is hereby granted, free of charge, to any person obtaining
 // a copy of this software and associated documentation files (the "Software"),
@@ -56,7 +56,7 @@
 #include "lcms2_internal.h"
 
 
-// Auxiliar: append a Lab identity after the given sequence of profiles
+// Auxiliary: append a Lab identity after the given sequence of profiles
 // and return the transform. Lab profile is closed, rest of profiles are kept open.
 cmsHTRANSFORM _cmsChain2Lab(cmsContext            ContextID,
                             cmsUInt32Number        nProfiles,
@@ -201,7 +201,7 @@
     }
 
     // Build the relationship. This effectively limits the maximum accuracy to 16 bits, but
-    // since this is used on black-preserving LUTs, we are not loosing  accuracy in any case
+    // since this is used on black-preserving LUTs, we are not losing  accuracy in any case
     KTone = cmsJoinToneCurve(ContextID, in, out, nPoints);
 
     // Get rid of components
@@ -307,7 +307,7 @@
 }
 
 // Does compute a gamut LUT going back and forth across pcs -> relativ. colorimetric intent -> pcs
-// the dE obtained is then annotated on the LUT. Values truely out of gamut are clipped to dE = 0xFFFE
+// the dE obtained is then annotated on the LUT. Values truly out of gamut are clipped to dE = 0xFFFE
 // and values changed are supposed to be handled by any gamut remapping, so, are out of gamut as well.
 //
 // **WARNING: This algorithm does assume that gamut remapping algorithms does NOT move in-gamut colors,
diff --git a/jdk/src/java.desktop/share/native/liblcms/cmshalf.c b/jdk/src/java.desktop/share/native/liblcms/cmshalf.c
index 11efe3a..ddcaf48 100644
--- a/jdk/src/java.desktop/share/native/liblcms/cmshalf.c
+++ b/jdk/src/java.desktop/share/native/liblcms/cmshalf.c
@@ -30,7 +30,7 @@
 //---------------------------------------------------------------------------------
 //
 //  Little Color Management System
-//  Copyright (c) 1998-2012 Marti Maria Saguer
+//  Copyright (c) 1998-2016 Marti Maria Saguer
 //
 // Permission is hereby granted, free of charge, to any person obtaining
 // a copy of this software and associated documentation files (the "Software"),
diff --git a/jdk/src/java.desktop/share/native/liblcms/cmsintrp.c b/jdk/src/java.desktop/share/native/liblcms/cmsintrp.c
index b40bc1d..dbe8b45 100644
--- a/jdk/src/java.desktop/share/native/liblcms/cmsintrp.c
+++ b/jdk/src/java.desktop/share/native/liblcms/cmsintrp.c
@@ -30,7 +30,7 @@
 //---------------------------------------------------------------------------------
 //
 //  Little Color Management System
-//  Copyright (c) 1998-2012 Marti Maria Saguer
+//  Copyright (c) 1998-2016 Marti Maria Saguer
 //
 // Permission is hereby granted, free of charge, to any person obtaining
 // a copy of this software and associated documentation files (the "Software"),
@@ -185,7 +185,7 @@
     int i;
     cmsUInt32Number Samples[MAX_INPUT_DIMENSIONS];
 
-    // Fill the auxiliar array
+    // Fill the auxiliary array
     for (i=0; i < MAX_INPUT_DIMENSIONS; i++)
         Samples[i] = nSamples;
 
diff --git a/jdk/src/java.desktop/share/native/liblcms/cmsio0.c b/jdk/src/java.desktop/share/native/liblcms/cmsio0.c
index cbaffb8..9e982ae 100644
--- a/jdk/src/java.desktop/share/native/liblcms/cmsio0.c
+++ b/jdk/src/java.desktop/share/native/liblcms/cmsio0.c
@@ -30,7 +30,7 @@
 //---------------------------------------------------------------------------------
 //
 //  Little Color Management System
-//  Copyright (c) 1998-2012 Marti Maria Saguer
+//  Copyright (c) 1998-2016 Marti Maria Saguer
 //
 // Permission is hereby granted, free of charge, to any person obtaining
 // a copy of this software and associated documentation files (the "Software"),
@@ -353,7 +353,7 @@
     return nReaded;
 }
 
-// Postion file pointer in the file
+// Position file pointer in the file
 static
 cmsBool  FileSeek(cmsIOHANDLER* iohandler, cmsUInt32Number offset)
 {
@@ -397,6 +397,7 @@
 {
     cmsIOHANDLER* iohandler = NULL;
     FILE* fm = NULL;
+    cmsInt32Number fileLen;
 
     _cmsAssert(FileName != NULL);
     _cmsAssert(AccessMode != NULL);
@@ -413,7 +414,16 @@
              cmsSignalError(ContextID, cmsERROR_FILE, "File '%s' not found", FileName);
             return NULL;
         }
-        iohandler -> ReportedSize = (cmsUInt32Number) cmsfilelength(fm);
+        fileLen = cmsfilelength(fm);
+        if (fileLen < 0)
+        {
+            fclose(fm);
+            _cmsFree(ContextID, iohandler);
+            cmsSignalError(ContextID, cmsERROR_FILE, "Cannot get size of file '%s'", FileName);
+            return NULL;
+        }
+
+        iohandler -> ReportedSize = (cmsUInt32Number) fileLen;
         break;
 
     case 'w':
@@ -453,6 +463,14 @@
 cmsIOHANDLER* CMSEXPORT cmsOpenIOhandlerFromStream(cmsContext ContextID, FILE* Stream)
 {
     cmsIOHANDLER* iohandler = NULL;
+    cmsInt32Number fileSize;
+
+    fileSize = cmsfilelength(Stream);
+    if (fileSize < 0)
+    {
+        cmsSignalError(ContextID, cmsERROR_FILE, "Cannot get size of stream");
+        return NULL;
+    }
 
     iohandler = (cmsIOHANDLER*) _cmsMallocZero(ContextID, sizeof(cmsIOHANDLER));
     if (iohandler == NULL) return NULL;
@@ -460,7 +478,7 @@
     iohandler -> ContextID = ContextID;
     iohandler -> stream = (void*) Stream;
     iohandler -> UsedSpace = 0;
-    iohandler -> ReportedSize = (cmsUInt32Number) cmsfilelength(Stream);
+    iohandler -> ReportedSize = (cmsUInt32Number) fileSize;
     iohandler -> PhysicalFile[0] = 0;
 
     iohandler ->Read    = FileRead;
@@ -652,7 +670,7 @@
 }
 
 
-// Check existance
+// Check existence
 cmsBool CMSEXPORT cmsIsTag(cmsHPROFILE hProfile, cmsTagSignature sig)
 {
        _cmsICCPROFILE*  Icc = (_cmsICCPROFILE*) (void*) hProfile;
@@ -708,7 +726,7 @@
         return FALSE;
     }
 
-    // Adjust endianess of the used parameters
+    // Adjust endianness of the used parameters
     Icc -> DeviceClass     = (cmsProfileClassSignature) _cmsAdjustEndianess32(Header.deviceClass);
     Icc -> ColorSpace      = (cmsColorSpaceSignature)   _cmsAdjustEndianess32(Header.colorSpace);
     Icc -> PCS             = (cmsColorSpaceSignature)   _cmsAdjustEndianess32(Header.pcs);
@@ -826,7 +844,7 @@
 
     memset(&Header.reserved, 0, sizeof(Header.reserved));
 
-    // Set profile ID. Endianess is always big endian
+    // Set profile ID. Endianness is always big endian
     memmove(&Header.profileID, &Icc ->ProfileID, 16);
 
     // Dump the header
@@ -836,7 +854,7 @@
 
     // Get true count
     for (i=0;  i < Icc -> TagCount; i++) {
-        if (Icc ->TagNames[i] != 0)
+        if (Icc ->TagNames[i] != (cmsTagSignature) 0)
             Count++;
     }
 
@@ -845,7 +863,7 @@
 
     for (i=0; i < Icc -> TagCount; i++) {
 
-        if (Icc ->TagNames[i] == 0) continue;   // It is just a placeholder
+        if (Icc ->TagNames[i] == (cmsTagSignature) 0) continue;   // It is just a placeholder
 
         Tag.sig    = (cmsTagSignature) _cmsAdjustEndianess32((cmsInt32Number) Icc -> TagNames[i]);
         Tag.offset = _cmsAdjustEndianess32((cmsInt32Number) Icc -> TagOffsets[i]);
@@ -1195,7 +1213,7 @@
 
     for (i=0; i < Icc -> TagCount; i++) {
 
-        if (Icc ->TagNames[i] == 0) continue;
+        if (Icc ->TagNames[i] == (cmsTagSignature) 0) continue;
 
         // Linked tags are not written
         if (Icc ->TagLinked[i] != (cmsTagSignature) 0) continue;
@@ -1329,11 +1347,15 @@
 
     _cmsAssert(hProfile != NULL);
 
+    if (!_cmsLockMutex(Icc->ContextID, Icc->UsrMutex)) return 0;
     memmove(&Keep, Icc, sizeof(_cmsICCPROFILE));
 
     ContextID = cmsGetProfileContextID(hProfile);
     PrevIO = Icc ->IOhandler = cmsOpenIOhandlerFromNULL(ContextID);
-    if (PrevIO == NULL) return 0;
+    if (PrevIO == NULL) {
+        _cmsUnlockMutex(Icc->ContextID, Icc->UsrMutex);
+        return 0;
+    }
 
     // Pass #1 does compute offsets
 
@@ -1353,7 +1375,10 @@
     }
 
     memmove(Icc, &Keep, sizeof(_cmsICCPROFILE));
-    if (!cmsCloseIOhandler(PrevIO)) return 0;
+    if (!cmsCloseIOhandler(PrevIO))
+        UsedSpace = 0; // As a error marker
+
+    _cmsUnlockMutex(Icc->ContextID, Icc->UsrMutex);
 
     return UsedSpace;
 
@@ -1361,6 +1386,8 @@
 Error:
     cmsCloseIOhandler(PrevIO);
     memmove(Icc, &Keep, sizeof(_cmsICCPROFILE));
+    _cmsUnlockMutex(Icc->ContextID, Icc->UsrMutex);
+
     return 0;
 }
 
@@ -1564,7 +1591,7 @@
     LocalTypeHandler.ICCVersion = Icc ->Version;
     Icc -> TagPtrs[n] = LocalTypeHandler.ReadPtr(&LocalTypeHandler, io, &ElemCount, TagSize);
 
-    // The tag type is supported, but something wrong happend and we cannot read the tag.
+    // The tag type is supported, but something wrong happened and we cannot read the tag.
     // let know the user about this (although it is just a warning)
     if (Icc -> TagPtrs[n] == NULL) {
 
@@ -1883,7 +1910,7 @@
     _cmsUnlockMutex(Icc->ContextID, Icc ->UsrMutex);
 
     if (Icc->TagPtrs[i] == NULL) {
-           Icc->TagNames[i] = 0;
+           Icc->TagNames[i] = (cmsTagSignature) 0;
            return FALSE;
     }
     return TRUE;
diff --git a/jdk/src/java.desktop/share/native/liblcms/cmsio1.c b/jdk/src/java.desktop/share/native/liblcms/cmsio1.c
index 4c259f8..c478b2e 100644
--- a/jdk/src/java.desktop/share/native/liblcms/cmsio1.c
+++ b/jdk/src/java.desktop/share/native/liblcms/cmsio1.c
@@ -30,7 +30,7 @@
 //---------------------------------------------------------------------------------
 //
 //  Little Color Management System
-//  Copyright (c) 1998-2012 Marti Maria Saguer
+//  Copyright (c) 1998-2016 Marti Maria Saguer
 //
 // Permission is hereby granted, free of charge, to any person obtaining
 // a copy of this software and associated documentation files (the "Software"),
@@ -157,7 +157,7 @@
 }
 
 
-// Auxiliar, read colorants as a MAT3 structure. Used by any function that needs a matrix-shaper
+// Auxiliary, read colorants as a MAT3 structure. Used by any function that needs a matrix-shaper
 static
 cmsBool ReadICCMatrixRGB2XYZ(cmsMAT3* r, cmsHPROFILE hProfile)
 {
@@ -343,7 +343,7 @@
     cmsTagSignature tagFloat;
     cmsContext ContextID = cmsGetProfileContextID(hProfile);
 
-    // On named color, take the appropiate tag
+    // On named color, take the appropriate tag
     if (cmsGetDeviceClass(hProfile) == cmsSigNamedColorClass) {
 
         cmsPipeline* Lut;
@@ -365,9 +365,9 @@
         return Lut;
     }
 
-    // This is an attempt to reuse this funtion to retrieve the matrix-shaper as pipeline no
+    // This is an attempt to reuse this function to retrieve the matrix-shaper as pipeline no
     // matter other LUT are present and have precedence. Intent = -1 means just this.
-    if (Intent != -1) {
+    if (Intent >= INTENT_PERCEPTUAL && Intent <= INTENT_ABSOLUTE_COLORIMETRIC) {
 
         tag16 = Device2PCS16[Intent];
         tagFloat = Device2PCSFloat[Intent];
@@ -423,7 +423,7 @@
     // Check if this is a grayscale profile.
     if (cmsGetColorSpace(hProfile) == cmsSigGrayData) {
 
-        // if so, build appropiate conversion tables.
+        // if so, build appropriate conversion tables.
         // The tables are the PCS iluminant, scaled across GrayTRC
         return BuildGrayInputMatrixPipeline(hProfile);
     }
@@ -578,7 +578,7 @@
     if (Lut == NULL) return NULL;
 
     // If PCS is Lab or XYZ, the floating point tag is accepting data in the space encoding,
-    // and since the formatter has already accomodated to 0..1.0, we should undo this change
+    // and since the formatter has already accommodated to 0..1.0, we should undo this change
     if ( PCS == cmsSigLabData)
     {
         if (!cmsPipelineInsertStage(Lut, cmsAT_BEGIN, _cmsStageNormalizeToLabFloat(ContextID)))
@@ -619,7 +619,7 @@
     cmsContext ContextID  = cmsGetProfileContextID(hProfile);
 
 
-    if (Intent != -1) {
+    if (Intent >= INTENT_PERCEPTUAL && Intent <= INTENT_ABSOLUTE_COLORIMETRIC) {
 
         tag16 = PCS2Device16[Intent];
         tagFloat = PCS2DeviceFloat[Intent];
@@ -680,7 +680,7 @@
     // Check if this is a grayscale profile.
     if (cmsGetColorSpace(hProfile) == cmsSigGrayData) {
 
-        // if so, build appropiate conversion tables.
+        // if so, build appropriate conversion tables.
         // The tables are the PCS iluminant, scaled across GrayTRC
         return BuildGrayOutputPipeline(hProfile);
     }
@@ -738,15 +738,21 @@
 {
     cmsPipeline* Lut;
     cmsTagTypeSignature OriginalType;
-    cmsTagSignature tag16    = Device2PCS16[Intent];
-    cmsTagSignature tagFloat = Device2PCSFloat[Intent];
+    cmsTagSignature tag16;
+    cmsTagSignature tagFloat;
     cmsContext ContextID = cmsGetProfileContextID(hProfile);
 
 
-    // On named color, take the appropiate tag
+    if (Intent < INTENT_PERCEPTUAL || Intent > INTENT_ABSOLUTE_COLORIMETRIC)
+        return NULL;
+
+    tag16 = Device2PCS16[Intent];
+    tagFloat = Device2PCSFloat[Intent];
+
+    // On named color, take the appropriate tag
     if (cmsGetDeviceClass(hProfile) == cmsSigNamedColorClass) {
 
-        cmsNAMEDCOLORLIST* nc = (cmsNAMEDCOLORLIST*) cmsReadTag(hProfile, cmsSigNamedColor2Tag);
+        cmsNAMEDCOLORLIST* nc = (cmsNAMEDCOLORLIST*)cmsReadTag(hProfile, cmsSigNamedColor2Tag);
 
         if (nc == NULL) return NULL;
 
@@ -762,12 +768,13 @@
                 goto Error;
 
         return Lut;
-Error:
+    Error:
         cmsPipelineFree(Lut);
         cmsFreeNamedColorList(nc);
         return NULL;
     }
 
+
     if (cmsIsTag(hProfile, tagFloat)) {  // Float tag takes precedence
 
         // Floating point LUT are always V
@@ -777,19 +784,19 @@
     tagFloat = Device2PCSFloat[0];
     if (cmsIsTag(hProfile, tagFloat)) {
 
-        return cmsPipelineDup((cmsPipeline*) cmsReadTag(hProfile, tagFloat));
+        return cmsPipelineDup((cmsPipeline*)cmsReadTag(hProfile, tagFloat));
     }
 
     if (!cmsIsTag(hProfile, tag16)) {  // Is there any LUT-Based table?
 
-        tag16    = Device2PCS16[0];
+        tag16 = Device2PCS16[0];
         if (!cmsIsTag(hProfile, tag16)) return NULL;
     }
 
     // Check profile version and LUT type. Do the necessary adjustments if needed
 
     // Read the tag
-    Lut = (cmsPipeline*) cmsReadTag(hProfile, tag16);
+    Lut = (cmsPipeline*)cmsReadTag(hProfile, tag16);
     if (Lut == NULL) return NULL;
 
     // The profile owns the Lut, so we need to copy it
@@ -802,7 +809,7 @@
         ChangeInterpolationToTrilinear(Lut);
 
     // After reading it, we have info about the original type
-    OriginalType =  _cmsGetTagTrueType(hProfile, tag16);
+    OriginalType = _cmsGetTagTrueType(hProfile, tag16);
 
     // We need to adjust data for Lab16 on output
     if (OriginalType != cmsSigLut16Type) return Lut;
@@ -810,12 +817,12 @@
     // Here it is possible to get Lab on both sides
 
     if (cmsGetColorSpace(hProfile) == cmsSigLabData) {
-        if(!cmsPipelineInsertStage(Lut, cmsAT_BEGIN, _cmsStageAllocLabV4ToV2(ContextID)))
+        if (!cmsPipelineInsertStage(Lut, cmsAT_BEGIN, _cmsStageAllocLabV4ToV2(ContextID)))
             goto Error2;
     }
 
     if (cmsGetPCS(hProfile) == cmsSigLabData) {
-        if(!cmsPipelineInsertStage(Lut, cmsAT_END, _cmsStageAllocLabV2ToV4(ContextID)))
+        if (!cmsPipelineInsertStage(Lut, cmsAT_END, _cmsStageAllocLabV2ToV4(ContextID)))
             goto Error2;
     }
 
@@ -950,7 +957,7 @@
 }
 
 
-// Auxiliar, read and duplicate a MLU if found.
+// Auxiliary, read and duplicate a MLU if found.
 static
 cmsMLU* GetMLUFromProfile(cmsHPROFILE h, cmsTagSignature sig)
 {
diff --git a/jdk/src/java.desktop/share/native/liblcms/cmslut.c b/jdk/src/java.desktop/share/native/liblcms/cmslut.c
index 69d2fd2..6c4b8ce 100644
--- a/jdk/src/java.desktop/share/native/liblcms/cmslut.c
+++ b/jdk/src/java.desktop/share/native/liblcms/cmslut.c
@@ -30,7 +30,7 @@
 //---------------------------------------------------------------------------------
 //
 //  Little Color Management System
-//  Copyright (c) 1998-2012 Marti Maria Saguer
+//  Copyright (c) 1998-2016 Marti Maria Saguer
 //
 // Permission is hereby granted, free of charge, to any person obtaining
 // a copy of this software and associated documentation files (the "Software"),
@@ -534,7 +534,7 @@
                 goto Error;
         } else {
             NewElem ->Tab.T = (cmsUInt16Number*) _cmsDupMem(mpe ->ContextID, Data ->Tab.T, Data ->nEntries * sizeof (cmsUInt16Number));
-            if (NewElem ->Tab.TFloat == NULL)
+            if (NewElem ->Tab.T == NULL)
                 goto Error;
         }
     }
@@ -1482,7 +1482,8 @@
                  First = FALSE;
              }
              else {
-                Anterior ->Next = NewMPE;
+                if (Anterior != NULL)
+                    Anterior ->Next = NewMPE;
              }
 
             Anterior = NewMPE;
@@ -1836,3 +1837,5 @@
 
     return TRUE;
 }
+
+
diff --git a/jdk/src/java.desktop/share/native/liblcms/cmsmd5.c b/jdk/src/java.desktop/share/native/liblcms/cmsmd5.c
index c238e41..619c94e 100644
--- a/jdk/src/java.desktop/share/native/liblcms/cmsmd5.c
+++ b/jdk/src/java.desktop/share/native/liblcms/cmsmd5.c
@@ -30,7 +30,7 @@
 //---------------------------------------------------------------------------------
 //
 //  Little Color Management System
-//  Copyright (c) 1998-2012 Marti Maria Saguer
+//  Copyright (c) 1998-2016 Marti Maria Saguer
 //
 // Permission is hereby granted, free of charge, to any person obtaining
 // a copy of this software and associated documentation files (the "Software"),
diff --git a/jdk/src/java.desktop/share/native/liblcms/cmsmtrx.c b/jdk/src/java.desktop/share/native/liblcms/cmsmtrx.c
index 6fcdc31..2bc6a49 100644
--- a/jdk/src/java.desktop/share/native/liblcms/cmsmtrx.c
+++ b/jdk/src/java.desktop/share/native/liblcms/cmsmtrx.c
@@ -30,7 +30,7 @@
 //---------------------------------------------------------------------------------
 //
 //  Little Color Management System
-//  Copyright (c) 1998-2012 Marti Maria Saguer
+//  Copyright (c) 1998-2016 Marti Maria Saguer
 //
 // Permission is hereby granted, free of charge, to any person obtaining
 // a copy of this software and associated documentation files (the "Software"),
@@ -67,7 +67,7 @@
     r -> n[VZ] = z;
 }
 
-// Vector substraction
+// Vector subtraction
 void CMSEXPORT _cmsVEC3minus(cmsVEC3* r, const cmsVEC3* a, const cmsVEC3* b)
 {
   r -> n[VX] = a -> n[VX] - b -> n[VX];
@@ -201,3 +201,5 @@
     r->n[VY] = a->v[1].n[VX]*v->n[VX] + a->v[1].n[VY]*v->n[VY] + a->v[1].n[VZ]*v->n[VZ];
     r->n[VZ] = a->v[2].n[VX]*v->n[VX] + a->v[2].n[VY]*v->n[VY] + a->v[2].n[VZ]*v->n[VZ];
 }
+
+
diff --git a/jdk/src/java.desktop/share/native/liblcms/cmsnamed.c b/jdk/src/java.desktop/share/native/liblcms/cmsnamed.c
index fd4e565..870936f 100644
--- a/jdk/src/java.desktop/share/native/liblcms/cmsnamed.c
+++ b/jdk/src/java.desktop/share/native/liblcms/cmsnamed.c
@@ -30,7 +30,7 @@
 //---------------------------------------------------------------------------------
 //
 //  Little Color Management System
-//  Copyright (c) 1998-2012 Marti Maria Saguer
+//  Copyright (c) 1998-2016 Marti Maria Saguer
 //
 // Permission is hereby granted, free of charge, to any person obtaining
 // a copy of this software and associated documentation files (the "Software"),
@@ -121,7 +121,7 @@
 static
 cmsBool GrowMLUtable(cmsMLU* mlu)
 {
-    int AllocatedEntries;
+    cmsUInt32Number AllocatedEntries;
     _cmsMLUentry *NewPtr;
 
     // Sanity check
@@ -147,7 +147,7 @@
 static
 int SearchMLUEntry(cmsMLU* mlu, cmsUInt16Number LanguageCode, cmsUInt16Number CountryCode)
 {
-    int i;
+    cmsUInt32Number i;
 
     // Sanity check
     if (mlu == NULL) return -1;
@@ -207,15 +207,42 @@
     return TRUE;
 }
 
+// Convert from a 3-char code to a cmsUInt16Number. It is done inthis way because some
+// compilers don't properly align beginning of strings
 
-// Add an ASCII entry.
+static
+cmsUInt16Number strTo16(const char str[3])
+{
+    cmsUInt16Number n = ((cmsUInt16Number) str[0] << 8) | str[1];
+
+    return n;  // Always big endian in this case
+}
+
+static
+void strFrom16(char str[3], cmsUInt16Number n)
+{
+    // Assiming this would be aligned
+    union {
+
+       cmsUInt16Number n;
+       char str[2];
+
+    } c;
+
+    c.n = n;  // Always big endian in this case
+
+    str[0] = c.str[0]; str[1] = c.str[1]; str[2] = 0;
+
+}
+
+// Add an ASCII entry. Do not add any \0 termination (ICC1v43_2010-12.pdf page 61)
 cmsBool CMSEXPORT cmsMLUsetASCII(cmsMLU* mlu, const char LanguageCode[3], const char CountryCode[3], const char* ASCIIString)
 {
-    cmsUInt32Number i, len = (cmsUInt32Number) strlen(ASCIIString)+1;
+    cmsUInt32Number i, len = (cmsUInt32Number) strlen(ASCIIString);
     wchar_t* WStr;
     cmsBool  rc;
-    cmsUInt16Number Lang  = _cmsAdjustEndianess16(*(cmsUInt16Number*) LanguageCode);
-    cmsUInt16Number Cntry = _cmsAdjustEndianess16(*(cmsUInt16Number*) CountryCode);
+    cmsUInt16Number Lang  = strTo16(LanguageCode);
+    cmsUInt16Number Cntry = strTo16(CountryCode);
 
     if (mlu == NULL) return FALSE;
 
@@ -245,18 +272,17 @@
     return (cmsUInt32Number)(p - s);
 }
 
-
-// Add a wide entry
+// Add a wide entry. Do not add any \0 terminator (ICC1v43_2010-12.pdf page 61)
 cmsBool  CMSEXPORT cmsMLUsetWide(cmsMLU* mlu, const char Language[3], const char Country[3], const wchar_t* WideString)
 {
-    cmsUInt16Number Lang  = _cmsAdjustEndianess16(*(cmsUInt16Number*) Language);
-    cmsUInt16Number Cntry = _cmsAdjustEndianess16(*(cmsUInt16Number*) Country);
+    cmsUInt16Number Lang  = strTo16(Language);
+    cmsUInt16Number Cntry = strTo16(Country);
     cmsUInt32Number len;
 
     if (mlu == NULL) return FALSE;
     if (WideString == NULL) return FALSE;
 
-    len = (cmsUInt32Number) (mywcslen(WideString) + 1) * sizeof(wchar_t);
+    len = (cmsUInt32Number) (mywcslen(WideString)) * sizeof(wchar_t);
     return AddMLUBlock(mlu, len, WideString, Lang, Cntry);
 }
 
@@ -327,8 +353,8 @@
                               cmsUInt16Number LanguageCode, cmsUInt16Number CountryCode,
                               cmsUInt16Number* UsedLanguageCode, cmsUInt16Number* UsedCountryCode)
 {
-    int i;
-    int Best = -1;
+    cmsUInt32Number i;
+    cmsInt32Number Best = -1;
     _cmsMLUentry* v;
 
     if (mlu == NULL) return NULL;
@@ -379,8 +405,8 @@
     cmsUInt32Number  StrLen = 0;
     cmsUInt32Number ASCIIlen, i;
 
-    cmsUInt16Number Lang  = _cmsAdjustEndianess16(*(cmsUInt16Number*) LanguageCode);
-    cmsUInt16Number Cntry = _cmsAdjustEndianess16(*(cmsUInt16Number*) CountryCode);
+    cmsUInt16Number Lang  = strTo16(LanguageCode);
+    cmsUInt16Number Cntry = strTo16(CountryCode);
 
     // Sanitize
     if (mlu == NULL) return 0;
@@ -423,8 +449,8 @@
     const wchar_t *Wide;
     cmsUInt32Number  StrLen = 0;
 
-    cmsUInt16Number Lang  = _cmsAdjustEndianess16(*(cmsUInt16Number*) LanguageCode);
-    cmsUInt16Number Cntry = _cmsAdjustEndianess16(*(cmsUInt16Number*) CountryCode);
+    cmsUInt16Number Lang  = strTo16(LanguageCode);
+    cmsUInt16Number Cntry = strTo16(CountryCode);
 
     // Sanitize
     if (mlu == NULL) return 0;
@@ -456,8 +482,8 @@
 {
     const wchar_t *Wide;
 
-    cmsUInt16Number Lang  = _cmsAdjustEndianess16(*(cmsUInt16Number*) LanguageCode);
-    cmsUInt16Number Cntry = _cmsAdjustEndianess16(*(cmsUInt16Number*) CountryCode);
+    cmsUInt16Number Lang  = strTo16(LanguageCode);
+    cmsUInt16Number Cntry = strTo16(CountryCode);
     cmsUInt16Number ObtLang, ObtCode;
 
     // Sanitize
@@ -467,10 +493,9 @@
     if (Wide == NULL) return FALSE;
 
     // Get used language and code
-    *(cmsUInt16Number *)ObtainedLanguage = _cmsAdjustEndianess16(ObtLang);
-    *(cmsUInt16Number *)ObtainedCountry  = _cmsAdjustEndianess16(ObtCode);
+    strFrom16(ObtainedLanguage, ObtLang);
+    strFrom16(ObtainedCountry, ObtCode);
 
-    ObtainedLanguage[2] = ObtainedCountry[2] = 0;
     return TRUE;
 }
 
@@ -493,12 +518,12 @@
 
     if (mlu == NULL) return FALSE;
 
-    if (idx >= (cmsUInt32Number) mlu->UsedEntries) return FALSE;
+    if (idx >= mlu->UsedEntries) return FALSE;
 
     entry = &mlu->Entries[idx];
 
-    *(cmsUInt16Number *)LanguageCode = _cmsAdjustEndianess16(entry->Language);
-    *(cmsUInt16Number *)CountryCode  = _cmsAdjustEndianess16(entry->Country);
+    strFrom16(LanguageCode, entry->Language);
+    strFrom16(CountryCode, entry->Country);
 
     return TRUE;
 }
diff --git a/jdk/src/java.desktop/share/native/liblcms/cmsopt.c b/jdk/src/java.desktop/share/native/liblcms/cmsopt.c
index 892ec0a..d40993b 100644
--- a/jdk/src/java.desktop/share/native/liblcms/cmsopt.c
+++ b/jdk/src/java.desktop/share/native/liblcms/cmsopt.c
@@ -27,11 +27,10 @@
 // However, the following notice accompanied the original version of this
 // file:
 //
-
 //---------------------------------------------------------------------------------
 //
 //  Little Color Management System
-//  Copyright (c) 1998-2011 Marti Maria Saguer
+//  Copyright (c) 1998-2016 Marti Maria Saguer
 //
 // Permission is hereby granted, free of charge, to any person obtaining
 // a copy of this software and associated documentation files (the "Software"),
@@ -258,11 +257,10 @@
 
                             // We can not get rid of full matrix
                             cmsStage* Multmat = cmsStageAllocMatrix(Lut->ContextID, 3, 3, (const cmsFloat64Number*) &res, NULL);
+                            if (Multmat == NULL) return FALSE;  // Should never happen
 
                             // Recover the chain
-                            if (Multmat != NULL) {
-                                Multmat->Next = chain;
-                            }
+                            Multmat->Next = chain;
                             *pt1 = Multmat;
                      }
 
@@ -560,7 +558,7 @@
             return TRUE;
 }
 
-// Auxiliar, to see if two values are equal or very different
+// Auxiliary, to see if two values are equal or very different
 static
 cmsBool WhitesAreEqual(int n, cmsUInt16Number White1[], cmsUInt16Number White2[] )
 {
@@ -568,7 +566,7 @@
 
     for (i=0; i < n; i++) {
 
-        if (abs(White1[i] - White2[i]) > 0xf000) return TRUE;  // Values are so extremly different that the fixup should be avoided
+        if (abs(White1[i] - White2[i]) > 0xf000) return TRUE;  // Values are so extremely different that the fixup should be avoided
         if (White1[i] != White2[i]) return FALSE;
     }
     return TRUE;
@@ -706,7 +704,7 @@
         cmsStage* PreLin = cmsPipelineGetPtrToFirstStage(Src);
 
         // Check if suitable
-        if (PreLin ->Type == cmsSigCurveSetElemType) {
+        if (PreLin && PreLin ->Type == cmsSigCurveSetElemType) {
 
             // Maybe this is a linear tram, so we can avoid the whole stuff
             if (!AllCurvesAreLinear(PreLin)) {
@@ -739,7 +737,7 @@
         cmsStage* PostLin = cmsPipelineGetPtrToLastStage(Src);
 
         // Check if suitable
-        if (cmsStageType(PostLin) == cmsSigCurveSetElemType) {
+        if (PostLin && cmsStageType(PostLin) == cmsSigCurveSetElemType) {
 
             // Maybe this is a linear tram, so we can avoid the whole stuff
             if (!AllCurvesAreLinear(PostLin)) {
@@ -1041,8 +1039,8 @@
     }
 
     if (Zeros == 1 && Poles == 1) return FALSE;  // For linear tables
-    if (Zeros > (nEntries / 4)) return TRUE;  // Degenerated, mostly zeros
-    if (Poles > (nEntries / 4)) return TRUE;  // Degenerated, mostly poles
+    if (Zeros > (nEntries / 20)) return TRUE;  // Degenerated, many zeros
+    if (Poles > (nEntries / 20)) return TRUE;  // Degenerated, many poles
 
     return FALSE;
 }
@@ -1064,17 +1062,19 @@
     cmsColorSpaceSignature ColorSpace, OutputColorSpace;
     cmsStage* OptimizedPrelinMpe;
     cmsStage* mpe;
-    cmsToneCurve**   OptimizedPrelinCurves;
-    _cmsStageCLutData*     OptimizedPrelinCLUT;
+    cmsToneCurve** OptimizedPrelinCurves;
+    _cmsStageCLutData* OptimizedPrelinCLUT;
 
 
     // This is a loosy optimization! does not apply in floating-point cases
     if (_cmsFormatterIsFloat(*InputFormat) || _cmsFormatterIsFloat(*OutputFormat)) return FALSE;
 
-    // Only on RGB
+    // Only on chunky RGB
     if (T_COLORSPACE(*InputFormat)  != PT_RGB) return FALSE;
-    if (T_COLORSPACE(*OutputFormat) != PT_RGB) return FALSE;
+    if (T_PLANAR(*InputFormat)) return FALSE;
 
+    if (T_COLORSPACE(*OutputFormat) != PT_RGB) return FALSE;
+    if (T_PLANAR(*OutputFormat)) return FALSE;
 
     // On 16 bits, user has to specify the feature
     if (!_cmsFormatterIs8bit(*InputFormat)) {
@@ -1098,6 +1098,22 @@
     memset(Trans, 0, sizeof(Trans));
     memset(TransReverse, 0, sizeof(TransReverse));
 
+    // If the last stage of the original lut are curves, and those curves are
+    // degenerated, it is likely the transform is squeezing and clipping
+    // the output from previous CLUT. We cannot optimize this case
+    {
+        cmsStage* last = cmsPipelineGetPtrToLastStage(OriginalLut);
+
+        if (cmsStageType(last) == cmsSigCurveSetElemType) {
+
+            _cmsStageToneCurvesData* Data = (_cmsStageToneCurvesData*)cmsStageData(last);
+            for (i = 0; i < Data->nCurves; i++) {
+                if (IsDegenerated(Data->TheCurves[i]))
+                    goto Error;
+            }
+        }
+    }
+
     for (t = 0; t < OriginalLut ->InputChannels; t++) {
         Trans[t] = cmsBuildTabulatedToneCurve16(OriginalLut ->ContextID, PRELINEARIZATION_POINTS, NULL);
         if (Trans[t] == NULL) goto Error;
@@ -1431,7 +1447,10 @@
         GammaTables[i] = NULL;
     }
 
-    if (GammaTables != NULL) _cmsFree(Src ->ContextID, GammaTables);
+    if (GammaTables != NULL) {
+        _cmsFree(Src->ContextID, GammaTables);
+        GammaTables = NULL;
+    }
 
     // Maybe the curves are linear at the end
     if (!AllCurvesAreLinear(ObtainedCurves)) {
diff --git a/jdk/src/java.desktop/share/native/liblcms/cmspack.c b/jdk/src/java.desktop/share/native/liblcms/cmspack.c
index e389c4e..a9087f6 100644
--- a/jdk/src/java.desktop/share/native/liblcms/cmspack.c
+++ b/jdk/src/java.desktop/share/native/liblcms/cmspack.c
@@ -30,7 +30,7 @@
 //---------------------------------------------------------------------------------
 //
 //  Little Color Management System
-//  Copyright (c) 1998-2010 Marti Maria Saguer
+//  Copyright (c) 1998-2016 Marti Maria Saguer
 //
 // Permission is hereby granted, free of charge, to any person obtaining
 // a copy of this software and associated documentation files (the "Software"),
@@ -110,7 +110,7 @@
 #define ANYFLAVOR       FLAVOR_SH(1)
 
 
-// Supress waning about info never being used
+// Suppress waning about info never being used
 
 #ifdef _MSC_VER
 #pragma warning(disable : 4100)
@@ -3188,6 +3188,8 @@
     cmsUInt32Number i;
     cmsFormatter fr;
 
+    // Optimization is only a hint
+    dwInput &= ~OPTIMIZED_SH(1);
 
     switch (dwFlags)
     {
diff --git a/jdk/src/java.desktop/share/native/liblcms/cmspcs.c b/jdk/src/java.desktop/share/native/liblcms/cmspcs.c
index d4ef694..f2ebf53 100644
--- a/jdk/src/java.desktop/share/native/liblcms/cmspcs.c
+++ b/jdk/src/java.desktop/share/native/liblcms/cmspcs.c
@@ -30,7 +30,7 @@
 //---------------------------------------------------------------------------------
 //
 //  Little Color Management System
-//  Copyright (c) 1998-2010 Marti Maria Saguer
+//  Copyright (c) 1998-2016 Marti Maria Saguer
 //
 // Permission is hereby granted, free of charge, to any person obtaining
 // a copy of this software and associated documentation files (the "Software"),
@@ -337,7 +337,7 @@
     wLab[2] = ab2Fix4(Lab.b);
 }
 
-// Auxiliar: convert to Radians
+// Auxiliary: convert to Radians
 static
 cmsFloat64Number RADIANS(cmsFloat64Number deg)
 {
@@ -345,7 +345,7 @@
 }
 
 
-// Auxiliar: atan2 but operating in degrees and returning 0 if a==b==0
+// Auxiliary: atan2 but operating in degrees and returning 0 if a==b==0
 static
 cmsFloat64Number atan2deg(cmsFloat64Number a, cmsFloat64Number b)
 {
@@ -368,7 +368,7 @@
 }
 
 
-// Auxiliar: Square
+// Auxiliary: Square
 static
 cmsFloat64Number Sqr(cmsFloat64Number v)
 {
diff --git a/jdk/src/java.desktop/share/native/liblcms/cmsplugin.c b/jdk/src/java.desktop/share/native/liblcms/cmsplugin.c
index 9fe6bc3..683c830 100644
--- a/jdk/src/java.desktop/share/native/liblcms/cmsplugin.c
+++ b/jdk/src/java.desktop/share/native/liblcms/cmsplugin.c
@@ -30,7 +30,7 @@
 //---------------------------------------------------------------------------------
 //
 //  Little Color Management System
-//  Copyright (c) 1998-2010 Marti Maria Saguer
+//  Copyright (c) 1998-2016 Marti Maria Saguer
 //
 // Permission is hereby granted, free of charge, to any person obtaining
 // a copy of this software and associated documentation files (the "Software"),
@@ -136,7 +136,7 @@
 #endif
 }
 
-// Auxiliar -- read 8, 16 and 32-bit numbers
+// Auxiliary -- read 8, 16 and 32-bit numbers
 cmsBool CMSEXPORT  _cmsReadUInt8Number(cmsIOHANDLER* io, cmsUInt8Number* n)
 {
     cmsUInt8Number tmp;
@@ -201,13 +201,13 @@
 
     _cmsAssert(io != NULL);
 
-    if (io -> Read(io, &tmp, sizeof(cmsFloat32Number), 1) != 1)
+    if (io -> Read(io, &tmp, sizeof(cmsUInt32Number), 1) != 1)
             return FALSE;
 
     if (n != NULL) {
 
         tmp = _cmsAdjustEndianess32(tmp);
-        *n = *(cmsFloat32Number*) &tmp;
+        *n = *(cmsFloat32Number*) (void*) &tmp;
     }
     return TRUE;
 }
@@ -244,22 +244,6 @@
 }
 
 
-// Jun-21-2000: Some profiles (those that comes with W2K) comes
-// with the media white (media black?) x 100. Add a sanity check
-
-static
-void NormalizeXYZ(cmsCIEXYZ* Dest)
-{
-    while (Dest -> X > 2. &&
-           Dest -> Y > 2. &&
-           Dest -> Z > 2.) {
-
-               Dest -> X /= 10.;
-               Dest -> Y /= 10.;
-               Dest -> Z /= 10.;
-       }
-}
-
 cmsBool CMSEXPORT  _cmsReadXYZNumber(cmsIOHANDLER* io, cmsCIEXYZ* XYZ)
 {
     cmsEncodedXYZNumber xyz;
@@ -273,8 +257,6 @@
         XYZ->X = _cms15Fixed16toDouble(_cmsAdjustEndianess32(xyz.X));
         XYZ->Y = _cms15Fixed16toDouble(_cmsAdjustEndianess32(xyz.Y));
         XYZ->Z = _cms15Fixed16toDouble(_cmsAdjustEndianess32(xyz.Z));
-
-        NormalizeXYZ(XYZ);
     }
     return TRUE;
 }
@@ -336,7 +318,7 @@
 
     _cmsAssert(io != NULL);
 
-    tmp = *(cmsUInt32Number*) &n;
+    tmp = *(cmsUInt32Number*) (void*) &n;
     tmp = _cmsAdjustEndianess32(tmp);
     if (io -> Write(io, sizeof(cmsUInt32Number), &tmp) != 1)
             return FALSE;
@@ -532,7 +514,10 @@
     va_start(args, frm);
 
     len = vsnprintf((char*) Buffer, 2047, frm, args);
-    if (len < 0) return FALSE;   // Truncated, which is a fatal error for us
+    if (len < 0) {
+        va_end(args);
+        return FALSE;   // Truncated, which is a fatal error for us
+    }
 
     rc = io ->Write(io, len, Buffer);
 
@@ -554,6 +539,7 @@
         if (ContextID == NULL) {
 
             ctx->MemPool = _cmsCreateSubAlloc(0, 2*1024);
+            if (ctx->MemPool == NULL) return NULL;
         }
         else {
             cmsSignalError(ContextID, cmsERROR_CORRUPTION_DETECTED, "NULL memory pool on context");
@@ -989,3 +975,5 @@
 {
     return _cmsContextGetClientChunk(ContextID, UserPtr);
 }
+
+
diff --git a/jdk/src/java.desktop/share/native/liblcms/cmsps2.c b/jdk/src/java.desktop/share/native/liblcms/cmsps2.c
index 22089d0..03d476b 100644
--- a/jdk/src/java.desktop/share/native/liblcms/cmsps2.c
+++ b/jdk/src/java.desktop/share/native/liblcms/cmsps2.c
@@ -30,7 +30,7 @@
 //---------------------------------------------------------------------------------
 //
 //  Little Color Management System
-//  Copyright (c) 1998-2011 Marti Maria Saguer
+//  Copyright (c) 1998-2016 Marti Maria Saguer
 //
 // Permission is hereby granted, free of charge, to any person obtaining
 // a copy of this software and associated documentation files (the "Software"),
@@ -608,7 +608,7 @@
 //
 //  Each row contains Pipeline values for all but first component. So, I
 //  detect row changing by keeping a copy of last value of first
-//  component. -1 is used to mark begining of whole block.
+//  component. -1 is used to mark beginning of whole block.
 
 static
 int OutputValueSampler(register const cmsUInt16Number In[], register cmsUInt16Number Out[], register void* Cargo)
@@ -1422,14 +1422,15 @@
     if (nColorant > cmsMAXCHANNELS)
         nColorant = cmsMAXCHANNELS;
 
-    for (j=0; j < nColorant; j++) {
+    for (j = 0; j < nColorant; j++) {
 
-                sprintf(Buff, "%.3f", Out[j] / 65535.0);
-                strcat(Colorant, Buff);
-                if (j < nColorant -1)
-                        strcat(Colorant, " ");
+        snprintf(Buff, 31, "%.3f", Out[j] / 65535.0);
+        Buff[31] = 0;
+        strcat(Colorant, Buff);
+        if (j < nColorant - 1)
+            strcat(Colorant, " ");
 
-        }
+    }
 }
 
 
diff --git a/jdk/src/java.desktop/share/native/liblcms/cmssamp.c b/jdk/src/java.desktop/share/native/liblcms/cmssamp.c
index bcd9d50..b22c427 100644
--- a/jdk/src/java.desktop/share/native/liblcms/cmssamp.c
+++ b/jdk/src/java.desktop/share/native/liblcms/cmssamp.c
@@ -30,7 +30,7 @@
 //---------------------------------------------------------------------------------
 //
 //  Little Color Management System
-//  Copyright (c) 1998-2014 Marti Maria Saguer
+//  Copyright (c) 1998-2016 Marti Maria Saguer
 //
 // Permission is hereby granted, free of charge, to any person obtaining
 // a copy of this software and associated documentation files (the "Software"),
diff --git a/jdk/src/java.desktop/share/native/liblcms/cmssm.c b/jdk/src/java.desktop/share/native/liblcms/cmssm.c
index 783f3c3..1923a02 100644
--- a/jdk/src/java.desktop/share/native/liblcms/cmssm.c
+++ b/jdk/src/java.desktop/share/native/liblcms/cmssm.c
@@ -30,7 +30,7 @@
 //---------------------------------------------------------------------------------
 //
 //  Little Color Management System
-//  Copyright (c) 1998-2011 Marti Maria Saguer
+//  Copyright (c) 1998-2016 Marti Maria Saguer
 //
 // Permission is hereby granted, free of charge, to any person obtaining
 // a copy of this software and associated documentation files (the "Software"),
@@ -247,7 +247,8 @@
 {
     cmsFloat64Number a, b, c, d, e, D;
     cmsFloat64Number sc, sN, sD;
-    cmsFloat64Number tc, tN, tD;
+    //cmsFloat64Number tc; // left for future use
+    cmsFloat64Number tN, tD;
     cmsVEC3 w0;
 
     _cmsVEC3minus(&w0, &line1 ->a, &line2 ->a);
@@ -315,7 +316,7 @@
     }
     // finally do the division to get sc and tc
     sc = (fabs(sN) < MATRIX_DET_TOLERANCE ? 0.0 : sN / sD);
-    tc = (fabs(tN) < MATRIX_DET_TOLERANCE ? 0.0 : tN / tD);
+    //tc = (fabs(tN) < MATRIX_DET_TOLERANCE ? 0.0 : tN / tD); // left for future use.
 
     GetPointOfLine(r, line1, sc);
     return TRUE;
@@ -346,7 +347,7 @@
 }
 
 
-// Auxiliar to retrieve a pointer to the segmentr containing the Lab value
+// Auxiliary to retrieve a pointer to the segmentr containing the Lab value
 static
 cmsGDBPoint* GetPoint(cmsGDB* gbd, const cmsCIELab* Lab, cmsSpherical* sp)
 {
@@ -358,7 +359,7 @@
     _cmsAssert(Lab != NULL);
     _cmsAssert(sp != NULL);
 
-    // Center L* by substracting half of its domain, that's 50
+    // Center L* by subtracting half of its domain, that's 50
     _cmsVEC3init(&v, Lab ->L - 50.0, Lab ->a, Lab ->b);
 
     // Convert to spherical coordinates
diff --git a/jdk/src/java.desktop/share/native/liblcms/cmstypes.c b/jdk/src/java.desktop/share/native/liblcms/cmstypes.c
index 684a205..2563a62 100644
--- a/jdk/src/java.desktop/share/native/liblcms/cmstypes.c
+++ b/jdk/src/java.desktop/share/native/liblcms/cmstypes.c
@@ -30,7 +30,7 @@
 //---------------------------------------------------------------------------------
 //
 //  Little Color Management System
-//  Copyright (c) 1998-2014 Marti Maria Saguer
+//  Copyright (c) 1998-2016 Marti Maria Saguer
 //
 // Permission is hereby granted, free of charge, to any person obtaining
 // a copy of this software and associated documentation files (the "Software"),
@@ -59,7 +59,7 @@
 // This file implements every single tag and tag type as described in the ICC spec. Some types
 // have been deprecated, like ncl and Data. There is no implementation for those types as there
 // are no profiles holding them. The programmer can also extend this list by defining his own types
-// by using the appropiate plug-in. There are three types of plug ins regarding that. First type
+// by using the appropriate plug-in. There are three types of plug ins regarding that. First type
 // allows to define new tags using any existing type. Next plug-in type allows to define new types
 // and the third one is very specific: allows to extend the number of elements in the multiprocessing
 // elements special type.
@@ -142,7 +142,7 @@
 }
 
 
-// Auxiliar to convert UTF-32 to UTF-16 in some cases
+// Auxiliary to convert UTF-32 to UTF-16 in some cases
 static
 cmsBool _cmsWriteWCharArray(cmsIOHANDLER* io, cmsUInt32Number n, const wchar_t* Array)
 {
@@ -158,7 +158,7 @@
     return TRUE;
 }
 
-// Auxiliar to read an array of wchar_t
+// Auxiliary to read an array of wchar_t
 static
 cmsBool _cmsReadWCharArray(cmsIOHANDLER* io, cmsUInt32Number n, wchar_t* Array)
 {
@@ -189,7 +189,7 @@
                                              cmsUInt32Number n,
                                              cmsUInt32Number SizeOfTag);
 
-// Helper function to deal with position tables as decribed in ICC spec 4.3
+// Helper function to deal with position tables as described in ICC spec 4.3
 // A table of n elements is readed, where first comes n records containing offsets and sizes and
 // then a block containing the data itself. This allows to reuse same data in more than one entry
 static
@@ -980,7 +980,7 @@
     cmsMLU* mlu = (cmsMLU*) Ptr;
     char *Text = NULL;
     wchar_t *Wide = NULL;
-    cmsUInt32Number len, len_aligned, len_filler_alignment;
+    cmsUInt32Number len, len_text, len_tag_requirement, len_aligned;
     cmsBool  rc = FALSE;
     char Filler[68];
 
@@ -990,17 +990,18 @@
     // Get the len of string
     len = cmsMLUgetASCII(mlu, cmsNoLanguage, cmsNoCountry, NULL, 0);
 
-    // From ICC3.4: It has been found that textDescriptionType can contain misaligned data
+    // Specification ICC.1:2001-04 (v2.4.0): It has been found that textDescriptionType can contain misaligned data
     //(see clause 4.1 for the definition of “aligned”). Because the Unicode language
     // code and Unicode count immediately follow the ASCII description, their
     // alignment is not correct if the ASCII count is not a multiple of four. The
     // ScriptCode code is misaligned when the ASCII count is odd. Profile reading and
     // writing software must be written carefully in order to handle these alignment
     // problems.
-
-    // Compute an aligned size
-    len_aligned = _cmsALIGNLONG(len);
-    len_filler_alignment = len_aligned - len;
+    //
+    // The above last sentence suggest to handle alignment issues in the
+    // parser. The provided example (Table 69 on Page 60) makes this clear.
+    // The padding only in the ASCII count is not sufficient for a aligned tag
+    // size, with the same text size in ASCII and Unicode.
 
     // Null strings
     if (len <= 0) {
@@ -1021,6 +1022,12 @@
         cmsMLUgetWide(mlu,  cmsNoLanguage, cmsNoCountry,  Wide, len * sizeof(wchar_t));
     }
 
+    // Tell the real text len including the null terminator and padding
+    len_text = (cmsUInt32Number) strlen(Text) + 1;
+    // Compute an total tag size requirement
+    len_tag_requirement = (8+4+len_text+4+4+2*len_text+2+1+67);
+    len_aligned = _cmsALIGNLONG(len_tag_requirement);
+
   // * cmsUInt32Number       count;          * Description length
   // * cmsInt8Number         desc[count]     * NULL terminated ascii string
   // * cmsUInt32Number       ucLangCode;     * UniCode language code
@@ -1030,20 +1037,14 @@
   // * cmsUInt8Number        scCount;        * ScriptCode count
   // * cmsInt8Number         scDesc[67];     * ScriptCode Description
 
-    if (!_cmsWriteUInt32Number(io, len_aligned)) goto Error;
-    if (!io ->Write(io, len, Text)) goto Error;
-    if (!io ->Write(io, len_filler_alignment, Filler)) goto Error;
+    if (!_cmsWriteUInt32Number(io, len_text)) goto Error;
+    if (!io ->Write(io, len_text, Text)) goto Error;
 
     if (!_cmsWriteUInt32Number(io, 0)) goto Error;  // ucLanguageCode
 
-    // This part is tricky: we need an aligned tag size, and the ScriptCode part
-    // takes 70 bytes, so we need 2 extra bytes to do the alignment
-
-    if (!_cmsWriteUInt32Number(io, len_aligned+1)) goto Error;
-
+    if (!_cmsWriteUInt32Number(io, len_text)) goto Error;
     // Note that in some compilers sizeof(cmsUInt16Number) != sizeof(wchar_t)
-    if (!_cmsWriteWCharArray(io, len, Wide)) goto Error;
-    if (!_cmsWriteUInt16Array(io, len_filler_alignment+1, (cmsUInt16Number*) Filler)) goto Error;
+    if (!_cmsWriteWCharArray(io, len_text, Wide)) goto Error;
 
     // ScriptCode Code & count (unused)
     if (!_cmsWriteUInt16Number(io, 0)) goto Error;
@@ -1051,6 +1052,10 @@
 
     if (!io ->Write(io, 67, Filler)) goto Error;
 
+    // possibly add pad at the end of tag
+    if(len_aligned - len_tag_requirement > 0)
+      if (!io ->Write(io, len_aligned - len_tag_requirement, Filler)) goto Error;
+
     rc = TRUE;
 
 Error:
@@ -1498,7 +1503,7 @@
             LargestPosition = EndOfThisString;
     }
 
-    // Now read the remaining of tag and fill all strings. Substract the directory
+    // Now read the remaining of tag and fill all strings. Subtract the directory
     SizeOfTag   = (LargestPosition * sizeof(wchar_t)) / sizeof(cmsUInt16Number);
     if (SizeOfTag == 0)
     {
@@ -1532,7 +1537,7 @@
     cmsMLU* mlu =(cmsMLU*) Ptr;
     cmsUInt32Number HeaderSize;
     cmsUInt32Number  Len, Offset;
-    int i;
+    cmsUInt32Number i;
 
     if (Ptr == NULL) {
 
@@ -3133,6 +3138,8 @@
 
         memset(Colorant, 0, sizeof(Colorant));
         if (io -> Read(io, Root, 32, 1) != 1) return NULL;
+        Root[32] = 0;  // To prevent exploits
+
         if (!_cmsReadUInt16Array(io, 3, PCS)) goto Error;
         if (!_cmsReadUInt16Array(io, nDeviceCoords, Colorant)) goto Error;
 
@@ -3155,8 +3162,8 @@
 cmsBool Type_NamedColor_Write(struct _cms_typehandler_struct* self, cmsIOHANDLER* io, void* Ptr, cmsUInt32Number nItems)
 {
     cmsNAMEDCOLORLIST* NamedColorList = (cmsNAMEDCOLORLIST*) Ptr;
-    char                prefix[32];     // Prefix for each color name
-    char                suffix[32];     // Suffix for each color name
+    char                prefix[33];     // Prefix for each color name
+    char                suffix[33];     // Suffix for each color name
     int i, nColors;
 
     nColors = cmsNamedColorCount(NamedColorList);
@@ -3168,7 +3175,7 @@
     strncpy(prefix, (const char*) NamedColorList->Prefix, 32);
     strncpy(suffix, (const char*) NamedColorList->Suffix, 32);
 
-    suffix[31] = prefix[31] = 0;
+    suffix[32] = prefix[32] = 0;
 
     if (!io ->Write(io, 32, prefix)) return FALSE;
     if (!io ->Write(io, 32, suffix)) return FALSE;
@@ -3180,6 +3187,7 @@
        char Root[33];
 
         if (!cmsNamedColorInfo(NamedColorList, i, Root, NULL, NULL, PCS, Colorant)) return 0;
+        Root[32] = 0;
         if (!io ->Write(io, 32 , Root)) return FALSE;
         if (!_cmsWriteUInt16Array(io, 3, PCS)) return FALSE;
         if (!_cmsWriteUInt16Array(io, NamedColorList ->ColorantCount, Colorant)) return FALSE;
@@ -3630,7 +3638,7 @@
 
 
 
-// Auxiliar, read an string specified as count + string
+// Auxiliary, read an string specified as count + string
 static
 cmsBool  ReadCountAndSting(struct _cms_typehandler_struct* self, cmsIOHANDLER* io, cmsMLU* mlu, cmsUInt32Number* SizeOfTag, const char* Section)
 {
@@ -3879,7 +3887,7 @@
 static
 void* Type_ViewingConditions_Dup(struct _cms_typehandler_struct* self, const void *Ptr, cmsUInt32Number n)
 {
-   return _cmsDupMem(self ->ContextID, Ptr, sizeof(cmsScreening));
+   return _cmsDupMem(self->ContextID, Ptr, sizeof(cmsICCViewingConditions));
 
    cmsUNUSED_PARAMETER(n);
 }
@@ -4333,13 +4341,13 @@
 static
 cmsBool  Type_MPEclut_Write(struct _cms_typehandler_struct* self, cmsIOHANDLER* io, void* Ptr, cmsUInt32Number nItems)
 {
-    cmsUInt8Number Dimensions8[16];
+    cmsUInt8Number Dimensions8[16];  // 16 because the spec says 16 and not max number of channels
     cmsUInt32Number i;
     cmsStage* mpe = (cmsStage*) Ptr;
     _cmsStageCLutData* clut = (_cmsStageCLutData*) mpe ->Data;
 
-    // Check for maximum number of channels
-    if (mpe -> InputChannels > 15) return FALSE;
+    // Check for maximum number of channels supported by lcms
+    if (mpe -> InputChannels > MAX_INPUT_DIMENSIONS) return FALSE;
 
     // Only floats are supported in MPE
     if (clut ->HasFloatValues == FALSE) return FALSE;
@@ -5477,8 +5485,9 @@
     { cmsSigScreeningTag,           { 1, 1, { cmsSigScreeningType},          NULL }, &SupportedTags[59]},
     { cmsSigVcgtTag,                { 1, 1, { cmsSigVcgtType},               NULL }, &SupportedTags[60]},
     { cmsSigMetaTag,                { 1, 1, { cmsSigDictType},               NULL }, &SupportedTags[61]},
-    { cmsSigProfileSequenceIdTag,   { 1, 1, { cmsSigProfileSequenceIdType},  NULL },  &SupportedTags[62]},
-    { cmsSigProfileDescriptionMLTag,{ 1, 1, { cmsSigMultiLocalizedUnicodeType}, NULL}, NULL}
+    { cmsSigProfileSequenceIdTag,   { 1, 1, { cmsSigProfileSequenceIdType},  NULL }, &SupportedTags[62]},
+    { cmsSigProfileDescriptionMLTag,{ 1, 1, { cmsSigMultiLocalizedUnicodeType}, NULL}, &SupportedTags[63]},
+    { cmsSigArgyllArtsTag,          { 9, 1, { cmsSigS15Fixed16ArrayType},    NULL}, NULL}
 
 
 };
diff --git a/jdk/src/java.desktop/share/native/liblcms/cmsvirt.c b/jdk/src/java.desktop/share/native/liblcms/cmsvirt.c
index 6c84f13..8d353b3 100644
--- a/jdk/src/java.desktop/share/native/liblcms/cmsvirt.c
+++ b/jdk/src/java.desktop/share/native/liblcms/cmsvirt.c
@@ -30,7 +30,7 @@
 //---------------------------------------------------------------------------------
 //
 //  Little Color Management System
-//  Copyright (c) 1998-2014 Marti Maria Saguer
+//  Copyright (c) 1998-2016 Marti Maria Saguer
 //
 // Permission is hereby granted, free of charge, to any person obtaining
 // a copy of this software and associated documentation files (the "Software"),
@@ -1167,15 +1167,20 @@
     // If no way, then force CLUT that for sure can be written
     if (AllowedLUT == NULL) {
 
+        cmsStage* FirstStage;
+        cmsStage* LastStage;
+
         dwFlags |= cmsFLAGS_FORCE_CLUT;
         _cmsOptimizePipeline(ContextID, &LUT, xform ->RenderingIntent, &FrmIn, &FrmOut, &dwFlags);
 
         // Put identity curves if needed
-        if (cmsPipelineGetPtrToFirstStage(LUT) ->Type != cmsSigCurveSetElemType)
+        FirstStage = cmsPipelineGetPtrToFirstStage(LUT);
+        if (FirstStage != NULL && FirstStage ->Type != cmsSigCurveSetElemType)
              if (!cmsPipelineInsertStage(LUT, cmsAT_BEGIN, _cmsStageAllocIdentityCurves(ContextID, ChansIn)))
                  goto Error;
 
-        if (cmsPipelineGetPtrToLastStage(LUT) ->Type != cmsSigCurveSetElemType)
+        LastStage = cmsPipelineGetPtrToLastStage(LUT);
+        if (LastStage != NULL && LastStage ->Type != cmsSigCurveSetElemType)
              if (!cmsPipelineInsertStage(LUT, cmsAT_END,   _cmsStageAllocIdentityCurves(ContextID, ChansOut)))
                  goto Error;
 
diff --git a/jdk/src/java.desktop/share/native/liblcms/cmswtpnt.c b/jdk/src/java.desktop/share/native/liblcms/cmswtpnt.c
index 5dceaab..d23b29f 100644
--- a/jdk/src/java.desktop/share/native/liblcms/cmswtpnt.c
+++ b/jdk/src/java.desktop/share/native/liblcms/cmswtpnt.c
@@ -30,7 +30,7 @@
 //---------------------------------------------------------------------------------
 //
 //  Little Color Management System
-//  Copyright (c) 1998-2014 Marti Maria Saguer
+//  Copyright (c) 1998-2016 Marti Maria Saguer
 //
 // Permission is hereby granted, free of charge, to any person obtaining
 // a copy of this software and associated documentation files (the "Software"),
@@ -376,3 +376,5 @@
 
     return TRUE;
 }
+
+
diff --git a/jdk/src/java.desktop/share/native/liblcms/cmsxform.c b/jdk/src/java.desktop/share/native/liblcms/cmsxform.c
index c0a0693..dfedd7f 100644
--- a/jdk/src/java.desktop/share/native/liblcms/cmsxform.c
+++ b/jdk/src/java.desktop/share/native/liblcms/cmsxform.c
@@ -30,7 +30,7 @@
 //---------------------------------------------------------------------------------
 //
 //  Little Color Management System
-//  Copyright (c) 1998-2014 Marti Maria Saguer
+//  Copyright (c) 1998-2016 Marti Maria Saguer
 //
 // Permission is hereby granted, free of charge, to any person obtaining
 // a copy of this software and associated documentation files (the "Software"),
@@ -208,12 +208,18 @@
 
 {
     _cmsTRANSFORM* p = (_cmsTRANSFORM*) Transform;
+    cmsStride stride;
 
-    p -> xform(p, InputBuffer, OutputBuffer, Size, Size);
+    stride.BytesPerLineIn = 0;  // Not used
+    stride.BytesPerLineOut = 0;
+    stride.BytesPerPlaneIn = Size;
+    stride.BytesPerPlaneOut = Size;
+
+    p -> xform(p, InputBuffer, OutputBuffer, Size, 1, &stride);
 }
 
 
-// Apply transform.
+// This is a legacy stride for planar
 void CMSEXPORT cmsDoTransformStride(cmsHTRANSFORM  Transform,
                               const void* InputBuffer,
                               void* OutputBuffer,
@@ -221,10 +227,40 @@
 
 {
     _cmsTRANSFORM* p = (_cmsTRANSFORM*) Transform;
+    cmsStride stride;
 
-    p -> xform(p, InputBuffer, OutputBuffer, Size, Stride);
+    stride.BytesPerLineIn = 0;
+    stride.BytesPerLineOut = 0;
+    stride.BytesPerPlaneIn = Stride;
+    stride.BytesPerPlaneOut = Stride;
+
+    p -> xform(p, InputBuffer, OutputBuffer, Size, 1, &stride);
 }
 
+// This is the "fast" function for plugins
+void CMSEXPORT cmsDoTransformLineStride(cmsHTRANSFORM  Transform,
+                              const void* InputBuffer,
+                              void* OutputBuffer,
+                              cmsUInt32Number PixelsPerLine,
+                              cmsUInt32Number LineCount,
+                              cmsUInt32Number BytesPerLineIn,
+                              cmsUInt32Number BytesPerLineOut,
+                              cmsUInt32Number BytesPerPlaneIn,
+                              cmsUInt32Number BytesPerPlaneOut)
+
+{
+    _cmsTRANSFORM* p = (_cmsTRANSFORM*) Transform;
+    cmsStride stride;
+
+    stride.BytesPerLineIn = BytesPerLineIn;
+    stride.BytesPerLineOut = BytesPerLineOut;
+    stride.BytesPerPlaneIn = BytesPerPlaneIn;
+    stride.BytesPerPlaneOut = BytesPerPlaneOut;
+
+    p->xform(p, InputBuffer, OutputBuffer, PixelsPerLine, LineCount, &stride);
+}
+
+
 
 // Transform routines ----------------------------------------------------------------------------------------------------------
 
@@ -233,49 +269,64 @@
 static
 void FloatXFORM(_cmsTRANSFORM* p,
                 const void* in,
-                void* out, cmsUInt32Number Size, cmsUInt32Number Stride)
+                void* out,
+                cmsUInt32Number PixelsPerLine,
+                cmsUInt32Number LineCount,
+                const cmsStride* Stride)
 {
     cmsUInt8Number* accum;
     cmsUInt8Number* output;
     cmsFloat32Number fIn[cmsMAXCHANNELS], fOut[cmsMAXCHANNELS];
     cmsFloat32Number OutOfGamut;
-    cmsUInt32Number i, j;
+    cmsUInt32Number i, j, c, strideIn, strideOut;
 
-    accum  = (cmsUInt8Number*)  in;
-    output = (cmsUInt8Number*)  out;
+    _cmsHandleExtraChannels(p, in, out, PixelsPerLine, LineCount, Stride);
 
-    for (i=0; i < Size; i++) {
+    strideIn = 0;
+    strideOut = 0;
 
-        accum = p -> FromInputFloat(p, fIn, accum, Stride);
+    for (i = 0; i < LineCount; i++) {
 
-        // Any gamut chack to do?
-        if (p ->GamutCheck != NULL) {
+        accum = (cmsUInt8Number*)in + strideIn;
+        output = (cmsUInt8Number*)out + strideOut;
 
-            // Evaluate gamut marker.
-            cmsPipelineEvalFloat( fIn, &OutOfGamut, p ->GamutCheck);
+        for (j = 0; j < PixelsPerLine; j++) {
 
-            // Is current color out of gamut?
-            if (OutOfGamut > 0.0) {
+            accum = p->FromInputFloat(p, fIn, accum, Stride->BytesPerPlaneIn);
 
-                // Certainly, out of gamut
-                for (j=0; j < cmsMAXCHANNELS; j++)
-                    fOut[j] = -1.0;
+            // Any gamut chack to do?
+            if (p->GamutCheck != NULL) {
 
+                // Evaluate gamut marker.
+                cmsPipelineEvalFloat(fIn, &OutOfGamut, p->GamutCheck);
+
+                // Is current color out of gamut?
+                if (OutOfGamut > 0.0) {
+
+                    // Certainly, out of gamut
+                    for (c = 0; c < cmsMAXCHANNELS; c++)
+                        fOut[c] = -1.0;
+
+                }
+                else {
+                    // No, proceed normally
+                    cmsPipelineEvalFloat(fIn, fOut, p->Lut);
+                }
             }
             else {
-                // No, proceed normally
-                cmsPipelineEvalFloat(fIn, fOut, p -> Lut);
+
+                // No gamut check at all
+                cmsPipelineEvalFloat(fIn, fOut, p->Lut);
             }
-        }
-        else {
 
-            // No gamut check at all
-            cmsPipelineEvalFloat(fIn, fOut, p -> Lut);
+
+            output = p->ToOutputFloat(p, fOut, output, Stride->BytesPerPlaneOut);
         }
 
-        // Back to asked representation
-        output = p -> ToOutputFloat(p, fOut, output, Stride);
+        strideIn += Stride->BytesPerLineIn;
+        strideOut += Stride->BytesPerLineOut;
     }
+
 }
 
 
@@ -283,22 +334,34 @@
 void NullFloatXFORM(_cmsTRANSFORM* p,
                     const void* in,
                     void* out,
-                    cmsUInt32Number Size,
-                    cmsUInt32Number Stride)
+                    cmsUInt32Number PixelsPerLine,
+                    cmsUInt32Number LineCount,
+                    const cmsStride* Stride)
+
 {
     cmsUInt8Number* accum;
     cmsUInt8Number* output;
     cmsFloat32Number fIn[cmsMAXCHANNELS];
-    cmsUInt32Number i, n;
+    cmsUInt32Number i, j, strideIn, strideOut;
 
-    accum  = (cmsUInt8Number*)  in;
-    output = (cmsUInt8Number*)  out;
-    n = Size;
+    _cmsHandleExtraChannels(p, in, out, PixelsPerLine, LineCount, Stride);
 
-    for (i=0; i < n; i++) {
+    strideIn = 0;
+    strideOut = 0;
 
-        accum  = p -> FromInputFloat(p, fIn, accum, Stride);
-        output = p -> ToOutputFloat(p, fIn, output, Stride);
+    for (i = 0; i < LineCount; i++) {
+
+           accum = (cmsUInt8Number*) in + strideIn;
+           output = (cmsUInt8Number*) out + strideOut;
+
+           for (j = 0; j < PixelsPerLine; j++) {
+
+                  accum = p->FromInputFloat(p, fIn, accum, Stride ->BytesPerPlaneIn);
+                  output = p->ToOutputFloat(p, fIn, output, Stride->BytesPerPlaneOut);
+           }
+
+           strideIn += Stride->BytesPerLineIn;
+           strideOut += Stride->BytesPerLineOut;
     }
 }
 
@@ -308,23 +371,36 @@
 static
 void NullXFORM(_cmsTRANSFORM* p,
                const void* in,
-               void* out, cmsUInt32Number Size,
-               cmsUInt32Number Stride)
+               void* out,
+               cmsUInt32Number PixelsPerLine,
+               cmsUInt32Number LineCount,
+               const cmsStride* Stride)
 {
     cmsUInt8Number* accum;
     cmsUInt8Number* output;
     cmsUInt16Number wIn[cmsMAXCHANNELS];
-    cmsUInt32Number i, n;
+    cmsUInt32Number i, j, strideIn, strideOut;
 
-    accum  = (cmsUInt8Number*)  in;
-    output = (cmsUInt8Number*)  out;
-    n = Size;                    // Buffer len
+    _cmsHandleExtraChannels(p, in, out, PixelsPerLine, LineCount, Stride);
 
-    for (i=0; i < n; i++) {
+    strideIn = 0;
+    strideOut = 0;
 
-        accum  = p -> FromInput(p, wIn, accum, Stride);
-        output = p -> ToOutput(p, wIn, output, Stride);
+    for (i = 0; i < LineCount; i++) {
+
+           accum = (cmsUInt8Number*)in + strideIn;
+           output = (cmsUInt8Number*)out + strideOut;
+
+           for (j = 0; j < PixelsPerLine; j++) {
+
+                  accum = p->FromInput(p, wIn, accum, Stride->BytesPerPlaneIn);
+                  output = p->ToOutput(p, wIn, output, Stride->BytesPerPlaneOut);
     }
+
+           strideIn += Stride->BytesPerLineIn;
+           strideOut += Stride->BytesPerLineOut;
+    }
+
 }
 
 
@@ -332,27 +408,41 @@
 static
 void PrecalculatedXFORM(_cmsTRANSFORM* p,
                         const void* in,
-                        void* out, cmsUInt32Number Size, cmsUInt32Number Stride)
+                        void* out,
+                        cmsUInt32Number PixelsPerLine,
+                        cmsUInt32Number LineCount,
+                        const cmsStride* Stride)
 {
     register cmsUInt8Number* accum;
     register cmsUInt8Number* output;
     cmsUInt16Number wIn[cmsMAXCHANNELS], wOut[cmsMAXCHANNELS];
-    cmsUInt32Number i, n;
+    cmsUInt32Number i, j, strideIn, strideOut;
 
-    accum  = (cmsUInt8Number*)  in;
-    output = (cmsUInt8Number*)  out;
-    n = Size;
+    _cmsHandleExtraChannels(p, in, out, PixelsPerLine, LineCount, Stride);
 
-    for (i=0; i < n; i++) {
+    strideIn = 0;
+    strideOut = 0;
 
-        accum = p -> FromInput(p, wIn, accum, Stride);
-        p ->Lut ->Eval16Fn(wIn, wOut, p -> Lut->Data);
-        output = p -> ToOutput(p, wOut, output, Stride);
+    for (i = 0; i < LineCount; i++) {
+
+        accum = (cmsUInt8Number*)in + strideIn;
+        output = (cmsUInt8Number*)out + strideOut;
+
+        for (j = 0; j < PixelsPerLine; j++) {
+
+            accum = p->FromInput(p, wIn, accum, Stride->BytesPerPlaneIn);
+            p->Lut->Eval16Fn(wIn, wOut, p->Lut->Data);
+            output = p->ToOutput(p, wOut, output, Stride->BytesPerPlaneOut);
+        }
+
+        strideIn += Stride->BytesPerLineIn;
+        strideOut += Stride->BytesPerLineOut;
     }
+
 }
 
 
-// Auxiliar: Handle precalculated gamut check. The retrieval of context may be alittle bit slow, but this function is not critical.
+// Auxiliary: Handle precalculated gamut check. The retrieval of context may be alittle bit slow, but this function is not critical.
 static
 void TransformOnePixelWithGamutCheck(_cmsTRANSFORM* p,
                                      const cmsUInt16Number wIn[],
@@ -379,22 +469,35 @@
 static
 void PrecalculatedXFORMGamutCheck(_cmsTRANSFORM* p,
                                   const void* in,
-                                  void* out, cmsUInt32Number Size, cmsUInt32Number Stride)
+                                  void* out,
+                                  cmsUInt32Number PixelsPerLine,
+                                  cmsUInt32Number LineCount,
+                                  const cmsStride* Stride)
 {
     cmsUInt8Number* accum;
     cmsUInt8Number* output;
     cmsUInt16Number wIn[cmsMAXCHANNELS], wOut[cmsMAXCHANNELS];
-    cmsUInt32Number i, n;
+    cmsUInt32Number i, j, strideIn, strideOut;
 
-    accum  = (cmsUInt8Number*)  in;
-    output = (cmsUInt8Number*)  out;
-    n = Size;                    // Buffer len
+    _cmsHandleExtraChannels(p, in, out, PixelsPerLine, LineCount, Stride);
 
-    for (i=0; i < n; i++) {
+    strideIn = 0;
+    strideOut = 0;
 
-        accum = p -> FromInput(p, wIn, accum, Stride);
-        TransformOnePixelWithGamutCheck(p, wIn, wOut);
-        output = p -> ToOutput(p, wOut, output, Stride);
+    for (i = 0; i < LineCount; i++) {
+
+           accum = (cmsUInt8Number*)in + strideIn;
+           output = (cmsUInt8Number*)out + strideOut;
+
+           for (j = 0; j < PixelsPerLine; j++) {
+
+                  accum = p->FromInput(p, wIn, accum, Stride->BytesPerPlaneIn);
+                  TransformOnePixelWithGamutCheck(p, wIn, wOut);
+                  output = p->ToOutput(p, wOut, output, Stride->BytesPerPlaneOut);
+           }
+
+           strideIn += Stride->BytesPerLineIn;
+           strideOut += Stride->BytesPerLineOut;
     }
 }
 
@@ -403,94 +506,120 @@
 static
 void CachedXFORM(_cmsTRANSFORM* p,
                  const void* in,
-                 void* out, cmsUInt32Number Size, cmsUInt32Number Stride)
+                 void* out,
+                 cmsUInt32Number PixelsPerLine,
+                 cmsUInt32Number LineCount,
+                 const cmsStride* Stride)
 {
     cmsUInt8Number* accum;
     cmsUInt8Number* output;
     cmsUInt16Number wIn[cmsMAXCHANNELS], wOut[cmsMAXCHANNELS];
-    cmsUInt32Number i, n;
     _cmsCACHE Cache;
+    cmsUInt32Number i, j, strideIn, strideOut;
 
-    accum  = (cmsUInt8Number*)  in;
-    output = (cmsUInt8Number*)  out;
-    n = Size;                    // Buffer len
+    _cmsHandleExtraChannels(p, in, out, PixelsPerLine, LineCount, Stride);
 
     // Empty buffers for quick memcmp
-    memset(wIn,  0, sizeof(wIn));
+    memset(wIn, 0, sizeof(wIn));
     memset(wOut, 0, sizeof(wOut));
 
     // Get copy of zero cache
-    memcpy(&Cache, &p ->Cache, sizeof(Cache));
+    memcpy(&Cache, &p->Cache, sizeof(Cache));
 
-    for (i=0; i < n; i++) {
+    strideIn = 0;
+    strideOut = 0;
 
-        accum = p -> FromInput(p, wIn, accum, Stride);
+    for (i = 0; i < LineCount; i++) {
 
-        if (memcmp(wIn, Cache.CacheIn, sizeof(Cache.CacheIn)) == 0) {
+        accum = (cmsUInt8Number*)in + strideIn;
+        output = (cmsUInt8Number*)out + strideOut;
 
-            memcpy(wOut, Cache.CacheOut, sizeof(Cache.CacheOut));
-        }
-        else {
+        for (j = 0; j < PixelsPerLine; j++) {
 
-            p ->Lut ->Eval16Fn(wIn, wOut, p -> Lut->Data);
+            accum = p->FromInput(p, wIn, accum, Stride->BytesPerPlaneIn);
 
-            memcpy(Cache.CacheIn,  wIn,  sizeof(Cache.CacheIn));
-            memcpy(Cache.CacheOut, wOut, sizeof(Cache.CacheOut));
+            if (memcmp(wIn, Cache.CacheIn, sizeof(Cache.CacheIn)) == 0) {
+
+                memcpy(wOut, Cache.CacheOut, sizeof(Cache.CacheOut));
+            }
+            else {
+                p->Lut->Eval16Fn(wIn, wOut, p->Lut->Data);
+
+                memcpy(Cache.CacheIn, wIn, sizeof(Cache.CacheIn));
+                memcpy(Cache.CacheOut, wOut, sizeof(Cache.CacheOut));
+            }
+
+            output = p->ToOutput(p, wOut, output, Stride->BytesPerPlaneOut);
         }
 
-        output = p -> ToOutput(p, wOut, output, Stride);
+        strideIn += Stride->BytesPerLineIn;
+        strideOut += Stride->BytesPerLineOut;
     }
-
 }
 
-
 // All those nice features together
 static
 void CachedXFORMGamutCheck(_cmsTRANSFORM* p,
                            const void* in,
-                           void* out, cmsUInt32Number Size, cmsUInt32Number Stride)
+                           void* out,
+                           cmsUInt32Number PixelsPerLine,
+                           cmsUInt32Number LineCount,
+                           const cmsStride* Stride)
 {
-       cmsUInt8Number* accum;
-       cmsUInt8Number* output;
-       cmsUInt16Number wIn[cmsMAXCHANNELS], wOut[cmsMAXCHANNELS];
-       cmsUInt32Number i, n;
-       _cmsCACHE Cache;
+    cmsUInt8Number* accum;
+    cmsUInt8Number* output;
+    cmsUInt16Number wIn[cmsMAXCHANNELS], wOut[cmsMAXCHANNELS];
+    _cmsCACHE Cache;
+    cmsUInt32Number i, j, strideIn, strideOut;
 
-       accum  = (cmsUInt8Number*)  in;
-       output = (cmsUInt8Number*)  out;
-       n = Size;                    // Buffer len
+    _cmsHandleExtraChannels(p, in, out, PixelsPerLine, LineCount, Stride);
 
-       // Empty buffers for quick memcmp
-       memset(wIn,  0, sizeof(cmsUInt16Number) * cmsMAXCHANNELS);
-       memset(wOut, 0, sizeof(cmsUInt16Number) * cmsMAXCHANNELS);
+    // Empty buffers for quick memcmp
+    memset(wIn, 0, sizeof(wIn));
+    memset(wOut, 0, sizeof(wOut));
 
-       // Get copy of zero cache
-       memcpy(&Cache, &p ->Cache, sizeof(Cache));
+    // Get copy of zero cache
+    memcpy(&Cache, &p->Cache, sizeof(Cache));
 
-       for (i=0; i < n; i++) {
+    strideIn = 0;
+    strideOut = 0;
 
-            accum = p -> FromInput(p, wIn, accum, Stride);
+    for (i = 0; i < LineCount; i++) {
+
+        accum = (cmsUInt8Number*)in + strideIn;
+        output = (cmsUInt8Number*)out + strideOut;
+
+        for (j = 0; j < PixelsPerLine; j++) {
+
+            accum = p->FromInput(p, wIn, accum, Stride->BytesPerPlaneIn);
 
             if (memcmp(wIn, Cache.CacheIn, sizeof(Cache.CacheIn)) == 0) {
-                    memcpy(wOut, Cache.CacheOut, sizeof(Cache.CacheOut));
+
+                memcpy(wOut, Cache.CacheOut, sizeof(Cache.CacheOut));
             }
             else {
-                    TransformOnePixelWithGamutCheck(p, wIn, wOut);
-                    memcpy(Cache.CacheIn, wIn, sizeof(Cache.CacheIn));
-                    memcpy(Cache.CacheOut, wOut, sizeof(Cache.CacheOut));
+                TransformOnePixelWithGamutCheck(p, wIn, wOut);
+
+                memcpy(Cache.CacheIn, wIn, sizeof(Cache.CacheIn));
+                memcpy(Cache.CacheOut, wOut, sizeof(Cache.CacheOut));
             }
 
-            output = p -> ToOutput(p, wOut, output, Stride);
-       }
+            output = p->ToOutput(p, wOut, output, Stride->BytesPerPlaneOut);
+        }
 
+        strideIn += Stride->BytesPerLineIn;
+        strideOut += Stride->BytesPerLineOut;
+    }
 }
 
-// -------------------------------------------------------------------------------------------------------------
+// Transform plug-ins ----------------------------------------------------------------------------------------------------
 
 // List of used-defined transform factories
 typedef struct _cmsTransformCollection_st {
 
-    _cmsTransformFactory  Factory;
+    _cmsTransform2Factory  Factory;
+    cmsBool                OldXform;   // Factory returns xform function in the old style
+
     struct _cmsTransformCollection_st *Next;
 
 } _cmsTransformCollection;
@@ -533,6 +662,7 @@
   ctx ->chunks[TransformPlugin] = _cmsSubAllocDup(ctx->MemPool, &newHead, sizeof(_cmsTransformPluginChunkType));
 }
 
+// Allocates memory for transform plugin factory
 void _cmsAllocTransformPluginChunk(struct _cmsContext_struct* ctx,
                                         const struct _cmsContext_struct* src)
 {
@@ -547,6 +677,35 @@
     }
 }
 
+// Adaptor for old versions of plug-in
+static
+void _cmsTransform2toTransformAdaptor(struct _cmstransform_struct *CMMcargo,
+                                      const void* InputBuffer,
+                                      void* OutputBuffer,
+                                      cmsUInt32Number PixelsPerLine,
+                                      cmsUInt32Number LineCount,
+                                      const cmsStride* Stride)
+{
+
+       cmsUInt32Number i, strideIn, strideOut;
+
+       _cmsHandleExtraChannels(CMMcargo, InputBuffer, OutputBuffer, PixelsPerLine, LineCount, Stride);
+
+       strideIn = 0;
+       strideOut = 0;
+
+       for (i = 0; i < LineCount; i++) {
+
+              void *accum = (cmsUInt8Number*)InputBuffer + strideIn;
+              void *output = (cmsUInt8Number*)OutputBuffer + strideOut;
+
+              CMMcargo->OldXform(CMMcargo, accum, output, PixelsPerLine, Stride->BytesPerPlaneIn);
+
+              strideIn += Stride->BytesPerLineIn;
+              strideOut += Stride->BytesPerLineOut;
+       }
+}
+
 
 
 // Register new ways to transform
@@ -564,14 +723,22 @@
     }
 
     // Factory callback is required
-    if (Plugin ->Factory == NULL) return FALSE;
+    if (Plugin->factories.xform == NULL) return FALSE;
 
 
     fl = (_cmsTransformCollection*) _cmsPluginMalloc(ContextID, sizeof(_cmsTransformCollection));
     if (fl == NULL) return FALSE;
 
+    // Check for full xform plug-ins previous to 2.8, we would need an adapter in that case
+    if (Plugin->base.ExpectedVersion < 2080) {
+
+           fl->OldXform = TRUE;
+    }
+    else
+           fl->OldXform = FALSE;
+
     // Copy the parameters
-    fl ->Factory = Plugin ->Factory;
+    fl->Factory = Plugin->factories.xform;
 
     // Keep linked list
     fl ->Next = ctx->TransformCollection;
@@ -656,6 +823,12 @@
                             p->FromInputFloat = _cmsGetFormatter(ContextID, *InputFormat, cmsFormatterInput, CMS_PACK_FLAGS_FLOAT).FmtFloat;
                             p->ToOutputFloat = _cmsGetFormatter(ContextID, *OutputFormat, cmsFormatterOutput, CMS_PACK_FLAGS_FLOAT).FmtFloat;
 
+                            // Save the day?
+                            if (Plugin->OldXform) {
+                                   p->OldXform = (_cmsTransformFn) p->xform;
+                                   p->xform = _cmsTransform2toTransformAdaptor;
+                            }
+
                             return p;
                      }
               }
@@ -816,6 +989,22 @@
 
 // ----------------------------------------------------------------------------------------------------------------
 
+// Jun-21-2000: Some profiles (those that comes with W2K) comes
+// with the media white (media black?) x 100. Add a sanity check
+
+static
+void NormalizeXYZ(cmsCIEXYZ* Dest)
+{
+    while (Dest -> X > 2. &&
+           Dest -> Y > 2. &&
+           Dest -> Z > 2.) {
+
+               Dest -> X /= 10.;
+               Dest -> Y /= 10.;
+               Dest -> Z /= 10.;
+       }
+}
+
 static
 void SetWhitePoint(cmsCIEXYZ* wtPt, const cmsCIEXYZ* src)
 {
@@ -828,6 +1017,8 @@
         wtPt ->X = src->X;
         wtPt ->Y = src->Y;
         wtPt ->Z = src->Z;
+
+        NormalizeXYZ(wtPt);
     }
 
 }
@@ -1138,7 +1329,6 @@
                                          cmsUInt32Number InputFormat,
                                          cmsUInt32Number OutputFormat)
 {
-
     _cmsTRANSFORM* xform = (_cmsTRANSFORM*) hTransform;
     cmsFormatter16 FromInput, ToOutput;
 
diff --git a/jdk/src/java.desktop/share/native/liblcms/lcms2.h b/jdk/src/java.desktop/share/native/liblcms/lcms2.h
index 0d66b26..9f148e5 100644
--- a/jdk/src/java.desktop/share/native/liblcms/lcms2.h
+++ b/jdk/src/java.desktop/share/native/liblcms/lcms2.h
@@ -30,7 +30,7 @@
 //---------------------------------------------------------------------------------
 //
 //  Little Color Management System
-//  Copyright (c) 1998-2014 Marti Maria Saguer
+//  Copyright (c) 1998-2016 Marti Maria Saguer
 //
 // Permission is hereby granted, free of charge, to any person obtaining
 // a copy of this software and associated documentation files (the "Software"),
@@ -52,7 +52,7 @@
 //
 //---------------------------------------------------------------------------------
 //
-// Version 2.7
+// Version 2.8
 //
 
 #ifndef _lcms2_H
@@ -104,7 +104,7 @@
 #endif
 
 // Version/release
-#define LCMS_VERSION        2070
+#define LCMS_VERSION        2080
 
 // I will give the chance of redefining basic types for compilers that are not fully C99 compliant
 #ifndef CMS_BASIC_TYPES_ALREADY_DEFINED
@@ -202,43 +202,44 @@
 #  define CMS_IS_WINDOWS_ 1
 #endif
 
-// Try to detect big endian platforms. This list can be endless, so only some checks are performed over here.
-// you can pass this toggle to the compiler by using -DCMS_USE_BIG_ENDIAN or something similar
+// Try to detect big endian platforms. This list can be endless, so primarily rely on the configure script
+// on Unix-like systems, and allow it to be set on the compiler command line using
+// -DCMS_USE_BIG_ENDIAN or something similar
+#ifdef CMS_USE_BIG_ENDIAN // set at compiler command line takes overall precedence
 
-#if defined(__sgi__) || defined(__sgi) || defined(sparc)
-#   define CMS_USE_BIG_ENDIAN      1
-#endif
+#  if CMS_USE_BIG_ENDIAN == 0
+#    undef CMS_USE_BIG_ENDIAN
+#  endif
 
-#if defined(__s390__) || defined(__s390x__)
-#   define CMS_USE_BIG_ENDIAN   1
-#endif
+#else // CMS_USE_BIG_ENDIAN
 
+#  ifdef WORDS_BIGENDIAN // set by configure (or explicitly on compiler command line)
+#    define CMS_USE_BIG_ENDIAN 1
+#  else // WORDS_BIGENDIAN
+// Fall back to platform/compiler specific tests
+#    if defined(__sgi__) || defined(__sgi) || defined(sparc)
+#      define CMS_USE_BIG_ENDIAN      1
+#    endif
 
-#if defined(__powerpc__) || defined(__ppc__) || defined(TARGET_CPU_PPC)
-#  if __powerpc__ || __ppc__ || TARGET_CPU_PPC
-#   define CMS_USE_BIG_ENDIAN   1
-#   if defined (__GNUC__) && defined(__BYTE_ORDER__) && defined(__ORDER_LITTLE_ENDIAN__)
-#       if __BYTE_ORDER__  == __ORDER_LITTLE_ENDIAN__
-                // Don't use big endian for PowerPC little endian mode
-#                undef CMS_USE_BIG_ENDIAN
-#       endif
-#     endif
-#   endif
-#endif
+#    if defined(__s390__) || defined(__s390x__)
+#      define CMS_USE_BIG_ENDIAN   1
+#    endif
 
-#ifdef macintosh
-# ifdef __BIG_ENDIAN__
-#   define CMS_USE_BIG_ENDIAN      1
-# endif
-# ifdef __LITTLE_ENDIAN__
-#   undef CMS_USE_BIG_ENDIAN
-# endif
-#endif
+#    ifdef macintosh
+#      ifdef __BIG_ENDIAN__
+#        define CMS_USE_BIG_ENDIAN      1
+#      endif
+#      ifdef __LITTLE_ENDIAN__
+#        undef CMS_USE_BIG_ENDIAN
+#      endif
+#    endif
+#  endif  // WORDS_BIGENDIAN
 
-// WORDS_BIGENDIAN takes precedence
-#if defined(_HOST_BIG_ENDIAN) || defined(__BIG_ENDIAN__) || defined(WORDS_BIGENDIAN)
-#   define CMS_USE_BIG_ENDIAN      1
-#endif
+#  if defined(_HOST_BIG_ENDIAN) || defined(__BIG_ENDIAN__)
+#    define CMS_USE_BIG_ENDIAN      1
+#  endif
+
+#endif  // CMS_USE_BIG_ENDIAN
 
 
 // Calling convention -- this is hardly platform and compiler dependent
@@ -248,7 +249,7 @@
 #        define CMSEXPORT       __stdcall _export
 #        define CMSAPI
 #     else
-#        define CMSEXPORT      _stdcall
+#        define CMSEXPORT      __stdcall
 #        ifdef CMS_DLL_BUILD
 #            define CMSAPI    __declspec(dllexport)
 #        else
@@ -410,7 +411,8 @@
     cmsSigViewingCondDescTag                = 0x76756564,  // 'vued'
     cmsSigViewingConditionsTag              = 0x76696577,  // 'view'
     cmsSigVcgtTag                           = 0x76636774,  // 'vcgt'
-    cmsSigMetaTag                           = 0x6D657461   // 'meta'
+    cmsSigMetaTag                           = 0x6D657461,  // 'meta'
+    cmsSigArgyllArtsTag                     = 0x61727473   // 'arts'
 
 } cmsTagSignature;
 
@@ -683,7 +685,7 @@
 //            T: Pixeltype
 //            F: Flavor  0=MinIsBlack(Chocolate) 1=MinIsWhite(Vanilla)
 //            P: Planar? 0=Chunky, 1=Planar
-//            X: swap 16 bps endianess?
+//            X: swap 16 bps endianness?
 //            S: Do swap? ie, BGR, KYMC
 //            E: Extra samples
 //            C: Channels (Samples per pixel)
@@ -926,7 +928,7 @@
 #define TYPE_ARGB_FLT         (FLOAT_SH(1)|COLORSPACE_SH(PT_RGB)|EXTRA_SH(1)|CHANNELS_SH(3)|BYTES_SH(4)|SWAPFIRST_SH(1))
 #define TYPE_BGR_FLT          (FLOAT_SH(1)|COLORSPACE_SH(PT_RGB)|CHANNELS_SH(3)|BYTES_SH(4)|DOSWAP_SH(1))
 #define TYPE_BGRA_FLT         (FLOAT_SH(1)|COLORSPACE_SH(PT_RGB)|EXTRA_SH(1)|CHANNELS_SH(3)|BYTES_SH(4)|DOSWAP_SH(1)|SWAPFIRST_SH(1))
-#define TYPE_ABGR_FLT         (FLOAT_SH(1)|COLORSPACE_SH(PT_RGB)|CHANNELS_SH(3)|BYTES_SH(4)|DOSWAP_SH(1))
+#define TYPE_ABGR_FLT         (FLOAT_SH(1)|COLORSPACE_SH(PT_RGB)|EXTRA_SH(1)|CHANNELS_SH(3)|BYTES_SH(4)|DOSWAP_SH(1))
 
 #define TYPE_CMYK_FLT         (FLOAT_SH(1)|COLORSPACE_SH(PT_CMYK)|CHANNELS_SH(4)|BYTES_SH(4))
 
@@ -1043,7 +1045,7 @@
 // Context handling --------------------------------------------------------------------------------------------------------
 
 // Each context holds its owns globals and its own plug-ins. There is a global context with the id = 0 for lecacy compatibility
-// though using the global context is not recomended. Proper context handling makes lcms more thread-safe.
+// though using the global context is not recommended. Proper context handling makes lcms more thread-safe.
 
 typedef struct _cmsContext_struct* cmsContext;
 
@@ -1412,7 +1414,7 @@
 typedef struct {
 
     cmsUInt32Number n;
-    cmsContext     ContextID;
+    cmsContext      ContextID;
     cmsPSEQDESC*    seq;
 
 } cmsSEQ;
@@ -1679,6 +1681,8 @@
 // Specific to unbounded mode
 #define cmsFLAGS_NONEGATIVES              0x8000    // Prevent negative numbers in floating point transforms
 
+// Copy alpha channels when transforming
+#define cmsFLAGS_COPY_ALPHA               0x04000000 // Alpha channels are copied on cmsDoTransform()
 
 // Fine-tune control over number of gridpoints
 #define cmsFLAGS_GRIDPOINTS(n)           (((n) & 0xFF) << 16)
@@ -1757,12 +1761,22 @@
                                                  void * OutputBuffer,
                                                  cmsUInt32Number Size);
 
-CMSAPI void             CMSEXPORT cmsDoTransformStride(cmsHTRANSFORM Transform,
+CMSAPI void             CMSEXPORT cmsDoTransformStride(cmsHTRANSFORM Transform,   // Deprecated
                                                  const void * InputBuffer,
                                                  void * OutputBuffer,
                                                  cmsUInt32Number Size,
                                                  cmsUInt32Number Stride);
 
+CMSAPI void             CMSEXPORT cmsDoTransformLineStride(cmsHTRANSFORM  Transform,
+                                                 const void* InputBuffer,
+                                                 void* OutputBuffer,
+                                                 cmsUInt32Number PixelsPerLine,
+                                                 cmsUInt32Number LineCount,
+                                                 cmsUInt32Number BytesPerLineIn,
+                                                 cmsUInt32Number BytesPerLineOut,
+                                                 cmsUInt32Number BytesPerPlaneIn,
+                                                 cmsUInt32Number BytesPerPlaneOut);
+
 
 CMSAPI void             CMSEXPORT cmsSetAlarmCodes(const cmsUInt16Number NewAlarm[cmsMAXCHANNELS]);
 CMSAPI void             CMSEXPORT cmsGetAlarmCodes(cmsUInt16Number NewAlarm[cmsMAXCHANNELS]);
diff --git a/jdk/src/java.desktop/share/native/liblcms/lcms2_internal.h b/jdk/src/java.desktop/share/native/liblcms/lcms2_internal.h
index c6cfbd6..9009472 100644
--- a/jdk/src/java.desktop/share/native/liblcms/lcms2_internal.h
+++ b/jdk/src/java.desktop/share/native/liblcms/lcms2_internal.h
@@ -30,7 +30,7 @@
 
 //
 //  Little Color Management System
-//  Copyright (c) 1998-2014 Marti Maria Saguer
+//  Copyright (c) 1998-2016 Marti Maria Saguer
 //
 // Permission is hereby granted, free of charge, to any person obtaining
 // a copy of this software and associated documentation files (the "Software"),
@@ -86,7 +86,15 @@
 #define _cmsALIGNLONG(x) (((x)+(sizeof(cmsUInt32Number)-1)) & ~(sizeof(cmsUInt32Number)-1))
 
 // Alignment to memory pointer
-#define _cmsALIGNMEM(x)  (((x)+(sizeof(void *) - 1)) & ~(sizeof(void *) - 1))
+
+// (Ultra)SPARC with gcc requires ptr alignment of 8 bytes
+// even though sizeof(void *) is only four: for greatest flexibility
+// allow the build to specify ptr alignment.
+#ifndef CMS_PTR_ALIGNMENT
+# define CMS_PTR_ALIGNMENT sizeof(void *)
+#endif
+
+#define _cmsALIGNMEM(x)  (((x)+(CMS_PTR_ALIGNMENT - 1)) & ~(CMS_PTR_ALIGNMENT - 1))
 
 // Maximum encodeable values in floating point
 #define MAX_ENCODEABLE_XYZ  (1.0 + 32767.0/32768.0)
@@ -122,7 +130,7 @@
 
 // A fast way to convert from/to 16 <-> 8 bits
 #define FROM_8_TO_16(rgb) (cmsUInt16Number) ((((cmsUInt16Number) (rgb)) << 8)|(rgb))
-#define FROM_16_TO_8(rgb) (cmsUInt8Number) ((((rgb) * 65281 + 8388608) >> 24) & 0xFF)
+#define FROM_16_TO_8(rgb) (cmsUInt8Number) ((((cmsUInt32Number)(rgb) * 65281U + 8388608U) >> 24) & 0xFFU)
 
 // Code analysis is broken on asserts
 #ifdef _MSC_VER
@@ -691,8 +699,8 @@
     cmsContext ContextID;
 
     // The directory
-    int AllocatedEntries;
-    int UsedEntries;
+    cmsUInt32Number  AllocatedEntries;
+    cmsUInt32Number  UsedEntries;
     _cmsMLUentry* Entries;     // Array of pointers to strings allocated in MemPool
 
     // The Pool
@@ -760,7 +768,7 @@
     // Dictionary
     cmsUInt32Number          TagCount;
     cmsTagSignature          TagNames[MAX_TABLE_TAG];
-    cmsTagSignature          TagLinked[MAX_TABLE_TAG];           // The tag to wich is linked (0=none)
+    cmsTagSignature          TagLinked[MAX_TABLE_TAG];           // The tag to which is linked (0=none)
     cmsUInt32Number          TagSizes[MAX_TABLE_TAG];            // Size on disk
     cmsUInt32Number          TagOffsets[MAX_TABLE_TAG];
     cmsBool                  TagSaveAsRaw[MAX_TABLE_TAG];        // True to write uncooked
@@ -988,7 +996,7 @@
     cmsUInt32Number InputFormat, OutputFormat; // Keep formats for further reference
 
     // Points to transform code
-    _cmsTransformFn xform;
+    _cmsTransform2Fn xform;
 
     // Formatters, cannot be embedded into LUT because cache
     cmsFormatter16 FromInput;
@@ -1034,9 +1042,20 @@
     void* UserData;
     _cmsFreeUserDataFn FreeUserData;
 
+    // A way to provide backwards compatibility with full xform plugins
+    _cmsTransformFn OldXform;
+
 } _cmsTRANSFORM;
 
-// --------------------------------------------------------------------------------------------------
+// Copies extra channels from input to output if the original flags in the transform structure
+// instructs to do so. This function is called on all standard transform functions.
+void _cmsHandleExtraChannels(_cmsTRANSFORM* p, const void* in,
+                             void* out,
+                             cmsUInt32Number PixelsPerLine,
+                             cmsUInt32Number LineCount,
+                             const cmsStride* Stride);
+
+// -----------------------------------------------------------------------------------------------------------------------
 
 cmsHTRANSFORM _cmsChain2Lab(cmsContext             ContextID,
                             cmsUInt32Number        nProfiles,
diff --git a/jdk/src/java.desktop/share/native/liblcms/lcms2_plugin.h b/jdk/src/java.desktop/share/native/liblcms/lcms2_plugin.h
index 77ff228..aff3b48 100644
--- a/jdk/src/java.desktop/share/native/liblcms/lcms2_plugin.h
+++ b/jdk/src/java.desktop/share/native/liblcms/lcms2_plugin.h
@@ -30,7 +30,7 @@
 //---------------------------------------------------------------------------------
 //
 //  Little Color Management System
-//  Copyright (c) 1998-2011 Marti Maria Saguer
+//  Copyright (c) 1998-2016 Marti Maria Saguer
 //
 // Permission is hereby granted, free of charge, to any person obtaining
 // a copy of this software and associated documentation files (the "Software"),
@@ -157,7 +157,7 @@
                                                                    const void* Buffer);
 };
 
-// Endianess adjust functions
+// Endianness adjust functions
 CMSAPI cmsUInt16Number   CMSEXPORT  _cmsAdjustEndianess16(cmsUInt16Number Word);
 CMSAPI cmsUInt32Number   CMSEXPORT  _cmsAdjustEndianess32(cmsUInt32Number Value);
 CMSAPI void              CMSEXPORT  _cmsAdjustEndianess64(cmsUInt64Number* Result, cmsUInt64Number* QWord);
@@ -371,8 +371,8 @@
 
 typedef cmsUInt8Number* (* cmsFormatter16)(register struct _cmstransform_struct* CMMcargo,
                                            register cmsUInt16Number Values[],
-                                           register cmsUInt8Number*  Buffer,
-                                           register cmsUInt32Number  Stride);
+                                           register cmsUInt8Number* Buffer,
+                                           register cmsUInt32Number Stride);
 
 typedef cmsUInt8Number* (* cmsFormatterFloat)(struct _cmstransform_struct* CMMcargo,
                                               cmsFloat32Number Values[],
@@ -600,11 +600,28 @@
 
 //----------------------------------------------------------------------------------------------------------
 // Full xform
-typedef void     (* _cmsTransformFn)(struct _cmstransform_struct *CMMcargo,
+
+typedef struct {
+       cmsUInt32Number BytesPerLineIn;
+       cmsUInt32Number BytesPerLineOut;
+       cmsUInt32Number BytesPerPlaneIn;
+       cmsUInt32Number BytesPerPlaneOut;
+
+} cmsStride;
+
+typedef void     (* _cmsTransformFn)(struct _cmstransform_struct *CMMcargo,   // Legacy function, handles just ONE scanline.
                                      const void* InputBuffer,
                                      void* OutputBuffer,
                                      cmsUInt32Number Size,
-                                     cmsUInt32Number Stride);
+                                     cmsUInt32Number Stride);                 // Stride in bytes to the next plana in planar formats
+
+
+typedef void     (*_cmsTransform2Fn)(struct _cmstransform_struct *CMMcargo,
+                                     const void* InputBuffer,
+                                     void* OutputBuffer,
+                                     cmsUInt32Number PixelsPerLine,
+                                     cmsUInt32Number LineCount,
+                                     const cmsStride* Stride);
 
 typedef cmsBool  (* _cmsTransformFactory)(_cmsTransformFn* xform,
                                          void** UserData,
@@ -614,6 +631,14 @@
                                          cmsUInt32Number* OutputFormat,
                                          cmsUInt32Number* dwFlags);
 
+typedef cmsBool  (* _cmsTransform2Factory)(_cmsTransform2Fn* xform,
+                                         void** UserData,
+                                         _cmsFreeUserDataFn* FreePrivateDataFn,
+                                         cmsPipeline** Lut,
+                                         cmsUInt32Number* InputFormat,
+                                         cmsUInt32Number* OutputFormat,
+                                         cmsUInt32Number* dwFlags);
+
 
 // Retrieve user data as specified by the factory
 CMSAPI void   CMSEXPORT _cmsSetTransformUserData(struct _cmstransform_struct *CMMcargo, void* ptr, _cmsFreeUserDataFn FreePrivateDataFn);
@@ -628,7 +653,10 @@
       cmsPluginBase     base;
 
       // Transform entry point
-      _cmsTransformFactory  Factory;
+      union {
+             _cmsTransformFactory        legacy_xform;
+             _cmsTransform2Factory       xform;
+      } factories;
 
 }  cmsPluginTransform;
 
diff --git a/jdk/src/java.desktop/share/native/libmlib_image/mlib_ImageAffine_NN_Bit.c b/jdk/src/java.desktop/share/native/libmlib_image/mlib_ImageAffine_NN_Bit.c
index 5b91aba..f84ce28 100644
--- a/jdk/src/java.desktop/share/native/libmlib_image/mlib_ImageAffine_NN_Bit.c
+++ b/jdk/src/java.desktop/share/native/libmlib_image/mlib_ImageAffine_NN_Bit.c
@@ -84,8 +84,7 @@
         ySrc = MLIB_POINTER_SHIFT(Y);
         srcPixelPtr = MLIB_POINTER_GET(lineAddr, ySrc);
 
-        res = (res & ~(1 << bit)) | (((srcPixelPtr[X >> (MLIB_SHIFT + 3)] >> (7 - (X >> MLIB_SHIFT) & 7)) & 1) <<
-           bit);
+        res = (res & ~(1 << bit)) | (((srcPixelPtr[X >> (MLIB_SHIFT + 3)] >> (7 - ((X >> MLIB_SHIFT) & 7))) & 1) << bit);
 
         X += dX;
         Y += dY;
@@ -150,7 +149,7 @@
         ySrc = MLIB_POINTER_SHIFT(Y);
         srcPixelPtr = MLIB_POINTER_GET(lineAddr, ySrc);
 
-        res = (res & ~(1 << bit)) | (((srcPixelPtr[X >> (MLIB_SHIFT + 3)] >> (7 - (X >> MLIB_SHIFT) & 7)) & 1) << bit);
+        res = (res & ~(1 << bit)) | (((srcPixelPtr[X >> (MLIB_SHIFT + 3)] >> (7 - ((X >> MLIB_SHIFT) & 7))) & 1) << bit);
 
         X += dX;
         Y += dY;
diff --git a/jdk/src/java.desktop/share/native/libmlib_image/mlib_ImageConv.h b/jdk/src/java.desktop/share/native/libmlib_image/mlib_ImageConv.h
index dc4b6bd..2528fb1 100644
--- a/jdk/src/java.desktop/share/native/libmlib_image/mlib_ImageConv.h
+++ b/jdk/src/java.desktop/share/native/libmlib_image/mlib_ImageConv.h
@@ -34,11 +34,9 @@
 // Shared macro defined for cleanup of allocated memory.
 #ifndef FREE_AND_RETURN_STATUS
 #define FREE_AND_RETURN_STATUS \
-{ \
 if (pbuff != buff) mlib_free(pbuff); \
 if (k != akernel) mlib_free(k); \
-return status; \
-}
+return status
 #endif /* FREE_AND_RETURN_STATUS */
 
 mlib_status mlib_convMxNext_s32(mlib_image       *dst,
diff --git a/jdk/src/java.desktop/share/native/libmlib_image/mlib_c_ImageConv.h b/jdk/src/java.desktop/share/native/libmlib_image/mlib_c_ImageConv.h
index 8097c7d..e3b67f0 100644
--- a/jdk/src/java.desktop/share/native/libmlib_image/mlib_c_ImageConv.h
+++ b/jdk/src/java.desktop/share/native/libmlib_image/mlib_c_ImageConv.h
@@ -34,11 +34,9 @@
 // Shared macro defined for cleanup of allocated memory.
 #ifndef FREE_AND_RETURN_STATUS
 #define FREE_AND_RETURN_STATUS \
-{ \
 if (pbuff != buff) mlib_free(pbuff); \
 if (k != akernel) mlib_free(k); \
-return status; \
-}
+return status
 #endif /* FREE_AND_RETURN_STATUS */
 
 mlib_status mlib_c_convMxNnw_u8(mlib_image       *dst,
diff --git a/jdk/src/java.desktop/share/native/libmlib_image/mlib_c_ImageCopy.c b/jdk/src/java.desktop/share/native/libmlib_image/mlib_c_ImageCopy.c
index d1481fc..270a5a7 100644
--- a/jdk/src/java.desktop/share/native/libmlib_image/mlib_c_ImageCopy.c
+++ b/jdk/src/java.desktop/share/native/libmlib_image/mlib_c_ImageCopy.c
@@ -182,7 +182,7 @@
 #define STRIP(pd, ps, w, h, data_type) {                        \
   data_type s0, s1;                                             \
   for ( i = 0; i < h; i++ ) {                                   \
-    if (j = w & 1)                                              \
+    if ((j = (w & 1)))                                          \
       pd[i * dst_stride] = ps[i * src_stride];                  \
     for (; j < w; j += 2) {                                     \
       s0 = ps[i * src_stride + j];                              \
@@ -546,7 +546,8 @@
     mlib_u32 *psrc_row = psrc + i * src_stride, *pdst_row = pdst + i * dst_stride;
 
     if (!(((mlib_addr) psrc_row ^ (mlib_addr) pdst_row) & 7)) {
-      if (j = ((mlib_s32) ((mlib_addr) psrc_row & 4) >> 2)) {
+      j = (mlib_s32) ((mlib_addr) psrc_row & 4) >> 2;
+      if (j != 0) {
         pdst_row[0] = psrc_row[0];
       }
 
@@ -575,8 +576,10 @@
       {
         mlib_u64 *ps, src0, src1;
 
-        if (j = ((mlib_s32) ((mlib_addr) pdst_row & 4) >> 2))
+        j = (mlib_s32) ((mlib_addr) pdst_row & 4) >> 2;
+        if (j != 0) {
           pdst_row[0] = psrc_row[0];
+        }
         ps = (mlib_u64 *) (psrc_row + j - 1);
         src1 = ps[0];
 #ifdef __SUNPRO_C
diff --git a/jdk/src/java.desktop/unix/classes/sun/awt/X11/XDecoratedPeer.java b/jdk/src/java.desktop/unix/classes/sun/awt/X11/XDecoratedPeer.java
index a392a30..66fc027 100644
--- a/jdk/src/java.desktop/unix/classes/sun/awt/X11/XDecoratedPeer.java
+++ b/jdk/src/java.desktop/unix/classes/sun/awt/X11/XDecoratedPeer.java
@@ -266,6 +266,12 @@
         return new Insets(i.top, i.left, i.bottom, i.right);
     }
 
+    private Insets copyAndScaleDown(Insets i) {
+        return new Insets(scaleDown(i.top), scaleDown(i.left),
+                          scaleDown(i.bottom), scaleDown(i.right));
+    }
+
+
     // insets which we get from WM (e.g from _NET_FRAME_EXTENTS)
     private Insets wm_set_insets;
 
@@ -289,7 +295,7 @@
         }
 
         if (wm_set_insets != null) {
-            wm_set_insets = copy(wm_set_insets);
+            wm_set_insets = copyAndScaleDown(wm_set_insets);
         }
         return wm_set_insets;
     }
@@ -386,6 +392,9 @@
                     }
                 } else {
                     correctWM = XWM.getWM().getInsets(this, xe.get_window(), xe.get_parent());
+                    if (correctWM != null) {
+                        correctWM = copyAndScaleDown(correctWM);
+                    }
 
                     if (insLog.isLoggable(PlatformLogger.Level.FINER)) {
                         if (correctWM != null) {
@@ -470,6 +479,9 @@
                 Insets res = getWMSetInsets(null);
                 if (res == null) {
                     res = XWM.getWM().guessInsets(this);
+                    if (res != null) {
+                        res = copyAndScaleDown(res);
+                    }
                 }
                 return res;
             }
@@ -756,7 +768,7 @@
                 }
             }
             if (correctWM != null) {
-                handleCorrectInsets(correctWM);
+                handleCorrectInsets(copyAndScaleDown(correctWM));
             } else {
                 //Only one attempt to correct insets is made (to lower risk)
                 //if insets are still not available we simply set the flag
diff --git a/jdk/src/java.desktop/unix/classes/sun/awt/X11/XDesktopPeer.java b/jdk/src/java.desktop/unix/classes/sun/awt/X11/XDesktopPeer.java
index b3d1c55..384e65e 100644
--- a/jdk/src/java.desktop/unix/classes/sun/awt/X11/XDesktopPeer.java
+++ b/jdk/src/java.desktop/unix/classes/sun/awt/X11/XDesktopPeer.java
@@ -60,7 +60,7 @@
         try {
             if (!initExecuted) {
                 nativeLibraryLoaded = init(UNIXToolkit.getEnabledGtkVersion()
-                        .ordinal(), UNIXToolkit.isGtkVerbose());
+                        .getNumber(), UNIXToolkit.isGtkVerbose());
             }
         } finally {
             initExecuted = true;
diff --git a/jdk/src/java.desktop/unix/classes/sun/awt/X11FontManager.java b/jdk/src/java.desktop/unix/classes/sun/awt/X11FontManager.java
index f49d4d4..2ae8e19 100644
--- a/jdk/src/java.desktop/unix/classes/sun/awt/X11FontManager.java
+++ b/jdk/src/java.desktop/unix/classes/sun/awt/X11FontManager.java
@@ -742,28 +742,20 @@
     protected FontConfiguration createFontConfiguration() {
         /* The logic here decides whether to use a preconfigured
          * fontconfig.properties file, or synthesise one using platform APIs.
-         * On Solaris (as opposed to OpenSolaris) we try to use the
+         * On Solaris we try to use the
          * pre-configured ones, but if the files it specifies are missing
          * we fail-safe to synthesising one. This might happen if Solaris
          * changes its fonts.
-         * For OpenSolaris I don't expect us to ever create fontconfig files,
-         * so it will always synthesise. Note that if we misidentify
-         * OpenSolaris as Solaris, then the test for the presence of
-         * Solaris-only font files will correct this.
          * For Linux we require an exact match of distro and version to
-         * use the preconfigured file, and also that it points to
-         * existent fonts.
+         * use the preconfigured file.
          * If synthesising fails, we fall back to any preconfigured file
          * and do the best we can. For the commercial JDK this will be
          * fine as it includes the Lucida fonts. OpenJDK should not hit
          * this as the synthesis should always work on its platforms.
          */
         FontConfiguration mFontConfig = new MFontConfiguration(this);
-        if (FontUtilities.isOpenSolaris ||
-            (FontUtilities.isLinux &&
-             (!mFontConfig.foundOsSpecificFile() ||
-              !mFontConfig.fontFilesArePresent()) ||
-             (FontUtilities.isSolaris && !mFontConfig.fontFilesArePresent()))) {
+        if ((FontUtilities.isLinux && !mFontConfig.foundOsSpecificFile()) ||
+            (FontUtilities.isSolaris && !mFontConfig.fontFilesArePresent())) {
             FcFontConfiguration fcFontConfig =
                 new FcFontConfiguration(this);
             if (fcFontConfig.init()) {
@@ -773,6 +765,7 @@
         mFontConfig.init();
         return mFontConfig;
     }
+
     public FontConfiguration
         createFontConfiguration(boolean preferLocaleFonts,
                                 boolean preferPropFonts) {
diff --git a/jdk/src/java.desktop/unix/classes/sun/font/MFontConfiguration.java b/jdk/src/java.desktop/unix/classes/sun/font/MFontConfiguration.java
index f62e464..26791b7 100644
--- a/jdk/src/java.desktop/unix/classes/sun/font/MFontConfiguration.java
+++ b/jdk/src/java.desktop/unix/classes/sun/font/MFontConfiguration.java
@@ -88,21 +88,13 @@
         reorderMap.put("UTF-8.th", "thai");
         reorderMap.put("UTF-8.zh.TW", "chinese-big5");
         reorderMap.put("UTF-8.zh.HK", split("chinese-big5,chinese-hkscs"));
-        if (FontUtilities.isSolaris8) {
-            reorderMap.put("UTF-8.zh.CN", split("chinese-gb2312,chinese-big5"));
-        } else {
-            reorderMap.put("UTF-8.zh.CN",
-                           split("chinese-gb18030-0,chinese-gb18030-1"));
-        }
+        reorderMap.put("UTF-8.zh.CN",
+                       split("chinese-gb18030-0,chinese-gb18030-1"));
         reorderMap.put("UTF-8.zh",
                        split("chinese-big5,chinese-hkscs,chinese-gb18030-0,chinese-gb18030-1"));
         reorderMap.put("Big5", "chinese-big5");
         reorderMap.put("Big5-HKSCS", split("chinese-big5,chinese-hkscs"));
-        if (! FontUtilities.isSolaris8 && ! FontUtilities.isSolaris9) {
-            reorderMap.put("GB2312", split("chinese-gbk,chinese-gb2312"));
-        } else {
-            reorderMap.put("GB2312","chinese-gb2312");
-        }
+        reorderMap.put("GB2312", split("chinese-gbk,chinese-gb2312"));
         reorderMap.put("x-EUC-TW",
             split("chinese-cns11643-1,chinese-cns11643-2,chinese-cns11643-3"));
         reorderMap.put("GBK", "chinese-gbk");
diff --git a/jdk/src/java.desktop/unix/classes/sun/java2d/xr/XRPMBlitLoops.java b/jdk/src/java.desktop/unix/classes/sun/java2d/xr/XRPMBlitLoops.java
index 58ebf71..2cfd8c2 100644
--- a/jdk/src/java.desktop/unix/classes/sun/java2d/xr/XRPMBlitLoops.java
+++ b/jdk/src/java.desktop/unix/classes/sun/java2d/xr/XRPMBlitLoops.java
@@ -127,7 +127,11 @@
             vImgSurfaceType = SurfaceType.IntArgbPre;
         }
 
-        if (vImg == null || vImg.getWidth() < w || vImg.getHeight() < h) {
+        if (vImg == null || vImg.getWidth() < w || vImg.getHeight() < h ||
+            // Sometimes we get volatile image of wrong dest surface type,
+            // so recreating it
+            !(vImg.getDestSurface() instanceof XRSurfaceData))
+        {
             if (vImg != null) {
                 vImg.flush();
             }
@@ -142,6 +146,11 @@
         }
 
         Blit swToSurfaceBlit = Blit.getFromCache(src.getSurfaceType(), CompositeType.SrcNoEa, vImgSurfaceType);
+
+        if (!(vImg.getDestSurface() instanceof XRSurfaceData)) {
+            throw new InvalidPipeException("wrong surface data type: " + vImg.getDestSurface());
+        }
+
         XRSurfaceData vImgSurface = (XRSurfaceData) vImg.getDestSurface();
         swToSurfaceBlit.Blit(src, vImgSurface, AlphaComposite.Src, null,
                              sx, sy, 0, 0, w, h);
diff --git a/jdk/src/java.desktop/unix/classes/sun/print/IPPPrintService.java b/jdk/src/java.desktop/unix/classes/sun/print/IPPPrintService.java
index ea89e90..9f351b0 100644
--- a/jdk/src/java.desktop/unix/classes/sun/print/IPPPrintService.java
+++ b/jdk/src/java.desktop/unix/classes/sun/print/IPPPrintService.java
@@ -1684,7 +1684,6 @@
         }
         connection = (HttpURLConnection)urlc;
         connection.setUseCaches(false);
-        connection.setDefaultUseCaches(false);
         connection.setDoInput(true);
         connection.setDoOutput(true);
         connection.setRequestProperty("Content-type", "application/ipp");
diff --git a/jdk/src/java.desktop/unix/classes/sun/print/UnixPrintJob.java b/jdk/src/java.desktop/unix/classes/sun/print/UnixPrintJob.java
index a0891b4..7d79243 100644
--- a/jdk/src/java.desktop/unix/classes/sun/print/UnixPrintJob.java
+++ b/jdk/src/java.desktop/unix/classes/sun/print/UnixPrintJob.java
@@ -126,6 +126,11 @@
             mDestination = ((IPPPrintService)service).getDest();
         }
         mDestType = UnixPrintJob.DESTPRINTER;
+        JobSheets js = (JobSheets)(service.
+                                      getDefaultAttributeValue(JobSheets.class));
+        if (js != null && js.equals(JobSheets.NONE)) {
+            mNoJobSheet = true;
+        }
     }
 
     public PrintService getPrintService() {
@@ -848,10 +853,10 @@
 
     private String[] printExecCmd(String printer, String options,
                                  boolean noJobSheet,
-                                 String banner, int copies, String spoolFile) {
+                                 String jobTitle, int copies, String spoolFile) {
         int PRINTER = 0x1;
         int OPTIONS = 0x2;
-        int BANNER  = 0x4;
+        int JOBTITLE  = 0x4;
         int COPIES  = 0x8;
         int NOSHEET  = 0x10;
         int pFlags = 0;
@@ -868,8 +873,8 @@
             pFlags |= OPTIONS;
             ncomps+=1;
         }
-        if (banner != null && !banner.equals("")) {
-            pFlags |= BANNER;
+        if (jobTitle != null && !jobTitle.equals("")) {
+            pFlags |= JOBTITLE;
             ncomps+=1;
         }
         if (copies > 1) {
@@ -879,6 +884,9 @@
         if (noJobSheet) {
             pFlags |= NOSHEET;
             ncomps+=1;
+        } else if (getPrintService().
+                        isAttributeCategorySupported(JobSheets.class)) {
+            ncomps+=1;
         }
         if (PrintServiceLookupProvider.osname.equals("SunOS")) {
             ncomps+=1; // lp uses 1 more arg than lpr (make a copy)
@@ -888,15 +896,18 @@
             if ((pFlags & PRINTER) != 0) {
                 execCmd[n++] = "-d" + printer;
             }
-            if ((pFlags & BANNER) != 0) {
+            if ((pFlags & JOBTITLE) != 0) {
                 String quoteChar = "\"";
-                execCmd[n++] = "-t "  + quoteChar+banner+quoteChar;
+                execCmd[n++] = "-t "  + quoteChar+jobTitle+quoteChar;
             }
             if ((pFlags & COPIES) != 0) {
                 execCmd[n++] = "-n " + copies;
             }
             if ((pFlags & NOSHEET) != 0) {
                 execCmd[n++] = "-o nobanner";
+            } else if (getPrintService().
+                        isAttributeCategorySupported(JobSheets.class)) {
+                execCmd[n++] = "-o job-sheets=standard";
             }
             if ((pFlags & OPTIONS) != 0) {
                 execCmd[n++] = "-o " + options;
@@ -907,14 +918,17 @@
             if ((pFlags & PRINTER) != 0) {
                 execCmd[n++] = "-P" + printer;
             }
-            if ((pFlags & BANNER) != 0) {
-                execCmd[n++] = "-J "  + banner;
+            if ((pFlags & JOBTITLE) != 0) {
+                execCmd[n++] = "-J "  + jobTitle;
             }
             if ((pFlags & COPIES) != 0) {
                 execCmd[n++] = "-#" + copies;
             }
             if ((pFlags & NOSHEET) != 0) {
                 execCmd[n++] = "-h";
+            } else if (getPrintService().
+                        isAttributeCategorySupported(JobSheets.class)) {
+                execCmd[n++] = "-o job-sheets=standard";
             }
             if ((pFlags & OPTIONS) != 0) {
                 execCmd[n++] = "-o" + options;
diff --git a/jdk/src/java.desktop/unix/native/common/awt/fontpath.c b/jdk/src/java.desktop/unix/native/common/awt/fontpath.c
index 9a2e027..9b2b413 100644
--- a/jdk/src/java.desktop/unix/native/common/awt/fontpath.c
+++ b/jdk/src/java.desktop/unix/native/common/awt/fontpath.c
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1998, 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1998, 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
@@ -805,30 +805,36 @@
     pattern = (*FcPatternBuild)(NULL, FC_OUTLINE, FcTypeBool, FcTrue, NULL);
     objset = (*FcObjectSetBuild)(FC_FILE, NULL);
     fontSet = (*FcFontList)(NULL, pattern, objset);
-    fontdirs = (char**)calloc(fontSet->nfont+1, sizeof(char*));
-    for (f=0; f < fontSet->nfont; f++) {
-        FcChar8 *file;
-        FcChar8 *dir;
-        if ((*FcPatternGetString)(fontSet->fonts[f], FC_FILE, 0, &file) ==
-                                  FcResultMatch) {
-            dir = (*FcStrDirname)(file);
-            found = 0;
-            for (i=0;i<numdirs; i++) {
-                if (strcmp(fontdirs[i], (char*)dir) == 0) {
-                    found = 1;
-                    break;
+    if (fontSet == NULL) {
+        /* FcFontList() may return NULL if fonts are not installed. */
+        fontdirs = NULL;
+    } else {
+        fontdirs = (char**)calloc(fontSet->nfont+1, sizeof(char*));
+        for (f=0; f < fontSet->nfont; f++) {
+            FcChar8 *file;
+            FcChar8 *dir;
+            if ((*FcPatternGetString)(fontSet->fonts[f], FC_FILE, 0, &file) ==
+                                      FcResultMatch) {
+                dir = (*FcStrDirname)(file);
+                found = 0;
+                for (i=0;i<numdirs; i++) {
+                    if (strcmp(fontdirs[i], (char*)dir) == 0) {
+                        found = 1;
+                        break;
+                    }
+                }
+                if (!found) {
+                    fontdirs[numdirs++] = (char*)dir;
+                } else {
+                    free((char*)dir);
                 }
             }
-            if (!found) {
-                fontdirs[numdirs++] = (char*)dir;
-            } else {
-                free((char*)dir);
-            }
         }
+        /* Free fontset if one was returned */
+        (*FcFontSetDestroy)(fontSet);
     }
 
     /* Free memory and close the ".so" */
-    (*FcFontSetDestroy)(fontSet);
     (*FcPatternDestroy)(pattern);
     closeFontConfig(libfontconfig, JNI_TRUE);
     return fontdirs;
diff --git a/jdk/src/java.desktop/unix/native/libawt_xawt/awt/awt_Robot.c b/jdk/src/java.desktop/unix/native/libawt_xawt/awt/awt_Robot.c
index 41bb100..b69e2c0 100644
--- a/jdk/src/java.desktop/unix/native/libawt_xawt/awt/awt_Robot.c
+++ b/jdk/src/java.desktop/unix/native/libawt_xawt/awt/awt_Robot.c
@@ -100,9 +100,9 @@
 
     /* check if XTest is available */
     isXTestAvailable = XQueryExtension(awt_display, XTestExtensionName, &major_opcode, &first_event, &first_error);
-    DTRACE_PRINTLN3("RobotPeer: XQueryExtension(XTEST) returns major_opcode = %d, first_event = %d, first_error = %d",
-                    major_opcode, first_event, first_error);
     if (isXTestAvailable) {
+        DTRACE_PRINTLN3("RobotPeer: XQueryExtension(XTEST) returns major_opcode = %d, first_event = %d, first_error = %d",
+                        major_opcode, first_event, first_error);
         /* check if XTest version is OK */
         XTestQueryExtension(awt_display, &event_basep, &error_basep, &majorp, &minorp);
         DTRACE_PRINTLN4("RobotPeer: XTestQueryExtension returns event_basep = %d, error_basep = %d, majorp = %d, minorp = %d",
diff --git a/jdk/src/java.desktop/unix/native/libawt_xawt/awt/awt_UNIXToolkit.c b/jdk/src/java.desktop/unix/native/libawt_xawt/awt/awt_UNIXToolkit.c
index 81e3423..7fae8f4 100644
--- a/jdk/src/java.desktop/unix/native/libawt_xawt/awt/awt_UNIXToolkit.c
+++ b/jdk/src/java.desktop/unix/native/libawt_xawt/awt/awt_UNIXToolkit.c
@@ -129,6 +129,7 @@
         return JNI_FALSE;
     }
     if (!init_method(env, this) ) {
+        free(filename_str);
         return JNI_FALSE;
     }
     (*env)->GetStringUTFRegion(env, filename, 0, len, filename_str);
diff --git a/jdk/src/java.desktop/unix/native/libawt_xawt/xawt/XToolkit.c b/jdk/src/java.desktop/unix/native/libawt_xawt/xawt/XToolkit.c
index db32a22..0b452b4 100644
--- a/jdk/src/java.desktop/unix/native/libawt_xawt/xawt/XToolkit.c
+++ b/jdk/src/java.desktop/unix/native/libawt_xawt/xawt/XToolkit.c
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2002, 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2002, 2016, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -122,11 +122,7 @@
 JNIEXPORT jlong JNICALL Java_sun_awt_X11_XToolkit_getTrayIconDisplayTimeout
   (JNIEnv *env, jclass clazz)
 {
-#ifndef JAVASE_EMBEDDED
     return (jlong) 2000;
-#else
-    return (jlong) 10000;
-#endif
 }
 
 /*
@@ -369,12 +365,7 @@
 #define AWT_READPIPE            (awt_pipe_fds[0])
 #define AWT_WRITEPIPE           (awt_pipe_fds[1])
 
-#ifdef JAVASE_EMBEDDED
-  #define DEF_AWT_MAX_POLL_TIMEOUT ((uint32_t)4000000000) /* milliseconds */
-#else
-  #define DEF_AWT_MAX_POLL_TIMEOUT ((uint32_t)500) /* milliseconds */
-#endif
-
+#define DEF_AWT_MAX_POLL_TIMEOUT ((uint32_t)500) /* milliseconds */
 #define DEF_AWT_FLUSH_TIMEOUT ((uint32_t)100) /* milliseconds */
 #define AWT_MIN_POLL_TIMEOUT ((uint32_t)0) /* milliseconds */
 
@@ -391,11 +382,7 @@
 
 // Static fields
 
-#ifdef JAVASE_EMBEDDED
-  static int          awt_poll_alg = AWT_POLL_AGING_FAST;
-#else
-  static int          awt_poll_alg = AWT_POLL_AGING_SLOW;
-#endif
+static int          awt_poll_alg = AWT_POLL_AGING_SLOW;
 
 static uint32_t AWT_FLUSH_TIMEOUT  =  DEF_AWT_FLUSH_TIMEOUT; /* milliseconds */
 static uint32_t AWT_MAX_POLL_TIMEOUT = DEF_AWT_MAX_POLL_TIMEOUT; /* milliseconds */
@@ -1021,9 +1008,9 @@
      * before calling XTestFakeButtonEvent().
      */
     xinputAvailable = XQueryExtension(awt_display, INAME, &major_opcode, &first_event, &first_error);
-    DTRACE_PRINTLN3("RobotPeer: XQueryExtension(XINPUT) returns major_opcode = %d, first_event = %d, first_error = %d",
-                    major_opcode, first_event, first_error);
     if (xinputAvailable) {
+        DTRACE_PRINTLN3("RobotPeer: XQueryExtension(XINPUT) returns major_opcode = %d, first_event = %d, first_error = %d",
+                        major_opcode, first_event, first_error);
         devices = XListInputDevices(awt_display, &numDevices);
         for (devIdx = 0; devIdx < numDevices; devIdx++) {
             aDevice = &(devices[devIdx]);
diff --git a/jdk/src/java.desktop/unix/native/libawt_xawt/xawt/gnome_interface.h b/jdk/src/java.desktop/unix/native/libawt_xawt/xawt/gnome_interface.h
index bfd7643..86ea796 100644
--- a/jdk/src/java.desktop/unix/native/libawt_xawt/xawt/gnome_interface.h
+++ b/jdk/src/java.desktop/unix/native/libawt_xawt/xawt/gnome_interface.h
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2013, 2016 Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2013, 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
diff --git a/jdk/src/java.desktop/unix/native/libjawt/jawt.c b/jdk/src/java.desktop/unix/native/libjawt/jawt.c
index 1b7c049..b6a5240 100644
--- a/jdk/src/java.desktop/unix/native/libjawt/jawt.c
+++ b/jdk/src/java.desktop/unix/native/libjawt/jawt.c
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1999, 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1999, 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
@@ -39,10 +39,6 @@
  */
 JNIEXPORT jboolean JNICALL JAWT_GetAWT(JNIEnv* env, JAWT* awt)
 {
-#if defined(JAVASE_EMBEDDED) && defined(HEADLESS)
-    /* there are no AWT libs available at all */
-    return JNI_FALSE;
-#else
     if (awt == NULL) {
         return JNI_FALSE;
     }
@@ -62,5 +58,4 @@
     }
 
     return JNI_TRUE;
-#endif
 }
diff --git a/jdk/src/java.desktop/share/native/libawt/java2d/ShaderList.c b/jdk/src/java.desktop/windows/native/libawt/java2d/d3d/ShaderList.c
similarity index 98%
rename from jdk/src/java.desktop/share/native/libawt/java2d/ShaderList.c
rename to jdk/src/java.desktop/windows/native/libawt/java2d/d3d/ShaderList.c
index d7f69f7..e129bcd 100644
--- a/jdk/src/java.desktop/share/native/libawt/java2d/ShaderList.c
+++ b/jdk/src/java.desktop/windows/native/libawt/java2d/d3d/ShaderList.c
@@ -49,7 +49,7 @@
     info = (ShaderInfo *)malloc(sizeof(ShaderInfo));
     if (info == NULL) {
         J2dTraceLn(J2D_TRACE_ERROR,
-                   "OGLContext_AddProgram: could not allocate ShaderInfo");
+                   "D3DContext_AddProgram: could not allocate ShaderInfo");
         return;
     }
 
diff --git a/jdk/src/java.desktop/share/native/libawt/java2d/ShaderList.h b/jdk/src/java.desktop/windows/native/libawt/java2d/d3d/ShaderList.h
similarity index 100%
rename from jdk/src/java.desktop/share/native/libawt/java2d/ShaderList.h
rename to jdk/src/java.desktop/windows/native/libawt/java2d/d3d/ShaderList.h
diff --git a/jdk/src/java.desktop/windows/native/libawt/windows/awt_Choice.cpp b/jdk/src/java.desktop/windows/native/libawt/windows/awt_Choice.cpp
index be1c41e..8376f0a 100644
--- a/jdk/src/java.desktop/windows/native/libawt/windows/awt_Choice.cpp
+++ b/jdk/src/java.desktop/windows/native/libawt/windows/awt_Choice.cpp
@@ -345,7 +345,7 @@
      * drop down item height.
      */
     env->SetIntField(dimension, AwtDimension::heightID,
-                       GetFontHeight(env));
+                       ScaleUpY(GetFontHeight(env)));
     return dimension;
 }
 
diff --git a/jdk/src/java.desktop/windows/native/libawt/windows/awt_Component.cpp b/jdk/src/java.desktop/windows/native/libawt/windows/awt_Component.cpp
index 13b061e..1e889dc 100644
--- a/jdk/src/java.desktop/windows/native/libawt/windows/awt_Component.cpp
+++ b/jdk/src/java.desktop/windows/native/libawt/windows/awt_Component.cpp
@@ -3852,10 +3852,12 @@
     if (!m_useNativeCompWindow) {
         if (subMsg == IMN_OPENCANDIDATE) {
             m_bitsCandType = subMsg;
-        } else if (subMsg != IMN_SETCANDIDATEPOS) {
+            InquireCandidatePosition();
+        } else if (subMsg == IMN_OPENSTATUSWINDOW ||
+                   subMsg == WM_IME_STARTCOMPOSITION) {
             m_bitsCandType = 0;
+            InquireCandidatePosition();
         }
-        InquireCandidatePosition();
         return mrConsume;
     }
     return mrDoDefault;
diff --git a/jdk/src/java.desktop/windows/native/libawt/windows/awt_Font.cpp b/jdk/src/java.desktop/windows/native/libawt/windows/awt_Font.cpp
index d6a27df..2e7c779 100644
--- a/jdk/src/java.desktop/windows/native/libawt/windows/awt_Font.cpp
+++ b/jdk/src/java.desktop/windows/native/libawt/windows/awt_Font.cpp
@@ -1685,6 +1685,8 @@
 
 CSegTableManager g_segTableManager;
 
+#define KEYLEN 16
+
 class CCombinedSegTable : public CSegTableComponent
 {
 public:
@@ -1695,7 +1697,7 @@
 private:
     LPSTR GetCodePageSubkey();
     void GetEUDCFileName(LPWSTR lpszFileName, int cchFileName);
-    static char m_szCodePageSubkey[16];
+    static char m_szCodePageSubkey[KEYLEN];
     static WCHAR m_szDefaultEUDCFile[_MAX_PATH];
     static BOOL m_fEUDCSubKeyExist;
     static BOOL m_fTTEUDCFileExist;
@@ -1703,7 +1705,7 @@
     CEUDCSegTable* m_pEUDCSegTable;
 };
 
-char CCombinedSegTable::m_szCodePageSubkey[16] = "";
+char CCombinedSegTable::m_szCodePageSubkey[KEYLEN] = "";
 
 WCHAR CCombinedSegTable::m_szDefaultEUDCFile[_MAX_PATH] = L"";
 
@@ -1735,8 +1737,11 @@
     }
     lpszCP++; // cf lpszCP = "932"
 
-    char szSubKey[80];
+    char szSubKey[KEYLEN];
     strcpy(szSubKey, "EUDC\\");
+    if ((strlen(szSubKey) + strlen(lpszCP)) >= KEYLEN) {
+        return NULL;
+    }
     strcpy(&(szSubKey[strlen(szSubKey)]), lpszCP);
     strcpy(m_szCodePageSubkey, szSubKey);
     return m_szCodePageSubkey;
diff --git a/jdk/src/java.desktop/windows/native/libawt/windows/awt_Frame.cpp b/jdk/src/java.desktop/windows/native/libawt/windows/awt_Frame.cpp
index ed8311f..fd7c089 100644
--- a/jdk/src/java.desktop/windows/native/libawt/windows/awt_Frame.cpp
+++ b/jdk/src/java.desktop/windows/native/libawt/windows/awt_Frame.cpp
@@ -1374,7 +1374,6 @@
             } else { // zoom == iconify == FALSE
                 wp.showCmd = focusable ? SW_RESTORE : SW_SHOWNOACTIVATE;
             }
-            ::ShowWindow(hwnd, wp.showCmd);
             if (zoom && iconify) {
                 wp.flags |= WPF_RESTORETOMAXIMIZED;
             } else {
diff --git a/jdk/src/java.desktop/windows/native/libawt/windows/awt_Robot.cpp b/jdk/src/java.desktop/windows/native/libawt/windows/awt_Robot.cpp
index 3baf7f7..6666a6e 100644
--- a/jdk/src/java.desktop/windows/native/libawt/windows/awt_Robot.cpp
+++ b/jdk/src/java.desktop/windows/native/libawt/windows/awt_Robot.cpp
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1998, 2014, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1998, 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
@@ -335,7 +335,17 @@
     } else {
         // get the scancode from the virtual key
         scancode = ::MapVirtualKey(vkey, 0);
-        if (vkey == VK_RMENU) {
+        if (vkey == VK_RMENU ||
+            vkey == VK_DELETE ||
+            vkey == VK_INSERT ||
+            vkey == VK_NEXT ||
+            vkey == VK_PRIOR ||
+            vkey == VK_HOME ||
+            vkey == VK_END ||
+            vkey == VK_LEFT ||
+            vkey == VK_RIGHT ||
+            vkey == VK_UP ||
+            vkey == VK_DOWN) {
             dwFlags |= KEYEVENTF_EXTENDEDKEY;
         }
         keybd_event(vkey, scancode, dwFlags, 0);
diff --git a/jdk/src/java.httpclient/share/classes/java/net/http/AuthenticationFilter.java b/jdk/src/java.httpclient/share/classes/java/net/http/AuthenticationFilter.java
index 5bd425b..1f098f9 100644
--- a/jdk/src/java.httpclient/share/classes/java/net/http/AuthenticationFilter.java
+++ b/jdk/src/java.httpclient/share/classes/java/net/http/AuthenticationFilter.java
@@ -189,7 +189,7 @@
         }
 
         boolean proxy = status == PROXY_UNAUTHORIZED;
-        String authname = proxy ? "Proxy-Authentication" : "WWW-Authenticate";
+        String authname = proxy ? "Proxy-Authenticate" : "WWW-Authenticate";
         String authval = hdrs.firstValue(authname).orElseThrow(() -> {
             return new IOException("Invalid auth header");
         });
diff --git a/jdk/src/java.management/share/classes/java/lang/management/ThreadInfo.java b/jdk/src/java.management/share/classes/java/lang/management/ThreadInfo.java
index 46f92a2..c859d33 100644
--- a/jdk/src/java.management/share/classes/java/lang/management/ThreadInfo.java
+++ b/jdk/src/java.management/share/classes/java/lang/management/ThreadInfo.java
@@ -771,6 +771,14 @@
      *         <th align=left>Type</th>
      *       </tr>
      *       <tr>
+     *         <td>moduleName</td>
+     *         <td>{@code java.lang.String}</td>
+     *       </tr>
+     *       <tr>
+     *         <td>moduleVersion</td>
+     *         <td>{@code java.lang.String}</td>
+     *       </tr>
+     *       <tr>
      *         <td>className</td>
      *         <td>{@code java.lang.String}</td>
      *       </tr>
diff --git a/jdk/src/java.security.jgss/share/classes/sun/security/jgss/spi/GSSContextSpi.java b/jdk/src/java.security.jgss/share/classes/sun/security/jgss/spi/GSSContextSpi.java
index 8611642..0a3ec9c 100644
--- a/jdk/src/java.security.jgss/share/classes/sun/security/jgss/spi/GSSContextSpi.java
+++ b/jdk/src/java.security.jgss/share/classes/sun/security/jgss/spi/GSSContextSpi.java
@@ -395,7 +395,7 @@
     public void dispose() throws GSSException;
 
     /**
-     * Return the mechanism-specific attribute associated with (@code type}.
+     * Return the mechanism-specific attribute associated with {@code type}.
      *
      * @param type the type of the attribute requested
      * @return the attribute
diff --git a/jdk/src/jdk.jartool/share/classes/sun/security/tools/jarsigner/Main.java b/jdk/src/jdk.jartool/share/classes/sun/security/tools/jarsigner/Main.java
index 10dcb27..15b6c6d 100644
--- a/jdk/src/jdk.jartool/share/classes/sun/security/tools/jarsigner/Main.java
+++ b/jdk/src/jdk.jartool/share/classes/sun/security/tools/jarsigner/Main.java
@@ -70,7 +70,6 @@
  * @author Roland Schemers
  * @author Jan Luehe
  */
-@SuppressWarnings("deprecation")
 public class Main {
 
     // for i18n
@@ -98,7 +97,6 @@
     static final String VERSION = "1.0";
 
     static final int IN_KEYSTORE = 0x01;        // signer is in keystore
-    static final int IN_SCOPE = 0x02;
     static final int NOT_ALIAS = 0x04;          // alias list is NOT empty and
                                                 // signer is not in alias list
     static final int SIGNED_BY_ALIAS = 0x08;    // signer is in alias list
@@ -676,14 +674,13 @@
                     hasUnsignedEntry |= !je.isDirectory() && !isSigned
                                         && !signatureRelated(name);
 
-                    int inStoreOrScope = inKeyStore(signers);
+                    int inStoreWithAlias = inKeyStore(signers);
 
-                    boolean inStore = (inStoreOrScope & IN_KEYSTORE) != 0;
-                    boolean inScope = (inStoreOrScope & IN_SCOPE) != 0;
+                    boolean inStore = (inStoreWithAlias & IN_KEYSTORE) != 0;
 
-                    notSignedByAlias |= (inStoreOrScope & NOT_ALIAS) != 0;
+                    notSignedByAlias |= (inStoreWithAlias & NOT_ALIAS) != 0;
                     if (keystore != null) {
-                        aliasNotInStore |= isSigned && (!inStore && !inScope);
+                        aliasNotInStore |= isSigned && !inStore;
                     }
 
                     // Only used when -verbose provided
@@ -697,8 +694,7 @@
                         sb.append(isSigned ? rb.getString("s") : rb.getString("SPACE"))
                                 .append(inManifest ? rb.getString("m") : rb.getString("SPACE"))
                                 .append(inStore ? rb.getString("k") : rb.getString("SPACE"))
-                                .append(inScope ? rb.getString("i") : rb.getString("SPACE"))
-                                .append((inStoreOrScope & NOT_ALIAS) != 0 ? 'X' : ' ')
+                                .append((inStoreWithAlias & NOT_ALIAS) != 0 ? 'X' : ' ')
                                 .append(rb.getString("SPACE"));
                         sb.append('|');
                     }
@@ -800,8 +796,6 @@
                     ".m.entry.is.listed.in.manifest"));
                 System.out.println(rb.getString(
                     ".k.at.least.one.certificate.was.found.in.keystore"));
-                System.out.println(rb.getString(
-                    ".i.at.least.one.certificate.was.found.in.identity.scope"));
                 if (ckaliases.size() > 0) {
                     System.out.println(rb.getString(
                         ".X.not.signed.by.specified.alias.es."));
@@ -1076,8 +1070,6 @@
             if (alias != null) {
                 if (alias.startsWith("(")) {
                     result |= IN_KEYSTORE;
-                } else if (alias.startsWith("[")) {
-                    result |= IN_SCOPE;
                 }
                 if (ckaliases.contains(alias.substring(1, alias.length() - 1))) {
                     result |= SIGNED_BY_ALIAS;
diff --git a/jdk/src/jdk.jartool/share/classes/sun/security/tools/jarsigner/Resources.java b/jdk/src/jdk.jartool/share/classes/sun/security/tools/jarsigner/Resources.java
index 6198cd4..97ea20e 100644
--- a/jdk/src/jdk.jartool/share/classes/sun/security/tools/jarsigner/Resources.java
+++ b/jdk/src/jdk.jartool/share/classes/sun/security/tools/jarsigner/Resources.java
@@ -130,7 +130,6 @@
         {"s", "s"},
         {"m", "m"},
         {"k", "k"},
-        {"i", "i"},
         {".and.d.more.", "(and %d more)"},
         {".s.signature.was.verified.",
                 "  s = signature was verified "},
@@ -138,8 +137,6 @@
                 "  m = entry is listed in manifest"},
         {".k.at.least.one.certificate.was.found.in.keystore",
                 "  k = at least one certificate was found in keystore"},
-        {".i.at.least.one.certificate.was.found.in.identity.scope",
-                "  i = at least one certificate was found in identity scope"},
         {".X.not.signed.by.specified.alias.es.",
                 "  X = not signed by specified alias(es)"},
         {"no.manifest.", "no manifest."},
diff --git a/jdk/src/jdk.jartool/share/classes/sun/security/tools/jarsigner/Resources_ja.java b/jdk/src/jdk.jartool/share/classes/sun/security/tools/jarsigner/Resources_ja.java
index d398fb2..6751b18 100644
--- a/jdk/src/jdk.jartool/share/classes/sun/security/tools/jarsigner/Resources_ja.java
+++ b/jdk/src/jdk.jartool/share/classes/sun/security/tools/jarsigner/Resources_ja.java
@@ -123,7 +123,6 @@
         {"s", "s"},
         {"m", "m"},
         {"k", "k"},
-        {"i", "i"},
         {".and.d.more.", "(\u4ED6\u306B\u3082%d\u500B)"},
         {".s.signature.was.verified.",
                 "  s=\u7F72\u540D\u304C\u691C\u8A3C\u3055\u308C\u307E\u3057\u305F "},
@@ -131,8 +130,6 @@
                 "  m=\u30A8\u30F3\u30C8\u30EA\u304C\u30DE\u30CB\u30D5\u30A7\u30B9\u30C8\u5185\u306B\u30EA\u30B9\u30C8\u3055\u308C\u307E\u3059"},
         {".k.at.least.one.certificate.was.found.in.keystore",
                 "  k=1\u3064\u4EE5\u4E0A\u306E\u8A3C\u660E\u66F8\u304C\u30AD\u30FC\u30B9\u30C8\u30A2\u3067\u691C\u51FA\u3055\u308C\u307E\u3057\u305F"},
-        {".i.at.least.one.certificate.was.found.in.identity.scope",
-                "  i=1\u3064\u4EE5\u4E0A\u306E\u8A3C\u660E\u66F8\u304C\u30A2\u30A4\u30C7\u30F3\u30C6\u30A3\u30C6\u30A3\u30FB\u30B9\u30B3\u30FC\u30D7\u3067\u691C\u51FA\u3055\u308C\u307E\u3057\u305F"},
         {".X.not.signed.by.specified.alias.es.",
                 "  X =\u6307\u5B9A\u3057\u305F\u5225\u540D\u3067\u7F72\u540D\u3055\u308C\u3066\u3044\u307E\u305B\u3093"},
         {"no.manifest.", "\u30DE\u30CB\u30D5\u30A7\u30B9\u30C8\u306F\u5B58\u5728\u3057\u307E\u305B\u3093\u3002"},
diff --git a/jdk/src/jdk.jartool/share/classes/sun/security/tools/jarsigner/Resources_zh_CN.java b/jdk/src/jdk.jartool/share/classes/sun/security/tools/jarsigner/Resources_zh_CN.java
index d3f0371..1e6956d 100644
--- a/jdk/src/jdk.jartool/share/classes/sun/security/tools/jarsigner/Resources_zh_CN.java
+++ b/jdk/src/jdk.jartool/share/classes/sun/security/tools/jarsigner/Resources_zh_CN.java
@@ -123,7 +123,6 @@
         {"s", "s"},
         {"m", "m"},
         {"k", "k"},
-        {"i", "i"},
         {".and.d.more.", "(%d \u53CA\u4EE5\u4E0A)"},
         {".s.signature.was.verified.",
                 "  s = \u5DF2\u9A8C\u8BC1\u7B7E\u540D "},
@@ -131,8 +130,6 @@
                 "  m = \u5728\u6E05\u5355\u4E2D\u5217\u51FA\u6761\u76EE"},
         {".k.at.least.one.certificate.was.found.in.keystore",
                 "  k = \u5728\u5BC6\u94A5\u5E93\u4E2D\u81F3\u5C11\u627E\u5230\u4E86\u4E00\u4E2A\u8BC1\u4E66"},
-        {".i.at.least.one.certificate.was.found.in.identity.scope",
-                "  i = \u5728\u8EAB\u4EFD\u4F5C\u7528\u57DF\u5185\u81F3\u5C11\u627E\u5230\u4E86\u4E00\u4E2A\u8BC1\u4E66"},
         {".X.not.signed.by.specified.alias.es.",
                 "  X = \u672A\u7531\u6307\u5B9A\u522B\u540D\u7B7E\u540D"},
         {"no.manifest.", "\u6CA1\u6709\u6E05\u5355\u3002"},
diff --git a/jdk/src/jdk.jlink/share/classes/jdk/tools/jlink/builder/DefaultImageBuilder.java b/jdk/src/jdk.jlink/share/classes/jdk/tools/jlink/builder/DefaultImageBuilder.java
index dc0742a..1b37140 100644
--- a/jdk/src/jdk.jlink/share/classes/jdk/tools/jlink/builder/DefaultImageBuilder.java
+++ b/jdk/src/jdk.jlink/share/classes/jdk/tools/jlink/builder/DefaultImageBuilder.java
@@ -56,7 +56,6 @@
 import java.util.Properties;
 import java.util.Set;
 import jdk.tools.jlink.internal.BasicImageWriter;
-import jdk.tools.jlink.internal.plugins.FileCopierPlugin;
 import jdk.tools.jlink.internal.plugins.FileCopierPlugin.SymImageFile;
 import jdk.tools.jlink.internal.ExecutableImage;
 import jdk.tools.jlink.plugin.ResourcePool;
@@ -184,10 +183,6 @@
             files.moduleView().modules().forEach(m -> {
                 // Only add modules that contain packages
                 if (!m.packages().isEmpty()) {
-                    // Skip the fake module used by FileCopierPlugin when copying files.
-                    if (m.name().equals(FileCopierPlugin.FAKE_MODULE)) {
-                        return;
-                    }
                     modules.add(m.name());
                 }
             });
@@ -228,6 +223,7 @@
             desc.osName().ifPresent(s -> props.setProperty("OS_NAME", s));
             desc.osVersion().ifPresent(s -> props.setProperty("OS_VERSION", s));
             desc.osArch().ifPresent(s -> props.setProperty("OS_ARCH", s));
+            props.setProperty("JAVA_VERSION", System.getProperty("java.version"));
         });
 
         Optional<ResourcePoolEntry> release = pool.findEntry("/java.base/release");
diff --git a/jdk/src/jdk.jlink/share/classes/jdk/tools/jlink/internal/ResourcePoolManager.java b/jdk/src/jdk.jlink/share/classes/jdk/tools/jlink/internal/ResourcePoolManager.java
index 54b1f7e..47447c9 100644
--- a/jdk/src/jdk.jlink/share/classes/jdk/tools/jlink/internal/ResourcePoolManager.java
+++ b/jdk/src/jdk.jlink/share/classes/jdk/tools/jlink/internal/ResourcePoolManager.java
@@ -83,8 +83,8 @@
             if (!path.startsWith("/")) {
                 path = "/" + path;
             }
-            if (!path.startsWith("/" + name)) {
-                path = "/" + name + path;
+            if (!path.startsWith("/" + name + "/")) {
+                path = "/" + name + path; // path already starts with '/'
             }
             return Optional.ofNullable(moduleContent.get(path));
         }
@@ -213,7 +213,6 @@
 
     private final Map<String, ResourcePoolEntry> resources = new LinkedHashMap<>();
     private final Map<String, ResourcePoolModule> modules = new LinkedHashMap<>();
-    private final ResourcePoolModuleImpl fileCopierModule = new ResourcePoolModuleImpl(FileCopierPlugin.FAKE_MODULE);
     private final ByteOrder order;
     private final StringTable table;
     private final ResourcePool poolImpl;
@@ -272,11 +271,6 @@
         }
         String modulename = data.moduleName();
         ResourcePoolModuleImpl m = (ResourcePoolModuleImpl)modules.get(modulename);
-        // ## TODO: FileCopierPlugin should not add content to a module
-        // FAKE_MODULE is not really a module to be added in the image
-        if (FileCopierPlugin.FAKE_MODULE.equals(modulename)) {
-            m = fileCopierModule;
-        }
         if (m == null) {
             m = new ResourcePoolModuleImpl(modulename);
             modules.put(modulename, m);
diff --git a/jdk/src/jdk.jlink/share/classes/jdk/tools/jlink/internal/plugins/ExcludeVMPlugin.java b/jdk/src/jdk.jlink/share/classes/jdk/tools/jlink/internal/plugins/ExcludeVMPlugin.java
index 4bfe522..df82485 100644
--- a/jdk/src/jdk.jlink/share/classes/jdk/tools/jlink/internal/plugins/ExcludeVMPlugin.java
+++ b/jdk/src/jdk.jlink/share/classes/jdk/tools/jlink/internal/plugins/ExcludeVMPlugin.java
@@ -38,6 +38,7 @@
 import jdk.tools.jlink.plugin.Plugin;
 import jdk.tools.jlink.plugin.ResourcePool;
 import jdk.tools.jlink.plugin.ResourcePoolBuilder;
+import jdk.tools.jlink.plugin.ResourcePoolModule;
 import jdk.tools.jlink.plugin.ResourcePoolEntry;
 import jdk.tools.jlink.plugin.PluginException;
 
@@ -98,9 +99,8 @@
      * e.g.: /java.base/native/amd64/server/libjvm.so
      * /java.base/native/server/libjvm.dylib
      */
-    private List<ResourcePoolEntry> getVMs(ResourcePool in) {
-        String jvmlib = jvmlib();
-        List<ResourcePoolEntry> ret = in.moduleView().findModule("java.base").get().entries().filter((t) -> {
+    private List<ResourcePoolEntry> getVMs(ResourcePoolModule javaBase, String jvmlib) {
+        List<ResourcePoolEntry> ret = javaBase.entries().filter((t) -> {
             return t.path().endsWith("/" + jvmlib);
         }).collect(Collectors.toList());
         return ret;
@@ -108,12 +108,13 @@
 
     @Override
     public ResourcePool transform(ResourcePool in, ResourcePoolBuilder out) {
-        String jvmlib = jvmlib();
+        ResourcePoolModule javaBase = in.moduleView().findModule("java.base").get();
+        String jvmlib = jvmlib(javaBase.descriptor().osName().get());
         TreeSet<Jvm> existing = new TreeSet<>(new JvmComparator());
         TreeSet<Jvm> removed = new TreeSet<>(new JvmComparator());
         if (!keepAll) {
             // First retrieve all available VM names and removed VM
-            List<ResourcePoolEntry> jvms = getVMs(in);
+            List<ResourcePoolEntry> jvms = getVMs(javaBase, jvmlib);
             for (Jvm jvm : Jvm.values()) {
                 for (ResourcePoolEntry md : jvms) {
                     if (md.path().endsWith("/" + jvm.getName() + "/" + jvmlib)) {
@@ -247,21 +248,21 @@
         return orig.copyWithContent(content);
     }
 
-    private static String jvmlib() {
+    private static String jvmlib(String osName) {
         String lib = "libjvm.so";
-        if (isWindows()) {
+        if (isWindows(osName)) {
             lib = "jvm.dll";
-        } else if (isMac()) {
+        } else if (isMac(osName)) {
             lib = "libjvm.dylib";
         }
         return lib;
     }
 
-    private static boolean isWindows() {
-        return System.getProperty("os.name").startsWith("Windows");
+    private static boolean isWindows(String osName) {
+        return osName.startsWith("Windows");
     }
 
-    private static boolean isMac() {
-        return System.getProperty("os.name").startsWith("Mac OS");
+    private static boolean isMac(String osName) {
+        return osName.startsWith("Mac OS") || osName.startsWith("Darwin");
     }
 }
diff --git a/jdk/src/jdk.jlink/share/classes/jdk/tools/jlink/internal/plugins/FileCopierPlugin.java b/jdk/src/jdk.jlink/share/classes/jdk/tools/jlink/internal/plugins/FileCopierPlugin.java
index 15f529c..a0384bb 100644
--- a/jdk/src/jdk.jlink/share/classes/jdk/tools/jlink/internal/plugins/FileCopierPlugin.java
+++ b/jdk/src/jdk.jlink/share/classes/jdk/tools/jlink/internal/plugins/FileCopierPlugin.java
@@ -58,8 +58,6 @@
         Path source;
         Path target;
     }
-    public static final String FAKE_MODULE = "$jlink-file-copier";
-
     private final List<CopiedFile> files = new ArrayList<>();
 
     /**
@@ -159,7 +157,7 @@
         Objects.requireNonNull(file);
         Objects.requireNonNull(path);
         ResourcePoolEntry impl = ResourcePoolEntry.create(
-                "/" + FAKE_MODULE + "/other/" + path,
+                "/java.base/other/" + path,
                 ResourcePoolEntry.Type.OTHER, file);
         try {
             pool.add(impl);
diff --git a/jdk/src/jdk.jlink/share/classes/jdk/tools/jlink/internal/plugins/GenerateJLIClassesPlugin.java b/jdk/src/jdk.jlink/share/classes/jdk/tools/jlink/internal/plugins/GenerateJLIClassesPlugin.java
index 0fdd27e..c50860a 100644
--- a/jdk/src/jdk.jlink/share/classes/jdk/tools/jlink/internal/plugins/GenerateJLIClassesPlugin.java
+++ b/jdk/src/jdk.jlink/share/classes/jdk/tools/jlink/internal/plugins/GenerateJLIClassesPlugin.java
@@ -24,9 +24,11 @@
  */
 package jdk.tools.jlink.internal.plugins;
 
+import java.lang.invoke.MethodType;
 import java.lang.reflect.Method;
 import java.util.Arrays;
 import java.util.EnumSet;
+import java.util.HashMap;
 import java.util.List;
 import java.util.Map;
 import java.util.Set;
@@ -48,14 +50,26 @@
 
     private static final String BMH_SPECIES_PARAM = "bmh-species";
 
+    private static final String DMH_PARAM = "dmh";
+
     private static final String DESCRIPTION = PluginsResourceBundle.getDescription(NAME);
 
     private static final String BMH = "java/lang/invoke/BoundMethodHandle";
+    private static final Method BMH_FACTORY_METHOD;
 
-    private static final Method FACTORY_METHOD;
+    private static final String DMH = "java/lang/invoke/DirectMethodHandle$Holder";
+    private static final String DMH_INVOKE_VIRTUAL = "invokeVirtual";
+    private static final String DMH_INVOKE_STATIC = "invokeStatic";
+    private static final String DMH_INVOKE_SPECIAL = "invokeSpecial";
+    private static final String DMH_NEW_INVOKE_SPECIAL = "newInvokeSpecial";
+    private static final String DMH_INVOKE_INTERFACE = "invokeInterface";
+    private static final String DMH_INVOKE_STATIC_INIT = "invokeStaticInit";
+    private static final Method DMH_FACTORY_METHOD;
 
     List<String> speciesTypes;
 
+    Map<String, List<String>> dmhMethods;
+
     public GenerateJLIClassesPlugin() {
     }
 
@@ -87,11 +101,9 @@
     /**
      * @return the default Species forms to generate.
      *
-     * This list was derived from running a Java concatenating strings
-     * with -Djava.lang.invoke.stringConcat=MH_INLINE_SIZED_EXACT set
-     * plus a subset of octane. A better long-term solution is to define
-     * and run a set of quick generators and extracting this list as a
-     * step in the build process.
+     * This list was derived from running a small startup benchmark.
+     * A better long-term solution is to define and run a set of quick
+     * generators and extracting this list as a step in the build process.
      */
     public static List<String> defaultSpecies() {
         return List.of("LL", "L3", "L4", "L5", "L6", "L7", "L7I",
@@ -100,18 +112,51 @@
                 "LILL", "I", "LLILL");
     }
 
+    /**
+     * @return the list of default DirectMethodHandle methods to generate.
+     */
+    public static Map<String, List<String>> defaultDMHMethods() {
+        return Map.of(
+            DMH_INVOKE_VIRTUAL, List.of("_L", "L_L", "LI_I", "LL_V"),
+            DMH_INVOKE_SPECIAL, List.of("L_I", "L_L", "LF_L", "LD_L", "LL_L",
+                "L3_L", "L4_L", "L5_L", "L6_L", "L7_L", "LI_I", "LI_L", "LIL_I",
+                "LII_I", "LII_L", "LLI_L", "LLI_I", "LILI_I", "LIIL_L",
+                "LIILL_L", "LIILL_I", "LIIL_I", "LILIL_I", "LILILL_I",
+                "LILII_I", "LI3_I", "LI3L_I", "LI3LL_I", "LI3_L", "LI4_I"),
+            DMH_INVOKE_STATIC, List.of("II_I", "IL_I", "ILIL_I", "ILII_I",
+                "_I", "_L", "_V", "D_L", "F_L", "I_I", "II_L", "LI_L",
+                "L_V", "L_L", "LL_L", "L3_L", "L4_L", "L5_L", "L6_L",
+                "L7_L", "L8_L", "L9_L", "L9I_L", "L9II_L", "L9IIL_L",
+                "L10_L", "L11_L", "L12_L", "L13_L", "L13I_L", "L13II_L")
+        );
+    }
+
+    // Map from DirectMethodHandle method type to internal ID
+    private static final Map<String, Integer> DMH_METHOD_TYPE_MAP =
+            Map.of(
+                DMH_INVOKE_VIRTUAL,     0,
+                DMH_INVOKE_STATIC,      1,
+                DMH_INVOKE_SPECIAL,     2,
+                DMH_NEW_INVOKE_SPECIAL, 3,
+                DMH_INVOKE_INTERFACE,   4,
+                DMH_INVOKE_STATIC_INIT, 5
+            );
+
     @Override
     public void configure(Map<String, String> config) {
         String mainArgument = config.get(NAME);
 
         // Enable by default
         boolean bmhEnabled = true;
+        boolean dmhEnabled = true;
         if (mainArgument != null) {
-            Set<String> args = Arrays.stream(mainArgument.split(","))
-                    .collect(Collectors.toSet());
+            List<String> args = Arrays.asList(mainArgument.split(","));
             if (!args.contains(BMH_PARAM)) {
                 bmhEnabled = false;
             }
+            if (!args.contains(DMH_PARAM)) {
+                dmhEnabled = false;
+            }
         }
 
         if (!bmhEnabled) {
@@ -132,40 +177,63 @@
             speciesTypes = bmhSpecies.stream()
                     .map(type -> expandSignature(type))
                     .collect(Collectors.toList());
+        }
 
-            // Validation check
-            for (String type : speciesTypes) {
-                for (char c : type.toCharArray()) {
-                    if ("LIJFD".indexOf(c) < 0) {
-                        throw new PluginException("All characters must "
-                                + "correspond to a basic field type: LIJFD");
+        // DirectMethodHandles
+        if (!dmhEnabled) {
+            dmhMethods = Map.of();
+        } else {
+            dmhMethods = new HashMap<>();
+            for (String dmhParam : DMH_METHOD_TYPE_MAP.keySet()) {
+                String args = config.get(dmhParam);
+                if (args != null && !args.isEmpty()) {
+                    List<String> dmhMethodTypes = Arrays.stream(args.split(","))
+                            .map(String::trim)
+                            .filter(s -> !s.isEmpty())
+                            .collect(Collectors.toList());
+                    dmhMethods.put(dmhParam, dmhMethodTypes);
+                    // Validation check
+                    for (String type : dmhMethodTypes) {
+                        String[] typeParts = type.split("_");
+                        // check return type (second part)
+                        if (typeParts.length != 2 || typeParts[1].length() != 1
+                                || "LJIFDV".indexOf(typeParts[1].charAt(0)) == -1) {
+                            throw new PluginException(
+                                    "Method type signature must be of form [LJIFD]*_[LJIFDV]");
+                        }
+                        // expand and check arguments (first part)
+                        expandSignature(typeParts[0]);
                     }
                 }
             }
+            if (dmhMethods.isEmpty()) {
+                dmhMethods = defaultDMHMethods();
+            }
+        }
+    }
+
+    private static void requireBasicType(char c) {
+        if ("LIJFD".indexOf(c) < 0) {
+            throw new PluginException(
+                    "Character " + c + " must correspond to a basic field type: LIJFD");
         }
     }
 
     @Override
     public ResourcePool transform(ResourcePool in, ResourcePoolBuilder out) {
-        in.entries().forEach(data -> {
-            if (("/java.base/" + BMH + ".class").equals(data.path())) {
-                // Add BoundMethodHandle unchanged
-                out.add(data);
-                speciesTypes.forEach(types -> generateConcreteClass(types, data, out));
-            } else {
-                out.add(data);
-            }
-        });
-
+        // Copy all but DMH_ENTRY to out
+        in.transformAndCopy(entry -> entry.path().equals(DMH_ENTRY) ? null : entry, out);
+        speciesTypes.forEach(types -> generateBMHClass(types, out));
+        generateDMHClass(out);
         return out.build();
     }
 
     @SuppressWarnings("unchecked")
-    private void generateConcreteClass(String types, ResourcePoolEntry data, ResourcePoolBuilder out) {
+    private void generateBMHClass(String types, ResourcePoolBuilder out) {
         try {
             // Generate class
             Map.Entry<String, byte[]> result = (Map.Entry<String, byte[]>)
-                    FACTORY_METHOD.invoke(null, types);
+                    BMH_FACTORY_METHOD.invoke(null, types);
             String className = result.getKey();
             byte[] bytes = result.getValue();
 
@@ -179,13 +247,47 @@
         }
     }
 
+    private void generateDMHClass(ResourcePoolBuilder out) {
+        int count = 0;
+        for (List<String> entry : dmhMethods.values()) {
+            count += entry.size();
+        }
+        MethodType[] methodTypes = new MethodType[count];
+        int[] dmhTypes = new int[count];
+        int index = 0;
+        for (Map.Entry<String, List<String>> entry : dmhMethods.entrySet()) {
+            String dmhType = entry.getKey();
+            for (String type : entry.getValue()) {
+                methodTypes[index] = asMethodType(type);
+                dmhTypes[index] = DMH_METHOD_TYPE_MAP.get(dmhType);
+                index++;
+            }
+        }
+        try {
+            byte[] bytes = (byte[])DMH_FACTORY_METHOD
+                    .invoke(null,
+                            DMH,
+                            methodTypes,
+                            dmhTypes);
+            ResourcePoolEntry ndata = ResourcePoolEntry.create(DMH_ENTRY, bytes);
+            out.add(ndata);
+        } catch (Exception ex) {
+            throw new PluginException(ex);
+        }
+    }
+    private static final String DMH_ENTRY = "/java.base/" + DMH + ".class";
+
     static {
         try {
             Class<?> BMHFactory = Class.forName("java.lang.invoke.BoundMethodHandle$Factory");
-            Method genClassMethod = BMHFactory.getDeclaredMethod("generateConcreteBMHClassBytes",
+            BMH_FACTORY_METHOD = BMHFactory.getDeclaredMethod("generateConcreteBMHClassBytes",
                     String.class);
-            genClassMethod.setAccessible(true);
-            FACTORY_METHOD = genClassMethod;
+            BMH_FACTORY_METHOD.setAccessible(true);
+
+            Class<?> DMHFactory = Class.forName("java.lang.invoke.DirectMethodHandle");
+            DMH_FACTORY_METHOD = DMHFactory.getDeclaredMethod("generateDMHClassBytes",
+                    String.class, MethodType[].class, int[].class);
+            DMH_FACTORY_METHOD.setAccessible(true);
         } catch (Exception e) {
             throw new PluginException(e);
         }
@@ -202,6 +304,7 @@
                 count *= 10;
                 count += (c - '0');
             } else {
+                requireBasicType(c);
                 for (int j = 1; j < count; j++) {
                     sb.append(last);
                 }
@@ -210,9 +313,52 @@
                 count = 0;
             }
         }
-        for (int j = 1; j < count; j++) {
-            sb.append(last);
+
+        // ended with a number, e.g., "L2": append last char count - 1 times
+        if (count > 1) {
+            requireBasicType(last);
+            for (int j = 1; j < count; j++) {
+                sb.append(last);
+            }
         }
         return sb.toString();
     }
+
+    private static MethodType asMethodType(String basicSignatureString) {
+        String[] parts = basicSignatureString.split("_");
+        assert(parts.length == 2);
+        assert(parts[1].length() == 1);
+        String parameters = expandSignature(parts[0]);
+        Class<?> rtype = primitiveType(parts[1].charAt(0));
+        Class<?>[] ptypes = new Class<?>[parameters.length()];
+        for (int i = 0; i < ptypes.length; i++) {
+            ptypes[i] = primitiveType(parameters.charAt(i));
+        }
+        return MethodType.methodType(rtype, ptypes);
+    }
+
+    private static Class<?> primitiveType(char c) {
+        switch (c) {
+            case 'F':
+                return float.class;
+            case 'D':
+                return double.class;
+            case 'I':
+                return int.class;
+            case 'L':
+                return Object.class;
+            case 'J':
+                return long.class;
+            case 'V':
+                return void.class;
+            case 'Z':
+            case 'B':
+            case 'S':
+            case 'C':
+                throw new IllegalArgumentException("Not a valid primitive: " + c +
+                        " (use I instead)");
+            default:
+                throw new IllegalArgumentException("Not a primitive: " + c);
+        }
+    }
 }
diff --git a/jdk/src/jdk.jlink/share/classes/jdk/tools/jlink/internal/plugins/IncludeLocalesPlugin.java b/jdk/src/jdk.jlink/share/classes/jdk/tools/jlink/internal/plugins/IncludeLocalesPlugin.java
index d8f9d79..b6e29bf 100644
--- a/jdk/src/jdk.jlink/share/classes/jdk/tools/jlink/internal/plugins/IncludeLocalesPlugin.java
+++ b/jdk/src/jdk.jlink/share/classes/jdk/tools/jlink/internal/plugins/IncludeLocalesPlugin.java
@@ -31,6 +31,7 @@
 import java.util.Locale;
 import java.util.List;
 import java.util.Map;
+import java.util.Objects;
 import java.util.Optional;
 import static java.util.ResourceBundle.Control;
 import java.util.Set;
@@ -342,9 +343,8 @@
                     // locales from the pre-filtered list.
                     locales.stream()
                         .filter(l -> l.toString().equalsIgnoreCase(loc.toString()))
-                        .findAny()
-                        .orElse(Locale.ROOT))
-                .filter(loc -> !loc.equals(Locale.ROOT))
+                        .findAny())
+                .flatMap(Optional::stream)
                 .flatMap(IncludeLocalesPlugin::localeToTags)
                 .distinct()
                 .collect(Collectors.toList());
@@ -373,40 +373,42 @@
     }
 
     private static Stream<String> localeToTags(Locale loc) {
+        Objects.requireNonNull(loc);
+
         String tag = loc.toLanguageTag();
-        Stream<String> ret = null;
+        List<String> tags = null;
 
         switch (loc.getLanguage()) {
             // ISO3166 compatibility
             case "iw":
-                ret = List.of(tag, tag.replaceFirst("^he", "iw")).stream();
+                tags = List.of(tag, tag.replaceFirst("^he", "iw"));
                 break;
             case "in":
-                ret = List.of(tag, tag.replaceFirst("^id", "in")).stream();
+                tags = List.of(tag, tag.replaceFirst("^id", "in"));
                 break;
             case "ji":
-                ret = List.of(tag, tag.replaceFirst("^yi", "ji")).stream();
+                tags = List.of(tag, tag.replaceFirst("^yi", "ji"));
                 break;
 
             // Special COMPAT provider locales
             case "ja":
                 if (loc.getCountry() == "JP") {
-                    ret = List.of(tag, jaJPJPTag).stream();
+                    tags = List.of(tag, jaJPJPTag);
                 }
                 break;
             case "no":
             case "nn":
                 if (loc.getCountry() == "NO") {
-                    ret = List.of(tag, noNONYTag).stream();
+                    tags = List.of(tag, noNONYTag);
                 }
                 break;
             case "th":
                 if (loc.getCountry() == "TH") {
-                    ret = List.of(tag, thTHTHTag).stream();
+                    tags = List.of(tag, thTHTHTag);
                 }
                 break;
         }
 
-        return ret == null ? List.of(tag).stream() : ret;
+        return tags == null ? List.of(tag).stream() : tags.stream();
     }
 }
diff --git a/jdk/src/jdk.jsobject/share/classes/netscape/javascript/JSObject.java b/jdk/src/jdk.jsobject/share/classes/netscape/javascript/JSObject.java
index 7ef7e3b..c7a11bc 100644
--- a/jdk/src/jdk.jsobject/share/classes/netscape/javascript/JSObject.java
+++ b/jdk/src/jdk.jsobject/share/classes/netscape/javascript/JSObject.java
@@ -149,7 +149,13 @@
      * {@code null} if we are not connected to a browser.
      * @throws JSException when an error is reported from the browser or
      * JavaScript engine or if applet is {@code null}
+     *
+     * @deprecated  The Applet API is deprecated. See the
+     * <a href="../../../../../../api/java/applet/package-summary.html">
+     * java.applet package documentation</a> for further information.
      */
+
+    @Deprecated(since = "9")
     public static JSObject getWindow(Applet applet) throws JSException {
         return ProviderLoader.callGetWindow(applet);
     }
diff --git a/jdk/src/jdk.management/share/classes/com/sun/management/internal/GcInfoBuilder.java b/jdk/src/jdk.management/share/classes/com/sun/management/internal/GcInfoBuilder.java
index ab5f795..0ceb1f6 100644
--- a/jdk/src/jdk.management/share/classes/com/sun/management/internal/GcInfoBuilder.java
+++ b/jdk/src/jdk.management/share/classes/com/sun/management/internal/GcInfoBuilder.java
@@ -79,7 +79,7 @@
     }
 
     public String[] getPoolNames() {
-        return poolNames;
+        return poolNames.clone();
     }
 
     int getGcExtItemCount() {
diff --git a/jdk/src/jdk.management/share/native/libmanagement_ext/Flag.c b/jdk/src/jdk.management/share/native/libmanagement_ext/Flag.c
index 1629468..c5dd599 100644
--- a/jdk/src/jdk.management/share/native/libmanagement_ext/Flag.c
+++ b/jdk/src/jdk.management/share/native/libmanagement_ext/Flag.c
@@ -141,6 +141,13 @@
             // ignore unsupported type
             continue;
         }
+
+        if (valueObj == NULL && globals[i].type != JMM_VMGLOBAL_TYPE_JSTRING) {
+            free(globals);
+            JNU_ThrowOutOfMemoryError(env, 0);
+            return 0;
+        }
+
         switch (globals[i].origin) {
         case JMM_VMGLOBAL_ORIGIN_DEFAULT:
             origin = default_origin;
diff --git a/jdk/src/jdk.security.auth/solaris/native/libjaas/Solaris.c b/jdk/src/jdk.security.auth/solaris/native/libjaas/Solaris.c
index 1d251a6..438b3b7 100644
--- a/jdk/src/jdk.security.auth/solaris/native/libjaas/Solaris.c
+++ b/jdk/src/jdk.security.auth/solaris/native/libjaas/Solaris.c
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2000, 2013, 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,10 +26,14 @@
 #include <jni.h>
 #include "com_sun_security_auth_module_SolarisSystem.h"
 #include <stdio.h>
-#include <pwd.h>
 #include <unistd.h>
 #include <stdlib.h>
 #include <string.h>
+
+/* For POSIX-compliant getpwuid_r on Solaris */
+#if defined(__solaris__)
+#define _POSIX_PTHREAD_SEMANTICS
+#endif
 #include <pwd.h>
 
 static void throwIllegalArgumentException(JNIEnv *env, const char *msg) {
@@ -43,8 +47,10 @@
                                                 (JNIEnv *env, jobject obj) {
 
     int i;
-    char pwd_buf[1024];
+    long pwd_bufsize;
+    char *pwd_buf = NULL;
     struct passwd pwd;
+    struct passwd* p = NULL;
     jsize numSuppGroups = getgroups(0, NULL);
     jfieldID fid;
     jstring jstr;
@@ -53,20 +59,31 @@
     gid_t *groups;
     jclass cls;
 
+    pwd_bufsize = sysconf(_SC_GETPW_R_SIZE_MAX);
+    if (pwd_bufsize == -1) {
+        pwd_bufsize = 1024;
+    }
+    pwd_buf = (char *)malloc(pwd_bufsize);
     groups = (gid_t *)calloc(numSuppGroups, sizeof(gid_t));
 
-    if (groups == NULL) {
-        jclass cls = (*env)->FindClass(env,"java/lang/OutOfMemoryError");
-        if (cls != NULL)
+    if (pwd_buf == NULL || groups == NULL) {
+        if (pwd_buf != NULL) {
+            free(pwd_buf);
+        }
+        if (groups != NULL) {
+            free(groups);
+        }
+        cls = (*env)->FindClass(env,"java/lang/OutOfMemoryError");
+        if (cls != NULL) {
             (*env)->ThrowNew(env, cls, NULL);
+        }
         return;
     }
 
     cls = (*env)->GetObjectClass(env, obj);
 
-    memset(pwd_buf, 0, sizeof(pwd_buf));
-    if (getpwuid_r(getuid(), &pwd, pwd_buf, sizeof(pwd_buf)) != NULL &&
-        getgroups(numSuppGroups, groups) != -1) {
+    if (getpwuid_r(getuid(), &pwd, pwd_buf, sizeof(pwd_buf), &p) != 0 &&
+        p != NULL && getgroups(numSuppGroups, groups) != -1) {
 
         /*
          * set username
@@ -129,7 +146,7 @@
         (*env)->SetObjectField(env, obj, fid, jgroups);
     }
 cleanupAndReturn:
+    free(pwd_buf);
     free(groups);
-
     return;
 }
diff --git a/jdk/src/jdk.security.auth/unix/native/libjaas/Unix.c b/jdk/src/jdk.security.auth/unix/native/libjaas/Unix.c
index 76737ab..fdee7d3 100644
--- a/jdk/src/jdk.security.auth/unix/native/libjaas/Unix.c
+++ b/jdk/src/jdk.security.auth/unix/native/libjaas/Unix.c
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2000, 2015, 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
@@ -23,20 +23,21 @@
  * questions.
  */
 
-#ifdef __solaris__
-#define _POSIX_C_SOURCE 199506L
-#endif
-
 #include <jni.h>
 #include "jni_util.h"
 #include "com_sun_security_auth_module_UnixSystem.h"
 #include <stdio.h>
-#include <pwd.h>
 #include <sys/types.h>
 #include <unistd.h>
 #include <stdlib.h>
 #include <string.h>
 
+/* For POSIX-compliant getpwuid_r on Solaris */
+#if defined(__solaris__)
+#define _POSIX_PTHREAD_SEMANTICS
+#endif
+#include <pwd.h>
+
 /*
  * Declare library specific JNI_Onload entry if static build
  */
diff --git a/jdk/test/ProblemList.txt b/jdk/test/ProblemList.txt
index 5585c01..a6af75c 100644
--- a/jdk/test/ProblemList.txt
+++ b/jdk/test/ProblemList.txt
@@ -297,9 +297,6 @@
 ############################################################################
 
 # jdk_imageio
-javax/imageio/plugins/shared/CanWriteSequence.java              8148454 generic-all
-javax/imageio/plugins/tiff/MultiPageTest/MultiPageTest.java     8148454 generic-all
-javax/imageio/plugins/tiff/WriteToSequenceAfterAbort.java       8148454 generic-all
 
 ############################################################################
 
@@ -318,7 +315,7 @@
 
 ############################################################################
 
-# jdk_tools
+# core_tools
 
 tools/pack200/CommandLineTests.java                             7143279,8059906 generic-all
 
@@ -344,6 +341,8 @@
 
 com/sun/jdi/GetLocalVariables4Test.sh                           8067354 windows-all
 
+com/sun/jdi/sde/SourceDebugExtensionTest.java                   8158066 windows-all
+
 ############################################################################
 
 # jdk_time
@@ -368,7 +367,9 @@
 
 sun/tools/jcmd/TestJcmdSanity.java                              8031482 windows-all
 
-sun/tools/jmap/heapconfig/JMapHeapConfigTest.java               8072131,8132452 generic-all
+sun/tools/jhsdb/BasicLauncherTest.java                          8160376 macosx-all
+
+sun/tools/jhsdb/heapconfig/JMapHeapConfigTest.java              8160376 macosx-all
 
 sun/tools/jstatd/TestJstatdExternalRegistry.java                8046285 generic-all
 
@@ -376,12 +377,8 @@
 
 sun/tools/jps/TestJpsJarRelative.java                           6456333 generic-all
 
-sun/tools/jinfo/JInfoRunningProcessFlagTest.java                6734748 generic-all
-
 sun/jvmstat/monitor/MonitoredVm/MonitorVmStartTerminate.java    8057732 generic-all
 
-sun/tools/jinfo/JInfoSanityTest.java                            8059035 generic-all
-
 demo/jvmti/compiledMethodLoad/CompiledMethodLoadTest.java       8151899 generic-all
 
 ############################################################################
@@ -391,9 +388,3 @@
 com/sun/jndi/ldap/DeadSSLLdapTimeoutTest.java                   8141370 linux-i586,macosx-all
 
 ############################################################################
-
-# core_tools
-
-tools/jlink/JLinkOptimTest.java                                 8159264 generic-all
-
-############################################################################
diff --git a/jdk/test/TEST.groups b/jdk/test/TEST.groups
index 86fb263..be15406 100644
--- a/jdk/test/TEST.groups
+++ b/jdk/test/TEST.groups
@@ -27,7 +27,6 @@
 
 tier1 = \
     :jdk_lang \
-    -java/lang/ProcessBuilder/Zombies.java \
     :jdk_util \
     -java/util/concurrent/ThreadPoolExecutor/ConfigChanges.java \
     -java/util/concurrent/forkjoin/FJExceptionTableLeak.java \
@@ -38,7 +37,6 @@
     tools/pack200
 
 tier2 = \
-    java/lang/ProcessBuilder/Zombies.java \
     java/util/concurrent/ThreadPoolExecutor/ConfigChanges.java \
     java/util/concurrent/forkjoin/FJExceptionTableLeak.java \
     :jdk_io \
diff --git a/jdk/test/com/sun/java/accessibility/util/8051626/Bug8051626.java b/jdk/test/com/sun/java/accessibility/util/8051626/Bug8051626.java
index 4dccef5..4751d55 100644
--- a/jdk/test/com/sun/java/accessibility/util/8051626/Bug8051626.java
+++ b/jdk/test/com/sun/java/accessibility/util/8051626/Bug8051626.java
@@ -23,6 +23,7 @@
 
 /*
  * @test
+ * @key headful
  * @bug 8051626
  * @summary Ensure no failure when using Java Accessibility Utility with security manager
  * @modules java.desktop jdk.accessibility
diff --git a/jdk/test/com/sun/java/swing/plaf/windows/8016551/bug8016551.java b/jdk/test/com/sun/java/swing/plaf/windows/8016551/bug8016551.java
index 23c46ff..94595a1 100644
--- a/jdk/test/com/sun/java/swing/plaf/windows/8016551/bug8016551.java
+++ b/jdk/test/com/sun/java/swing/plaf/windows/8016551/bug8016551.java
@@ -21,7 +21,9 @@
  * questions.
  */
 
-/* @test
+/*
+ * @test
+ * @key headful
  * @bug 8016551
  * @summary JMenuItem in WindowsLookAndFeel can't paint default icons
  * @author Leonid Romanov
diff --git a/jdk/test/java/awt/Checkbox/SetStateExcessEvent/SetStateExcessEvent.java b/jdk/test/java/awt/Checkbox/SetStateExcessEvent/SetStateExcessEvent.java
index f7235be..3a8d65b 100644
--- a/jdk/test/java/awt/Checkbox/SetStateExcessEvent/SetStateExcessEvent.java
+++ b/jdk/test/java/awt/Checkbox/SetStateExcessEvent/SetStateExcessEvent.java
@@ -29,6 +29,7 @@
 
 /**
  * @test
+ * @key headful
  * @bug 8074500
  * @summary Checkbox.setState() call should not post ItemEvent
  * @author Sergey Bylokhov
diff --git a/jdk/test/java/awt/Choice/ChoiceHiDpi/ChoiceTest.java b/jdk/test/java/awt/Choice/ChoiceHiDpi/ChoiceTest.java
new file mode 100644
index 0000000..fd23b47
--- /dev/null
+++ b/jdk/test/java/awt/Choice/ChoiceHiDpi/ChoiceTest.java
@@ -0,0 +1,62 @@
+/*
+ * 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.
+ */
+
+/*
+ * @test
+ * @bug 8144594
+ * @summary HiDPI: awt.Choice looks improperly (Win 8)
+ * @run main ChoiceTest
+ */
+import java.awt.Frame;
+import java.awt.Choice;
+import java.awt.Font;
+import java.util.stream.Stream;
+
+public class ChoiceTest {
+
+    private static void UI() {
+        Frame frame = new Frame("Test frame");
+        Choice choice = new Choice();
+
+        Stream.of(new String[]{"item 1", "item 2", "item 3"}).forEach(choice::add);
+        frame.add(choice);
+        frame.setBounds(100, 100, 400, 200);
+
+        frame.setVisible(true);
+        Font font = choice.getFont();
+        int size = font.getSize();
+        int height = choice.getBounds().height;
+        try {
+            if (height < size) {
+                throw new RuntimeException("Test failed");
+            }
+        } finally {
+            frame.dispose();
+        }
+    }
+
+    public static void main(String[] args) throws Exception {
+        ChoiceTest.UI();
+    }
+}
+
diff --git a/jdk/test/java/awt/Choice/ChoiceLocationTest/ChoiceLocationTest.java b/jdk/test/java/awt/Choice/ChoiceLocationTest/ChoiceLocationTest.java
index c3bc890..78c8318 100644
--- a/jdk/test/java/awt/Choice/ChoiceLocationTest/ChoiceLocationTest.java
+++ b/jdk/test/java/awt/Choice/ChoiceLocationTest/ChoiceLocationTest.java
@@ -22,13 +22,14 @@
  */
 
 /*
- @test
-  @bug 7159566
-  @summary The choice positioned in the top of applet when clicking the choice.
-  @author Petr Pchelko
-  @library ../../regtesthelpers
-  @build Util
-  @run main ChoiceLocationTest
+ * @test
+ * @key headful
+ * @bug 7159566
+ * @summary The choice positioned in the top of applet when clicking the choice.
+ * @author Petr Pchelko
+ * @library ../../regtesthelpers
+ * @build Util
+ * @run main ChoiceLocationTest
  */
 
 import java.awt.*;
diff --git a/jdk/test/java/awt/Choice/DragMouseOutAndRelease/DragMouseOutAndRelease.java b/jdk/test/java/awt/Choice/DragMouseOutAndRelease/DragMouseOutAndRelease.java
index 272b30d..1909392 100644
--- a/jdk/test/java/awt/Choice/DragMouseOutAndRelease/DragMouseOutAndRelease.java
+++ b/jdk/test/java/awt/Choice/DragMouseOutAndRelease/DragMouseOutAndRelease.java
@@ -22,6 +22,7 @@
  */
 /*
   @test
+  @key headful
   @bug 6322625
   @summary REG:Choice does not trigger MouseReleased when dragging and releasing the mouse outside choice, XAWT
   @author andrei.dmitriev area=awt.choice
diff --git a/jdk/test/java/awt/Choice/GetSizeTest/GetSizeTest.java b/jdk/test/java/awt/Choice/GetSizeTest/GetSizeTest.java
index 58376333..54bb22c 100644
--- a/jdk/test/java/awt/Choice/GetSizeTest/GetSizeTest.java
+++ b/jdk/test/java/awt/Choice/GetSizeTest/GetSizeTest.java
@@ -22,6 +22,7 @@
  */
 /*
   @test
+  @key headful
   @bug 4255631
   @summary Solaris: Size returned by Choice.getSize() does not match actual size
   @author Andrei Dmitriev : area=Choice
diff --git a/jdk/test/java/awt/Choice/ResizeAutoClosesChoice/ResizeAutoClosesChoice.java b/jdk/test/java/awt/Choice/ResizeAutoClosesChoice/ResizeAutoClosesChoice.java
index 26e05aa..5e6ca75 100644
--- a/jdk/test/java/awt/Choice/ResizeAutoClosesChoice/ResizeAutoClosesChoice.java
+++ b/jdk/test/java/awt/Choice/ResizeAutoClosesChoice/ResizeAutoClosesChoice.java
@@ -22,6 +22,7 @@
  */
 /*
   @test
+  @key headful
   @bug 6399679
   @summary Choice is not invalidated when the frame gets resized programmatically when the drop-down is visible
   @author andrei.dmitriev area=awt.choice
diff --git a/jdk/test/java/awt/Choice/UnfocusableCB_ERR/UnfocusableCB_ERR.java b/jdk/test/java/awt/Choice/UnfocusableCB_ERR/UnfocusableCB_ERR.java
index 322e358..be08741 100644
--- a/jdk/test/java/awt/Choice/UnfocusableCB_ERR/UnfocusableCB_ERR.java
+++ b/jdk/test/java/awt/Choice/UnfocusableCB_ERR/UnfocusableCB_ERR.java
@@ -22,6 +22,7 @@
  */
 /*
   @test
+  @key headful
   @bug 6390103
   @summary Non-Focusable choice throws exception when selecting an item, Win32
   @author andrei.dmitriev area=awt.choice
diff --git a/jdk/test/java/awt/Choice/UnfocusableToplevel/UnfocusableToplevel.java b/jdk/test/java/awt/Choice/UnfocusableToplevel/UnfocusableToplevel.java
index bdde570..17587f9 100644
--- a/jdk/test/java/awt/Choice/UnfocusableToplevel/UnfocusableToplevel.java
+++ b/jdk/test/java/awt/Choice/UnfocusableToplevel/UnfocusableToplevel.java
@@ -23,6 +23,7 @@
 
 /*
   @test
+  @key headful
   @bug 6566434 8039467
   @library ../../regtesthelpers
   @build Util Sysout AbstractTest
diff --git a/jdk/test/java/awt/Component/DimensionEncapsulation/DimensionEncapsulation.java b/jdk/test/java/awt/Component/DimensionEncapsulation/DimensionEncapsulation.java
index c84486c..3e4ecd6 100644
--- a/jdk/test/java/awt/Component/DimensionEncapsulation/DimensionEncapsulation.java
+++ b/jdk/test/java/awt/Component/DimensionEncapsulation/DimensionEncapsulation.java
@@ -90,6 +90,7 @@
 
 /**
  * @test
+ * @key headful
  * @bug 6459798
  * @author Sergey Bylokhov
  */
diff --git a/jdk/test/java/awt/Component/GetScreenLocTest/GetScreenLocTest.java b/jdk/test/java/awt/Component/GetScreenLocTest/GetScreenLocTest.java
index 36f44c7..6fb2d9f 100644
--- a/jdk/test/java/awt/Component/GetScreenLocTest/GetScreenLocTest.java
+++ b/jdk/test/java/awt/Component/GetScreenLocTest/GetScreenLocTest.java
@@ -38,6 +38,7 @@
 
 /**
  * @test
+ * @key headful
  * @bug 4356202
  * @summary Tests that getLocationOnScreen returns valid value(WindowMaker
  *          only).
diff --git a/jdk/test/java/awt/Component/InsetsEncapsulation/InsetsEncapsulation.java b/jdk/test/java/awt/Component/InsetsEncapsulation/InsetsEncapsulation.java
index 846051c..cc99318 100644
--- a/jdk/test/java/awt/Component/InsetsEncapsulation/InsetsEncapsulation.java
+++ b/jdk/test/java/awt/Component/InsetsEncapsulation/InsetsEncapsulation.java
@@ -74,6 +74,7 @@
 
 /**
  * @test
+ * @key headful
  * @bug 6459800
  * @author Sergey Bylokhov
  */
diff --git a/jdk/test/java/awt/Component/PaintAll/PaintAll.java b/jdk/test/java/awt/Component/PaintAll/PaintAll.java
index 483f1a5..21b76a8 100644
--- a/jdk/test/java/awt/Component/PaintAll/PaintAll.java
+++ b/jdk/test/java/awt/Component/PaintAll/PaintAll.java
@@ -43,6 +43,7 @@
 
 /*
   @test
+  @key headful
   @bug 6596915
   @summary Test Component.paintAll() method
   @author sergey.bylokhov@oracle.com: area=awt.component
diff --git a/jdk/test/java/awt/Component/Revalidate/Revalidate.java b/jdk/test/java/awt/Component/Revalidate/Revalidate.java
index 386e539..211a2a8 100644
--- a/jdk/test/java/awt/Component/Revalidate/Revalidate.java
+++ b/jdk/test/java/awt/Component/Revalidate/Revalidate.java
@@ -23,6 +23,7 @@
 
 /*
   @test
+  @key headful
   @bug 7036669
   @summary Test Component.revalidate() method
   @author anthony.petrov@oracle.com: area=awt.component
diff --git a/jdk/test/java/awt/Component/SetEnabledPerformance/SetEnabledPerformance.java b/jdk/test/java/awt/Component/SetEnabledPerformance/SetEnabledPerformance.java
index a597e85..f44b18a 100644
--- a/jdk/test/java/awt/Component/SetEnabledPerformance/SetEnabledPerformance.java
+++ b/jdk/test/java/awt/Component/SetEnabledPerformance/SetEnabledPerformance.java
@@ -31,6 +31,7 @@
 
 /**
  * @test
+ * @key headful
  * @bug 8071306
  * @author Sergey Bylokhov
  */
diff --git a/jdk/test/java/awt/Container/CheckZOrderChange/CheckZOrderChange.java b/jdk/test/java/awt/Container/CheckZOrderChange/CheckZOrderChange.java
index fa888ec..334191f 100644
--- a/jdk/test/java/awt/Container/CheckZOrderChange/CheckZOrderChange.java
+++ b/jdk/test/java/awt/Container/CheckZOrderChange/CheckZOrderChange.java
@@ -22,12 +22,14 @@
  */
 
 /*
-   @test %I% %E%
-   @bug 2161766
-   @summary Component is missing after changing the z-order of the component & focus is not transfered in
-   @author  Andrei Dmitriev : area=awt.container
-   @run main CheckZOrderChange
-*/
+ * @test %I% %E%
+ * @key headful
+ * @bug 2161766
+ * @summary Component is missing after changing the z-order of the component & focus is not transfered in
+ * @author  Andrei Dmitriev : area=awt.container
+ * @run main CheckZOrderChange
+ */
+
 import java.awt.*;
 import java.awt.event.*;
 
diff --git a/jdk/test/java/awt/Container/ValidateRoot/InvalidateMustRespectValidateRoots.java b/jdk/test/java/awt/Container/ValidateRoot/InvalidateMustRespectValidateRoots.java
index 6c03c99..dd43833 100644
--- a/jdk/test/java/awt/Container/ValidateRoot/InvalidateMustRespectValidateRoots.java
+++ b/jdk/test/java/awt/Container/ValidateRoot/InvalidateMustRespectValidateRoots.java
@@ -23,6 +23,7 @@
 
 /*
   @test
+  @key headful
   @bug 6852592
   @summary invalidate() must stop when it encounters a validate root
   @author anthony.petrov@sun.com
diff --git a/jdk/test/java/awt/Desktop/DesktopGtkLoadTest/DesktopGtkLoadTest.java b/jdk/test/java/awt/Desktop/DesktopGtkLoadTest/DesktopGtkLoadTest.java
new file mode 100644
index 0000000..5769f88
--- /dev/null
+++ b/jdk/test/java/awt/Desktop/DesktopGtkLoadTest/DesktopGtkLoadTest.java
@@ -0,0 +1,66 @@
+/*
+ * 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.
+ */
+
+/* @test
+ * @bug 8157827
+ * @summary AWT_Desktop/Automated/Exceptions/BasicTest loads incorrect GTK
+ * version when jdk.gtk.version=3
+ * @requires (os.family == "linux")
+ * @run main DesktopGtkLoadTest
+ */
+
+
+import java.awt.*;
+import java.io.*;
+
+public class DesktopGtkLoadTest {
+    public static class RunDesktop {
+        public static void main(String[] args) {
+            Desktop.getDesktop();
+        }
+    }
+
+    public static void main(String[] args) throws Exception {
+        Process p = Runtime.getRuntime().exec(System.getProperty("java.home") +
+                "/bin/java -Djdk.gtk.version=3 -Djdk.gtk.verbose=true " +
+                "-cp " + System.getProperty("java.class.path", ".") +
+                " DesktopGtkLoadTest$RunDesktop");
+        p.waitFor();
+        try (BufferedReader br = new BufferedReader(
+                                   new InputStreamReader(p.getErrorStream()))) {
+            String line;
+            while ((line = br.readLine()) != null) {
+                System.out.println(line);
+                if (line.contains("Looking for GTK2 library")) {
+                    break;
+                }
+                if (line.contains("Looking for GTK3 library")) {
+                    return;
+                }
+            }
+            throw new RuntimeException("Wrong GTK library version: \n" + line);
+        }
+
+    }
+
+}
diff --git a/jdk/test/java/awt/Dialog/ChildProperties/ChildDialogProperties.java b/jdk/test/java/awt/Dialog/ChildProperties/ChildDialogProperties.java
index 1a963aa..a17c032 100644
--- a/jdk/test/java/awt/Dialog/ChildProperties/ChildDialogProperties.java
+++ b/jdk/test/java/awt/Dialog/ChildProperties/ChildDialogProperties.java
@@ -21,12 +21,14 @@
  * questions.
  */
 
- /*
- @test
- @bug 8057574
- @summary Verify that child Dialog does not inherit parent's Properties
- @run main ChildDialogProperties
+/*
+ * @test
+ * @key headful
+ * @bug 8057574
+ * @summary Verify that child Dialog does not inherit parent's Properties
+ * @run main ChildDialogProperties
  */
+
 import java.awt.Color;
 import java.awt.Dialog;
 import java.awt.Font;
diff --git a/jdk/test/java/awt/Dialog/MakeWindowAlwaysOnTop/MakeWindowAlwaysOnTop.java b/jdk/test/java/awt/Dialog/MakeWindowAlwaysOnTop/MakeWindowAlwaysOnTop.java
index 3e3e83f..20a9dd5 100644
--- a/jdk/test/java/awt/Dialog/MakeWindowAlwaysOnTop/MakeWindowAlwaysOnTop.java
+++ b/jdk/test/java/awt/Dialog/MakeWindowAlwaysOnTop/MakeWindowAlwaysOnTop.java
@@ -23,6 +23,7 @@
 
 /*
   @test
+  @key headful
   @bug 6829546
   @summary tests that an always-on-top modal dialog doesn't make any windows always-on-top
   @author artem.ananiev: area=awt.modal
diff --git a/jdk/test/java/awt/Dialog/ValidateOnShow/ValidateOnShow.java b/jdk/test/java/awt/Dialog/ValidateOnShow/ValidateOnShow.java
index 9f72f2a..e35877c 100644
--- a/jdk/test/java/awt/Dialog/ValidateOnShow/ValidateOnShow.java
+++ b/jdk/test/java/awt/Dialog/ValidateOnShow/ValidateOnShow.java
@@ -23,6 +23,7 @@
 
 /*
   @test
+  @key headful
   @bug 7027013
   @summary Dialog.show() should validate the window unconditionally
   @author anthony.petrov@oracle.com: area=awt.toplevel
diff --git a/jdk/test/java/awt/EventDispatchThread/LoopRobustness/LoopRobustness.java b/jdk/test/java/awt/EventDispatchThread/LoopRobustness/LoopRobustness.java
index 603f786..86207ff 100644
--- a/jdk/test/java/awt/EventDispatchThread/LoopRobustness/LoopRobustness.java
+++ b/jdk/test/java/awt/EventDispatchThread/LoopRobustness/LoopRobustness.java
@@ -24,7 +24,8 @@
 /**
  *
  * @bug 4023283
- * @summary Checks that an Error which propogate up to the EventDispatch
+ * @key headful
+ * @summary Checks that an Error which propogates up to the EventDispatch
  * loop does not crash AWT.
  * @author Andrei Dmitriev: area=awt.event
  * @library ../../regtesthelpers
diff --git a/jdk/test/java/awt/Focus/6981400/Test1.java b/jdk/test/java/awt/Focus/6981400/Test1.java
index a78c947..730e108 100644
--- a/jdk/test/java/awt/Focus/6981400/Test1.java
+++ b/jdk/test/java/awt/Focus/6981400/Test1.java
@@ -23,6 +23,7 @@
 
 /*
  * @test
+ * @key headful
  * @bug     6981400
  * @summary Tabbing between textfiled do not work properly when ALT+TAB
  * @author  anton.tarasov
diff --git a/jdk/test/java/awt/Focus/6981400/Test2.java b/jdk/test/java/awt/Focus/6981400/Test2.java
index 6afcf6f..acb6157 100644
--- a/jdk/test/java/awt/Focus/6981400/Test2.java
+++ b/jdk/test/java/awt/Focus/6981400/Test2.java
@@ -23,6 +23,7 @@
 
 /*
  * @test
+ * @key headful
  * @bug     6981400
  * @summary Tabbing between textfiled do not work properly when ALT+TAB
  * @author  anton.tarasov
diff --git a/jdk/test/java/awt/Focus/6981400/Test3.java b/jdk/test/java/awt/Focus/6981400/Test3.java
index 2c6d514..b423cc7 100644
--- a/jdk/test/java/awt/Focus/6981400/Test3.java
+++ b/jdk/test/java/awt/Focus/6981400/Test3.java
@@ -23,6 +23,7 @@
 
 /*
  * @test
+ * @key headful
  * @bug     6981400
  * @summary Tabbing between textfiled do not work properly when ALT+TAB
  * @author  anton.tarasov
diff --git a/jdk/test/java/awt/Focus/8013611/JDK8013611.java b/jdk/test/java/awt/Focus/8013611/JDK8013611.java
index 346f235..c8254de 100644
--- a/jdk/test/java/awt/Focus/8013611/JDK8013611.java
+++ b/jdk/test/java/awt/Focus/8013611/JDK8013611.java
@@ -23,6 +23,7 @@
 
 /*
   @test
+  @key headful
   @bug      8013611
   @summary  Tests showing a modal dialog with requesting focus in frame.
   @author   Anton.Tarasov: area=awt.focus
diff --git a/jdk/test/java/awt/Focus/8073453/AWTFocusTransitionTest.java b/jdk/test/java/awt/Focus/8073453/AWTFocusTransitionTest.java
index 7acf7f5..dcfc38d 100644
--- a/jdk/test/java/awt/Focus/8073453/AWTFocusTransitionTest.java
+++ b/jdk/test/java/awt/Focus/8073453/AWTFocusTransitionTest.java
@@ -21,7 +21,9 @@
  * questions.
  */
 
-/* @test
+/*
+ * @test
+ * @key headful
  * @bug 8073453
  * @summary Focus doesn't move when pressing Shift + Tab keys
  * @author Dmitry Markov
diff --git a/jdk/test/java/awt/Focus/8073453/SwingFocusTransitionTest.java b/jdk/test/java/awt/Focus/8073453/SwingFocusTransitionTest.java
index c9947cc..727514e 100644
--- a/jdk/test/java/awt/Focus/8073453/SwingFocusTransitionTest.java
+++ b/jdk/test/java/awt/Focus/8073453/SwingFocusTransitionTest.java
@@ -21,7 +21,9 @@
  * questions.
  */
 
-/* @test
+/*
+ * @test
+ * @key headful
  * @bug 8073453
  * @summary Focus doesn't move when pressing Shift + Tab keys
  * @author Dmitry Markov
diff --git a/jdk/test/java/awt/Focus/ActualFocusedWindowTest/ActualFocusedWindowRetaining.java b/jdk/test/java/awt/Focus/ActualFocusedWindowTest/ActualFocusedWindowRetaining.java
index b760fc7..d693a58 100644
--- a/jdk/test/java/awt/Focus/ActualFocusedWindowTest/ActualFocusedWindowRetaining.java
+++ b/jdk/test/java/awt/Focus/ActualFocusedWindowTest/ActualFocusedWindowRetaining.java
@@ -23,6 +23,7 @@
 
 /*
   @test
+  @key headful
   @bug      4823903
   @summary  Tests actual focused window retaining.
   @author   Anton.Tarasov: area=awt.focus
diff --git a/jdk/test/java/awt/Focus/AutoRequestFocusTest/AutoRequestFocusSetVisibleTest.java b/jdk/test/java/awt/Focus/AutoRequestFocusTest/AutoRequestFocusSetVisibleTest.java
index f4c1c49..1ac1861 100644
--- a/jdk/test/java/awt/Focus/AutoRequestFocusTest/AutoRequestFocusSetVisibleTest.java
+++ b/jdk/test/java/awt/Focus/AutoRequestFocusTest/AutoRequestFocusSetVisibleTest.java
@@ -23,6 +23,7 @@
 
 /*
   @test
+  @key headful
   @bug       6187066
   @summary   Tests the Window.autoRequestFocus property for the Window.setVisible() method.
   @author    anton.tarasov: area=awt.focus
diff --git a/jdk/test/java/awt/Focus/AutoRequestFocusTest/AutoRequestFocusToFrontTest.java b/jdk/test/java/awt/Focus/AutoRequestFocusTest/AutoRequestFocusToFrontTest.java
index f26c0b2..dba872a 100644
--- a/jdk/test/java/awt/Focus/AutoRequestFocusTest/AutoRequestFocusToFrontTest.java
+++ b/jdk/test/java/awt/Focus/AutoRequestFocusTest/AutoRequestFocusToFrontTest.java
@@ -23,6 +23,7 @@
 
 /*
   @test
+  @key headful
   @bug       6187066
   @summary   Tests the Window.autoRequestFocus property for the Window.toFront() method.
   @author    anton.tarasov: area=awt.focus
diff --git a/jdk/test/java/awt/Focus/ClearGlobalFocusOwnerTest/ClearGlobalFocusOwnerTest.java b/jdk/test/java/awt/Focus/ClearGlobalFocusOwnerTest/ClearGlobalFocusOwnerTest.java
index 623f75e..5ff7124 100644
--- a/jdk/test/java/awt/Focus/ClearGlobalFocusOwnerTest/ClearGlobalFocusOwnerTest.java
+++ b/jdk/test/java/awt/Focus/ClearGlobalFocusOwnerTest/ClearGlobalFocusOwnerTest.java
@@ -23,6 +23,7 @@
 
 /*
   @test
+  @key headful
   @bug 4390555
   @summary Synopsis: clearGlobalFocusOwner() is not trigerring permanent FOCUS_LOST event
   @author son@sparc.spb.su, anton.tarasov: area=awt.focus
diff --git a/jdk/test/java/awt/Focus/KeyEventForBadFocusOwnerTest/KeyEventForBadFocusOwnerTest.java b/jdk/test/java/awt/Focus/KeyEventForBadFocusOwnerTest/KeyEventForBadFocusOwnerTest.java
index cfeba58..2813a3f 100644
--- a/jdk/test/java/awt/Focus/KeyEventForBadFocusOwnerTest/KeyEventForBadFocusOwnerTest.java
+++ b/jdk/test/java/awt/Focus/KeyEventForBadFocusOwnerTest/KeyEventForBadFocusOwnerTest.java
@@ -22,6 +22,7 @@
  */
 /*
   @test
+  @key headful
   @bug 4476629
   @library ../../../../javax/swing/regtesthelpers
   @build Util
diff --git a/jdk/test/java/awt/Focus/MouseClickRequestFocusRaceTest/MouseClickRequestFocusRaceTest.java b/jdk/test/java/awt/Focus/MouseClickRequestFocusRaceTest/MouseClickRequestFocusRaceTest.java
index c5abf9c..651030f 100644
--- a/jdk/test/java/awt/Focus/MouseClickRequestFocusRaceTest/MouseClickRequestFocusRaceTest.java
+++ b/jdk/test/java/awt/Focus/MouseClickRequestFocusRaceTest/MouseClickRequestFocusRaceTest.java
@@ -42,6 +42,7 @@
 
 /**
  * @test
+ * @key headful
  * @bug 5028014
  * @summary Focus request & mouse click being performed nearly synchronously
  *          shouldn't break the focus subsystem
diff --git a/jdk/test/java/awt/Focus/RemoveAfterRequest/RemoveAfterRequest.java b/jdk/test/java/awt/Focus/RemoveAfterRequest/RemoveAfterRequest.java
index 1419d97..97ad261 100644
--- a/jdk/test/java/awt/Focus/RemoveAfterRequest/RemoveAfterRequest.java
+++ b/jdk/test/java/awt/Focus/RemoveAfterRequest/RemoveAfterRequest.java
@@ -23,6 +23,7 @@
 
 /*
   @test
+  @key headful
   @bug 6411406
   @summary Components automatically transfer focus on removal, even if developer requests focus elsewhere first
   @author oleg.sukhodolsky, anton.tarasov: area=awt.focus
diff --git a/jdk/test/java/awt/Focus/RollbackFocusFromAnotherWindowTest/RollbackFocusFromAnotherWindowTest.java b/jdk/test/java/awt/Focus/RollbackFocusFromAnotherWindowTest/RollbackFocusFromAnotherWindowTest.java
index 8d94f0d..3a718e0 100644
--- a/jdk/test/java/awt/Focus/RollbackFocusFromAnotherWindowTest/RollbackFocusFromAnotherWindowTest.java
+++ b/jdk/test/java/awt/Focus/RollbackFocusFromAnotherWindowTest/RollbackFocusFromAnotherWindowTest.java
@@ -23,6 +23,7 @@
 
 /*
   @test
+  @key headful
   @bug       8139218
   @summary   Dialog that opens and closes quickly changes focus in original
              focusowner
diff --git a/jdk/test/java/awt/Focus/SimpleWindowActivationTest/SimpleWindowActivationTest.java b/jdk/test/java/awt/Focus/SimpleWindowActivationTest/SimpleWindowActivationTest.java
index fde5797..a63d819 100644
--- a/jdk/test/java/awt/Focus/SimpleWindowActivationTest/SimpleWindowActivationTest.java
+++ b/jdk/test/java/awt/Focus/SimpleWindowActivationTest/SimpleWindowActivationTest.java
@@ -23,6 +23,7 @@
 
 /*
  * @test
+ * @key headful
  * @bug       6385277
  * @summary   Tests that override redirect window gets activated on click.
  * @author    anton.tarasov@sun.com: area=awt.focus
diff --git a/jdk/test/java/awt/Focus/TranserFocusToWindow/TranserFocusToWindow.java b/jdk/test/java/awt/Focus/TranserFocusToWindow/TranserFocusToWindow.java
index bf22528..33ab24e 100644
--- a/jdk/test/java/awt/Focus/TranserFocusToWindow/TranserFocusToWindow.java
+++ b/jdk/test/java/awt/Focus/TranserFocusToWindow/TranserFocusToWindow.java
@@ -23,6 +23,7 @@
 
 /*
   @test
+  @key headful
   @bug 6562853 7035459
   @summary Tests that focus transfered directy to window w/o transfering it to frame.
   @author Oleg Sukhodolsky: area=awt.focus
diff --git a/jdk/test/java/awt/Focus/TypeAhead/TestFocusFreeze.java b/jdk/test/java/awt/Focus/TypeAhead/TestFocusFreeze.java
index 5127d00..64d48d3 100644
--- a/jdk/test/java/awt/Focus/TypeAhead/TestFocusFreeze.java
+++ b/jdk/test/java/awt/Focus/TypeAhead/TestFocusFreeze.java
@@ -22,14 +22,15 @@
  */
 
 /*
-   @test
-   @bug        6183877 6216005 6225560
-   @library    ../../regtesthelpers
-   @build      Util
-   @summary    Tests that keyboard input doesn't freeze due to type-ahead problems
-   @author     Denis.Mikhalkin, Anton.Tarasov: area=awt.focus
-   @run        main TestFocusFreeze
-*/
+ * @test
+ * @key headful
+ * @bug        6183877 6216005 6225560
+ * @library    ../../regtesthelpers
+ * @build      Util
+ * @summary    Tests that keyboard input doesn't freeze due to type-ahead problems
+ * @author     Denis.Mikhalkin, Anton.Tarasov: area=awt.focus
+ * @run        main TestFocusFreeze
+ */
 
 import java.awt.Component;
 import java.awt.DefaultKeyboardFocusManager;
diff --git a/hotspot/test/compiler/c1/6849574/Test.java b/jdk/test/java/awt/Frame/8158918/SetExtendedState.java
similarity index 62%
copy from hotspot/test/compiler/c1/6849574/Test.java
copy to jdk/test/java/awt/Frame/8158918/SetExtendedState.java
index 7639d03..04aa64c 100644
--- a/hotspot/test/compiler/c1/6849574/Test.java
+++ b/jdk/test/java/awt/Frame/8158918/SetExtendedState.java
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2009, 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
@@ -19,26 +19,30 @@
  * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
  * or visit www.oracle.com if you need additional information or have any
  * questions.
- *
  */
 
-/**
+/*
  * @test
- * @bug 6849574
- * @summary VM crash using NonBlockingHashMap (high_scale_lib)
- *
- * @run main/othervm -XX:+UnlockDiagnosticVMOptions -XX:+VerifyBeforeGC Test
+ * @bug 8158918
+ * @summary setExtendedState(1) for maximized Frame results in state==7
+ * @run main SetExtendedState
  */
+import java.awt.Frame;
 
-import java.util.concurrent.atomic.*;
-
-public class Test extends Thread {
+public class SetExtendedState {
 
     public static void main(String[] args) {
-        AtomicReferenceArray a = new AtomicReferenceArray(10000);
-        for (int i = 0; i < 100000; i++) {
-            a.getAndSet(9999, new Object());
-            if (i > 99990) System.gc();
+        Frame frame = new Frame("frame");
+        frame.setBounds(100, 100, 200, 200);
+        frame.setVisible(true);
+        frame.setExtendedState(Frame.MAXIMIZED_BOTH);
+        frame.setExtendedState(Frame.ICONIFIED);
+        if (frame.getExtendedState() != Frame.ICONIFIED) {
+            frame.dispose();
+            throw new RuntimeException("Test Failed");
         }
+        frame.dispose();
     }
 }
+
+
diff --git a/jdk/test/java/awt/Frame/DecoratedExceptions/DecoratedExceptions.java b/jdk/test/java/awt/Frame/DecoratedExceptions/DecoratedExceptions.java
index 8dca632..27d22c6 100644
--- a/jdk/test/java/awt/Frame/DecoratedExceptions/DecoratedExceptions.java
+++ b/jdk/test/java/awt/Frame/DecoratedExceptions/DecoratedExceptions.java
@@ -25,6 +25,7 @@
 
 /*
  * @test
+ * @key headful
  * @summary An attempt to set non-trivial background, shape, or translucency
  *          to a decorated toplevel should end with an exception.
  * @author Dmitriy Ermashov (dmitriy.ermashov@oracle.com)
diff --git a/jdk/test/java/awt/Frame/DisposeParentGC/DisposeParentGC.java b/jdk/test/java/awt/Frame/DisposeParentGC/DisposeParentGC.java
index 53aa13d..4bdf97a 100644
--- a/jdk/test/java/awt/Frame/DisposeParentGC/DisposeParentGC.java
+++ b/jdk/test/java/awt/Frame/DisposeParentGC/DisposeParentGC.java
@@ -30,6 +30,7 @@
 
 /*
  * @test
+ * @key headful
  * @summary Display a dialog with a parent, the dialog contains all awt components
  *          added to it & each components are setted with different cursors types.
  *          Dispose the parent & collect GC. Garbage collection should happen
diff --git a/jdk/test/java/awt/Frame/FramesGC/FramesGC.java b/jdk/test/java/awt/Frame/FramesGC/FramesGC.java
index 5620717..9d8e3d9 100644
--- a/jdk/test/java/awt/Frame/FramesGC/FramesGC.java
+++ b/jdk/test/java/awt/Frame/FramesGC/FramesGC.java
@@ -30,6 +30,7 @@
 
 /*
  * @test
+ * @key headful
  * @summary Verify that disposed frames are collected with GC
  * @author Dmitriy Ermashov (dmitriy.ermashov@oracle.com)
  * @library ../../../../lib/testlibrary
diff --git a/jdk/test/java/awt/Frame/MiscUndecorated/ActiveAWTWindowTest.java b/jdk/test/java/awt/Frame/MiscUndecorated/ActiveAWTWindowTest.java
index 39e3c35..39ee540 100644
--- a/jdk/test/java/awt/Frame/MiscUndecorated/ActiveAWTWindowTest.java
+++ b/jdk/test/java/awt/Frame/MiscUndecorated/ActiveAWTWindowTest.java
@@ -22,14 +22,15 @@
  */
 
 /*
-* @test
-* @summary To check proper WINDOW_EVENTS are triggered when Frame gains or losses the focus
-* @author Jitender(jitender.singh@eng.sun.com) area=AWT
-* @author yan
-* @library ../../../../lib/testlibrary
-* @build ExtendedRobot
-* @run main ActiveAWTWindowTest
-*/
+ * @test
+ * @key headful
+ * @summary To check proper WINDOW_EVENTS are triggered when Frame gains or losses the focus
+ * @author Jitender(jitender.singh@eng.sun.com) area=AWT
+ * @author yan
+ * @library ../../../../lib/testlibrary
+ * @build ExtendedRobot
+ * @run main ActiveAWTWindowTest
+ */
 
 import java.awt.*;
 import java.awt.event.*;
diff --git a/jdk/test/java/awt/Frame/MiscUndecorated/ActiveSwingWindowTest.java b/jdk/test/java/awt/Frame/MiscUndecorated/ActiveSwingWindowTest.java
index 24b3ab6..6513a98 100644
--- a/jdk/test/java/awt/Frame/MiscUndecorated/ActiveSwingWindowTest.java
+++ b/jdk/test/java/awt/Frame/MiscUndecorated/ActiveSwingWindowTest.java
@@ -22,14 +22,15 @@
  */
 
 /*
-* @test
-* @summary To check proper WINDOW_EVENTS are triggered when JFrame gains or losses the focus
-* @author Jitender(jitender.singh@eng.sun.com) area=AWT
-* @author yan
-* @library ../../../../lib/testlibrary
-* @build ExtendedRobot
-* @run main ActiveSwingWindowTest
-*/
+ * @test
+ * @key headful
+ * @summary To check proper WINDOW_EVENTS are triggered when JFrame gains or losses the focus
+ * @author Jitender(jitender.singh@eng.sun.com) area=AWT
+ * @author yan
+ * @library ../../../../lib/testlibrary
+ * @build ExtendedRobot
+ * @run main ActiveSwingWindowTest
+ */
 
 import java.awt.*;
 import java.awt.event.*;
diff --git a/jdk/test/java/awt/Frame/MiscUndecorated/FrameCloseTest.java b/jdk/test/java/awt/Frame/MiscUndecorated/FrameCloseTest.java
index 105285b..8a43f65 100644
--- a/jdk/test/java/awt/Frame/MiscUndecorated/FrameCloseTest.java
+++ b/jdk/test/java/awt/Frame/MiscUndecorated/FrameCloseTest.java
@@ -22,14 +22,15 @@
  */
 
 /*
-* @test
-* @summary To make sure Undecorated Frame triggers correct windows events while closing
-* @author Jitender(jitender.singh@eng.sun.com) area=AWT*
-* @author yan
-* @library ../../../../lib/testlibrary
-* @build ExtendedRobot
-* @run main FrameCloseTest
-*/
+ * @test
+ * @key headful
+ * @summary To make sure Undecorated Frame triggers correct windows events while closing
+ * @author Jitender(jitender.singh@eng.sun.com) area=AWT*
+ * @author yan
+ * @library ../../../../lib/testlibrary
+ * @build ExtendedRobot
+ * @run main FrameCloseTest
+ */
 
 import java.awt.*;
 import java.awt.event.*;
diff --git a/jdk/test/java/awt/Frame/MiscUndecorated/RepaintTest.java b/jdk/test/java/awt/Frame/MiscUndecorated/RepaintTest.java
index 3e982fa..50e0902 100644
--- a/jdk/test/java/awt/Frame/MiscUndecorated/RepaintTest.java
+++ b/jdk/test/java/awt/Frame/MiscUndecorated/RepaintTest.java
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1999, 2014, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1999, 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
@@ -20,16 +20,18 @@
  * or visit www.oracle.com if you need additional information or have any
  * questions.
  */
+
 /*
-* @test
-* @summary Make sure that on changing state of Undecorated Frame,
-*          all the components on it are repainted correctly
-* @author Jitender(jitender.singh@eng.sun.com) area=AWT
-* @author yan
-* @library ../../../../lib/testlibrary
-* @build ExtendedRobot
-* @run main RepaintTest
-*/
+ * @test
+ * @key headful
+ * @summary Make sure that on changing state of Undecorated Frame,
+ *          all the components on it are repainted correctly
+ * @author Jitender(jitender.singh@eng.sun.com) area=AWT
+ * @author yan
+ * @library ../../../../lib/testlibrary
+ * @build ExtendedRobot
+ * @run main RepaintTest
+ */
 
 import java.awt.*;
 import java.awt.event.*;
diff --git a/jdk/test/java/awt/Frame/ShapeNotSetSometimes/ShapeNotSetSometimes.java b/jdk/test/java/awt/Frame/ShapeNotSetSometimes/ShapeNotSetSometimes.java
index af9c361..efc80d4 100644
--- a/jdk/test/java/awt/Frame/ShapeNotSetSometimes/ShapeNotSetSometimes.java
+++ b/jdk/test/java/awt/Frame/ShapeNotSetSometimes/ShapeNotSetSometimes.java
@@ -23,6 +23,7 @@
 
 /*
   @test
+  @key headful
   @bug 6988428
   @summary Tests whether shape is always set
   @author anthony.petrov@oracle.com: area=awt.toplevel
diff --git a/jdk/test/java/awt/FullScreen/TranslucentWindow/TranslucentWindow.java b/jdk/test/java/awt/FullScreen/TranslucentWindow/TranslucentWindow.java
index 35ab7dc..b5b9577 100644
--- a/jdk/test/java/awt/FullScreen/TranslucentWindow/TranslucentWindow.java
+++ b/jdk/test/java/awt/FullScreen/TranslucentWindow/TranslucentWindow.java
@@ -23,6 +23,7 @@
 
 /*
  * @test
+ * @key headful
  * @bug 6837004
  * @summary Checks that non-opaque window can be made a fullscreen window
  * @author Artem Ananiev
diff --git a/jdk/test/java/awt/Graphics2D/WhiteTextColorTest.java b/jdk/test/java/awt/Graphics2D/WhiteTextColorTest.java
index 8c2ddf4..9801d9a 100644
--- a/jdk/test/java/awt/Graphics2D/WhiteTextColorTest.java
+++ b/jdk/test/java/awt/Graphics2D/WhiteTextColorTest.java
@@ -27,11 +27,13 @@
 
 /**
  * @test
+ * @key headful
  * @bug 8056009
  * @summary tests whether Graphics.setColor-calls with Color.white are ignored directly
  *          after pipeline initialization for a certain set of operations.
  * @author ceisserer
  */
+
 public class WhiteTextColorTest extends Frame {
     public static volatile boolean success = false;
 
diff --git a/jdk/test/java/awt/GridLayout/ChangeGridSize/ChangeGridSize.java b/jdk/test/java/awt/GridLayout/ChangeGridSize/ChangeGridSize.java
index 86f7a7a..f2869ea 100644
--- a/jdk/test/java/awt/GridLayout/ChangeGridSize/ChangeGridSize.java
+++ b/jdk/test/java/awt/GridLayout/ChangeGridSize/ChangeGridSize.java
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2006, 2014, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2006, 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,6 +26,7 @@
 
 /*
  * @test
+ * @key headful
  * @summary Have different components having different preferred sizes
  *          added to a grid layout. Change the rows and columns of the
  *          grid layout and check the components are re-laid out.
@@ -33,14 +34,13 @@
  *          depending on the preferred sizes and gaps and click the cornors
  *          of the components to check if events are triggered
  * @library ../../../../lib/testlibrary/
- * @build ExtendedRobot
  * @run main ChangeGridSize
  * @run main ChangeGridSize -hg 20 -vg 20
  */
 
 public class ChangeGridSize {
 
-    private int width = 200;
+    private int width = 300;
     private int height = 200;
     private final int hGap, vGap;
     private final int rows = 3;
@@ -50,7 +50,7 @@
     private Button[] buttons;
     private Frame frame;
 
-    private ExtendedRobot robot;
+    private Robot robot;
     private GridLayout layout;
 
     private volatile boolean actionPerformed = false;
@@ -58,7 +58,7 @@
     public ChangeGridSize(int hGap, int vGap) throws Exception  {
         this.hGap = hGap;
         this.vGap = vGap;
-        robot = new ExtendedRobot();
+        robot = new Robot();
         EventQueue.invokeAndWait( () -> {
             frame = new Frame("Test frame");
             frame.setSize(width, height);
@@ -122,10 +122,12 @@
         robot.mousePress(InputEvent.BUTTON1_DOWN_MASK);
         robot.delay(500);
         robot.mouseRelease(InputEvent.BUTTON1_DOWN_MASK);
-        robot.waitForIdle(3000);
+        robot.delay(3000);
 
-        if(!actionPerformed)
+        if (!actionPerformed) {
+            frame.dispose();
             throw new RuntimeException("Clicking on the left top of button did not trigger action event");
+        }
 
         actionPerformed = false;
         robot.mouseMove(bottomRightX, bottomRightY);
@@ -133,10 +135,12 @@
         robot.mousePress(InputEvent.BUTTON1_DOWN_MASK);
         robot.delay(500);
         robot.mouseRelease(InputEvent.BUTTON1_DOWN_MASK);
-        robot.waitForIdle(3000);
+        robot.delay(3000);
 
-        if(!actionPerformed)
+        if (!actionPerformed) {
+            frame.dispose();
             throw new RuntimeException("Clicking on the bottom right of button did not trigger action event");
+        }
     }
 
     private void doTest() throws Exception {
@@ -154,6 +158,7 @@
         for (int i = 0; i < buttons.length; i++) {
             if (buttons[i].getSize().width != componentWidth ||
                     buttons[i].getSize().height != componentHeight) {
+                frame.dispose();
                 throw new RuntimeException(
                         "FAIL: Button " + i + " not of proper size" +
                         "Expected: " + componentWidth + "*" + componentHeight +
diff --git a/jdk/test/java/awt/GridLayout/ComponentPreferredSize/ComponentPreferredSize.java b/jdk/test/java/awt/GridLayout/ComponentPreferredSize/ComponentPreferredSize.java
index d8ceac7..3e60c26 100644
--- a/jdk/test/java/awt/GridLayout/ComponentPreferredSize/ComponentPreferredSize.java
+++ b/jdk/test/java/awt/GridLayout/ComponentPreferredSize/ComponentPreferredSize.java
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2006, 2014, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2006, 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,6 +26,7 @@
 
 /*
  * @test
+ * @key headful
  * @summary Have different components having different preferred sizes
  *          added to a grid layout having various values of row/columns.
  *          Check if the compnents are correctly laid out.
@@ -33,14 +34,13 @@
  *          depending on the preferred sizes and gaps and click the cornors
  *          of the components to check if events are triggered
  * @library ../../../../lib/testlibrary/
- * @build ExtendedRobot
  * @run main ComponentPreferredSize
  * @run main ComponentPreferredSize -hg 20 -vg 20
  */
 
 public class ComponentPreferredSize {
 
-    private int width = 200;
+    private int width = 300;
     private int height = 200;
     private final int hGap, vGap;
     private final int rows = 3;
@@ -50,7 +50,7 @@
     private Button[] buttons;
     private Frame frame;
 
-    private ExtendedRobot robot;
+    private Robot robot;
     private GridLayout layout;
 
     private volatile boolean actionPerformed = false;
@@ -58,7 +58,7 @@
     public ComponentPreferredSize(int hGap, int vGap) throws Exception {
         this.hGap = hGap;
         this.vGap = vGap;
-        robot = new ExtendedRobot();
+        robot = new Robot();
         EventQueue.invokeAndWait( () -> {
             frame = new Frame("Test frame");
             frame.setSize(width, height);
@@ -115,10 +115,12 @@
         robot.mousePress(InputEvent.BUTTON1_DOWN_MASK);
         robot.delay(500);
         robot.mouseRelease(InputEvent.BUTTON1_DOWN_MASK);
-        robot.waitForIdle(3000);
+        robot.delay(3000);
 
-        if(!actionPerformed)
+        if (!actionPerformed) {
+            frame.dispose();
             throw new RuntimeException("Clicking on the left top of button did not trigger action event");
+        }
 
         actionPerformed = false;
         robot.mouseMove(bottomRightX, bottomRightY);
@@ -126,10 +128,12 @@
         robot.mousePress(InputEvent.BUTTON1_DOWN_MASK);
         robot.delay(500);
         robot.mouseRelease(InputEvent.BUTTON1_DOWN_MASK);
-        robot.waitForIdle(3000);
+        robot.delay(3000);
 
-        if(!actionPerformed)
+        if (!actionPerformed) {
+            frame.dispose();
             throw new RuntimeException("Clicking on the bottom right of button did not trigger action event");
+        }
     }
 
     private void doTest() throws Exception {
@@ -146,6 +150,7 @@
         for (int i = 0; i < buttons.length; i++) {
             if (buttons[i].getSize().width != componentWidth ||
                     buttons[i].getSize().height != componentHeight) {
+                frame.dispose();
                 throw new RuntimeException(
                         "FAIL: Button " + i + " not of proper size" +
                         "Expected: " + componentWidth + "*" + componentHeight +
diff --git a/jdk/test/java/awt/LightweightComponent/LightweightEventTest/LightweightEventTest.java b/jdk/test/java/awt/LightweightComponent/LightweightEventTest/LightweightEventTest.java
index 4c729282..7f1ddeb 100644
--- a/jdk/test/java/awt/LightweightComponent/LightweightEventTest/LightweightEventTest.java
+++ b/jdk/test/java/awt/LightweightComponent/LightweightEventTest/LightweightEventTest.java
@@ -23,6 +23,7 @@
 
 /**
  * @test
+ * @key headful
  * @summary Test of mouse move messages to lightweight components
  * @library ../../regtesthelpers
  * @build Util
diff --git a/jdk/test/java/awt/LightweightDispatcher/LWDispatcherMemoryLeakTest.java b/jdk/test/java/awt/LightweightDispatcher/LWDispatcherMemoryLeakTest.java
index 706ae38..22a6812 100644
--- a/jdk/test/java/awt/LightweightDispatcher/LWDispatcherMemoryLeakTest.java
+++ b/jdk/test/java/awt/LightweightDispatcher/LWDispatcherMemoryLeakTest.java
@@ -38,6 +38,7 @@
 
 /*
  @test
+ @key headful
  @bug 7079254
  @summary Toolkit eventListener leaks memory
  @library ../regtesthelpers
diff --git a/jdk/test/java/awt/List/EmptyListEventTest/EmptyListEventTest.java b/jdk/test/java/awt/List/EmptyListEventTest/EmptyListEventTest.java
index 81f5378..baa7df9 100644
--- a/jdk/test/java/awt/List/EmptyListEventTest/EmptyListEventTest.java
+++ b/jdk/test/java/awt/List/EmptyListEventTest/EmptyListEventTest.java
@@ -23,6 +23,7 @@
 
 /*
  * @test
+ * @key headful
  * @bug 6366126
  * @summary List throws ArrayIndexOutOfBoundsException when pressing ENTER after removing all the items, Win32
  * @author Dmitry Cherepanov area=awt.list
diff --git a/jdk/test/java/awt/List/NofocusListDblClickTest/NofocusListDblClickTest.java b/jdk/test/java/awt/List/NofocusListDblClickTest/NofocusListDblClickTest.java
index 02448b2..298e662 100644
--- a/jdk/test/java/awt/List/NofocusListDblClickTest/NofocusListDblClickTest.java
+++ b/jdk/test/java/awt/List/NofocusListDblClickTest/NofocusListDblClickTest.java
@@ -22,6 +22,7 @@
  */
 /*
   @test
+  @key headful
   @bug       6240202
   @summary   Tests that non-focusable List in a Window generates ActionEvent.
   @author    anton.tarasov@sun.com: area=awt-list
diff --git a/jdk/test/java/awt/MenuBar/MenuBarSetFont/MenuBarSetFont.java b/jdk/test/java/awt/MenuBar/MenuBarSetFont/MenuBarSetFont.java
index 9199c7a..1ae8eb4 100644
--- a/jdk/test/java/awt/MenuBar/MenuBarSetFont/MenuBarSetFont.java
+++ b/jdk/test/java/awt/MenuBar/MenuBarSetFont/MenuBarSetFont.java
@@ -37,6 +37,7 @@
 
 /**
  * @test
+ * @key headful
  * @bug 6263470
  * @summary Tries to change font of MenuBar. Test passes if the font has changed
  * fails otherwise.
diff --git a/jdk/test/java/awt/Modal/FileDialog/FileDialogAppModal1Test.java b/jdk/test/java/awt/Modal/FileDialog/FileDialogAppModal1Test.java
index d2a21a9..e37d749 100644
--- a/jdk/test/java/awt/Modal/FileDialog/FileDialogAppModal1Test.java
+++ b/jdk/test/java/awt/Modal/FileDialog/FileDialogAppModal1Test.java
@@ -25,6 +25,7 @@
 
 /*
  * @test
+ * @key headful
  * @bug 8054359 7186009
  *
  * @summary Check whether FileDialog blocks an application modal Dialog
diff --git a/jdk/test/java/awt/Modal/FileDialog/FileDialogAppModal2Test.java b/jdk/test/java/awt/Modal/FileDialog/FileDialogAppModal2Test.java
index e9d2b15..c1ff3fb 100644
--- a/jdk/test/java/awt/Modal/FileDialog/FileDialogAppModal2Test.java
+++ b/jdk/test/java/awt/Modal/FileDialog/FileDialogAppModal2Test.java
@@ -25,6 +25,7 @@
 
 /*
  * @test
+ * @key headful
  * @bug 8054359 7186009
  *
  * @summary Check whether FileDialog blocks an application modal Dialog
diff --git a/jdk/test/java/awt/Modal/FileDialog/FileDialogAppModal3Test.java b/jdk/test/java/awt/Modal/FileDialog/FileDialogAppModal3Test.java
index adc9709..c20a96f 100644
--- a/jdk/test/java/awt/Modal/FileDialog/FileDialogAppModal3Test.java
+++ b/jdk/test/java/awt/Modal/FileDialog/FileDialogAppModal3Test.java
@@ -25,6 +25,7 @@
 
 /*
  * @test
+ * @key headful
  * @bug 8054359 7186009
  *
  * @summary Check whether FileDialog blocks an application modal Dialog
diff --git a/jdk/test/java/awt/Modal/FileDialog/FileDialogAppModal4Test.java b/jdk/test/java/awt/Modal/FileDialog/FileDialogAppModal4Test.java
index 9dc6149..eec804b 100644
--- a/jdk/test/java/awt/Modal/FileDialog/FileDialogAppModal4Test.java
+++ b/jdk/test/java/awt/Modal/FileDialog/FileDialogAppModal4Test.java
@@ -25,6 +25,7 @@
 
 /*
  * @test
+ * @key headful
  * @bug 8054359 7186009
  *
  * @summary Check whether FileDialog blocks an application modal Dialog
diff --git a/jdk/test/java/awt/Modal/FileDialog/FileDialogAppModal5Test.java b/jdk/test/java/awt/Modal/FileDialog/FileDialogAppModal5Test.java
index 3bb80e3..c7de419 100644
--- a/jdk/test/java/awt/Modal/FileDialog/FileDialogAppModal5Test.java
+++ b/jdk/test/java/awt/Modal/FileDialog/FileDialogAppModal5Test.java
@@ -25,6 +25,7 @@
 
 /*
  * @test
+ * @key headful
  * @bug 8054359 7186009
  *
  * @summary Check whether FileDialog blocks an application modal Dialog
diff --git a/jdk/test/java/awt/Modal/FileDialog/FileDialogAppModal6Test.java b/jdk/test/java/awt/Modal/FileDialog/FileDialogAppModal6Test.java
index 16f03f7..75e0da8 100644
--- a/jdk/test/java/awt/Modal/FileDialog/FileDialogAppModal6Test.java
+++ b/jdk/test/java/awt/Modal/FileDialog/FileDialogAppModal6Test.java
@@ -25,6 +25,7 @@
 
 /*
  * @test
+ * @key headful
  * @bug 8054359 7186009
  *
  * @summary Check whether FileDialog blocks an application modal Dialog
diff --git a/jdk/test/java/awt/Modal/FileDialog/FileDialogDocModal1Test.java b/jdk/test/java/awt/Modal/FileDialog/FileDialogDocModal1Test.java
index 4ff0bce..3816a0c 100644
--- a/jdk/test/java/awt/Modal/FileDialog/FileDialogDocModal1Test.java
+++ b/jdk/test/java/awt/Modal/FileDialog/FileDialogDocModal1Test.java
@@ -25,6 +25,7 @@
 
 /*
  * @test
+ * @key headful
  * @bug 8054359 7186009
  *
  * @summary Check whether FileDialog blocks a document modal Dialog
diff --git a/jdk/test/java/awt/Modal/FileDialog/FileDialogDocModal2Test.java b/jdk/test/java/awt/Modal/FileDialog/FileDialogDocModal2Test.java
index a8179c1..164a68e 100644
--- a/jdk/test/java/awt/Modal/FileDialog/FileDialogDocModal2Test.java
+++ b/jdk/test/java/awt/Modal/FileDialog/FileDialogDocModal2Test.java
@@ -25,6 +25,7 @@
 
 /*
  * @test
+ * @key headful
  * @bug 8054359 7186009
  *
  * @summary Check whether FileDialog blocks a document modal Dialog
diff --git a/jdk/test/java/awt/Modal/FileDialog/FileDialogDocModal3Test.java b/jdk/test/java/awt/Modal/FileDialog/FileDialogDocModal3Test.java
index 5b95dbc..c63c735 100644
--- a/jdk/test/java/awt/Modal/FileDialog/FileDialogDocModal3Test.java
+++ b/jdk/test/java/awt/Modal/FileDialog/FileDialogDocModal3Test.java
@@ -25,6 +25,7 @@
 
 /*
  * @test
+ * @key headful
  * @bug 8054359 7186009
  *
  * @summary Check whether FileDialog blocks a document modal Dialog
diff --git a/jdk/test/java/awt/Modal/FileDialog/FileDialogDocModal4Test.java b/jdk/test/java/awt/Modal/FileDialog/FileDialogDocModal4Test.java
index 0c5de04..6fe1b77 100644
--- a/jdk/test/java/awt/Modal/FileDialog/FileDialogDocModal4Test.java
+++ b/jdk/test/java/awt/Modal/FileDialog/FileDialogDocModal4Test.java
@@ -25,6 +25,7 @@
 
 /*
  * @test
+ * @key headful
  * @bug 8054359 7186009
  *
  * @summary Check whether FileDialog blocks a document modal Dialog
diff --git a/jdk/test/java/awt/Modal/FileDialog/FileDialogDocModal5Test.java b/jdk/test/java/awt/Modal/FileDialog/FileDialogDocModal5Test.java
index e27c97c..c42766c 100644
--- a/jdk/test/java/awt/Modal/FileDialog/FileDialogDocModal5Test.java
+++ b/jdk/test/java/awt/Modal/FileDialog/FileDialogDocModal5Test.java
@@ -25,6 +25,7 @@
 
 /*
  * @test
+ * @key headful
  * @bug 8054359 7186009
  *
  * @summary Check whether FileDialog blocks a document modal Dialog
diff --git a/jdk/test/java/awt/Modal/FileDialog/FileDialogDocModal6Test.java b/jdk/test/java/awt/Modal/FileDialog/FileDialogDocModal6Test.java
index 9aa2f2a..6ce9d72 100644
--- a/jdk/test/java/awt/Modal/FileDialog/FileDialogDocModal6Test.java
+++ b/jdk/test/java/awt/Modal/FileDialog/FileDialogDocModal6Test.java
@@ -25,6 +25,7 @@
 
 /*
  * @test
+ * @key headful
  * @bug 8054359 7186009
  *
  * @summary Check whether FileDialog blocks a document modal Dialog
diff --git a/jdk/test/java/awt/Modal/FileDialog/FileDialogDocModal7Test.java b/jdk/test/java/awt/Modal/FileDialog/FileDialogDocModal7Test.java
index d3c0a68..471de5b 100644
--- a/jdk/test/java/awt/Modal/FileDialog/FileDialogDocModal7Test.java
+++ b/jdk/test/java/awt/Modal/FileDialog/FileDialogDocModal7Test.java
@@ -25,6 +25,7 @@
 
 /*
  * @test
+ * @key headful
  * @bug 8054359 7186009
  * @summary Check whether a FileDialog set to document modality behaves as expected.
  *
diff --git a/jdk/test/java/awt/Modal/FileDialog/FileDialogModal1Test.java b/jdk/test/java/awt/Modal/FileDialog/FileDialogModal1Test.java
index f9cae23..dc0004f 100644
--- a/jdk/test/java/awt/Modal/FileDialog/FileDialogModal1Test.java
+++ b/jdk/test/java/awt/Modal/FileDialog/FileDialogModal1Test.java
@@ -24,6 +24,7 @@
 
 /*
  * @test
+ * @key headful
  * @bug 8054359 7186009
  *
  * @summary Check whether FileDialog blocks a modal Dialog
diff --git a/jdk/test/java/awt/Modal/FileDialog/FileDialogModal2Test.java b/jdk/test/java/awt/Modal/FileDialog/FileDialogModal2Test.java
index 037f596..ef43a93 100644
--- a/jdk/test/java/awt/Modal/FileDialog/FileDialogModal2Test.java
+++ b/jdk/test/java/awt/Modal/FileDialog/FileDialogModal2Test.java
@@ -24,6 +24,7 @@
 
 /*
  * @test
+ * @key headful
  * @bug 8054359 7186009
  *
  * @summary Check whether FileDialog blocks a modal Dialog
diff --git a/jdk/test/java/awt/Modal/FileDialog/FileDialogModal3Test.java b/jdk/test/java/awt/Modal/FileDialog/FileDialogModal3Test.java
index b2423e3..ba80f71 100644
--- a/jdk/test/java/awt/Modal/FileDialog/FileDialogModal3Test.java
+++ b/jdk/test/java/awt/Modal/FileDialog/FileDialogModal3Test.java
@@ -24,6 +24,7 @@
 
 /*
  * @test
+ * @key headful
  * @bug 8054359 7186009
  *
  * @summary Check whether FileDialog blocks a modal Dialog
diff --git a/jdk/test/java/awt/Modal/FileDialog/FileDialogModal4Test.java b/jdk/test/java/awt/Modal/FileDialog/FileDialogModal4Test.java
index 0899eb3..be47237 100644
--- a/jdk/test/java/awt/Modal/FileDialog/FileDialogModal4Test.java
+++ b/jdk/test/java/awt/Modal/FileDialog/FileDialogModal4Test.java
@@ -24,6 +24,7 @@
 
 /*
  * @test
+ * @key headful
  * @bug 8054359 7186009
  *
  * @summary Check whether FileDialog blocks a modal Dialog
diff --git a/jdk/test/java/awt/Modal/FileDialog/FileDialogModal5Test.java b/jdk/test/java/awt/Modal/FileDialog/FileDialogModal5Test.java
index d294039..54e78b8 100644
--- a/jdk/test/java/awt/Modal/FileDialog/FileDialogModal5Test.java
+++ b/jdk/test/java/awt/Modal/FileDialog/FileDialogModal5Test.java
@@ -24,6 +24,7 @@
 
 /*
  * @test
+ * @key headful
  * @bug 8054359 7186009
  *
  * @summary Check whether FileDialog blocks a modal Dialog
diff --git a/jdk/test/java/awt/Modal/FileDialog/FileDialogModal6Test.java b/jdk/test/java/awt/Modal/FileDialog/FileDialogModal6Test.java
index 8cbee49..758aed4 100644
--- a/jdk/test/java/awt/Modal/FileDialog/FileDialogModal6Test.java
+++ b/jdk/test/java/awt/Modal/FileDialog/FileDialogModal6Test.java
@@ -24,6 +24,7 @@
 
 /*
  * @test
+ * @key headful
  * @bug 8054359 7186009
  *
  * @summary Check whether FileDialog blocks a modal Dialog
diff --git a/jdk/test/java/awt/Modal/FileDialog/FileDialogNonModal1Test.java b/jdk/test/java/awt/Modal/FileDialog/FileDialogNonModal1Test.java
index b941c09..5ef0f21 100644
--- a/jdk/test/java/awt/Modal/FileDialog/FileDialogNonModal1Test.java
+++ b/jdk/test/java/awt/Modal/FileDialog/FileDialogNonModal1Test.java
@@ -24,6 +24,7 @@
 
 /*
  * @test
+ * @key headful
  * @bug 8054359 7186009
  *
  * @summary Check whether FileDialog blocks a non-modal Dialog
diff --git a/jdk/test/java/awt/Modal/FileDialog/FileDialogNonModal2Test.java b/jdk/test/java/awt/Modal/FileDialog/FileDialogNonModal2Test.java
index a35d39f..11ffa96 100644
--- a/jdk/test/java/awt/Modal/FileDialog/FileDialogNonModal2Test.java
+++ b/jdk/test/java/awt/Modal/FileDialog/FileDialogNonModal2Test.java
@@ -24,6 +24,7 @@
 
 /*
  * @test
+ * @key headful
  * @bug 8054359
  *
  * @summary Check whether FileDialog blocks a non-modal Dialog
diff --git a/jdk/test/java/awt/Modal/FileDialog/FileDialogNonModal3Test.java b/jdk/test/java/awt/Modal/FileDialog/FileDialogNonModal3Test.java
index 83b7a46..0987b6e 100644
--- a/jdk/test/java/awt/Modal/FileDialog/FileDialogNonModal3Test.java
+++ b/jdk/test/java/awt/Modal/FileDialog/FileDialogNonModal3Test.java
@@ -24,6 +24,7 @@
 
 /*
  * @test
+ * @key headful
  * @bug 8054359
  *
  * @summary Check whether FileDialog blocks a non-modal Dialog
diff --git a/jdk/test/java/awt/Modal/FileDialog/FileDialogNonModal4Test.java b/jdk/test/java/awt/Modal/FileDialog/FileDialogNonModal4Test.java
index b7d1641..0a89f8a 100644
--- a/jdk/test/java/awt/Modal/FileDialog/FileDialogNonModal4Test.java
+++ b/jdk/test/java/awt/Modal/FileDialog/FileDialogNonModal4Test.java
@@ -24,6 +24,7 @@
 
 /*
  * @test
+ * @key headful
  * @bug 8054359
  *
  * @summary Check whether FileDialog blocks a non-modal Dialog
diff --git a/jdk/test/java/awt/Modal/FileDialog/FileDialogNonModal5Test.java b/jdk/test/java/awt/Modal/FileDialog/FileDialogNonModal5Test.java
index d2ff38a..c703141 100644
--- a/jdk/test/java/awt/Modal/FileDialog/FileDialogNonModal5Test.java
+++ b/jdk/test/java/awt/Modal/FileDialog/FileDialogNonModal5Test.java
@@ -24,6 +24,7 @@
 
 /*
  * @test
+ * @key headful
  * @bug 8054359
  *
  * @summary Check whether FileDialog blocks a non-modal Dialog
diff --git a/jdk/test/java/awt/Modal/FileDialog/FileDialogNonModal6Test.java b/jdk/test/java/awt/Modal/FileDialog/FileDialogNonModal6Test.java
index 49b5ce0..c75a061 100644
--- a/jdk/test/java/awt/Modal/FileDialog/FileDialogNonModal6Test.java
+++ b/jdk/test/java/awt/Modal/FileDialog/FileDialogNonModal6Test.java
@@ -24,6 +24,7 @@
 
 /*
  * @test
+ * @key headful
  * @bug 8054359
  *
  * @summary Check whether FileDialog blocks a non-modal Dialog
diff --git a/jdk/test/java/awt/Modal/FileDialog/FileDialogNonModal7Test.java b/jdk/test/java/awt/Modal/FileDialog/FileDialogNonModal7Test.java
index 3712112..6fc761a 100644
--- a/jdk/test/java/awt/Modal/FileDialog/FileDialogNonModal7Test.java
+++ b/jdk/test/java/awt/Modal/FileDialog/FileDialogNonModal7Test.java
@@ -25,6 +25,7 @@
 
 /*
  * @test
+ * @key headful
  * @bug 8054359
  * @summary Check whether a modeless FileDialog behaves as expected.
  *
diff --git a/jdk/test/java/awt/Modal/FileDialog/FileDialogTKModal1Test.java b/jdk/test/java/awt/Modal/FileDialog/FileDialogTKModal1Test.java
index b9c6e05..5d23dab 100644
--- a/jdk/test/java/awt/Modal/FileDialog/FileDialogTKModal1Test.java
+++ b/jdk/test/java/awt/Modal/FileDialog/FileDialogTKModal1Test.java
@@ -25,6 +25,7 @@
 
 /*
  * @test
+ * @key headful
  * @bug 8054359 8055752
  *
  * @summary Check whether FileDialog blocks a toolkit modal Dialog
diff --git a/jdk/test/java/awt/Modal/FileDialog/FileDialogTKModal2Test.java b/jdk/test/java/awt/Modal/FileDialog/FileDialogTKModal2Test.java
index 36db1d0..ecfe45d 100644
--- a/jdk/test/java/awt/Modal/FileDialog/FileDialogTKModal2Test.java
+++ b/jdk/test/java/awt/Modal/FileDialog/FileDialogTKModal2Test.java
@@ -25,6 +25,7 @@
 
 /*
  * @test
+ * @key headful
  * @bug 8054359 8055752
  *
  * @summary Check whether FileDialog blocks a toolkit modal Dialog
diff --git a/jdk/test/java/awt/Modal/FileDialog/FileDialogTKModal3Test.java b/jdk/test/java/awt/Modal/FileDialog/FileDialogTKModal3Test.java
index 99a177a..87bf1fe 100644
--- a/jdk/test/java/awt/Modal/FileDialog/FileDialogTKModal3Test.java
+++ b/jdk/test/java/awt/Modal/FileDialog/FileDialogTKModal3Test.java
@@ -25,6 +25,7 @@
 
 /*
  * @test
+ * @key headful
  * @bug 8054359 8055752
  *
  * @summary Check whether FileDialog blocks a toolkit modal Dialog
diff --git a/jdk/test/java/awt/Modal/FileDialog/FileDialogTKModal4Test.java b/jdk/test/java/awt/Modal/FileDialog/FileDialogTKModal4Test.java
index abc6cb6..0ee9b04 100644
--- a/jdk/test/java/awt/Modal/FileDialog/FileDialogTKModal4Test.java
+++ b/jdk/test/java/awt/Modal/FileDialog/FileDialogTKModal4Test.java
@@ -25,6 +25,7 @@
 
 /*
  * @test
+ * @key headful
  * @bug 8054359 8055752
  *
  * @summary Check whether FileDialog blocks a toolkit modal Dialog
diff --git a/jdk/test/java/awt/Modal/FileDialog/FileDialogTKModal5Test.java b/jdk/test/java/awt/Modal/FileDialog/FileDialogTKModal5Test.java
index 8e84650..f3dc2df 100644
--- a/jdk/test/java/awt/Modal/FileDialog/FileDialogTKModal5Test.java
+++ b/jdk/test/java/awt/Modal/FileDialog/FileDialogTKModal5Test.java
@@ -25,6 +25,7 @@
 
 /*
  * @test
+ * @key headful
  * @bug 8054359 8055752
  *
  * @summary Check whether FileDialog blocks a toolkit modal Dialog
diff --git a/jdk/test/java/awt/Modal/FileDialog/FileDialogTKModal6Test.java b/jdk/test/java/awt/Modal/FileDialog/FileDialogTKModal6Test.java
index 4e0d1d1..bf47ece 100644
--- a/jdk/test/java/awt/Modal/FileDialog/FileDialogTKModal6Test.java
+++ b/jdk/test/java/awt/Modal/FileDialog/FileDialogTKModal6Test.java
@@ -25,6 +25,7 @@
 
 /*
  * @test
+ * @key headful
  * @bug 8054359 8055752
  *
  * @summary Check whether FileDialog blocks a toolkit modal Dialog
diff --git a/jdk/test/java/awt/Modal/FileDialog/FileDialogTKModal7Test.java b/jdk/test/java/awt/Modal/FileDialog/FileDialogTKModal7Test.java
index f4a2ac3..77e9ade 100644
--- a/jdk/test/java/awt/Modal/FileDialog/FileDialogTKModal7Test.java
+++ b/jdk/test/java/awt/Modal/FileDialog/FileDialogTKModal7Test.java
@@ -25,6 +25,7 @@
 
 /*
  * @test
+ * @key headful
  * @bug 8054359 7186009
  * @summary Check whether a FileDialog set to toolkit modality behaves as expected.
  *
diff --git a/jdk/test/java/awt/Modal/ModalBlockingTests/BlockingDDAppModalTest.java b/jdk/test/java/awt/Modal/ModalBlockingTests/BlockingDDAppModalTest.java
index b04cd70..a918cdc 100644
--- a/jdk/test/java/awt/Modal/ModalBlockingTests/BlockingDDAppModalTest.java
+++ b/jdk/test/java/awt/Modal/ModalBlockingTests/BlockingDDAppModalTest.java
@@ -25,6 +25,7 @@
 
 /*
  * @test
+ * @key headful
  * @bug 8049617
  * @summary Check whether an application modal Dialog created with a Dialog
  *          constructor receives focus, whether its components receive focus
diff --git a/jdk/test/java/awt/Modal/ModalBlockingTests/BlockingDDDocModalTest.java b/jdk/test/java/awt/Modal/ModalBlockingTests/BlockingDDDocModalTest.java
index e73867e..78cea79 100644
--- a/jdk/test/java/awt/Modal/ModalBlockingTests/BlockingDDDocModalTest.java
+++ b/jdk/test/java/awt/Modal/ModalBlockingTests/BlockingDDDocModalTest.java
@@ -25,6 +25,7 @@
 
 /*
  * @test
+ * @key headful
  * @bug 8049617
  * @summary Check whether a document modal Dialog created with a Dialog
  *          constructor receives focus, whether its components receive focus
diff --git a/jdk/test/java/awt/Modal/ModalBlockingTests/BlockingDDModelessTest.java b/jdk/test/java/awt/Modal/ModalBlockingTests/BlockingDDModelessTest.java
index f38c3d6..353957d 100644
--- a/jdk/test/java/awt/Modal/ModalBlockingTests/BlockingDDModelessTest.java
+++ b/jdk/test/java/awt/Modal/ModalBlockingTests/BlockingDDModelessTest.java
@@ -25,6 +25,7 @@
 
 /*
  * @test
+ * @key headful
  * @bug 8049617
  * @summary Check whether a modeless Dialog created with a Dialog
  *          constructor receives focus, whether its components receive focus
diff --git a/jdk/test/java/awt/Modal/ModalBlockingTests/BlockingDDNonModalTest.java b/jdk/test/java/awt/Modal/ModalBlockingTests/BlockingDDNonModalTest.java
index f3f558e..92f224f 100644
--- a/jdk/test/java/awt/Modal/ModalBlockingTests/BlockingDDNonModalTest.java
+++ b/jdk/test/java/awt/Modal/ModalBlockingTests/BlockingDDNonModalTest.java
@@ -23,6 +23,7 @@
 
 /*
  * @test
+ * @key headful
  * @bug 8049617
  * @summary Check whether a non-modal Dialog created with a Dialog
  *          constructor receives focus, whether its components receive focus
diff --git a/jdk/test/java/awt/Modal/ModalBlockingTests/BlockingDDSetModalTest.java b/jdk/test/java/awt/Modal/ModalBlockingTests/BlockingDDSetModalTest.java
index 3b89dad..5dc0a5d 100644
--- a/jdk/test/java/awt/Modal/ModalBlockingTests/BlockingDDSetModalTest.java
+++ b/jdk/test/java/awt/Modal/ModalBlockingTests/BlockingDDSetModalTest.java
@@ -24,6 +24,7 @@
 
 /*
  * @test
+ * @key headful
  * @bug 8049617
  * @summary Check whether a modal Dialog created with a Dialog
  *          constructor receives focus, whether its components receive focus
diff --git a/jdk/test/java/awt/Modal/ModalBlockingTests/BlockingDDToolkitModalTest.java b/jdk/test/java/awt/Modal/ModalBlockingTests/BlockingDDToolkitModalTest.java
index e386dc1..a68fa4f 100644
--- a/jdk/test/java/awt/Modal/ModalBlockingTests/BlockingDDToolkitModalTest.java
+++ b/jdk/test/java/awt/Modal/ModalBlockingTests/BlockingDDToolkitModalTest.java
@@ -25,6 +25,7 @@
 
 /*
  * @test
+ * @key headful
  * @bug 8049617
  * @summary Check whether a toolkit modal Dialog created with a Dialog
  *          constructor receives focus, whether its components receive focus
diff --git a/jdk/test/java/awt/Modal/ModalBlockingTests/BlockingDFAppModalTest.java b/jdk/test/java/awt/Modal/ModalBlockingTests/BlockingDFAppModalTest.java
index 7ebc765..9f3fa81 100644
--- a/jdk/test/java/awt/Modal/ModalBlockingTests/BlockingDFAppModalTest.java
+++ b/jdk/test/java/awt/Modal/ModalBlockingTests/BlockingDFAppModalTest.java
@@ -25,6 +25,7 @@
 
 /*
  * @test
+ * @key headful
  * @bug 8049617
  * @summary Check whether an application modal Dialog created with a Frame
  *          constructor receives focus, whether its components receive focus
diff --git a/jdk/test/java/awt/Modal/ModalBlockingTests/BlockingDFSetModalTest.java b/jdk/test/java/awt/Modal/ModalBlockingTests/BlockingDFSetModalTest.java
index 790d5e0..995287f 100644
--- a/jdk/test/java/awt/Modal/ModalBlockingTests/BlockingDFSetModalTest.java
+++ b/jdk/test/java/awt/Modal/ModalBlockingTests/BlockingDFSetModalTest.java
@@ -25,6 +25,7 @@
 
 /*
  * @test
+ * @key headful
  * @bug 8049617
  * @summary Check whether a modal Dialog created with a Frame
  *          constructor receives focus, whether its components receive focus
diff --git a/jdk/test/java/awt/Modal/ModalBlockingTests/BlockingDFToolkitModalTest.java b/jdk/test/java/awt/Modal/ModalBlockingTests/BlockingDFToolkitModalTest.java
index de09b5d..673f230 100644
--- a/jdk/test/java/awt/Modal/ModalBlockingTests/BlockingDFToolkitModalTest.java
+++ b/jdk/test/java/awt/Modal/ModalBlockingTests/BlockingDFToolkitModalTest.java
@@ -25,6 +25,7 @@
 
 /*
  * @test
+ * @key headful
  * @bug 8049617
  * @summary Check whether a toolkit modal Dialog created with a Frame
  *          constructor receives focus, whether its components receives focus
diff --git a/jdk/test/java/awt/Modal/ModalBlockingTests/BlockingDFWModeless1Test.java b/jdk/test/java/awt/Modal/ModalBlockingTests/BlockingDFWModeless1Test.java
index 5c9c3f3..5d6d14b 100644
--- a/jdk/test/java/awt/Modal/ModalBlockingTests/BlockingDFWModeless1Test.java
+++ b/jdk/test/java/awt/Modal/ModalBlockingTests/BlockingDFWModeless1Test.java
@@ -25,6 +25,7 @@
 
 /*
  * @test
+ * @key headful
  * @bug 8049617
  * @summary Check whether a modeless Dialog created with a Frame
  *          constructor receives focus, whether its components receive focus
diff --git a/jdk/test/java/awt/Modal/ModalBlockingTests/BlockingDFWModeless2Test.java b/jdk/test/java/awt/Modal/ModalBlockingTests/BlockingDFWModeless2Test.java
index 430dff2..cf69eb0 100644
--- a/jdk/test/java/awt/Modal/ModalBlockingTests/BlockingDFWModeless2Test.java
+++ b/jdk/test/java/awt/Modal/ModalBlockingTests/BlockingDFWModeless2Test.java
@@ -25,6 +25,7 @@
 
 /*
  * @test
+ * @key headful
  * @bug 8049617
  * @summary Check whether a modeless Dialog created with a Dialog
  *          constructor receives focus, whether its components receive focus
diff --git a/jdk/test/java/awt/Modal/ModalBlockingTests/BlockingDFWNonModal1Test.java b/jdk/test/java/awt/Modal/ModalBlockingTests/BlockingDFWNonModal1Test.java
index 58242e4..d929b24 100644
--- a/jdk/test/java/awt/Modal/ModalBlockingTests/BlockingDFWNonModal1Test.java
+++ b/jdk/test/java/awt/Modal/ModalBlockingTests/BlockingDFWNonModal1Test.java
@@ -24,6 +24,7 @@
 
 /*
  * @test
+ * @key headful
  * @bug 8049617
  * @summary Check whether a non-modal Dialog created with a Frame
  *          constructor receives focus, whether its components receive focus
diff --git a/jdk/test/java/awt/Modal/ModalBlockingTests/BlockingDFWNonModal2Test.java b/jdk/test/java/awt/Modal/ModalBlockingTests/BlockingDFWNonModal2Test.java
index acd9fb8..31ca236 100644
--- a/jdk/test/java/awt/Modal/ModalBlockingTests/BlockingDFWNonModal2Test.java
+++ b/jdk/test/java/awt/Modal/ModalBlockingTests/BlockingDFWNonModal2Test.java
@@ -24,6 +24,7 @@
 
 /*
  * @test
+ * @key headful
  * @bug 8049617
  * @summary Check whether a non-modal Dialog created with a Dialog
  *          constructor receives focus, whether its components receive focus
diff --git a/jdk/test/java/awt/Modal/ModalBlockingTests/BlockingDocModalTest.java b/jdk/test/java/awt/Modal/ModalBlockingTests/BlockingDocModalTest.java
index 638c67a..3ae730f 100644
--- a/jdk/test/java/awt/Modal/ModalBlockingTests/BlockingDocModalTest.java
+++ b/jdk/test/java/awt/Modal/ModalBlockingTests/BlockingDocModalTest.java
@@ -28,6 +28,7 @@
 
 /*
  * @test
+ * @key headful
  * @bug 8049617
  * @summary Test if a document modality works as expected:
  *          whether all the windows lying down the document root
diff --git a/jdk/test/java/awt/Modal/ModalBlockingTests/BlockingFDAppModalTest.java b/jdk/test/java/awt/Modal/ModalBlockingTests/BlockingFDAppModalTest.java
index e446498..ddfea7f 100644
--- a/jdk/test/java/awt/Modal/ModalBlockingTests/BlockingFDAppModalTest.java
+++ b/jdk/test/java/awt/Modal/ModalBlockingTests/BlockingFDAppModalTest.java
@@ -25,6 +25,7 @@
 
 /*
  * @test
+ * @key headful
  * @bug 8049617
  * @summary Check whether an application modal Dialog created with a Frame
  *          constructor receives focus, whether its components receive focus
diff --git a/jdk/test/java/awt/Modal/ModalBlockingTests/BlockingFDDocModalTest.java b/jdk/test/java/awt/Modal/ModalBlockingTests/BlockingFDDocModalTest.java
index 1f9168f..014cb0b 100644
--- a/jdk/test/java/awt/Modal/ModalBlockingTests/BlockingFDDocModalTest.java
+++ b/jdk/test/java/awt/Modal/ModalBlockingTests/BlockingFDDocModalTest.java
@@ -25,6 +25,7 @@
 
 /*
  * @test
+ * @key headful
  * @bug 8049617
  * @summary Check whether a document modal Dialog created with a Frame
  *          constructor receives focus, whether its components receive focus
diff --git a/jdk/test/java/awt/Modal/ModalBlockingTests/BlockingFDModelessTest.java b/jdk/test/java/awt/Modal/ModalBlockingTests/BlockingFDModelessTest.java
index d63d1f3..aedff9f 100644
--- a/jdk/test/java/awt/Modal/ModalBlockingTests/BlockingFDModelessTest.java
+++ b/jdk/test/java/awt/Modal/ModalBlockingTests/BlockingFDModelessTest.java
@@ -25,6 +25,7 @@
 
 /*
  * @test
+ * @key headful
  * @bug 8049617
  * @summary Check whether a modeless Dialog created with a Frame
  *          constructor receives focus, whether its components receive focus
diff --git a/jdk/test/java/awt/Modal/ModalBlockingTests/BlockingFDNonModalTest.java b/jdk/test/java/awt/Modal/ModalBlockingTests/BlockingFDNonModalTest.java
index f91bcfb..27cafe9 100644
--- a/jdk/test/java/awt/Modal/ModalBlockingTests/BlockingFDNonModalTest.java
+++ b/jdk/test/java/awt/Modal/ModalBlockingTests/BlockingFDNonModalTest.java
@@ -24,6 +24,7 @@
 
 /*
  * @test
+ * @key headful
  * @bug 8049617
  * @summary Check whether a non-modal Dialog created with a Frame
  *          constructor receives focus, whether its components receive focus
diff --git a/jdk/test/java/awt/Modal/ModalBlockingTests/BlockingFDSetModalTest.java b/jdk/test/java/awt/Modal/ModalBlockingTests/BlockingFDSetModalTest.java
index 21f1720..f4837b7 100644
--- a/jdk/test/java/awt/Modal/ModalBlockingTests/BlockingFDSetModalTest.java
+++ b/jdk/test/java/awt/Modal/ModalBlockingTests/BlockingFDSetModalTest.java
@@ -24,6 +24,7 @@
 
 /*
  * @test
+ * @key headful
  * @bug 8049617
  * @summary Check whether a modal Dialog created with a Frame
  *          constructor receives focus, whether its components receive focus
diff --git a/jdk/test/java/awt/Modal/ModalBlockingTests/BlockingFDToolkitModalTest.java b/jdk/test/java/awt/Modal/ModalBlockingTests/BlockingFDToolkitModalTest.java
index f907276..f92b501 100644
--- a/jdk/test/java/awt/Modal/ModalBlockingTests/BlockingFDToolkitModalTest.java
+++ b/jdk/test/java/awt/Modal/ModalBlockingTests/BlockingFDToolkitModalTest.java
@@ -25,6 +25,7 @@
 
 /*
  * @test
+ * @key headful
  * @bug 8049617
  * @summary Check whether a toolkit modal Dialog created with a Frame
  *          constructor receives focus, whether its components receive focus
diff --git a/jdk/test/java/awt/Modal/ModalBlockingTests/BlockingFDWDocModal1Test.java b/jdk/test/java/awt/Modal/ModalBlockingTests/BlockingFDWDocModal1Test.java
index 8f24edc..6c6834e 100644
--- a/jdk/test/java/awt/Modal/ModalBlockingTests/BlockingFDWDocModal1Test.java
+++ b/jdk/test/java/awt/Modal/ModalBlockingTests/BlockingFDWDocModal1Test.java
@@ -25,6 +25,7 @@
 
 /*
  * @test
+ * @key headful
  * @bug 8049617
  * @summary Check whether a document modal Dialog created with a null Frame
  *          constructor receives focus; whether its components receive focus
diff --git a/jdk/test/java/awt/Modal/ModalBlockingTests/BlockingFDWDocModal2Test.java b/jdk/test/java/awt/Modal/ModalBlockingTests/BlockingFDWDocModal2Test.java
index 41b3f07..d0b315a 100644
--- a/jdk/test/java/awt/Modal/ModalBlockingTests/BlockingFDWDocModal2Test.java
+++ b/jdk/test/java/awt/Modal/ModalBlockingTests/BlockingFDWDocModal2Test.java
@@ -25,6 +25,7 @@
 
 /*
  * @test
+ * @key headful
  * @bug 8049617
  * @summary Check whether a document modal Dialog created with a null Dialog
  *          constructor receives focus; whether its components receive focus
diff --git a/jdk/test/java/awt/Modal/ModalBlockingTests/BlockingFDWDocModal3Test.java b/jdk/test/java/awt/Modal/ModalBlockingTests/BlockingFDWDocModal3Test.java
index 4cc992e..cbf56ee 100644
--- a/jdk/test/java/awt/Modal/ModalBlockingTests/BlockingFDWDocModal3Test.java
+++ b/jdk/test/java/awt/Modal/ModalBlockingTests/BlockingFDWDocModal3Test.java
@@ -25,6 +25,7 @@
 
 /*
  * @test
+ * @key headful
  * @bug 8049617
  * @summary Check whether a document modal Dialog created with a hidden Frame
  *          constructor receives focus; whether its components receive focus
diff --git a/jdk/test/java/awt/Modal/ModalBlockingTests/BlockingFDWDocModal4Test.java b/jdk/test/java/awt/Modal/ModalBlockingTests/BlockingFDWDocModal4Test.java
index a84af09..6003cb0 100644
--- a/jdk/test/java/awt/Modal/ModalBlockingTests/BlockingFDWDocModal4Test.java
+++ b/jdk/test/java/awt/Modal/ModalBlockingTests/BlockingFDWDocModal4Test.java
@@ -25,6 +25,7 @@
 
 /*
  * @test
+ * @key headful
  * @bug 8049617
  * @summary Check whether a document modal Dialog created with a hidden Dialog
  *          constructor receives focus; whether its components receive focus
diff --git a/jdk/test/java/awt/Modal/ModalBlockingTests/BlockingFDWModeless1Test.java b/jdk/test/java/awt/Modal/ModalBlockingTests/BlockingFDWModeless1Test.java
index 2872d59..5cb47bf 100644
--- a/jdk/test/java/awt/Modal/ModalBlockingTests/BlockingFDWModeless1Test.java
+++ b/jdk/test/java/awt/Modal/ModalBlockingTests/BlockingFDWModeless1Test.java
@@ -25,6 +25,7 @@
 
 /*
  * @test
+ * @key headful
  * @bug 8049617
  * @summary Check whether a modeless Dialog created with a null Frame
  *          constructor receives focus; whether its components receive focus
diff --git a/jdk/test/java/awt/Modal/ModalBlockingTests/BlockingFDWModeless2Test.java b/jdk/test/java/awt/Modal/ModalBlockingTests/BlockingFDWModeless2Test.java
index d8a9417..0f47b4e 100644
--- a/jdk/test/java/awt/Modal/ModalBlockingTests/BlockingFDWModeless2Test.java
+++ b/jdk/test/java/awt/Modal/ModalBlockingTests/BlockingFDWModeless2Test.java
@@ -25,6 +25,7 @@
 
 /*
  * @test
+ * @key headful
  * @bug 8049617
  * @summary Check whether a modeless Dialog created with a null Dialog
  *          constructor receives focus; whether its components receive focus
diff --git a/jdk/test/java/awt/Modal/ModalBlockingTests/BlockingFDWModeless3Test.java b/jdk/test/java/awt/Modal/ModalBlockingTests/BlockingFDWModeless3Test.java
index b85b23d..81dd298 100644
--- a/jdk/test/java/awt/Modal/ModalBlockingTests/BlockingFDWModeless3Test.java
+++ b/jdk/test/java/awt/Modal/ModalBlockingTests/BlockingFDWModeless3Test.java
@@ -25,6 +25,7 @@
 
 /*
  * @test
+ * @key headful
  * @bug 8049617
  * @summary Check whether a modeless Dialog created with a hidden Frame
  *          constructor receives focus; whether its components receive focus
diff --git a/jdk/test/java/awt/Modal/ModalBlockingTests/BlockingFDWModeless4Test.java b/jdk/test/java/awt/Modal/ModalBlockingTests/BlockingFDWModeless4Test.java
index 37a04b4..47b7025 100644
--- a/jdk/test/java/awt/Modal/ModalBlockingTests/BlockingFDWModeless4Test.java
+++ b/jdk/test/java/awt/Modal/ModalBlockingTests/BlockingFDWModeless4Test.java
@@ -25,6 +25,7 @@
 
 /*
  * @test
+ * @key headful
  * @bug 8049617
  * @summary Check whether a modeless Dialog created with a hidden Dialog
  *          constructor receives focus; whether its components receive focus
diff --git a/jdk/test/java/awt/Modal/ModalBlockingTests/BlockingFDWNonModal1Test.java b/jdk/test/java/awt/Modal/ModalBlockingTests/BlockingFDWNonModal1Test.java
index 440d428..e6a914f 100644
--- a/jdk/test/java/awt/Modal/ModalBlockingTests/BlockingFDWNonModal1Test.java
+++ b/jdk/test/java/awt/Modal/ModalBlockingTests/BlockingFDWNonModal1Test.java
@@ -23,6 +23,7 @@
 
 /*
  * @test
+ * @key headful
  * @bug 8049617
  * @summary Check whether a non-modal Dialog created with a null Frame
  *          constructor receives focus; whether its components receive focus
diff --git a/jdk/test/java/awt/Modal/ModalBlockingTests/BlockingFDWNonModal2Test.java b/jdk/test/java/awt/Modal/ModalBlockingTests/BlockingFDWNonModal2Test.java
index ece4809..6b7b2cb 100644
--- a/jdk/test/java/awt/Modal/ModalBlockingTests/BlockingFDWNonModal2Test.java
+++ b/jdk/test/java/awt/Modal/ModalBlockingTests/BlockingFDWNonModal2Test.java
@@ -24,6 +24,7 @@
 
 /*
  * @test
+ * @key headful
  * @bug 8049617
  * @summary Check whether a non-modal Dialog created with a null Dialog
  *          constructor receives focus; whether its components receive focus
diff --git a/jdk/test/java/awt/Modal/ModalBlockingTests/BlockingFDWNonModal3Test.java b/jdk/test/java/awt/Modal/ModalBlockingTests/BlockingFDWNonModal3Test.java
index 759967a..eda2f4f 100644
--- a/jdk/test/java/awt/Modal/ModalBlockingTests/BlockingFDWNonModal3Test.java
+++ b/jdk/test/java/awt/Modal/ModalBlockingTests/BlockingFDWNonModal3Test.java
@@ -24,6 +24,7 @@
 
 /*
  * @test
+ * @key headful
  * @bug 8049617
  * @summary Check whether a non-modal Dialog created with a hidden Frame
  *          constructor receives focus; whether its components receive focus
diff --git a/jdk/test/java/awt/Modal/ModalBlockingTests/BlockingFDWNonModal4Test.java b/jdk/test/java/awt/Modal/ModalBlockingTests/BlockingFDWNonModal4Test.java
index e24f818..a777015 100644
--- a/jdk/test/java/awt/Modal/ModalBlockingTests/BlockingFDWNonModal4Test.java
+++ b/jdk/test/java/awt/Modal/ModalBlockingTests/BlockingFDWNonModal4Test.java
@@ -24,6 +24,7 @@
 
 /*
  * @test
+ * @key headful
  * @bug 8049617
  * @summary Check whether a non-modal Dialog created with a hidden Dialog
  *          constructor receives focus; whether its components receive focus
diff --git a/jdk/test/java/awt/Modal/ModalBlockingTests/BlockingWindowsAppModal1Test.java b/jdk/test/java/awt/Modal/ModalBlockingTests/BlockingWindowsAppModal1Test.java
index 4a840f8..3a58464 100644
--- a/jdk/test/java/awt/Modal/ModalBlockingTests/BlockingWindowsAppModal1Test.java
+++ b/jdk/test/java/awt/Modal/ModalBlockingTests/BlockingWindowsAppModal1Test.java
@@ -25,6 +25,7 @@
 
 /*
  * @test
+ * @key headful
  * @bug 8049617
  * @summary Check whether an application modal Dialog created with a null Frame
  *          constructor receives focus; whether its components receive focus
diff --git a/jdk/test/java/awt/Modal/ModalBlockingTests/BlockingWindowsAppModal2Test.java b/jdk/test/java/awt/Modal/ModalBlockingTests/BlockingWindowsAppModal2Test.java
index 46a37f8..ee0fde8 100644
--- a/jdk/test/java/awt/Modal/ModalBlockingTests/BlockingWindowsAppModal2Test.java
+++ b/jdk/test/java/awt/Modal/ModalBlockingTests/BlockingWindowsAppModal2Test.java
@@ -25,6 +25,7 @@
 
 /*
  * @test
+ * @key headful
  * @bug 8049617
  * @summary Check whether an application modal Dialog created with a null Dialog
  *          constructor receives focus; whether its components receive focus
diff --git a/jdk/test/java/awt/Modal/ModalBlockingTests/BlockingWindowsAppModal3Test.java b/jdk/test/java/awt/Modal/ModalBlockingTests/BlockingWindowsAppModal3Test.java
index c58fe74..8d67712 100644
--- a/jdk/test/java/awt/Modal/ModalBlockingTests/BlockingWindowsAppModal3Test.java
+++ b/jdk/test/java/awt/Modal/ModalBlockingTests/BlockingWindowsAppModal3Test.java
@@ -25,6 +25,7 @@
 
 /*
  * @test
+ * @key headful
  * @bug 8049617
  * @summary Check whether an application modal Dialog created with a hidden Frame
  *          constructor receives focus; whether its components receive focus
diff --git a/jdk/test/java/awt/Modal/ModalBlockingTests/BlockingWindowsAppModal4Test.java b/jdk/test/java/awt/Modal/ModalBlockingTests/BlockingWindowsAppModal4Test.java
index 651ef12..f9d7768 100644
--- a/jdk/test/java/awt/Modal/ModalBlockingTests/BlockingWindowsAppModal4Test.java
+++ b/jdk/test/java/awt/Modal/ModalBlockingTests/BlockingWindowsAppModal4Test.java
@@ -25,6 +25,7 @@
 
 /*
  * @test
+ * @key headful
  * @bug 8049617
  * @summary Check whether an application modal Dialog created with a hidden Dialog
  *          constructor receives focus; whether its components receive focus
diff --git a/jdk/test/java/awt/Modal/ModalBlockingTests/BlockingWindowsAppModal5Test.java b/jdk/test/java/awt/Modal/ModalBlockingTests/BlockingWindowsAppModal5Test.java
index 0fd12ae..f960e3d 100644
--- a/jdk/test/java/awt/Modal/ModalBlockingTests/BlockingWindowsAppModal5Test.java
+++ b/jdk/test/java/awt/Modal/ModalBlockingTests/BlockingWindowsAppModal5Test.java
@@ -25,6 +25,7 @@
 
 /*
  * @test
+ * @key headful
  * @bug 8049617
  * @summary Check whether an application modal Dialog created with a Frame
  *          constructor receives focus; whether its components receive focus
diff --git a/jdk/test/java/awt/Modal/ModalBlockingTests/BlockingWindowsAppModal6Test.java b/jdk/test/java/awt/Modal/ModalBlockingTests/BlockingWindowsAppModal6Test.java
index 39ae804..718f8bf 100644
--- a/jdk/test/java/awt/Modal/ModalBlockingTests/BlockingWindowsAppModal6Test.java
+++ b/jdk/test/java/awt/Modal/ModalBlockingTests/BlockingWindowsAppModal6Test.java
@@ -25,6 +25,7 @@
 
 /*
  * @test
+ * @key headful
  * @bug 8049617
  * @summary Check whether an application modal Dialog created with a Dialog
  *          constructor receives focus; whether its components receive focus
diff --git a/jdk/test/java/awt/Modal/ModalBlockingTests/BlockingWindowsDocModal1Test.java b/jdk/test/java/awt/Modal/ModalBlockingTests/BlockingWindowsDocModal1Test.java
index dbb1382..4af7dfb 100644
--- a/jdk/test/java/awt/Modal/ModalBlockingTests/BlockingWindowsDocModal1Test.java
+++ b/jdk/test/java/awt/Modal/ModalBlockingTests/BlockingWindowsDocModal1Test.java
@@ -25,6 +25,7 @@
 
 /*
  * @test
+ * @key headful
  * @bug 8049617
  * @summary Check whether a document modal Dialog created with a Frame
  *          constructor receives focus; whether its components receive focus
diff --git a/jdk/test/java/awt/Modal/ModalBlockingTests/BlockingWindowsDocModal2Test.java b/jdk/test/java/awt/Modal/ModalBlockingTests/BlockingWindowsDocModal2Test.java
index da39e5d..db13a65 100644
--- a/jdk/test/java/awt/Modal/ModalBlockingTests/BlockingWindowsDocModal2Test.java
+++ b/jdk/test/java/awt/Modal/ModalBlockingTests/BlockingWindowsDocModal2Test.java
@@ -25,6 +25,7 @@
 
 /*
  * @test
+ * @key headful
  * @bug 8049617
  * @summary Check whether a document modal Dialog created with a Dialog
  *          constructor receives focus; whether its components receive focus
diff --git a/jdk/test/java/awt/Modal/ModalBlockingTests/BlockingWindowsSetModal1Test.java b/jdk/test/java/awt/Modal/ModalBlockingTests/BlockingWindowsSetModal1Test.java
index c4b7e36..461d92e 100644
--- a/jdk/test/java/awt/Modal/ModalBlockingTests/BlockingWindowsSetModal1Test.java
+++ b/jdk/test/java/awt/Modal/ModalBlockingTests/BlockingWindowsSetModal1Test.java
@@ -24,6 +24,7 @@
 
 /*
  * @test
+ * @key headful
  * @bug 8049617
  * @summary Check whether a modal Dialog created with a null Frame
  *          constructor receives focus; whether its components receive focus
diff --git a/jdk/test/java/awt/Modal/ModalBlockingTests/BlockingWindowsSetModal2Test.java b/jdk/test/java/awt/Modal/ModalBlockingTests/BlockingWindowsSetModal2Test.java
index 5eccd05..0d2b5cb 100644
--- a/jdk/test/java/awt/Modal/ModalBlockingTests/BlockingWindowsSetModal2Test.java
+++ b/jdk/test/java/awt/Modal/ModalBlockingTests/BlockingWindowsSetModal2Test.java
@@ -24,6 +24,7 @@
 
 /*
  * @test
+ * @key headful
  * @bug 8049617
  * @summary Check whether a modal Dialog created with a null Dialog
  *          constructor receives focus; whether its components receive focus
diff --git a/jdk/test/java/awt/Modal/ModalBlockingTests/BlockingWindowsSetModal3Test.java b/jdk/test/java/awt/Modal/ModalBlockingTests/BlockingWindowsSetModal3Test.java
index 7bfdc05..b3ca9e9 100644
--- a/jdk/test/java/awt/Modal/ModalBlockingTests/BlockingWindowsSetModal3Test.java
+++ b/jdk/test/java/awt/Modal/ModalBlockingTests/BlockingWindowsSetModal3Test.java
@@ -24,6 +24,7 @@
 
 /*
  * @test
+ * @key headful
  * @bug 8049617
  * @summary Check whether a modal Dialog created with a hidden Frame
  *          constructor receives focus; whether its components receive focus
diff --git a/jdk/test/java/awt/Modal/ModalBlockingTests/BlockingWindowsSetModal4Test.java b/jdk/test/java/awt/Modal/ModalBlockingTests/BlockingWindowsSetModal4Test.java
index 1019335..4907904 100644
--- a/jdk/test/java/awt/Modal/ModalBlockingTests/BlockingWindowsSetModal4Test.java
+++ b/jdk/test/java/awt/Modal/ModalBlockingTests/BlockingWindowsSetModal4Test.java
@@ -24,6 +24,7 @@
 
 /*
  * @test
+ * @key headful
  * @bug 8049617
  * @summary Check whether a modal Dialog created with a hidden Dialog
  *          constructor receives focus; whether its components receive focus
diff --git a/jdk/test/java/awt/Modal/ModalBlockingTests/BlockingWindowsSetModal5Test.java b/jdk/test/java/awt/Modal/ModalBlockingTests/BlockingWindowsSetModal5Test.java
index 067cd4e..fb97a8c 100644
--- a/jdk/test/java/awt/Modal/ModalBlockingTests/BlockingWindowsSetModal5Test.java
+++ b/jdk/test/java/awt/Modal/ModalBlockingTests/BlockingWindowsSetModal5Test.java
@@ -24,6 +24,7 @@
 
 /*
  * @test
+ * @key headful
  * @bug 8049617
  * @summary Check whether a modal Dialog created with a Frame
  *          constructor receives focus; whether its components receive focus
diff --git a/jdk/test/java/awt/Modal/ModalBlockingTests/BlockingWindowsSetModal6Test.java b/jdk/test/java/awt/Modal/ModalBlockingTests/BlockingWindowsSetModal6Test.java
index 57d43ca..6958db4 100644
--- a/jdk/test/java/awt/Modal/ModalBlockingTests/BlockingWindowsSetModal6Test.java
+++ b/jdk/test/java/awt/Modal/ModalBlockingTests/BlockingWindowsSetModal6Test.java
@@ -24,6 +24,7 @@
 
 /*
  * @test
+ * @key headful
  * @bug 8049617
  * @summary Check whether a modal Dialog created with a Dialog
  *          constructor receives focus; whether its components receive focus
diff --git a/jdk/test/java/awt/Modal/ModalBlockingTests/BlockingWindowsToolkitModal1Test.java b/jdk/test/java/awt/Modal/ModalBlockingTests/BlockingWindowsToolkitModal1Test.java
index 0a9d6a1..a2c837e 100644
--- a/jdk/test/java/awt/Modal/ModalBlockingTests/BlockingWindowsToolkitModal1Test.java
+++ b/jdk/test/java/awt/Modal/ModalBlockingTests/BlockingWindowsToolkitModal1Test.java
@@ -25,6 +25,7 @@
 
 /*
  * @test
+ * @key headful
  * @bug 8049617
  * @summary Check whether a toolkit modal Dialog created with a null Frame
  *          constructor receives focus; whether its components receive focus
diff --git a/jdk/test/java/awt/Modal/ModalBlockingTests/BlockingWindowsToolkitModal2Test.java b/jdk/test/java/awt/Modal/ModalBlockingTests/BlockingWindowsToolkitModal2Test.java
index 3208027..db8e50a 100644
--- a/jdk/test/java/awt/Modal/ModalBlockingTests/BlockingWindowsToolkitModal2Test.java
+++ b/jdk/test/java/awt/Modal/ModalBlockingTests/BlockingWindowsToolkitModal2Test.java
@@ -25,6 +25,7 @@
 
 /*
  * @test
+ * @key headful
  * @bug 8049617
  * @summary Check whether a toolkit modal Dialog created with a null Dialog
  *          constructor receives focus; whether its components receive focus
diff --git a/jdk/test/java/awt/Modal/ModalBlockingTests/BlockingWindowsToolkitModal3Test.java b/jdk/test/java/awt/Modal/ModalBlockingTests/BlockingWindowsToolkitModal3Test.java
index 6b4aaf7..2bb2d21 100644
--- a/jdk/test/java/awt/Modal/ModalBlockingTests/BlockingWindowsToolkitModal3Test.java
+++ b/jdk/test/java/awt/Modal/ModalBlockingTests/BlockingWindowsToolkitModal3Test.java
@@ -25,6 +25,7 @@
 
 /*
  * @test
+ * @key headful
  * @bug 8049617
  * @summary Check whether a toolkit modal Dialog created with a hidden Frame
  *          constructor receives focus; whether its components receive focus
diff --git a/jdk/test/java/awt/Modal/ModalBlockingTests/BlockingWindowsToolkitModal4Test.java b/jdk/test/java/awt/Modal/ModalBlockingTests/BlockingWindowsToolkitModal4Test.java
index f8ddae7..0b0249e 100644
--- a/jdk/test/java/awt/Modal/ModalBlockingTests/BlockingWindowsToolkitModal4Test.java
+++ b/jdk/test/java/awt/Modal/ModalBlockingTests/BlockingWindowsToolkitModal4Test.java
@@ -25,6 +25,7 @@
 
 /*
  * @test
+ * @key headful
  * @bug 8049617
  * @summary Check whether a toolkit modal Dialog created with a hidden Dialog
  *          constructor receives focus; whether its components receive focus
diff --git a/jdk/test/java/awt/Modal/ModalBlockingTests/BlockingWindowsToolkitModal5Test.java b/jdk/test/java/awt/Modal/ModalBlockingTests/BlockingWindowsToolkitModal5Test.java
index cb55619..4e8dee9 100644
--- a/jdk/test/java/awt/Modal/ModalBlockingTests/BlockingWindowsToolkitModal5Test.java
+++ b/jdk/test/java/awt/Modal/ModalBlockingTests/BlockingWindowsToolkitModal5Test.java
@@ -25,6 +25,7 @@
 
 /*
  * @test
+ * @key headful
  * @bug 8049617
  * @summary Check whether a toolkit modal Dialog created with a Frame
  *          constructor receives focus; whether its components receive focus
diff --git a/jdk/test/java/awt/Modal/ModalBlockingTests/BlockingWindowsToolkitModal6Test.java b/jdk/test/java/awt/Modal/ModalBlockingTests/BlockingWindowsToolkitModal6Test.java
index 6407def..f4cbcf4 100644
--- a/jdk/test/java/awt/Modal/ModalBlockingTests/BlockingWindowsToolkitModal6Test.java
+++ b/jdk/test/java/awt/Modal/ModalBlockingTests/BlockingWindowsToolkitModal6Test.java
@@ -25,6 +25,7 @@
 
 /*
  * @test
+ * @key headful
  * @bug 8049617
  * @summary Check whether a toolkit modal Dialog created with a Dialog
  *          constructor receives focus; whether its components receive focus
diff --git a/jdk/test/java/awt/Modal/ModalBlockingTests/UnblockedDialogAppModalTest.java b/jdk/test/java/awt/Modal/ModalBlockingTests/UnblockedDialogAppModalTest.java
index 81965d2..e90679e 100644
--- a/jdk/test/java/awt/Modal/ModalBlockingTests/UnblockedDialogAppModalTest.java
+++ b/jdk/test/java/awt/Modal/ModalBlockingTests/UnblockedDialogAppModalTest.java
@@ -25,6 +25,7 @@
 
 /*
  * @test
+ * @key headful
  * @bug 8049617
  * @summary Check whether an application modal Dialog receives focus; check
  *          if its components receive focus and respond to key events
diff --git a/jdk/test/java/awt/Modal/ModalBlockingTests/UnblockedDialogDocModalTest.java b/jdk/test/java/awt/Modal/ModalBlockingTests/UnblockedDialogDocModalTest.java
index ce4fb9d..edeb86b 100644
--- a/jdk/test/java/awt/Modal/ModalBlockingTests/UnblockedDialogDocModalTest.java
+++ b/jdk/test/java/awt/Modal/ModalBlockingTests/UnblockedDialogDocModalTest.java
@@ -25,6 +25,7 @@
 
 /*
  * @test
+ * @key headful
  * @bug 8049617
  * @summary Check whether a document modal Dialog receives focus; check
  *          if its components receive focus and respond to key events
diff --git a/jdk/test/java/awt/Modal/ModalBlockingTests/UnblockedDialogModelessTest.java b/jdk/test/java/awt/Modal/ModalBlockingTests/UnblockedDialogModelessTest.java
index e566b71..0b49687 100644
--- a/jdk/test/java/awt/Modal/ModalBlockingTests/UnblockedDialogModelessTest.java
+++ b/jdk/test/java/awt/Modal/ModalBlockingTests/UnblockedDialogModelessTest.java
@@ -25,6 +25,7 @@
 
 /*
  * @test
+ * @key headful
  * @bug 8049617
  * @summary Check whether a modeless Dialog receives focus; check
  *          if its components receive focus and respond to key events
diff --git a/jdk/test/java/awt/Modal/ModalBlockingTests/UnblockedDialogNonModalTest.java b/jdk/test/java/awt/Modal/ModalBlockingTests/UnblockedDialogNonModalTest.java
index 664ddc7..683fe42 100644
--- a/jdk/test/java/awt/Modal/ModalBlockingTests/UnblockedDialogNonModalTest.java
+++ b/jdk/test/java/awt/Modal/ModalBlockingTests/UnblockedDialogNonModalTest.java
@@ -24,6 +24,7 @@
 
 /*
  * @test
+ * @key headful
  * @bug 8049617
  * @summary Check whether a non-modal Dialog receives focus; check
  *          if its components receive focus and respond to key events
diff --git a/jdk/test/java/awt/Modal/ModalBlockingTests/UnblockedDialogSetModalTest.java b/jdk/test/java/awt/Modal/ModalBlockingTests/UnblockedDialogSetModalTest.java
index 4c7996b..0178925 100644
--- a/jdk/test/java/awt/Modal/ModalBlockingTests/UnblockedDialogSetModalTest.java
+++ b/jdk/test/java/awt/Modal/ModalBlockingTests/UnblockedDialogSetModalTest.java
@@ -24,6 +24,7 @@
 
 /*
  * @test
+ * @key headful
  * @bug 8049617
  * @summary Check whether a modal Dialog receives focus; check
  *          if its components receive focus and respond to key events
diff --git a/jdk/test/java/awt/Modal/ModalBlockingTests/UnblockedDialogToolkitModalTest.java b/jdk/test/java/awt/Modal/ModalBlockingTests/UnblockedDialogToolkitModalTest.java
index 213d029..b3e6c93 100644
--- a/jdk/test/java/awt/Modal/ModalBlockingTests/UnblockedDialogToolkitModalTest.java
+++ b/jdk/test/java/awt/Modal/ModalBlockingTests/UnblockedDialogToolkitModalTest.java
@@ -25,6 +25,7 @@
 
 /*
  * @test
+ * @key headful
  * @bug 8049617
  * @summary Check whether a toolkit modal Dialog receives focus; check
  *          if its components receive focus and respond to key events
diff --git a/jdk/test/java/awt/Modal/ModalExclusionTests/ApplicationExcludeDialogFileTest.java b/jdk/test/java/awt/Modal/ModalExclusionTests/ApplicationExcludeDialogFileTest.java
index b86c2b2..ebbba07 100644
--- a/jdk/test/java/awt/Modal/ModalExclusionTests/ApplicationExcludeDialogFileTest.java
+++ b/jdk/test/java/awt/Modal/ModalExclusionTests/ApplicationExcludeDialogFileTest.java
@@ -25,6 +25,7 @@
 
 /*
  * @test
+ * @key headful
  * @bug 8047179 8044429
  * @summary Check whether a FileDialog blocks an application modality excluded Dialog
  *          (it shouldn't). Checks also whether setting a parent dialog to be
diff --git a/jdk/test/java/awt/Modal/ModalExclusionTests/ApplicationExcludeDialogPageSetupTest.java b/jdk/test/java/awt/Modal/ModalExclusionTests/ApplicationExcludeDialogPageSetupTest.java
index c3b083b..dca252c 100644
--- a/jdk/test/java/awt/Modal/ModalExclusionTests/ApplicationExcludeDialogPageSetupTest.java
+++ b/jdk/test/java/awt/Modal/ModalExclusionTests/ApplicationExcludeDialogPageSetupTest.java
@@ -25,6 +25,7 @@
 
 /*
  * @test
+ * @key headful
  * @bug 7125054 8044429
  * @summary Check whether a pageDialog blocks an application modality excluded Dialog
  *          (it shouldn't). Checks also whether setting a parent dialog to be
diff --git a/jdk/test/java/awt/Modal/ModalExclusionTests/ApplicationExcludeDialogPrintSetupTest.java b/jdk/test/java/awt/Modal/ModalExclusionTests/ApplicationExcludeDialogPrintSetupTest.java
index 8bd4330..f2f5e43 100644
--- a/jdk/test/java/awt/Modal/ModalExclusionTests/ApplicationExcludeDialogPrintSetupTest.java
+++ b/jdk/test/java/awt/Modal/ModalExclusionTests/ApplicationExcludeDialogPrintSetupTest.java
@@ -25,6 +25,7 @@
 
 /*
  * @test
+ * @key headful
  * @bug 7125054 8044429
  * @summary Check whether a printDialog blocks an application modality excluded Dialog
  *          (it shouldn't). Checks also whether setting a parent dialog to be
diff --git a/jdk/test/java/awt/Modal/ModalExclusionTests/ApplicationExcludeFrameFileTest.java b/jdk/test/java/awt/Modal/ModalExclusionTests/ApplicationExcludeFrameFileTest.java
index 83ebdff..2e0553a 100644
--- a/jdk/test/java/awt/Modal/ModalExclusionTests/ApplicationExcludeFrameFileTest.java
+++ b/jdk/test/java/awt/Modal/ModalExclusionTests/ApplicationExcludeFrameFileTest.java
@@ -25,6 +25,7 @@
 
 /*
  * @test
+ * @key headful
  * @bug 8047179 8044429
  * @summary Check whether a FileDialog blocks an application modality excluded Frame
  *          (it shouldn't). Checks also whether setting a parent frame to be
diff --git a/jdk/test/java/awt/Modal/ModalExclusionTests/ApplicationExcludeFramePageSetupTest.java b/jdk/test/java/awt/Modal/ModalExclusionTests/ApplicationExcludeFramePageSetupTest.java
index ce34348..3965b8c 100644
--- a/jdk/test/java/awt/Modal/ModalExclusionTests/ApplicationExcludeFramePageSetupTest.java
+++ b/jdk/test/java/awt/Modal/ModalExclusionTests/ApplicationExcludeFramePageSetupTest.java
@@ -25,6 +25,7 @@
 
 /*
  * @test
+ * @key headful
  * @bug 7125054 8044429
  * @summary Check whether a pageDialog blocks an application modality excluded Frame
  *          (it shouldn't). Checks also whether setting a parent frame to be
diff --git a/jdk/test/java/awt/Modal/ModalExclusionTests/ApplicationExcludeFramePrintSetupTest.java b/jdk/test/java/awt/Modal/ModalExclusionTests/ApplicationExcludeFramePrintSetupTest.java
index 66aeb64..3763bf4 100644
--- a/jdk/test/java/awt/Modal/ModalExclusionTests/ApplicationExcludeFramePrintSetupTest.java
+++ b/jdk/test/java/awt/Modal/ModalExclusionTests/ApplicationExcludeFramePrintSetupTest.java
@@ -25,6 +25,7 @@
 
 /*
  * @test
+ * @key headful
  * @bug 7125054 8044429
  * @summary Check whether a printDialog blocks an application modality excluded Frame
  *          (it shouldn't). Checks also whether setting a parent frame to be
diff --git a/jdk/test/java/awt/Modal/ModalExclusionTests/ToolkitExcludeDialogFileTest.java b/jdk/test/java/awt/Modal/ModalExclusionTests/ToolkitExcludeDialogFileTest.java
index 78c612d..5b4db15 100644
--- a/jdk/test/java/awt/Modal/ModalExclusionTests/ToolkitExcludeDialogFileTest.java
+++ b/jdk/test/java/awt/Modal/ModalExclusionTests/ToolkitExcludeDialogFileTest.java
@@ -25,6 +25,7 @@
 
 /*
  * @test
+ * @key headful
  * @bug 8047179 8044429
  * @summary Check whether a FileDialog blocks a toolkit modality excluded Dialog
  *          (it shouldn't). Checks also whether setting a parent dialog to be
diff --git a/jdk/test/java/awt/Modal/ModalExclusionTests/ToolkitExcludeDialogPageSetupTest.java b/jdk/test/java/awt/Modal/ModalExclusionTests/ToolkitExcludeDialogPageSetupTest.java
index 4e67f65..aa1b7cc 100644
--- a/jdk/test/java/awt/Modal/ModalExclusionTests/ToolkitExcludeDialogPageSetupTest.java
+++ b/jdk/test/java/awt/Modal/ModalExclusionTests/ToolkitExcludeDialogPageSetupTest.java
@@ -25,6 +25,7 @@
 
 /*
  * @test
+ * @key headful
  * @bug 7125054 8044429
  * @summary Check whether a pageDialog blocks a toolkit modality excluded Dialog
  *          (it shouldn't). Checks also whether setting a parent dialog to be
diff --git a/jdk/test/java/awt/Modal/ModalExclusionTests/ToolkitExcludeDialogPrintSetupTest.java b/jdk/test/java/awt/Modal/ModalExclusionTests/ToolkitExcludeDialogPrintSetupTest.java
index 5f0bd42..2de113b 100644
--- a/jdk/test/java/awt/Modal/ModalExclusionTests/ToolkitExcludeDialogPrintSetupTest.java
+++ b/jdk/test/java/awt/Modal/ModalExclusionTests/ToolkitExcludeDialogPrintSetupTest.java
@@ -25,6 +25,7 @@
 
 /*
  * @test
+ * @key headful
  * @bug 7125054 8044429
  * @summary Check whether a printDialog blocks a toolkit modality excluded Dialog
  *          (it shouldn't). Checks also whether setting a parent dialog to be
diff --git a/jdk/test/java/awt/Modal/ModalExclusionTests/ToolkitExcludeFrameFileTest.java b/jdk/test/java/awt/Modal/ModalExclusionTests/ToolkitExcludeFrameFileTest.java
index ec84508..29c7b6b 100644
--- a/jdk/test/java/awt/Modal/ModalExclusionTests/ToolkitExcludeFrameFileTest.java
+++ b/jdk/test/java/awt/Modal/ModalExclusionTests/ToolkitExcludeFrameFileTest.java
@@ -25,6 +25,7 @@
 
 /*
  * @test
+ * @key headful
  * @bug 8047179 8044429
  * @summary Check whether a FileDialog blocks a toolkit modality excluded Frame
  *          (it shouldn't). Checks also whether setting a parent frame to be
diff --git a/jdk/test/java/awt/Modal/ModalExclusionTests/ToolkitExcludeFramePageSetupTest.java b/jdk/test/java/awt/Modal/ModalExclusionTests/ToolkitExcludeFramePageSetupTest.java
index f26bc8f..f5c18cd 100644
--- a/jdk/test/java/awt/Modal/ModalExclusionTests/ToolkitExcludeFramePageSetupTest.java
+++ b/jdk/test/java/awt/Modal/ModalExclusionTests/ToolkitExcludeFramePageSetupTest.java
@@ -25,6 +25,7 @@
 
 /*
  * @test
+ * @key headful
  * @bug 7125054 8044429
  * @summary Check whether a pageDialog blocks a toolkit modality excluded Frame
  *          (it shouldn't). Checks also whether setting a parent frame to be
diff --git a/jdk/test/java/awt/Modal/ModalExclusionTests/ToolkitExcludeFramePrintSetupTest.java b/jdk/test/java/awt/Modal/ModalExclusionTests/ToolkitExcludeFramePrintSetupTest.java
index 809dd20..cf6c792 100644
--- a/jdk/test/java/awt/Modal/ModalExclusionTests/ToolkitExcludeFramePrintSetupTest.java
+++ b/jdk/test/java/awt/Modal/ModalExclusionTests/ToolkitExcludeFramePrintSetupTest.java
@@ -25,6 +25,7 @@
 
 /*
  * @test
+ * @key headful
  * @bug 7125054 8044429
  * @summary Check whether a printDialog blocks a toolkit modality excluded Frame
  *          (it shouldn't). Checks also whether setting a parent frame to be
diff --git a/jdk/test/java/awt/Modal/ModalFocusTransferTests/FocusTransferDWFAppModalTest.java b/jdk/test/java/awt/Modal/ModalFocusTransferTests/FocusTransferDWFAppModalTest.java
index 20f15fb..7f16a93 100644
--- a/jdk/test/java/awt/Modal/ModalFocusTransferTests/FocusTransferDWFAppModalTest.java
+++ b/jdk/test/java/awt/Modal/ModalFocusTransferTests/FocusTransferDWFAppModalTest.java
@@ -25,6 +25,7 @@
 
 /*
  * @test
+ * @key headful
  * @bug 8047367
  * @summary Check whether the focus transfer between windows occurs correctly when the following
  *          happens: an application modal dialog (D) having null frame owner is shown;
diff --git a/jdk/test/java/awt/Modal/ModalFocusTransferTests/FocusTransferDWFDocModalTest.java b/jdk/test/java/awt/Modal/ModalFocusTransferTests/FocusTransferDWFDocModalTest.java
index bb70a4f..fb08782 100644
--- a/jdk/test/java/awt/Modal/ModalFocusTransferTests/FocusTransferDWFDocModalTest.java
+++ b/jdk/test/java/awt/Modal/ModalFocusTransferTests/FocusTransferDWFDocModalTest.java
@@ -25,6 +25,7 @@
 
 /*
  * @test
+ * @key headful
  * @bug 8047367 8049339
  * @summary Check whether the focus transfer between windows occurs correctly when the
  *          following happens: a document modal dialog (D) having null frame owner is shown;
diff --git a/jdk/test/java/awt/Modal/ModalFocusTransferTests/FocusTransferDWFModelessTest.java b/jdk/test/java/awt/Modal/ModalFocusTransferTests/FocusTransferDWFModelessTest.java
index eb2ca1e..98f4589 100644
--- a/jdk/test/java/awt/Modal/ModalFocusTransferTests/FocusTransferDWFModelessTest.java
+++ b/jdk/test/java/awt/Modal/ModalFocusTransferTests/FocusTransferDWFModelessTest.java
@@ -25,6 +25,7 @@
 
 /*
  * @test
+ * @key headful
  * @bug 8047367 8049339
  * @summary Check whether the focus transfer between windows occurs correctly when the
  *          following happens: a modeless dialog (D) having null frame owner is shown;
diff --git a/jdk/test/java/awt/Modal/ModalFocusTransferTests/FocusTransferDWFNonModalTest.java b/jdk/test/java/awt/Modal/ModalFocusTransferTests/FocusTransferDWFNonModalTest.java
index 697c5c3..4ba23f0 100644
--- a/jdk/test/java/awt/Modal/ModalFocusTransferTests/FocusTransferDWFNonModalTest.java
+++ b/jdk/test/java/awt/Modal/ModalFocusTransferTests/FocusTransferDWFNonModalTest.java
@@ -25,6 +25,7 @@
 
 /*
  * @test
+ * @key headful
  * @bug 8047367 8049339
  * @summary Check whether the focus transfer between windows occurs correctly when the following
  *          happens: a non-modal dialog (D) having null frame owner is shown; a window having D
diff --git a/jdk/test/java/awt/Modal/ModalFocusTransferTests/FocusTransferDialogsAppModalTest.java b/jdk/test/java/awt/Modal/ModalFocusTransferTests/FocusTransferDialogsAppModalTest.java
index 900c388..22905f7 100644
--- a/jdk/test/java/awt/Modal/ModalFocusTransferTests/FocusTransferDialogsAppModalTest.java
+++ b/jdk/test/java/awt/Modal/ModalFocusTransferTests/FocusTransferDialogsAppModalTest.java
@@ -25,6 +25,7 @@
 
 /*
  * @test
+ * @key headful
  * @bug 8047367
  * @summary Check whether the focus transfer between windows occurs correctly when
  *          the following happens: an application modal dialog (D1) having a null
diff --git a/jdk/test/java/awt/Modal/ModalFocusTransferTests/FocusTransferDialogsDocModalTest.java b/jdk/test/java/awt/Modal/ModalFocusTransferTests/FocusTransferDialogsDocModalTest.java
index 62e0458..dba8567 100644
--- a/jdk/test/java/awt/Modal/ModalFocusTransferTests/FocusTransferDialogsDocModalTest.java
+++ b/jdk/test/java/awt/Modal/ModalFocusTransferTests/FocusTransferDialogsDocModalTest.java
@@ -25,6 +25,7 @@
 
 /*
  * @test
+ * @key headful
  * @bug 8047367
  * @summary Check whether the focus transfer between windows occurs correctly when
  *          the following happens: a document modal dialog (D1) having a null
diff --git a/jdk/test/java/awt/Modal/ModalFocusTransferTests/FocusTransferDialogsModelessTest.java b/jdk/test/java/awt/Modal/ModalFocusTransferTests/FocusTransferDialogsModelessTest.java
index 2215b5a..def17c1 100644
--- a/jdk/test/java/awt/Modal/ModalFocusTransferTests/FocusTransferDialogsModelessTest.java
+++ b/jdk/test/java/awt/Modal/ModalFocusTransferTests/FocusTransferDialogsModelessTest.java
@@ -25,6 +25,7 @@
 
 /*
  * @test
+ * @key headful
  * @bug 8047367
  * @summary Check whether the focus transfer between windows occurs correctly when
  *          the following happens: a modeless dialog (D1) having a null
diff --git a/jdk/test/java/awt/Modal/ModalFocusTransferTests/FocusTransferDialogsNonModalTest.java b/jdk/test/java/awt/Modal/ModalFocusTransferTests/FocusTransferDialogsNonModalTest.java
index dc87c0f..20b2a0b 100644
--- a/jdk/test/java/awt/Modal/ModalFocusTransferTests/FocusTransferDialogsNonModalTest.java
+++ b/jdk/test/java/awt/Modal/ModalFocusTransferTests/FocusTransferDialogsNonModalTest.java
@@ -25,6 +25,7 @@
 
 /*
  * @test
+ * @key headful
  * @bug 8047367
  * @summary Check whether the focus transfer between windows occurs correctly when
  *          the following happens: a non-modal dialog (D1) having a null
diff --git a/jdk/test/java/awt/Modal/ModalFocusTransferTests/FocusTransferFDWAppModalTest.java b/jdk/test/java/awt/Modal/ModalFocusTransferTests/FocusTransferFDWAppModalTest.java
index f3fc961..51f189e 100644
--- a/jdk/test/java/awt/Modal/ModalFocusTransferTests/FocusTransferFDWAppModalTest.java
+++ b/jdk/test/java/awt/Modal/ModalFocusTransferTests/FocusTransferFDWAppModalTest.java
@@ -25,6 +25,7 @@
 
 /*
  * @test
+ * @key headful
  * @bug 8047367
  * @summary Check whether the focus transfer between windows occurs correctly when
  *          the following happens: a frame is shown; an application modal dialog (D)
diff --git a/jdk/test/java/awt/Modal/ModalFocusTransferTests/FocusTransferFDWDocModalTest.java b/jdk/test/java/awt/Modal/ModalFocusTransferTests/FocusTransferFDWDocModalTest.java
index 9a163e4..ff5b1eb 100644
--- a/jdk/test/java/awt/Modal/ModalFocusTransferTests/FocusTransferFDWDocModalTest.java
+++ b/jdk/test/java/awt/Modal/ModalFocusTransferTests/FocusTransferFDWDocModalTest.java
@@ -25,6 +25,7 @@
 
 /*
  * @test
+ * @key headful
  * @bug 8047367
  * @summary Check whether the focus transfer between windows occurs correctly when
  *          the following happens: a frame is shown; a document modal dialog (D)
diff --git a/jdk/test/java/awt/Modal/ModalFocusTransferTests/FocusTransferFDWModelessTest.java b/jdk/test/java/awt/Modal/ModalFocusTransferTests/FocusTransferFDWModelessTest.java
index 41dce55..e801611 100644
--- a/jdk/test/java/awt/Modal/ModalFocusTransferTests/FocusTransferFDWModelessTest.java
+++ b/jdk/test/java/awt/Modal/ModalFocusTransferTests/FocusTransferFDWModelessTest.java
@@ -25,6 +25,7 @@
 
 /*
  * @test
+ * @key headful
  * @bug 8047367
  * @summary Check whether the focus transfer between windows occurs correctly when
  *          the following happens: a frame is shown; a modeless dialog (D)
diff --git a/jdk/test/java/awt/Modal/ModalFocusTransferTests/FocusTransferFDWNonModalTest.java b/jdk/test/java/awt/Modal/ModalFocusTransferTests/FocusTransferFDWNonModalTest.java
index 3211762..370ebf3 100644
--- a/jdk/test/java/awt/Modal/ModalFocusTransferTests/FocusTransferFDWNonModalTest.java
+++ b/jdk/test/java/awt/Modal/ModalFocusTransferTests/FocusTransferFDWNonModalTest.java
@@ -25,6 +25,7 @@
 
 /*
  * @test
+ * @key headful
  * @bug 8047367
  * @summary Check whether the focus transfer between windows occurs correctly when
  *          the following happens: a frame is shown; a non-modal dialog (D)
diff --git a/jdk/test/java/awt/Modal/ModalFocusTransferTests/FocusTransferFWDAppModal1Test.java b/jdk/test/java/awt/Modal/ModalFocusTransferTests/FocusTransferFWDAppModal1Test.java
index 121aeb5..8fe9df3 100644
--- a/jdk/test/java/awt/Modal/ModalFocusTransferTests/FocusTransferFWDAppModal1Test.java
+++ b/jdk/test/java/awt/Modal/ModalFocusTransferTests/FocusTransferFWDAppModal1Test.java
@@ -25,6 +25,7 @@
 
 /*
  * @test
+ * @key headful
  * @bug 8047367 8049339
  * @summary Check whether the focus transfer between windows occurs correctly when the following happens:
  *          a frame (F) is shown; a window having F as owner is shown; an application modal dialog having
diff --git a/jdk/test/java/awt/Modal/ModalFocusTransferTests/FocusTransferFWDAppModal2Test.java b/jdk/test/java/awt/Modal/ModalFocusTransferTests/FocusTransferFWDAppModal2Test.java
index ba1ff58..8b4bbd0 100644
--- a/jdk/test/java/awt/Modal/ModalFocusTransferTests/FocusTransferFWDAppModal2Test.java
+++ b/jdk/test/java/awt/Modal/ModalFocusTransferTests/FocusTransferFWDAppModal2Test.java
@@ -25,6 +25,7 @@
 
 /*
  * @test
+ * @key headful
  * @bug 8047367 8049339
  * @summary Check whether the focus transfer between windows occurs correctly when the following happens:
  *          a frame (F) is shown; a window having F as owner is shown; an application modal dialog having
diff --git a/jdk/test/java/awt/Modal/ModalFocusTransferTests/FocusTransferFWDAppModal3Test.java b/jdk/test/java/awt/Modal/ModalFocusTransferTests/FocusTransferFWDAppModal3Test.java
index 5098658..618f8c0 100644
--- a/jdk/test/java/awt/Modal/ModalFocusTransferTests/FocusTransferFWDAppModal3Test.java
+++ b/jdk/test/java/awt/Modal/ModalFocusTransferTests/FocusTransferFWDAppModal3Test.java
@@ -25,6 +25,7 @@
 
 /*
  * @test
+ * @key headful
  * @bug 8047367 8049339
  * @summary Check whether the focus transfer between windows occurs correctly when the following happens:
  *          a frame (F) is shown; a window having F as owner is shown; an application modal dialog having
diff --git a/jdk/test/java/awt/Modal/ModalFocusTransferTests/FocusTransferFWDAppModal4Test.java b/jdk/test/java/awt/Modal/ModalFocusTransferTests/FocusTransferFWDAppModal4Test.java
index f4ae064..855eb8f 100644
--- a/jdk/test/java/awt/Modal/ModalFocusTransferTests/FocusTransferFWDAppModal4Test.java
+++ b/jdk/test/java/awt/Modal/ModalFocusTransferTests/FocusTransferFWDAppModal4Test.java
@@ -25,6 +25,7 @@
 
 /*
  * @test
+ * @key headful
  * @bug 8047367 8049339
  * @summary Check whether the focus transfer between windows occurs correctly when the following happens:
  *          a frame (F) is shown; a window having F as owner is shown; an application modal dialog having
diff --git a/jdk/test/java/awt/Modal/ModalFocusTransferTests/FocusTransferFWDDocModal1Test.java b/jdk/test/java/awt/Modal/ModalFocusTransferTests/FocusTransferFWDDocModal1Test.java
index 4f3958f..dcd587c 100644
--- a/jdk/test/java/awt/Modal/ModalFocusTransferTests/FocusTransferFWDDocModal1Test.java
+++ b/jdk/test/java/awt/Modal/ModalFocusTransferTests/FocusTransferFWDDocModal1Test.java
@@ -25,6 +25,7 @@
 
 /*
  * @test
+ * @key headful
  * @bug 8047367 8049339
  * @summary Check whether the focus transfer between windows occurs correctly when the following happens:
  *          a frame (F) is shown; a window having F as owner is shown; a document modal dialog having
diff --git a/jdk/test/java/awt/Modal/ModalFocusTransferTests/FocusTransferFWDDocModal2Test.java b/jdk/test/java/awt/Modal/ModalFocusTransferTests/FocusTransferFWDDocModal2Test.java
index f68eb0e..7f29559 100644
--- a/jdk/test/java/awt/Modal/ModalFocusTransferTests/FocusTransferFWDDocModal2Test.java
+++ b/jdk/test/java/awt/Modal/ModalFocusTransferTests/FocusTransferFWDDocModal2Test.java
@@ -25,6 +25,7 @@
 
 /*
  * @test
+ * @key headful
  * @bug 8047367 8049339
  * @summary Check whether the focus transfer between windows occurs correctly when the following happens:
  *          a frame (F) is shown; a window having F as owner is shown; a document modal dialog having
diff --git a/jdk/test/java/awt/Modal/ModalFocusTransferTests/FocusTransferFWDDocModal3Test.java b/jdk/test/java/awt/Modal/ModalFocusTransferTests/FocusTransferFWDDocModal3Test.java
index 7ad9e8e..cc0fa6a 100644
--- a/jdk/test/java/awt/Modal/ModalFocusTransferTests/FocusTransferFWDDocModal3Test.java
+++ b/jdk/test/java/awt/Modal/ModalFocusTransferTests/FocusTransferFWDDocModal3Test.java
@@ -25,6 +25,7 @@
 
 /*
  * @test
+ * @key headful
  * @bug 8047367 8049339
  * @summary Check whether the focus transfer between windows occurs correctly when the following happens:
  *          a frame (F) is shown; a window having F as owner is shown; a document modal dialog having
diff --git a/jdk/test/java/awt/Modal/ModalFocusTransferTests/FocusTransferFWDDocModal4Test.java b/jdk/test/java/awt/Modal/ModalFocusTransferTests/FocusTransferFWDDocModal4Test.java
index d689b61..1fd811f 100644
--- a/jdk/test/java/awt/Modal/ModalFocusTransferTests/FocusTransferFWDDocModal4Test.java
+++ b/jdk/test/java/awt/Modal/ModalFocusTransferTests/FocusTransferFWDDocModal4Test.java
@@ -25,6 +25,7 @@
 
 /*
  * @test
+ * @key headful
  * @bug 8047367 8049339
  * @summary Check whether the focus transfer between windows occurs correctly when the following happens:
  *          a frame (F) is shown; a window having F as owner is shown; a document modal dialog having
diff --git a/jdk/test/java/awt/Modal/ModalFocusTransferTests/FocusTransferFWDModeless1Test.java b/jdk/test/java/awt/Modal/ModalFocusTransferTests/FocusTransferFWDModeless1Test.java
index bdf00c0..f1de565 100644
--- a/jdk/test/java/awt/Modal/ModalFocusTransferTests/FocusTransferFWDModeless1Test.java
+++ b/jdk/test/java/awt/Modal/ModalFocusTransferTests/FocusTransferFWDModeless1Test.java
@@ -25,6 +25,7 @@
 
 /*
  * @test
+ * @key headful
  * @bug 8047367 8049339
  * @summary Check whether the focus transfer between windows occurs correctly when the following happens:
  *          a frame (F) is shown; a window having F as owner is shown; a modeless dialog having
diff --git a/jdk/test/java/awt/Modal/ModalFocusTransferTests/FocusTransferFWDModeless2Test.java b/jdk/test/java/awt/Modal/ModalFocusTransferTests/FocusTransferFWDModeless2Test.java
index a1d31e4..0d78e4f 100644
--- a/jdk/test/java/awt/Modal/ModalFocusTransferTests/FocusTransferFWDModeless2Test.java
+++ b/jdk/test/java/awt/Modal/ModalFocusTransferTests/FocusTransferFWDModeless2Test.java
@@ -25,6 +25,7 @@
 
 /*
  * @test
+ * @key headful
  * @bug 8047367 8049339
  * @summary Check whether the focus transfer between windows occurs correctly when the following happens:
  *          a frame (F) is shown; a window having F as owner is shown; a modeless dialog having
diff --git a/jdk/test/java/awt/Modal/ModalFocusTransferTests/FocusTransferFWDModeless3Test.java b/jdk/test/java/awt/Modal/ModalFocusTransferTests/FocusTransferFWDModeless3Test.java
index 6ed6f9e..ae1bcd6 100644
--- a/jdk/test/java/awt/Modal/ModalFocusTransferTests/FocusTransferFWDModeless3Test.java
+++ b/jdk/test/java/awt/Modal/ModalFocusTransferTests/FocusTransferFWDModeless3Test.java
@@ -25,6 +25,7 @@
 
 /*
  * @test
+ * @key headful
  * @bug 8047367 8049339
  * @summary Check whether the focus transfer between windows occurs correctly when the following happens:
  *          a frame (F) is shown; a window having F as owner is shown; a modeless dialog having
diff --git a/jdk/test/java/awt/Modal/ModalFocusTransferTests/FocusTransferFWDModeless4Test.java b/jdk/test/java/awt/Modal/ModalFocusTransferTests/FocusTransferFWDModeless4Test.java
index 956b691..32cbc08 100644
--- a/jdk/test/java/awt/Modal/ModalFocusTransferTests/FocusTransferFWDModeless4Test.java
+++ b/jdk/test/java/awt/Modal/ModalFocusTransferTests/FocusTransferFWDModeless4Test.java
@@ -25,6 +25,7 @@
 
 /*
  * @test
+ * @key headful
  * @bug 8047367 8049339
  * @summary Check whether the focus transfer between windows occurs correctly when the following happens:
  *          a frame (F) is shown; a window having F as owner is shown; a modeless dialog having
diff --git a/jdk/test/java/awt/Modal/ModalFocusTransferTests/FocusTransferFWDNonModal1Test.java b/jdk/test/java/awt/Modal/ModalFocusTransferTests/FocusTransferFWDNonModal1Test.java
index fd06036..7b63ce7 100644
--- a/jdk/test/java/awt/Modal/ModalFocusTransferTests/FocusTransferFWDNonModal1Test.java
+++ b/jdk/test/java/awt/Modal/ModalFocusTransferTests/FocusTransferFWDNonModal1Test.java
@@ -25,6 +25,7 @@
 
 /*
  * @test
+ * @key headful
  * @bug 8047367 8049339
  * @summary Check whether the focus transfer between windows occurs correctly when the following happens:
  *          a frame (F) is shown; a window having F as owner is shown; a non-modal dialog having
diff --git a/jdk/test/java/awt/Modal/ModalFocusTransferTests/FocusTransferFWDNonModal2Test.java b/jdk/test/java/awt/Modal/ModalFocusTransferTests/FocusTransferFWDNonModal2Test.java
index 8228311..241d16e 100644
--- a/jdk/test/java/awt/Modal/ModalFocusTransferTests/FocusTransferFWDNonModal2Test.java
+++ b/jdk/test/java/awt/Modal/ModalFocusTransferTests/FocusTransferFWDNonModal2Test.java
@@ -25,6 +25,7 @@
 
 /*
  * @test
+ * @key headful
  * @bug 8047367 8049339
  * @summary Check whether the focus transfer between windows occurs correctly when the following happens:
  *          a frame (F) is shown; a window having F as owner is shown; a non-modal dialog having
diff --git a/jdk/test/java/awt/Modal/ModalFocusTransferTests/FocusTransferFWDNonModal3Test.java b/jdk/test/java/awt/Modal/ModalFocusTransferTests/FocusTransferFWDNonModal3Test.java
index 4475351..9b57220 100644
--- a/jdk/test/java/awt/Modal/ModalFocusTransferTests/FocusTransferFWDNonModal3Test.java
+++ b/jdk/test/java/awt/Modal/ModalFocusTransferTests/FocusTransferFWDNonModal3Test.java
@@ -25,6 +25,7 @@
 
 /*
  * @test
+ * @key headful
  * @bug 8047367 8049339
  * @summary Check whether the focus transfer between windows occurs correctly when the following happens:
  *          a frame (F) is shown; a window having F as owner is shown; a non-modal dialog having
diff --git a/jdk/test/java/awt/Modal/ModalFocusTransferTests/FocusTransferFWDNonModal4Test.java b/jdk/test/java/awt/Modal/ModalFocusTransferTests/FocusTransferFWDNonModal4Test.java
index 6ceed53..548d429 100644
--- a/jdk/test/java/awt/Modal/ModalFocusTransferTests/FocusTransferFWDNonModal4Test.java
+++ b/jdk/test/java/awt/Modal/ModalFocusTransferTests/FocusTransferFWDNonModal4Test.java
@@ -25,6 +25,7 @@
 
 /*
  * @test
+ * @key headful
  * @bug 8047367 8049339
  * @summary Check whether the focus transfer between windows occurs correctly when the following happens:
  *          a frame (F) is shown; a window having F as owner is shown; a non-modal dialog having
diff --git a/jdk/test/java/awt/Modal/ModalFocusTransferTests/FocusTransferWDFAppModal1Test.java b/jdk/test/java/awt/Modal/ModalFocusTransferTests/FocusTransferWDFAppModal1Test.java
index d235936..8cad428 100644
--- a/jdk/test/java/awt/Modal/ModalFocusTransferTests/FocusTransferWDFAppModal1Test.java
+++ b/jdk/test/java/awt/Modal/ModalFocusTransferTests/FocusTransferWDFAppModal1Test.java
@@ -25,6 +25,7 @@
 
 /*
  * @test
+ * @key headful
  * @bug 8047367
  * @summary Check whether the focus transfer between windows occurs correctly when
  *          the following happens: a window having a hidden frame owner is shown;
diff --git a/jdk/test/java/awt/Modal/ModalFocusTransferTests/FocusTransferWDFAppModal2Test.java b/jdk/test/java/awt/Modal/ModalFocusTransferTests/FocusTransferWDFAppModal2Test.java
index e37420f..ff18a36 100644
--- a/jdk/test/java/awt/Modal/ModalFocusTransferTests/FocusTransferWDFAppModal2Test.java
+++ b/jdk/test/java/awt/Modal/ModalFocusTransferTests/FocusTransferWDFAppModal2Test.java
@@ -25,6 +25,7 @@
 
 /*
  * @test
+ * @key headful
  * @bug 8047367 8048263
  * @summary Check whether the focus transfer between windows occurs correctly when
  *          the following happens: a window having a hidden frame owner is shown;
diff --git a/jdk/test/java/awt/Modal/ModalFocusTransferTests/FocusTransferWDFAppModal3Test.java b/jdk/test/java/awt/Modal/ModalFocusTransferTests/FocusTransferWDFAppModal3Test.java
index f75c869..58679b7 100644
--- a/jdk/test/java/awt/Modal/ModalFocusTransferTests/FocusTransferWDFAppModal3Test.java
+++ b/jdk/test/java/awt/Modal/ModalFocusTransferTests/FocusTransferWDFAppModal3Test.java
@@ -25,6 +25,7 @@
 
 /*
  * @test
+ * @key headful
  * @bug 8047367
  * @summary Check whether the focus transfer between windows occurs correctly when
  *          the following happens: a window having a frame (F) owner is shown;
diff --git a/jdk/test/java/awt/Modal/ModalFocusTransferTests/FocusTransferWDFDocModal1Test.java b/jdk/test/java/awt/Modal/ModalFocusTransferTests/FocusTransferWDFDocModal1Test.java
index cd1e9e8..89b1ce7 100644
--- a/jdk/test/java/awt/Modal/ModalFocusTransferTests/FocusTransferWDFDocModal1Test.java
+++ b/jdk/test/java/awt/Modal/ModalFocusTransferTests/FocusTransferWDFDocModal1Test.java
@@ -25,6 +25,7 @@
 
 /*
  * @test
+ * @key headful
  * @bug 8047367
  * @summary Check whether the focus transfer between windows occurs correctly when
  *          the following happens: a window having a hidden frame owner is shown;
diff --git a/jdk/test/java/awt/Modal/ModalFocusTransferTests/FocusTransferWDFDocModal2Test.java b/jdk/test/java/awt/Modal/ModalFocusTransferTests/FocusTransferWDFDocModal2Test.java
index 9f3a1f8..6f1a848 100644
--- a/jdk/test/java/awt/Modal/ModalFocusTransferTests/FocusTransferWDFDocModal2Test.java
+++ b/jdk/test/java/awt/Modal/ModalFocusTransferTests/FocusTransferWDFDocModal2Test.java
@@ -25,6 +25,7 @@
 
 /*
  * @test
+ * @key headful
  * @bug 8047367
  * @summary Check whether the focus transfer between windows occurs correctly when
  *          the following happens: a window having a hidden frame owner is shown;
diff --git a/jdk/test/java/awt/Modal/ModalFocusTransferTests/FocusTransferWDFDocModal3Test.java b/jdk/test/java/awt/Modal/ModalFocusTransferTests/FocusTransferWDFDocModal3Test.java
index 2c116b0..cf8bafe 100644
--- a/jdk/test/java/awt/Modal/ModalFocusTransferTests/FocusTransferWDFDocModal3Test.java
+++ b/jdk/test/java/awt/Modal/ModalFocusTransferTests/FocusTransferWDFDocModal3Test.java
@@ -25,6 +25,7 @@
 
 /*
  * @test
+ * @key headful
  * @bug 8047367
  * @summary Check whether the focus transfer between windows occurs correctly when
  *          the following happens: a window having a frame (F) owner is shown;
diff --git a/jdk/test/java/awt/Modal/ModalFocusTransferTests/FocusTransferWDFModeless1Test.java b/jdk/test/java/awt/Modal/ModalFocusTransferTests/FocusTransferWDFModeless1Test.java
index 73d36b6..7113c28 100644
--- a/jdk/test/java/awt/Modal/ModalFocusTransferTests/FocusTransferWDFModeless1Test.java
+++ b/jdk/test/java/awt/Modal/ModalFocusTransferTests/FocusTransferWDFModeless1Test.java
@@ -25,6 +25,7 @@
 
 /*
  * @test
+ * @key headful
  * @bug 8047367
  * @summary Check whether the focus transfer between windows occurs correctly when
  *          the following happens: a window having a hidden frame owner is shown;
diff --git a/jdk/test/java/awt/Modal/ModalFocusTransferTests/FocusTransferWDFModeless2Test.java b/jdk/test/java/awt/Modal/ModalFocusTransferTests/FocusTransferWDFModeless2Test.java
index e496e25..f17f239 100644
--- a/jdk/test/java/awt/Modal/ModalFocusTransferTests/FocusTransferWDFModeless2Test.java
+++ b/jdk/test/java/awt/Modal/ModalFocusTransferTests/FocusTransferWDFModeless2Test.java
@@ -25,6 +25,7 @@
 
 /*
  * @test
+ * @key headful
  * @bug 8047367
  * @summary Check whether the focus transfer between windows occurs correctly when
  *          the following happens: a window having a hidden frame owner is shown;
diff --git a/jdk/test/java/awt/Modal/ModalFocusTransferTests/FocusTransferWDFModeless3Test.java b/jdk/test/java/awt/Modal/ModalFocusTransferTests/FocusTransferWDFModeless3Test.java
index df3ff81..dfa56f5 100644
--- a/jdk/test/java/awt/Modal/ModalFocusTransferTests/FocusTransferWDFModeless3Test.java
+++ b/jdk/test/java/awt/Modal/ModalFocusTransferTests/FocusTransferWDFModeless3Test.java
@@ -25,6 +25,7 @@
 
 /*
  * @test
+ * @key headful
  * @bug 8047367
  * @summary Check whether the focus transfer between windows occurs correctly when
  *          the following happens: a window having a frame (F) owner is shown;
diff --git a/jdk/test/java/awt/Modal/ModalFocusTransferTests/FocusTransferWDFNonModal1Test.java b/jdk/test/java/awt/Modal/ModalFocusTransferTests/FocusTransferWDFNonModal1Test.java
index c700a05..75fbd3a 100644
--- a/jdk/test/java/awt/Modal/ModalFocusTransferTests/FocusTransferWDFNonModal1Test.java
+++ b/jdk/test/java/awt/Modal/ModalFocusTransferTests/FocusTransferWDFNonModal1Test.java
@@ -25,6 +25,7 @@
 
 /*
  * @test
+ * @key headful
  * @bug 8047367
  * @summary Check whether the focus transfer between windows occurs correctly when
  *          the following happens: a window having a hidden frame owner is shown;
diff --git a/jdk/test/java/awt/Modal/ModalFocusTransferTests/FocusTransferWDFNonModal2Test.java b/jdk/test/java/awt/Modal/ModalFocusTransferTests/FocusTransferWDFNonModal2Test.java
index 5e36b8d..cac3e96 100644
--- a/jdk/test/java/awt/Modal/ModalFocusTransferTests/FocusTransferWDFNonModal2Test.java
+++ b/jdk/test/java/awt/Modal/ModalFocusTransferTests/FocusTransferWDFNonModal2Test.java
@@ -25,6 +25,7 @@
 
 /*
  * @test
+ * @key headful
  * @bug 8047367
  * @summary Check whether the focus transfer between windows occurs correctly when
  *          the following happens: a window having a hidden frame owner is shown;
diff --git a/jdk/test/java/awt/Modal/ModalFocusTransferTests/FocusTransferWDFNonModal3Test.java b/jdk/test/java/awt/Modal/ModalFocusTransferTests/FocusTransferWDFNonModal3Test.java
index e0d3ebb..5a05a76 100644
--- a/jdk/test/java/awt/Modal/ModalFocusTransferTests/FocusTransferWDFNonModal3Test.java
+++ b/jdk/test/java/awt/Modal/ModalFocusTransferTests/FocusTransferWDFNonModal3Test.java
@@ -25,6 +25,7 @@
 
 /*
  * @test
+ * @key headful
  * @bug 8047367
  * @summary Check whether the focus transfer between windows occurs correctly when
  *          the following happens: a window having a frame (F) owner is shown;
diff --git a/jdk/test/java/awt/Modal/ModalInternalFrameTest/ModalInternalFrameTest.java b/jdk/test/java/awt/Modal/ModalInternalFrameTest/ModalInternalFrameTest.java
index 10d445a..2841401 100644
--- a/jdk/test/java/awt/Modal/ModalInternalFrameTest/ModalInternalFrameTest.java
+++ b/jdk/test/java/awt/Modal/ModalInternalFrameTest/ModalInternalFrameTest.java
@@ -23,6 +23,7 @@
 
 /*
   @test
+  @key headful
   @bug 6518753
   @summary Tests the functionality of modal Swing internal frames
   @author artem.ananiev: area=awt.modal
diff --git a/jdk/test/java/awt/Modal/MultipleDialogs/MultipleDialogs1Test.java b/jdk/test/java/awt/Modal/MultipleDialogs/MultipleDialogs1Test.java
index e7fed02..b8fc67b 100644
--- a/jdk/test/java/awt/Modal/MultipleDialogs/MultipleDialogs1Test.java
+++ b/jdk/test/java/awt/Modal/MultipleDialogs/MultipleDialogs1Test.java
@@ -23,6 +23,7 @@
 
 /*
  * @test
+ * @key headful
  * @bug 8054358
  * @summary Check whether a set of dialogs created with a toolkit excluded Frame
  *          parent has a proper modal blocking behavior. Also show a document modal
diff --git a/jdk/test/java/awt/Modal/MultipleDialogs/MultipleDialogs2Test.java b/jdk/test/java/awt/Modal/MultipleDialogs/MultipleDialogs2Test.java
index 323b4ef..a3e25a5 100644
--- a/jdk/test/java/awt/Modal/MultipleDialogs/MultipleDialogs2Test.java
+++ b/jdk/test/java/awt/Modal/MultipleDialogs/MultipleDialogs2Test.java
@@ -23,6 +23,7 @@
 
 /*
  * @test
+ * @key headful
  * @bug 8054358
  * @summary Check whether a set of dialogs created with an application excluded Frame
  *          parent has a proper modal blocking behavior. Also show a document modal
diff --git a/jdk/test/java/awt/Modal/MultipleDialogs/MultipleDialogs3Test.java b/jdk/test/java/awt/Modal/MultipleDialogs/MultipleDialogs3Test.java
index dc93cda..771bd5f 100644
--- a/jdk/test/java/awt/Modal/MultipleDialogs/MultipleDialogs3Test.java
+++ b/jdk/test/java/awt/Modal/MultipleDialogs/MultipleDialogs3Test.java
@@ -23,6 +23,7 @@
 
 /*
  * @test
+ * @key headful
  * @bug 8054358
  * @summary Check correctness of modal blocking behavior for a chain of Dialogs
  *          having different modality types with a Frame as a document root.
diff --git a/jdk/test/java/awt/Modal/MultipleDialogs/MultipleDialogs4Test.java b/jdk/test/java/awt/Modal/MultipleDialogs/MultipleDialogs4Test.java
index 64abf11..524dada 100644
--- a/jdk/test/java/awt/Modal/MultipleDialogs/MultipleDialogs4Test.java
+++ b/jdk/test/java/awt/Modal/MultipleDialogs/MultipleDialogs4Test.java
@@ -23,6 +23,7 @@
 
 /*
  * @test
+ * @key headful
  * @bug 8054358 8055003
  * @summary Check whether application and document modality levels for Dialog
  *          work properly. Also check whether the blocking dialogs are
diff --git a/jdk/test/java/awt/Modal/MultipleDialogs/MultipleDialogs5Test.java b/jdk/test/java/awt/Modal/MultipleDialogs/MultipleDialogs5Test.java
index 09be718..457940b 100644
--- a/jdk/test/java/awt/Modal/MultipleDialogs/MultipleDialogs5Test.java
+++ b/jdk/test/java/awt/Modal/MultipleDialogs/MultipleDialogs5Test.java
@@ -23,9 +23,10 @@
 
 /*
  * @test
+ * @key headful
  * @bug 8054358
  * @summary This is a simple check if a chain of dialogs having different
-  *         modality types block each other properly.
+ *          modality types block each other properly.
  *
  * @library ../helpers ../../../../lib/testlibrary/
  * @build ExtendedRobot
diff --git a/jdk/test/java/awt/Modal/NullModalityDialogTest/NullModalityDialogTest.java b/jdk/test/java/awt/Modal/NullModalityDialogTest/NullModalityDialogTest.java
index f8632ff..559bea0 100644
--- a/jdk/test/java/awt/Modal/NullModalityDialogTest/NullModalityDialogTest.java
+++ b/jdk/test/java/awt/Modal/NullModalityDialogTest/NullModalityDialogTest.java
@@ -29,6 +29,7 @@
 
 /*
  * @test
+ * @key headful
  * @bug 8047367
  * @summary Check whether a Dialog set with null modality type
  *          behaves like a modeless dialog
diff --git a/jdk/test/java/awt/Modal/OnTop/OnTopAppModal1Test.java b/jdk/test/java/awt/Modal/OnTop/OnTopAppModal1Test.java
index 9ff150c..ce33ec4 100644
--- a/jdk/test/java/awt/Modal/OnTop/OnTopAppModal1Test.java
+++ b/jdk/test/java/awt/Modal/OnTop/OnTopAppModal1Test.java
@@ -25,6 +25,7 @@
 
 /*
  * @test
+ * @key headful
  * @bug 8052012
  * @summary Check whether an application modal Dialog created with null Frame
  *          constructor stays on top of the windows it blocks.
diff --git a/jdk/test/java/awt/Modal/OnTop/OnTopAppModal2Test.java b/jdk/test/java/awt/Modal/OnTop/OnTopAppModal2Test.java
index 21de602..4a09ac7 100644
--- a/jdk/test/java/awt/Modal/OnTop/OnTopAppModal2Test.java
+++ b/jdk/test/java/awt/Modal/OnTop/OnTopAppModal2Test.java
@@ -25,6 +25,7 @@
 
 /*
  * @test
+ * @key headful
  * @bug 8052012
  * @summary Check whether an application modal Dialog created with null Dialog
  *          constructor stays on top of the windows it blocks.
diff --git a/jdk/test/java/awt/Modal/OnTop/OnTopAppModal3Test.java b/jdk/test/java/awt/Modal/OnTop/OnTopAppModal3Test.java
index 9cf58c1..d903fbf 100644
--- a/jdk/test/java/awt/Modal/OnTop/OnTopAppModal3Test.java
+++ b/jdk/test/java/awt/Modal/OnTop/OnTopAppModal3Test.java
@@ -25,6 +25,7 @@
 
 /*
  * @test
+ * @key headful
  * @bug 8052012
  * @summary Check whether an application modal Dialog created with hidden Frame
  *          constructor stays on top of the windows it blocks.
diff --git a/jdk/test/java/awt/Modal/OnTop/OnTopAppModal4Test.java b/jdk/test/java/awt/Modal/OnTop/OnTopAppModal4Test.java
index 0fce109..0e938f6 100644
--- a/jdk/test/java/awt/Modal/OnTop/OnTopAppModal4Test.java
+++ b/jdk/test/java/awt/Modal/OnTop/OnTopAppModal4Test.java
@@ -25,6 +25,7 @@
 
 /*
  * @test
+ * @key headful
  * @bug 8052012
  * @summary Check whether an application modal Dialog created with hidden Dialog
  *          constructor stays on top of the windows it blocks.
diff --git a/jdk/test/java/awt/Modal/OnTop/OnTopAppModal5Test.java b/jdk/test/java/awt/Modal/OnTop/OnTopAppModal5Test.java
index ef0610a..4cc3db6 100644
--- a/jdk/test/java/awt/Modal/OnTop/OnTopAppModal5Test.java
+++ b/jdk/test/java/awt/Modal/OnTop/OnTopAppModal5Test.java
@@ -25,6 +25,7 @@
 
 /*
  * @test
+ * @key headful
  * @bug 8052012
  * @summary Check whether an application modal Dialog created with visible Frame
  *          constructor stays on top of the windows it blocks.
diff --git a/jdk/test/java/awt/Modal/OnTop/OnTopAppModal6Test.java b/jdk/test/java/awt/Modal/OnTop/OnTopAppModal6Test.java
index 730d698..3810416 100644
--- a/jdk/test/java/awt/Modal/OnTop/OnTopAppModal6Test.java
+++ b/jdk/test/java/awt/Modal/OnTop/OnTopAppModal6Test.java
@@ -25,6 +25,7 @@
 
 /*
  * @test
+ * @key headful
  * @bug 8052012
  * @summary Check whether an application modal Dialog created with visible
  *          Dialog constructor stays on top of the windows it blocks.
diff --git a/jdk/test/java/awt/Modal/OnTop/OnTopDocModal1Test.java b/jdk/test/java/awt/Modal/OnTop/OnTopDocModal1Test.java
index c3f8f9d..5ad2a45 100644
--- a/jdk/test/java/awt/Modal/OnTop/OnTopDocModal1Test.java
+++ b/jdk/test/java/awt/Modal/OnTop/OnTopDocModal1Test.java
@@ -25,6 +25,7 @@
 
 /*
  * @test
+ * @key headful
  * @bug 8052012
  * @summary Check whether a document modal Dialog created with null Frame
  *          constructor follows normal Z order.
diff --git a/jdk/test/java/awt/Modal/OnTop/OnTopDocModal2Test.java b/jdk/test/java/awt/Modal/OnTop/OnTopDocModal2Test.java
index 8f6ff61..20c4e3e 100644
--- a/jdk/test/java/awt/Modal/OnTop/OnTopDocModal2Test.java
+++ b/jdk/test/java/awt/Modal/OnTop/OnTopDocModal2Test.java
@@ -25,6 +25,7 @@
 
 /*
  * @test
+ * @key headful
  * @bug 8052012
  * @summary Check whether a document modal Dialog created with null Dialog
  *          constructor follows normal Z order.
diff --git a/jdk/test/java/awt/Modal/OnTop/OnTopDocModal3Test.java b/jdk/test/java/awt/Modal/OnTop/OnTopDocModal3Test.java
index e6b508b..f182e1a 100644
--- a/jdk/test/java/awt/Modal/OnTop/OnTopDocModal3Test.java
+++ b/jdk/test/java/awt/Modal/OnTop/OnTopDocModal3Test.java
@@ -25,6 +25,7 @@
 
 /*
  * @test
+ * @key headful
  * @bug 8052012
  * @summary Check whether a document modal Dialog created with hidden Frame
  *          constructor follows normal Z order.
diff --git a/jdk/test/java/awt/Modal/OnTop/OnTopDocModal4Test.java b/jdk/test/java/awt/Modal/OnTop/OnTopDocModal4Test.java
index 486d60e..ba989c2 100644
--- a/jdk/test/java/awt/Modal/OnTop/OnTopDocModal4Test.java
+++ b/jdk/test/java/awt/Modal/OnTop/OnTopDocModal4Test.java
@@ -25,6 +25,7 @@
 
 /*
  * @test
+ * @key headful
  * @bug 8052012
  * @summary Check whether a document modal Dialog created with hidden Dialog
  *          constructor follows normal Z order.
diff --git a/jdk/test/java/awt/Modal/OnTop/OnTopDocModal5Test.java b/jdk/test/java/awt/Modal/OnTop/OnTopDocModal5Test.java
index 735646e..1b6e80c 100644
--- a/jdk/test/java/awt/Modal/OnTop/OnTopDocModal5Test.java
+++ b/jdk/test/java/awt/Modal/OnTop/OnTopDocModal5Test.java
@@ -25,6 +25,7 @@
 
 /*
  * @test
+ * @key headful
  * @bug 8052012
  * @summary Check whether a document modal Dialog created with visible Frame
  *          constructor stays on top of the windows it blocks.
diff --git a/jdk/test/java/awt/Modal/OnTop/OnTopDocModal6Test.java b/jdk/test/java/awt/Modal/OnTop/OnTopDocModal6Test.java
index 5697006..cbe4e90 100644
--- a/jdk/test/java/awt/Modal/OnTop/OnTopDocModal6Test.java
+++ b/jdk/test/java/awt/Modal/OnTop/OnTopDocModal6Test.java
@@ -25,6 +25,7 @@
 
 /*
  * @test
+ * @key headful
  * @bug 8052012
  * @summary Check whether a document modal Dialog created with visible
  *          Dialog constructor stays on top of the windows it blocks.
diff --git a/jdk/test/java/awt/Modal/OnTop/OnTopModal1Test.java b/jdk/test/java/awt/Modal/OnTop/OnTopModal1Test.java
index 6f817ee..b78e850 100644
--- a/jdk/test/java/awt/Modal/OnTop/OnTopModal1Test.java
+++ b/jdk/test/java/awt/Modal/OnTop/OnTopModal1Test.java
@@ -25,6 +25,7 @@
 
 /*
  * @test
+ * @key headful
  * @bug 8052012
  * @summary Check whether a modal Dialog created with null Frame
  *          constructor stays on top of the windows it blocks.
diff --git a/jdk/test/java/awt/Modal/OnTop/OnTopModal2Test.java b/jdk/test/java/awt/Modal/OnTop/OnTopModal2Test.java
index 6e4799e..805c72a 100644
--- a/jdk/test/java/awt/Modal/OnTop/OnTopModal2Test.java
+++ b/jdk/test/java/awt/Modal/OnTop/OnTopModal2Test.java
@@ -25,6 +25,7 @@
 
 /*
  * @test
+ * @key headful
  * @bug 8052012
  * @summary Check whether a modal Dialog created with null Dialog
  *          constructor stays on top of the windows it blocks.
diff --git a/jdk/test/java/awt/Modal/OnTop/OnTopModal3Test.java b/jdk/test/java/awt/Modal/OnTop/OnTopModal3Test.java
index 5c696b3..bd3f82d 100644
--- a/jdk/test/java/awt/Modal/OnTop/OnTopModal3Test.java
+++ b/jdk/test/java/awt/Modal/OnTop/OnTopModal3Test.java
@@ -25,6 +25,7 @@
 
 /*
  * @test
+ * @key headful
  * @bug 8052012
  * @summary Check whether a modal Dialog created with hidden Frame
  *          constructor stays on top of the windows it blocks.
diff --git a/jdk/test/java/awt/Modal/OnTop/OnTopModal4Test.java b/jdk/test/java/awt/Modal/OnTop/OnTopModal4Test.java
index 770fafb..8284962 100644
--- a/jdk/test/java/awt/Modal/OnTop/OnTopModal4Test.java
+++ b/jdk/test/java/awt/Modal/OnTop/OnTopModal4Test.java
@@ -25,6 +25,7 @@
 
 /*
  * @test
+ * @key headful
  * @bug 8052012
  * @summary Check whether a modal Dialog created with hidden Dialog
  *          constructor stays on top of the windows it blocks.
diff --git a/jdk/test/java/awt/Modal/OnTop/OnTopModal5Test.java b/jdk/test/java/awt/Modal/OnTop/OnTopModal5Test.java
index 1b6fbe7..67219a9 100644
--- a/jdk/test/java/awt/Modal/OnTop/OnTopModal5Test.java
+++ b/jdk/test/java/awt/Modal/OnTop/OnTopModal5Test.java
@@ -25,6 +25,7 @@
 
 /*
  * @test
+ * @key headful
  * @bug 8052012
  * @summary Check whether a modal Dialog created with visible Frame
  *          constructor stays on top of the windows it blocks.
diff --git a/jdk/test/java/awt/Modal/OnTop/OnTopModal6Test.java b/jdk/test/java/awt/Modal/OnTop/OnTopModal6Test.java
index a7d57a6..94a2f16 100644
--- a/jdk/test/java/awt/Modal/OnTop/OnTopModal6Test.java
+++ b/jdk/test/java/awt/Modal/OnTop/OnTopModal6Test.java
@@ -25,6 +25,7 @@
 
 /*
  * @test
+ * @key headful
  * @bug 8052012
  * @summary Check whether a modal Dialog created with visible Dialog
  *          constructor stays on top of the windows it blocks.
diff --git a/jdk/test/java/awt/Modal/OnTop/OnTopModeless1Test.java b/jdk/test/java/awt/Modal/OnTop/OnTopModeless1Test.java
index 723c142..f897721 100644
--- a/jdk/test/java/awt/Modal/OnTop/OnTopModeless1Test.java
+++ b/jdk/test/java/awt/Modal/OnTop/OnTopModeless1Test.java
@@ -25,6 +25,7 @@
 
 /*
  * @test
+ * @key headful
  * @bug 8052012
  * @summary Check whether a modeless Dialog created with a
  *          null Frame constructor follows normal Z Order.
diff --git a/jdk/test/java/awt/Modal/OnTop/OnTopModeless2Test.java b/jdk/test/java/awt/Modal/OnTop/OnTopModeless2Test.java
index dd7d308..352a310 100644
--- a/jdk/test/java/awt/Modal/OnTop/OnTopModeless2Test.java
+++ b/jdk/test/java/awt/Modal/OnTop/OnTopModeless2Test.java
@@ -25,6 +25,7 @@
 
 /*
  * @test
+ * @key headful
  * @bug 8052012
  * @summary Check whether a modeless Dialog created with a
  *          null Dialog constructor follows normal Z Order.
diff --git a/jdk/test/java/awt/Modal/OnTop/OnTopModeless3Test.java b/jdk/test/java/awt/Modal/OnTop/OnTopModeless3Test.java
index 54cf899..6373355 100644
--- a/jdk/test/java/awt/Modal/OnTop/OnTopModeless3Test.java
+++ b/jdk/test/java/awt/Modal/OnTop/OnTopModeless3Test.java
@@ -25,6 +25,7 @@
 
 /*
  * @test
+ * @key headful
  * @bug 8052012
  * @summary Check whether a modeless Dialog created with a
  *          hidden Frame constructor follows normal Z Order.
diff --git a/jdk/test/java/awt/Modal/OnTop/OnTopModeless4Test.java b/jdk/test/java/awt/Modal/OnTop/OnTopModeless4Test.java
index 9b5cfa4..c5864ab 100644
--- a/jdk/test/java/awt/Modal/OnTop/OnTopModeless4Test.java
+++ b/jdk/test/java/awt/Modal/OnTop/OnTopModeless4Test.java
@@ -25,6 +25,7 @@
 
 /*
  * @test
+ * @key headful
  * @bug 8052012
  * @summary Check whether a modeless Dialog created with a
  *          hidden Dialog constructor follows normal Z Order.
diff --git a/jdk/test/java/awt/Modal/OnTop/OnTopModeless5Test.java b/jdk/test/java/awt/Modal/OnTop/OnTopModeless5Test.java
index 9df9a62..ef5d40f 100644
--- a/jdk/test/java/awt/Modal/OnTop/OnTopModeless5Test.java
+++ b/jdk/test/java/awt/Modal/OnTop/OnTopModeless5Test.java
@@ -25,6 +25,7 @@
 
 /*
  * @test
+ * @key headful
  * @bug 8052012
  * @summary Check whether a modeless Dialog created with a
  *          visible Frame constructor follows normal Z Order.
diff --git a/jdk/test/java/awt/Modal/OnTop/OnTopModeless6Test.java b/jdk/test/java/awt/Modal/OnTop/OnTopModeless6Test.java
index e03e6cd..1feef2a 100644
--- a/jdk/test/java/awt/Modal/OnTop/OnTopModeless6Test.java
+++ b/jdk/test/java/awt/Modal/OnTop/OnTopModeless6Test.java
@@ -25,6 +25,7 @@
 
 /*
  * @test
+ * @key headful
  * @bug 8052012
  * @summary Check whether a modeless Dialog created with a visible Dialog
  *          constructor follows a normal Z order.
diff --git a/jdk/test/java/awt/Modal/OnTop/OnTopTKModal1Test.java b/jdk/test/java/awt/Modal/OnTop/OnTopTKModal1Test.java
index 5ab64a6..eb1d702 100644
--- a/jdk/test/java/awt/Modal/OnTop/OnTopTKModal1Test.java
+++ b/jdk/test/java/awt/Modal/OnTop/OnTopTKModal1Test.java
@@ -25,6 +25,7 @@
 
 /*
  * @test
+ * @key headful
  * @bug 8052012
  * @summary Check whether a toolkit modal Dialog created with null Frame
  *          constructor stays on top of the windows it blocks.
diff --git a/jdk/test/java/awt/Modal/OnTop/OnTopTKModal2Test.java b/jdk/test/java/awt/Modal/OnTop/OnTopTKModal2Test.java
index 904e509..e743570 100644
--- a/jdk/test/java/awt/Modal/OnTop/OnTopTKModal2Test.java
+++ b/jdk/test/java/awt/Modal/OnTop/OnTopTKModal2Test.java
@@ -25,6 +25,7 @@
 
 /*
  * @test
+ * @key headful
  * @bug 8052012
  * @summary Check whether a toolkit modal Dialog created with null Dialog
  *          constructor stays on top of the windows it blocks.
diff --git a/jdk/test/java/awt/Modal/OnTop/OnTopTKModal3Test.java b/jdk/test/java/awt/Modal/OnTop/OnTopTKModal3Test.java
index 2ecb970..3d6a908 100644
--- a/jdk/test/java/awt/Modal/OnTop/OnTopTKModal3Test.java
+++ b/jdk/test/java/awt/Modal/OnTop/OnTopTKModal3Test.java
@@ -25,6 +25,7 @@
 
 /*
  * @test
+ * @key headful
  * @bug 8052012
  * @summary Check whether a toolkit modal Dialog created with hidden Frame
  *          constructor stays on top of the windows it blocks.
diff --git a/jdk/test/java/awt/Modal/OnTop/OnTopTKModal4Test.java b/jdk/test/java/awt/Modal/OnTop/OnTopTKModal4Test.java
index f535ab2..2434879 100644
--- a/jdk/test/java/awt/Modal/OnTop/OnTopTKModal4Test.java
+++ b/jdk/test/java/awt/Modal/OnTop/OnTopTKModal4Test.java
@@ -25,6 +25,7 @@
 
 /*
  * @test
+ * @key headful
  * @bug 8052012
  * @summary Check whether a toolkit modal Dialog created with hidden Dialog
  *          constructor stays on top of the windows it blocks.
diff --git a/jdk/test/java/awt/Modal/OnTop/OnTopTKModal5Test.java b/jdk/test/java/awt/Modal/OnTop/OnTopTKModal5Test.java
index 52f860d..c5e85d2 100644
--- a/jdk/test/java/awt/Modal/OnTop/OnTopTKModal5Test.java
+++ b/jdk/test/java/awt/Modal/OnTop/OnTopTKModal5Test.java
@@ -25,6 +25,7 @@
 
 /*
  * @test
+ * @key headful
  * @bug 8052012
  * @summary Check whether a toolkit modal Dialog created with visible Frame
  *          constructor stays on top of the windows it blocks.
diff --git a/jdk/test/java/awt/Modal/OnTop/OnTopTKModal6Test.java b/jdk/test/java/awt/Modal/OnTop/OnTopTKModal6Test.java
index eda000f..e35a499 100644
--- a/jdk/test/java/awt/Modal/OnTop/OnTopTKModal6Test.java
+++ b/jdk/test/java/awt/Modal/OnTop/OnTopTKModal6Test.java
@@ -25,6 +25,7 @@
 
 /*
  * @test
+ * @key headful
  * @bug 8052012
  * @summary Check whether a toolkit modal Dialog created with visible
  *          Dialog constructor stays on top of the windows it blocks.
diff --git a/jdk/test/java/awt/Modal/ToBack/ToBackAppModal1Test.java b/jdk/test/java/awt/Modal/ToBack/ToBackAppModal1Test.java
index 9d60a6d..bba8d40 100644
--- a/jdk/test/java/awt/Modal/ToBack/ToBackAppModal1Test.java
+++ b/jdk/test/java/awt/Modal/ToBack/ToBackAppModal1Test.java
@@ -25,6 +25,7 @@
 
 /*
  * @test
+ * @key headful
  * @bug 8054143
  * @summary Check whether an application modal dialog having a null Frame
  *          constructor still stays on top of the blocked windows even
diff --git a/jdk/test/java/awt/Modal/ToBack/ToBackAppModal2Test.java b/jdk/test/java/awt/Modal/ToBack/ToBackAppModal2Test.java
index d691535..d992375 100644
--- a/jdk/test/java/awt/Modal/ToBack/ToBackAppModal2Test.java
+++ b/jdk/test/java/awt/Modal/ToBack/ToBackAppModal2Test.java
@@ -25,6 +25,7 @@
 
 /*
  * @test
+ * @key headful
  * @bug 8054143
  * @summary Check whether an application modal dialog having a null Dialog
  *          constructor still stays on top of the blocked windows even
diff --git a/jdk/test/java/awt/Modal/ToBack/ToBackAppModal3Test.java b/jdk/test/java/awt/Modal/ToBack/ToBackAppModal3Test.java
index 9db72a77..ab57cd7 100644
--- a/jdk/test/java/awt/Modal/ToBack/ToBackAppModal3Test.java
+++ b/jdk/test/java/awt/Modal/ToBack/ToBackAppModal3Test.java
@@ -25,6 +25,7 @@
 
 /*
  * @test
+ * @key headful
  * @bug 8054143
  * @summary Check whether an application modal dialog having a hidden Frame
  *          constructor still stays on top of the blocked windows even
diff --git a/jdk/test/java/awt/Modal/ToBack/ToBackAppModal4Test.java b/jdk/test/java/awt/Modal/ToBack/ToBackAppModal4Test.java
index eef0e92..7a20e91 100644
--- a/jdk/test/java/awt/Modal/ToBack/ToBackAppModal4Test.java
+++ b/jdk/test/java/awt/Modal/ToBack/ToBackAppModal4Test.java
@@ -25,6 +25,7 @@
 
 /*
  * @test
+ * @key headful
  * @bug 8054143
  * @summary Check whether an application modal dialog having a hidden Dialog
  *          constructor still stays on top of the blocked windows even
diff --git a/jdk/test/java/awt/Modal/ToBack/ToBackAppModal5Test.java b/jdk/test/java/awt/Modal/ToBack/ToBackAppModal5Test.java
index a1b845a..8772441 100644
--- a/jdk/test/java/awt/Modal/ToBack/ToBackAppModal5Test.java
+++ b/jdk/test/java/awt/Modal/ToBack/ToBackAppModal5Test.java
@@ -25,6 +25,7 @@
 
 /*
  * @test
+ * @key headful
  * @bug 8054143
  * @summary Check whether an application modal dialog having a visible Frame
  *          constructor still stays on top of the blocked windows even
diff --git a/jdk/test/java/awt/Modal/ToBack/ToBackAppModal6Test.java b/jdk/test/java/awt/Modal/ToBack/ToBackAppModal6Test.java
index fccb53c..a5f71fe 100644
--- a/jdk/test/java/awt/Modal/ToBack/ToBackAppModal6Test.java
+++ b/jdk/test/java/awt/Modal/ToBack/ToBackAppModal6Test.java
@@ -25,6 +25,7 @@
 
 /*
  * @test
+ * @key headful
  * @bug 8054143
  * @summary Check whether an application modal dialog having a visible Dialog
  *          constructor still stays on top of the blocked windows even
diff --git a/jdk/test/java/awt/Modal/ToBack/ToBackDocModal1Test.java b/jdk/test/java/awt/Modal/ToBack/ToBackDocModal1Test.java
index 27efa65..b7dea73 100644
--- a/jdk/test/java/awt/Modal/ToBack/ToBackDocModal1Test.java
+++ b/jdk/test/java/awt/Modal/ToBack/ToBackDocModal1Test.java
@@ -25,6 +25,7 @@
 
 /*
  * @test
+ * @key headful
  * @bug 8054143
  * @summary Check if toBack method works correctly for
  *          a document modal dialog with null Frame parent.
diff --git a/jdk/test/java/awt/Modal/ToBack/ToBackDocModal2Test.java b/jdk/test/java/awt/Modal/ToBack/ToBackDocModal2Test.java
index 646b5ef..21c3244 100644
--- a/jdk/test/java/awt/Modal/ToBack/ToBackDocModal2Test.java
+++ b/jdk/test/java/awt/Modal/ToBack/ToBackDocModal2Test.java
@@ -25,6 +25,7 @@
 
 /*
  * @test
+ * @key headful
  * @bug 8054143
  * @summary Check if toBack method works correctly for
  *          a document modal dialog with null Dialog parent.
diff --git a/jdk/test/java/awt/Modal/ToBack/ToBackDocModal3Test.java b/jdk/test/java/awt/Modal/ToBack/ToBackDocModal3Test.java
index d79387f..7299428 100644
--- a/jdk/test/java/awt/Modal/ToBack/ToBackDocModal3Test.java
+++ b/jdk/test/java/awt/Modal/ToBack/ToBackDocModal3Test.java
@@ -25,6 +25,7 @@
 
 /*
  * @test
+ * @key headful
  * @bug 8054143
  * @summary Check if toBack method works correctly for
  *          a document modal dialog with hidden Frame parent.
diff --git a/jdk/test/java/awt/Modal/ToBack/ToBackDocModal4Test.java b/jdk/test/java/awt/Modal/ToBack/ToBackDocModal4Test.java
index 2ace153..e1de930 100644
--- a/jdk/test/java/awt/Modal/ToBack/ToBackDocModal4Test.java
+++ b/jdk/test/java/awt/Modal/ToBack/ToBackDocModal4Test.java
@@ -25,6 +25,7 @@
 
 /*
  * @test
+ * @key headful
  * @bug 8054143
  * @summary Check if toBack method works correctly for
  *          a document modal dialog with hidden Dialog parent.
diff --git a/jdk/test/java/awt/Modal/ToBack/ToBackDocModal5Test.java b/jdk/test/java/awt/Modal/ToBack/ToBackDocModal5Test.java
index b2925ea..6256806 100644
--- a/jdk/test/java/awt/Modal/ToBack/ToBackDocModal5Test.java
+++ b/jdk/test/java/awt/Modal/ToBack/ToBackDocModal5Test.java
@@ -25,6 +25,7 @@
 
 /*
  * @test
+ * @key headful
  * @bug 8054143
  * @summary Check whether a document modal dialog having a visible Frame
  *          constructor still stays on top of the blocked windows even
diff --git a/jdk/test/java/awt/Modal/ToBack/ToBackDocModal6Test.java b/jdk/test/java/awt/Modal/ToBack/ToBackDocModal6Test.java
index 6dfc7fb..feedec2 100644
--- a/jdk/test/java/awt/Modal/ToBack/ToBackDocModal6Test.java
+++ b/jdk/test/java/awt/Modal/ToBack/ToBackDocModal6Test.java
@@ -25,6 +25,7 @@
 
 /*
  * @test
+ * @key headful
  * @bug 8054143
  * @summary Check whether a document modal dialog having a visible Dialog
  *          constructor still stays on top of the blocked windows even
diff --git a/jdk/test/java/awt/Modal/ToBack/ToBackModal1Test.java b/jdk/test/java/awt/Modal/ToBack/ToBackModal1Test.java
index f0c4b37..0ac34f3 100644
--- a/jdk/test/java/awt/Modal/ToBack/ToBackModal1Test.java
+++ b/jdk/test/java/awt/Modal/ToBack/ToBackModal1Test.java
@@ -24,6 +24,7 @@
 
 /*
  * @test
+ * @key headful
  * @bug 8054143
  * @summary Check whether a modal dialog having a null Frame
  *          constructor still stays on top of the blocked windows even
diff --git a/jdk/test/java/awt/Modal/ToBack/ToBackModal2Test.java b/jdk/test/java/awt/Modal/ToBack/ToBackModal2Test.java
index 15a45e2..c7f76cb 100644
--- a/jdk/test/java/awt/Modal/ToBack/ToBackModal2Test.java
+++ b/jdk/test/java/awt/Modal/ToBack/ToBackModal2Test.java
@@ -24,6 +24,7 @@
 
 /*
  * @test
+ * @key headful
  * @bug 8054143
  * @summary Check whether a modal dialog having a null Dialog
  *          constructor still stays on top of the blocked windows even
diff --git a/jdk/test/java/awt/Modal/ToBack/ToBackModal3Test.java b/jdk/test/java/awt/Modal/ToBack/ToBackModal3Test.java
index dea6a8a..425ab3a 100644
--- a/jdk/test/java/awt/Modal/ToBack/ToBackModal3Test.java
+++ b/jdk/test/java/awt/Modal/ToBack/ToBackModal3Test.java
@@ -24,6 +24,7 @@
 
 /*
  * @test
+ * @key headful
  * @bug 8054143
  * @summary Check whether a modal dialog having a hidden Frame
  *          constructor still stays on top of the blocked windows even
diff --git a/jdk/test/java/awt/Modal/ToBack/ToBackModal4Test.java b/jdk/test/java/awt/Modal/ToBack/ToBackModal4Test.java
index d9e8577..a6a18ac 100644
--- a/jdk/test/java/awt/Modal/ToBack/ToBackModal4Test.java
+++ b/jdk/test/java/awt/Modal/ToBack/ToBackModal4Test.java
@@ -24,6 +24,7 @@
 
 /*
  * @test
+ * @key headful
  * @bug 8054143
  * @summary Check whether a modal dialog having a hidden Dialog
  *          constructor still stays on top of the blocked windows even
diff --git a/jdk/test/java/awt/Modal/ToBack/ToBackModal5Test.java b/jdk/test/java/awt/Modal/ToBack/ToBackModal5Test.java
index caf58ee..fb5d219 100644
--- a/jdk/test/java/awt/Modal/ToBack/ToBackModal5Test.java
+++ b/jdk/test/java/awt/Modal/ToBack/ToBackModal5Test.java
@@ -24,6 +24,7 @@
 
 /*
  * @test
+ * @key headful
  * @bug 8054143
  * @summary Check whether a modal dialog having a visible Frame
  *          constructor still stays on top of the blocked windows even
diff --git a/jdk/test/java/awt/Modal/ToBack/ToBackModal6Test.java b/jdk/test/java/awt/Modal/ToBack/ToBackModal6Test.java
index 692f904..f4d2a09 100644
--- a/jdk/test/java/awt/Modal/ToBack/ToBackModal6Test.java
+++ b/jdk/test/java/awt/Modal/ToBack/ToBackModal6Test.java
@@ -24,6 +24,7 @@
 
 /*
  * @test
+ * @key headful
  * @bug 8054143
  * @summary Check whether a modal dialog having a visible Dialog
  *          constructor still stays on top of the blocked windows even
diff --git a/jdk/test/java/awt/Modal/ToBack/ToBackModeless1Test.java b/jdk/test/java/awt/Modal/ToBack/ToBackModeless1Test.java
index 1856254..a05c943 100644
--- a/jdk/test/java/awt/Modal/ToBack/ToBackModeless1Test.java
+++ b/jdk/test/java/awt/Modal/ToBack/ToBackModeless1Test.java
@@ -25,6 +25,7 @@
 
 /*
  * @test
+ * @key headful
  * @bug 8054143
  * @summary Check whether a modeless dialog having a null Frame constructor
  *          goes behind other windows when toBack is called for it.
diff --git a/jdk/test/java/awt/Modal/ToBack/ToBackModeless2Test.java b/jdk/test/java/awt/Modal/ToBack/ToBackModeless2Test.java
index b9b0356..40681897 100644
--- a/jdk/test/java/awt/Modal/ToBack/ToBackModeless2Test.java
+++ b/jdk/test/java/awt/Modal/ToBack/ToBackModeless2Test.java
@@ -25,6 +25,7 @@
 
 /*
  * @test
+ * @key headful
  * @bug 8054143
  * @summary Check whether a modeless dialog having a null Dialog constructor
  *          goes behind other windows when toBack is called for it.
diff --git a/jdk/test/java/awt/Modal/ToBack/ToBackModeless3Test.java b/jdk/test/java/awt/Modal/ToBack/ToBackModeless3Test.java
index b6a9380..df9885f 100644
--- a/jdk/test/java/awt/Modal/ToBack/ToBackModeless3Test.java
+++ b/jdk/test/java/awt/Modal/ToBack/ToBackModeless3Test.java
@@ -25,6 +25,7 @@
 
 /*
  * @test
+ * @key headful
  * @bug 8054143
  * @summary Check whether a modeless dialog having a hidden Frame constructor
  *          goes behind other windows when toBack is called for it.
diff --git a/jdk/test/java/awt/Modal/ToBack/ToBackModeless4Test.java b/jdk/test/java/awt/Modal/ToBack/ToBackModeless4Test.java
index 282b509..22218de 100644
--- a/jdk/test/java/awt/Modal/ToBack/ToBackModeless4Test.java
+++ b/jdk/test/java/awt/Modal/ToBack/ToBackModeless4Test.java
@@ -25,6 +25,7 @@
 
 /*
  * @test
+ * @key headful
  * @bug 8054143
  * @summary Check whether a modeless dialog having a hidden Dialog constructor
  *          goes behind other windows when toBack is called for it.
diff --git a/jdk/test/java/awt/Modal/ToBack/ToBackModeless5Test.java b/jdk/test/java/awt/Modal/ToBack/ToBackModeless5Test.java
index 1c38e21..950418b 100644
--- a/jdk/test/java/awt/Modal/ToBack/ToBackModeless5Test.java
+++ b/jdk/test/java/awt/Modal/ToBack/ToBackModeless5Test.java
@@ -25,6 +25,7 @@
 
 /*
  * @test
+ * @key headful
  * @bug 8054143
  * @summary Check if toBack method works correctly for a modeless dialog
  *          having a visible Frame constructor.
diff --git a/jdk/test/java/awt/Modal/ToBack/ToBackModeless6Test.java b/jdk/test/java/awt/Modal/ToBack/ToBackModeless6Test.java
index c5c5305..df56012 100644
--- a/jdk/test/java/awt/Modal/ToBack/ToBackModeless6Test.java
+++ b/jdk/test/java/awt/Modal/ToBack/ToBackModeless6Test.java
@@ -25,6 +25,7 @@
 
 /*
  * @test
+ * @key headful
  * @bug 8054143
  * @summary Check if toBack method works correctly for a modeless dialog
  *          having a visible Dialog constructor.
diff --git a/jdk/test/java/awt/Modal/ToBack/ToBackNonModal1Test.java b/jdk/test/java/awt/Modal/ToBack/ToBackNonModal1Test.java
index 12ea002..c175449 100644
--- a/jdk/test/java/awt/Modal/ToBack/ToBackNonModal1Test.java
+++ b/jdk/test/java/awt/Modal/ToBack/ToBackNonModal1Test.java
@@ -24,6 +24,7 @@
 
 /*
  * @test
+ * @key headful
  * @bug 8054143
  * @summary Check whether a non-modal dialog having a null Frame constructor
  *          goes behind other windows when toBack is called for it.
diff --git a/jdk/test/java/awt/Modal/ToBack/ToBackNonModal2Test.java b/jdk/test/java/awt/Modal/ToBack/ToBackNonModal2Test.java
index 5ccf7a7..e5b8edc 100644
--- a/jdk/test/java/awt/Modal/ToBack/ToBackNonModal2Test.java
+++ b/jdk/test/java/awt/Modal/ToBack/ToBackNonModal2Test.java
@@ -24,6 +24,7 @@
 
 /*
  * @test
+ * @key headful
  * @bug 8054143
  * @summary Check whether a non-modal dialog having a null Dialog constructor
  *          goes behind other windows when toBack is called for it.
diff --git a/jdk/test/java/awt/Modal/ToBack/ToBackNonModal3Test.java b/jdk/test/java/awt/Modal/ToBack/ToBackNonModal3Test.java
index 7bb6829..6b9781a 100644
--- a/jdk/test/java/awt/Modal/ToBack/ToBackNonModal3Test.java
+++ b/jdk/test/java/awt/Modal/ToBack/ToBackNonModal3Test.java
@@ -24,6 +24,7 @@
 
 /*
  * @test
+ * @key headful
  * @bug 8054143
  * @summary Check whether a non-modal dialog having a hidden Frame constructor
  *          goes behind other windows when toBack is called for it.
diff --git a/jdk/test/java/awt/Modal/ToBack/ToBackNonModal4Test.java b/jdk/test/java/awt/Modal/ToBack/ToBackNonModal4Test.java
index d2efc41..00839a6 100644
--- a/jdk/test/java/awt/Modal/ToBack/ToBackNonModal4Test.java
+++ b/jdk/test/java/awt/Modal/ToBack/ToBackNonModal4Test.java
@@ -24,6 +24,7 @@
 
 /*
  * @test
+ * @key headful
  * @bug 8054143
  * @summary Check whether a non-modal dialog having a hidden Dialog constructor
  *          goes behind other windows when toBack is called for it.
diff --git a/jdk/test/java/awt/Modal/ToBack/ToBackNonModal5Test.java b/jdk/test/java/awt/Modal/ToBack/ToBackNonModal5Test.java
index ad1646d..c3fac48 100644
--- a/jdk/test/java/awt/Modal/ToBack/ToBackNonModal5Test.java
+++ b/jdk/test/java/awt/Modal/ToBack/ToBackNonModal5Test.java
@@ -24,6 +24,7 @@
 
 /*
  * @test
+ * @key headful
  * @bug 8054143
  * @summary Check if toBack method works correctly for a non-modal dialog
  *          having a visible Frame constructor.
diff --git a/jdk/test/java/awt/Modal/ToBack/ToBackNonModal6Test.java b/jdk/test/java/awt/Modal/ToBack/ToBackNonModal6Test.java
index b8204da..dda2420 100644
--- a/jdk/test/java/awt/Modal/ToBack/ToBackNonModal6Test.java
+++ b/jdk/test/java/awt/Modal/ToBack/ToBackNonModal6Test.java
@@ -24,6 +24,7 @@
 
 /*
  * @test
+ * @key headful
  * @bug 8054143
  * @summary Check if toBack method works correctly for a non-modal dialog
  *          having a visible Dialog constructor.
diff --git a/jdk/test/java/awt/Modal/ToBack/ToBackTKModal1Test.java b/jdk/test/java/awt/Modal/ToBack/ToBackTKModal1Test.java
index 8052053..e0eeec6 100644
--- a/jdk/test/java/awt/Modal/ToBack/ToBackTKModal1Test.java
+++ b/jdk/test/java/awt/Modal/ToBack/ToBackTKModal1Test.java
@@ -25,6 +25,7 @@
 
 /*
  * @test
+ * @key headful
  * @bug 8054143
  * @summary Check whether a toolkit modal dialog having a null Frame
  *          constructor still stays on top of the blocked windows even
diff --git a/jdk/test/java/awt/Modal/ToBack/ToBackTKModal2Test.java b/jdk/test/java/awt/Modal/ToBack/ToBackTKModal2Test.java
index f2ffdaa..9914428 100644
--- a/jdk/test/java/awt/Modal/ToBack/ToBackTKModal2Test.java
+++ b/jdk/test/java/awt/Modal/ToBack/ToBackTKModal2Test.java
@@ -25,6 +25,7 @@
 
 /*
  * @test
+ * @key headful
  * @bug 8054143
  * @summary Check whether a toolkit modal dialog having a null Dialog
  *          constructor still stays on top of the blocked windows even
diff --git a/jdk/test/java/awt/Modal/ToBack/ToBackTKModal3Test.java b/jdk/test/java/awt/Modal/ToBack/ToBackTKModal3Test.java
index 675fb24..763489c 100644
--- a/jdk/test/java/awt/Modal/ToBack/ToBackTKModal3Test.java
+++ b/jdk/test/java/awt/Modal/ToBack/ToBackTKModal3Test.java
@@ -25,6 +25,7 @@
 
 /*
  * @test
+ * @key headful
  * @bug 8054143
  * @summary Check whether a toolkit modal dialog having a hidden Frame
  *          constructor still stays on top of the blocked windows even
diff --git a/jdk/test/java/awt/Modal/ToBack/ToBackTKModal4Test.java b/jdk/test/java/awt/Modal/ToBack/ToBackTKModal4Test.java
index c78e26d..bb521df 100644
--- a/jdk/test/java/awt/Modal/ToBack/ToBackTKModal4Test.java
+++ b/jdk/test/java/awt/Modal/ToBack/ToBackTKModal4Test.java
@@ -25,6 +25,7 @@
 
 /*
  * @test
+ * @key headful
  * @bug 8054143
  * @summary Check whether a toolkit modal dialog having a hidden Dialog
  *          constructor still stays on top of the blocked windows even
diff --git a/jdk/test/java/awt/Modal/ToBack/ToBackTKModal5Test.java b/jdk/test/java/awt/Modal/ToBack/ToBackTKModal5Test.java
index 5aa519c..675fdc3 100644
--- a/jdk/test/java/awt/Modal/ToBack/ToBackTKModal5Test.java
+++ b/jdk/test/java/awt/Modal/ToBack/ToBackTKModal5Test.java
@@ -25,6 +25,7 @@
 
 /*
  * @test
+ * @key headful
  * @bug 8054143
  * @summary Check whether a toolkit modal dialog having a visible Frame
  *          constructor still stays on top of the blocked windows even
diff --git a/jdk/test/java/awt/Modal/ToBack/ToBackTKModal6Test.java b/jdk/test/java/awt/Modal/ToBack/ToBackTKModal6Test.java
index 6e373a9..d8015a4 100644
--- a/jdk/test/java/awt/Modal/ToBack/ToBackTKModal6Test.java
+++ b/jdk/test/java/awt/Modal/ToBack/ToBackTKModal6Test.java
@@ -25,6 +25,7 @@
 
 /*
  * @test
+ * @key headful
  * @bug 8054143
  * @summary Check whether a toolkit modal dialog having a visible Dialog
  *          constructor still stays on top of the blocked windows even
diff --git a/jdk/test/java/awt/Modal/ToFront/DialogToFrontAppModalTest.java b/jdk/test/java/awt/Modal/ToFront/DialogToFrontAppModalTest.java
index 41d27d9..863ceaa 100644
--- a/jdk/test/java/awt/Modal/ToFront/DialogToFrontAppModalTest.java
+++ b/jdk/test/java/awt/Modal/ToFront/DialogToFrontAppModalTest.java
@@ -25,6 +25,7 @@
 
 /*
  * @test
+ * @key headful
  * @bug 8050885
  * @summary Check that calling toFront method for a dialog in presence of
  *          blocking application modal dialog does not bring it to the top
diff --git a/jdk/test/java/awt/Modal/ToFront/DialogToFrontDocModalTest.java b/jdk/test/java/awt/Modal/ToFront/DialogToFrontDocModalTest.java
index 65cf9ff..a79b620 100644
--- a/jdk/test/java/awt/Modal/ToFront/DialogToFrontDocModalTest.java
+++ b/jdk/test/java/awt/Modal/ToFront/DialogToFrontDocModalTest.java
@@ -25,6 +25,7 @@
 
 /*
  * @test
+ * @key headful
  * @bug 8050885
  * @summary Check that calling toFront method for a dialog in presence of
  *          blocking document modal dialog does not bring it to the top
diff --git a/jdk/test/java/awt/Modal/ToFront/DialogToFrontModalTest.java b/jdk/test/java/awt/Modal/ToFront/DialogToFrontModalTest.java
index 6c20549..8833302 100644
--- a/jdk/test/java/awt/Modal/ToFront/DialogToFrontModalTest.java
+++ b/jdk/test/java/awt/Modal/ToFront/DialogToFrontModalTest.java
@@ -23,6 +23,7 @@
 
 /*
  * @test
+ * @key headful
  * @bug 8050885
  * @summary Check that calling toFront method for a dialog in presence of
  *          blocking modal dialog does not bring it to the top
diff --git a/jdk/test/java/awt/Modal/ToFront/DialogToFrontModeless1Test.java b/jdk/test/java/awt/Modal/ToFront/DialogToFrontModeless1Test.java
index be5da09..56d32dc 100644
--- a/jdk/test/java/awt/Modal/ToFront/DialogToFrontModeless1Test.java
+++ b/jdk/test/java/awt/Modal/ToFront/DialogToFrontModeless1Test.java
@@ -23,6 +23,7 @@
 
 /*
  * @test
+ * @key headful
  * @bug 8050885
  * @summary Check that calling toFront method does not bring a dialog to the top
  *          of a child modeless dialog.
diff --git a/jdk/test/java/awt/Modal/ToFront/DialogToFrontNonModalTest.java b/jdk/test/java/awt/Modal/ToFront/DialogToFrontNonModalTest.java
index 6e6b70f..ef89f22 100644
--- a/jdk/test/java/awt/Modal/ToFront/DialogToFrontNonModalTest.java
+++ b/jdk/test/java/awt/Modal/ToFront/DialogToFrontNonModalTest.java
@@ -23,6 +23,7 @@
 
 /*
  * @test
+ * @key headful
  * @bug 8050885
  * @summary Check that calling toFront method does not bring a dialog to the top
  *          of a non-modal child dialog.
diff --git a/jdk/test/java/awt/Modal/ToFront/DialogToFrontTKModalTest.java b/jdk/test/java/awt/Modal/ToFront/DialogToFrontTKModalTest.java
index c48eac0..c5d3505 100644
--- a/jdk/test/java/awt/Modal/ToFront/DialogToFrontTKModalTest.java
+++ b/jdk/test/java/awt/Modal/ToFront/DialogToFrontTKModalTest.java
@@ -25,6 +25,7 @@
 
 /*
  * @test
+ * @key headful
  * @bug 8050885
  * @summary Check that calling toFront method for a dialog in presence of
  *          blocking toolkit modal dialog does not bring it to the top
diff --git a/jdk/test/java/awt/Modal/ToFront/FrameToFrontAppModal1Test.java b/jdk/test/java/awt/Modal/ToFront/FrameToFrontAppModal1Test.java
index 0b32758..b2192ef 100644
--- a/jdk/test/java/awt/Modal/ToFront/FrameToFrontAppModal1Test.java
+++ b/jdk/test/java/awt/Modal/ToFront/FrameToFrontAppModal1Test.java
@@ -25,6 +25,7 @@
 
 /*
  * @test
+ * @key headful
  * @bug 8050885
  * @summary Check that calling toFront method for a frame in presence of
  *          blocking application modal dialog having a null Frame parent
diff --git a/jdk/test/java/awt/Modal/ToFront/FrameToFrontAppModal2Test.java b/jdk/test/java/awt/Modal/ToFront/FrameToFrontAppModal2Test.java
index 7a8e8eb..e3882ac 100644
--- a/jdk/test/java/awt/Modal/ToFront/FrameToFrontAppModal2Test.java
+++ b/jdk/test/java/awt/Modal/ToFront/FrameToFrontAppModal2Test.java
@@ -25,6 +25,7 @@
 
 /*
  * @test
+ * @key headful
  * @bug 8050885
  * @summary Check that calling toFront method for a frame in presence of
  *          blocking application modal dialog having a null Dialog parent
diff --git a/jdk/test/java/awt/Modal/ToFront/FrameToFrontAppModal3Test.java b/jdk/test/java/awt/Modal/ToFront/FrameToFrontAppModal3Test.java
index d57d1e3..012ee24 100644
--- a/jdk/test/java/awt/Modal/ToFront/FrameToFrontAppModal3Test.java
+++ b/jdk/test/java/awt/Modal/ToFront/FrameToFrontAppModal3Test.java
@@ -25,6 +25,7 @@
 
 /*
  * @test
+ * @key headful
  * @bug 8050885
  * @summary Check that calling toFront method for a frame in presence of
  *          blocking application modal dialog having a hidden Frame parent
diff --git a/jdk/test/java/awt/Modal/ToFront/FrameToFrontAppModal4Test.java b/jdk/test/java/awt/Modal/ToFront/FrameToFrontAppModal4Test.java
index 447a13e..7e26568 100644
--- a/jdk/test/java/awt/Modal/ToFront/FrameToFrontAppModal4Test.java
+++ b/jdk/test/java/awt/Modal/ToFront/FrameToFrontAppModal4Test.java
@@ -25,6 +25,7 @@
 
 /*
  * @test
+ * @key headful
  * @bug 8050885
  * @summary Check that calling toFront method for a frame in presence of
  *          blocking application modal dialog having a hidden Dialog parent
diff --git a/jdk/test/java/awt/Modal/ToFront/FrameToFrontAppModal5Test.java b/jdk/test/java/awt/Modal/ToFront/FrameToFrontAppModal5Test.java
index 3165711..295e0a4 100644
--- a/jdk/test/java/awt/Modal/ToFront/FrameToFrontAppModal5Test.java
+++ b/jdk/test/java/awt/Modal/ToFront/FrameToFrontAppModal5Test.java
@@ -25,6 +25,7 @@
 
 /*
  * @test
+ * @key headful
  * @bug 8050885
  * @summary Check that calling toFront method for a frame in presence of
  *          blocking application modal dialog having a visible Frame parent
diff --git a/jdk/test/java/awt/Modal/ToFront/FrameToFrontDocModal1Test.java b/jdk/test/java/awt/Modal/ToFront/FrameToFrontDocModal1Test.java
index 357be00..dd5a7d1 100644
--- a/jdk/test/java/awt/Modal/ToFront/FrameToFrontDocModal1Test.java
+++ b/jdk/test/java/awt/Modal/ToFront/FrameToFrontDocModal1Test.java
@@ -25,6 +25,7 @@
 
 /*
  * @test
+ * @key headful
  * @bug 8050885
  * @summary Check that calling toFront method for a frame in presence of
  *          blocking document modal dialog having a visible Frame parent
diff --git a/jdk/test/java/awt/Modal/ToFront/FrameToFrontDocModal2Test.java b/jdk/test/java/awt/Modal/ToFront/FrameToFrontDocModal2Test.java
index 4524afb..66d24fa 100644
--- a/jdk/test/java/awt/Modal/ToFront/FrameToFrontDocModal2Test.java
+++ b/jdk/test/java/awt/Modal/ToFront/FrameToFrontDocModal2Test.java
@@ -25,6 +25,7 @@
 
 /*
  * @test
+ * @key headful
  * @bug 8050885
  * @summary Check if toFront method works correctly for a document modal dialog.
  *
diff --git a/jdk/test/java/awt/Modal/ToFront/FrameToFrontModal1Test.java b/jdk/test/java/awt/Modal/ToFront/FrameToFrontModal1Test.java
index eb1d4e7..eb05af8 100644
--- a/jdk/test/java/awt/Modal/ToFront/FrameToFrontModal1Test.java
+++ b/jdk/test/java/awt/Modal/ToFront/FrameToFrontModal1Test.java
@@ -24,6 +24,7 @@
 
 /*
  * @test
+ * @key headful
  * @bug 8050885
  * @summary Check that calling toFront method for a frame in presence of
  *          blocking modal dialog having a null Frame parent
diff --git a/jdk/test/java/awt/Modal/ToFront/FrameToFrontModal2Test.java b/jdk/test/java/awt/Modal/ToFront/FrameToFrontModal2Test.java
index 4e1ab89..bddabdd 100644
--- a/jdk/test/java/awt/Modal/ToFront/FrameToFrontModal2Test.java
+++ b/jdk/test/java/awt/Modal/ToFront/FrameToFrontModal2Test.java
@@ -24,6 +24,7 @@
 
 /*
  * @test
+ * @key headful
  * @bug 8050885
  * @summary Check that calling toFront method for a frame in presence of
  *          blocking modal dialog having a null Dialog parent
diff --git a/jdk/test/java/awt/Modal/ToFront/FrameToFrontModal3Test.java b/jdk/test/java/awt/Modal/ToFront/FrameToFrontModal3Test.java
index da6dc06..84dfe45 100644
--- a/jdk/test/java/awt/Modal/ToFront/FrameToFrontModal3Test.java
+++ b/jdk/test/java/awt/Modal/ToFront/FrameToFrontModal3Test.java
@@ -24,6 +24,7 @@
 
 /*
  * @test
+ * @key headful
  * @bug 8050885
  * @summary Check that calling toFront method for a frame in presence of
  *          blocking modal dialog having a hidden Frame parent
diff --git a/jdk/test/java/awt/Modal/ToFront/FrameToFrontModal4Test.java b/jdk/test/java/awt/Modal/ToFront/FrameToFrontModal4Test.java
index e967d4b..793ad63 100644
--- a/jdk/test/java/awt/Modal/ToFront/FrameToFrontModal4Test.java
+++ b/jdk/test/java/awt/Modal/ToFront/FrameToFrontModal4Test.java
@@ -24,6 +24,7 @@
 
 /*
  * @test
+ * @key headful
  * @bug 8050885
  * @summary Check that calling toFront method for a frame in presence of
  *          blocking modal dialog having a hidden Dialog parent
diff --git a/jdk/test/java/awt/Modal/ToFront/FrameToFrontModal5Test.java b/jdk/test/java/awt/Modal/ToFront/FrameToFrontModal5Test.java
index ba3ae7d..a7e8fea 100644
--- a/jdk/test/java/awt/Modal/ToFront/FrameToFrontModal5Test.java
+++ b/jdk/test/java/awt/Modal/ToFront/FrameToFrontModal5Test.java
@@ -24,6 +24,7 @@
 
 /*
  * @test
+ * @key headful
  * @bug 8050885
  * @summary Check that calling toFront method for a frame in presence of
  *          blocking modal dialog having a visible Frame parent
diff --git a/jdk/test/java/awt/Modal/ToFront/FrameToFrontModeless1Test.java b/jdk/test/java/awt/Modal/ToFront/FrameToFrontModeless1Test.java
index 29be38f..cf04e33 100644
--- a/jdk/test/java/awt/Modal/ToFront/FrameToFrontModeless1Test.java
+++ b/jdk/test/java/awt/Modal/ToFront/FrameToFrontModeless1Test.java
@@ -24,6 +24,7 @@
 
 /*
  * @test
+ * @key headful
  * @bug 8050885
  * @summary Check that calling toFront method does not bring a frame to the top of
  *          a modeless child dialog.
diff --git a/jdk/test/java/awt/Modal/ToFront/FrameToFrontNonModalTest.java b/jdk/test/java/awt/Modal/ToFront/FrameToFrontNonModalTest.java
index 5e16f14..dcc7926 100644
--- a/jdk/test/java/awt/Modal/ToFront/FrameToFrontNonModalTest.java
+++ b/jdk/test/java/awt/Modal/ToFront/FrameToFrontNonModalTest.java
@@ -24,6 +24,7 @@
 
 /*
  * @test
+ * @key headful
  * @bug 8050885
  * @summary Check that calling toFront method does not bring a frame to the top
  *          of a non-modal child dialog.
diff --git a/jdk/test/java/awt/Modal/ToFront/FrameToFrontTKModal1Test.java b/jdk/test/java/awt/Modal/ToFront/FrameToFrontTKModal1Test.java
index 528847e..6972f4b 100644
--- a/jdk/test/java/awt/Modal/ToFront/FrameToFrontTKModal1Test.java
+++ b/jdk/test/java/awt/Modal/ToFront/FrameToFrontTKModal1Test.java
@@ -25,6 +25,7 @@
 
 /*
  * @test
+ * @key headful
  * @bug 8050885
  * @summary Check that calling toFront method for a frame in presence of
  *          blocking modal toolkit dialog having a null Frame parent
diff --git a/jdk/test/java/awt/Modal/ToFront/FrameToFrontTKModal2Test.java b/jdk/test/java/awt/Modal/ToFront/FrameToFrontTKModal2Test.java
index 7cd3122..72db1dc 100644
--- a/jdk/test/java/awt/Modal/ToFront/FrameToFrontTKModal2Test.java
+++ b/jdk/test/java/awt/Modal/ToFront/FrameToFrontTKModal2Test.java
@@ -25,6 +25,7 @@
 
 /*
  * @test
+ * @key headful
  * @bug 8050885
  * @summary Check that calling toFront method for a frame in presence of
  *          blocking toolkit modal dialog having a null Dialog parent
diff --git a/jdk/test/java/awt/Modal/ToFront/FrameToFrontTKModal3Test.java b/jdk/test/java/awt/Modal/ToFront/FrameToFrontTKModal3Test.java
index 90eff04..689bc0d 100644
--- a/jdk/test/java/awt/Modal/ToFront/FrameToFrontTKModal3Test.java
+++ b/jdk/test/java/awt/Modal/ToFront/FrameToFrontTKModal3Test.java
@@ -25,6 +25,7 @@
 
 /*
  * @test
+ * @key headful
  * @bug 8050885
  * @summary Check that calling toFront method for a frame in presence of
  *          blocking toolkit modal dialog having a hidden Frame parent
diff --git a/jdk/test/java/awt/Modal/ToFront/FrameToFrontTKModal4Test.java b/jdk/test/java/awt/Modal/ToFront/FrameToFrontTKModal4Test.java
index 625ced9..b88d0cd 100644
--- a/jdk/test/java/awt/Modal/ToFront/FrameToFrontTKModal4Test.java
+++ b/jdk/test/java/awt/Modal/ToFront/FrameToFrontTKModal4Test.java
@@ -25,6 +25,7 @@
 
 /*
  * @test
+ * @key headful
  * @bug 8050885
  * @summary Check that calling toFront method for a frame in presence of
  *          blocking toolkit modal dialog having a hidden Dialog parent
diff --git a/jdk/test/java/awt/Modal/ToFront/FrameToFrontTKModal5Test.java b/jdk/test/java/awt/Modal/ToFront/FrameToFrontTKModal5Test.java
index 1e91e9a..5b04491 100644
--- a/jdk/test/java/awt/Modal/ToFront/FrameToFrontTKModal5Test.java
+++ b/jdk/test/java/awt/Modal/ToFront/FrameToFrontTKModal5Test.java
@@ -25,6 +25,7 @@
 
 /*
  * @test
+ * @key headful
  * @bug 8050885
  * @summary Check that calling toFront method for a frame in presence of
  *          blocking toolkit modal dialog having a visible Frame parent
diff --git a/jdk/test/java/awt/Mouse/EnterExitEvents/DragWindowOutOfFrameTest.java b/jdk/test/java/awt/Mouse/EnterExitEvents/DragWindowOutOfFrameTest.java
index 8f386fa..1648df9 100644
--- a/jdk/test/java/awt/Mouse/EnterExitEvents/DragWindowOutOfFrameTest.java
+++ b/jdk/test/java/awt/Mouse/EnterExitEvents/DragWindowOutOfFrameTest.java
@@ -23,6 +23,7 @@
 
 /*
  * @test
+ * @key headful
  * @bug 7154048
  * @summary Window created under a mouse does not receive mouse enter event.
  *     Mouse Entered/Exited events should be generated during dragging the window
diff --git a/jdk/test/java/awt/Mouse/EnterExitEvents/DragWindowTest.java b/jdk/test/java/awt/Mouse/EnterExitEvents/DragWindowTest.java
index 909559a..4067bce 100644
--- a/jdk/test/java/awt/Mouse/EnterExitEvents/DragWindowTest.java
+++ b/jdk/test/java/awt/Mouse/EnterExitEvents/DragWindowTest.java
@@ -23,6 +23,7 @@
 
 /*
  * @test
+ * @key headful
  * @bug 7154048
  * @summary Window created under a mouse does not receive mouse enter event.
  *     Mouse Entered/Exited events are wrongly generated during dragging the window
diff --git a/jdk/test/java/awt/Mouse/EnterExitEvents/ResizingFrameTest.java b/jdk/test/java/awt/Mouse/EnterExitEvents/ResizingFrameTest.java
index 2591b39..51e5dd3 100644
--- a/jdk/test/java/awt/Mouse/EnterExitEvents/ResizingFrameTest.java
+++ b/jdk/test/java/awt/Mouse/EnterExitEvents/ResizingFrameTest.java
@@ -23,6 +23,7 @@
 
 /*
  * @test
+ * @key headful
  * @bug 7154048
  * @summary Programmatically resized  window does not receive mouse entered/exited events
  * @author  alexandr.scherbatiy area=awt.event
diff --git a/jdk/test/java/awt/Mouse/GetMousePositionTest/GetMousePositionWithOverlay.java b/jdk/test/java/awt/Mouse/GetMousePositionTest/GetMousePositionWithOverlay.java
index 3cb1b73..a466c03 100644
--- a/jdk/test/java/awt/Mouse/GetMousePositionTest/GetMousePositionWithOverlay.java
+++ b/jdk/test/java/awt/Mouse/GetMousePositionTest/GetMousePositionWithOverlay.java
@@ -29,6 +29,7 @@
 
 /**
  * @test
+ * @key headful
  * @bug 8012026
  * @summary Component.getMousePosition() does not work in an applet on MacOS
  * @author Petr Pchelko
diff --git a/jdk/test/java/awt/Mouse/GetMousePositionTest/GetMousePositionWithPopup.java b/jdk/test/java/awt/Mouse/GetMousePositionTest/GetMousePositionWithPopup.java
index d04b500..7ff5e0f 100644
--- a/jdk/test/java/awt/Mouse/GetMousePositionTest/GetMousePositionWithPopup.java
+++ b/jdk/test/java/awt/Mouse/GetMousePositionTest/GetMousePositionWithPopup.java
@@ -30,6 +30,7 @@
 
 /**
  * @test
+ * @key headful
  * @bug 8012026
  * @summary Component.getMousePosition() does not work in an applet on MacOS
  * @author Petr Pchelko
diff --git a/jdk/test/java/awt/Mouse/MouseComboBoxTest/MouseComboBoxTest.java b/jdk/test/java/awt/Mouse/MouseComboBoxTest/MouseComboBoxTest.java
index 07b798f..3c4eb32 100644
--- a/jdk/test/java/awt/Mouse/MouseComboBoxTest/MouseComboBoxTest.java
+++ b/jdk/test/java/awt/Mouse/MouseComboBoxTest/MouseComboBoxTest.java
@@ -23,6 +23,7 @@
 
 /*
  * @test
+ * @key headful
  * @bug 8032872
  * @summary Tests JComboBox selection via the mouse
  * @author Dmitry Markov
diff --git a/jdk/test/java/awt/Mouse/MouseDragEvent/MouseDraggedTest.java b/jdk/test/java/awt/Mouse/MouseDragEvent/MouseDraggedTest.java
index 0e75224..9e02856 100644
--- a/jdk/test/java/awt/Mouse/MouseDragEvent/MouseDraggedTest.java
+++ b/jdk/test/java/awt/Mouse/MouseDragEvent/MouseDraggedTest.java
@@ -26,6 +26,7 @@
 import javax.swing.*;
 /*
  * @test
+ * @key headful
  * @bug 8080137
  * @summary Dragged events for extra mouse buttons (4,5,6) are not generated
  *            on JSplitPane
diff --git a/jdk/test/java/awt/Mouse/RemovedComponentMouseListener/RemovedComponentMouseListener.java b/jdk/test/java/awt/Mouse/RemovedComponentMouseListener/RemovedComponentMouseListener.java
index 7c5d8b2..8e95cbb 100644
--- a/jdk/test/java/awt/Mouse/RemovedComponentMouseListener/RemovedComponentMouseListener.java
+++ b/jdk/test/java/awt/Mouse/RemovedComponentMouseListener/RemovedComponentMouseListener.java
@@ -23,6 +23,7 @@
 
 /*
  * @test
+ * @key headful
  * @bug 8061636
  * @summary fix for 7079254 changes behavior of MouseListener, MouseMotionListener
  * @library ../../regtesthelpers
diff --git a/jdk/test/java/awt/MouseAdapter/MouseAdapterUnitTest/MouseAdapterUnitTest.java b/jdk/test/java/awt/MouseAdapter/MouseAdapterUnitTest/MouseAdapterUnitTest.java
index da79c61..cf916de 100644
--- a/jdk/test/java/awt/MouseAdapter/MouseAdapterUnitTest/MouseAdapterUnitTest.java
+++ b/jdk/test/java/awt/MouseAdapter/MouseAdapterUnitTest/MouseAdapterUnitTest.java
@@ -23,6 +23,7 @@
 
 /*
   @test
+  @key headful
   @bug 4453162
   @summary MouseAdapter should implement MouseMotionListener and MouseWheelListener
   @author andrei.dmitriev: area=
diff --git a/jdk/test/java/awt/MouseInfo/JContainerMousePositionTest.java b/jdk/test/java/awt/MouseInfo/JContainerMousePositionTest.java
index 211a29d..f04c063 100644
--- a/jdk/test/java/awt/MouseInfo/JContainerMousePositionTest.java
+++ b/jdk/test/java/awt/MouseInfo/JContainerMousePositionTest.java
@@ -23,6 +23,7 @@
 
 /*
   @test
+  @key headful
   @summary unit test for a new method in Container class: getMousePosition(boolean)
   @author dav@sparc.spb.su: area=
   @bug 4009555
diff --git a/jdk/test/java/awt/Multiscreen/LocationRelativeToTest/LocationRelativeToTest.java b/jdk/test/java/awt/Multiscreen/LocationRelativeToTest/LocationRelativeToTest.java
index 705f253..07b1330 100644
--- a/jdk/test/java/awt/Multiscreen/LocationRelativeToTest/LocationRelativeToTest.java
+++ b/jdk/test/java/awt/Multiscreen/LocationRelativeToTest/LocationRelativeToTest.java
@@ -22,15 +22,16 @@
  */
 
 /*
- @test
- @bug 6232687
- @summary Tests that Window.setLocationRelativeTo() method works correctly
-for different multiscreen configurations
- @author artem.ananiev, area=awt.multiscreen
- @library ../../regtesthelpers
- @build Util
- @run main LocationRelativeToTest
-*/
+ * @test
+ * @key headful
+ * @bug 6232687
+ * @summary Tests that Window.setLocationRelativeTo() method works correctly
+ *          for different multiscreen configurations
+ * @author artem.ananiev, area=awt.multiscreen
+ * @library ../../regtesthelpers
+ * @build Util
+ * @run main LocationRelativeToTest
+ */
 
 import java.awt.*;
 import java.awt.event.*;
diff --git a/jdk/test/java/awt/Multiscreen/TranslucencyThrowsExceptionWhenFullScreen/TranslucencyThrowsExceptionWhenFullScreen.java b/jdk/test/java/awt/Multiscreen/TranslucencyThrowsExceptionWhenFullScreen/TranslucencyThrowsExceptionWhenFullScreen.java
index 137f48d..9ba0f8e 100644
--- a/jdk/test/java/awt/Multiscreen/TranslucencyThrowsExceptionWhenFullScreen/TranslucencyThrowsExceptionWhenFullScreen.java
+++ b/jdk/test/java/awt/Multiscreen/TranslucencyThrowsExceptionWhenFullScreen/TranslucencyThrowsExceptionWhenFullScreen.java
@@ -23,6 +23,7 @@
 
 /*
   @test
+  @key headful
   @bug 6838089
   @summary Translucent windows should throw exception in FS mode
   @author dmitry.cherepanov@oracle.com: area=awt-multiscreen
diff --git a/jdk/test/java/awt/Paint/ExposeOnEDT.java b/jdk/test/java/awt/Paint/ExposeOnEDT.java
index 21f7dc0..971735f 100644
--- a/jdk/test/java/awt/Paint/ExposeOnEDT.java
+++ b/jdk/test/java/awt/Paint/ExposeOnEDT.java
@@ -26,6 +26,7 @@
 
 /**
  * @test
+ * @key headful
  * @bug 7090424
  * @author Sergey Bylokhov
  * @library ../../../lib/testlibrary/
diff --git a/jdk/test/java/awt/Paint/PaintNativeOnUpdate.java b/jdk/test/java/awt/Paint/PaintNativeOnUpdate.java
index 6036cd5..a1fb63d 100644
--- a/jdk/test/java/awt/Paint/PaintNativeOnUpdate.java
+++ b/jdk/test/java/awt/Paint/PaintNativeOnUpdate.java
@@ -31,6 +31,7 @@
 
 /**
  * @test
+ * @key headful
  * @bug 7157680
  * @library ../../../lib/testlibrary
  * @build ExtendedRobot
diff --git a/jdk/test/java/awt/Paint/bug8024864.java b/jdk/test/java/awt/Paint/bug8024864.java
index 42580a4..e39ff5d 100644
--- a/jdk/test/java/awt/Paint/bug8024864.java
+++ b/jdk/test/java/awt/Paint/bug8024864.java
@@ -21,7 +21,9 @@
  * questions.
  */
 
-/* @test
+/*
+ * @test
+ * @key headful
  * @bug 8024864 8031422
  * @summary [macosx] Problems with rendering of controls
  * @author Petr Pchelko
diff --git a/jdk/test/java/awt/PrintJob/PrinterException.java b/jdk/test/java/awt/PrintJob/PrinterException.java
index 32fa544..781d011 100644
--- a/jdk/test/java/awt/PrintJob/PrinterException.java
+++ b/jdk/test/java/awt/PrintJob/PrinterException.java
@@ -22,6 +22,7 @@
  */
 /*
  * @test
+ * @key headful
  * @bug 7161283 8158520
  * @summary  Toolkit.getPrintJob throws NPE if no printer available
  * @run main PrinterException
diff --git a/jdk/test/java/awt/Robot/AcceptExtraMouseButtons/AcceptExtraMouseButtons.java b/jdk/test/java/awt/Robot/AcceptExtraMouseButtons/AcceptExtraMouseButtons.java
index 922244b..4d913e4 100644
--- a/jdk/test/java/awt/Robot/AcceptExtraMouseButtons/AcceptExtraMouseButtons.java
+++ b/jdk/test/java/awt/Robot/AcceptExtraMouseButtons/AcceptExtraMouseButtons.java
@@ -23,6 +23,7 @@
 
 /*
   @test %I% %E%
+  @key headful
   @bug 6315717
   @summary verifies that Robot is accepting extra mouse buttons
   @author Andrei Dmitriev : area=awt.mouse
diff --git a/jdk/test/java/awt/Robot/ModifierRobotKey/ModifierRobotEnhancedKeyTest.java b/jdk/test/java/awt/Robot/ModifierRobotKey/ModifierRobotEnhancedKeyTest.java
new file mode 100644
index 0000000..20182d0
--- /dev/null
+++ b/jdk/test/java/awt/Robot/ModifierRobotKey/ModifierRobotEnhancedKeyTest.java
@@ -0,0 +1,257 @@
+/*
+ * Copyright (c) 2007, 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.
+ */
+
+import java.awt.BorderLayout;
+import java.awt.Canvas;
+import java.awt.EventQueue;
+import java.awt.Frame;
+import java.awt.event.FocusAdapter;
+import java.awt.event.FocusEvent;
+import java.awt.event.InputEvent;
+import java.awt.event.KeyAdapter;
+import java.awt.event.KeyEvent;
+import java.awt.event.MouseEvent;
+
+import static jdk.testlibrary.Asserts.assertTrue;
+
+/*
+ * NOTE: this is no intentionally a manual test (i.e. has no test tag) because
+ * even on Windows, the various tested key-combination may get partially
+ * intercepted by other applications and this can leave the whole system in an
+ * inconsistent state. For example on my Windows machine with Intel Graphics
+ * the key combinations "Ctl-Alt-F11" and "Ctl-Alt-F12" triggers some Intel
+ * Graphics utilities by default. If the test is run in such an environment,
+ * some key events of the test are intercepted by those utilities with the
+ * result that the test fails and no more keyboard input will be possible at
+ * all.
+ *
+ * To execute the test add a '@' before the 'test' keyword below to make it a tag.
+ */
+
+/*
+ * test 8155742
+ *
+ * @summary Make sure that modifier key mask is set when robot press
+ *          some key with one or more modifiers.
+ * @library ../../../../lib/testlibrary/
+ * @build ExtendedRobot
+ * @key headful
+ * @run main/timeout=600 ModifierRobotEnhancedKeyTest
+ */
+
+public class ModifierRobotEnhancedKeyTest extends KeyAdapter {
+
+    private boolean focusGained = false;
+    private boolean startTest = false;
+    private ExtendedRobot robot;
+    private Frame frame;
+    private Canvas canvas;
+
+    private volatile boolean tempPress = false;
+
+    private int[] textKeys, modifierKeys, inputMasks;
+    private boolean[] modifierStatus, textStatus;
+
+    private final static int waitDelay = 5000;
+    private Object tempLock = new Object();
+    private Object keyLock = new Object();
+
+    public static void main(String[] args) throws Exception {
+        String os = System.getProperty("os.name").toLowerCase();
+        if (!os.contains("windows")) {
+            System.out.println("*** this test is for windows only because some of the tested key combinations " +
+                               "might be caught by the os and therefore don't reach the canvas ***");
+            return;
+        }
+
+        ModifierRobotEnhancedKeyTest test = new ModifierRobotEnhancedKeyTest();
+        test.doTest();
+    }
+
+    public ModifierRobotEnhancedKeyTest() throws Exception {
+        modifierKeys =  new int[4];
+        modifierKeys[0] = KeyEvent.VK_SHIFT;
+        modifierKeys[1] = KeyEvent.VK_CONTROL;
+        modifierKeys[2] = KeyEvent.VK_ALT;
+        modifierKeys[3] = KeyEvent.VK_ALT_GRAPH;
+
+        inputMasks = new int[4];
+        inputMasks[0] =  InputEvent.SHIFT_MASK;
+        inputMasks[1] =  InputEvent.CTRL_MASK;
+        inputMasks[2] =  InputEvent.ALT_MASK;
+        inputMasks[3] =  InputEvent.ALT_GRAPH_MASK;
+
+        modifierStatus = new boolean[modifierKeys.length];
+
+        textKeys = new int[6];
+        textKeys[0] = KeyEvent.VK_A;
+        textKeys[1] = KeyEvent.VK_S;
+        textKeys[2] = KeyEvent.VK_DELETE;
+        textKeys[3] = KeyEvent.VK_HOME;
+        textKeys[4] = KeyEvent.VK_F12;
+        textKeys[5] = KeyEvent.VK_LEFT;
+
+        textStatus = new boolean[textKeys.length];
+
+        EventQueue.invokeAndWait( () -> { initializeGUI(); });
+    }
+
+    public void keyPressed(KeyEvent event) {
+
+        tempPress = true;
+        synchronized (tempLock) { tempLock.notifyAll(); }
+
+        if (! startTest) {
+            return;
+        }
+        for (int x = 0; x < inputMasks.length; x++) {
+            if ((event.getModifiers() & inputMasks[x]) != 0) {
+                System.out.println("Modifier set: " + event.getKeyModifiersText(inputMasks[x]));
+                modifierStatus[x] = true;
+            }
+        }
+        for (int x = 0; x < textKeys.length; x++) {
+            if (event.getKeyCode() == textKeys[x]) {
+                System.out.println("Text set: " + event.getKeyText(textKeys[x]));
+                textStatus[x] = true;
+            }
+        }
+
+        synchronized (keyLock) { keyLock.notifyAll(); }
+    }
+
+    private void initializeGUI() {
+        frame = new Frame("Test frame");
+        canvas = new Canvas();
+        canvas.addFocusListener(new FocusAdapter() {
+            public void focusGained(FocusEvent event) { focusGained = true; }
+        });
+        canvas.addKeyListener(this);
+        frame.setLayout(new BorderLayout());
+        frame.add(canvas);
+        frame.setSize(200, 200);
+        frame.setVisible(true);
+    }
+
+    public void doTest() throws Exception {
+        robot = new ExtendedRobot();
+
+        robot.mouseMove((int) frame.getLocationOnScreen().getX() + frame.getSize().width / 2,
+                        (int) frame.getLocationOnScreen().getY() + frame.getSize().height / 2);
+        robot.click(MouseEvent.BUTTON1_MASK);
+        robot.waitForIdle();
+
+        assertTrue(focusGained, "FAIL: Canvas gained focus!");
+
+        for (int i = 0; i < modifierKeys.length; i++) {
+            for (int j = 0; j < textKeys.length; j++) {
+                tempPress = false;
+                robot.keyPress(modifierKeys[i]);
+                robot.waitForIdle();
+                if (! tempPress) {
+                    synchronized (tempLock) { tempLock.wait(waitDelay); }
+                }
+                assertTrue(tempPress, "FAIL: keyPressed triggered for i=" + i);
+
+                resetStatus();
+                startTest = true;
+                robot.keyPress(textKeys[j]);
+                robot.waitForIdle();
+                if (! modifierStatus[i] || ! textStatus[j]) {
+                    synchronized (keyLock) { keyLock.wait(waitDelay); }
+                }
+
+
+                assertTrue(modifierStatus[i] && textStatus[j],
+                        "FAIL: KeyEvent not proper!"+
+                        "Key checked: i=" + i + "; j=" + j+
+                        "ModifierStatus = " + modifierStatus[i]+
+                        "TextStatus = " + textStatus[j]);
+                startTest = false;
+                robot.keyRelease(textKeys[j]);
+                robot.waitForIdle();
+                robot.keyRelease(modifierKeys[i]);
+                robot.waitForIdle();
+            }
+        }
+
+        for (int i = 0; i < modifierKeys.length; i++) {
+            for (int j = i + 1; j < modifierKeys.length; j++) {
+                for (int k = 0; k < textKeys.length; k++) {
+                    tempPress = false;
+                    robot.keyPress(modifierKeys[i]);
+                    robot.waitForIdle();
+                    if (! tempPress) {
+                        synchronized (tempLock) { tempLock.wait(waitDelay); }
+                    }
+
+                    assertTrue(tempPress, "FAIL: MultiKeyTest: keyPressed triggered for i=" + i);
+
+                    tempPress = false;
+                    robot.keyPress(modifierKeys[j]);
+                    robot.waitForIdle();
+                    if (! tempPress) {
+                        synchronized (tempLock) { tempLock.wait(waitDelay); }
+                    }
+                    assertTrue(tempPress, "FAIL: MultiKeyTest keyPressed triggered for j=" + j);
+
+                    resetStatus();
+                    startTest = true;
+                    robot.keyPress(textKeys[k]);
+                    robot.waitForIdle();
+                    if (! modifierStatus[i] || ! modifierStatus[j] || ! textStatus[k]) {
+                        synchronized (keyLock) {
+                            keyLock.wait(waitDelay);
+                        }
+                    }
+                    assertTrue(modifierStatus[i] && modifierStatus[j] && textStatus[k],
+                            "FAIL: KeyEvent not proper!"+
+                            "Key checked: i=" + i + "; j=" + j + "; k=" + k+
+                            "Modifier1Status = " + modifierStatus[i]+
+                            "Modifier2Status = " + modifierStatus[j]+
+                            "TextStatus = " + textStatus[k]);
+
+                    startTest = false;
+                    robot.keyRelease(textKeys[k]);
+                    robot.waitForIdle();
+                    robot.keyRelease(modifierKeys[j]);
+                    robot.waitForIdle();
+                    robot.keyRelease(modifierKeys[i]);
+                    robot.waitForIdle();
+                }
+            }
+        }
+
+        frame.dispose();
+    }
+
+    private void resetStatus() {
+        for (int i = 0; i < modifierStatus.length; i++) {
+            modifierStatus[i] = false;
+        }
+        for (int i = 0; i < textStatus.length; i++) {
+            textStatus[i] = false;
+        }
+    }
+
+}
diff --git a/jdk/test/java/awt/Robot/ModifierRobotKey/ModifierRobotKeyTest.java b/jdk/test/java/awt/Robot/ModifierRobotKey/ModifierRobotKeyTest.java
index 1e94147..43e37ef 100644
--- a/jdk/test/java/awt/Robot/ModifierRobotKey/ModifierRobotKeyTest.java
+++ b/jdk/test/java/awt/Robot/ModifierRobotKey/ModifierRobotKeyTest.java
@@ -36,6 +36,7 @@
 
 /*
  * @test 8155742
+ * @key headful
  * @summary Make sure that modifier key mask is set when robot press
  *          some key with one or more modifiers.
  * @library ../../../../lib/testlibrary/
diff --git a/jdk/test/java/awt/TextArea/TextAreaCaretVisibilityTest/bug7129742.java b/jdk/test/java/awt/TextArea/TextAreaCaretVisibilityTest/bug7129742.java
index 02d8919..32217e8 100644
--- a/jdk/test/java/awt/TextArea/TextAreaCaretVisibilityTest/bug7129742.java
+++ b/jdk/test/java/awt/TextArea/TextAreaCaretVisibilityTest/bug7129742.java
@@ -26,7 +26,9 @@
  */
 
 
-/* @test
+/*
+ * @test
+ * @key headful
  * @bug 7129742
  * @summary Focus in non-editable TextArea is not shown on Linux.
  * @requires (os.family == "linux" | os.family == "solaris")
diff --git a/jdk/test/java/awt/TextArea/TextAreaEditing/TextAreaEditing.java b/jdk/test/java/awt/TextArea/TextAreaEditing/TextAreaEditing.java
index 6b7dcfa..71d5d25 100644
--- a/jdk/test/java/awt/TextArea/TextAreaEditing/TextAreaEditing.java
+++ b/jdk/test/java/awt/TextArea/TextAreaEditing/TextAreaEditing.java
@@ -23,6 +23,7 @@
 
 /*
  @test
+ @key headful
  @bug 8040322 8060137
  @library ../../regtesthelpers
  @build Util
diff --git a/jdk/test/java/awt/TextField/TextFieldEditing/TextFieldEditing.java b/jdk/test/java/awt/TextField/TextFieldEditing/TextFieldEditing.java
index 503b6e3..091ab63 100644
--- a/jdk/test/java/awt/TextField/TextFieldEditing/TextFieldEditing.java
+++ b/jdk/test/java/awt/TextField/TextFieldEditing/TextFieldEditing.java
@@ -23,6 +23,7 @@
 
 /*
  @test
+ @key headful
  @bug 8060137
  @library ../../regtesthelpers
  @build Util
diff --git a/jdk/test/java/awt/Toolkit/AutoShutdown/ShowExitTest/ShowExitTest.sh b/jdk/test/java/awt/Toolkit/AutoShutdown/ShowExitTest/ShowExitTest.sh
index 0b83b09..e23120a 100644
--- a/jdk/test/java/awt/Toolkit/AutoShutdown/ShowExitTest/ShowExitTest.sh
+++ b/jdk/test/java/awt/Toolkit/AutoShutdown/ShowExitTest/ShowExitTest.sh
@@ -25,6 +25,7 @@
 
 #
 #   @test       ShowExitTest.sh
+#   @key        headful
 #   @bug        6513421
 #   @summary    Java process does not terminate on closing the Main Application Frame
 #
diff --git a/jdk/test/java/awt/Toolkit/LockingKeyStateTest/LockingKeyStateTest.java b/jdk/test/java/awt/Toolkit/LockingKeyStateTest/LockingKeyStateTest.java
index 37aef35..edd8e0e 100644
--- a/jdk/test/java/awt/Toolkit/LockingKeyStateTest/LockingKeyStateTest.java
+++ b/jdk/test/java/awt/Toolkit/LockingKeyStateTest/LockingKeyStateTest.java
@@ -26,6 +26,7 @@
 
 /*
   @test
+  @key headful
   @summary verify LOCK buttons toogle
   @author Yuri.Nesterenko, Dmitriy.Ermashov
   @library ../../../../lib/testlibrary
diff --git a/jdk/test/java/awt/Toolkit/SecurityTest/SecurityTest2.java b/jdk/test/java/awt/Toolkit/SecurityTest/SecurityTest2.java
index 3424d02..4fa3a7c 100644
--- a/jdk/test/java/awt/Toolkit/SecurityTest/SecurityTest2.java
+++ b/jdk/test/java/awt/Toolkit/SecurityTest/SecurityTest2.java
@@ -22,13 +22,14 @@
  */
 
 /*
-  @test
-  @bug 6599601
-  @summary tests that a simple GUI application runs without any
-exceptions thrown
-  @author Artem.Ananiev area=awt.Toolkit
-  @run main SecurityTest2
-*/
+ * @test
+ * @key headful
+ * @bug 6599601
+ * @summary tests that a simple GUI application runs without any
+ *          exceptions thrown
+ * @author Artem.Ananiev area=awt.Toolkit
+ * @run main SecurityTest2
+ */
 
 import java.awt.*;
 
diff --git a/jdk/test/java/awt/TrayIcon/PopupMenuLeakTest/PopupMenuLeakTest.java b/jdk/test/java/awt/TrayIcon/PopupMenuLeakTest/PopupMenuLeakTest.java
index 5220546..1b60781 100644
--- a/jdk/test/java/awt/TrayIcon/PopupMenuLeakTest/PopupMenuLeakTest.java
+++ b/jdk/test/java/awt/TrayIcon/PopupMenuLeakTest/PopupMenuLeakTest.java
@@ -23,6 +23,7 @@
 
 /*
  @test
+ @key headful
   @bug 8007220
   @summary Reference to the popup leaks after the TrayIcon is removed
   @author Petr Pchelko
diff --git a/jdk/test/java/awt/Window/8027025/Test8027025.java b/jdk/test/java/awt/Window/8027025/Test8027025.java
index e798354..5436b9d 100644
--- a/jdk/test/java/awt/Window/8027025/Test8027025.java
+++ b/jdk/test/java/awt/Window/8027025/Test8027025.java
@@ -21,7 +21,9 @@
  * questions.
  */
 
-/* @test
+/*
+ * @test
+ * @key headful
  * @bug 8027025
  * @summary [macosx] getLocationOnScreen returns 0 if parent invisible
  * @author Petr Pchelko
diff --git a/jdk/test/java/awt/Window/AlwaysOnTop/AlwaysOnTopFieldTest.java b/jdk/test/java/awt/Window/AlwaysOnTop/AlwaysOnTopFieldTest.java
index 5cfaa00..dfba6da 100644
--- a/jdk/test/java/awt/Window/AlwaysOnTop/AlwaysOnTopFieldTest.java
+++ b/jdk/test/java/awt/Window/AlwaysOnTop/AlwaysOnTopFieldTest.java
@@ -26,6 +26,7 @@
 import java.awt.Window;
 /**
  * @test
+ * @key headful
  * @bug 7081594
  * @author Alexander Scherbatiy
  * @summary Windows owned by an always-on-top window DO NOT automatically become always-on-top
@@ -37,7 +38,7 @@
         Robot robot;
         try {
             robot = new Robot();
-        }catch(Exception ex) {
+        } catch(Exception ex) {
             ex.printStackTrace();
             throw new RuntimeException("Unexpected failure");
         }
diff --git a/jdk/test/java/awt/Window/AlwaysOnTop/AutoTestOnTop.java b/jdk/test/java/awt/Window/AlwaysOnTop/AutoTestOnTop.java
index 7fee84f..70dd0a4 100644
--- a/jdk/test/java/awt/Window/AlwaysOnTop/AutoTestOnTop.java
+++ b/jdk/test/java/awt/Window/AlwaysOnTop/AutoTestOnTop.java
@@ -23,6 +23,7 @@
 
 /*
   @test
+  @key headful
   @bug 4632143
   @summary Unit test for the RFE window/frame/dialog always on top
   @author dom@sparc.spb.su: area=awt.toplevel
diff --git a/jdk/test/java/awt/Window/ChildProperties/ChildWindowProperties.java b/jdk/test/java/awt/Window/ChildProperties/ChildWindowProperties.java
index a6a2318..c2ee10f 100644
--- a/jdk/test/java/awt/Window/ChildProperties/ChildWindowProperties.java
+++ b/jdk/test/java/awt/Window/ChildProperties/ChildWindowProperties.java
@@ -21,12 +21,14 @@
  * questions.
  */
 
- /*
- @test
- @bug 8057574
- @summary Verify that child Window does not inherit parent's Properties
- @run main ChildWindowProperties
+/*
+ * @test
+ * @key headful
+ * @bug 8057574
+ * @summary Verify that child Window does not inherit parent's Properties
+ * @run main ChildWindowProperties
  */
+
 import java.awt.Color;
 import java.awt.Dialog;
 import java.awt.Font;
diff --git a/jdk/test/java/awt/Window/GetScreenLocation/GetScreenLocationTest.java b/jdk/test/java/awt/Window/GetScreenLocation/GetScreenLocationTest.java
index 5aba90b..af7940b 100644
--- a/jdk/test/java/awt/Window/GetScreenLocation/GetScreenLocationTest.java
+++ b/jdk/test/java/awt/Window/GetScreenLocation/GetScreenLocationTest.java
@@ -23,8 +23,9 @@
 
 /**
  * @test @summary setLocationRelativeTo stopped working in Ubuntu 13.10 (Unity)
- * @bug 8036915
- * @run main GetScreenLocationTest
+ * @bug 8036915 8161273
+ * @run main/othervm -Dsun.java2d.uiScale=1 GetScreenLocationTest
+ * @run main/othervm -Dsun.java2d.uiScale=2 GetScreenLocationTest
  */
 import java.awt.*;
 
@@ -33,28 +34,28 @@
     public static void main(String[] args) throws Exception {
         Robot robot = new Robot();
         Window frame = null;
-        for(int i = 0; i < 50; i++) {
+        for(int i = 0; i < 30; i++) {
             if(frame != null) frame.dispose();
             frame = new Dialog((Frame)null);
-            frame.setBounds(0, 0, 200, 200);
+            frame.setBounds(0, 0, 200, 100);
             frame.setVisible(true);
             robot.waitForIdle();
             robot.delay(200);
-            frame.setLocation(321, 321);
+            frame.setLocation(321, 121);
             robot.waitForIdle();
             robot.delay(200);
             Dimension size = frame.getSize();
-            if(size.width != 200 || size.height != 200) {
+            if(size.width != 200 || size.height != 100) {
                 frame.dispose();
                 throw new RuntimeException("getSize() is wrong " + size);
             }
             Rectangle r = frame.getBounds();
             frame.dispose();
-            if(r.x != 321 || r.y != 321) {
+            if(r.x != 321 || r.y != 121) {
                 throw new RuntimeException("getLocation() returns " +
                         "wrong coordinates " + r.getLocation());
             }
-            if(r.width != 200 || r.height != 200) {
+            if(r.width != 200 || r.height != 100) {
                 throw new RuntimeException("getSize() is wrong " + r.getSize());
             }
         }
diff --git a/jdk/test/java/awt/Window/MaximizeOffscreen/MaximizeOffscreenTest.java b/jdk/test/java/awt/Window/MaximizeOffscreen/MaximizeOffscreenTest.java
index 78155f3..31d931e 100644
--- a/jdk/test/java/awt/Window/MaximizeOffscreen/MaximizeOffscreenTest.java
+++ b/jdk/test/java/awt/Window/MaximizeOffscreen/MaximizeOffscreenTest.java
@@ -23,6 +23,7 @@
 
 /**
  * @test @summary JVM crash if the frame maximized from offscreen
+ * @key headful
  * @bug 8020210
  * @author Petr Pchelko
  * @library ../../regtesthelpers
diff --git a/jdk/test/java/awt/Window/OwnedWindowsSerialization/OwnedWindowsSerialization.java b/jdk/test/java/awt/Window/OwnedWindowsSerialization/OwnedWindowsSerialization.java
index 9100c50..0b3b799 100644
--- a/jdk/test/java/awt/Window/OwnedWindowsSerialization/OwnedWindowsSerialization.java
+++ b/jdk/test/java/awt/Window/OwnedWindowsSerialization/OwnedWindowsSerialization.java
@@ -28,7 +28,9 @@
 import java.io.ObjectInputStream;
 import java.io.ObjectOutputStream;
 
-/* @test
+/*
+ * @test
+ * @key headful
  * @bug 8027152
  * @summary Checks that ownedWindowList is serialized and deserialized properly and alwaysOnTop works after deserialization
  * @author Petr Pchelko
diff --git a/jdk/test/java/awt/Window/TopLevelLocation/TopLevelLocation.java b/jdk/test/java/awt/Window/TopLevelLocation/TopLevelLocation.java
index 9e229b7..1530188 100644
--- a/jdk/test/java/awt/Window/TopLevelLocation/TopLevelLocation.java
+++ b/jdk/test/java/awt/Window/TopLevelLocation/TopLevelLocation.java
@@ -23,6 +23,7 @@
 
 /**
  * @test
+ * @key headful
  * @bug 8027628
  * @author Oleg Pekhovskiy
  * @summary JWindow jumps to (0, 0) after mouse clicked
diff --git a/jdk/test/java/awt/Window/WindowGCInFullScreen/WindowGCInFullScreen.java b/jdk/test/java/awt/Window/WindowGCInFullScreen/WindowGCInFullScreen.java
index 2b044de..edc7bce 100644
--- a/jdk/test/java/awt/Window/WindowGCInFullScreen/WindowGCInFullScreen.java
+++ b/jdk/test/java/awt/Window/WindowGCInFullScreen/WindowGCInFullScreen.java
@@ -32,6 +32,7 @@
 
 /**
  * @test
+ * @key headful
  * @bug 8019591
  * @author Sergey Bylokhov
  */
diff --git a/jdk/test/java/awt/Window/WindowJumpingTest/WindowJumpingTest.java b/jdk/test/java/awt/Window/WindowJumpingTest/WindowJumpingTest.java
index f2e2100..f73f058 100644
--- a/jdk/test/java/awt/Window/WindowJumpingTest/WindowJumpingTest.java
+++ b/jdk/test/java/awt/Window/WindowJumpingTest/WindowJumpingTest.java
@@ -21,7 +21,9 @@
  * questions.
  */
 
-/* @test
+/*
+ * @test
+ * @key headful
  * @bug 8080729
  * @summary Dialogs on multiscreen jump to parent frame on focus gain
  * @author Dmitry Markov
diff --git a/jdk/test/java/awt/Window/WindowsLeak/WindowsLeak.java b/jdk/test/java/awt/Window/WindowsLeak/WindowsLeak.java
index 584025f..7dca9e9 100644
--- a/jdk/test/java/awt/Window/WindowsLeak/WindowsLeak.java
+++ b/jdk/test/java/awt/Window/WindowsLeak/WindowsLeak.java
@@ -23,6 +23,7 @@
 
 /*
  * @test
+ * @key headful
  * @bug 8013563 8028486
  * @summary Tests that windows are removed from windows list
  * @library /javax/swing/regtesthelpers
diff --git a/jdk/test/java/awt/datatransfer/DataFlavor/NullDataFlavorTest.java b/jdk/test/java/awt/datatransfer/DataFlavor/NullDataFlavorTest.java
index 6880f3e..4b7ab84 100644
--- a/jdk/test/java/awt/datatransfer/DataFlavor/NullDataFlavorTest.java
+++ b/jdk/test/java/awt/datatransfer/DataFlavor/NullDataFlavorTest.java
@@ -23,6 +23,7 @@
 
 /*
   @test
+  @key headful
   @bug 4682039
   @summary Tests that DataTransferer.getFormatsForFlavors() does not throw
            NullPointerException if some of given as parameter data flavors
diff --git a/jdk/test/java/awt/datatransfer/UnicodeTransferTest/UnicodeTransferTest.java b/jdk/test/java/awt/datatransfer/UnicodeTransferTest/UnicodeTransferTest.java
index 844ca26..3a7ea0c 100644
--- a/jdk/test/java/awt/datatransfer/UnicodeTransferTest/UnicodeTransferTest.java
+++ b/jdk/test/java/awt/datatransfer/UnicodeTransferTest/UnicodeTransferTest.java
@@ -24,6 +24,7 @@
 
 /*
   @test
+  @key headful
   @bug 4718897
   @summary tests that a Unicode string can be transferred between JVMs.
   @author das@sparc.spb.su area=datatransfer
diff --git a/jdk/test/java/awt/dnd/AcceptDropMultipleTimes/AcceptDropMultipleTimes.java b/jdk/test/java/awt/dnd/AcceptDropMultipleTimes/AcceptDropMultipleTimes.java
index a2a4f51..f632be7 100644
--- a/jdk/test/java/awt/dnd/AcceptDropMultipleTimes/AcceptDropMultipleTimes.java
+++ b/jdk/test/java/awt/dnd/AcceptDropMultipleTimes/AcceptDropMultipleTimes.java
@@ -23,6 +23,7 @@
 
 /**
  * @test
+ * @key headful
  * @bug 8029979
  * @summary Checks if acceptDrop() can be called several times
  * @library ../../regtesthelpers
diff --git a/jdk/test/java/awt/dnd/DisposeFrameOnDragCrash/DisposeFrameOnDragTest.java b/jdk/test/java/awt/dnd/DisposeFrameOnDragCrash/DisposeFrameOnDragTest.java
index bfeb4bd..93a1bad 100644
--- a/jdk/test/java/awt/dnd/DisposeFrameOnDragCrash/DisposeFrameOnDragTest.java
+++ b/jdk/test/java/awt/dnd/DisposeFrameOnDragCrash/DisposeFrameOnDragTest.java
@@ -23,6 +23,7 @@
 
 /**
  * @test @summary JVM crash if the frame is disposed in DropTargetListener
+ * @key headful
  * @author Petr Pchelko
  * @library ../../regtesthelpers
  * @build Util
diff --git a/jdk/test/java/awt/dnd/DropTargetEnterExitTest/ExtraDragEnterTest.java b/jdk/test/java/awt/dnd/DropTargetEnterExitTest/ExtraDragEnterTest.java
index 16d938f..cafd01b 100644
--- a/jdk/test/java/awt/dnd/DropTargetEnterExitTest/ExtraDragEnterTest.java
+++ b/jdk/test/java/awt/dnd/DropTargetEnterExitTest/ExtraDragEnterTest.java
@@ -23,6 +23,7 @@
 
 /**
  * @test
+ * @key headful
  * @bug 8024163
  * @summary Checks the dragEnter event is correctly generated
  * @library ../../regtesthelpers
diff --git a/jdk/test/java/awt/dnd/DropTargetEnterExitTest/MissedDragExitTest.java b/jdk/test/java/awt/dnd/DropTargetEnterExitTest/MissedDragExitTest.java
index 3863667..7b53573 100644
--- a/jdk/test/java/awt/dnd/DropTargetEnterExitTest/MissedDragExitTest.java
+++ b/jdk/test/java/awt/dnd/DropTargetEnterExitTest/MissedDragExitTest.java
@@ -23,6 +23,7 @@
 
 /**
  * @test
+ * @key headful
  * @bug 8024163
  * @summary Checks that dragExit is generated when the new DropTarget is created under the drag
  * @library ../../regtesthelpers
diff --git a/jdk/test/java/awt/dnd/MissingDragExitEventTest/MissingDragExitEventTest.java b/jdk/test/java/awt/dnd/MissingDragExitEventTest/MissingDragExitEventTest.java
index 8854c7d..5a5b225 100644
--- a/jdk/test/java/awt/dnd/MissingDragExitEventTest/MissingDragExitEventTest.java
+++ b/jdk/test/java/awt/dnd/MissingDragExitEventTest/MissingDragExitEventTest.java
@@ -23,6 +23,7 @@
 
 /**
  * @test
+ * @key headful
  * @bug 8027913
  * @library ../../regtesthelpers
  * @build Util
diff --git a/jdk/test/java/awt/event/KeyEvent/AltCharAcceleratorTest/AltCharAcceleratorTest.java b/jdk/test/java/awt/event/KeyEvent/AltCharAcceleratorTest/AltCharAcceleratorTest.java
index 9eac602..50b86b3 100644
--- a/jdk/test/java/awt/event/KeyEvent/AltCharAcceleratorTest/AltCharAcceleratorTest.java
+++ b/jdk/test/java/awt/event/KeyEvent/AltCharAcceleratorTest/AltCharAcceleratorTest.java
@@ -22,13 +22,14 @@
  */
 
 /*
-@test
-@bug 8068283
-@summary Checks that <Alt>+Char accelerators work when pressed in a text component
-@author Anton Nashatyrev
-@modules java.desktop/sun.awt
-@run main AltCharAcceleratorTest
-*/
+ * @test
+ * @key headful
+ * @bug 8068283
+ * @summary Checks that <Alt>+Char accelerators work when pressed in a text component
+ * @author Anton Nashatyrev
+ * @modules java.desktop/sun.awt
+ * @run main AltCharAcceleratorTest
+ */
 
 import javax.swing.*;
 import java.awt.*;
diff --git a/jdk/test/java/awt/event/KeyEvent/CorrectTime/CorrectTime.java b/jdk/test/java/awt/event/KeyEvent/CorrectTime/CorrectTime.java
index 259f1fc..9b2c904 100644
--- a/jdk/test/java/awt/event/KeyEvent/CorrectTime/CorrectTime.java
+++ b/jdk/test/java/awt/event/KeyEvent/CorrectTime/CorrectTime.java
@@ -23,6 +23,7 @@
 
 /*
   @test
+  @key headful
   @bug 6451578
   @library ../../../regtesthelpers
   @build Sysout AbstractTest Util
diff --git a/jdk/test/java/awt/event/KeyEvent/ExtendedKeyCode/ExtendedKeyCodeTest.java b/jdk/test/java/awt/event/KeyEvent/ExtendedKeyCode/ExtendedKeyCodeTest.java
index 8acf2e4..8c4a38e 100644
--- a/jdk/test/java/awt/event/KeyEvent/ExtendedKeyCode/ExtendedKeyCodeTest.java
+++ b/jdk/test/java/awt/event/KeyEvent/ExtendedKeyCode/ExtendedKeyCodeTest.java
@@ -28,6 +28,7 @@
 
 /*
  * @test
+ * @key headful
  * @bug 8007156 8025126
  * @summary Extended key code is not set for a key event
  * @author Alexandr Scherbatiy
diff --git a/jdk/test/java/awt/event/KeyEvent/ExtendedModifiersTest/ExtendedModifiersTest.java b/jdk/test/java/awt/event/KeyEvent/ExtendedModifiersTest/ExtendedModifiersTest.java
index ee473ea..dd9786e 100644
--- a/jdk/test/java/awt/event/KeyEvent/ExtendedModifiersTest/ExtendedModifiersTest.java
+++ b/jdk/test/java/awt/event/KeyEvent/ExtendedModifiersTest/ExtendedModifiersTest.java
@@ -24,6 +24,7 @@
 
 /*
  * @test
+ * @key headful
  * @bug 8043126 8145116
  * @summary Check whether
  *          1. correct extended modifiers are returned
@@ -281,4 +282,4 @@
         ExtendedModifiersTest test = new ExtendedModifiersTest();
         test.doTest();
     }
-}
\ No newline at end of file
+}
diff --git a/jdk/test/java/awt/event/KeyEvent/KeyMaskTest/KeyMaskTest.java b/jdk/test/java/awt/event/KeyEvent/KeyMaskTest/KeyMaskTest.java
index 3400444..2b8dc0d 100644
--- a/jdk/test/java/awt/event/KeyEvent/KeyMaskTest/KeyMaskTest.java
+++ b/jdk/test/java/awt/event/KeyEvent/KeyMaskTest/KeyMaskTest.java
@@ -24,6 +24,7 @@
 
 /*
  * @test
+ * @key headful
  * @bug 8043126
  * @summary Check whether KeyEvent.getModifiers() returns correct modifiers
  *          when Ctrl, Alt or Shift keys are pressed.
diff --git a/jdk/test/java/awt/event/KeyEvent/SwallowKeyEvents/SwallowKeyEvents.java b/jdk/test/java/awt/event/KeyEvent/SwallowKeyEvents/SwallowKeyEvents.java
index 5b62bf6..ddf5a0f 100644
--- a/jdk/test/java/awt/event/KeyEvent/SwallowKeyEvents/SwallowKeyEvents.java
+++ b/jdk/test/java/awt/event/KeyEvent/SwallowKeyEvents/SwallowKeyEvents.java
@@ -23,6 +23,7 @@
 
 /*
   @test
+  @key headful
   @bug       7154072 7161320
   @summary   Tests that key events with modifiers are not swallowed.
   @author    anton.tarasov: area=awt.focus
diff --git a/jdk/test/java/awt/event/MouseEvent/DisabledComponents/DisabledComponentsTest.java b/jdk/test/java/awt/event/MouseEvent/DisabledComponents/DisabledComponentsTest.java
index 3da25c6..d16cd41 100644
--- a/jdk/test/java/awt/event/MouseEvent/DisabledComponents/DisabledComponentsTest.java
+++ b/jdk/test/java/awt/event/MouseEvent/DisabledComponents/DisabledComponentsTest.java
@@ -23,6 +23,7 @@
 
 /*
   @test
+  @key headful
   @bug 4173714
   @summary java.awt.button behaves differently under Win32/Solaris
   @author tdv@sparc.spb.su
diff --git a/jdk/test/java/awt/event/MouseEvent/EnterAsGrabbedEvent/EnterAsGrabbedEvent.java b/jdk/test/java/awt/event/MouseEvent/EnterAsGrabbedEvent/EnterAsGrabbedEvent.java
index 8f62e4f..9757b40 100644
--- a/jdk/test/java/awt/event/MouseEvent/EnterAsGrabbedEvent/EnterAsGrabbedEvent.java
+++ b/jdk/test/java/awt/event/MouseEvent/EnterAsGrabbedEvent/EnterAsGrabbedEvent.java
@@ -23,6 +23,7 @@
 
 /*
   @test
+  @key headful
   @bug 6317481 8012325
   @summary REG:Pressing the mouse, dragging and releasing it outside the button triggers ActionEvent, XAWT
   @author Dmitry.Cherepanov@SUN.COM area=awt.event
diff --git a/jdk/test/java/awt/event/MouseEvent/MouseButtonsAndKeyMasksTest/MouseButtonsAndKeyMasksTest.java b/jdk/test/java/awt/event/MouseEvent/MouseButtonsAndKeyMasksTest/MouseButtonsAndKeyMasksTest.java
index 850679c..8733b3a 100644
--- a/jdk/test/java/awt/event/MouseEvent/MouseButtonsAndKeyMasksTest/MouseButtonsAndKeyMasksTest.java
+++ b/jdk/test/java/awt/event/MouseEvent/MouseButtonsAndKeyMasksTest/MouseButtonsAndKeyMasksTest.java
@@ -40,6 +40,7 @@
 
 /*
  * @test
+ * @key headful
  * @bug 8043126
  * @summary Check whether MouseEvent.getModifiers(), MouseEvent.getModifiersEx()
  *          and KeyEvent.getModifiers() return correct modifiers when pressing
diff --git a/jdk/test/java/awt/event/MouseEvent/MouseButtonsTest/MouseButtonsTest.java b/jdk/test/java/awt/event/MouseEvent/MouseButtonsTest/MouseButtonsTest.java
index cc36b0c..49459e4 100644
--- a/jdk/test/java/awt/event/MouseEvent/MouseButtonsTest/MouseButtonsTest.java
+++ b/jdk/test/java/awt/event/MouseEvent/MouseButtonsTest/MouseButtonsTest.java
@@ -38,6 +38,7 @@
 
 /*
  * @test
+ * @key headful
  * @bug 8043126
  * @summary Check whether getButton() returns correct mouse button
  *          number when the mouse buttons are pressed and getModifiers()
diff --git a/jdk/test/java/awt/event/MouseEvent/MultipleMouseButtonsTest/MultipleMouseButtonsTest.java b/jdk/test/java/awt/event/MouseEvent/MultipleMouseButtonsTest/MultipleMouseButtonsTest.java
index df143b7..11527a3 100644
--- a/jdk/test/java/awt/event/MouseEvent/MultipleMouseButtonsTest/MultipleMouseButtonsTest.java
+++ b/jdk/test/java/awt/event/MouseEvent/MultipleMouseButtonsTest/MultipleMouseButtonsTest.java
@@ -32,6 +32,7 @@
 
 /*
  * @test
+ * @key headful
  * @bug 8043126
  * @summary Check whether correct modifiers set when multiple mouse buttons were pressed;
  *          check number of received events.
diff --git a/jdk/test/java/awt/event/MouseEvent/SpuriousExitEnter/SpuriousExitEnter_3.java b/jdk/test/java/awt/event/MouseEvent/SpuriousExitEnter/SpuriousExitEnter_3.java
index 42695a5..d942395 100644
--- a/jdk/test/java/awt/event/MouseEvent/SpuriousExitEnter/SpuriousExitEnter_3.java
+++ b/jdk/test/java/awt/event/MouseEvent/SpuriousExitEnter/SpuriousExitEnter_3.java
@@ -23,6 +23,7 @@
 
 /*
   @test
+  @key headful
   @bug 6479820
   @library ../../../regtesthelpers
   @build Util
diff --git a/jdk/test/java/awt/event/MouseWheelEvent/InfiniteRecursion/InfiniteRecursion.java b/jdk/test/java/awt/event/MouseWheelEvent/InfiniteRecursion/InfiniteRecursion.java
index f0efaf1..e2c42d3 100644
--- a/jdk/test/java/awt/event/MouseWheelEvent/InfiniteRecursion/InfiniteRecursion.java
+++ b/jdk/test/java/awt/event/MouseWheelEvent/InfiniteRecursion/InfiniteRecursion.java
@@ -23,6 +23,7 @@
 
 /*
   @test
+  @key headful
   @bug 6480024
   @library ../../../regtesthelpers
   @build Util Sysout AbstractTest
diff --git a/jdk/test/java/awt/event/MouseWheelEvent/InfiniteRecursion/InfiniteRecursion_1.java b/jdk/test/java/awt/event/MouseWheelEvent/InfiniteRecursion/InfiniteRecursion_1.java
index 0b6639a..c5f7d17 100644
--- a/jdk/test/java/awt/event/MouseWheelEvent/InfiniteRecursion/InfiniteRecursion_1.java
+++ b/jdk/test/java/awt/event/MouseWheelEvent/InfiniteRecursion/InfiniteRecursion_1.java
@@ -23,6 +23,7 @@
 
 /*
   @test
+  @key headful
   @bug 6480024
   @library ../../../regtesthelpers
   @build Util Sysout AbstractTest
diff --git a/jdk/test/java/awt/event/MouseWheelEvent/InfiniteRecursion/InfiniteRecursion_4.java b/jdk/test/java/awt/event/MouseWheelEvent/InfiniteRecursion/InfiniteRecursion_4.java
index bf8fa1b..5dd576f 100644
--- a/jdk/test/java/awt/event/MouseWheelEvent/InfiniteRecursion/InfiniteRecursion_4.java
+++ b/jdk/test/java/awt/event/MouseWheelEvent/InfiniteRecursion/InfiniteRecursion_4.java
@@ -23,6 +23,7 @@
 
 /*
   @test
+  @key headful
   @bug 6480024
   @library ../../../regtesthelpers
   @build Util Sysout AbstractTest
diff --git a/jdk/test/java/awt/event/MouseWheelEvent/WheelModifier/WheelModifier.java b/jdk/test/java/awt/event/MouseWheelEvent/WheelModifier/WheelModifier.java
index 28fd50a..8f16b03 100644
--- a/jdk/test/java/awt/event/MouseWheelEvent/WheelModifier/WheelModifier.java
+++ b/jdk/test/java/awt/event/MouseWheelEvent/WheelModifier/WheelModifier.java
@@ -21,11 +21,14 @@
  * questions.
  */
 
-/* @test
+/*
+   @test
+   @key headful
    @bug 8041470
    @summary JButtons stay pressed after they have lost focus if you use the mouse wheel
    @author Anton Nashatyrev
-*/
+ */
+
 import javax.swing.*;
 import java.awt.*;
 import java.awt.event.*;
diff --git a/jdk/test/java/awt/event/TextEvent/TextEventSequenceTest/TextEventSequenceTest.java b/jdk/test/java/awt/event/TextEvent/TextEventSequenceTest/TextEventSequenceTest.java
index 0c06ba1..416d88e 100644
--- a/jdk/test/java/awt/event/TextEvent/TextEventSequenceTest/TextEventSequenceTest.java
+++ b/jdk/test/java/awt/event/TextEvent/TextEventSequenceTest/TextEventSequenceTest.java
@@ -23,6 +23,7 @@
 
 /*
  * @test
+ * @key headful
  * @bug 4028580
  * @summary TextArea does not send TextEvent when setText. Does for insert
  * @author kdm@sparc.spb.su: area= awt.TextAvent
diff --git a/jdk/test/java/awt/grab/GrabOnUnfocusableToplevel/GrabOnUnfocusableToplevel.java b/jdk/test/java/awt/grab/GrabOnUnfocusableToplevel/GrabOnUnfocusableToplevel.java
index 8810351..04b21ec 100644
--- a/jdk/test/java/awt/grab/GrabOnUnfocusableToplevel/GrabOnUnfocusableToplevel.java
+++ b/jdk/test/java/awt/grab/GrabOnUnfocusableToplevel/GrabOnUnfocusableToplevel.java
@@ -23,6 +23,7 @@
 
 /*
   @test
+  @key headful
   @bug 6539458
   @summary JPopupMenu does not display if invoker is instance of JWindow
   @author oleg.sukhodolsky area=awt.grab
diff --git a/jdk/test/java/awt/im/memoryleak/InputContextMemoryLeakTest.java b/jdk/test/java/awt/im/memoryleak/InputContextMemoryLeakTest.java
index 04e4a33..a557702 100644
--- a/jdk/test/java/awt/im/memoryleak/InputContextMemoryLeakTest.java
+++ b/jdk/test/java/awt/im/memoryleak/InputContextMemoryLeakTest.java
@@ -36,6 +36,7 @@
 
 /*
  @test
+ @key headful
  @bug 7079260
  @summary XInputContext leaks memory by needRecetXXIClient field
  @author Petr Pchelko
diff --git a/jdk/test/java/awt/image/LookupOp/RasterOpNullDestinationRasterTest.java b/jdk/test/java/awt/image/LookupOp/RasterOpNullDestinationRasterTest.java
new file mode 100644
index 0000000..dd705ad
--- /dev/null
+++ b/jdk/test/java/awt/image/LookupOp/RasterOpNullDestinationRasterTest.java
@@ -0,0 +1,61 @@
+/*
+ * 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.
+ */
+
+/*
+ * @test
+ * @bug 6427331
+ * @summary Test to check there is no NullPointerException raised if
+ * null raster is provided as destination in case of RasterOp.filter()
+ * @run main RasterOpNullDestinationRasterTest
+ */
+
+import java.awt.Point;
+import java.awt.image.ByteLookupTable;
+import java.awt.image.DataBuffer;
+import java.awt.image.DataBufferByte;
+import java.awt.image.LookupOp;
+import java.awt.image.PixelInterleavedSampleModel;
+import java.awt.image.Raster;
+import java.awt.image.RasterOp;
+import java.awt.image.SampleModel;
+
+public class RasterOpNullDestinationRasterTest {
+
+    public static void main(String[] args) {
+
+        byte[][] data = new byte[1][10];
+        ByteLookupTable lut = new ByteLookupTable(0, data);
+        RasterOp op = new LookupOp(lut, null);
+
+        int[] bandOffsets = {0};
+        Point location = new Point(0, 0);
+        DataBuffer db = new DataBufferByte(10 * 10);
+        SampleModel sm = new PixelInterleavedSampleModel(DataBuffer.TYPE_BYTE,
+                                                         10, 10, 1, 10,
+                                                         bandOffsets);
+
+        Raster src = Raster.createRaster(sm, db, location);
+
+        op.filter(src, null); // this used to result in NullPointerException
+    }
+}
diff --git a/jdk/test/java/awt/image/multiresolution/MenuMultiresolutionIconTest.java b/jdk/test/java/awt/image/multiresolution/MenuMultiresolutionIconTest.java
index 9a09f5c..a50940c 100644
--- a/jdk/test/java/awt/image/multiresolution/MenuMultiresolutionIconTest.java
+++ b/jdk/test/java/awt/image/multiresolution/MenuMultiresolutionIconTest.java
@@ -23,6 +23,7 @@
 
 /*
  * @test
+ * @key headful
  * @bug 8150258
  * @author a.stepanov
  * @summary Check that correct resolution variants are chosen for menu icons
diff --git a/jdk/test/java/awt/image/multiresolution/MultiResolutionIcon/IconTest.java b/jdk/test/java/awt/image/multiresolution/MultiResolutionIcon/IconTest.java
new file mode 100644
index 0000000..985041f
--- /dev/null
+++ b/jdk/test/java/awt/image/multiresolution/MultiResolutionIcon/IconTest.java
@@ -0,0 +1,163 @@
+/**
+ * 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.
+ */
+
+/**
+ * @test
+ * @bug 8147648
+ * @summary [hidpi] multiresolution image: wrong resolution variant is used as
+ * icon in the Unity panel
+ * @run main/othervm -Dsun.java2d.uiScale=2 IconTest
+ */
+import java.awt.Color;
+import java.awt.Graphics;
+import java.awt.GridBagConstraints;
+import java.awt.GridBagLayout;
+import java.awt.event.ActionEvent;
+import java.awt.event.ActionListener;
+import java.awt.event.WindowAdapter;
+import java.awt.event.WindowEvent;
+import java.awt.image.BaseMultiResolutionImage;
+import java.awt.image.BufferedImage;
+import java.util.concurrent.CountDownLatch;
+import javax.swing.ImageIcon;
+import javax.swing.JButton;
+import javax.swing.JFrame;
+import javax.swing.JLabel;
+import javax.swing.JPanel;
+import javax.swing.SwingUtilities;
+
+public class IconTest {
+
+    private final static int SZ = 8;
+    private static GridBagLayout layout;
+    private static JPanel mainControlPanel;
+    private static JPanel resultButtonPanel;
+    private static JLabel instructionText;
+    private static JButton passButton;
+    private static JButton failButton;
+    private static JButton testButton;
+    private static JFrame f;
+    private static CountDownLatch latch;
+
+    private static BufferedImage generateImage(int scale, Color c) {
+        int x = SZ * scale;
+        BufferedImage img = new BufferedImage(x, x, BufferedImage.TYPE_INT_RGB);
+        Graphics g = img.getGraphics();
+        try {
+            if (g != null) {
+                g.setColor(c);
+                g.fillRect(0, 0, x, x);
+                g.setColor(Color.YELLOW);
+                g.drawRect(0, 0, x-1, x-1);
+            }
+        } finally {
+            g.dispose();
+        }
+        return img;
+    }
+
+
+    private static void createUI() throws Exception {
+        SwingUtilities.invokeAndWait(new Runnable() {
+            public void run() {
+                f = new JFrame("TrayIcon Test");
+
+                final BaseMultiResolutionImage IMG = new BaseMultiResolutionImage(
+                        new BufferedImage[]{generateImage(1, Color.RED), generateImage(2, Color.BLUE)});
+                layout = new GridBagLayout();
+                mainControlPanel = new JPanel(layout);
+                resultButtonPanel = new JPanel(layout);
+                f.setIconImage(IMG);
+                GridBagConstraints gbc = new GridBagConstraints();
+                String instructions
+                        = "<html>INSTRUCTIONS:<br>"
+                        + "Check if test button and unity icons are both blue with yellow border.<br><br>"
+                        + "If Icon color is blue press pass"
+                        + " else press fail.<br><br></html>";
+
+                instructionText = new JLabel();
+                instructionText.setText(instructions);
+
+                gbc.gridx = 0;
+                gbc.gridy = 0;
+                gbc.fill = GridBagConstraints.HORIZONTAL;
+                mainControlPanel.add(instructionText, gbc);
+                testButton = new JButton("Test");
+                testButton.setActionCommand("Test");
+                mainControlPanel.add(testButton, gbc);
+
+                testButton.setIcon(new ImageIcon(IMG));
+                gbc.gridx = 0;
+                gbc.gridy = 0;
+                resultButtonPanel.add(testButton, gbc);
+
+                passButton = new JButton("Pass");
+                passButton.setActionCommand("Pass");
+                passButton.addActionListener((ActionEvent e) -> {
+                    latch.countDown();
+                    f.dispose();
+                });
+                failButton = new JButton("Fail");
+                failButton.setActionCommand("Fail");
+                failButton.addActionListener(new ActionListener() {
+                    @Override
+                    public void actionPerformed(ActionEvent e) {
+                        latch.countDown();
+                        f.dispose();
+                        throw new RuntimeException("Test Failed");
+                    }
+                });
+                gbc.gridx = 1;
+                gbc.gridy = 0;
+                resultButtonPanel.add(passButton, gbc);
+                gbc.gridx = 2;
+                gbc.gridy = 0;
+                resultButtonPanel.add(failButton, gbc);
+
+                gbc.gridx = 0;
+                gbc.gridy = 1;
+                mainControlPanel.add(resultButtonPanel, gbc);
+
+                f.add(mainControlPanel);
+                f.setSize(400, 200);
+                f.setLocationRelativeTo(null);
+                f.setVisible(true);
+
+                f.addWindowListener(new WindowAdapter() {
+                    @Override
+                    public void windowClosing(WindowEvent e) {
+                        latch.countDown();
+                        f.dispose();
+                    }
+                });
+            }
+        });
+    }
+
+    public static void main(String[] args) throws Exception {
+        latch = new CountDownLatch(1);
+        createUI();
+        latch.await();
+    }
+}
+
diff --git a/jdk/test/java/awt/image/multiresolution/MultiResolutionJOptionPaneIconTest.java b/jdk/test/java/awt/image/multiresolution/MultiResolutionJOptionPaneIconTest.java
index ea3cee5..4f82914 100644
--- a/jdk/test/java/awt/image/multiresolution/MultiResolutionJOptionPaneIconTest.java
+++ b/jdk/test/java/awt/image/multiresolution/MultiResolutionJOptionPaneIconTest.java
@@ -23,6 +23,7 @@
 
 /*
   @test
+  @key headful
   @bug 8150176 8150844
   @author a.stepanov
   @summary Check if correct resolution variant is used
diff --git a/jdk/test/java/awt/print/PrinterJob/BannerTest.java b/jdk/test/java/awt/print/PrinterJob/BannerTest.java
new file mode 100644
index 0000000..85f3329
--- /dev/null
+++ b/jdk/test/java/awt/print/PrinterJob/BannerTest.java
@@ -0,0 +1,160 @@
+/*
+ * 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.
+ */
+/*
+ * @test
+ * @bug 6575247
+ * @summary  Verifies if Banner page is printed
+ * @requires (os.family == "linux" | os.family == "solaris")
+ * @run main/manual BannerTest
+ */
+
+import java.awt.BorderLayout;
+import java.awt.FlowLayout;
+import java.awt.Graphics;
+import java.awt.event.WindowAdapter;
+import java.awt.event.WindowEvent;
+import java.awt.print.PageFormat;
+import java.awt.print.Printable;
+import static java.awt.print.Printable.NO_SUCH_PAGE;
+import static java.awt.print.Printable.PAGE_EXISTS;
+import java.awt.print.PrinterException;
+import java.awt.print.PrinterJob;
+import javax.swing.JButton;
+import javax.swing.JDialog;
+import javax.swing.JPanel;
+import javax.swing.JTextArea;
+import javax.swing.SwingUtilities;
+
+
+public class BannerTest implements Printable {
+    private static Thread mainThread;
+    private static boolean testPassed;
+    private static boolean testGeneratedInterrupt;
+
+    public static void main(String[] args)  throws Exception {
+        SwingUtilities.invokeAndWait(() -> {
+            doTest(BannerTest::printTest);
+        });
+        mainThread = Thread.currentThread();
+        try {
+            Thread.sleep(180000);
+        } catch (InterruptedException e) {
+            if (!testPassed && testGeneratedInterrupt) {
+                throw new RuntimeException("Banner page did not print");
+            }
+        }
+        if (!testGeneratedInterrupt) {
+            throw new RuntimeException("user has not executed the test");
+        }
+    }
+
+    private static void printTest() {
+        PrinterJob job = PrinterJob.getPrinterJob();
+        if (job.getPrintService() == null) {
+            System.out.println("No printers. Test cannot continue");
+            return;
+        }
+        job.setPrintable(new BannerTest());
+        if(job.printDialog()) {
+            try {
+                job.print();
+            } catch (PrinterException e) {
+                e.printStackTrace();
+                fail();
+            }
+        }
+    }
+
+    public static synchronized void pass() {
+        testPassed = true;
+        testGeneratedInterrupt = true;
+        mainThread.interrupt();
+    }
+
+    public static synchronized void fail() {
+        testPassed = false;
+        testGeneratedInterrupt = true;
+        mainThread.interrupt();
+    }
+
+    private static void doTest(Runnable action) {
+        String description
+                = " A print dialog will be shown.\n"
+                + " Click on the \"Appearance\" tab.\n "
+                + " Select the \"Banner page\" checkbox.\n"
+                + " Click on Print, and check if Banner page is printed.\n "
+                + " If Banner page is printed, press PASS else press FAIL";
+
+        final JDialog dialog = new JDialog();
+        dialog.setTitle("printBannerTest");
+        JTextArea textArea = new JTextArea(description);
+        textArea.setEditable(false);
+        final JButton testButton = new JButton("Start Test");
+        final JButton passButton = new JButton("PASS");
+        passButton.setEnabled(false);
+        passButton.addActionListener((e) -> {
+            dialog.dispose();
+            pass();
+        });
+        final JButton failButton = new JButton("FAIL");
+        failButton.setEnabled(false);
+        failButton.addActionListener((e) -> {
+            dialog.dispose();
+            fail();
+        });
+        testButton.addActionListener((e) -> {
+            testButton.setEnabled(false);
+            action.run();
+            passButton.setEnabled(true);
+            failButton.setEnabled(true);
+        });
+        JPanel mainPanel = new JPanel(new BorderLayout());
+        mainPanel.add(textArea, BorderLayout.CENTER);
+        JPanel buttonPanel = new JPanel(new FlowLayout());
+        buttonPanel.add(testButton);
+        buttonPanel.add(passButton);
+        buttonPanel.add(failButton);
+        mainPanel.add(buttonPanel, BorderLayout.SOUTH);
+        dialog.add(mainPanel);
+        dialog.pack();
+        dialog.setVisible(true);
+        dialog.addWindowListener(new WindowAdapter() {
+           @Override
+            public void windowClosing(WindowEvent e) {
+                System.out.println("main dialog closing");
+                testGeneratedInterrupt = false;
+                mainThread.interrupt();
+            }
+        });
+    }
+
+    @Override
+    public int print(Graphics g, PageFormat pf, int pi)
+            throws PrinterException {
+        System.out.println("pi = " + pi);
+        g.drawString("Testing", 100, 100);
+        if (pi == 1)
+            return NO_SUCH_PAGE;
+        return PAGE_EXISTS;
+    }
+}
diff --git a/jdk/test/java/awt/print/PrinterJob/LandscapeStackOverflow.java b/jdk/test/java/awt/print/PrinterJob/LandscapeStackOverflow.java
index 66a4ebd..ced2385 100644
--- a/jdk/test/java/awt/print/PrinterJob/LandscapeStackOverflow.java
+++ b/jdk/test/java/awt/print/PrinterJob/LandscapeStackOverflow.java
@@ -22,6 +22,7 @@
  */
 /*
  * @test
+ * @key headful
  * @bug 6842011 8158758
  * @summary Test if StackOverflowError occurs during printing landscape with
  *          scale and transform.
diff --git a/jdk/test/java/lang/ProcessBuilder/Zombies.java b/jdk/test/java/lang/ProcessBuilder/Zombies.java
index 91cbd21..30f296c 100644
--- a/jdk/test/java/lang/ProcessBuilder/Zombies.java
+++ b/jdk/test/java/lang/ProcessBuilder/Zombies.java
@@ -23,7 +23,8 @@
 
 /*
  * @test
- * @bug 6474073
+ * @run main/othervm Zombies
+ * @bug 6474073 6180151
  * @key intermittent
  * @summary Make sure zombies don't get created on Unix
  * @author Martin Buchholz
@@ -65,22 +66,21 @@
 
         Process p = rt.exec(TrueCommand);
         ProcessHandle pp = p.toHandle().parent().orElse(null);
-        System.out.printf("pid: %d, parent: %s%n", p.getPid(), pp);
+        System.out.printf("%s pid: %d, parent: %s%n", TrueCommand, p.getPid(), pp);
         p.waitFor();
 
         // Count all the zombies that are children of this Java process
         final String[] zombieCounter = {
             "/usr/bin/perl", "-e",
-            "exit @{[`/bin/ps -eo ppid,s` =~ /^ *@{[getppid]} +Z$/mog]}"
+                "$a=`/bin/ps -eo ppid,pid,s,command`;" +
+                        "print @b=$a=~/^ *@{[getppid]} +[0-9]+ +Z.*$/mog;" +
+                        "exit @b"
         };
 
-        int zombies = rt.exec(zombieCounter).waitFor();
+        ProcessBuilder pb = new ProcessBuilder(zombieCounter);
+        pb.inheritIO();
+        int zombies = pb.start().waitFor();
         if (zombies != 0) {
-            // Log remaining processes
-            ProcessBuilder pb = new ProcessBuilder("/bin/ps", "-ef");
-            pb.inheritIO();
-            Process p2 = pb.start();
-            p2.waitFor();
             throw new Error(zombies + " zombies!");
         }
     }
diff --git a/jdk/test/java/lang/Runtime/exec/LotsOfOutput.java b/jdk/test/java/lang/Runtime/exec/LotsOfOutput.java
index a77ffcb..33d35f0 100644
--- a/jdk/test/java/lang/Runtime/exec/LotsOfOutput.java
+++ b/jdk/test/java/lang/Runtime/exec/LotsOfOutput.java
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2002, 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2002, 2016, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -25,7 +25,6 @@
  * @test
  * @bug 4369826 8078582
  * @summary Process with lots of output should not crash VM
- * @key intermittent
  * @author kladko
  */
 
diff --git a/jdk/test/java/lang/StackWalker/VerifyStackTrace.java b/jdk/test/java/lang/StackWalker/VerifyStackTrace.java
index 829fb17..eb4a508 100644
--- a/jdk/test/java/lang/StackWalker/VerifyStackTrace.java
+++ b/jdk/test/java/lang/StackWalker/VerifyStackTrace.java
@@ -205,6 +205,8 @@
                     .replaceAll("java.base@(\\d+\\.){0,3}(\\d+)/", "java.base/")
                     .replaceAll("/[0-9]+\\.run", "/xxxxxxxx.run")
                     .replaceAll("/[0-9]+\\.invoke", "/xxxxxxxx.invoke")
+                    .replaceAll("DirectMethodHandle\\$Holder", "LambdaForm\\$DMH")
+                    .replaceAll("DMH\\.invoke", "DMH/xxxxxxxx.invoke")
                     .replaceAll("\\$[0-9]+", "\\$??");
         } else {
             return produced;
diff --git a/jdk/test/java/lang/annotation/AnnotationToStringTest.java b/jdk/test/java/lang/annotation/AnnotationToStringTest.java
new file mode 100644
index 0000000..ffcbcb4
--- /dev/null
+++ b/jdk/test/java/lang/annotation/AnnotationToStringTest.java
@@ -0,0 +1,293 @@
+/*
+ * 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.
+ */
+
+/*
+ * @test
+ * @bug 8162817
+ * @summary Test of toString on normal annotations
+ */
+
+import java.lang.annotation.*;
+import java.lang.reflect.*;
+import java.util.*;
+
+/**
+ * The expected string values are stored in @ExpectedString
+ * annotations. The essence of the test is comparing the toString()
+ * result of annotations to the corresponding ExpectedString.value().
+ */
+
+public class AnnotationToStringTest {
+    public static void main(String... args) throws Exception {
+        int failures = 0;
+
+        failures += check(PrimHost.class.getAnnotation(ExpectedString.class).value(),
+                          PrimHost.class.getAnnotation(MostlyPrimitive.class).toString());
+        failures += classyTest();
+        failures += arrayAnnotationTest();
+
+        if (failures > 0)
+            throw new RuntimeException(failures + " failures");
+    }
+
+    private static int check(String expected, String actual) {
+        if (!expected.equals(actual)) {
+            System.err.printf("ERROR: Expected ''%s'';%ngot             ''%s''.\n",
+                              expected, actual);
+            return 1;
+        } else
+            return 0;
+    }
+
+    @ExpectedString(
+        "@MostlyPrimitive(c0='a', "+
+        "c1='\\'', " +
+        "i0=1, " +
+        "i1=2, " +
+        "f0=1.0f, " +
+        "f1=0.0f/0.0f, " +
+        "d0=0.0, " +
+        "d1=1.0/0.0, " +
+        "l0=5, " +
+        "l1=9223372036854775807L, " +
+        "s0=\"Hello world.\", " +
+        "s1=\"a\\\"b\", " +
+        "class0=Obj[].class)")
+    @MostlyPrimitive(
+        c0='a',
+        c1='\'',
+        i0=1,
+        i1=2,
+        f0=1.0f,
+        f1=Float.NaN,
+        d0=0.0,
+        d1=2.0/0.0,
+        l0=5,
+        l1=Long.MAX_VALUE,
+        s0="Hello world.",
+        s1="a\"b",
+        class0=Obj[].class
+    )
+    static class PrimHost{}
+
+    private static int classyTest() {
+        int failures = 0;
+        for (Field f : AnnotationHost.class.getFields()) {
+            Annotation a = f.getAnnotation(Classy.class);
+            System.out.println(a);
+            failures += check(f.getAnnotation(ExpectedString.class).value(),
+                              a.toString());
+        }
+        return failures;
+    }
+
+    static class AnnotationHost {
+        @ExpectedString(
+       "@Classy(value=Obj.class)")
+        @Classy(value=Obj.class)
+        public int f0;
+
+        @ExpectedString(
+       "@Classy(value=Obj[].class)")
+        @Classy(value=Obj[].class)
+        public int f1;
+
+        @ExpectedString(
+       "@Classy(value=Obj[][].class)")
+        @Classy(value=Obj[][].class)
+        public int f2;
+
+        @ExpectedString(
+       "@Classy(value=Obj[][][].class)")
+        @Classy(value=Obj[][][].class)
+        public int f3;
+
+        @ExpectedString(
+       "@Classy(value=int.class)")
+        @Classy(value=int.class)
+        public int f4;
+
+        @ExpectedString(
+       "@Classy(value=int[][][].class)")
+        @Classy(value=int[][][].class)
+        public int f5;
+    }
+
+    /**
+     * Each field should have two annotations, the first being
+     * @ExpectedString and the second the annotation under test.
+     */
+    private static int arrayAnnotationTest() {
+        int failures = 0;
+        for (Field f : ArrayAnnotationHost.class.getFields()) {
+            Annotation[] annotations = f.getAnnotations();
+            System.out.println(annotations[1]);
+            failures += check(((ExpectedString)annotations[0]).value(),
+                              annotations[1].toString());
+        }
+        return failures;
+    }
+
+    static class ArrayAnnotationHost {
+        @ExpectedString(
+       "@BooleanArray(value={true, false, true})")
+        @BooleanArray(value={true, false, true})
+        public boolean[]   f0;
+
+        @ExpectedString(
+       "@FloatArray(value={3.0f, 4.0f, 0.0f/0.0f, -1.0f/0.0f, 1.0f/0.0f})")
+        @FloatArray(value={3.0f, 4.0f, Float.NaN, Float.NEGATIVE_INFINITY, Float.POSITIVE_INFINITY})
+        public float[]     f1;
+
+        @ExpectedString(
+       "@DoubleArray(value={1.0, 2.0, 0.0/0.0, 1.0/0.0, -1.0/0.0})")
+        @DoubleArray(value={1.0, 2.0, Double.NaN, Double.POSITIVE_INFINITY, Double.NEGATIVE_INFINITY,})
+        public double[]    f2;
+
+        @ExpectedString(
+       "@ByteArray(value={10, 11, 12})")
+        @ByteArray(value={10, 11, 12})
+        public byte[]      f3;
+
+        @ExpectedString(
+       "@ShortArray(value={0, 4, 5})")
+        @ShortArray(value={0, 4, 5})
+        public short[]     f4;
+
+        @ExpectedString(
+       "@CharArray(value={'a', 'b', 'c', '\\''})")
+        @CharArray(value={'a', 'b', 'c', '\''})
+        public char[]      f5;
+
+        @ExpectedString(
+       "@IntArray(value={1})")
+        @IntArray(value={1})
+        public int[]       f6;
+
+        @ExpectedString(
+       "@LongArray(value={-2147483647, 2147483648L, 9223372036854775807L})")
+        @LongArray(value={-Integer.MAX_VALUE, Integer.MAX_VALUE+1L, Long.MAX_VALUE})
+        public long[]      f7;
+
+        @ExpectedString(
+       "@StringArray(value={\"A\", \"B\", \"C\", \"\\\"Quote\\\"\"})")
+        @StringArray(value={"A", "B", "C", "\"Quote\""})
+        public String[]    f8;
+
+        @ExpectedString(
+       "@ClassArray(value={int.class, Obj[].class})")
+        @ClassArray(value={int.class, Obj[].class})
+        public Class<?>[]  f9;
+
+        @ExpectedString(
+       "@EnumArray(value={SOURCE})")
+        @EnumArray(value={RetentionPolicy.SOURCE})
+        public RetentionPolicy[]  f10;
+    }
+}
+
+// ------------ Supporting types ------------
+
+class Obj {}
+
+@Retention(RetentionPolicy.RUNTIME)
+@interface ExpectedString {
+    String value();
+}
+
+@Retention(RetentionPolicy.RUNTIME)
+@interface Classy {
+    Class<?> value();
+}
+
+@Retention(RetentionPolicy.RUNTIME)
+@interface BooleanArray {
+    boolean[] value();
+}
+
+@Retention(RetentionPolicy.RUNTIME)
+@interface FloatArray {
+    float[] value();
+}
+
+@Retention(RetentionPolicy.RUNTIME)
+@interface DoubleArray {
+    double[] value();
+}
+
+@Retention(RetentionPolicy.RUNTIME)
+@interface ByteArray {
+    byte[] value();
+}
+
+@Retention(RetentionPolicy.RUNTIME)
+@interface ShortArray {
+    short[] value();
+}
+
+@Retention(RetentionPolicy.RUNTIME)
+@interface CharArray {
+    char[] value();
+}
+
+@Retention(RetentionPolicy.RUNTIME)
+@interface IntArray {
+    int[] value();
+}
+
+@Retention(RetentionPolicy.RUNTIME)
+@interface LongArray {
+    long[] value();
+}
+
+@Retention(RetentionPolicy.RUNTIME)
+@interface ClassArray {
+    Class<?>[] value() default {int.class, Obj[].class};
+}
+
+@Retention(RetentionPolicy.RUNTIME)
+@interface StringArray {
+    String[] value();
+}
+
+@Retention(RetentionPolicy.RUNTIME)
+@interface EnumArray {
+    RetentionPolicy[] value();
+}
+
+@Retention(RetentionPolicy.RUNTIME)
+@interface MostlyPrimitive {
+    char   c0();
+    char   c1();
+    int    i0();
+    int    i1();
+    float  f0();
+    float  f1();
+    double d0();
+    double d1();
+    long   l0();
+    long   l1();
+    String s0();
+    String s1();
+    Class<?> class0();
+}
diff --git a/jdk/test/java/lang/annotation/ParameterAnnotations.java b/jdk/test/java/lang/annotation/ParameterAnnotations.java
index 4ea72d1..623b4dc 100644
--- a/jdk/test/java/lang/annotation/ParameterAnnotations.java
+++ b/jdk/test/java/lang/annotation/ParameterAnnotations.java
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2008, 2010, 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
@@ -23,7 +23,7 @@
 
 /*
  * @test
- * @bug 6761678
+ * @bug 6761678 8162817
  * @summary Check properties of Annotations returned from
  * getParameterAnnotations, including freedom from security
  * exceptions.
@@ -89,8 +89,8 @@
                 equal(ann.length, 2);
                 Annotation foo = ann[0][0];
                 Annotation bar = ann[1][0];
-                equal(foo.toString(), "@Named(value=foo)");
-                equal(bar.toString(), "@Named(value=bar)");
+                equal(foo.toString(), "@Named(value=\"foo\")");
+                equal(bar.toString(), "@Named(value=\"bar\")");
                 check(foo.equals(foo));
                 check(! foo.equals(bar));
             }
diff --git a/jdk/test/java/lang/invoke/VMAnonymousClass.java b/jdk/test/java/lang/invoke/VMAnonymousClass.java
index 8cd24d2..f686b24 100644
--- a/jdk/test/java/lang/invoke/VMAnonymousClass.java
+++ b/jdk/test/java/lang/invoke/VMAnonymousClass.java
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2014, 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
@@ -45,6 +45,7 @@
         test.testJavaUtil();
         test.testJdkInternalMisc();
         test.testJavaLangInvoke();
+        test.testProhibitedJavaPkg();
         System.out.println("TEST PASSED");
     }
 
@@ -54,13 +55,29 @@
     @Test public void testJavaUtil()        throws Throwable { test("java/util");         }
     @Test public void testJdkInternalMisc() throws Throwable { test("jdk/internal/misc"); }
     @Test public void testJavaLangInvoke()  throws Throwable { test("java/lang/invoke");  }
+    @Test public void testProhibitedJavaPkg() throws Throwable {
+       try {
+          test("java/prohibited");
+       } catch (SecurityException e) {
+         return;
+       }
+       throw new RuntimeException("Expected SecurityException");
+     }
 
     private static Unsafe unsafe = getUnsafe();
 
     private static void test(String pkg) throws Throwable {
         byte[] bytes = dumpClass(pkg);
-        // Define VM anonymous class in privileged context (on BCP).
-        Class anonClass = unsafe.defineAnonymousClass(Object.class, bytes, null);
+        Class host_class;
+        if (pkg.equals("java/prohibited")) {
+            VMAnonymousClass sampleclass = new VMAnonymousClass();
+            host_class = (Class)sampleclass.getClass();
+        } else {
+            host_class = Object.class;
+        }
+
+        // Define VM anonymous class
+        Class anonClass = unsafe.defineAnonymousClass(host_class, bytes, null);
 
         MethodType t = MethodType.methodType(Object.class, int.class);
         MethodHandle target = MethodHandles.lookup().findStatic(anonClass, "get", t);
diff --git a/jdk/test/java/nio/Buffer/ByteBufferViews.java b/jdk/test/java/nio/Buffer/ByteBufferViews.java
new file mode 100644
index 0000000..dfa3f55
--- /dev/null
+++ b/jdk/test/java/nio/Buffer/ByteBufferViews.java
@@ -0,0 +1,746 @@
+/*
+ * 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.
+ */
+
+/* @test
+ * @summary Binary data and view tests for byte buffers
+ * @bug 8159257
+ * @run testng ByteBufferViews
+ */
+
+import org.testng.annotations.DataProvider;
+import org.testng.annotations.Test;
+
+import java.nio.Buffer;
+import java.nio.ByteBuffer;
+import java.nio.ByteOrder;
+import java.nio.CharBuffer;
+import java.nio.DoubleBuffer;
+import java.nio.FloatBuffer;
+import java.nio.IntBuffer;
+import java.nio.LongBuffer;
+import java.nio.ShortBuffer;
+import java.util.List;
+import java.util.Map;
+import java.util.function.Function;
+import java.util.function.IntFunction;
+import java.util.function.IntUnaryOperator;
+import java.util.function.UnaryOperator;
+import java.util.stream.Collectors;
+
+import static org.testng.Assert.*;
+
+public class ByteBufferViews {
+    static final int SIZE = 32;
+
+    // List of buffer allocator functions
+    static final List<Map.Entry<String, IntFunction<ByteBuffer>>> BYTE_BUFFER_ALLOCATE_FUNCTIONS = List.of(
+            // Heap
+            Map.entry("ByteBuffer.allocate(ba)",
+                      size -> ByteBuffer.allocate(size)),
+            // Aligned
+            Map.entry("ByteBuffer.allocate(size).position(8)",
+                      size -> ByteBuffer.allocate(size).position(8)),
+            Map.entry("ByteBuffer.allocate(size).position(8).slice()",
+                      size -> ByteBuffer.allocate(size).position(8).slice()),
+            Map.entry("ByteBuffer.allocate(size).position(8).slice().duplicate()",
+                      size -> ByteBuffer.allocate(size).position(8).slice().duplicate()),
+            // Unaligned
+            Map.entry("ByteBuffer.allocate(size).position(1)",
+                      size -> ByteBuffer.allocate(size).position(1)),
+            Map.entry("ByteBuffer.allocate(size).position(1).slice()",
+                      size -> ByteBuffer.allocate(size).position(1).slice()),
+            Map.entry("ByteBuffer.allocate(size).position(1).slice().duplicate()",
+                      size -> ByteBuffer.allocate(size).position(1).slice().duplicate()),
+
+            // Off-heap
+            Map.entry("ByteBuffer.allocateDirect(size)",
+                      size -> ByteBuffer.allocateDirect(size)),
+            // Aligned
+            Map.entry("ByteBuffer.allocateDirect(size).position(8)",
+                      size -> ByteBuffer.allocateDirect(size).position(8)),
+            Map.entry("ByteBuffer.allocateDirect(size).position(8).slice()",
+                      size -> ByteBuffer.allocateDirect(size).position(8).slice()),
+            Map.entry("ByteBuffer.allocateDirect(size).position(8).slice().duplicate()",
+                      size -> ByteBuffer.allocateDirect(size).position(8).slice().duplicate()),
+            // Unaligned
+            Map.entry("ByteBuffer.allocateDirect(size).position(1)",
+                      size -> ByteBuffer.allocateDirect(size).position(1)),
+            Map.entry("ByteBuffer.allocateDirect(size).position(1).slice()",
+                      size -> ByteBuffer.allocateDirect(size).position(1).slice()),
+            Map.entry("ByteBuffer.allocateDirect(size).position(1).slice().duplicate()",
+                      size -> ByteBuffer.allocateDirect(size).position(1).slice().duplicate())
+    );
+
+    // List of buffer byte order functions
+    static final List<Map.Entry<String, UnaryOperator<ByteBuffer>>> BYTE_BUFFER_ORDER_FUNCTIONS = List.of(
+            Map.entry("order(ByteOrder.BIG_ENDIAN)",
+                      (ByteBuffer bb) -> bb.order(ByteOrder.BIG_ENDIAN)),
+            Map.entry("order(ByteOrder.LITTLE_ENDIAN)",
+                      (ByteBuffer bb) -> bb.order(ByteOrder.LITTLE_ENDIAN))
+    );
+
+    // Produce a composition of allocation and byte order buffer functions
+    static List<Map.Entry<String, IntFunction<ByteBuffer>>> composeBufferFunctions(
+            List<Map.Entry<String, IntFunction<ByteBuffer>>> af,
+            List<Map.Entry<String, UnaryOperator<ByteBuffer>>> of) {
+        return af.stream().flatMap(afe -> of.stream().
+                map(ofe -> {
+                    String s = afe.getKey() + "." + ofe.getKey();
+                    IntFunction<ByteBuffer> f = size -> ofe.getValue().
+                            apply(afe.getValue().apply(size));
+                    return Map.entry(s, f);
+                })
+        ).collect(Collectors.toList());
+    }
+
+    // List of buffer allocator functions to test
+    static final List<Map.Entry<String, IntFunction<ByteBuffer>>> BYTE_BUFFER_FUNCTIONS =
+            composeBufferFunctions(BYTE_BUFFER_ALLOCATE_FUNCTIONS, BYTE_BUFFER_ORDER_FUNCTIONS);
+
+    // Creates a cross product of test arguments for
+    // buffer allocator functions and buffer view functions
+    static Object[][] product(List<? extends Map.Entry<String, ?>> la,
+                              List<? extends Map.Entry<String, ?>> lb) {
+        return la.stream().flatMap(lae -> lb.stream().
+                map(lbe -> List.of(
+                        lae.getKey() + " -> " + lbe.getKey(),
+                        lae.getValue(),
+                        lbe.getValue()).toArray()
+                )).toArray(Object[][]::new);
+    }
+
+    static void assertValues(int i, Object bValue, Object bbValue, ByteBuffer bb) {
+        if (!bValue.equals(bbValue)) {
+            fail(String.format("Values %s and %s differ at index %d for %s",
+                               bValue, bbValue, i, bb));
+        }
+    }
+
+    static void assertValues(int i, Object bbValue, Object bvValue, ByteBuffer bb, Buffer bv) {
+        if (!bbValue.equals(bvValue)) {
+            fail(String.format("Values %s and %s differ at index %d for %s and %s",
+                               bbValue, bvValue, i, bb, bv));
+        }
+    }
+
+    static ByteBuffer allocate(IntFunction<ByteBuffer> f) {
+        return allocate(f, i -> i);
+    }
+
+    static ByteBuffer allocate(IntFunction<ByteBuffer> f, IntUnaryOperator o) {
+        return fill(f.apply(SIZE), o);
+    }
+
+    static ByteBuffer fill(ByteBuffer bb, IntUnaryOperator o) {
+        for (int i = 0; i < bb.limit(); i++) {
+            bb.put(i, (byte) o.applyAsInt(i));
+        }
+        return bb;
+    }
+
+
+    @DataProvider
+    public static Object[][] shortViewProvider() {
+        List<Map.Entry<String, Function<ByteBuffer, ShortBuffer>>> bfs = List.of(
+                Map.entry("bb.asShortBuffer()",
+                          bb -> bb.asShortBuffer()),
+                Map.entry("bb.asShortBuffer().slice()",
+                          bb -> bb.asShortBuffer().slice()),
+                Map.entry("bb.asShortBuffer().slice().duplicate()",
+                          bb -> bb.asShortBuffer().slice().duplicate())
+        );
+
+        return product(BYTE_BUFFER_FUNCTIONS, bfs);
+    }
+
+    @Test(dataProvider = "shortViewProvider")
+    public void testShortGet(String desc, IntFunction<ByteBuffer> fbb,
+                             Function<ByteBuffer, ShortBuffer> fbi) {
+        ByteBuffer bb = allocate(fbb);
+        ShortBuffer vb = fbi.apply(bb);
+        int o = bb.position();
+
+        for (int i = 0; i < vb.limit(); i++) {
+            short fromBytes = getShortFromBytes(bb, o + i * 2);
+            short fromMethodView = bb.getShort(o + i * 2);
+            assertValues(i, fromBytes, fromMethodView, bb);
+
+            short fromBufferView = vb.get(i);
+            assertValues(i, fromMethodView, fromBufferView, bb, vb);
+        }
+
+        for (int i = 0; i < vb.limit(); i++) {
+            short v = getShortFromBytes(bb, o + i * 2);
+            short a = bb.getShort();
+            assertValues(i, v, a, bb);
+
+            short b = vb.get();
+            assertValues(i, a, b, bb, vb);
+        }
+
+    }
+
+    @Test(dataProvider = "shortViewProvider")
+    public void testShortPut(String desc, IntFunction<ByteBuffer> fbb,
+                             Function<ByteBuffer, ShortBuffer> fbi) {
+        ByteBuffer bbfilled = allocate(fbb);
+        ByteBuffer bb = allocate(fbb, i -> 0);
+        ShortBuffer vb = fbi.apply(bb);
+        int o = bb.position();
+
+        for (int i = 0; i < vb.limit(); i++) {
+            short fromFilled = bbfilled.getShort(o + i * 2);
+
+            vb.put(i, fromFilled);
+            short fromMethodView = bb.getShort(o + i * 2);
+            assertValues(i, fromFilled, fromMethodView, bb, vb);
+        }
+
+        for (int i = 0; i < vb.limit(); i++) {
+            short fromFilled = bbfilled.getShort(o + i * 2);
+
+            vb.put(fromFilled);
+            short fromMethodView = bb.getShort();
+            assertValues(i, fromFilled, fromMethodView, bb, vb);
+        }
+
+
+        fill(bb, i -> 0);
+        bb.clear().position(o);
+        vb.clear();
+
+        for (int i = 0; i < vb.limit(); i++) {
+            short fromFilled = bbfilled.getShort(o + i * 2);
+
+            bb.putShort(o + i * 2, fromFilled);
+            short fromBufferView = vb.get(i);
+            assertValues(i, fromFilled, fromBufferView, bb, vb);
+        }
+
+        for (int i = 0; i < vb.limit(); i++) {
+            short fromFilled = bbfilled.getShort(o + i * 2);
+
+            bb.putShort(fromFilled);
+            short fromBufferView = vb.get();
+            assertValues(i, fromFilled, fromBufferView, bb, vb);
+        }
+    }
+
+    static short getShortFromBytes(ByteBuffer bb, int i) {
+        int a = bb.get(i) & 0xFF;
+        int b = bb.get(i + 1) & 0xFF;
+
+        if (bb.order() == ByteOrder.BIG_ENDIAN) {
+            return (short) ((a << 8) | b);
+        }
+        else {
+            return (short) ((b << 8) | a);
+        }
+    }
+
+    @DataProvider
+    public static Object[][] charViewProvider() {
+        List<Map.Entry<String, Function<ByteBuffer, CharBuffer>>> bfs = List.of(
+                Map.entry("bb.asCharBuffer()",
+                          bb -> bb.asCharBuffer()),
+                Map.entry("bb.asCharBuffer().slice()",
+                          bb -> bb.asCharBuffer().slice()),
+                Map.entry("bb.asCharBuffer().slice().duplicate()",
+                          bb -> bb.asCharBuffer().slice().duplicate())
+        );
+
+        return product(BYTE_BUFFER_FUNCTIONS, bfs);
+    }
+
+    @Test(dataProvider = "charViewProvider")
+    public void testCharGet(String desc, IntFunction<ByteBuffer> fbb,
+                            Function<ByteBuffer, CharBuffer> fbi) {
+        ByteBuffer bb = allocate(fbb);
+        CharBuffer vb = fbi.apply(bb);
+        int o = bb.position();
+
+        for (int i = 0; i < vb.limit(); i++) {
+            char fromBytes = getCharFromBytes(bb, o + i * 2);
+            char fromMethodView = bb.getChar(o + i * 2);
+            assertValues(i, fromBytes, fromMethodView, bb);
+
+            char fromBufferView = vb.get(i);
+            assertValues(i, fromMethodView, fromBufferView, bb, vb);
+        }
+
+        for (int i = 0; i < vb.limit(); i++) {
+            char fromBytes = getCharFromBytes(bb, o + i * 2);
+            char fromMethodView = bb.getChar();
+            assertValues(i, fromBytes, fromMethodView, bb);
+
+            char fromBufferView = vb.get();
+            assertValues(i, fromMethodView, fromBufferView, bb, vb);
+        }
+
+    }
+
+    @Test(dataProvider = "charViewProvider")
+    public void testCharPut(String desc, IntFunction<ByteBuffer> fbb,
+                            Function<ByteBuffer, CharBuffer> fbi) {
+        ByteBuffer bbfilled = allocate(fbb);
+        ByteBuffer bb = allocate(fbb, i -> 0);
+        CharBuffer vb = fbi.apply(bb);
+        int o = bb.position();
+
+        for (int i = 0; i < vb.limit(); i++) {
+            char fromFilled = bbfilled.getChar(o + i * 2);
+
+            vb.put(i, fromFilled);
+            char fromMethodView = bb.getChar(o + i * 2);
+            assertValues(i, fromFilled, fromMethodView, bb, vb);
+        }
+
+        for (int i = 0; i < vb.limit(); i++) {
+            char fromFilled = bbfilled.getChar(o + i * 2);
+
+            vb.put(fromFilled);
+            char fromMethodView = bb.getChar();
+            assertValues(i, fromFilled, fromMethodView, bb, vb);
+        }
+
+
+        fill(bb, i -> 0);
+        bb.clear().position(o);
+        vb.clear();
+
+        for (int i = 0; i < vb.limit(); i++) {
+            char fromFilled = bbfilled.getChar(o + i * 2);
+
+            bb.putChar(o + i * 2, fromFilled);
+            char fromBufferView = vb.get(i);
+            assertValues(i, fromFilled, fromBufferView, bb, vb);
+        }
+
+        for (int i = 0; i < vb.limit(); i++) {
+            char fromFilled = bbfilled.getChar(o + i * 2);
+
+            bb.putChar(fromFilled);
+            char fromBufferView = vb.get();
+            assertValues(i, fromFilled, fromBufferView, bb, vb);
+        }
+    }
+
+    static char getCharFromBytes(ByteBuffer bb, int i) {
+        return (char) getShortFromBytes(bb, i);
+    }
+
+
+    @DataProvider
+    public static Object[][] intViewProvider() {
+        List<Map.Entry<String, Function<ByteBuffer, IntBuffer>>> bfs = List.of(
+                Map.entry("bb.asIntBuffer()",
+                          bb -> bb.asIntBuffer()),
+                Map.entry("bb.asIntBuffer().slice()",
+                          bb -> bb.asIntBuffer().slice()),
+                Map.entry("bb.asIntBuffer().slice().duplicate()",
+                          bb -> bb.asIntBuffer().slice().duplicate())
+        );
+
+        return product(BYTE_BUFFER_FUNCTIONS, bfs);
+    }
+
+    @Test(dataProvider = "intViewProvider")
+    public void testIntGet(String desc, IntFunction<ByteBuffer> fbb,
+                           Function<ByteBuffer, IntBuffer> fbi) {
+        ByteBuffer bb = allocate(fbb);
+        IntBuffer vb = fbi.apply(bb);
+        int o = bb.position();
+
+        for (int i = 0; i < vb.limit(); i++) {
+            int fromBytes = getIntFromBytes(bb, o + i * 4);
+            int fromMethodView = bb.getInt(o + i * 4);
+            assertValues(i, fromBytes, fromMethodView, bb);
+
+            int fromBufferView = vb.get(i);
+            assertValues(i, fromMethodView, fromBufferView, bb, vb);
+        }
+
+        for (int i = 0; i < vb.limit(); i++) {
+            int v = getIntFromBytes(bb, o + i * 4);
+            int a = bb.getInt();
+            assertValues(i, v, a, bb);
+
+            int b = vb.get();
+            assertValues(i, a, b, bb, vb);
+        }
+
+    }
+
+    @Test(dataProvider = "intViewProvider")
+    public void testIntPut(String desc, IntFunction<ByteBuffer> fbb,
+                           Function<ByteBuffer, IntBuffer> fbi) {
+        ByteBuffer bbfilled = allocate(fbb);
+        ByteBuffer bb = allocate(fbb, i -> 0);
+        IntBuffer vb = fbi.apply(bb);
+        int o = bb.position();
+
+        for (int i = 0; i < vb.limit(); i++) {
+            int fromFilled = bbfilled.getInt(o + i * 4);
+
+            vb.put(i, fromFilled);
+            int fromMethodView = bb.getInt(o + i * 4);
+            assertValues(i, fromFilled, fromMethodView, bb, vb);
+        }
+
+        for (int i = 0; i < vb.limit(); i++) {
+            int fromFilled = bbfilled.getInt(o + i * 4);
+
+            vb.put(fromFilled);
+            int fromMethodView = bb.getInt();
+            assertValues(i, fromFilled, fromMethodView, bb, vb);
+        }
+
+
+        fill(bb, i -> 0);
+        bb.clear().position(o);
+        vb.clear();
+
+        for (int i = 0; i < vb.limit(); i++) {
+            int fromFilled = bbfilled.getInt(o + i * 4);
+
+            bb.putInt(o + i * 4, fromFilled);
+            int fromBufferView = vb.get(i);
+            assertValues(i, fromFilled, fromBufferView, bb, vb);
+        }
+
+        for (int i = 0; i < vb.limit(); i++) {
+            int fromFilled = bbfilled.getInt(o + i * 4);
+
+            bb.putInt(fromFilled);
+            int fromBufferView = vb.get();
+            assertValues(i, fromFilled, fromBufferView, bb, vb);
+        }
+    }
+
+    static int getIntFromBytes(ByteBuffer bb, int i) {
+        int a = bb.get(i) & 0xFF;
+        int b = bb.get(i + 1) & 0xFF;
+        int c = bb.get(i + 2) & 0xFF;
+        int d = bb.get(i + 3) & 0xFF;
+
+        if (bb.order() == ByteOrder.BIG_ENDIAN) {
+            return ((a << 24) | (b << 16) | (c << 8) | d);
+        }
+        else {
+            return ((d << 24) | (c << 16) | (b << 8) | a);
+        }
+    }
+
+
+    @DataProvider
+    public static Object[][] longViewProvider() {
+        List<Map.Entry<String, Function<ByteBuffer, LongBuffer>>> bfs = List.of(
+                Map.entry("bb.asLongBuffer()",
+                          bb -> bb.asLongBuffer()),
+                Map.entry("bb.asLongBuffer().slice()",
+                          bb -> bb.asLongBuffer().slice()),
+                Map.entry("bb.asLongBuffer().slice().duplicate()",
+                          bb -> bb.asLongBuffer().slice().duplicate())
+        );
+
+        return product(BYTE_BUFFER_FUNCTIONS, bfs);
+    }
+
+    @Test(dataProvider = "longViewProvider")
+    public void testLongGet(String desc, IntFunction<ByteBuffer> fbb,
+                            Function<ByteBuffer, LongBuffer> fbi) {
+        ByteBuffer bb = allocate(fbb);
+        LongBuffer vb = fbi.apply(bb);
+        int o = bb.position();
+
+        for (int i = 0; i < vb.limit(); i++) {
+            long fromBytes = getLongFromBytes(bb, o + i * 8);
+            long fromMethodView = bb.getLong(o + i * 8);
+            assertValues(i, fromBytes, fromMethodView, bb);
+
+            long fromBufferView = vb.get(i);
+            assertValues(i, fromMethodView, fromBufferView, bb, vb);
+        }
+
+        for (int i = 0; i < vb.limit(); i++) {
+            long v = getLongFromBytes(bb, o + i * 8);
+            long a = bb.getLong();
+            assertValues(i, v, a, bb);
+
+            long b = vb.get();
+            assertValues(i, a, b, bb, vb);
+        }
+
+    }
+
+    @Test(dataProvider = "longViewProvider")
+    public void testLongPut(String desc, IntFunction<ByteBuffer> fbb,
+                            Function<ByteBuffer, LongBuffer> fbi) {
+        ByteBuffer bbfilled = allocate(fbb);
+        ByteBuffer bb = allocate(fbb, i -> 0);
+        LongBuffer vb = fbi.apply(bb);
+        int o = bb.position();
+
+        for (int i = 0; i < vb.limit(); i++) {
+            long fromFilled = bbfilled.getLong(o + i * 8);
+
+            vb.put(i, fromFilled);
+            long fromMethodView = bb.getLong(o + i * 8);
+            assertValues(i, fromFilled, fromMethodView, bb, vb);
+        }
+
+        for (int i = 0; i < vb.limit(); i++) {
+            long fromFilled = bbfilled.getLong(o + i * 8);
+
+            vb.put(fromFilled);
+            long fromMethodView = bb.getLong();
+            assertValues(i, fromFilled, fromMethodView, bb, vb);
+        }
+
+
+        fill(bb, i -> 0);
+        bb.clear().position(o);
+        vb.clear();
+
+        for (int i = 0; i < vb.limit(); i++) {
+            long fromFilled = bbfilled.getLong(o + i * 8);
+
+            bb.putLong(o + i * 8, fromFilled);
+            long fromBufferView = vb.get(i);
+            assertValues(i, fromFilled, fromBufferView, bb, vb);
+        }
+
+        for (int i = 0; i < vb.limit(); i++) {
+            long fromFilled = bbfilled.getLong(o + i * 8);
+
+            bb.putLong(fromFilled);
+            long fromBufferView = vb.get();
+            assertValues(i, fromFilled, fromBufferView, bb, vb);
+        }
+    }
+
+    static long getLongFromBytes(ByteBuffer bb, int i) {
+        long a = bb.get(i) & 0xFF;
+        long b = bb.get(i + 1) & 0xFF;
+        long c = bb.get(i + 2) & 0xFF;
+        long d = bb.get(i + 3) & 0xFF;
+        long e = bb.get(i + 4) & 0xFF;
+        long f = bb.get(i + 5) & 0xFF;
+        long g = bb.get(i + 6) & 0xFF;
+        long h = bb.get(i + 7) & 0xFF;
+
+        if (bb.order() == ByteOrder.BIG_ENDIAN) {
+            return ((a << 56) | (b << 48) | (c << 40) | (d << 32) |
+                    (e << 24) | (f << 16) | (g << 8) | h);
+        }
+        else {
+            return ((h << 56) | (g << 48) | (f << 40) | (e << 32) |
+                    (d << 24) | (c << 16) | (b << 8) | a);
+        }
+    }
+
+
+    @DataProvider
+    public static Object[][] floatViewProvider() {
+        List<Map.Entry<String, Function<ByteBuffer, FloatBuffer>>> bfs = List.of(
+                Map.entry("bb.asFloatBuffer()",
+                          bb -> bb.asFloatBuffer()),
+                Map.entry("bb.asFloatBuffer().slice()",
+                          bb -> bb.asFloatBuffer().slice()),
+                Map.entry("bb.asFloatBuffer().slice().duplicate()",
+                          bb -> bb.asFloatBuffer().slice().duplicate())
+        );
+
+        return product(BYTE_BUFFER_FUNCTIONS, bfs);
+    }
+
+    @Test(dataProvider = "floatViewProvider")
+    public void testFloatGet(String desc, IntFunction<ByteBuffer> fbb,
+                             Function<ByteBuffer, FloatBuffer> fbi) {
+        ByteBuffer bb = allocate(fbb);
+        FloatBuffer vb = fbi.apply(bb);
+        int o = bb.position();
+
+        for (int i = 0; i < vb.limit(); i++) {
+            float fromBytes = getFloatFromBytes(bb, o + i * 4);
+            float fromMethodView = bb.getFloat(o + i * 4);
+            assertValues(i, fromBytes, fromMethodView, bb);
+
+            float fromBufferView = vb.get(i);
+            assertValues(i, fromMethodView, fromBufferView, bb, vb);
+        }
+
+        for (int i = 0; i < vb.limit(); i++) {
+            float v = getFloatFromBytes(bb, o + i * 4);
+            float a = bb.getFloat();
+            assertValues(i, v, a, bb);
+
+            float b = vb.get();
+            assertValues(i, a, b, bb, vb);
+        }
+
+    }
+
+    @Test(dataProvider = "floatViewProvider")
+    public void testFloatPut(String desc, IntFunction<ByteBuffer> fbb,
+                             Function<ByteBuffer, FloatBuffer> fbi) {
+        ByteBuffer bbfilled = allocate(fbb);
+        ByteBuffer bb = allocate(fbb, i -> 0);
+        FloatBuffer vb = fbi.apply(bb);
+        int o = bb.position();
+
+        for (int i = 0; i < vb.limit(); i++) {
+            float fromFilled = bbfilled.getFloat(o + i * 4);
+
+            vb.put(i, fromFilled);
+            float fromMethodView = bb.getFloat(o + i * 4);
+            assertValues(i, fromFilled, fromMethodView, bb, vb);
+        }
+
+        for (int i = 0; i < vb.limit(); i++) {
+            float fromFilled = bbfilled.getFloat(o + i * 4);
+
+            vb.put(fromFilled);
+            float fromMethodView = bb.getFloat();
+            assertValues(i, fromFilled, fromMethodView, bb, vb);
+        }
+
+
+        fill(bb, i -> 0);
+        bb.clear().position(o);
+        vb.clear();
+
+        for (int i = 0; i < vb.limit(); i++) {
+            float fromFilled = bbfilled.getFloat(o + i * 4);
+
+            bb.putFloat(o + i * 4, fromFilled);
+            float fromBufferView = vb.get(i);
+            assertValues(i, fromFilled, fromBufferView, bb, vb);
+        }
+
+        for (int i = 0; i < vb.limit(); i++) {
+            float fromFilled = bbfilled.getFloat(o + i * 4);
+
+            bb.putFloat(fromFilled);
+            float fromBufferView = vb.get();
+            assertValues(i, fromFilled, fromBufferView, bb, vb);
+        }
+    }
+
+    static float getFloatFromBytes(ByteBuffer bb, int i) {
+        return Float.intBitsToFloat(getIntFromBytes(bb, i));
+    }
+
+
+
+    @DataProvider
+    public static Object[][] doubleViewProvider() {
+        List<Map.Entry<String, Function<ByteBuffer, DoubleBuffer>>> bfs = List.of(
+                Map.entry("bb.asDoubleBuffer()",
+                          bb -> bb.asDoubleBuffer()),
+                Map.entry("bb.asDoubleBuffer().slice()",
+                          bb -> bb.asDoubleBuffer().slice()),
+                Map.entry("bb.asDoubleBuffer().slice().duplicate()",
+                          bb -> bb.asDoubleBuffer().slice().duplicate())
+        );
+
+        return product(BYTE_BUFFER_FUNCTIONS, bfs);
+    }
+
+    @Test(dataProvider = "doubleViewProvider")
+    public void testDoubleGet(String desc, IntFunction<ByteBuffer> fbb,
+                              Function<ByteBuffer, DoubleBuffer> fbi) {
+        ByteBuffer bb = allocate(fbb);
+        DoubleBuffer vb = fbi.apply(bb);
+        int o = bb.position();
+
+        for (int i = 0; i < vb.limit(); i++) {
+            double fromBytes = getDoubleFromBytes(bb, o + i * 8);
+            double fromMethodView = bb.getDouble(o + i * 8);
+            assertValues(i, fromBytes, fromMethodView, bb);
+
+            double fromBufferView = vb.get(i);
+            assertValues(i, fromMethodView, fromBufferView, bb, vb);
+        }
+
+        for (int i = 0; i < vb.limit(); i++) {
+            double v = getDoubleFromBytes(bb, o + i * 8);
+            double a = bb.getDouble();
+            assertValues(i, v, a, bb);
+
+            double b = vb.get();
+            assertValues(i, a, b, bb, vb);
+        }
+
+    }
+
+    @Test(dataProvider = "doubleViewProvider")
+    public void testDoublePut(String desc, IntFunction<ByteBuffer> fbb,
+                              Function<ByteBuffer, DoubleBuffer> fbi) {
+        ByteBuffer bbfilled = allocate(fbb);
+        ByteBuffer bb = allocate(fbb, i -> 0);
+        DoubleBuffer vb = fbi.apply(bb);
+        int o = bb.position();
+
+        for (int i = 0; i < vb.limit(); i++) {
+            double fromFilled = bbfilled.getDouble(o + i * 8);
+
+            vb.put(i, fromFilled);
+            double fromMethodView = bb.getDouble(o + i * 8);
+            assertValues(i, fromFilled, fromMethodView, bb, vb);
+        }
+
+        for (int i = 0; i < vb.limit(); i++) {
+            double fromFilled = bbfilled.getDouble(o + i * 8);
+
+            vb.put(fromFilled);
+            double fromMethodView = bb.getDouble();
+            assertValues(i, fromFilled, fromMethodView, bb, vb);
+        }
+
+
+        fill(bb, i -> 0);
+        bb.clear().position(o);
+        vb.clear();
+
+        for (int i = 0; i < vb.limit(); i++) {
+            double fromFilled = bbfilled.getDouble(o + i * 8);
+
+            bb.putDouble(o + i * 8, fromFilled);
+            double fromBufferView = vb.get(i);
+            assertValues(i, fromFilled, fromBufferView, bb, vb);
+        }
+
+        for (int i = 0; i < vb.limit(); i++) {
+            double fromFilled = bbfilled.getDouble(o + i * 8);
+
+            bb.putDouble(fromFilled);
+            double fromBufferView = vb.get();
+            assertValues(i, fromFilled, fromBufferView, bb, vb);
+        }
+    }
+
+    static double getDoubleFromBytes(ByteBuffer bb, int i) {
+        return Double.longBitsToDouble(getLongFromBytes(bb, i));
+    }
+}
diff --git a/jdk/test/java/nio/file/Files/probeContentType/Basic.java b/jdk/test/java/nio/file/Files/probeContentType/Basic.java
index b71e8a2..bb48ca7 100644
--- a/jdk/test/java/nio/file/Files/probeContentType/Basic.java
+++ b/jdk/test/java/nio/file/Files/probeContentType/Basic.java
@@ -22,7 +22,7 @@
  */
 
 /* @test
- * @bug 4313887 8129632 8129633 8162624
+ * @bug 4313887 8129632 8129633 8162624 8146215 8162745
  * @summary Unit test for probeContentType method
  * @library ../..
  * @build Basic SimpleFileTypeDetector
@@ -38,7 +38,6 @@
  * set of file extension to content type mappings.
  */
 public class Basic {
-
     private static final boolean IS_UNIX =
         ! System.getProperty("os.name").startsWith("Windows");
 
@@ -55,6 +54,23 @@
         return Files.createTempFile("red", ".grape");
     }
 
+    private static void checkMimeTypesFile(Path mimeTypes) {
+        if (!Files.exists(mimeTypes)) {
+            System.out.println(mimeTypes + " does not exist");
+        } else if (!Files.isReadable(mimeTypes)) {
+            System.out.println(mimeTypes + " is not readable");
+        } else {
+            System.out.println(mimeTypes + " contents:");
+            try (Stream<String> lines = Files.lines(mimeTypes)) {
+                lines.forEach(System.out::println);
+                System.out.println("");
+            } catch (IOException ioe) {
+                System.err.printf("Problem reading %s: %s%n",
+                                  mimeTypes, ioe.getMessage());
+            }
+        }
+    }
+
     private static int checkContentTypes(String expected, String actual) {
         assert expected != null;
         assert actual != null;
@@ -63,36 +79,10 @@
             if (IS_UNIX) {
                 Path userMimeTypes =
                     Paths.get(System.getProperty("user.home"), ".mime.types");
-                if (!Files.exists(userMimeTypes)) {
-                    System.out.println(userMimeTypes + " does not exist");
-                } else if (!Files.isReadable(userMimeTypes)) {
-                    System.out.println(userMimeTypes + " is not readable");
-                } else {
-                    System.out.println(userMimeTypes + " contents:");
-                    try (Stream<String> lines = Files.lines(userMimeTypes)) {
-                        lines.forEach(System.out::println);
-                        System.out.println("");
-                    } catch (IOException ioe) {
-                        System.err.println("Problem reading "
-                                           + userMimeTypes);
-                    }
-                }
+                checkMimeTypesFile(userMimeTypes);
 
                 Path etcMimeTypes = Paths.get("/etc/mime.types");
-                if (!Files.exists(etcMimeTypes)) {
-                    System.out.println(etcMimeTypes + " does not exist");
-                } else if (!Files.isReadable(etcMimeTypes)) {
-                    System.out.println(etcMimeTypes + " is not readable");
-                } else {
-                    System.out.println(etcMimeTypes + " contents:");
-                    try (Stream<String> lines = Files.lines(etcMimeTypes)) {
-                        lines.forEach(System.out::println);
-                        System.out.println("");
-                    } catch (IOException ioe) {
-                        System.err.println("Problem reading "
-                                           + etcMimeTypes);
-                    }
-                }
+                checkMimeTypesFile(etcMimeTypes);
             }
 
             System.err.println("Expected \"" + expected
@@ -105,11 +95,11 @@
         return 0;
     }
 
-    static int checkOSXContentTypes(String[] extensions, String[] expectedTypes)
+    static int checkContentTypes(String[] extensions, String[] expectedTypes)
         throws IOException {
         if (extensions.length != expectedTypes.length) {
-            throw new IllegalArgumentException
-                ("Parameter array lengths differ");
+            System.err.println("Parameter array lengths differ");
+            return 1;
         }
 
         int failures = 0;
@@ -157,25 +147,25 @@
         file = createGrapeFile();
         try {
             String type = Files.probeContentType(file);
-            if (type == null)
-                throw new RuntimeException("Custom file type detector not installed?");
-            failures += checkContentTypes("grape/unknown", type);
+            if (type == null) {
+                System.err.println("Custom file type detector not installed?");
+                failures++;
+            } else {
+                failures += checkContentTypes("grape/unknown", type);
+            }
         } finally {
             Files.delete(file);
         }
 
-        // Verify that common file extensions are mapped to the correct content
-        // types on Mac OS X only which has consistent Uniform Type Identifiers.
-        if (System.getProperty("os.name").contains("OS X")) {
-            String[] extensions = new String[]{
-                "jpg", "mp3", "mp4", "pdf", "png"
-            };
-            String[] expectedTypes = new String[]{
-                "image/jpeg", "audio/mpeg", "video/mp4", "application/pdf",
-                "image/png"
-            };
-            failures += checkOSXContentTypes(extensions, expectedTypes);
-        }
+        // Verify that certain media extensions are mapped to the correct type.
+        String[] extensions = new String[]{
+            "aac", "flac", "jpg", "mp3", "mp4", "pdf", "png", "webm"
+        };
+        String[] expectedTypes = new String[]{
+            "audio/aac", "audio/flac", "image/jpeg", "audio/mpeg",
+            "video/mp4", "application/pdf", "image/png", "video/webm"
+        };
+        failures += checkContentTypes(extensions, expectedTypes);
 
         if (failures > 0) {
             throw new RuntimeException("Test failed!");
diff --git a/jdk/test/java/nio/file/WatchService/DeleteInterference.java b/jdk/test/java/nio/file/WatchService/DeleteInterference.java
index 032d02a..459b17e 100644
--- a/jdk/test/java/nio/file/WatchService/DeleteInterference.java
+++ b/jdk/test/java/nio/file/WatchService/DeleteInterference.java
@@ -38,6 +38,7 @@
 import java.util.concurrent.Executors;
 import java.util.concurrent.Future;
 
+import static java.lang.System.out;
 import static java.nio.file.StandardWatchEventKinds.*;
 
 public class DeleteInterference {
@@ -66,22 +67,28 @@
     private static void openAndCloseWatcher(Path dir) {
         FileSystem fs = FileSystems.getDefault();
         for (int i = 0; i < ITERATIONS_COUNT; i++) {
+            out.printf("open %d begin%n", i);
             try (WatchService watcher = fs.newWatchService()) {
                 dir.register(watcher, ENTRY_CREATE, ENTRY_DELETE, ENTRY_MODIFY);
             } catch (IOException ioe) {
                 // ignore
+            } finally {
+                out.printf("open %d end%n", i);
             }
         }
     }
 
     private static void deleteAndRecreateDirectory(Path dir) {
         for (int i = 0; i < ITERATIONS_COUNT; i++) {
+            out.printf("del %d begin%n", i);
             try {
                 deleteFileTree(dir);
                 Path subdir = Files.createDirectories(dir.resolve("subdir"));
                 Files.createFile(subdir.resolve("test"));
             } catch (IOException ioe) {
                 // ignore
+            } finally {
+                out.printf("del %d end%n", i);
             }
         }
     }
diff --git a/jdk/test/java/util/Locale/Bug8035133.java b/jdk/test/java/util/Locale/Bug8035133.java
new file mode 100644
index 0000000..8d86ca0
--- /dev/null
+++ b/jdk/test/java/util/Locale/Bug8035133.java
@@ -0,0 +1,159 @@
+/*
+ * 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.
+ */
+/*
+ * @test
+ * @bug 8035133
+ * @summary Checks that the tags matching the range with quality weight q=0
+ *          e.g. en;q=0 must be elimited and must not be the part of output
+ */
+
+import java.util.ArrayList;
+import java.util.Iterator;
+import java.util.List;
+import java.util.Locale;
+
+
+public class Bug8035133 {
+
+    private static boolean err = false;
+
+    public static void main(String[] args) {
+
+        // checking Locale.lookup with de-ch;q=0
+        checkLookup("en;q=0.1, *-ch;q=0.5, de-ch;q=0",
+                "de-ch, en, fr-ch", "fr-CH");
+
+        /* checking Locale.lookup with *;q=0 '*' should be ignored
+         * in lookup
+         */
+        checkLookup("en;q=0.1, *-ch;q=0.5, *;q=0",
+                "de-ch, en, fr-ch", "de-CH");
+
+        // checking Locale.filter with fr-ch;q=0 in BASIC_FILTERING
+        checkFilter("en;q=0.1, fr-ch;q=0.0, de-ch;q=0.5",
+                "de-ch, en, fr-ch", "de-CH, en");
+
+        // checking Locale.filter with *;q=0 in BASIC_FILTERING
+        checkFilter("de-ch;q=0.6, *;q=0", "de-ch, fr-ch", "");
+
+        // checking Locale.filter with *;q=0 in BASIC_FILTERING
+        checkFilter("de-ch;q=0.6, de;q=0", "de-ch", "");
+
+        // checking Locale.filter with *;q=0.6, en;q=0 in BASIC_FILTERING
+        checkFilter("*;q=0.6, en;q=0", "de-ch, hi-in, en", "de-CH, hi-IN");
+
+        // checking Locale.filter with de-ch;q=0 in EXTENDED_FILTERING
+        checkFilter("en;q=0.1, *-ch;q=0.5, de-ch;q=0",
+                "de-ch, en, fr-ch", "fr-CH, en");
+
+        /* checking Locale.filter with *-ch;q=0 in EXTENDED_FILTERING which
+         * must make filter to return "" empty or no match
+         */
+        checkFilter("de-ch;q=0.5, *-ch;q=0", "de-ch, fr-ch", "");
+
+        /* checking Locale.filter with *;q=0 in EXTENDED_FILTERING which
+         * must make filter to return "" empty or no match
+         */
+        checkFilter("*-ch;q=0.5, *;q=0", "de-ch, fr-ch", "");
+
+        /* checking Locale.filter with *;q=0.6, *-Latn;q=0 in
+         * EXTENDED_FILTERING
+         */
+        checkFilter("*;q=0.6, *-Latn;q=0", "de-ch, hi-in, en-Latn",
+                "de-CH, hi-IN");
+
+        if (err) {
+            throw new RuntimeException("[LocaleMatcher method(s) failed]");
+        }
+
+    }
+
+    private static void checkLookup(String ranges, String tags,
+            String expectedLocale) {
+
+        List<Locale.LanguageRange> priorityList = Locale.LanguageRange
+                .parse(ranges);
+        List<Locale> localeList = generateLocales(tags);
+        Locale loc = Locale.lookup(priorityList, localeList);
+        String actualLocale
+                = loc.toLanguageTag();
+
+        if (!actualLocale.equals(expectedLocale)) {
+            System.err.println("Locale.lookup failed with ranges: " + ranges
+                    + " Expected: " + expectedLocale
+                    + " Actual: " + actualLocale);
+            err = true;
+        }
+
+    }
+
+    private static void checkFilter(String ranges, String tags,
+            String expectedLocales) {
+
+        List<Locale.LanguageRange> priorityList = Locale.LanguageRange
+                .parse(ranges);
+        List<Locale> localeList = generateLocales(tags);
+        String actualLocales = getLocalesAsString(
+                Locale.filter(priorityList, localeList));
+
+        if (!actualLocales.equals(expectedLocales)) {
+            System.err.println("Locale.filter failed with ranges: " + ranges
+                    + " Expected: " + expectedLocales
+                    + " Actual: " + actualLocales);
+            err = true;
+        }
+
+    }
+
+    private static List<Locale> generateLocales(String tags) {
+        if (tags == null) {
+            return null;
+        }
+
+        List<Locale> localeList = new ArrayList<>();
+        if (tags.equals("")) {
+            return localeList;
+        }
+        String[] t = tags.split(", ");
+        for (String tag : t) {
+            localeList.add(Locale.forLanguageTag(tag));
+        }
+        return localeList;
+    }
+
+    private static String getLocalesAsString(List<Locale> locales) {
+        StringBuilder sb = new StringBuilder();
+
+        Iterator<Locale> itr = locales.iterator();
+        if (itr.hasNext()) {
+            sb.append(itr.next().toLanguageTag());
+        }
+        while (itr.hasNext()) {
+            sb.append(", ");
+            sb.append(itr.next().toLanguageTag());
+        }
+
+        return sb.toString().trim();
+    }
+
+}
diff --git a/jdk/test/javax/imageio/plugins/external_plugin_tests/TestClassPathPlugin.sh b/jdk/test/javax/imageio/plugins/external_plugin_tests/TestClassPathPlugin.sh
index 196189a..60e8fc0 100644
--- a/jdk/test/javax/imageio/plugins/external_plugin_tests/TestClassPathPlugin.sh
+++ b/jdk/test/javax/imageio/plugins/external_plugin_tests/TestClassPathPlugin.sh
@@ -22,7 +22,7 @@
 #
 
 # @test
-# @bug 8081729
+# @bug 8081729 8140314
 # @summary Test external plugin as classpath jar and as a modular jar.
 #          Test both cases with and without a security manager.
 
diff --git a/jdk/test/javax/imageio/plugins/jpeg/ReadAllThumbnailsTest.java b/jdk/test/javax/imageio/plugins/jpeg/ReadAllThumbnailsTest.java
new file mode 100644
index 0000000..04d5e0c
--- /dev/null
+++ b/jdk/test/javax/imageio/plugins/jpeg/ReadAllThumbnailsTest.java
@@ -0,0 +1,126 @@
+/*
+ * Copyright (c) 2004, 2016, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+/*
+ * @test
+ * @bug     4958271 8160943
+ * @summary This test verifies that ImageReader.readAll() method is able to read
+ *          all the thumbnails present in the input source without throwing any
+ *          exception while reading through Jpeg data.
+ * @run     main ReadAllThumbnailsTest
+ */
+
+import java.util.Iterator;
+import java.io.File;
+import javax.imageio.IIOImage;
+import javax.imageio.ImageIO;
+import javax.imageio.ImageReader;
+import javax.imageio.stream.ImageInputStream;
+
+public class ReadAllThumbnailsTest {
+
+    public ReadAllThumbnailsTest() {
+
+        try {
+            ImageReader reader = null;
+
+            String fileName = "thumbimg.jpg";
+            String sep = System.getProperty("file.separator");
+            String dir = System.getProperty("test.src", ".");
+            String filePath = dir+sep+fileName;
+            System.out.println("Test file: " + filePath);
+            File f = new File(filePath);
+
+            ImageInputStream iis = ImageIO.createImageInputStream(f);
+            Iterator readerIt = ImageIO.getImageReaders(iis);
+            if (readerIt.hasNext()) {
+                reader = (ImageReader) readerIt.next();
+            }
+
+            if (reader == null) {
+                error("FAIL: Reader is not available for reading a " +
+                      "JPG image with thumbnails. Test Aborted !!");
+            }
+
+            reader.setInput(iis);
+
+            if (!reader.readerSupportsThumbnails()) {
+                error("FAIL: JPG Reader fails to support thumbnails."
+                        + " Test aborted !!");
+            }
+
+            int numThumbnails = reader.getNumThumbnails(0);
+            if (numThumbnails <= 0) {
+                error(" FAIL: Reader.getNumThumbnails() returns 0 when the " +
+                      "input image contains some thumbnails");
+            }
+            IIOImage iioImg = reader.readAll(0, null);
+            int thumbnailsRead = iioImg.getNumThumbnails();
+
+            if (numThumbnails == thumbnailsRead) {
+                System.out.println("PASS: Thumbnails are read properly by"
+                        + " ImageReader.readAll(index, readParam) ");
+            } else {
+                error("FAIL: Some of the thumbnails are not read" +
+                      " from the input source when calling" +
+                      " ImageReader.readAll(index, readParam) ");
+            }
+
+            iis = ImageIO.createImageInputStream(f);
+            reader.setInput(iis);
+
+            iioImg = null;
+            Iterator imgIter = reader.readAll(null);
+            if (imgIter.hasNext()) {
+                iioImg = (IIOImage) imgIter.next();
+                thumbnailsRead = iioImg.getNumThumbnails();
+
+                if (numThumbnails == thumbnailsRead) {
+                    System.out.println("PASS: Thumbnails are read properly by"
+                            + " ImageReader.readAll(Iter)");
+                } else {
+                    error("FAIL: Some of the thumbnails are not read " +
+                          "from the input source when calling"
+                            + " ImageReader.readAll(Iter)");
+                }
+            } else {
+                error("FAIL: ImageReader.readAll(Iter) fails to read the image"
+                        + " & thumbnails from the input source");
+            }
+
+        } catch (Exception e) {
+            error(" FAIL: The following exception is thrown by " +
+                  "ImageReader.readAll() method when input source contains " +
+                  "some thumbnails. Exception: " + e.toString());
+        }
+
+    }
+
+    public final void error(String mesg) {
+        throw new RuntimeException(mesg);
+    }
+
+    public static void main(String args[]) {
+        ReadAllThumbnailsTest test = new ReadAllThumbnailsTest();
+    }
+}
diff --git a/jdk/test/javax/imageio/plugins/jpeg/thumbimg.jpg b/jdk/test/javax/imageio/plugins/jpeg/thumbimg.jpg
new file mode 100644
index 0000000..8370755
--- /dev/null
+++ b/jdk/test/javax/imageio/plugins/jpeg/thumbimg.jpg
Binary files differ
diff --git a/jdk/test/javax/imageio/plugins/tiff/MultiPageImageTIFFFieldTest.java b/jdk/test/javax/imageio/plugins/tiff/MultiPageImageTIFFFieldTest.java
index 4a57578..14a5741 100644
--- a/jdk/test/javax/imageio/plugins/tiff/MultiPageImageTIFFFieldTest.java
+++ b/jdk/test/javax/imageio/plugins/tiff/MultiPageImageTIFFFieldTest.java
@@ -23,7 +23,6 @@
 
 /**
  * @test
- * @ignore  8148454
  * @bug     8152183 8148454
  * @author  a.stepanov
  * @summary check that TIFFields are derived properly for multi-page tiff
diff --git a/jdk/test/javax/print/attribute/TestOrientationSupportForStreamPrnSrv.java b/jdk/test/javax/print/attribute/TestOrientationSupportForStreamPrnSrv.java
new file mode 100644
index 0000000..1817804
--- /dev/null
+++ b/jdk/test/javax/print/attribute/TestOrientationSupportForStreamPrnSrv.java
@@ -0,0 +1,80 @@
+/*
+ * 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.
+ */
+/*
+ * @test
+ * @bug 4882305
+ * @summary  Verifies if StreamPrintServ.getSupportedAttributeValues returns
+ *           valid Orientation attribute and not null for image/jpeg DocFlavor.
+ * @run main TestOrientationSupportForStreamPrnSrv
+ */
+import java.io.File;
+import java.io.FileOutputStream;
+import javax.print.DocFlavor;
+import javax.print.PrintService;
+import javax.print.PrintServiceLookup;
+import javax.print.StreamPrintServiceFactory;
+import javax.print.attribute.standard.OrientationRequested;
+
+public class TestOrientationSupportForStreamPrnSrv {
+
+    public static void main(java.lang.String[] args) throws Exception {
+        PrintService service = null;
+        PrintService defService = PrintServiceLookup.lookupDefaultPrintService();
+        File f = null;
+        FileOutputStream fos = null;
+        String mType = "application/postscript";
+        DocFlavor flavors[] = null;
+
+        f = new File("streamexample1.ps");
+        fos = new FileOutputStream(f);
+        StreamPrintServiceFactory[] factories = StreamPrintServiceFactory.
+                lookupStreamPrintServiceFactories(DocFlavor.INPUT_STREAM.JPEG,
+                        mType);
+        if (factories.length > 0) {
+            System.out.println("output format "+factories[0].getOutputFormat());
+            service = factories[0].getPrintService(fos);
+            flavors = factories[0].getSupportedDocFlavors();
+        }
+        System.out.println("Stream Print Service "+service);
+
+        if (service == null) {
+            throw new RuntimeException("No Stream Print Service found");
+        }
+        System.out.println("is OrientationRequested supported? "+
+                service.isAttributeCategorySupported(OrientationRequested.class));
+
+        for (int k = 0; k < flavors.length; k ++) {
+            Object obj = service.getSupportedAttributeValues(OrientationRequested.class,
+                    flavors[k], null);
+            if (flavors[k].equals(DocFlavor.INPUT_STREAM.JPEG)) {
+                if (obj == null) {
+                    throw new RuntimeException(""
+                            + "StreamPrintServ.getSupportedAttributeValues "
+                            + "returns null for image/jpeg DocFlavor for "
+                            + "supported Orientation category");
+                }
+            }
+        }
+    }
+}
+
diff --git a/jdk/test/javax/swing/AbstractButton/6711682/bug6711682.java b/jdk/test/javax/swing/AbstractButton/6711682/bug6711682.java
index 3e15537..72808d4 100644
--- a/jdk/test/javax/swing/AbstractButton/6711682/bug6711682.java
+++ b/jdk/test/javax/swing/AbstractButton/6711682/bug6711682.java
@@ -21,12 +21,14 @@
  * questions.
  */
 
-/* @test
-   @bug 6711682
-   @summary  JCheckBox in JTable: checkbox doesn't alaways respond to the first mouse click
-   @author Alexander Potochkin
-   @run main bug6711682
-*/
+/*
+ * @test
+ * @key headful
+ * @bug 6711682
+ * @summary  JCheckBox in JTable: checkbox doesn't alaways respond to the first mouse click
+ * @author Alexander Potochkin
+ * @run main bug6711682
+ */
 
 import javax.swing.*;
 import javax.swing.event.CellEditorListener;
diff --git a/jdk/test/javax/swing/Action/8133039/bug8133039.java b/jdk/test/javax/swing/Action/8133039/bug8133039.java
index 3bfbe2d..cec80f2 100644
--- a/jdk/test/javax/swing/Action/8133039/bug8133039.java
+++ b/jdk/test/javax/swing/Action/8133039/bug8133039.java
@@ -35,6 +35,7 @@
 
 /**
  * @test
+ * @key headful
  * @bug 8133039
  * @summary Provide public API to sun.swing.UIAction#isEnabled(Object)
  * @modules java.desktop/sun.swing
diff --git a/jdk/test/javax/swing/AncestorNotifier/7193219/bug7193219.java b/jdk/test/javax/swing/AncestorNotifier/7193219/bug7193219.java
index 9fc6a7d..1b77343 100644
--- a/jdk/test/javax/swing/AncestorNotifier/7193219/bug7193219.java
+++ b/jdk/test/javax/swing/AncestorNotifier/7193219/bug7193219.java
@@ -21,11 +21,13 @@
  * questions.
  */
 
-/* @test
-   @bug 7193219
-   @summary JComboBox serialization fails in JDK 1.7
-   @author Anton Litvinov
-*/
+/*
+ * @test
+ * @key headful
+ * @bug 7193219
+ * @summary JComboBox serialization fails in JDK 1.7
+ * @author Anton Litvinov
+ */
 
 import java.io.*;
 
diff --git a/jdk/test/javax/swing/GroupLayout/8013566/bug8013566.java b/jdk/test/javax/swing/GroupLayout/8013566/bug8013566.java
index 886da01..6fc0da8 100644
--- a/jdk/test/javax/swing/GroupLayout/8013566/bug8013566.java
+++ b/jdk/test/javax/swing/GroupLayout/8013566/bug8013566.java
@@ -21,12 +21,14 @@
  * questions.
  */
 
-/* @test
-   @bug 8013566
-   @summary Failure of GroupLayout in combination of addPreferredGap and addGroup's
-   last row
-   @author Semyon Sadetsky
-*/
+/*
+ * @test
+ * @key headful
+ * @bug 8013566
+ * @summary Failure of GroupLayout in combination of addPreferredGap and addGroup's
+ * last row
+ * @author Semyon Sadetsky
+ */
 
 import javax.swing.*;
 
diff --git a/jdk/test/javax/swing/GroupLayout/8079640/bug8079640.java b/jdk/test/javax/swing/GroupLayout/8079640/bug8079640.java
index c61949f..2956377 100644
--- a/jdk/test/javax/swing/GroupLayout/8079640/bug8079640.java
+++ b/jdk/test/javax/swing/GroupLayout/8079640/bug8079640.java
@@ -21,11 +21,13 @@
  * questions.
  */
 
-/* @test
-   @bug 8079640
-   @summary GroupLayout incorrect layout with large JTextArea
-   @author Semyon Sadetsky
-  */
+/*
+ * @test
+ * @key headful
+ * @bug 8079640
+ * @summary GroupLayout incorrect layout with large JTextArea
+ * @author Semyon Sadetsky
+ */
 
 
 import javax.swing.*;
diff --git a/jdk/test/javax/swing/InputVerifier/VerifyTarget/VerifyTargetTest.java b/jdk/test/javax/swing/InputVerifier/VerifyTarget/VerifyTargetTest.java
index 86bd6dd..2cb1c63 100644
--- a/jdk/test/javax/swing/InputVerifier/VerifyTarget/VerifyTargetTest.java
+++ b/jdk/test/javax/swing/InputVerifier/VerifyTarget/VerifyTargetTest.java
@@ -23,6 +23,7 @@
 
 /*
   @test
+  @key headful
   @bug 8154431
   @summary Allow source and target based validation for the focus transfer
            between two JComponents.
@@ -90,4 +91,4 @@
     public void focusLost(FocusEvent e) {
         success = false;
     }
-}
\ No newline at end of file
+}
diff --git a/jdk/test/javax/swing/JButton/4368790/bug4368790.java b/jdk/test/javax/swing/JButton/4368790/bug4368790.java
index 9a90fb7..a071fb5 100644
--- a/jdk/test/javax/swing/JButton/4368790/bug4368790.java
+++ b/jdk/test/javax/swing/JButton/4368790/bug4368790.java
@@ -21,12 +21,14 @@
  * questions.
  */
 
-/* @test
-   @bug 4368790
-   @summary JButton stays pressed when focus stolen
-   @author Alexander Potochkin
-   @run main bug4368790
-*/
+/*
+ * @test
+ * @key headful
+ *    @bug 4368790
+ *    @summary JButton stays pressed when focus stolen
+ *    @author Alexander Potochkin
+ *    @run main bug4368790
+ */
 
 import javax.swing.*;
 import java.awt.*;
diff --git a/jdk/test/javax/swing/JButton/JButtonPaintNPE/JButtonPaintNPE.java b/jdk/test/javax/swing/JButton/JButtonPaintNPE/JButtonPaintNPE.java
index e0182a5..9f01662 100644
--- a/jdk/test/javax/swing/JButton/JButtonPaintNPE/JButtonPaintNPE.java
+++ b/jdk/test/javax/swing/JButton/JButtonPaintNPE/JButtonPaintNPE.java
@@ -33,6 +33,7 @@
 
 /**
  * @test
+ * @key headful
  * @bug 8009919
  * @author Sergey Bylokhov
  * @library ../../../../lib/testlibrary/
diff --git a/jdk/test/javax/swing/JButton/PressedButtonRightClickTest.java b/jdk/test/javax/swing/JButton/PressedButtonRightClickTest.java
index c4cddc71..160465a 100644
--- a/jdk/test/javax/swing/JButton/PressedButtonRightClickTest.java
+++ b/jdk/test/javax/swing/JButton/PressedButtonRightClickTest.java
@@ -33,6 +33,7 @@
 
 /*
  * @test
+ * @key headful
  * @bug  8049069
  * @summary Tests whether right mouse click releases a pressed JButton
  */
diff --git a/jdk/test/javax/swing/JButton/TimeChangeButtonClickTest.java b/jdk/test/javax/swing/JButton/TimeChangeButtonClickTest.java
new file mode 100644
index 0000000..ac8e07d
--- /dev/null
+++ b/jdk/test/javax/swing/JButton/TimeChangeButtonClickTest.java
@@ -0,0 +1,220 @@
+/*
+ * 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.
+ */
+
+/*
+ * @test
+ * @bug 7096375
+ * @summary  Test that Swing does not ignore first click on a JButton after
+ * decreasing system's time
+ * @run main/manual TimeChangeButtonClickTest
+ */
+import java.awt.GridBagConstraints;
+import java.awt.GridBagLayout;
+import java.util.concurrent.CountDownLatch;
+import javax.swing.BorderFactory;
+import javax.swing.JPanel;
+import javax.swing.JTextArea;
+import javax.swing.SwingUtilities;
+import javax.swing.JButton;
+import javax.swing.JFrame;
+import java.awt.event.ActionEvent;
+import java.awt.event.ActionListener;
+import java.util.concurrent.TimeUnit;
+import javax.swing.Box;
+import javax.swing.JLabel;
+
+public class TimeChangeButtonClickTest {
+
+    public static void main(String args[]) throws Exception {
+        final CountDownLatch latch = new CountDownLatch(1);
+        TestUI test = new TestUI(latch);
+
+        SwingUtilities.invokeLater(new Runnable() {
+            @Override
+            public void run() {
+                try {
+                    test.createUI();
+                } catch (Exception ex) {
+                    throw new RuntimeException("Exception while creating test UI");
+                }
+            }
+        });
+
+        boolean status = latch.await(5, TimeUnit.MINUTES);
+
+        if (!status) {
+            System.out.println("Test timed out.");
+        }
+
+        SwingUtilities.invokeAndWait(new Runnable() {
+            @Override
+            public void run() {
+                try {
+                    test.disposeUI();
+                } catch (Exception ex) {
+                    throw new RuntimeException("Exception while disposing test UI");
+                }
+            }
+        });
+
+        if (test.testResult == false) {
+            throw new RuntimeException("Test Failed.");
+        }
+    }
+}
+
+class TestUI {
+
+    private static JFrame mainFrame;
+    private static JPanel mainControlPanel;
+
+    private static JTextArea instructionTextArea;
+
+    private static JPanel resultButtonPanel;
+    private static JButton passButton;
+    private static JButton failButton;
+
+    private static JPanel testPanel;
+    private static JButton testButton;
+    private static JLabel buttonPressCountLabel;
+
+    private static GridBagLayout layout;
+    private final CountDownLatch latch;
+    public boolean testResult = false;
+    private int buttonPressCount = 0;
+
+    public TestUI(CountDownLatch latch) throws Exception {
+        this.latch = latch;
+    }
+
+    public final void createUI() throws Exception {
+
+        mainFrame = new JFrame("TimeChangeButtonClickTest");
+
+        layout = new GridBagLayout();
+        mainControlPanel = new JPanel(layout);
+        resultButtonPanel = new JPanel(layout);
+        testPanel = new JPanel(layout);
+
+        GridBagConstraints gbc = new GridBagConstraints();
+
+        // Create Test instructions
+        String instructions
+                = "Test 1 : --------------------\n"
+                + "1. Click 'Test Button' with left mouse button\n"
+                + "Observe : Button Press count change to 1\n"
+                + "Test 2 : --------------------\n"
+                + "1. Change the system time to one hour less than current time\n"
+                + "2. Click 'Test Button' with left mouse button\n"
+                + "Observe : Button Press count change to 2\n"
+                + "Test 3 : --------------------\n"
+                + "1. Change the system time by adding two hours\n"
+                + "2. Click 'Test Button' with left mouse button\n"
+                + "Observe : Button Press count change to 3\n"
+                + "--------------------\n"
+                + "Restore the system time.\n"
+                + "--------------------\n"
+                + "Press 'Pass' if Button Press count is 3, 'Fail' otherwise";
+
+        instructionTextArea = new JTextArea();
+        instructionTextArea.setText(instructions);
+        instructionTextArea.setEditable(false);
+        instructionTextArea.setBorder(BorderFactory.
+                createTitledBorder("Test Instructions"));
+
+        gbc.gridx = 0;
+        gbc.gridy = 0;
+        gbc.fill = GridBagConstraints.HORIZONTAL;
+        mainControlPanel.add(instructionTextArea, gbc);
+
+        // Create Test Button and label
+        testButton = new JButton("Test Button");
+        testButton.addActionListener(new ActionListener() {
+            @Override
+            public void actionPerformed(ActionEvent e) {
+                buttonPressCount++;
+                buttonPressCountLabel.setText(
+                        "Button Press Count : " + buttonPressCount);
+            }
+        });
+
+        gbc.gridx = 0;
+        gbc.gridy = 0;
+        testPanel.add(testButton, gbc);
+
+        gbc.gridx = 0;
+        gbc.gridy = 1;
+        testPanel.add(Box.createVerticalStrut(50));
+
+        gbc.gridx = 0;
+        gbc.gridy = 2;
+        buttonPressCountLabel = new JLabel(
+                "Button Press Count : " + buttonPressCount);
+        testPanel.add(buttonPressCountLabel, gbc);
+
+        mainControlPanel.add(testPanel);
+
+        // Create resultButtonPanel with Pass, Fail buttons
+        passButton = new JButton("Pass");
+        passButton.setActionCommand("Pass");
+        passButton.addActionListener((ActionEvent e) -> {
+            System.out.println("Pass Button pressed!");
+            testResult = true;
+            latch.countDown();
+
+        });
+
+        failButton = new JButton("Fail");
+        failButton.setActionCommand("Fail");
+        failButton.addActionListener(new ActionListener() {
+            @Override
+            public void actionPerformed(ActionEvent e) {
+                System.out.println("Fail Button pressed!");
+                testResult = false;
+                latch.countDown();
+            }
+        });
+
+        gbc.gridx = 0;
+        gbc.gridy = 0;
+        resultButtonPanel.add(passButton, gbc);
+        gbc.gridx = 1;
+        gbc.gridy = 0;
+        resultButtonPanel.add(failButton, gbc);
+
+        gbc.gridx = 0;
+        gbc.gridy = 1;
+        mainControlPanel.add(resultButtonPanel, gbc);
+
+        mainFrame.add(mainControlPanel);
+
+        mainFrame.pack();
+        mainFrame.setVisible(true);
+    }
+
+    public void disposeUI() {
+        mainFrame.setVisible(false);
+        mainFrame.dispose();
+    }
+}
+
diff --git a/jdk/test/javax/swing/JColorChooser/Test6541987.java b/jdk/test/javax/swing/JColorChooser/Test6541987.java
index 7a946e1..84053cd 100644
--- a/jdk/test/javax/swing/JColorChooser/Test6541987.java
+++ b/jdk/test/javax/swing/JColorChooser/Test6541987.java
@@ -23,6 +23,7 @@
 
 /*
  * @test
+ * @key headful
  * @bug 6541987
  * @summary Tests closing by ESC
  * @author Sergey Malenkov
diff --git a/jdk/test/javax/swing/JColorChooser/Test6559154.java b/jdk/test/javax/swing/JColorChooser/Test6559154.java
index ab2a8ba..1ebc4d9 100644
--- a/jdk/test/javax/swing/JColorChooser/Test6559154.java
+++ b/jdk/test/javax/swing/JColorChooser/Test6559154.java
@@ -23,6 +23,7 @@
 
 /*
  * @test
+ * @key headful
  * @bug 6559154
  * @summary Tests EDT hanging
  * @author Sergey Malenkov
diff --git a/jdk/test/javax/swing/JColorChooser/Test6827032.java b/jdk/test/javax/swing/JColorChooser/Test6827032.java
index 4d89987..fff9834 100644
--- a/jdk/test/javax/swing/JColorChooser/Test6827032.java
+++ b/jdk/test/javax/swing/JColorChooser/Test6827032.java
@@ -23,6 +23,7 @@
 
 /*
  * @test
+ * @key headful
  * @bug 6827032
  * @summary Color chooser with drag enabled shouldn't throw NPE
  * @author Peter Zhelezniakov
diff --git a/jdk/test/javax/swing/JColorChooser/Test7194184.java b/jdk/test/javax/swing/JColorChooser/Test7194184.java
index 7020176..460aefa 100644
--- a/jdk/test/javax/swing/JColorChooser/Test7194184.java
+++ b/jdk/test/javax/swing/JColorChooser/Test7194184.java
@@ -27,6 +27,7 @@
 
 /*
  * @test
+ * @key headful
  * @bug 7194184
  * @summary Tests JColorChooser Swatch keyboard accessibility.
  * @author Sean Chou
diff --git a/jdk/test/javax/swing/JColorChooser/Test8051548.java b/jdk/test/javax/swing/JColorChooser/Test8051548.java
index fe9a6eb..287601f 100644
--- a/jdk/test/javax/swing/JColorChooser/Test8051548.java
+++ b/jdk/test/javax/swing/JColorChooser/Test8051548.java
@@ -37,6 +37,7 @@
 
 /*
  * @test
+ * @key headful
  * @bug 8051548
  * @summary JColorChooser should have a way to disable transparency controls
  * @author Alexandr Scherbatiy
diff --git a/jdk/test/javax/swing/JComboBox/4199622/bug4199622.java b/jdk/test/javax/swing/JComboBox/4199622/bug4199622.java
index 6293a3ed..e96e2cd 100644
--- a/jdk/test/javax/swing/JComboBox/4199622/bug4199622.java
+++ b/jdk/test/javax/swing/JComboBox/4199622/bug4199622.java
@@ -21,7 +21,9 @@
  * questions.
  */
 
-/* @test
+/*
+   @test
+   @key headful
    @bug 4199622
    @summary RFE: JComboBox shouldn't send ActionEvents for keyboard navigation
    @author Vladislav Karnaukhov
@@ -29,7 +31,7 @@
    @modules java.desktop/com.sun.java.swing.plaf.windows
    @build jdk.testlibrary.OSInfo
    @run main bug4199622
-*/
+ */
 
 import com.sun.java.swing.plaf.windows.WindowsLookAndFeel;
 import jdk.testlibrary.OSInfo;
diff --git a/jdk/test/javax/swing/JComboBox/4515752/DefaultButtonTest.java b/jdk/test/javax/swing/JComboBox/4515752/DefaultButtonTest.java
index 88abb7b..eeb87ce 100644
--- a/jdk/test/javax/swing/JComboBox/4515752/DefaultButtonTest.java
+++ b/jdk/test/javax/swing/JComboBox/4515752/DefaultButtonTest.java
@@ -27,6 +27,7 @@
 
 /**
  * @test
+ * @key headful
  * @bug 4515752 4337071
  * @author Mark Davidson
  * @summary Tests the invocation of the default button within the JComboBox.
diff --git a/jdk/test/javax/swing/JComboBox/4523758/bug4523758.java b/jdk/test/javax/swing/JComboBox/4523758/bug4523758.java
index 423f89d..25e5ee6 100644
--- a/jdk/test/javax/swing/JComboBox/4523758/bug4523758.java
+++ b/jdk/test/javax/swing/JComboBox/4523758/bug4523758.java
@@ -21,7 +21,9 @@
  * questions.
  */
 
-/* @test
+/*
+ * @test
+ * @key headful
  * @bug 4523758
  * @summary Directly check that torn-off combo works
  * @library ../../../../lib/testlibrary
diff --git a/jdk/test/javax/swing/JComboBox/4743225/bug4743225.java b/jdk/test/javax/swing/JComboBox/4743225/bug4743225.java
index 76c2f1c..76ace04 100644
--- a/jdk/test/javax/swing/JComboBox/4743225/bug4743225.java
+++ b/jdk/test/javax/swing/JComboBox/4743225/bug4743225.java
@@ -21,7 +21,9 @@
  * questions.
  */
 
-/* @test
+/*
+ * @test
+ * @key headful
  * @bug 4743225
  * @summary Size of JComboBox list is wrong when list is populated via PopupMenuListener
  * @author Alexander Potochkin
diff --git a/jdk/test/javax/swing/JComboBox/6236162/bug6236162.java b/jdk/test/javax/swing/JComboBox/6236162/bug6236162.java
index 66d6cb7..56b85ff 100644
--- a/jdk/test/javax/swing/JComboBox/6236162/bug6236162.java
+++ b/jdk/test/javax/swing/JComboBox/6236162/bug6236162.java
@@ -20,16 +20,19 @@
  * or visit www.oracle.com if you need additional information or have any
  * questions.
  */
-/* @test
-   @bug 6236162
-   @summary Checks that there is no an inconsistence in combo box
-            behavior when user points an item in combo popup
-            by mouse and then uses UP/DOWN keys.
-   @library ../../regtesthelpers
-   @build Util
-   @author Mikhail Lapshin
-   @run main bug6236162
-*/
+
+/*
+ * @test
+ * @key headful
+ * @bug 6236162
+ * @summary Checks that there is no an inconsistence in combo box
+ *          behavior when user points an item in combo popup
+ *          by mouse and then uses UP/DOWN keys.
+ * @library ../../regtesthelpers
+ * @build Util
+ * @author Mikhail Lapshin
+ * @run main bug6236162
+ */
 
 import javax.swing.*;
 import javax.swing.plaf.basic.*;
diff --git a/jdk/test/javax/swing/JComboBox/6406264/bug6406264.java b/jdk/test/javax/swing/JComboBox/6406264/bug6406264.java
index 91356c3..75de8c9 100644
--- a/jdk/test/javax/swing/JComboBox/6406264/bug6406264.java
+++ b/jdk/test/javax/swing/JComboBox/6406264/bug6406264.java
@@ -23,11 +23,13 @@
  * questions.
  */
 
-/* @test
-   @bug 6406264
-   @summary Tests that JComboBox's focusable popup can be shown.
-   @author Mikhail Lapshin
-   @run main bug6406264
+/*
+ * @test
+ * @key headful
+ * @bug 6406264
+ * @summary Tests that JComboBox's focusable popup can be shown.
+ * @author Mikhail Lapshin
+ * @run main bug6406264
  */
 
 import javax.swing.JComboBox;
diff --git a/jdk/test/javax/swing/JComboBox/6559152/bug6559152.java b/jdk/test/javax/swing/JComboBox/6559152/bug6559152.java
index d04e600..a857f96 100644
--- a/jdk/test/javax/swing/JComboBox/6559152/bug6559152.java
+++ b/jdk/test/javax/swing/JComboBox/6559152/bug6559152.java
@@ -20,15 +20,18 @@
  * or visit www.oracle.com if you need additional information or have any
  * questions.
  */
-/* @test
-   @bug 6559152
-   @summary Checks that you can select an item in JComboBox with keyboard
-            when it is a JTable cell editor.
-   @author Mikhail Lapshin
-   @library ../../../../lib/testlibrary
-   @build ExtendedRobot
-   @run main bug6559152
-*/
+
+/*
+ * @test
+ * @key headful
+ * @bug 6559152
+ * @summary Checks that you can select an item in JComboBox with keyboard
+ *          when it is a JTable cell editor.
+ * @author Mikhail Lapshin
+ * @library ../../../../lib/testlibrary
+ * @build ExtendedRobot
+ * @run main bug6559152
+ */
 
 import javax.swing.*;
 import javax.swing.table.DefaultTableModel;
diff --git a/jdk/test/javax/swing/JComboBox/6607130/bug6607130.java b/jdk/test/javax/swing/JComboBox/6607130/bug6607130.java
index 86850f3..f80da53 100644
--- a/jdk/test/javax/swing/JComboBox/6607130/bug6607130.java
+++ b/jdk/test/javax/swing/JComboBox/6607130/bug6607130.java
@@ -21,7 +21,9 @@
  * questions.
  */
 
-/* @test
+/*
+ * @test
+ * @key headful
  * @bug 6607130
  * @summary Checks that JComboBox cell editor is hidden if the same
  *          item is selected with keyboard.
diff --git a/jdk/test/javax/swing/JComboBox/7195179/Test7195179.java b/jdk/test/javax/swing/JComboBox/7195179/Test7195179.java
index f22084a..7680bea 100644
--- a/jdk/test/javax/swing/JComboBox/7195179/Test7195179.java
+++ b/jdk/test/javax/swing/JComboBox/7195179/Test7195179.java
@@ -35,6 +35,7 @@
 
 /*
  * @test
+ * @key headful
  * @bug 7195179
  * @summary Tests that combobox works with generified renderers
  * @author Sergey Malenkov
diff --git a/jdk/test/javax/swing/JComboBox/8015300/Test8015300.java b/jdk/test/javax/swing/JComboBox/8015300/Test8015300.java
index 48b3a40..747418b 100644
--- a/jdk/test/javax/swing/JComboBox/8015300/Test8015300.java
+++ b/jdk/test/javax/swing/JComboBox/8015300/Test8015300.java
@@ -37,8 +37,9 @@
 
 /*
  * @test
+ * @key headful
  * @bug 8015300
- * @summary Tests that editable combobox select all text
+ * @summary Tests that editable combobox selects all text.
  * @author Sergey Malenkov
  * @library ../../../../lib/testlibrary/
  * @modules java.desktop/com.sun.java.swing.plaf.windows
diff --git a/jdk/test/javax/swing/JComboBox/8032878/bug8032878.java b/jdk/test/javax/swing/JComboBox/8032878/bug8032878.java
index c20e486..195bb4d 100644
--- a/jdk/test/javax/swing/JComboBox/8032878/bug8032878.java
+++ b/jdk/test/javax/swing/JComboBox/8032878/bug8032878.java
@@ -21,7 +21,9 @@
  * questions.
  */
 
-/* @test
+/*
+ * @test
+ * @key headful
  * @bug 8032878 8078855
  * @summary Checks that JComboBox as JTable cell editor processes key events
  *          even where setSurrendersFocusOnKeystroke flag in JTable is false and
diff --git a/jdk/test/javax/swing/JComboBox/8033069/bug8033069NoScrollBar.java b/jdk/test/javax/swing/JComboBox/8033069/bug8033069NoScrollBar.java
index 9850aa2..c07ad3a 100644
--- a/jdk/test/javax/swing/JComboBox/8033069/bug8033069NoScrollBar.java
+++ b/jdk/test/javax/swing/JComboBox/8033069/bug8033069NoScrollBar.java
@@ -35,7 +35,9 @@
 import javax.swing.UIManager.LookAndFeelInfo;
 import javax.swing.UnsupportedLookAndFeelException;
 
-/* @test
+/*
+ * @test
+ * @key headful
  * @bug 8033069
  * @summary Checks that JComboBox popup does not close when mouse wheel is
  *          rotated over combo box and over its popup. The case where popup
diff --git a/jdk/test/javax/swing/JComboBox/8033069/bug8033069ScrollBar.java b/jdk/test/javax/swing/JComboBox/8033069/bug8033069ScrollBar.java
index fed71e6..bb1d5be 100644
--- a/jdk/test/javax/swing/JComboBox/8033069/bug8033069ScrollBar.java
+++ b/jdk/test/javax/swing/JComboBox/8033069/bug8033069ScrollBar.java
@@ -23,7 +23,9 @@
 
 import java.awt.AWTException;
 
-/* @test
+/*
+ * @test
+ * @key headful
  * @bug 8033069
  * @summary Checks that JComboBox popup does not close when mouse wheel is
  *          rotated over combo box and over its popup. The case where
diff --git a/jdk/test/javax/swing/JComboBox/8057893/bug8057893.java b/jdk/test/javax/swing/JComboBox/8057893/bug8057893.java
index 76944ed..de8efce 100644
--- a/jdk/test/javax/swing/JComboBox/8057893/bug8057893.java
+++ b/jdk/test/javax/swing/JComboBox/8057893/bug8057893.java
@@ -33,6 +33,7 @@
 
 /**
  * @test
+ * @key headful
  * @bug 8057893
  * @author Alexander Scherbatiy
  * @summary JComboBox actionListener never receives "comboBoxEdited"
diff --git a/jdk/test/javax/swing/JComboBox/8072767/bug8072767.java b/jdk/test/javax/swing/JComboBox/8072767/bug8072767.java
index 826e463..9cfddd4 100644
--- a/jdk/test/javax/swing/JComboBox/8072767/bug8072767.java
+++ b/jdk/test/javax/swing/JComboBox/8072767/bug8072767.java
@@ -37,6 +37,7 @@
 
 /**
  * @test
+ * @key headful
  * @bug 8072767
  * @author Alexander Scherbatiy
  * @summary DefaultCellEditor for comboBox creates ActionEvent with wrong source
diff --git a/jdk/test/javax/swing/JComboBox/8136998/bug8136998.java b/jdk/test/javax/swing/JComboBox/8136998/bug8136998.java
index e7d9e0a..8da5d36 100644
--- a/jdk/test/javax/swing/JComboBox/8136998/bug8136998.java
+++ b/jdk/test/javax/swing/JComboBox/8136998/bug8136998.java
@@ -38,7 +38,9 @@
 import javax.swing.UnsupportedLookAndFeelException;
 import javax.swing.WindowConstants;
 
-/* @test
+/*
+ * @test
+ * @key headful
  * @bug 8136998
  * @summary Checks that JComboBox does not prevent mouse-wheel scrolling JScrollPane.
  * @library ../../regtesthelpers
diff --git a/jdk/test/javax/swing/JComboBox/ConsumedKeyTest/ConsumedKeyTest.java b/jdk/test/javax/swing/JComboBox/ConsumedKeyTest/ConsumedKeyTest.java
index 12128cd..0169a75 100644
--- a/jdk/test/javax/swing/JComboBox/ConsumedKeyTest/ConsumedKeyTest.java
+++ b/jdk/test/javax/swing/JComboBox/ConsumedKeyTest/ConsumedKeyTest.java
@@ -27,6 +27,7 @@
 
 /*
   @test
+  @key headful
   @bug 8031485 8058193
   @summary Combo box consuming escape and enter key events
   @author Petr Pchelko
diff --git a/jdk/test/javax/swing/JComboBox/ShowPopupAfterHidePopupTest/ShowPopupAfterHidePopupTest.java b/jdk/test/javax/swing/JComboBox/ShowPopupAfterHidePopupTest/ShowPopupAfterHidePopupTest.java
index 52b9e71..df2ac32 100644
--- a/jdk/test/javax/swing/JComboBox/ShowPopupAfterHidePopupTest/ShowPopupAfterHidePopupTest.java
+++ b/jdk/test/javax/swing/JComboBox/ShowPopupAfterHidePopupTest/ShowPopupAfterHidePopupTest.java
@@ -21,12 +21,14 @@
  * questions.
  */
 
-/* @test
-   @bug 8006417
-   @summary JComboBox.showPopup(), hidePopup() fails in JRE 1.7 on OS X
-   @author Anton Litvinov
-   @run main ShowPopupAfterHidePopupTest
-*/
+/*
+ * @test
+ * @key headful
+ * @bug 8006417
+ * @summary JComboBox.showPopup(), hidePopup() fails in JRE 1.7 on OS X
+ * @author Anton Litvinov
+ * @run main ShowPopupAfterHidePopupTest
+ */
 
 import java.awt.*;
 
diff --git a/jdk/test/javax/swing/JComponent/6989617/bug6989617.java b/jdk/test/javax/swing/JComponent/6989617/bug6989617.java
index a13201d..ff6bd7f 100644
--- a/jdk/test/javax/swing/JComponent/6989617/bug6989617.java
+++ b/jdk/test/javax/swing/JComponent/6989617/bug6989617.java
@@ -21,12 +21,14 @@
  * questions.
  */
 
-/* @test
-   @bug 6989617
-   @summary Enable JComponent to control repaintings of its children
-   @author Alexander Potochkin
-   @run main bug6989617
-*/
+/*
+ * @test
+ * @key headful
+ * @bug 6989617
+ * @summary Enable JComponent to control repaintings of its children
+ * @author Alexander Potochkin
+ * @run main bug6989617
+ */
 
 import javax.swing.*;
 import java.awt.*;
diff --git a/jdk/test/javax/swing/JComponent/7154030/bug7154030.java b/jdk/test/javax/swing/JComponent/7154030/bug7154030.java
index dab2d3c..b671a1f 100644
--- a/jdk/test/javax/swing/JComponent/7154030/bug7154030.java
+++ b/jdk/test/javax/swing/JComponent/7154030/bug7154030.java
@@ -40,7 +40,9 @@
 import java.awt.Toolkit;
 import java.awt.image.BufferedImage;
 
-/* @test 1.1 2012/04/12
+/*
+ * @test
+ * @key headful
  * @bug 7154030
  * @summary Swing components fail to hide after calling hide()
  * @author Jonathan Lu
diff --git a/jdk/test/javax/swing/JDialog/Transparency/TransparencyTest.java b/jdk/test/javax/swing/JDialog/Transparency/TransparencyTest.java
index cb2ba23..5c6080c 100644
--- a/jdk/test/javax/swing/JDialog/Transparency/TransparencyTest.java
+++ b/jdk/test/javax/swing/JDialog/Transparency/TransparencyTest.java
@@ -23,6 +23,7 @@
 
  /*
  @test
+ @key headful
  @bug 8062946
  @summary Verify Transparency upon iconify/deiconify sequence
  @run main TransparencyTest
diff --git a/jdk/test/javax/swing/JDialog/WrongBackgroundColor/WrongBackgroundColor.java b/jdk/test/javax/swing/JDialog/WrongBackgroundColor/WrongBackgroundColor.java
index 63b6e71c..a910e0d 100644
--- a/jdk/test/javax/swing/JDialog/WrongBackgroundColor/WrongBackgroundColor.java
+++ b/jdk/test/javax/swing/JDialog/WrongBackgroundColor/WrongBackgroundColor.java
@@ -33,6 +33,7 @@
 
 /**
  * @test
+ * @key headful
  * @bug 8033786
  * @summary JDialog should update background color of the native peer.
  * @author Sergey Bylokhov
diff --git a/jdk/test/javax/swing/JEditorPane/4492274/bug4492274.java b/jdk/test/javax/swing/JEditorPane/4492274/bug4492274.java
index 369f05f..179450d 100644
--- a/jdk/test/javax/swing/JEditorPane/4492274/bug4492274.java
+++ b/jdk/test/javax/swing/JEditorPane/4492274/bug4492274.java
@@ -21,7 +21,9 @@
  * questions.
  */
 
-/* @test
+/*
+ * @test
+ * @key headful
  * @bug 4492274
  * @summary  Tests if JEditorPane.getPage() correctly returns anchor reference.
  * @author Denis Sharypov
diff --git a/jdk/test/javax/swing/JEditorPane/6917744/bug6917744.java b/jdk/test/javax/swing/JEditorPane/6917744/bug6917744.java
index 75af983..8eaa525 100644
--- a/jdk/test/javax/swing/JEditorPane/6917744/bug6917744.java
+++ b/jdk/test/javax/swing/JEditorPane/6917744/bug6917744.java
@@ -21,7 +21,9 @@
  * questions.
  */
 
-/* @test
+/*
+ * @test
+ * @key headful
  * @bug 6917744
  * @summary JScrollPane Page Up/Down keys do not handle correctly html tables with different cells contents
  * @author Pavel Porvatov
diff --git a/jdk/test/javax/swing/JEditorPane/8146319/JEditorPaneTest.java b/jdk/test/javax/swing/JEditorPane/8146319/JEditorPaneTest.java
index 86a5173..1f0eded 100644
--- a/jdk/test/javax/swing/JEditorPane/8146319/JEditorPaneTest.java
+++ b/jdk/test/javax/swing/JEditorPane/8146319/JEditorPaneTest.java
@@ -23,6 +23,7 @@
 
 /*
  * @test
+ * @key headful
  * @bug 8146319
  * @summary JEditorPane function setPage leaves a file lock
  * @run main JEditorPaneTest
diff --git a/jdk/test/javax/swing/JFileChooser/4524490/bug4524490.java b/jdk/test/javax/swing/JFileChooser/4524490/bug4524490.java
index 81a5259..5fdb164 100644
--- a/jdk/test/javax/swing/JFileChooser/4524490/bug4524490.java
+++ b/jdk/test/javax/swing/JFileChooser/4524490/bug4524490.java
@@ -23,6 +23,7 @@
 
 /*
  * @test
+ * @key headful
  * @bug 4524490
  * @summary Tests if in JFileChooser, ALT+L does not bring focus to 'Files' selection list in Motif LAF
  * @author Konstantin Eremin
diff --git a/jdk/test/javax/swing/JFileChooser/6396844/TwentyThousandTest.java b/jdk/test/javax/swing/JFileChooser/6396844/TwentyThousandTest.java
index 977c85e..afc2fc4 100644
--- a/jdk/test/javax/swing/JFileChooser/6396844/TwentyThousandTest.java
+++ b/jdk/test/javax/swing/JFileChooser/6396844/TwentyThousandTest.java
@@ -23,6 +23,7 @@
 
 /*
  * @test
+ * @key headful
  * @bug 6396844
  * @summary Tests memory leak for 20000 files
  * @author Sergey Malenkov
diff --git a/jdk/test/javax/swing/JFileChooser/7199708/bug7199708.java b/jdk/test/javax/swing/JFileChooser/7199708/bug7199708.java
index f8265c8..588c62e 100644
--- a/jdk/test/javax/swing/JFileChooser/7199708/bug7199708.java
+++ b/jdk/test/javax/swing/JFileChooser/7199708/bug7199708.java
@@ -40,6 +40,7 @@
 
 /**
  * @test
+ * @key headful
  * @bug 7199708 8159587
  * @author Alexander Scherbatiy
  * @summary FileChooser crashs when opening large folder
diff --git a/jdk/test/javax/swing/JFileChooser/8002077/bug8002077.java b/jdk/test/javax/swing/JFileChooser/8002077/bug8002077.java
index 4a76b7d..d9fcdcf 100644
--- a/jdk/test/javax/swing/JFileChooser/8002077/bug8002077.java
+++ b/jdk/test/javax/swing/JFileChooser/8002077/bug8002077.java
@@ -30,6 +30,7 @@
 
 /**
  * @test
+ * @key headful
  * @bug 8002077
  * @author Alexander Scherbatiy
  * @summary Possible mnemonic issue on JFileChooser Save button on nimbus L&F
diff --git a/jdk/test/javax/swing/JFileChooser/8016665/JFileChooserOrientation.java b/jdk/test/javax/swing/JFileChooser/8016665/JFileChooserOrientation.java
index 4296d48..99b53a0 100644
--- a/jdk/test/javax/swing/JFileChooser/8016665/JFileChooserOrientation.java
+++ b/jdk/test/javax/swing/JFileChooser/8016665/JFileChooserOrientation.java
@@ -21,7 +21,9 @@
  * questions.
  */
 
-/* @test
+/*
+ * @test
+ * @key headful
  * @bug 8016665
  * @summary verifies different behaviour of JFileChooser changing orientation
  * @run main JFileChooserOrientation
diff --git a/jdk/test/javax/swing/JFileChooser/8021253/bug8021253.java b/jdk/test/javax/swing/JFileChooser/8021253/bug8021253.java
index 3839c5a..831711b 100644
--- a/jdk/test/javax/swing/JFileChooser/8021253/bug8021253.java
+++ b/jdk/test/javax/swing/JFileChooser/8021253/bug8021253.java
@@ -35,6 +35,7 @@
 
 /**
  * @test
+ * @key headful
  * @bug 8021253
  * @author Alexander Scherbatiy
  * @summary JFileChooser does not react on pressing enter since java 7
diff --git a/jdk/test/javax/swing/JFileChooser/8041694/bug8041694.java b/jdk/test/javax/swing/JFileChooser/8041694/bug8041694.java
index d24016b..e572e32 100644
--- a/jdk/test/javax/swing/JFileChooser/8041694/bug8041694.java
+++ b/jdk/test/javax/swing/JFileChooser/8041694/bug8041694.java
@@ -21,13 +21,15 @@
  * questions.
  */
 
-/* @test
-   @bug 8041694
-   @summary JFileChooser removes trailing spaces in the selected directory name
-   @author Anton Litvinov
-   @library ../../../../lib/testlibrary
-   @build jdk.testlibrary.OSInfo
-   @run main bug8041694
+/*
+ * @test
+ * @key headful
+ * @bug 8041694
+ * @summary JFileChooser removes trailing spaces in the selected directory name
+ * @author Anton Litvinov
+ * @library ../../../../lib/testlibrary
+ * @build jdk.testlibrary.OSInfo
+ * @run main bug8041694
  */
 
 import java.awt.AWTException;
diff --git a/jdk/test/javax/swing/JFileChooser/DeserializedJFileChooser/DeserializedJFileChooserTest.java b/jdk/test/javax/swing/JFileChooser/DeserializedJFileChooser/DeserializedJFileChooserTest.java
index 122b819..01e51c6 100644
--- a/jdk/test/javax/swing/JFileChooser/DeserializedJFileChooser/DeserializedJFileChooserTest.java
+++ b/jdk/test/javax/swing/JFileChooser/DeserializedJFileChooser/DeserializedJFileChooserTest.java
@@ -23,6 +23,7 @@
 
 /**
  * @test
+ * @key headful
  * @bug 8146301
  * @summary Enter key does not work in a deserialized JFileChooser.
  * @run main DeserializedJFileChooserTest
diff --git a/jdk/test/javax/swing/JFrame/HangNonVolatileBuffer/HangNonVolatileBuffer.java b/jdk/test/javax/swing/JFrame/HangNonVolatileBuffer/HangNonVolatileBuffer.java
index c61be1c..db8d0de 100644
--- a/jdk/test/javax/swing/JFrame/HangNonVolatileBuffer/HangNonVolatileBuffer.java
+++ b/jdk/test/javax/swing/JFrame/HangNonVolatileBuffer/HangNonVolatileBuffer.java
@@ -28,6 +28,7 @@
 
 /**
  * @test
+ * @key headful
  * @bug 8029455
  * @summary Swing should not hang if non-volatile image is used as a backbuffer.
  * @run main/othervm -Dswing.volatileImageBufferEnabled=false HangNonVolatileBuffer
diff --git a/jdk/test/javax/swing/JInternalFrame/4769772/TestJInternalFrameIconify.java b/jdk/test/javax/swing/JInternalFrame/4769772/TestJInternalFrameIconify.java
index 12bd49d..cbef0ff 100644
--- a/jdk/test/javax/swing/JInternalFrame/4769772/TestJInternalFrameIconify.java
+++ b/jdk/test/javax/swing/JInternalFrame/4769772/TestJInternalFrameIconify.java
@@ -23,6 +23,7 @@
 
 /*
  * @test
+ * @key headful
  * @bug 4769772
  * @summary JInternalFrame.setIcon(true) before JDesktopPane.add(JIF) causes wrong state
  * @run main TestJInternalFrameIconify
diff --git a/jdk/test/javax/swing/JInternalFrame/5066752/bug5066752.java b/jdk/test/javax/swing/JInternalFrame/5066752/bug5066752.java
index 3ed42fc..4182cca 100644
--- a/jdk/test/javax/swing/JInternalFrame/5066752/bug5066752.java
+++ b/jdk/test/javax/swing/JInternalFrame/5066752/bug5066752.java
@@ -22,6 +22,7 @@
  */
 /*
   @test
+  @key headful
   @bug 5066752
   @summary  Transparent JDesktopPane impossible because isOpaque() returns true
   @author mb50250: area=JDesktopPane
diff --git a/jdk/test/javax/swing/JInternalFrame/6647340/bug6647340.java b/jdk/test/javax/swing/JInternalFrame/6647340/bug6647340.java
index 8bb1ffc..283e40f 100644
--- a/jdk/test/javax/swing/JInternalFrame/6647340/bug6647340.java
+++ b/jdk/test/javax/swing/JInternalFrame/6647340/bug6647340.java
@@ -22,6 +22,7 @@
  */
 
 /* @test
+ * @key headful
  * @bug 6647340
  * @summary Checks that iconified internal frame follows
  *          the main frame borders properly.
diff --git a/jdk/test/javax/swing/JInternalFrame/6725409/bug6725409.java b/jdk/test/javax/swing/JInternalFrame/6725409/bug6725409.java
index b121e1d..c56eadd 100644
--- a/jdk/test/javax/swing/JInternalFrame/6725409/bug6725409.java
+++ b/jdk/test/javax/swing/JInternalFrame/6725409/bug6725409.java
@@ -22,6 +22,7 @@
  */
 
 /* @test
+ * @key headful
  * @bug 6725409
  * @summary Checks that JInternalFrame's system menu
  *          can be localized during run-time
diff --git a/jdk/test/javax/swing/JInternalFrame/8020708/bug8020708.java b/jdk/test/javax/swing/JInternalFrame/8020708/bug8020708.java
index 3a3f82b..4493624 100644
--- a/jdk/test/javax/swing/JInternalFrame/8020708/bug8020708.java
+++ b/jdk/test/javax/swing/JInternalFrame/8020708/bug8020708.java
@@ -35,6 +35,7 @@
 
 /**
  * @test
+ * @key headful
  * @bug 8020708 8032568
  * @author Alexander Scherbatiy
  * @summary NLS: mnemonics missing in SwingSet2/JInternalFrame demo
diff --git a/jdk/test/javax/swing/JInternalFrame/8069348/bug8069348.java b/jdk/test/javax/swing/JInternalFrame/8069348/bug8069348.java
index d9deeef..62d4923 100644
--- a/jdk/test/javax/swing/JInternalFrame/8069348/bug8069348.java
+++ b/jdk/test/javax/swing/JInternalFrame/8069348/bug8069348.java
@@ -36,6 +36,7 @@
 
 /**
  * @test
+ * @key headful
  * @bug 8069348
  * @summary SunGraphics2D.copyArea() does not properly work for scaled graphics
  * @author Alexandr Scherbatiy
diff --git a/jdk/test/javax/swing/JInternalFrame/8145896/TestJInternalFrameMaximize.java b/jdk/test/javax/swing/JInternalFrame/8145896/TestJInternalFrameMaximize.java
index e48a2da..5c176de 100644
--- a/jdk/test/javax/swing/JInternalFrame/8145896/TestJInternalFrameMaximize.java
+++ b/jdk/test/javax/swing/JInternalFrame/8145896/TestJInternalFrameMaximize.java
@@ -23,6 +23,7 @@
 
 /*
  * @test
+ * @key headful
  * @bug 8145896
  * @summary JInternalFrame setMaximum before adding to desktop throws null pointer exception
  * @library ../../regtesthelpers
diff --git a/jdk/test/javax/swing/JInternalFrame/8146321/JInternalFrameIconTest.java b/jdk/test/javax/swing/JInternalFrame/8146321/JInternalFrameIconTest.java
index fb3480d..4db711c 100644
--- a/jdk/test/javax/swing/JInternalFrame/8146321/JInternalFrameIconTest.java
+++ b/jdk/test/javax/swing/JInternalFrame/8146321/JInternalFrameIconTest.java
@@ -21,7 +21,9 @@
  * questions.
  */
 
-/* @test
+/*
+ * @test
+ * @key headful
  * @bug 8146321 8151282
  * @summary verifies JInternalFrame Icon and ImageIcon
  * @library ../../regtesthelpers
diff --git a/jdk/test/javax/swing/JInternalFrame/InternalFrameIsNotCollectedTest.java b/jdk/test/javax/swing/JInternalFrame/InternalFrameIsNotCollectedTest.java
index a008126..df332e2 100644
--- a/jdk/test/javax/swing/JInternalFrame/InternalFrameIsNotCollectedTest.java
+++ b/jdk/test/javax/swing/JInternalFrame/InternalFrameIsNotCollectedTest.java
@@ -21,11 +21,13 @@
  * questions.
  */
 
- /* @test
-    @bug 8012004
-    @summary JINTERNALFRAME NOT BEING FINALIZED AFTER CLOSING
-    @author mcherkas
-    @run main InternalFrameIsNotCollectedTest
+/*
+ * @test
+ * @key headful
+ * @bug 8012004
+ * @summary JINTERNALFRAME NOT BEING FINALIZED AFTER CLOSING
+ * @author mcherkas
+ * @run main InternalFrameIsNotCollectedTest
  */
 import javax.swing.*;
 import java.awt.*;
diff --git a/jdk/test/javax/swing/JInternalFrame/NormalBoundsTest.java b/jdk/test/javax/swing/JInternalFrame/NormalBoundsTest.java
index 2a6d7f9..dcd9067 100644
--- a/jdk/test/javax/swing/JInternalFrame/NormalBoundsTest.java
+++ b/jdk/test/javax/swing/JInternalFrame/NormalBoundsTest.java
@@ -23,6 +23,7 @@
 
  /*
  @test
+ @key headful
  @bug 7126823
  @summary Verify NormalBounds upon iconify/deiconify sequence
  @run main NormalBoundsTest
diff --git a/jdk/test/javax/swing/JInternalFrame/Test6505027.java b/jdk/test/javax/swing/JInternalFrame/Test6505027.java
index 36c3db3..2397140 100644
--- a/jdk/test/javax/swing/JInternalFrame/Test6505027.java
+++ b/jdk/test/javax/swing/JInternalFrame/Test6505027.java
@@ -23,6 +23,7 @@
 
 /*
  * @test
+ * @key headful
  * @bug 6505027
  * @summary Tests focus problem inside internal frame
  * @author Sergey Malenkov
diff --git a/jdk/test/javax/swing/JInternalFrame/Test6802868.java b/jdk/test/javax/swing/JInternalFrame/Test6802868.java
index 61e1717..1222e87 100644
--- a/jdk/test/javax/swing/JInternalFrame/Test6802868.java
+++ b/jdk/test/javax/swing/JInternalFrame/Test6802868.java
@@ -23,6 +23,7 @@
 
 /*
  * @test
+ * @key headful
  * @bug 6802868
  * @summary JInternalFrame is not maximized when maximized parent frame
  * @author Alexander Potochkin
diff --git a/jdk/test/javax/swing/JLabel/6596966/bug6596966.java b/jdk/test/javax/swing/JLabel/6596966/bug6596966.java
index d28551b..e804b29 100644
--- a/jdk/test/javax/swing/JLabel/6596966/bug6596966.java
+++ b/jdk/test/javax/swing/JLabel/6596966/bug6596966.java
@@ -21,15 +21,17 @@
  * questions.
  */
 
-/* @test
-   @bug 6596966
-   @summary Some JFileChooser mnemonics do not work with sticky keys
-   @library ../../regtesthelpers
-   @library ../../../../lib/testlibrary
-   @build Util jdk.testlibrary.OSInfo
-   @run main bug6596966
-   @author Pavel Porvatov
-*/
+/*
+ * @test
+ * @key headful
+ * @bug 6596966
+ * @summary Some JFileChooser mnemonics do not work with sticky keys
+ * @library ../../regtesthelpers
+ * @library ../../../../lib/testlibrary
+ * @build Util jdk.testlibrary.OSInfo
+ * @run main bug6596966
+ * @author Pavel Porvatov
+ */
 
 import java.awt.*;
 import java.awt.event.KeyEvent;
diff --git a/jdk/test/javax/swing/JLabel/7004134/bug7004134.java b/jdk/test/javax/swing/JLabel/7004134/bug7004134.java
index 12fcf81..9440d14 100644
--- a/jdk/test/javax/swing/JLabel/7004134/bug7004134.java
+++ b/jdk/test/javax/swing/JLabel/7004134/bug7004134.java
@@ -21,12 +21,14 @@
  * questions.
  */
 
-/* @test
-   @bug 7004134
-   @summary JLabel containing a ToolTipText does no longer show ToolTip after browser refresh
-   @author Pavel Porvatov
-   @modules java.desktop/sun.awt
-*/
+/*
+ * @test
+ * @key headful
+ * @bug 7004134
+ * @summary JLabel containing a ToolTipText does no longer show ToolTip after browser refresh
+ * @author Pavel Porvatov
+ * @modules java.desktop/sun.awt
+ */
 
 import sun.awt.SunToolkit;
 
diff --git a/jdk/test/javax/swing/JLayer/6824395/bug6824395.java b/jdk/test/javax/swing/JLayer/6824395/bug6824395.java
index fd35608..e8ad1e2 100644
--- a/jdk/test/javax/swing/JLayer/6824395/bug6824395.java
+++ b/jdk/test/javax/swing/JLayer/6824395/bug6824395.java
@@ -23,6 +23,7 @@
 
  /*
  * @test
+ * @key headful
  * @summary Checks that JLayer inside JViewport works is correctly laid out
  * @author Alexander Potochkin
  * @library ../../../../lib/testlibrary/
diff --git a/jdk/test/javax/swing/JLayer/6872503/bug6872503.java b/jdk/test/javax/swing/JLayer/6872503/bug6872503.java
index c48f014..82744b1 100644
--- a/jdk/test/javax/swing/JLayer/6872503/bug6872503.java
+++ b/jdk/test/javax/swing/JLayer/6872503/bug6872503.java
@@ -21,7 +21,9 @@
  * questions.
  */
 
-/* @test
+/*
+ * @test
+ * @key headful
  * @bug 6872503
  * @summary Checks that JLayer correctly works with its AWTEventListener
  * @author Alexander Potochkin
diff --git a/jdk/test/javax/swing/JList/6462008/bug6462008.java b/jdk/test/javax/swing/JList/6462008/bug6462008.java
index 9ecd674..77febbc 100644
--- a/jdk/test/javax/swing/JList/6462008/bug6462008.java
+++ b/jdk/test/javax/swing/JList/6462008/bug6462008.java
@@ -23,6 +23,7 @@
 
 /*
  * @test
+ * @key headful
  * @bug 6462008
  * @summary Tests that mouse/keyboard work properly on JList with lead < 0 or > list.getModel().getSize()
  * @author Shannon Hickey
diff --git a/jdk/test/javax/swing/JList/6510999/bug6510999.java b/jdk/test/javax/swing/JList/6510999/bug6510999.java
index 76c871b..1269de2 100644
--- a/jdk/test/javax/swing/JList/6510999/bug6510999.java
+++ b/jdk/test/javax/swing/JList/6510999/bug6510999.java
@@ -20,12 +20,14 @@
  * or visit www.oracle.com if you need additional information or have any
  * questions.
  */
-/* @test
-   @bug 6510999
-   @summary Selection in a JList with both scrollbars visible jumps on arrowkey-down
-   @author Alexander Potochkin
-   @run main bug6510999
-*/
+/*
+ * @test
+ * @key headful
+ * @bug 6510999
+ * @summary Selection in a JList with both scrollbars visible jumps on arrowkey-down
+ * @author Alexander Potochkin
+ * @run main bug6510999
+ */
 
 import javax.swing.*;
 import java.awt.*;
diff --git a/jdk/test/javax/swing/JMenu/4213634/bug4213634.java b/jdk/test/javax/swing/JMenu/4213634/bug4213634.java
index efd6633..dd699b7 100644
--- a/jdk/test/javax/swing/JMenu/4213634/bug4213634.java
+++ b/jdk/test/javax/swing/JMenu/4213634/bug4213634.java
@@ -35,7 +35,9 @@
 import javax.swing.JTextArea;
 import javax.swing.SwingUtilities;
 
-/* @test
+/*
+ * @test
+ * @key headful
  * @bug 4213634 8017187
  * @author Scott Violet
  * @library ../../regtesthelpers
diff --git a/jdk/test/javax/swing/JMenu/4417601/bug4417601.java b/jdk/test/javax/swing/JMenu/4417601/bug4417601.java
index 44c10f8..dc64702 100644
--- a/jdk/test/javax/swing/JMenu/4417601/bug4417601.java
+++ b/jdk/test/javax/swing/JMenu/4417601/bug4417601.java
@@ -20,14 +20,17 @@
  * or visit www.oracle.com if you need additional information or have any
  * questions.
  */
-/* @test
-   @bug 4417601
-   @summary JMenus with no items paint a tiny menu.
-   @author Alexander Potochkin
-   @library ../../../../lib/testlibrary
-   @build ExtendedRobot
-   @run main bug4417601
-*/
+
+/*
+ * @test
+ * @key headful
+ * @bug 4417601
+ * @summary JMenus with no items paint a tiny menu.
+ * @author Alexander Potochkin
+ * @library ../../../../lib/testlibrary
+ * @build ExtendedRobot
+ * @run main bug4417601
+ */
 
 import javax.swing.*;
 import java.awt.event.*;
diff --git a/jdk/test/javax/swing/JMenu/4515762/bug4515762.java b/jdk/test/javax/swing/JMenu/4515762/bug4515762.java
index 8b0cae2..67387c8 100644
--- a/jdk/test/javax/swing/JMenu/4515762/bug4515762.java
+++ b/jdk/test/javax/swing/JMenu/4515762/bug4515762.java
@@ -27,6 +27,7 @@
 
 /**
  * @test
+ * @key headful
  * @bug 4515762
  * @author Mark Davidson
  * @summary Tests the ability to support duplicate mnemonics
diff --git a/jdk/test/javax/swing/JMenu/4692443/bug4692443.java b/jdk/test/javax/swing/JMenu/4692443/bug4692443.java
index ac61b72..9d52215 100644
--- a/jdk/test/javax/swing/JMenu/4692443/bug4692443.java
+++ b/jdk/test/javax/swing/JMenu/4692443/bug4692443.java
@@ -23,6 +23,7 @@
 
 /*
  * @test
+ * @key headful
  * @library ../../regtesthelpers
  * @build Util
  * @bug 4692443 7105030
diff --git a/jdk/test/javax/swing/JMenu/6359669/bug6359669.java b/jdk/test/javax/swing/JMenu/6359669/bug6359669.java
index 1dc562e..941fced 100644
--- a/jdk/test/javax/swing/JMenu/6359669/bug6359669.java
+++ b/jdk/test/javax/swing/JMenu/6359669/bug6359669.java
@@ -20,14 +20,16 @@
  * or visit www.oracle.com if you need additional information or have any
  * questions.
  */
-/* @test
-   @bug 6359669
-   @summary REGRESSION: Submenu does not work if populated in PopupMenuListener.popupMenuWillBecomeVisible
-   @author Alexander Potochkin
-   @library ../../../../lib/testlibrary
-   @build ExtendedRobot
-   @run main bug6359669
-*/
+/*
+ * @test
+ * @key headful
+ * @bug 6359669
+ * @summary REGRESSION: Submenu does not work if populated in PopupMenuListener.popupMenuWillBecomeVisible
+ * @author Alexander Potochkin
+ * @library ../../../../lib/testlibrary
+ * @build ExtendedRobot
+ * @run main bug6359669
+ */
 
 import javax.swing.*;
 import javax.swing.event.PopupMenuListener;
diff --git a/jdk/test/javax/swing/JMenu/6470128/bug6470128.java b/jdk/test/javax/swing/JMenu/6470128/bug6470128.java
index 20a298d..0c323e2 100644
--- a/jdk/test/javax/swing/JMenu/6470128/bug6470128.java
+++ b/jdk/test/javax/swing/JMenu/6470128/bug6470128.java
@@ -20,14 +20,18 @@
  * or visit www.oracle.com if you need additional information or have any
  * questions.
  */
-/* @test
-   @bug 6470128
-   @summary Escape Key causes JMenu Selection to Disappear
-   @author Alexander Potochkin
-   @library ../../../../lib/testlibrary
-   @build jdk.testlibrary.OSInfo
-   @run main bug6470128
-*/
+
+/*
+ * @test
+ * @key headful
+ * @bug 6470128
+ * @summary Escape Key causes JMenu Selection to Disappear
+ * @author Alexander Potochkin
+ * @library ../../../../lib/testlibrary
+ * @build jdk.testlibrary.OSInfo
+ * @run main bug6470128
+ */
+
 import javax.swing.*;
 import java.awt.*;
 import java.awt.event.KeyEvent;
diff --git a/jdk/test/javax/swing/JMenu/8072900/WrongSelectionOnMouseOver.java b/jdk/test/javax/swing/JMenu/8072900/WrongSelectionOnMouseOver.java
index 9f293b3..d59b49f 100644
--- a/jdk/test/javax/swing/JMenu/8072900/WrongSelectionOnMouseOver.java
+++ b/jdk/test/javax/swing/JMenu/8072900/WrongSelectionOnMouseOver.java
@@ -22,12 +22,13 @@
  */
 
 /*
-@test
-@bug 8072900
-@summary Mouse events are captured by the wrong menu in OS X
-@author Anton Nashatyrev
-@run main WrongSelectionOnMouseOver
-*/
+ * @test
+ * @key headful
+ * @bug 8072900
+ * @summary Mouse events are captured by the wrong menu in OS X
+ * @author Anton Nashatyrev
+ * @run main WrongSelectionOnMouseOver
+ */
 
 import javax.swing.*;
 import javax.swing.event.MenuEvent;
diff --git a/jdk/test/javax/swing/JMenuBar/4750590/bug4750590.java b/jdk/test/javax/swing/JMenuBar/4750590/bug4750590.java
index 7e249d3..d2d7019 100644
--- a/jdk/test/javax/swing/JMenuBar/4750590/bug4750590.java
+++ b/jdk/test/javax/swing/JMenuBar/4750590/bug4750590.java
@@ -21,13 +21,15 @@
  * questions.
  */
 
-/* @test
- @library ../../regtesthelpers
- @build Util
- @bug 4750590 8015597
- @summary SwingSet: Cannot change Themes using menu accelerators
- @author Alexander Zuev
- @run main bug4750590
+/*
+ * @test
+ * @key headful
+ * @library ../../regtesthelpers
+ * @build Util
+ * @bug 4750590 8015597
+ * @summary SwingSet: Cannot change Themes using menu accelerators
+ * @author Alexander Zuev
+ * @run main bug4750590
  */
 
 import javax.swing.*;
diff --git a/jdk/test/javax/swing/JMenuBar/MisplacedBorder/MisplacedBorder.java b/jdk/test/javax/swing/JMenuBar/MisplacedBorder/MisplacedBorder.java
index 2bba726..9972fe5 100644
--- a/jdk/test/javax/swing/JMenuBar/MisplacedBorder/MisplacedBorder.java
+++ b/jdk/test/javax/swing/JMenuBar/MisplacedBorder/MisplacedBorder.java
@@ -40,6 +40,7 @@
 
 /**
  * @test
+ * @key headful
  * @bug 8073795
  * @summary JMenuBar has incorrect border when the window is on retina display.
  * @author Sergey Bylokhov
diff --git a/jdk/test/javax/swing/JMenuItem/4171437/bug4171437.java b/jdk/test/javax/swing/JMenuItem/4171437/bug4171437.java
index 29d1736..43914ca 100644
--- a/jdk/test/javax/swing/JMenuItem/4171437/bug4171437.java
+++ b/jdk/test/javax/swing/JMenuItem/4171437/bug4171437.java
@@ -20,13 +20,17 @@
  * or visit www.oracle.com if you need additional information or have any
  * questions.
  */
-/* @test
-   @bug 4171437
-   @library ../../regtesthelpers
-   @build Util
-   @author Georges Saab
-   @run main bug4171437
-*/
+
+/*
+ * @test
+ * @key headful
+ * @bug 4171437
+ * @library ../../regtesthelpers
+ * @build Util
+ * @author Georges Saab
+ * @run main bug4171437
+ */
+
 import java.awt.*;
 import java.awt.event.*;
 import java.util.ArrayList;
diff --git a/jdk/test/javax/swing/JMenuItem/4654927/bug4654927.java b/jdk/test/javax/swing/JMenuItem/4654927/bug4654927.java
index 34abf3f..8a4384e4 100644
--- a/jdk/test/javax/swing/JMenuItem/4654927/bug4654927.java
+++ b/jdk/test/javax/swing/JMenuItem/4654927/bug4654927.java
@@ -23,6 +23,7 @@
 
 /*
  * @test
+ * @key headful
  * @bug 4654927
  * @summary Clicking on Greyed Menuitems closes the Menubar Dropdown
  * @author Alexander Potochkin
diff --git a/jdk/test/javax/swing/JMenuItem/6209975/bug6209975.java b/jdk/test/javax/swing/JMenuItem/6209975/bug6209975.java
index a2f13ab..00d0e88 100644
--- a/jdk/test/javax/swing/JMenuItem/6209975/bug6209975.java
+++ b/jdk/test/javax/swing/JMenuItem/6209975/bug6209975.java
@@ -23,6 +23,7 @@
 
 /*
  * @test
+ * @key headful
  * @bug 6209975
  * @summary regression: JMenuItem icons overimposed on JMenuItem labels under Metal LAF
  * @author Alexander Zuev
diff --git a/jdk/test/javax/swing/JMenuItem/6249972/bug6249972.java b/jdk/test/javax/swing/JMenuItem/6249972/bug6249972.java
index 5139e26..7a02490 100644
--- a/jdk/test/javax/swing/JMenuItem/6249972/bug6249972.java
+++ b/jdk/test/javax/swing/JMenuItem/6249972/bug6249972.java
@@ -20,13 +20,16 @@
  * or visit www.oracle.com if you need additional information or have any
  * questions.
  */
-/* @test
-   @bug 6249972
-   @summary Tests that JMenuItem(String,int) handles lower-case mnemonics properly.
-   @library ../../../../lib/testlibrary
-   @build ExtendedRobot
-   @author Mikhail Lapshin
-   @run main bug6249972
+
+/*
+ * @test
+ * @key headful
+ * @bug 6249972
+ * @summary Tests that JMenuItem(String,int) handles lower-case mnemonics properly.
+ * @library ../../../../lib/testlibrary
+ * @build ExtendedRobot
+ * @author Mikhail Lapshin
+ * @run main bug6249972
  */
 
 import javax.swing.*;
diff --git a/jdk/test/javax/swing/JOptionPane/6428694/bug6428694.java b/jdk/test/javax/swing/JOptionPane/6428694/bug6428694.java
index fa065af..7491189 100644
--- a/jdk/test/javax/swing/JOptionPane/6428694/bug6428694.java
+++ b/jdk/test/javax/swing/JOptionPane/6428694/bug6428694.java
@@ -21,13 +21,14 @@
  * questions.
  */
 /*
-@test
-@bug 6428694
-@summary Checks that double click closes JOptionPane's input dialog.
-@library ../../../../lib/testlibrary
-@build ExtendedRobot
-@author Mikhail Lapshin
-@run main bug6428694
+ * @test
+ * @key headful
+ * @bug 6428694
+ * @summary Checks that double click closes JOptionPane's input dialog.
+ * @library ../../../../lib/testlibrary
+ * @build ExtendedRobot
+ * @author Mikhail Lapshin
+ * @run main bug6428694
 */
 
 import javax.swing.JFrame;
diff --git a/jdk/test/javax/swing/JOptionPane/6464022/bug6464022.java b/jdk/test/javax/swing/JOptionPane/6464022/bug6464022.java
index 9554ae9..8b3a8a0 100644
--- a/jdk/test/javax/swing/JOptionPane/6464022/bug6464022.java
+++ b/jdk/test/javax/swing/JOptionPane/6464022/bug6464022.java
@@ -23,12 +23,13 @@
 
 /*
  * @test
+ * @key headful
  * @bug 6464022
  * @summary Memory leak in JOptionPane.createDialog
  * @author Pavel Porvatov
  * @library ../../regtesthelpers
  * @build Util
- * @run main bug6464022
+ * @run main/othervm -mx128m bug6464022
  */
 
 import javax.swing.*;
diff --git a/jdk/test/javax/swing/JOptionPane/7138665/bug7138665.java b/jdk/test/javax/swing/JOptionPane/7138665/bug7138665.java
index 16b4228..11a38c8 100644
--- a/jdk/test/javax/swing/JOptionPane/7138665/bug7138665.java
+++ b/jdk/test/javax/swing/JOptionPane/7138665/bug7138665.java
@@ -21,11 +21,13 @@
  * questions.
  */
 
-/* @test
-   @bug 7138665
-   @summary JOptionPane.getValue() unexpected change between JRE 1.6 and JRE 1.7
-   @author Pavel Porvatov
-*/
+/*
+ * @test
+ * @key headful
+ * @bug 7138665
+ * @summary JOptionPane.getValue() unexpected change between JRE 1.6 and JRE 1.7
+ * @author Pavel Porvatov
+ */
 
 import javax.swing.*;
 import java.awt.*;
diff --git a/jdk/test/javax/swing/JOptionPane/8139213/OptionPaneTest.java b/jdk/test/javax/swing/JOptionPane/8139213/OptionPaneTest.java
index 0230ce1..84819a0 100644
--- a/jdk/test/javax/swing/JOptionPane/8139213/OptionPaneTest.java
+++ b/jdk/test/javax/swing/JOptionPane/8139213/OptionPaneTest.java
@@ -23,6 +23,7 @@
 
 /*
  * @test
+ * @key headful
  * @bug 8139213
  * @summary Mac OS Aqua X LAF: JOptionPane truncates the first button
  * @run main OptionPaneTest
diff --git a/jdk/test/javax/swing/JPopupMenu/4458079/bug4458079.java b/jdk/test/javax/swing/JPopupMenu/4458079/bug4458079.java
index 3dc95fc..d4f21b5 100644
--- a/jdk/test/javax/swing/JPopupMenu/4458079/bug4458079.java
+++ b/jdk/test/javax/swing/JPopupMenu/4458079/bug4458079.java
@@ -20,14 +20,18 @@
  * or visit www.oracle.com if you need additional information or have any
  * questions.
  */
-/* @test
-   @bug 4458079
-   @library ../../regtesthelpers
-   @build Util
-   @summary Tests calling removeAll() from PopupMenuListener
-   @author Peter Zhelezniakov
-   @run main bug4458079
-*/
+
+/*
+ * @test
+ * @key headful
+ * @bug 4458079
+ * @library ../../regtesthelpers
+ * @build Util
+ * @summary Tests calling removeAll() from PopupMenuListener
+ * @author Peter Zhelezniakov
+ * @run main bug4458079
+ */
+
 import java.awt.Robot;
 import java.awt.Toolkit;
 import java.awt.event.*;
diff --git a/jdk/test/javax/swing/JPopupMenu/4966112/bug4966112.java b/jdk/test/javax/swing/JPopupMenu/4966112/bug4966112.java
index 3d17274..a569d65 100644
--- a/jdk/test/javax/swing/JPopupMenu/4966112/bug4966112.java
+++ b/jdk/test/javax/swing/JPopupMenu/4966112/bug4966112.java
@@ -23,6 +23,7 @@
 
 /*
  * @test
+ * @key headful
  * @bug 4966112
  * @summary Some Composite components does not show the Context Popup.
  * @library ../../regtesthelpers
diff --git a/jdk/test/javax/swing/JPopupMenu/6415145/bug6415145.java b/jdk/test/javax/swing/JPopupMenu/6415145/bug6415145.java
index c288300..4714bbf 100644
--- a/jdk/test/javax/swing/JPopupMenu/6415145/bug6415145.java
+++ b/jdk/test/javax/swing/JPopupMenu/6415145/bug6415145.java
@@ -21,14 +21,15 @@
  * questions.
  */
 /*
-@test
-@bug 6415145
-@summary REGRESSION: Selected item is not being updated while dragging above popup menu
-@library ../../../../lib/testlibrary
-@build ExtendedRobot
-@author Mikhail Lapshin
-@run main bug6415145
-*/
+ * @test
+ * @key headful
+ * @bug 6415145
+ * @summary REGRESSION: Selected item is not being updated while dragging above popup menu
+ * @library ../../../../lib/testlibrary
+ * @build ExtendedRobot
+ * @author Mikhail Lapshin
+ * @run main bug6415145
+ */
 
 import javax.swing.*;
 import java.awt.event.*;
diff --git a/jdk/test/javax/swing/JPopupMenu/6495920/bug6495920.java b/jdk/test/javax/swing/JPopupMenu/6495920/bug6495920.java
index ff68cf6..b15194a 100644
--- a/jdk/test/javax/swing/JPopupMenu/6495920/bug6495920.java
+++ b/jdk/test/javax/swing/JPopupMenu/6495920/bug6495920.java
@@ -23,6 +23,7 @@
 
 /*
  * @test
+ * @key headful
  * @bug 6495920
  * @summary Tests that if the JPopupMenu.setVisible method throws an exception,
             interaction with GNOME is not crippled
diff --git a/jdk/test/javax/swing/JPopupMenu/6515446/bug6515446.java b/jdk/test/javax/swing/JPopupMenu/6515446/bug6515446.java
index b26aa03..74a49f5 100644
--- a/jdk/test/javax/swing/JPopupMenu/6515446/bug6515446.java
+++ b/jdk/test/javax/swing/JPopupMenu/6515446/bug6515446.java
@@ -21,14 +21,15 @@
  * questions.
  */
 /*
-@test
-@bug 6515446
-@summary JMenuItems in JPopupMenus not receiving ActionEvents - incompat with 1.5
-@author Alexander Potochkin
-@library ../../../../lib/testlibrary
-@build ExtendedRobot
-@run main bug6515446
-*/
+ * @test
+ * @key headful
+ * @bug 6515446
+ * @summary JMenuItems in JPopupMenus not receiving ActionEvents - incompat with 1.5
+ * @author Alexander Potochkin
+ * @library ../../../../lib/testlibrary
+ * @build ExtendedRobot
+ * @run main bug6515446
+ */
 
 import javax.swing.*;
 import java.awt.event.*;
diff --git a/jdk/test/javax/swing/JPopupMenu/6544309/bug6544309.java b/jdk/test/javax/swing/JPopupMenu/6544309/bug6544309.java
index f0c76a4..0824856 100644
--- a/jdk/test/javax/swing/JPopupMenu/6544309/bug6544309.java
+++ b/jdk/test/javax/swing/JPopupMenu/6544309/bug6544309.java
@@ -20,7 +20,9 @@
  * or visit www.oracle.com if you need additional information or have any
  * questions.
  */
-/* @test
+/*
+   @test
+  @key headful
    @bug 6544309
    @summary Checks that 'Select Input Method' popup menu allows to select
             items with keyboard.
diff --git a/jdk/test/javax/swing/JPopupMenu/6580930/bug6580930.java b/jdk/test/javax/swing/JPopupMenu/6580930/bug6580930.java
index cbc805c..1f97729 100644
--- a/jdk/test/javax/swing/JPopupMenu/6580930/bug6580930.java
+++ b/jdk/test/javax/swing/JPopupMenu/6580930/bug6580930.java
@@ -21,14 +21,15 @@
  * questions.
  */
 /*
-@test
-@bug 6580930 7184956
-@summary Swing Popups should overlap taskbar
-@author Alexander Potochkin
-@library ../../../../lib/testlibrary
-@build ExtendedRobot
-@run main bug6580930
-*/
+ * @test
+ * @key headful
+ * @bug 6580930 7184956
+ * @summary Swing Popups should overlap taskbar
+ * @author Alexander Potochkin
+ * @library ../../../../lib/testlibrary
+ * @build ExtendedRobot
+ * @run main bug6580930
+ */
 
 import javax.swing.*;
 import java.awt.*;
diff --git a/jdk/test/javax/swing/JPopupMenu/6583251/bug6583251.java b/jdk/test/javax/swing/JPopupMenu/6583251/bug6583251.java
index d44c221..b913133 100644
--- a/jdk/test/javax/swing/JPopupMenu/6583251/bug6583251.java
+++ b/jdk/test/javax/swing/JPopupMenu/6583251/bug6583251.java
@@ -24,12 +24,13 @@
  */
 
 /*
-@test
-@bug 6583251
-@summary One more ClassCastException in Swing with TrayIcon
-@author Alexander Potochkin
-@run main bug6583251
-*/
+ * @test
+ * @key headful
+ * @bug 6583251
+ * @summary One more ClassCastException in Swing with TrayIcon
+ * @author Alexander Potochkin
+ * @run main bug6583251
+ */
 
 import javax.swing.*;
 import java.awt.*;
diff --git a/jdk/test/javax/swing/JPopupMenu/6691503/bug6691503.java b/jdk/test/javax/swing/JPopupMenu/6691503/bug6691503.java
index f07ebd1..f6f3d97 100644
--- a/jdk/test/javax/swing/JPopupMenu/6691503/bug6691503.java
+++ b/jdk/test/javax/swing/JPopupMenu/6691503/bug6691503.java
@@ -23,6 +23,7 @@
 
 /*
  * @test
+ * @key headful
  * @bug 6691503
  * @summary Checks that there is no opportunity for a malicious applet
  * to show a popup menu which has whole screen size.
diff --git a/jdk/test/javax/swing/JPopupMenu/6694823/bug6694823.java b/jdk/test/javax/swing/JPopupMenu/6694823/bug6694823.java
index 3e6c4be..94daa45 100644
--- a/jdk/test/javax/swing/JPopupMenu/6694823/bug6694823.java
+++ b/jdk/test/javax/swing/JPopupMenu/6694823/bug6694823.java
@@ -23,6 +23,7 @@
 
 /*
  * @test
+ * @key headful
  * @bug 6694823
  * @summary Checks that popup menu cannot be partially hidden
  * by the task bar in applets.
diff --git a/jdk/test/javax/swing/JPopupMenu/6800513/bug6800513.java b/jdk/test/javax/swing/JPopupMenu/6800513/bug6800513.java
index 097e28dd..098defe 100644
--- a/jdk/test/javax/swing/JPopupMenu/6800513/bug6800513.java
+++ b/jdk/test/javax/swing/JPopupMenu/6800513/bug6800513.java
@@ -24,6 +24,7 @@
 
 /*
  * @test
+ * @key headful
  * @bug 6800513
  * @summary GTK-LaF renders menus incompletely
  * @author Mario Torre
diff --git a/jdk/test/javax/swing/JPopupMenu/6827786/bug6827786.java b/jdk/test/javax/swing/JPopupMenu/6827786/bug6827786.java
index ed8ec47..c377a7b 100644
--- a/jdk/test/javax/swing/JPopupMenu/6827786/bug6827786.java
+++ b/jdk/test/javax/swing/JPopupMenu/6827786/bug6827786.java
@@ -23,6 +23,7 @@
 
 /*
  * @test
+ * @key headful
  * @bug 6827786
  * @summary Tests duplicate mnemonics
  * @author Peter Zhelezniakov
diff --git a/jdk/test/javax/swing/JPopupMenu/6987844/bug6987844.java b/jdk/test/javax/swing/JPopupMenu/6987844/bug6987844.java
index 2fd16e2..97790ca 100644
--- a/jdk/test/javax/swing/JPopupMenu/6987844/bug6987844.java
+++ b/jdk/test/javax/swing/JPopupMenu/6987844/bug6987844.java
@@ -23,6 +23,7 @@
 
 /*
  * @test
+ * @key headful
  * @bug 6987844
  * @summary Incorrect width of JComboBox drop down
  * @author Alexander Potochkin
diff --git a/jdk/test/javax/swing/JPopupMenu/7156657/bug7156657.java b/jdk/test/javax/swing/JPopupMenu/7156657/bug7156657.java
index d6d818d..8851eab 100644
--- a/jdk/test/javax/swing/JPopupMenu/7156657/bug7156657.java
+++ b/jdk/test/javax/swing/JPopupMenu/7156657/bug7156657.java
@@ -29,7 +29,9 @@
 import java.awt.image.BufferedImage;
 import java.util.concurrent.Callable;
 
-/* @test
+/*
+   @test
+  @key headful
    @bug 7156657
    @summary Version 7 doesn't support translucent popup menus against a translucent window
    @library ../../regtesthelpers
diff --git a/jdk/test/javax/swing/JPopupMenu/8147521/PopupMenuTest.java b/jdk/test/javax/swing/JPopupMenu/8147521/PopupMenuTest.java
index b00abfc..51f12c8 100644
--- a/jdk/test/javax/swing/JPopupMenu/8147521/PopupMenuTest.java
+++ b/jdk/test/javax/swing/JPopupMenu/8147521/PopupMenuTest.java
@@ -23,6 +23,7 @@
 
 /*
  * @test
+ * @key headful
  * @bug 8147521 8158358
  * @summary [macosx] Internal API Usage: setPopupType used to force creation of
  * heavyweight popup
diff --git a/jdk/test/javax/swing/JProgressBar/8015748/JProgressBarOrientationRobotTest.java b/jdk/test/javax/swing/JProgressBar/8015748/JProgressBarOrientationRobotTest.java
index bc2a685..4bb6252 100644
--- a/jdk/test/javax/swing/JProgressBar/8015748/JProgressBarOrientationRobotTest.java
+++ b/jdk/test/javax/swing/JProgressBar/8015748/JProgressBarOrientationRobotTest.java
@@ -21,7 +21,9 @@
  * questions.
  */
 
-/* @test
+/*
+ * @test
+ * @key headful
  * @bug 8015748
  * @summary verifies ProgressBar RightToLeft orientations for all Look and Feels
  * @library ../../regtesthelpers
diff --git a/jdk/test/javax/swing/JRadioButton/8033699/bug8033699.java b/jdk/test/javax/swing/JRadioButton/8033699/bug8033699.java
index 212b442..681bb92 100644
--- a/jdk/test/javax/swing/JRadioButton/8033699/bug8033699.java
+++ b/jdk/test/javax/swing/JRadioButton/8033699/bug8033699.java
@@ -23,6 +23,7 @@
 
  /*
  * @test
+ * @key headful
  * @library ../../regtesthelpers
  * @build Util
  * @bug 8033699
diff --git a/jdk/test/javax/swing/JRadioButton/8041561/bug8041561.java b/jdk/test/javax/swing/JRadioButton/8041561/bug8041561.java
index 9a7e3bd..12efa8b 100644
--- a/jdk/test/javax/swing/JRadioButton/8041561/bug8041561.java
+++ b/jdk/test/javax/swing/JRadioButton/8041561/bug8041561.java
@@ -36,6 +36,7 @@
 
 /**
  * @test
+ * @key headful
  * @bug 8041561
  * @author Alexander Scherbatiy
  * @summary Inconsistent opacity behaviour between JCheckBox and JRadioButton
diff --git a/jdk/test/javax/swing/JRadioButton/8075609/bug8075609.java b/jdk/test/javax/swing/JRadioButton/8075609/bug8075609.java
index 6cd1721..664f5b4 100644
--- a/jdk/test/javax/swing/JRadioButton/8075609/bug8075609.java
+++ b/jdk/test/javax/swing/JRadioButton/8075609/bug8075609.java
@@ -23,6 +23,7 @@
 
  /*
  * @test
+ * @key headful
  * @library ../../regtesthelpers
  * @build Util
  * @bug 8075609
diff --git a/jdk/test/javax/swing/JRadioButton/FocusTraversal/FocusTraversal.java b/jdk/test/javax/swing/JRadioButton/FocusTraversal/FocusTraversal.java
index 34a7cfe..f714631 100644
--- a/jdk/test/javax/swing/JRadioButton/FocusTraversal/FocusTraversal.java
+++ b/jdk/test/javax/swing/JRadioButton/FocusTraversal/FocusTraversal.java
@@ -22,9 +22,10 @@
  */
 
 /* @test
- @bug 8129940 8132770
- @summary JRadioButton should run custom FocusTraversalKeys for all LaFs
- @run main FocusTraversal
+ * @key headful
+ * @bug 8129940 8132770 8161470
+ * @summary JRadioButton should run custom FocusTraversalKeys for all LaFs
+ * @run main FocusTraversal
  */
 import java.awt.BorderLayout;
 import java.awt.Component;
@@ -60,7 +61,7 @@
     public static void main(String[] args) throws Exception {
 
         robot = new Robot();
-        robot.delay(2000);
+        robot.waitForIdle();
         UIManager.LookAndFeelInfo[] lookAndFeelArray
                 = UIManager.getInstalledLookAndFeels();
         for (UIManager.LookAndFeelInfo lookAndFeelItem : lookAndFeelArray) {
@@ -72,11 +73,11 @@
             throws Exception {
         if (tryLookAndFeel(lookAndFeelString)) {
             createUI(lookAndFeelString);
-            robot.delay(2000);
+            robot.waitForIdle();
             runTestCase();
-            robot.delay(2000);
+            robot.waitForIdle();
             cleanUp();
-            robot.delay(2000);
+            robot.waitForIdle();
         }
     }
 
diff --git a/jdk/test/javax/swing/JRootPane/4670486/bug4670486.java b/jdk/test/javax/swing/JRootPane/4670486/bug4670486.java
index d967d45..150396e 100644
--- a/jdk/test/javax/swing/JRootPane/4670486/bug4670486.java
+++ b/jdk/test/javax/swing/JRootPane/4670486/bug4670486.java
@@ -27,6 +27,7 @@
 
 /**
  * @test
+ * @key headful
  * @bug 4670486
  * @author Mark Davidson
  * @summary Regression: Popup menu bindings doesn't work when a default button has been defined.
diff --git a/jdk/test/javax/swing/JRootPane/SilenceOfDeprecatedMenuBar/SilenceOfDeprecatedMenuBar.java b/jdk/test/javax/swing/JRootPane/SilenceOfDeprecatedMenuBar/SilenceOfDeprecatedMenuBar.java
index a59ac06..14fc038 100644
--- a/jdk/test/javax/swing/JRootPane/SilenceOfDeprecatedMenuBar/SilenceOfDeprecatedMenuBar.java
+++ b/jdk/test/javax/swing/JRootPane/SilenceOfDeprecatedMenuBar/SilenceOfDeprecatedMenuBar.java
@@ -32,6 +32,7 @@
 
 /**
  * @test
+ * @key headful
  * @bug 6368321
  * @author Sergey Bylokhov
  */
diff --git a/jdk/test/javax/swing/JScrollBar/4708809/bug4708809.java b/jdk/test/javax/swing/JScrollBar/4708809/bug4708809.java
index 144b228..829df8d 100644
--- a/jdk/test/javax/swing/JScrollBar/4708809/bug4708809.java
+++ b/jdk/test/javax/swing/JScrollBar/4708809/bug4708809.java
@@ -23,6 +23,7 @@
 
 /*
  * @test
+ * @key headful
  * @bug 4708809
  * @summary JScrollBar functionality slightly different from native scrollbar
  * @author Andrey Pikalev
diff --git a/jdk/test/javax/swing/JScrollBar/4865918/bug4865918.java b/jdk/test/javax/swing/JScrollBar/4865918/bug4865918.java
index 2bf5be4..d624923 100644
--- a/jdk/test/javax/swing/JScrollBar/4865918/bug4865918.java
+++ b/jdk/test/javax/swing/JScrollBar/4865918/bug4865918.java
@@ -23,6 +23,7 @@
 
 /*
  * @test
+ * @key headful
  * @bug 4865918
  * @summary REGRESSION:JCK1.4a-runtime api/javax_swing/interactive/JScrollBarTests.html#JScrollBar
  * @author Andrey Pikalev
diff --git a/jdk/test/javax/swing/JScrollBar/6542335/bug6542335.java b/jdk/test/javax/swing/JScrollBar/6542335/bug6542335.java
index 2f03463..8b44323 100644
--- a/jdk/test/javax/swing/JScrollBar/6542335/bug6542335.java
+++ b/jdk/test/javax/swing/JScrollBar/6542335/bug6542335.java
@@ -21,12 +21,14 @@
  * questions.
  */
 
-/* @test
-   @bug 6542335
-   @summary different behavior on knob of scroll bar between 1.4.2 and 5.0
-   @author  Alexander Potochkin
-   @run main bug6542335
-*/
+/*
+ * @test
+ * @key headful
+ * @bug 6542335
+ * @summary different behavior on knob of scroll bar between 1.4.2 and 5.0
+ * @author  Alexander Potochkin
+ * @run main bug6542335
+ */
 
 import javax.swing.*;
 import javax.swing.plaf.basic.BasicScrollBarUI;
diff --git a/jdk/test/javax/swing/JScrollBar/7163696/Test7163696.java b/jdk/test/javax/swing/JScrollBar/7163696/Test7163696.java
index 2ca34b5..0d65a70 100644
--- a/jdk/test/javax/swing/JScrollBar/7163696/Test7163696.java
+++ b/jdk/test/javax/swing/JScrollBar/7163696/Test7163696.java
@@ -23,6 +23,7 @@
 
 /*
  * @test
+ * @key headful
  * @bug 7163696
  * @summary Tests that JScrollBar scrolls to the left
  * @author Sergey Malenkov
diff --git a/jdk/test/javax/swing/JScrollBar/bug4202954/bug4202954.java b/jdk/test/javax/swing/JScrollBar/bug4202954/bug4202954.java
index 915a802..995e573 100644
--- a/jdk/test/javax/swing/JScrollBar/bug4202954/bug4202954.java
+++ b/jdk/test/javax/swing/JScrollBar/bug4202954/bug4202954.java
@@ -20,14 +20,16 @@
  * or visit www.oracle.com if you need additional information or have any
  * questions.
  */
-/* @test
+/*
+   @test
+   @key headful
    @bug 4202954
    @library ../../../../lib/testlibrary
    @library ../../regtesthelpers
    @build Util jdk.testlibrary.OSInfo
    @author Michael C. Albers
    @run main bug4202954
-*/
+ */
 
 import java.awt.*;
 import java.awt.event.InputEvent;
diff --git a/jdk/test/javax/swing/JScrollPane/6274267/bug6274267.java b/jdk/test/javax/swing/JScrollPane/6274267/bug6274267.java
index 1783c0f..a141c43 100644
--- a/jdk/test/javax/swing/JScrollPane/6274267/bug6274267.java
+++ b/jdk/test/javax/swing/JScrollPane/6274267/bug6274267.java
@@ -23,13 +23,15 @@
  * questions.
  */
 
-/* @test
-   @bug 6274267
-   @summary Checks that ScrollPaneLayout properly calculates preferred
-   layout size.
-   @author Mikhail Lapshin
-   @run main bug6274267
-*/
+/*
+ * @test
+ * @key headful
+ * @bug 6274267
+ * @summary Checks that ScrollPaneLayout properly calculates preferred
+ * layout size.
+ * @author Mikhail Lapshin
+ * @run main bug6274267
+ */
 
 import javax.swing.*;
 import java.awt.*;
diff --git a/jdk/test/javax/swing/JScrollPane/HorizontalMouseWheelOnShiftPressed/HorizontalMouseWheelOnShiftPressed.java b/jdk/test/javax/swing/JScrollPane/HorizontalMouseWheelOnShiftPressed/HorizontalMouseWheelOnShiftPressed.java
index b8120b9..5f10c11 100644
--- a/jdk/test/javax/swing/JScrollPane/HorizontalMouseWheelOnShiftPressed/HorizontalMouseWheelOnShiftPressed.java
+++ b/jdk/test/javax/swing/JScrollPane/HorizontalMouseWheelOnShiftPressed/HorizontalMouseWheelOnShiftPressed.java
@@ -35,6 +35,7 @@
 
 /**
  * @test
+ * @key headful
  * @bug 8033000 8147994
  * @author Alexander Scherbatiy
  * @summary No Horizontal Mouse Wheel Support In BasicScrollPaneUI
diff --git a/jdk/test/javax/swing/JScrollPane/Test6526631.java b/jdk/test/javax/swing/JScrollPane/Test6526631.java
index f7f1633..df7512e 100644
--- a/jdk/test/javax/swing/JScrollPane/Test6526631.java
+++ b/jdk/test/javax/swing/JScrollPane/Test6526631.java
@@ -23,6 +23,7 @@
 
 /*
  * @test
+ * @key headful
  * @bug 6526631
  * @summary Resizes right-oriented scroll pane
  * @author Sergey Malenkov
diff --git a/jdk/test/javax/swing/JScrollPane/bug8044371.java b/jdk/test/javax/swing/JScrollPane/bug8044371.java
index 2e83385..7dc606d 100644
--- a/jdk/test/javax/swing/JScrollPane/bug8044371.java
+++ b/jdk/test/javax/swing/JScrollPane/bug8044371.java
@@ -23,6 +23,7 @@
 
 /*
  * @test
+ * @key headful
  * @bug 8044371
  * @summary setOneTouchExpandable functionality of JSplitPane will reduce vertical Scrollbar
  * @author Anton Nashatyrev
diff --git a/jdk/test/javax/swing/JSlider/6348946/bug6348946.java b/jdk/test/javax/swing/JSlider/6348946/bug6348946.java
index 588097a..1bc0cb1 100644
--- a/jdk/test/javax/swing/JSlider/6348946/bug6348946.java
+++ b/jdk/test/javax/swing/JSlider/6348946/bug6348946.java
@@ -23,6 +23,7 @@
 
 /*
  * @test
+ * @key headful
  * @bug 6348946
  * @summary Tests that JSlider's thumb moves in the right direction
  *          when it is used as a JTable cell editor.
diff --git a/jdk/test/javax/swing/JSlider/6401380/bug6401380.java b/jdk/test/javax/swing/JSlider/6401380/bug6401380.java
index 8cb70db..1a11dc4 100644
--- a/jdk/test/javax/swing/JSlider/6401380/bug6401380.java
+++ b/jdk/test/javax/swing/JSlider/6401380/bug6401380.java
@@ -20,14 +20,17 @@
  * or visit www.oracle.com if you need additional information or have any
  * questions.
  */
-/* @test
-   @bug 6401380
-   @summary JSlider - mouse click ont the left side of the knob is ignored.
-   @library ../../../../lib/testlibrary
-   @build ExtendedRobot
-   @author Alexander Potochkin
-   @run main bug6401380
-*/
+
+/*
+ * @test
+ * @key headful
+ * @bug 6401380
+ * @summary JSlider - mouse click ont the left side of the knob is ignored.
+ * @library ../../../../lib/testlibrary
+ * @build ExtendedRobot
+ * @author Alexander Potochkin
+ * @run main bug6401380
+ */
 
 import javax.swing.*;
 import javax.swing.plaf.basic.BasicSliderUI;
diff --git a/jdk/test/javax/swing/JSlider/6794831/bug6794831.java b/jdk/test/javax/swing/JSlider/6794831/bug6794831.java
index 27aa09f..c9f19ef 100644
--- a/jdk/test/javax/swing/JSlider/6794831/bug6794831.java
+++ b/jdk/test/javax/swing/JSlider/6794831/bug6794831.java
@@ -21,7 +21,9 @@
  * questions.
  */
 
-/* @test
+/*
+ * @test
+ * @key headful
  * @bug 6794831
  * @summary Infinite loop while painting ticks on Slider with maximum=MAX_INT
  * @author Pavel Porvatov
diff --git a/jdk/test/javax/swing/JSlider/6848475/bug6848475.java b/jdk/test/javax/swing/JSlider/6848475/bug6848475.java
index a27f024..e4f5bfcc 100644
--- a/jdk/test/javax/swing/JSlider/6848475/bug6848475.java
+++ b/jdk/test/javax/swing/JSlider/6848475/bug6848475.java
@@ -21,7 +21,9 @@
  * questions.
  */
 
-/* @test
+/*
+ * @test
+ * @key headful
  * @bug 6848475
  * @summary JSlider does not display the correct value of its BoundedRangeModel
  * @author Pavel Porvatov
diff --git a/jdk/test/javax/swing/JSlider/6918861/bug6918861.java b/jdk/test/javax/swing/JSlider/6918861/bug6918861.java
index d1b4944..b965e82 100644
--- a/jdk/test/javax/swing/JSlider/6918861/bug6918861.java
+++ b/jdk/test/javax/swing/JSlider/6918861/bug6918861.java
@@ -21,7 +21,9 @@
  * questions.
  */
 
-/* @test
+/*
+ * @test
+ * @key headful
  * @bug 6918861
  * @summary SynthSliderUI.uninstallDefaults() is not called when UI is uninstalled
  * @author Pavel Porvatov
diff --git a/jdk/test/javax/swing/JSlider/6923305/bug6923305.java b/jdk/test/javax/swing/JSlider/6923305/bug6923305.java
index 6079d7e..20a3298 100644
--- a/jdk/test/javax/swing/JSlider/6923305/bug6923305.java
+++ b/jdk/test/javax/swing/JSlider/6923305/bug6923305.java
@@ -21,7 +21,9 @@
  * questions.
  */
 
-/* @test
+/*
+ * @test
+ * @key headful
  * @bug 6923305
  * @summary SynthSliderUI paints the slider track when the slider's "paintTrack" property is set to false
  * @author Pavel Porvatov
diff --git a/jdk/test/javax/swing/JSpinner/4973721/bug4973721.java b/jdk/test/javax/swing/JSpinner/4973721/bug4973721.java
index 9bbc381..9c18583 100644
--- a/jdk/test/javax/swing/JSpinner/4973721/bug4973721.java
+++ b/jdk/test/javax/swing/JSpinner/4973721/bug4973721.java
@@ -20,14 +20,16 @@
  * or visit www.oracle.com if you need additional information or have any
  * questions.
  */
-/* @test
+/*
+   @test
+   @key headful
    @bug 4973721
    @summary Up and Down Arrow key buttons are not working for the JSpinner in Synth LAF
    @library ../../regtesthelpers
    @build Util
    @author Oleg Mokhovikov
    @run main bug4973721
-*/
+ */
 
 import java.awt.Robot;
 import javax.swing.event.ChangeListener;
diff --git a/jdk/test/javax/swing/JSpinner/6421058/bug6421058.java b/jdk/test/javax/swing/JSpinner/6421058/bug6421058.java
index d67762b..a9f1044 100644
--- a/jdk/test/javax/swing/JSpinner/6421058/bug6421058.java
+++ b/jdk/test/javax/swing/JSpinner/6421058/bug6421058.java
@@ -21,13 +21,14 @@
  * questions.
  */
 
- /*
-  * @test
-  * @bug 6421058
-  * @summary Verify font of the text field is changed to the font of
-  *        JSpinner if the font of text field was NOT set by the user
-  * @run main bug6421058
-  */
+/*
+ * @test
+ * @key headful
+ * @bug 6421058
+ * @summary Verify font of the text field is changed to the font of
+ *          JSpinner if the font of text field was NOT set by the user
+ * @run main bug6421058
+ */
 
 import java.awt.Font;
 import javax.swing.JFrame;
diff --git a/jdk/test/javax/swing/JSpinner/6532833/bug6532833.java b/jdk/test/javax/swing/JSpinner/6532833/bug6532833.java
index 80013da..5e27e71 100644
--- a/jdk/test/javax/swing/JSpinner/6532833/bug6532833.java
+++ b/jdk/test/javax/swing/JSpinner/6532833/bug6532833.java
@@ -21,7 +21,9 @@
  * questions.
  */
 
-/* @test
+/*
+ * @test
+ * @key headful
  * @bug 6532833 7077259
  * @summary PIT: Metal LAF - The right side border is not shown for the Spinner after the removing the buttons
  * @author Pavel Porvatov
diff --git a/jdk/test/javax/swing/JSpinner/8008657/bug8008657.java b/jdk/test/javax/swing/JSpinner/8008657/bug8008657.java
index 1acb45d..cbeb0c1 100644
--- a/jdk/test/javax/swing/JSpinner/8008657/bug8008657.java
+++ b/jdk/test/javax/swing/JSpinner/8008657/bug8008657.java
@@ -37,6 +37,7 @@
 
 /**
  * @test
+ * @key headful
  * @bug 8008657
  * @author Alexander Scherbatiy
  * @summary JSpinner setComponentOrientation doesn't affect on text orientation
diff --git a/jdk/test/javax/swing/JSpinner/WrongEditorTextFieldFont/WrongEditorTextFieldFont.java b/jdk/test/javax/swing/JSpinner/WrongEditorTextFieldFont/WrongEditorTextFieldFont.java
index 0236298..6ab395d 100644
--- a/jdk/test/javax/swing/JSpinner/WrongEditorTextFieldFont/WrongEditorTextFieldFont.java
+++ b/jdk/test/javax/swing/JSpinner/WrongEditorTextFieldFont/WrongEditorTextFieldFont.java
@@ -36,6 +36,7 @@
 
 /**
  * @test
+ * @key headful
  * @bug 5036022
  * @author Sergey Bylokhov
  */
diff --git a/jdk/test/javax/swing/JSplitPane/4816114/bug4816114.java b/jdk/test/javax/swing/JSplitPane/4816114/bug4816114.java
index 1129683..1e9c3fe 100644
--- a/jdk/test/javax/swing/JSplitPane/4816114/bug4816114.java
+++ b/jdk/test/javax/swing/JSplitPane/4816114/bug4816114.java
@@ -20,12 +20,15 @@
  * or visit www.oracle.com if you need additional information or have any
  * questions.
  */
-/* @test
-   @bug 4816114
-   @summary REGRESSION: Regression in divider location behavior when JSplitPane is resized
-   @author Andrey Pikalev
-   @run main bug4816114
-*/
+
+/*
+ * @test
+ * @key headful
+ * @bug 4816114
+ * @summary REGRESSION: Regression in divider location behavior when JSplitPane is resized
+ * @author Andrey Pikalev
+ * @run main bug4816114
+ */
 
 import javax.swing.*;
 import java.awt.*;
diff --git a/jdk/test/javax/swing/JSplitPane/4885629/bug4885629.java b/jdk/test/javax/swing/JSplitPane/4885629/bug4885629.java
index 97fc5c7..59db070 100644
--- a/jdk/test/javax/swing/JSplitPane/4885629/bug4885629.java
+++ b/jdk/test/javax/swing/JSplitPane/4885629/bug4885629.java
@@ -23,6 +23,7 @@
 
 /*
  * @test
+ * @key headful
  * @bug 4885629
  * @summary With JSplitPane in VERTICAL_SPLIT, SplitPaneBorder draws bottom edge of divider
  * @author Andrey Pikalev
diff --git a/jdk/test/javax/swing/JTabbedPane/4361477/bug4361477.java b/jdk/test/javax/swing/JTabbedPane/4361477/bug4361477.java
index a617ccc..20ca62e 100644
--- a/jdk/test/javax/swing/JTabbedPane/4361477/bug4361477.java
+++ b/jdk/test/javax/swing/JTabbedPane/4361477/bug4361477.java
@@ -28,6 +28,7 @@
 
 /*
  * @test
+ * @key headful
  * @bug 4361477
  * @summary JTabbedPane throws ArrayOutOfBoundsException
  * @author Oleg Mokhovikov
diff --git a/jdk/test/javax/swing/JTabbedPane/4624207/bug4624207.java b/jdk/test/javax/swing/JTabbedPane/4624207/bug4624207.java
index 9476df0..6b7aa04 100644
--- a/jdk/test/javax/swing/JTabbedPane/4624207/bug4624207.java
+++ b/jdk/test/javax/swing/JTabbedPane/4624207/bug4624207.java
@@ -23,6 +23,7 @@
 
 /*
  * @test
+ * @key headful
  * @bug 4624207
  * @summary JTabbedPane mnemonics don't work from outside the tabbed pane
  * @author Oleg Mokhovikov
diff --git a/jdk/test/javax/swing/JTabbedPane/6495408/bug6495408.java b/jdk/test/javax/swing/JTabbedPane/6495408/bug6495408.java
index 8f7f667..25da3f8 100644
--- a/jdk/test/javax/swing/JTabbedPane/6495408/bug6495408.java
+++ b/jdk/test/javax/swing/JTabbedPane/6495408/bug6495408.java
@@ -25,6 +25,7 @@
 import java.awt.*;
 /*
  * @test
+ * @key headful
  * @bug 6495408
  * @summary REGRESSION: JTabbedPane throws ArrayIndexOutOfBoundsException
  * @author Alexander Potochkin
diff --git a/jdk/test/javax/swing/JTabbedPane/7024235/Test7024235.java b/jdk/test/javax/swing/JTabbedPane/7024235/Test7024235.java
index e18f4aa..7e1c3aa 100644
--- a/jdk/test/javax/swing/JTabbedPane/7024235/Test7024235.java
+++ b/jdk/test/javax/swing/JTabbedPane/7024235/Test7024235.java
@@ -38,6 +38,7 @@
 
 /*
  * @test
+ * @key headful
  * @bug 7024235
  * @summary Tests JFrame.pack() with the JTabbedPane
  * @library ../../../../lib/testlibrary/
diff --git a/jdk/test/javax/swing/JTabbedPane/7161568/bug7161568.java b/jdk/test/javax/swing/JTabbedPane/7161568/bug7161568.java
index 46571ab..1904a3f 100644
--- a/jdk/test/javax/swing/JTabbedPane/7161568/bug7161568.java
+++ b/jdk/test/javax/swing/JTabbedPane/7161568/bug7161568.java
@@ -26,6 +26,7 @@
 
 /**
  * @test
+ * @key headful
  * @bug 7161568
  * @author Alexander Scherbatiy
  * @summary Tests that navigating tabs in the JTAbbedPane does not throw NPE
diff --git a/jdk/test/javax/swing/JTabbedPane/8007563/Test8007563.java b/jdk/test/javax/swing/JTabbedPane/8007563/Test8007563.java
index 5fd35ac..25d3ad4 100644
--- a/jdk/test/javax/swing/JTabbedPane/8007563/Test8007563.java
+++ b/jdk/test/javax/swing/JTabbedPane/8007563/Test8007563.java
@@ -33,6 +33,7 @@
 
 /*
  * @test
+ * @key headful
  * @bug 8007563
  * @summary Tests JTabbedPane background
  * @author Sergey Malenkov
diff --git a/jdk/test/javax/swing/JTabbedPane/8017284/bug8017284.java b/jdk/test/javax/swing/JTabbedPane/8017284/bug8017284.java
index 5a71726..1cddb78 100644
--- a/jdk/test/javax/swing/JTabbedPane/8017284/bug8017284.java
+++ b/jdk/test/javax/swing/JTabbedPane/8017284/bug8017284.java
@@ -31,6 +31,7 @@
 
 /**
  * @test
+ * @key headful
  * @bug 8017284
  * @author Alexander Scherbatiy
  * @summary  Aqua LaF: memory leak when HTML is used for JTabbedPane tab titles
diff --git a/jdk/test/javax/swing/JTabbedPane/8134116/Bug8134116.java b/jdk/test/javax/swing/JTabbedPane/8134116/Bug8134116.java
index ed408d9..1881666 100644
--- a/jdk/test/javax/swing/JTabbedPane/8134116/Bug8134116.java
+++ b/jdk/test/javax/swing/JTabbedPane/8134116/Bug8134116.java
@@ -12,6 +12,7 @@
 
 /*
  * @test
+ * @key headful
  * @bug 8134116
  * @summary JTabbedPane$Page.getBounds throws IndexOutOfBoundsException
  * @run main Bug8134116
diff --git a/jdk/test/javax/swing/JTabbedPane/8137169/ScrollableTabbedPaneTest.java b/jdk/test/javax/swing/JTabbedPane/8137169/ScrollableTabbedPaneTest.java
index 834da2e..4a37f73 100644
--- a/jdk/test/javax/swing/JTabbedPane/8137169/ScrollableTabbedPaneTest.java
+++ b/jdk/test/javax/swing/JTabbedPane/8137169/ScrollableTabbedPaneTest.java
@@ -21,7 +21,9 @@
  * questions.
  */
 
-/* @test
+/*
+ * @test
+ * @key headful
  * @bug 8137169
  * @summary verifies TabbedScrollPane minimum height for all Look and Feels
  * @library ../../regtesthelpers
diff --git a/jdk/test/javax/swing/JTable/4220171/bug4220171.java b/jdk/test/javax/swing/JTable/4220171/bug4220171.java
index 2b4ecb5..0dc904b 100644
--- a/jdk/test/javax/swing/JTable/4220171/bug4220171.java
+++ b/jdk/test/javax/swing/JTable/4220171/bug4220171.java
@@ -23,6 +23,7 @@
 
 /*
  * @test
+ * @key headful
  * @bug 4220171
  * @author Konstantin Eremin
  * @summary Tests
diff --git a/jdk/test/javax/swing/JTable/6263446/bug6263446.java b/jdk/test/javax/swing/JTable/6263446/bug6263446.java
index 9089e3f..917fa33 100644
--- a/jdk/test/javax/swing/JTable/6263446/bug6263446.java
+++ b/jdk/test/javax/swing/JTable/6263446/bug6263446.java
@@ -23,6 +23,7 @@
 
 /*
  * @test
+ * @key headful
  * @bug 6263446
  * @summary Tests that double-clicking to edit a cell doesn't select the content.
  * @author Shannon Hickey
diff --git a/jdk/test/javax/swing/JTable/6777378/bug6777378.java b/jdk/test/javax/swing/JTable/6777378/bug6777378.java
index 973da5a..b353249 100644
--- a/jdk/test/javax/swing/JTable/6777378/bug6777378.java
+++ b/jdk/test/javax/swing/JTable/6777378/bug6777378.java
@@ -21,7 +21,9 @@
  * questions.
  */
 
-/* @test
+/*
+   @test
+  @key headful
    @bug 6777378
    @summary NullPointerException in XPDefaultRenderer.paint()
    @author Alexander Potochkin
diff --git a/jdk/test/javax/swing/JTable/6894632/bug6894632.java b/jdk/test/javax/swing/JTable/6894632/bug6894632.java
index 07cf596..9e8e395 100644
--- a/jdk/test/javax/swing/JTable/6894632/bug6894632.java
+++ b/jdk/test/javax/swing/JTable/6894632/bug6894632.java
@@ -21,12 +21,14 @@
  * questions.
  */
 
-/* @test
-   @bug 6894632
-   @summary Removing rows from a DefaultTableModel with a RowSorter deselectes
-   last row
-   @author Semyon Sadetsky
-*/
+/*
+ * @test
+ * @key headful
+ * @bug 6894632
+ * @summary Removing rows from a DefaultTableModel with a RowSorter deselectes
+ * last row
+ * @author Semyon Sadetsky
+ */
 
 import javax.swing.*;
 import javax.swing.table.DefaultTableModel;
diff --git a/jdk/test/javax/swing/JTable/6913768/bug6913768.java b/jdk/test/javax/swing/JTable/6913768/bug6913768.java
index 331ff70..6f49d79 100644
--- a/jdk/test/javax/swing/JTable/6913768/bug6913768.java
+++ b/jdk/test/javax/swing/JTable/6913768/bug6913768.java
@@ -21,7 +21,9 @@
  * questions.
  */
 
-/* @test
+/*
+ * @test
+ * @key headful
  * @bug 6913768
  * @summary With default SynthLookAndFeel instance installed new JTable creation leads to throwing NPE
  * @author Pavel Porvatov
diff --git a/jdk/test/javax/swing/JTable/7055065/bug7055065.java b/jdk/test/javax/swing/JTable/7055065/bug7055065.java
index 4b58971..f88a6ec 100644
--- a/jdk/test/javax/swing/JTable/7055065/bug7055065.java
+++ b/jdk/test/javax/swing/JTable/7055065/bug7055065.java
@@ -25,7 +25,9 @@
  * Portions Copyright (c) 2012 IBM Corporation
  */
 
-/* @test 1.1 2012/04/19
+/*
+ * @test
+ * @key headful
  * @bug 7055065
  * @summary NullPointerException when sorting JTable with empty cell
  * @author Jonathan Lu
diff --git a/jdk/test/javax/swing/JTable/7068740/bug7068740.java b/jdk/test/javax/swing/JTable/7068740/bug7068740.java
index d0c8fbd..b037684 100644
--- a/jdk/test/javax/swing/JTable/7068740/bug7068740.java
+++ b/jdk/test/javax/swing/JTable/7068740/bug7068740.java
@@ -21,12 +21,14 @@
  * questions.
  */
 
-/* @test
-   @bug 7068740
-   @summary JTable wrapped in JLayer can't use PGUP/PGDOWN keys
-   @author Vladislav Karnaukhov
-   @run main bug7068740
-*/
+/*
+ * @test
+ * @key headful
+ * @bug 7068740
+ * @summary JTable wrapped in JLayer can't use PGUP/PGDOWN keys
+ * @author Vladislav Karnaukhov
+ * @run main bug7068740
+ */
 
 import javax.swing.*;
 import javax.swing.plaf.LayerUI;
diff --git a/jdk/test/javax/swing/JTable/7124218/SelectEditTableCell.java b/jdk/test/javax/swing/JTable/7124218/SelectEditTableCell.java
index 6191ddf..67793b2 100644
--- a/jdk/test/javax/swing/JTable/7124218/SelectEditTableCell.java
+++ b/jdk/test/javax/swing/JTable/7124218/SelectEditTableCell.java
@@ -21,7 +21,9 @@
  * questions.
  */
 
-/* @test
+/*
+ * @test
+ * @key headful
  * @bug 7124218
  * @summary verifies different behaviour of SPACE and ENTER in JTable
  * @library ../../regtesthelpers
diff --git a/jdk/test/javax/swing/JTable/7188612/JTableAccessibleGetLocationOnScreen.java b/jdk/test/javax/swing/JTable/7188612/JTableAccessibleGetLocationOnScreen.java
index da9262f..a1a3b64 100644
--- a/jdk/test/javax/swing/JTable/7188612/JTableAccessibleGetLocationOnScreen.java
+++ b/jdk/test/javax/swing/JTable/7188612/JTableAccessibleGetLocationOnScreen.java
@@ -25,7 +25,9 @@
  * Portions Copyright (c) 2012 IBM Corporation
  */
 
-/* @test
+/*
+ * @test
+ * @key headful
  * @bug 7188612
  * @summary AccessibleTableHeader and AccessibleJTableCell should stick to
  *    AccessibleComponent.getLocationOnScreen api.
diff --git a/jdk/test/javax/swing/JTable/8032874/bug8032874.java b/jdk/test/javax/swing/JTable/8032874/bug8032874.java
index 1116aeb..7b7ca4a 100644
--- a/jdk/test/javax/swing/JTable/8032874/bug8032874.java
+++ b/jdk/test/javax/swing/JTable/8032874/bug8032874.java
@@ -21,7 +21,9 @@
  * questions.
  */
 
-/* @test
+/*
+ * @test
+ * @key headful
  * @bug 8032874
  * @summary Test whether ArrayIndexOutOfBoundsException is thrown or not,
  *          once selected row is removed from JTable with Sorter and Filter
diff --git a/jdk/test/javax/swing/JTableHeader/4473075/bug4473075.java b/jdk/test/javax/swing/JTableHeader/4473075/bug4473075.java
index a45cd16..8abd6f5 100644
--- a/jdk/test/javax/swing/JTableHeader/4473075/bug4473075.java
+++ b/jdk/test/javax/swing/JTableHeader/4473075/bug4473075.java
@@ -21,7 +21,9 @@
  * questions.
  */
 
-/* @test
+/*
+   @test
+  @key headful
    @bug 4473075
    @summary JTable header rendering problem (after setting preferred size)
    @author Semyon Sadetsky
diff --git a/jdk/test/javax/swing/JTableHeader/6884066/bug6884066.java b/jdk/test/javax/swing/JTableHeader/6884066/bug6884066.java
index cf5e291..58926f6 100644
--- a/jdk/test/javax/swing/JTableHeader/6884066/bug6884066.java
+++ b/jdk/test/javax/swing/JTableHeader/6884066/bug6884066.java
@@ -21,7 +21,9 @@
  * questions.
  */
 
-/* @test
+/*
+   @test
+  @key headful
    @bug 6884066
    @summary JTableHeader listens mouse in disabled state and doesn't work when not attached to a table
    @author Alexander Potochkin
diff --git a/jdk/test/javax/swing/JTableHeader/6889007/bug6889007.java b/jdk/test/javax/swing/JTableHeader/6889007/bug6889007.java
index c416d63..d24072b 100644
--- a/jdk/test/javax/swing/JTableHeader/6889007/bug6889007.java
+++ b/jdk/test/javax/swing/JTableHeader/6889007/bug6889007.java
@@ -21,7 +21,9 @@
  * questions.
  */
 
-/* @test
+/*
+   @test
+  @key headful
    @bug 6889007
    @summary No resize cursor during hovering mouse over JTable
    @author Alexander Potochkin
diff --git a/jdk/test/javax/swing/JTextArea/4697612/bug4697612.java b/jdk/test/javax/swing/JTextArea/4697612/bug4697612.java
index 715da74..5f4f3e7 100644
--- a/jdk/test/javax/swing/JTextArea/4697612/bug4697612.java
+++ b/jdk/test/javax/swing/JTextArea/4697612/bug4697612.java
@@ -23,6 +23,7 @@
 
 /*
  * @test
+ * @key headful
  * @bug 4697612 6244705
  * @author Peter Zhelezniakov
  * @library ../../regtesthelpers
diff --git a/jdk/test/javax/swing/JTextArea/7049024/bug7049024.java b/jdk/test/javax/swing/JTextArea/7049024/bug7049024.java
index 36d328f..74a7609 100644
--- a/jdk/test/javax/swing/JTextArea/7049024/bug7049024.java
+++ b/jdk/test/javax/swing/JTextArea/7049024/bug7049024.java
@@ -25,7 +25,9 @@
  * Portions Copyright (c) 2011 IBM Corporation
  */
 
-/* @test
+/*
+ * @test
+ * @key headful
  * @bug 7049024
  * @summary DnD fails with JTextArea and JTextField
  * @author Sean Chou
diff --git a/jdk/test/javax/swing/JTextArea/8149849/DNDTextToScaledArea.java b/jdk/test/javax/swing/JTextArea/8149849/DNDTextToScaledArea.java
index 501fa19..a68a11c 100644
--- a/jdk/test/javax/swing/JTextArea/8149849/DNDTextToScaledArea.java
+++ b/jdk/test/javax/swing/JTextArea/8149849/DNDTextToScaledArea.java
@@ -34,6 +34,7 @@
 
 /**
  * @test
+ * @key headful
  * @bug 8149849
  * @summary [hidpi] DnD issues (cannot DnD from JFileChooser to JEditorPane or
  *          other text component) when scale > 1
diff --git a/jdk/test/javax/swing/JTextArea/ScrollbarFlicker/ScrollFlickerTest.java b/jdk/test/javax/swing/JTextArea/ScrollbarFlicker/ScrollFlickerTest.java
new file mode 100644
index 0000000..73a25e6
--- /dev/null
+++ b/jdk/test/javax/swing/JTextArea/ScrollbarFlicker/ScrollFlickerTest.java
@@ -0,0 +1,74 @@
+/*
+ * 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.
+ */
+
+/* @test
+ * @bug 8160246
+ * @summary Regression: 4410243 reproducible with GTK LaF
+ * @run main ScrollFlickerTest
+ */
+
+import javax.swing.*;
+import java.awt.*;
+import java.awt.event.ComponentAdapter;
+import java.awt.event.ComponentEvent;
+
+public class ScrollFlickerTest {
+
+    private static JFrame frame;
+    private static JScrollPane scroll;
+    private static int cnt = 0;
+
+    public static void main(String[] args) throws Exception {
+        SwingUtilities.invokeAndWait(() -> {
+            frame = new JFrame();
+            frame.setSize(300, 200);
+            frame.getContentPane().setLayout(null);
+            JTextArea text = new JTextArea("Test test test test");
+            text.setLineWrap(true);
+            scroll = new JScrollPane(text);
+            frame.getContentPane().add(scroll);
+            scroll.setBounds(1, 1, 100, 50);
+            frame.setVisible(true);
+        });
+
+        Robot robot = new Robot();
+        robot.waitForIdle();
+        robot.delay(200);
+
+        SwingUtilities.invokeAndWait(() -> {
+            scroll.getViewport().addChangeListener((e) -> cnt++);
+            Insets insets = scroll.getInsets();
+            scroll.setSize(insets.left + insets.right +
+                    scroll.getVerticalScrollBar().getPreferredSize().width, 50);
+            scroll.revalidate();
+        });
+
+        robot.delay(1000);
+
+        SwingUtilities.invokeLater(frame::dispose);
+
+        if (cnt > 2) {
+            throw new RuntimeException("Scroll bar flickers");
+        }
+    }
+}
diff --git a/jdk/test/javax/swing/JTextArea/Test6593649.java b/jdk/test/javax/swing/JTextArea/Test6593649.java
index f27057c..854e500 100644
--- a/jdk/test/javax/swing/JTextArea/Test6593649.java
+++ b/jdk/test/javax/swing/JTextArea/Test6593649.java
@@ -21,12 +21,14 @@
  * questions.
  */
 
-/* @test
-   @bug 6593649
-   @summary Word wrap does not work in JTextArea: long lines are not wrapped
-   @author Lillian Angel
-   @run main Test6593649
-*/
+/*
+ * @test
+ * @key headful
+ * @bug 6593649
+ * @summary Word wrap does not work in JTextArea: long lines are not wrapped
+ * @author Lillian Angel
+ * @run main Test6593649
+ */
 
 import javax.swing.*;
 import java.awt.*;
diff --git a/jdk/test/javax/swing/JTextArea/TextViewOOM/TextViewOOM.java b/jdk/test/javax/swing/JTextArea/TextViewOOM/TextViewOOM.java
index e75c705..6c31f28 100644
--- a/jdk/test/javax/swing/JTextArea/TextViewOOM/TextViewOOM.java
+++ b/jdk/test/javax/swing/JTextArea/TextViewOOM/TextViewOOM.java
@@ -29,6 +29,7 @@
 
 /**
  * @test
+ * @key headful
  * @bug 8072775
  * @run main/othervm -Xmx80m TextViewOOM
  */
diff --git a/jdk/test/javax/swing/JTextField/8036819/bug8036819.java b/jdk/test/javax/swing/JTextField/8036819/bug8036819.java
index 214f13c..052b383 100644
--- a/jdk/test/javax/swing/JTextField/8036819/bug8036819.java
+++ b/jdk/test/javax/swing/JTextField/8036819/bug8036819.java
@@ -23,6 +23,7 @@
 
 /*
  * @test
+ * @key headful
  * @library ../../regtesthelpers
  * @build Util
  * @bug 8036819
diff --git a/jdk/test/javax/swing/JTextPane/JTextPaneDocumentAlignment.java b/jdk/test/javax/swing/JTextPane/JTextPaneDocumentAlignment.java
index f75d1c0..af19383 100644
--- a/jdk/test/javax/swing/JTextPane/JTextPaneDocumentAlignment.java
+++ b/jdk/test/javax/swing/JTextPane/JTextPaneDocumentAlignment.java
@@ -21,11 +21,13 @@
  * questions.
  */
 
-/* @test
-   @bug 8132136
-   @summary [PIT] RTL orientation in JEditorPane is broken
-   @author Semyon Sadetsky
-  */
+/*
+ * @test
+ * @key headful
+ * @bug 8132136
+ * @summary [PIT] RTL orientation in JEditorPane is broken
+ * @author Semyon Sadetsky
+ */
 
 import javax.swing.*;
 import javax.swing.text.BadLocationException;
diff --git a/jdk/test/javax/swing/JTextPane/JTextPaneDocumentWrapping.java b/jdk/test/javax/swing/JTextPane/JTextPaneDocumentWrapping.java
index ba7aee4..0f6a70a 100644
--- a/jdk/test/javax/swing/JTextPane/JTextPaneDocumentWrapping.java
+++ b/jdk/test/javax/swing/JTextPane/JTextPaneDocumentWrapping.java
@@ -21,11 +21,13 @@
  * questions.
  */
 
-/* @test
-   @bug 8133108
-   @summary [PIT] Container size is wrong in JEditorPane
-   @author Semyon Sadetsky
-  */
+/*
+ * @test
+ * @key headful
+ * @bug 8133108
+ * @summary [PIT] Container size is wrong in JEditorPane
+ * @author Semyon Sadetsky
+ */
 
 import javax.swing.*;
 import javax.swing.text.BadLocationException;
diff --git a/jdk/test/javax/swing/JTextPane/bug8025082.java b/jdk/test/javax/swing/JTextPane/bug8025082.java
index 1c92f76..aeedbb4 100644
--- a/jdk/test/javax/swing/JTextPane/bug8025082.java
+++ b/jdk/test/javax/swing/JTextPane/bug8025082.java
@@ -23,6 +23,7 @@
 
 /*
  * @test
+ * @key headful
  * @bug 8025082
  * @summary The behaviour of the highlight will be lost after clicking the set
  * button.
diff --git a/jdk/test/javax/swing/JToolBar/4247996/bug4247996.java b/jdk/test/javax/swing/JToolBar/4247996/bug4247996.java
index 63eaccb..9670e86 100644
--- a/jdk/test/javax/swing/JToolBar/4247996/bug4247996.java
+++ b/jdk/test/javax/swing/JToolBar/4247996/bug4247996.java
@@ -21,7 +21,9 @@
  * questions.
  */
 
-/* @test
+/*
+ * @test
+ * @key headful
  * @bug 4247996 4260485
  * @summary Test that rollover toolbar doesn't corrupt buttons
  * @author Peter Zhelezniakov
diff --git a/jdk/test/javax/swing/JToolBar/4529206/bug4529206.java b/jdk/test/javax/swing/JToolBar/4529206/bug4529206.java
index 61e96b7..0b05ded 100644
--- a/jdk/test/javax/swing/JToolBar/4529206/bug4529206.java
+++ b/jdk/test/javax/swing/JToolBar/4529206/bug4529206.java
@@ -23,12 +23,14 @@
  * questions.
  */
 
-/* @test
-   @bug     4529206
-   @summary JToolBar - setFloating does not work correctly
-   @author  Konstantin Eremin
-   @run     main bug4529206
-*/
+/*
+ * @test
+ * @key headful
+ * @bug     4529206
+ * @summary JToolBar - setFloating does not work correctly
+ * @author  Konstantin Eremin
+ * @run     main bug4529206
+ */
 
 import javax.swing.*;
 import java.awt.*;
diff --git a/jdk/test/javax/swing/JToolTip/4846413/bug4846413.java b/jdk/test/javax/swing/JToolTip/4846413/bug4846413.java
index a18b2be..4fac3c5 100644
--- a/jdk/test/javax/swing/JToolTip/4846413/bug4846413.java
+++ b/jdk/test/javax/swing/JToolTip/4846413/bug4846413.java
@@ -23,6 +23,7 @@
 
 /*
  * @test
+ * @key headful
  * @bug 4846413
  * @summary Checks if No tooltip modification when no KeyStroke modifier
  * @library ../../regtesthelpers
diff --git a/jdk/test/javax/swing/JToolTip/6219960/bug6219960.java b/jdk/test/javax/swing/JToolTip/6219960/bug6219960.java
index c23fa2c..2df5d8d 100644
--- a/jdk/test/javax/swing/JToolTip/6219960/bug6219960.java
+++ b/jdk/test/javax/swing/JToolTip/6219960/bug6219960.java
@@ -44,6 +44,7 @@
 
 /**
  * @test
+ * @key headful
  * @bug 6219960
  * @summary null reference in ToolTipManager
  * @run main bug6219960
diff --git a/jdk/test/javax/swing/JTree/4330357/bug4330357.java b/jdk/test/javax/swing/JTree/4330357/bug4330357.java
index 810c886..2f6a76a 100644
--- a/jdk/test/javax/swing/JTree/4330357/bug4330357.java
+++ b/jdk/test/javax/swing/JTree/4330357/bug4330357.java
@@ -23,6 +23,7 @@
 
 /*
  * @test
+ * @key headful
  * @bug 4330357
  * @summary Tests that real editor in JTree cleans up after editing was stopped
  * @library ../../regtesthelpers
diff --git a/jdk/test/javax/swing/JTree/4908142/bug4908142.java b/jdk/test/javax/swing/JTree/4908142/bug4908142.java
index 2b6fbd7..1556d67 100644
--- a/jdk/test/javax/swing/JTree/4908142/bug4908142.java
+++ b/jdk/test/javax/swing/JTree/4908142/bug4908142.java
@@ -24,6 +24,7 @@
 
 /*
  * @test
+ * @key headful
  * @bug 4908142
  * @summary JList doesn't handle search function appropriately
  * @author Andrey Pikalev
diff --git a/jdk/test/javax/swing/JTree/4927934/bug4927934.java b/jdk/test/javax/swing/JTree/4927934/bug4927934.java
index c4f739e..d4dee0c 100644
--- a/jdk/test/javax/swing/JTree/4927934/bug4927934.java
+++ b/jdk/test/javax/swing/JTree/4927934/bug4927934.java
@@ -20,7 +20,9 @@
  * or visit www.oracle.com if you need additional information or have any
  * questions.
  */
-/* @test
+/*
+   @test
+  @key headful
    @bug 4927934
    @summary JTree traversal is unlike Native windows tree traversal
    @author Andrey Pikalev
diff --git a/jdk/test/javax/swing/JTree/6263446/bug6263446.java b/jdk/test/javax/swing/JTree/6263446/bug6263446.java
index 2e13599..698255a 100644
--- a/jdk/test/javax/swing/JTree/6263446/bug6263446.java
+++ b/jdk/test/javax/swing/JTree/6263446/bug6263446.java
@@ -23,6 +23,7 @@
 
 /*
  * @test
+ * @key headful
  * @bug 6263446
  * @summary Tests that double-clicking to edit a cell doesn't select the content.
  * @author Shannon Hickey
diff --git a/jdk/test/javax/swing/JTree/6505523/bug6505523.java b/jdk/test/javax/swing/JTree/6505523/bug6505523.java
index 21a1043..7e501bc 100644
--- a/jdk/test/javax/swing/JTree/6505523/bug6505523.java
+++ b/jdk/test/javax/swing/JTree/6505523/bug6505523.java
@@ -23,6 +23,7 @@
 
 /*
  * @test
+ * @key headful
  * @bug 6505523
  * @summary NullPointerException in BasicTreeUI when a node is removed by expansion listener
  * @author Alexandr Scherbatiy
diff --git a/jdk/test/javax/swing/JTree/6578666/bug6578666.java b/jdk/test/javax/swing/JTree/6578666/bug6578666.java
index 708ce54..89664fe 100644
--- a/jdk/test/javax/swing/JTree/6578666/bug6578666.java
+++ b/jdk/test/javax/swing/JTree/6578666/bug6578666.java
@@ -22,6 +22,7 @@
  */
 /*
  * @test
+ * @key headful
  * @bug 6578666
  * @summary REGRESSION: Exception occurs when updateUI for JTree is triggered by KeyEvent
  * @run main bug6578666
diff --git a/jdk/test/javax/swing/JTree/8003400/Test8003400.java b/jdk/test/javax/swing/JTree/8003400/Test8003400.java
index 7f09751..a4b9114 100644
--- a/jdk/test/javax/swing/JTree/8003400/Test8003400.java
+++ b/jdk/test/javax/swing/JTree/8003400/Test8003400.java
@@ -23,6 +23,7 @@
 
 /*
  * @test
+ * @key headful
  * @bug 8003400
  * @summary Tests that JTree shows the last row
  * @author Sergey Malenkov
diff --git a/jdk/test/javax/swing/JTree/8004298/bug8004298.java b/jdk/test/javax/swing/JTree/8004298/bug8004298.java
index 12b618b..440dbe4 100644
--- a/jdk/test/javax/swing/JTree/8004298/bug8004298.java
+++ b/jdk/test/javax/swing/JTree/8004298/bug8004298.java
@@ -23,6 +23,7 @@
 
 /*
  * @test
+ * @key headful
  * @bug 8004298
  * @summary NPE in WindowsTreeUI.ensureRowsAreVisible
  * @author Alexander Scherbatiy
diff --git a/jdk/test/javax/swing/JTree/DnD/LastNodeLowerHalfDrop.java b/jdk/test/javax/swing/JTree/DnD/LastNodeLowerHalfDrop.java
index 1308f26..9cc5922 100644
--- a/jdk/test/javax/swing/JTree/DnD/LastNodeLowerHalfDrop.java
+++ b/jdk/test/javax/swing/JTree/DnD/LastNodeLowerHalfDrop.java
@@ -21,7 +21,9 @@
  * questions.
  */
 
-/* @test
+/*
+ * @test
+ * @key headful
  * @bug 8129830 8132771
  * @summary JTree drag/drop on lower half of last child of container incorrect
  * @run main LastNodeLowerHalfDrop
diff --git a/jdk/test/javax/swing/JViewport/7107099/bug7107099.java b/jdk/test/javax/swing/JViewport/7107099/bug7107099.java
index a6bdce4..f91a74d 100644
--- a/jdk/test/javax/swing/JViewport/7107099/bug7107099.java
+++ b/jdk/test/javax/swing/JViewport/7107099/bug7107099.java
@@ -21,7 +21,9 @@
  * questions.
  */
 
-/* @test
+/*
+   @test
+  @key headful
    @bug 7107099
    @summary JScrollBar does not show up even if there are enough lebgth of textstring in textField
    @author Pavel Porvatov
diff --git a/jdk/test/javax/swing/JWindow/ShapedAndTranslucentWindows/PerPixelTranslucentCanvas.java b/jdk/test/javax/swing/JWindow/ShapedAndTranslucentWindows/PerPixelTranslucentCanvas.java
index fed42ce..7d70f55 100644
--- a/jdk/test/javax/swing/JWindow/ShapedAndTranslucentWindows/PerPixelTranslucentCanvas.java
+++ b/jdk/test/javax/swing/JWindow/ShapedAndTranslucentWindows/PerPixelTranslucentCanvas.java
@@ -27,6 +27,7 @@
 
 /*
  * @test
+ * @key headful
  * @summary Check if a per-pixel translucent window shows up with correct translucency
  * @author mrkam
  * @library ../../../../lib/testlibrary
diff --git a/jdk/test/javax/swing/KeyboardManager/8013370/Test8013370.java b/jdk/test/javax/swing/KeyboardManager/8013370/Test8013370.java
index 33f48a2..97f2909 100644
--- a/jdk/test/javax/swing/KeyboardManager/8013370/Test8013370.java
+++ b/jdk/test/javax/swing/KeyboardManager/8013370/Test8013370.java
@@ -40,6 +40,7 @@
 
 /*
  * @test
+ * @key headful
  * @bug 8013370
  * @summary Ensure that key stroke is not null
  * @author Sergey Malenkov
diff --git a/jdk/test/javax/swing/LookAndFeel/6897701/JMenuItemsTest.java b/jdk/test/javax/swing/LookAndFeel/6897701/JMenuItemsTest.java
index c8e2492..3a4a911 100644
--- a/jdk/test/javax/swing/LookAndFeel/6897701/JMenuItemsTest.java
+++ b/jdk/test/javax/swing/LookAndFeel/6897701/JMenuItemsTest.java
@@ -21,12 +21,14 @@
  * questions.
  */
 
- /*
+/*
  * @test
+ * @key headful
  * @bug 6897701
  * @summary Verify JMenu and JMenuItem Disabled state for Nimbus LAF
  * @run main JMenuItemsTest
  */
+
 import java.awt.Color;
 import java.awt.Rectangle;
 import java.awt.image.BufferedImage;
diff --git a/jdk/test/javax/swing/LookAndFeel/8146276/NimbusGlueTest.java b/jdk/test/javax/swing/LookAndFeel/8146276/NimbusGlueTest.java
index cd64ee7..156bb4c 100644
--- a/jdk/test/javax/swing/LookAndFeel/8146276/NimbusGlueTest.java
+++ b/jdk/test/javax/swing/LookAndFeel/8146276/NimbusGlueTest.java
@@ -23,6 +23,7 @@
 
 /*
  * @test
+ * @key headful
  * @bug 8146276
  * @summary Right aligned toolbar component does not appear
  * @run main NimbusGlueTest
diff --git a/jdk/test/javax/swing/Popup/6514582/bug6514582.java b/jdk/test/javax/swing/Popup/6514582/bug6514582.java
index 94fee3f..b2d5d57 100644
--- a/jdk/test/javax/swing/Popup/6514582/bug6514582.java
+++ b/jdk/test/javax/swing/Popup/6514582/bug6514582.java
@@ -23,12 +23,14 @@
  * questions.
  */
 
-/* @test
-   @bug 6514582
-   @summary SubMenu of a JMenu with no items paints a single pixel tiny menu.
-   @author Alexander Potochkin
-   @run main bug6514582
-*/
+/*
+ * @test
+ * @key headful
+ * @bug 6514582
+ * @summary SubMenu of a JMenu with no items paints a single pixel tiny menu.
+ * @author Alexander Potochkin
+ * @run main bug6514582
+ */
 
 import javax.swing.*;
 import java.awt.*;
diff --git a/jdk/test/javax/swing/Popup/TaskbarPositionTest.java b/jdk/test/javax/swing/Popup/TaskbarPositionTest.java
index 0f30c2a..c72a15b 100644
--- a/jdk/test/javax/swing/Popup/TaskbarPositionTest.java
+++ b/jdk/test/javax/swing/Popup/TaskbarPositionTest.java
@@ -28,6 +28,7 @@
 
 /**
  * @test @bug 4245587 4474813 4425878 4767478 8015599
+ * @key headful
  * @author Mark Davidson
  * @summary Tests the location of the heavy weight popup portion of JComboBox,
  * JMenu and JPopupMenu.
diff --git a/jdk/test/javax/swing/PopupFactory/6276087/NonOpaquePopupMenuTest.java b/jdk/test/javax/swing/PopupFactory/6276087/NonOpaquePopupMenuTest.java
index 256ad4e..245eecf 100644
--- a/jdk/test/javax/swing/PopupFactory/6276087/NonOpaquePopupMenuTest.java
+++ b/jdk/test/javax/swing/PopupFactory/6276087/NonOpaquePopupMenuTest.java
@@ -23,6 +23,7 @@
 
 /**
  * @test
+ * @key headful
  * @bug 6276087
  * @author Romain Guy
  * @summary Tests opacity of a popup menu.
diff --git a/jdk/test/javax/swing/PopupFactory/8048506/bug8048506.java b/jdk/test/javax/swing/PopupFactory/8048506/bug8048506.java
index 66167ec..0c5a0c3 100644
--- a/jdk/test/javax/swing/PopupFactory/8048506/bug8048506.java
+++ b/jdk/test/javax/swing/PopupFactory/8048506/bug8048506.java
@@ -23,6 +23,7 @@
 
 /*
  * @test
+ * @key headful
  * @bug 8048506
  * @summary Tests that popup with null-owner does not throw NPE
  * @author Dmitry Markov
diff --git a/jdk/test/javax/swing/RepaintManager/IconifyTest/IconifyTest.java b/jdk/test/javax/swing/RepaintManager/IconifyTest/IconifyTest.java
index 5d4198c..7c540c3 100644
--- a/jdk/test/javax/swing/RepaintManager/IconifyTest/IconifyTest.java
+++ b/jdk/test/javax/swing/RepaintManager/IconifyTest/IconifyTest.java
@@ -22,6 +22,7 @@
  */
 /*
  * @test
+ * @key headful
  * @bug 4665214
  * @summary Makes sure that RepaintManager doesn't attempt to repaint
  *          a frame when it is iconified.
diff --git a/jdk/test/javax/swing/Security/6657138/ComponentTest.java b/jdk/test/javax/swing/Security/6657138/ComponentTest.java
index 2ee7b84..307791b 100644
--- a/jdk/test/javax/swing/Security/6657138/ComponentTest.java
+++ b/jdk/test/javax/swing/Security/6657138/ComponentTest.java
@@ -23,6 +23,7 @@
 
 /*
  * @test
+ * @key headful
  * @bug 6657138
  * @summary Verifies that buttons and labels work well after the fix for 6657138
  * @author Alexander Potochkin
diff --git a/jdk/test/javax/swing/SwingUtilities/4917669/bug4917669.java b/jdk/test/javax/swing/SwingUtilities/4917669/bug4917669.java
index ed43892..7eaba0c 100644
--- a/jdk/test/javax/swing/SwingUtilities/4917669/bug4917669.java
+++ b/jdk/test/javax/swing/SwingUtilities/4917669/bug4917669.java
@@ -24,6 +24,7 @@
 
 /*
  * @test
+ * @key headful
  * @bug 4917669
  * @summary 1.4 REGRESSION: MenuItem accelerator doesn't work if parent menu is in JDialog
  * @author Alexander Zuev
diff --git a/jdk/test/javax/swing/SwingUtilities/7088744/bug7088744.java b/jdk/test/javax/swing/SwingUtilities/7088744/bug7088744.java
index b4ed035..10d97ca 100644
--- a/jdk/test/javax/swing/SwingUtilities/7088744/bug7088744.java
+++ b/jdk/test/javax/swing/SwingUtilities/7088744/bug7088744.java
@@ -21,11 +21,13 @@
  * questions.
  */
 
-/* @test
-   @bug 7088744
-   @summary SwingUtilities.isMiddleMouseButton does not work with ALT/Meta keys
-   @author Pavel Porvatov
-*/
+/*
+ * @test
+ * @key headful
+ * @bug 7088744
+ * @summary SwingUtilities.isMiddleMouseButton does not work with ALT/Meta keys
+ * @author Pavel Porvatov
+ */
 
 import java.awt.Component;
 import java.awt.Event;
diff --git a/jdk/test/javax/swing/SwingUtilities/7146377/bug7146377.java b/jdk/test/javax/swing/SwingUtilities/7146377/bug7146377.java
index 5114b77..20045ef 100644
--- a/jdk/test/javax/swing/SwingUtilities/7146377/bug7146377.java
+++ b/jdk/test/javax/swing/SwingUtilities/7146377/bug7146377.java
@@ -21,11 +21,13 @@
  * questions.
  */
 
-/* @test
-   @bug 7146377
-   @summary closed/javax/swing/DataTransfer/4876520/bug4876520.java failed since b08 in jdk 8
-   @author Pavel Porvatov
-*/
+/*
+ * @test
+ * @key headful
+ * @bug 7146377
+ * @summary closed/javax/swing/DataTransfer/4876520/bug4876520.java failed since b08 in jdk 8
+ * @author Pavel Porvatov
+ */
 
 import javax.swing.*;
 import java.awt.*;
diff --git a/jdk/test/javax/swing/SwingUtilities/TestBadBreak/TestBadBreak.java b/jdk/test/javax/swing/SwingUtilities/TestBadBreak/TestBadBreak.java
index a4d1e0f..5284ce8 100644
--- a/jdk/test/javax/swing/SwingUtilities/TestBadBreak/TestBadBreak.java
+++ b/jdk/test/javax/swing/SwingUtilities/TestBadBreak/TestBadBreak.java
@@ -36,6 +36,7 @@
 
 /**
  * @test
+ * @key headful
  * @bug 8015085 8079253
  * @summary Shortening via " ... " is broken for Strings containing a combining
  *          diaeresis.
diff --git a/jdk/test/javax/swing/ToolTipManager/7123767/bug7123767.java b/jdk/test/javax/swing/ToolTipManager/7123767/bug7123767.java
index f7bae5b..6579549 100644
--- a/jdk/test/javax/swing/ToolTipManager/7123767/bug7123767.java
+++ b/jdk/test/javax/swing/ToolTipManager/7123767/bug7123767.java
@@ -21,13 +21,15 @@
  * questions.
  */
 
-/* @test
-   @bug 7123767
-   @summary Wrong tooltip location in Multi-Monitor configurations
-   @author Vladislav Karnaukhov
-   @modules java.desktop/sun.awt
-   @run main bug7123767
-*/
+/*
+ * @test
+ * @key headful
+ * @bug 7123767
+ * @summary Wrong tooltip location in Multi-Monitor configurations
+ * @author Vladislav Karnaukhov
+ * @modules java.desktop/sun.awt
+ * @run main bug7123767
+ */
 
 import javax.swing.*;
 import javax.swing.plaf.metal.MetalLookAndFeel;
diff --git a/jdk/test/javax/swing/ToolTipManager/Test6256140.java b/jdk/test/javax/swing/ToolTipManager/Test6256140.java
index ca90d81..3456c0e 100644
--- a/jdk/test/javax/swing/ToolTipManager/Test6256140.java
+++ b/jdk/test/javax/swing/ToolTipManager/Test6256140.java
@@ -23,6 +23,7 @@
 
 /*
  * @test
+ * @key headful
  * @bug 6256140
  * @summary Esc key doesn't restore old value in JFormattedtextField when ToolTip is set
  * @author Alexander Potochkin
diff --git a/jdk/test/javax/swing/UIDefaults/6795356/bug6795356.java b/jdk/test/javax/swing/UIDefaults/6795356/bug6795356.java
index f22e588..7be773a 100644
--- a/jdk/test/javax/swing/UIDefaults/6795356/bug6795356.java
+++ b/jdk/test/javax/swing/UIDefaults/6795356/bug6795356.java
@@ -28,7 +28,7 @@
  * @author Alexander Potochkin
  * @library ../../regtesthelpers
  * @build Util
- * @run main bug6795356
+ * @run main/othervm -mx128m bug6795356
  */
 
 import java.lang.ref.WeakReference;
diff --git a/jdk/test/javax/swing/dnd/7171812/bug7171812.java b/jdk/test/javax/swing/dnd/7171812/bug7171812.java
index 8de55bd..ff985b1 100644
--- a/jdk/test/javax/swing/dnd/7171812/bug7171812.java
+++ b/jdk/test/javax/swing/dnd/7171812/bug7171812.java
@@ -21,11 +21,13 @@
  * questions.
  */
 
-/* @test
-   @bug 7171812
-   @summary [macosx] Views keep scrolling back to the drag position after DnD
-   @author Alexander Zuev
-   @run main bug7171812
+/*
+ * @test
+ * @key headful
+ * @bug 7171812
+ * @summary [macosx] Views keep scrolling back to the drag position after DnD
+ * @author Alexander Zuev
+ * @run main bug7171812
  */
 
 import java.awt.*;
diff --git a/jdk/test/javax/swing/plaf/basic/BasicComboPopup/7072653/bug7072653.java b/jdk/test/javax/swing/plaf/basic/BasicComboPopup/7072653/bug7072653.java
index d983cd5..fbaabf0 100644
--- a/jdk/test/javax/swing/plaf/basic/BasicComboPopup/7072653/bug7072653.java
+++ b/jdk/test/javax/swing/plaf/basic/BasicComboPopup/7072653/bug7072653.java
@@ -21,7 +21,9 @@
  * questions.
  */
 
-/* @test
+/*
+ * @test
+ * @key headful
  * @bug 7072653 8144161
  * @summary JComboBox popup mispositioned if its height exceeds the screen height
  * @run main bug7072653
diff --git a/jdk/test/javax/swing/plaf/basic/BasicHTML/4251579/bug4251579.java b/jdk/test/javax/swing/plaf/basic/BasicHTML/4251579/bug4251579.java
index 8aa96ae..04244a9 100644
--- a/jdk/test/javax/swing/plaf/basic/BasicHTML/4251579/bug4251579.java
+++ b/jdk/test/javax/swing/plaf/basic/BasicHTML/4251579/bug4251579.java
@@ -24,6 +24,7 @@
 
 /*
  * @test
+ * @key headful
  * @bug 4251579
  * @summary  Tests if style sheets are working in JLabel
  * @author Denis Sharypov
diff --git a/jdk/test/javax/swing/plaf/basic/BasicMenuUI/4983388/bug4983388.java b/jdk/test/javax/swing/plaf/basic/BasicMenuUI/4983388/bug4983388.java
index 666f0be..1ccb5e6 100644
--- a/jdk/test/javax/swing/plaf/basic/BasicMenuUI/4983388/bug4983388.java
+++ b/jdk/test/javax/swing/plaf/basic/BasicMenuUI/4983388/bug4983388.java
@@ -21,14 +21,16 @@
  * questions.
  */
 
-/* @test
-   @bug 4983388 8015600
-   @summary shortcuts on menus do not work on JDS
-   @author Oleg Mokhovikov
-   @library ../../../../regtesthelpers
-   @build Util
-   @run main bug4983388
-*/
+/*
+ * @test
+ * @key headful
+ * @bug 4983388 8015600
+ * @summary shortcuts on menus do not work on JDS
+ * @author Oleg Mokhovikov
+ * @library ../../../../regtesthelpers
+ * @build Util
+ * @run main bug4983388
+ */
 
 import java.awt.*;
 import javax.swing.*;
diff --git a/jdk/test/javax/swing/plaf/basic/BasicRootPaneUI/HiddenDefaultButtonTest.java b/jdk/test/javax/swing/plaf/basic/BasicRootPaneUI/HiddenDefaultButtonTest.java
index 040126c..29c480c 100644
--- a/jdk/test/javax/swing/plaf/basic/BasicRootPaneUI/HiddenDefaultButtonTest.java
+++ b/jdk/test/javax/swing/plaf/basic/BasicRootPaneUI/HiddenDefaultButtonTest.java
@@ -21,7 +21,9 @@
  * questions.
  */
 
-/* @test
+/*
+ * @test
+ * @key headful
  * @bug 6827800
  * @summary Test to check hidden default button does not respond to 'Enter' key
  * @run main HiddenDefaultButtonTest
diff --git a/jdk/test/javax/swing/plaf/basic/BasicTextUI/8001470/bug8001470.java b/jdk/test/javax/swing/plaf/basic/BasicTextUI/8001470/bug8001470.java
index a63a769..20d9e32 100644
--- a/jdk/test/javax/swing/plaf/basic/BasicTextUI/8001470/bug8001470.java
+++ b/jdk/test/javax/swing/plaf/basic/BasicTextUI/8001470/bug8001470.java
@@ -21,11 +21,13 @@
  * questions.
  */
 
-/* @test
-   @bug 8001470
-   @summary JTextField's size is computed incorrectly when it contains Indic or Thai characters
-   @author Semyon Sadetsky
-  */
+/*
+ * @test
+ * @key headful
+ * @bug 8001470
+ * @summary JTextField's size is computed incorrectly when it contains Indic or Thai characters
+ * @author Semyon Sadetsky
+ */
 
 import javax.swing.*;
 import java.awt.*;
diff --git a/jdk/test/javax/swing/plaf/basic/BasicTreeUI/8023474/bug8023474.java b/jdk/test/javax/swing/plaf/basic/BasicTreeUI/8023474/bug8023474.java
index 1095ace..aff399b 100644
--- a/jdk/test/javax/swing/plaf/basic/BasicTreeUI/8023474/bug8023474.java
+++ b/jdk/test/javax/swing/plaf/basic/BasicTreeUI/8023474/bug8023474.java
@@ -23,6 +23,7 @@
 
 /*
  * @test
+ * @key headful
  * @bug 8023474
  * @summary Tests that the first mouse press starts editing in JTree
  * @author Dmitry Markov
diff --git a/jdk/test/javax/swing/plaf/gtk/crash/RenderBadPictureCrash.java b/jdk/test/javax/swing/plaf/gtk/crash/RenderBadPictureCrash.java
index 71a2e6f..a7bae7f 100644
--- a/jdk/test/javax/swing/plaf/gtk/crash/RenderBadPictureCrash.java
+++ b/jdk/test/javax/swing/plaf/gtk/crash/RenderBadPictureCrash.java
@@ -23,6 +23,7 @@
 
 /*
  @test
+ @key headful
  @bug 8056151 8131751
  @summary Switching to GTK L&F on-the-fly leads to X Window System error RenderBadPicture
  @run main/othervm -Dswing.defaultlaf=javax.swing.plaf.metal.MetalLookAndFeel -Dsun.java2d.xrender=T RenderBadPictureCrash
diff --git a/jdk/test/javax/swing/plaf/nimbus/8041642/bug8041642.java b/jdk/test/javax/swing/plaf/nimbus/8041642/bug8041642.java
index c829e0c..73f4202 100644
--- a/jdk/test/javax/swing/plaf/nimbus/8041642/bug8041642.java
+++ b/jdk/test/javax/swing/plaf/nimbus/8041642/bug8041642.java
@@ -21,11 +21,13 @@
  * questions.
  */
 
-/* @test
-   @bug 8041642 8079450
-   @summary Incorrect paint of JProgressBar in Nimbus LF
-   @author Semyon Sadetsky
-*/
+/*
+ * @test
+ * @key headful
+ * @bug 8041642 8079450
+ * @summary Incorrect paint of JProgressBar in Nimbus LF
+ * @author Semyon Sadetsky
+ */
 
 import javax.swing.*;
 import java.awt.*;
diff --git a/jdk/test/javax/swing/plaf/nimbus/8041725/bug8041725.java b/jdk/test/javax/swing/plaf/nimbus/8041725/bug8041725.java
index d668a34..5556f5b 100644
--- a/jdk/test/javax/swing/plaf/nimbus/8041725/bug8041725.java
+++ b/jdk/test/javax/swing/plaf/nimbus/8041725/bug8041725.java
@@ -21,11 +21,13 @@
  * questions.
  */
 
-/* @test
-   @bug 8041725
-   @summary JList selection colors are not UIResource instances in Nimbus L&F
-   @author Anton Litvinov
-*/
+/*
+ * @test
+ * @key headful
+ * @bug 8041725
+ * @summary JList selection colors are not UIResource instances in Nimbus L&F
+ * @author Anton Litvinov
+ */
 
 import java.awt.*;
 import javax.swing.*;
diff --git a/jdk/test/javax/swing/plaf/nimbus/8057791/bug8057791.java b/jdk/test/javax/swing/plaf/nimbus/8057791/bug8057791.java
index cc31544..d8146b6 100644
--- a/jdk/test/javax/swing/plaf/nimbus/8057791/bug8057791.java
+++ b/jdk/test/javax/swing/plaf/nimbus/8057791/bug8057791.java
@@ -21,20 +21,20 @@
  * questions.
  */
 
-/* @test
-   @bug 8057791
+ /* @test
+   @bug 8057791 8160438
    @summary Selection in JList is drawn with wrong colors in Nimbus L&F
-   @author Anton Litvinov
    @run main bug8057791
  */
-
 import java.awt.Color;
+import java.awt.Font;
 import java.awt.Graphics;
+import java.awt.Point;
 import java.awt.Rectangle;
+import java.awt.Robot;
 import java.awt.image.BufferedImage;
-import java.lang.reflect.InvocationTargetException;
-import java.util.HashSet;
 import javax.swing.DefaultListModel;
+import javax.swing.JFrame;
 import javax.swing.JList;
 import javax.swing.SwingUtilities;
 import javax.swing.UIManager;
@@ -42,59 +42,148 @@
 import javax.swing.plaf.nimbus.NimbusLookAndFeel;
 
 public class bug8057791 {
-    public static void main(String[] args) {
+
+    private static JFrame frame;
+    private static JList<String> list;
+    private static DefaultListModel<String> model;
+    private static Robot robot;
+    private static final int SELECTED_INDEX = 0;
+    private static volatile String errorString = "";
+
+    public static void main(String[] args) throws Exception {
+        robot = new Robot();
+        robot.waitForIdle();
+        runSteps();
+        if (!errorString.isEmpty()) {
+            throw new RuntimeException("Error Log:\n" + errorString);
+        }
+    }
+
+    private static void runSteps() throws Exception {
+        if (tryNimbusLookAndFeel()) {
+            createUI();
+            robot.waitForIdle();
+            runColorTestCase();
+            robot.waitForIdle();
+            cleanUp();
+        }
+
+    }
+
+    private static boolean tryNimbusLookAndFeel()
+            throws Exception {
         try {
             UIManager.setLookAndFeel(new NimbusLookAndFeel());
+        } catch (UnsupportedLookAndFeelException e) {
+            errorString += e.getMessage();
+            return false;
+        }
+        return true;
+    }
 
-            SwingUtilities.invokeAndWait(new Runnable() {
-                @Override
-                public void run() {
-                    final int listWidth = 50;
-                    final int listHeight = 50;
-                    final int selCellIndex = 0;
+    private static void createUI()
+            throws Exception {
+        SwingUtilities.invokeAndWait(new Runnable() {
+            @Override
+            public void run() {
+                frame = new JFrame();
+                frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
+                list = new JList<>();
+                model = new DefaultListModel<>();
+                model.add(0, "@@");
+                Font font = list.getFont();
+                list.setFont(
+                        new Font(font.getFontName(),
+                                Font.BOLD,
+                                (int) (font.getSize2D() * 2)));
+                list.setModel(model);
+                list.setSelectedIndex(SELECTED_INDEX);
+                frame.add(list);
+                frame.pack();
+                frame.setLocationRelativeTo(null);
+                frame.setVisible(true);
+            }
+        });
+    }
 
-                    JList<String> list = new JList<String>();
-                    list.setSize(listWidth, listHeight);
-                    DefaultListModel<String> listModel = new DefaultListModel<String>();
-                    listModel.add(selCellIndex, "E");
-                    list.setModel(listModel);
-                    list.setSelectedIndex(selCellIndex);
+    private static void runColorTestCase() throws Exception {
+        SwingUtilities.invokeAndWait(new Runnable() {
+            @Override
+            public void run() {
+                Rectangle cellBounds = list.getCellBounds(SELECTED_INDEX, SELECTED_INDEX);
+                cellBounds.x += list.getLocationOnScreen().x;
+                cellBounds.y += list.getLocationOnScreen().y;
+                //positive test cases
+                Color foregroundColor = list.getSelectionForeground();
+                Color backgroundColor = list.getSelectionBackground();
+                checkColor(foregroundColor, cellBounds);
+                checkColor(backgroundColor, cellBounds);
+                //negative test cases
+                Color changedForegroundColor = foregroundColor.darker();
+                Color changedBackgroundColor = backgroundColor.brighter();
+                checkNotColor(changedForegroundColor, cellBounds);
+                checkNotColor(changedBackgroundColor, cellBounds);
+            }
+        });
+    }
 
-                    BufferedImage img = new BufferedImage(listWidth, listHeight,
-                        BufferedImage.TYPE_INT_ARGB);
-                    Graphics g = img.getGraphics();
-                    list.paint(g);
-                    g.dispose();
+    private static void checkColor(Color colorCheck, Rectangle bounds) {
+        if (!findColor(colorCheck, bounds)) {
+            String error = "[ERROR][" + colorCheck.toString()
+                    + "] Not found in selected cell";
+            errorString += error;
+        }
+    }
 
-                    Rectangle cellRect = list.getCellBounds(selCellIndex, selCellIndex);
-                    HashSet<Color> cellColors = new HashSet<Color>();
-                    int uniqueColorIndex = 0;
-                    for (int x = cellRect.x; x < (cellRect.x + cellRect.width); x++) {
-                        for (int y = cellRect.y; y < (cellRect.y + cellRect.height); y++) {
-                            Color cellColor = new Color(img.getRGB(x, y), true);
-                            if (cellColors.add(cellColor)) {
-                                System.err.println(String.format("Cell color #%d: %s",
-                                    uniqueColorIndex++, cellColor));
-                            }
-                        }
-                    }
+    private static void checkNotColor(Color colorCheck, Rectangle bounds) {
+        if (findColor(colorCheck, bounds)) {
+            String error = "[ERROR][" + colorCheck.toString()
+                    + "] is found in selected cell. "
+                    + "Not supposed to be found in negative test case";
+            errorString += error;
+        }
+    }
 
-                    Color selForegroundColor = list.getSelectionForeground();
-                    Color selBackgroundColor = list.getSelectionBackground();
-                    if (!cellColors.contains(new Color(selForegroundColor.getRGB(), true))) {
-                        throw new RuntimeException(String.format(
-                            "Selected cell is drawn without selection foreground color '%s'.",
-                            selForegroundColor));
-                    }
-                    if (!cellColors.contains(new Color(selBackgroundColor.getRGB(), true))) {
-                        throw new RuntimeException(String.format(
-                            "Selected cell is drawn without selection background color '%s'.",
-                            selBackgroundColor));
+    private static boolean findColor(Color colorCheck, Rectangle bounds) {
+        BufferedImage img = new BufferedImage(bounds.width,
+                bounds.height,
+                BufferedImage.TYPE_INT_ARGB);
+        Graphics g = img.getGraphics();
+        list.paint(g);
+        g.dispose();
+        checkLoops:
+        for (int x = 0; x < bounds.width; x++) {
+            for (int y = 0; y < bounds.height; y++) {
+                Point relativePointCheck = new Point(bounds.x + x, bounds.y + y);
+                robot.mouseMove(relativePointCheck.x, relativePointCheck.y);
+                Color detectedColor = robot.getPixelColor(relativePointCheck.x,
+                        relativePointCheck.y);
+                if (detectedColor.equals(colorCheck)) {
+                    return true;
+                }
+                if (isMac()) {
+                    //One more chance for Mac due to non-Generic display setting
+                    detectedColor = new Color(img.getRGB(x, y), true);
+                    if (detectedColor.equals(colorCheck)) {
+                        return true;
                     }
                 }
-            });
-        } catch (UnsupportedLookAndFeelException | InterruptedException | InvocationTargetException e) {
-            throw new RuntimeException(e);
+            }
         }
+        return false;
+    }
+
+    private static boolean isMac() {
+        String osName = System.getProperty("os.name");
+        return osName.contains("Mac");
+    }
+
+    private static void cleanUp() throws Exception {
+        SwingUtilities.invokeAndWait(new Runnable() {
+            @Override
+            public void run() {
+                frame.dispose();
+            }
+        });
     }
 }
diff --git a/jdk/test/javax/swing/plaf/nimbus/Test6919629.java b/jdk/test/javax/swing/plaf/nimbus/Test6919629.java
index 6fe98fa..a7b3365 100644
--- a/jdk/test/javax/swing/plaf/nimbus/Test6919629.java
+++ b/jdk/test/javax/swing/plaf/nimbus/Test6919629.java
@@ -21,7 +21,9 @@
  * questions.
  */
 
-/* @test
+/*
+   @test
+   @key headful
    @bug 6919629
    @summary Tests that components with Nimbus.Overrides are GC'ed properly
    @author Peter Zhelezniakov
diff --git a/jdk/test/javax/swing/plaf/synth/7158712/bug7158712.java b/jdk/test/javax/swing/plaf/synth/7158712/bug7158712.java
index 0665362..2ef8899 100644
--- a/jdk/test/javax/swing/plaf/synth/7158712/bug7158712.java
+++ b/jdk/test/javax/swing/plaf/synth/7158712/bug7158712.java
@@ -21,12 +21,14 @@
  * questions.
  */
 
-/* @test
-   @bug 7158712
-   @summary Synth Property "ComboBox.popupInsets" is ignored
-   @library ../../../regtesthelpers
-   @author Pavel Porvatov
-*/
+/*
+ * @test
+ * @key headful
+ * @bug 7158712
+ * @summary Synth Property "ComboBox.popupInsets" is ignored
+ * @library ../../../regtesthelpers
+ * @author Pavel Porvatov
+ */
 
 import javax.swing.*;
 import javax.swing.plaf.basic.BasicComboPopup;
diff --git a/jdk/test/javax/swing/plaf/synth/8040328/bug8040328.java b/jdk/test/javax/swing/plaf/synth/8040328/bug8040328.java
index 72a0e46..3df80da 100644
--- a/jdk/test/javax/swing/plaf/synth/8040328/bug8040328.java
+++ b/jdk/test/javax/swing/plaf/synth/8040328/bug8040328.java
@@ -21,11 +21,13 @@
  * questions.
  */
 
-/* @test
+/*
+   @test
+   @key headful
    @bug 8040328
    @summary JSlider has wrong preferred size with Synth LAF
    @author Semyon Sadetsky
-*/
+ */
 
 import javax.swing.*;
 import javax.swing.plaf.synth.SynthLookAndFeel;
diff --git a/jdk/test/javax/swing/plaf/synth/SynthButtonUI/6276188/bug6276188.java b/jdk/test/javax/swing/plaf/synth/SynthButtonUI/6276188/bug6276188.java
index 1031e5e..a4171fe 100644
--- a/jdk/test/javax/swing/plaf/synth/SynthButtonUI/6276188/bug6276188.java
+++ b/jdk/test/javax/swing/plaf/synth/SynthButtonUI/6276188/bug6276188.java
@@ -22,6 +22,7 @@
  */
 /**
  * @test 1.4 08/08/05
+ * @key headful
  * @bug 6276188
  * @library ../../../../regtesthelpers
  * @build Util
diff --git a/jdk/test/javax/swing/plaf/synth/SynthScrollbarThumbPainter/SynthScrollbarThumbPainterTest.java b/jdk/test/javax/swing/plaf/synth/SynthScrollbarThumbPainter/SynthScrollbarThumbPainterTest.java
index 39601d1..6d1aefc 100644
--- a/jdk/test/javax/swing/plaf/synth/SynthScrollbarThumbPainter/SynthScrollbarThumbPainterTest.java
+++ b/jdk/test/javax/swing/plaf/synth/SynthScrollbarThumbPainter/SynthScrollbarThumbPainterTest.java
@@ -21,7 +21,9 @@
  * questions.
  */
 
-/* @test
+/*
+ * @test
+ * @key headful
  * @bug 7172750
  * @summary Test to check Synth ScrollBar:ScrollBarThumb[].backgroundPainter is invoked
  * @run main SynthScrollbarThumbPainterTest
diff --git a/jdk/test/javax/swing/plaf/synth/Test8015926.java b/jdk/test/javax/swing/plaf/synth/Test8015926.java
index 01751fe..2d17b40 100644
--- a/jdk/test/javax/swing/plaf/synth/Test8015926.java
+++ b/jdk/test/javax/swing/plaf/synth/Test8015926.java
@@ -23,6 +23,7 @@
 
 /*
  * @test
+ * @key headful
  * @bug 8015926
  * @summary Tests that there are no NPE during painting
  * @author Sergey Malenkov
diff --git a/jdk/test/javax/swing/regtesthelpers/JRobot.java b/jdk/test/javax/swing/regtesthelpers/JRobot.java
new file mode 100644
index 0000000..aba18c3
--- /dev/null
+++ b/jdk/test/javax/swing/regtesthelpers/JRobot.java
@@ -0,0 +1,294 @@
+/*
+ * Copyright (c) 2007, 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.
+ */
+
+/**
+ * JRobot is a wrapper around java.awt.Robot that provides some convenience
+ * methods.
+ * <p>When using jtreg you would include this class via something like:
+ * <pre>
+ * @library ../../../regtesthelpers
+ * @build JRobot
+ * </pre>
+ *
+ */
+import java.awt.AWTException;
+import java.awt.Component;
+import java.awt.Dimension;
+import java.awt.EventQueue;
+import java.awt.Point;
+import java.awt.Rectangle;
+import java.awt.event.InputEvent;
+import java.awt.event.KeyEvent;
+import javax.swing.SwingUtilities;
+
+public class JRobot extends java.awt.Robot {
+    private static int DEFAULT_DELAY = 550;
+    private static int INTERNAL_DELAY = 250;
+
+    private int delay;
+    private boolean delaysEnabled;
+
+    protected JRobot(boolean enableDelays) throws AWTException {
+        super();
+        delaysEnabled = enableDelays;
+        setAutoWaitForIdle(enableDelays);
+        if (enableDelays) {
+            setAutoDelay(INTERNAL_DELAY);
+            setDelay(DEFAULT_DELAY);
+        }
+    }
+
+    /**
+     * Return a JRobot. Delays are enabled by default.
+     * @return a JRobot
+     */
+    public static JRobot getRobot() {
+        return getRobot(true);
+    }
+
+    /**
+     * Create a JRobot. The parameter controls whether delays are enabled.
+     * @param enableDelays controls whether delays are enabled.
+     * @return a JRobot
+     */
+    public static JRobot getRobot(boolean enableDelays) {
+        JRobot robot = null;
+        try {
+            robot = new JRobot(enableDelays);
+        } catch (AWTException e) {
+            System.err.println("Coudn't create Robot, details below");
+            throw new Error(e);
+        }
+        return robot;
+    }
+
+    /**
+     * Press and release a key.
+     * @param keycode which key to press. For example, KeyEvent.VK_DOWN
+     */
+    public void hitKey(int keycode) {
+        keyPress(keycode);
+        keyRelease(keycode);
+        delay();
+    }
+
+    /**
+     * Press and release a key with modifiers.
+     * @param keys keys to press. Keys are pressed in order they are passed as
+     * parameters to this method. All keys except the last one are considered
+     * modifiers. For example, to press Ctrl+Shift+T, call:
+     * hitKey(KeyEvent.VK_CONTROL, KeyEvent.VK_SHIFT, KeyEvent.VK_T);
+     */
+    public void hitKey(int... keys) {
+        for (int i = 0; i < keys.length; i++) {
+            keyPress(keys[i]);
+        }
+
+        for (int i = keys.length - 1; i >= 0; i--) {
+            keyRelease(keys[i]);
+        }
+        delay();
+    }
+
+    /**
+     * Move mouse cursor to the center of the Component.
+     * @param c Component the mouse is placed over
+     */
+    public void moveMouseTo(Component c) {
+        Point p = c.getLocationOnScreen();
+        Dimension size = c.getSize();
+        p.x += size.width / 2;
+        p.y += size.height / 2;
+        mouseMove(p.x, p.y);
+        delay();
+    }
+
+    /**
+     * Move mouse smoothly from (x0, y0) to (x1, y1).
+     */
+    public void glide(int x0, int y0, int x1, int y1) {
+        float dmax = (float)Math.max(Math.abs(x1 - x0), Math.abs(y1 - y0));
+        float dx = (x1 - x0) / dmax;
+        float dy = (y1 - y0) / dmax;
+
+        mouseMove(x0, y0);
+        for (int i=1; i<=dmax; i++) {
+            mouseMove((int)(x0 + dx*i), (int)(y0 + dy*i));
+        }
+        delay();
+    }
+
+    /**
+     * Perform a mouse click, i.e. press and release mouse button(s).
+     * @param buttons mouse button(s).
+     *                For example, MouseEvent.BUTTON1_MASK
+     */
+    public void clickMouse(int buttons) {
+        mousePress(buttons);
+        mouseRelease(buttons);
+        delay();
+    }
+
+    /**
+     * Perform a click with the first mouse button.
+     */
+    public void clickMouse() {
+        clickMouse(InputEvent.BUTTON1_MASK);
+    }
+
+    /**
+     * Click in the center of the given Component
+     * @param c the Component to click on
+     * @param buttons mouse button(s).
+     */
+    public void clickMouseOn(Component c, int buttons) {
+        moveMouseTo(c);
+        clickMouse(buttons);
+    }
+
+    /**
+     * Click the first mouse button in the center of the given Component
+     * @param c the Component to click on
+     */
+    public void clickMouseOn(Component c) {
+        clickMouseOn(c, InputEvent.BUTTON1_MASK);
+    }
+
+    /**
+     * Return whether delays are enabled
+     * @return whether delays are enabled
+     */
+    public boolean getDelaysEnabled() {
+        return delaysEnabled;
+    }
+
+    /**
+     * Delay execution by delay milliseconds
+     */
+    public void delay() {
+        delay(delay);
+    }
+
+    /**
+     * Return the delay amount, in milliseconds
+     */
+    public int getDelay() {
+        return delay;
+    }
+
+    /**
+     * Set the delay amount, in milliseconds
+     */
+    public void setDelay(int delay) {
+        this.delay = delay;
+    }
+
+    /**
+     * Waits until all events currently on the event queue have been processed.
+     * Does nothing if called on EDT
+     */
+    public synchronized void waitForIdle() {
+        if (!EventQueue.isDispatchThread()) {
+            super.waitForIdle();
+        }
+    }
+
+    /**
+     * Calculate the center of the Rectangle passed, and return them
+     * in a Point object.
+     * @param r a non-null Rectangle
+     * @return a new Point object containing coordinates of r's center
+     */
+    public Point centerOf(Rectangle r) {
+        return new Point(r.x + r.width / 2, r.y + r.height / 2);
+    }
+
+    /**
+     * Calculate the center of the Rectangle passed, and store it in p.
+     * @param r a non-null Rectangle
+     * @param p a non-null Point that receives coordinates of r's center
+     * @return p
+     */
+    public Point centerOf(Rectangle r, Point p) {
+        p.x = r.x + r.width / 2;
+        p.y = r.y + r.height / 2;
+        return p;
+    }
+
+    /**
+     * Convert a rectangle from coordinate system of Component c to
+     * screen coordinate system.
+     * @param r a non-null Rectangle
+     * @param c a Component whose coordinate system is used for conversion
+     */
+    public void convertRectToScreen(Rectangle r, Component c) {
+        Point p = new Point(r.x, r.y);
+        SwingUtilities.convertPointToScreen(p, c);
+        r.x = p.x;
+        r.y = p.y;
+    }
+
+    /**
+     * Compares two rectangles pixel-by-pixel.
+     * @param r0 the first area
+     * @param r1 the second area
+     * return true if all pixels in the two areas are identical
+     */
+    public boolean compareRects(Rectangle r0, Rectangle r1) {
+        int xShift = r1.x - r0.x;
+        int yShift = r1.y - r0.y;
+
+        for (int y = r0.y; y < r0.y + r0.height; y++) {
+            for (int x = r0.x; x < r0.x + r0.width; x++) {
+                if (!comparePixels(x, y, x + xShift, y + yShift)) {
+                    return false;
+                }
+            }
+        }
+        return true;
+    }
+
+    /**
+     * Compares colors of two points on the screen.
+     * @param p0 the first point
+     * @param p1 the second point
+     * return true if the two points have the same color
+     */
+    public boolean comparePixels(Point p0, Point p1) {
+        return comparePixels(p0.x, p0.y, p1.x, p1.y);
+    }
+
+    /**
+     * Compares colors of two points on the screen.
+     * @param x0 the x coordinate of the first point
+     * @param y0 the y coordinate of the first point
+     * @param x1 the x coordinate of the second point
+     * @param y1 the y coordinate of the second point
+     * return true if the two points have the same color
+     */
+    public boolean comparePixels(int x0, int y0, int x1, int y1) {
+        return (getPixelColor(x0, y0).equals(getPixelColor(x1, y1)));
+    }
+}
diff --git a/jdk/test/javax/swing/regtesthelpers/SwingTestHelper.java b/jdk/test/javax/swing/regtesthelpers/SwingTestHelper.java
new file mode 100644
index 0000000..5b6d35f
--- /dev/null
+++ b/jdk/test/javax/swing/regtesthelpers/SwingTestHelper.java
@@ -0,0 +1,862 @@
+/*
+ * Copyright (c) 2007, 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.awt.*;
+import java.awt.event.*;
+import java.beans.*;
+import java.lang.reflect.*;
+import java.util.*;
+
+import javax.swing.*;
+
+/**
+ * SwingTestHelper is a utility class for writing AWT/Swing regression
+ * tests that require interacting with the UI.  Typically such tests
+ * consist of executing a chunk of code, waiting on an event, executing
+ * more code ...  This is painful in that you typically have to use various
+ * invokeLaters and threading to handle that interaction.  SwingTestHelper
+ * strealines this process.
+ * <p>
+ * SwingTestHelper uses reflection to invoke all methods starting with
+ * the name <code>onEDT</code> on the EDT and all methods starting with
+ * <code>onBackgroundThread</code> on a background thread.  Between each method
+ * invocation all pending events on the EDT are processed.  The methods
+ * are first sorted based on an integer after the method names and invoked
+ * in that order.  For example, the following subclass:
+ * <pre>
+ * class Test extends SwingTestHelper {
+ *   private void onEDT10();
+ *   private void onBackgroundThread20();
+ *   private void onBackgroundThread30();
+ *   private void onEDT40();
+ *   private void onBackgroundThread50();
+ * }
+ * </pre>
+ * Will have the methods invoked in the order <code>onEDT10</code>,
+ * <code>onBackgroundThread20</code>, <code>onBackgroundThread30</code>,
+ * <code>onEDT40</code>, <code>onBackgroundThread50</code>.
+ * <p>
+ * If you're not happy with method mangling you can also use annotations.
+ * The following gives the same result as the previous example:
+ * <pre>
+ * class Test extends SwingTestHelper {
+ *   &#064;Test(10)
+ *   private void foo(); // Was onEDT10
+ *
+ *   &#064;Test(value=20, onEDT=false)
+ *   private void bar(); // Was onBackgroundThread20
+ *
+ *   &#064;Test(value=30, onEDT=false)
+ *   private void baz(); // Was onBackgroundThread30
+ *
+ *   &#064;Test(40)
+ *   private void zed(); // Was onEDT40
+ *
+ *   &#064;Test(value=50, onEDT=false)
+ *   private void onBackgroundThread50(); // Was onBackgroundThread50
+ * }
+ * </pre>
+ * <p>
+ * It is recommended that you increment the value in increments of
+ * 10.  This makes it easier to add methods at a later date without
+ * having to change all method names/annotations after the newly added
+ * method.
+ * <p>
+ * Between each of the methods, all pending events (native and Java)
+ * are processed.
+ * <p>
+ * Failure of the test is signaled by any method throwing
+ * an exception, directly invoking <code>fail</code> or one of the
+ * <code>assert</code> variants.  If no methods throw an exception the test is
+ * assumed to have passed.
+ * <p>
+ * Often times it is necessary to block until focus has been gained on a
+ * particular widget.  This can be handled by the
+ * <code>requestAndWaitForFocus</code> method.  It will invoke
+ * <code>requestFocus</code> and block the test (not the EDT) until focus
+ * has been granted to the widget.
+ * <p>
+ * Care must be taken when using <code>Robot</code> directly.  For
+ * example, it's tempting to flood <code>Robot</code> with events and
+ * assume they will be received after some delay.  Depending upon the
+ * machine you may need to increase the delay.  Instead it's
+ * preferrable to block test execution until the event has been
+ * received and processed.  This can be done using the method
+ * <code>waitForEvent</code>.  For example, to block until a key typed
+ * event has been processed do the following:
+ * <pre>
+ *   private void onEDT() {
+ *     robot.moveMouseTo(myComponent);
+ *     robot.mousePress(xxx);
+ *     robot.mouseRelease(xxx);
+ *     waitForEvent(myComponent, MouseEvent.MOUSE_RELEASED);
+ *   }
+ * </pre>
+ * <p>
+ * Waiting for focus and events are specific examples of a more
+ * general problem.  Often times you need the EDT to continue processing
+ * events, but want to block test execution until something happens.
+ * In the case of focus you want to block test execution until focus
+ * is gained.  The method <code>waitForCondition</code> can be used to
+ * block test execution until the supplied <code>Runnable</code> returns.  The
+ * <code>Runnable</code> is invoked on the background thread.
+ * <p>
+ * To use this class you will need to do the following:
+ * <ol>
+ * <li>Override the method <code>createContentPane</code>.  All of your logic
+ *     for setting up the test environment should go here.  This method is
+ *     invoked on the EDT.
+ * <li>Implement the necessary <code>onEDTXX</code> and
+ *     <code>onBackgroundThreadXXX</code> methods to do the actual testing.
+ * <li>Make your <code>main</code> method look like:
+ *     <code>new MySwingTestHelper().run(args)</code>.  This will block
+ *     until the test fails or succeeds.
+ * <li>To use this with jtreg you'll need to have something like:
+ *   <pre>
+ *     &#064;library ../../../regtesthelpers
+ *     &#064;build Test JRobot Assert SwingTestHelper
+ *     &#064;run main MySwingTestHelper
+ *     * </pre>
+ * </ol>
+ * <p>
+ * Here's a complete example:
+ * <pre>
+ * public class bug4852305 extends SwingTestHelper {
+ *     private JTable table;
+ *
+ *     public static void main(String[] args) throws Throwable {
+ *         new bug4852305().run(args);
+ *     }
+ *
+ *     protected Component createContentPane() {
+ *         DefaultTableModel model = new DefaultTableModel(1, 2);
+ *         model.setValueAt("x", 0, 0);
+ *         model.setValueAt("z", 0, 1);
+ *         table = new JTable(model);
+ *         table.setDefaultEditor(Object.class, new DefaultCellEditor(new JTextField()) {
+ *             public boolean isCellEditable(EventObject anEvent) {
+ *                 if ((anEvent instanceof KeyEvent) ||
+ *                         (anEvent instanceof ActionEvent)) {
+ *                     return false;
+ *                 }
+ *                 return true;
+ *             }
+ *         });
+ *         return new JScrollPane(table);
+ *     }
+ *
+ *     private void onEDT10() {
+ *         requestAndWaitForFocus(table);
+ *     }
+ *
+ *     private void onEDT20() {
+ *         robot.keyPress(KeyEvent.VK_A);
+ *         robot.keyRelease(KeyEvent.VK_A);
+ *         waitForEvent(table, KeyEvent.KEY_RELEASED);
+ *     }
+ *
+ *     private void onEDT30() {
+ *         if (table.isEditing()) {
+ *             fail("Should not be editing");
+ *         }
+ *     }
+ * }
+ * </pre>
+ *
+ *
+ * @author Scott Violet
+ */
+public abstract class SwingTestHelper {
+    private static final String ON_EDT_METHOD_NAME = "onEDT";
+    private static final String IN_BACKGROUND_METHOD_NAME = "onBackgroundThread";
+
+    // Whether or not we've installed a PropertyChangeListener on the
+    // KeyboardFocusManager
+    private boolean installedFocusListener;
+    // Component currently blocking on until focus has been received.
+    private Component componentWaitingForFocus;
+
+    // Set to true when done.
+    private boolean done;
+    // If failed, this gives the exception.  Only the first exception is
+    // kept.
+    private Throwable error;
+
+    // List of methods to invoke
+    private java.util.List<Method> methods;
+
+    // The conditions the background thread is blocked on.
+    private java.util.List<Runnable> conditions;
+
+    // Whether or not we've installed the AWTEventListener
+    private boolean installedEventListener;
+
+    /**
+     * Instance of <code>Robot</code> returned from <code>createRobot</code>.
+     */
+    protected JRobot robot;
+
+    /**
+     * <code>Window</code> returned from <code>createWindow</code>.
+     */
+    protected Window window;
+
+    // Listens for the first paint event
+    private AWTEventListener paintListener;
+    // Whether or not we've received a paint event.
+    private boolean receivedFirstPaint;
+
+    // used if the user wants to slow down method processing
+    private PauseCondition delay = null;
+
+    private boolean showProgress;
+    private JProgressBar progBar;
+
+
+    public SwingTestHelper() {
+        paintListener = new AWTEventListener() {
+            public void eventDispatched(AWTEvent ev) {
+                if ((ev.getID() & PaintEvent.PAINT) != 0 &&
+                        ev.getSource() == window) {
+                    synchronized(SwingTestHelper.this) {
+                        if (receivedFirstPaint) {
+                            return;
+                        }
+                        receivedFirstPaint = true;
+                    }
+                    Toolkit.getDefaultToolkit().removeAWTEventListener(
+                                   paintListener);
+                    startControlLoop();
+                }
+            }
+        };
+        Toolkit.getDefaultToolkit().addAWTEventListener(
+            paintListener, AWTEvent.PAINT_EVENT_MASK);
+    }
+
+    /**
+     * Sets whether SwingTestHelper should use {@code SunToolkit.realSync}
+     * to wait for events to finish, or {@code Robot.waitForIdle}. The default
+     * is to use realSync.
+     * Nov 2014: no realSync any more, just robot.waitForIdle which actually
+     * _is_ realSync on all platforms but OS X (and thus cannot be used on EDT).
+     */
+    public void setUseRealSync(boolean useRealSync) {
+        //NOOP
+    }
+
+    /**
+     * Set the amount of time to delay between invoking methods in
+     * the control loop. Useful to slow down testing.
+     */
+    protected void setDelay(int delay) {
+        if (delay <= 0) {
+            this.delay = null;
+        } else {
+            this.delay = new PauseCondition(delay);
+        }
+    }
+
+    /**
+     * Sets whether or not progress through the list of methods is
+     * shown by a progress bar at the bottom of the window created
+     * by {@code createWindow}.
+     */
+    protected void setShowProgress(boolean showProgress) {
+        this.showProgress = showProgress;
+    }
+
+    /**
+     * Creates and returns the <code>Window</code> for the test.  This
+     * implementation returns a JFrame with a default close operation
+     * of <code>EXIT_ON_CLOSE</code>.  The <code>Component</code>
+     * returned from <code>createContentPane</code> is added the
+     * <code>JFrame</code> and the the frame is packed.
+     * <p>
+     * Typically you only need override <code>createContentPane</code>.
+     */
+    protected Window createWindow() {
+        JFrame frame = new JFrame("Test: " + getClass().getName());
+        frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
+        frame.add(createContentPane());
+        if (showProgress) {
+            progBar = new JProgressBar();
+            progBar.setString("");
+            progBar.setStringPainted(true);
+            frame.add(progBar, BorderLayout.SOUTH);
+        }
+        frame.pack();
+        return frame;
+    }
+
+    /**
+     * Returns the <code>Component</code> to place in the frame.
+     * Override this or the <code>createWindow</code> method.
+     */
+    protected Component createContentPane() {
+        return null;
+    }
+
+    /**
+     * Invokes <code>requestFocus</code> on the passed in component (assuming
+     * it doesn't already have focus).  Test execution is blocked until focus
+     * has been gained on the component.  This method <b>must</b> be invoked
+     * on the EDT, if you do not invoke it from the edt the test will fail.
+     *
+     * @param c the <code>Component</code> to wait for focus on
+     */
+    protected void requestAndWaitForFocus(Component c) {
+        requestAndWaitForFocus(c, true);
+    }
+
+    /**
+     * Blocks test execution until focus is gained on the component.
+     * This method <b>must</b> be invoked
+     * on the EDT, if you do not invoke it from the edt the test will fail.
+     */
+    protected void waitForFocusGained(Component c) {
+        requestAndWaitForFocus(c, false);
+    }
+
+    private void requestAndWaitForFocus(Component c, boolean requestFocus) {
+        if (!EventQueue.isDispatchThread()) {
+            System.out.println(
+                "requestAndWaitForFocus should be invoked on EDT");
+            throw new RuntimeException();
+        }
+        if (componentWaitingForFocus != null) {
+            System.out.println("Already waiting for focus");
+            throw new RuntimeException();
+        }
+        if (!installedFocusListener) {
+            installedFocusListener = true;
+            KeyboardFocusManager.getCurrentKeyboardFocusManager().
+                addPropertyChangeListener(new FocusListener());
+        }
+        synchronized(this) {
+            if (c.hasFocus()) {
+                return;
+            }
+            componentWaitingForFocus = c;
+        }
+        if (requestFocus) {
+            c.requestFocus();
+        }
+        waitForCondition(new FocusCondition());
+    }
+
+    /**
+     * Blocks test execution until the specified event has been received.
+     * This method immediately returns and the EDT will continue to
+     * process events, but test execution is blocked until
+     * the event is received.
+     *
+     * @param event the event type to wait for
+     */
+    protected void waitForEvent(int event) {
+        waitForEvent(null, event);
+    }
+
+    /**
+     * Blocks test execution until the specified event has been received.
+     * This method immediately returns and the EDT will continue to
+     * process events, but test execution is blocked until
+     * the event is received.
+     *
+     * @param target the <code>Component</code> to wait for the event on;
+     *               <code>null</code> indicates it does not matter which
+     *               component the event is received on
+     * @param event the event type to wait for
+     */
+    protected void waitForEvent(Component target, int event) {
+        waitForCondition(new EventCondition(target, event));
+        if (!installedEventListener) {
+            installedEventListener = true;
+            Toolkit.getDefaultToolkit().addAWTEventListener(
+                    new EventListener(), 0xFFFFFFFFFFFFFFFFl);
+        }
+    }
+
+    /**
+     * Paused test execution for the specified amount of time.  The caller
+     * immediately returns and the EDT can process events.
+     *
+     * @param time the amount of time, in milliseconds, to pause for
+     */
+    protected void pause(int time) {
+        waitForCondition(new PauseCondition(time));
+    }
+
+    /**
+     * Schedules a <code>Runnable</code> that will be processed in the
+     * background thread.  This method immediately returns, and the
+     * EDT is free to continue processing events. Test execution is
+     * blocked until the <code>Runnable</code> completes.
+     */
+    protected void waitForCondition(Runnable runnable) {
+        synchronized(this) {
+            if (conditions == null) {
+                conditions = new LinkedList<Runnable>();
+            }
+            conditions.add(runnable);
+        }
+    }
+
+    /**
+     * Runs the test.  This method blocks the caller until the test
+     * fails or succeeds. Recognized arguments are:
+     * <p>
+     * "-exit": Causes main to exit when the test is done.
+     * "-showProg": Indicate the progress of the test with a
+     *              progress bar in the main window. Only works
+     *              if the test hasn't overridden {@code createWindow}.
+     * "-delay int": Sets the delay between executing methods.
+     *               Useful when you want to slow a test to watch it.
+     *
+     * @param args the arguments from main, it's ok to pass in null
+     */
+    protected final void run(String[] args) throws Throwable {
+        boolean exit = false;
+        if (args != null) {
+            for (int i = 0; i < args.length; i++) {
+                if (args[i].equals("-exit")) {
+                    exit = true;
+                } else if (args[i].equals("-delay")) {
+                    try {
+                        setDelay(Integer.parseInt(args[++i]));
+                    } catch (NumberFormatException ne) {
+                        throw new RuntimeException("-delay requires an integer value");
+                    } catch (ArrayIndexOutOfBoundsException ae) {
+                        throw new RuntimeException("-delay requires an integer value");
+                    }
+                } else if (args[i].equals("-showProg")) {
+                    setShowProgress(true);
+                } else {
+                    throw new RuntimeException("Invalid argument \"" + args[i] + "\"");
+                }
+            }
+        }
+
+        createWindow0();
+        synchronized(this) {
+            while(!done) {
+                wait();
+            }
+        }
+        if (exit) {
+            // Not in harness
+            if (error != null) {
+                System.out.println("FAILED: " + error);
+                error.printStackTrace();
+            }
+            System.exit(0);
+        }
+        if (error != null) {
+            throw error;
+        }
+    }
+
+    /**
+     * Creates the window, on the EDT.
+     */
+    private void createWindow0() {
+        EventQueue.invokeLater(new Runnable() {
+            public void run() {
+                window = createWindow();
+                window.show();
+            }
+        });
+    }
+
+    /**
+     * Initializes the progress bar if necessary.
+     */
+    private void initProgressBar(final int size) {
+        EventQueue.invokeLater(new Runnable() {
+            public void run() {
+                if (progBar != null) {
+                    progBar.setMaximum(size);
+                }
+            }
+        });
+    }
+
+    /**
+     * Starst the control loop.
+     */
+    private void startControlLoop() {
+        robot = createRobot();
+        if (robot != null) {
+            calculateMethods();
+            initProgressBar(methods.size());
+            new Thread(new Runnable() {
+                public void run() {
+                    controlLoop();
+                }
+            }).start();
+        }
+    }
+
+    /**
+     * Increment the progress bar.
+     */
+    private void nextProgress(final String name) {
+        EventQueue.invokeLater(new Runnable() {
+            public void run() {
+                if (progBar != null) {
+                    progBar.setString(name);
+                    progBar.setValue(progBar.getValue() + 1);
+                }
+            }
+        });
+    }
+
+    private synchronized Runnable currentCondition() {
+        if (conditions != null && conditions.size() > 0) {
+            return conditions.get(0);
+        }
+        return null;
+    }
+
+    private synchronized Runnable nextCondition() {
+        return conditions.remove(0);
+    }
+
+    private void controlLoop() {
+        int methodIndex = 0;
+        while (methodIndex < methods.size()) {
+            // Wait for any pending conditions
+            Runnable condition;
+            while ((condition = currentCondition()) != null) {
+                try {
+                    condition.run();
+                } catch (Exception e) {
+                    fail(e);
+                    return;
+                }
+                waitForEDTToFinish();
+                synchronized(this) {
+                    if (done) {
+                        return;
+                    }
+                }
+                // Advance to next condition
+                nextCondition();
+            }
+
+            // Let all events on the EDT finish
+            waitForEDTToFinish();
+
+            if (delay != null) {
+                delay.run();
+            }
+
+            // Invoke the next method
+            Method method = methods.get(methodIndex++);
+            Test test = method.getAnnotation(Test.class);
+            boolean onEDT = true;
+            if (test != null) {
+                onEDT = test.onEDT();
+            }
+            else if (!method.getName().startsWith(ON_EDT_METHOD_NAME)) {
+                onEDT = false;
+            }
+            if (onEDT) {
+                invokeOnEDT(method);
+            }
+            else {
+                invoke(method);
+            }
+
+            // Let all events on the EDT finish
+            waitForEDTToFinish();
+
+            nextProgress(method.getName());
+
+            // If done, stop.
+            synchronized(this) {
+                if (done) {
+                    return;
+                }
+            }
+        }
+
+        // No more methods, if we get and done isn't true, set it true
+        // so that the main thread wakes up.
+        synchronized(this) {
+            if (!done) {
+                done = true;
+                notifyAll();
+            }
+        }
+    }
+
+    private void waitForEDTToFinish() {
+            robot.waitForIdle();
+        }
+
+    private void invokeOnEDT(final Method method) {
+        try {
+            EventQueue.invokeAndWait(new Runnable() {
+                public void run() {
+                    invoke(method);
+                }
+            });
+        } catch (InvocationTargetException ite) {
+            fail(ite);
+        } catch (InterruptedException ie) {
+            fail(ie);
+        }
+    }
+
+    private void invoke(Method method) {
+        System.out.println("invoking: " + method.getName());
+        try {
+            if (Modifier.isPrivate(method.getModifiers())) {
+                method.setAccessible(true);
+            }
+            method.invoke(this);
+        } catch (Exception e) {
+            fail(e);
+        }
+    }
+
+    // Determines the methods to execute.
+    private void calculateMethods() {
+        // Using a Set avoids duplicating methods returned by both
+        // getMethods() and getDeclaredMethods().
+        HashSet<Method> allMethods = new HashSet<Method>();
+        allMethods.addAll(Arrays.asList(getClass().getMethods()));
+        allMethods.addAll(Arrays.asList(getClass().getDeclaredMethods()));
+
+        methods = new ArrayList<Method>();
+        for (Method method : allMethods) {
+            Test test = method.getAnnotation(Test.class);
+            if (test != null) {
+                methods.add(method);
+            }
+            else if (method.getName().startsWith(ON_EDT_METHOD_NAME)) {
+                methods.add(method);
+            }
+            else if (method.getName().startsWith(IN_BACKGROUND_METHOD_NAME)) {
+                methods.add(method);
+            }
+        }
+        Comparator<Method> comparator = new Comparator<Method>() {
+            public int compare(Method m1, Method m2) {
+                int index1 = getIndex(m1);
+                int index2 = getIndex(m2);
+                return index1 - index2;
+            }
+            private int getIndex(Method m) {
+                String name = m.getName();
+                String indexAsString;
+                Test test = m.getAnnotation(Test.class);
+                if (test != null) {
+                    return test.value();
+                }
+                if (name.startsWith(ON_EDT_METHOD_NAME)) {
+                    indexAsString = name.substring(
+                            ON_EDT_METHOD_NAME.length());
+                }
+                else {
+                    indexAsString = name.substring(
+                            IN_BACKGROUND_METHOD_NAME.length());
+                }
+                if (indexAsString.length() == 0) {
+                    System.out.println(
+                            "onEDT and onBackgroundThread must be " +
+                            "followed by an integer specifying " +
+                            "order.");
+                    System.exit(0);
+                }
+                return Integer.parseInt(indexAsString);
+            }
+        };
+        Collections.sort(methods, comparator);
+    }
+
+    /**
+     * Invoke if the test should be considered to have failed.  This will
+     * stop test execution.
+     */
+    public void fail(String reason) {
+        fail(new RuntimeException(reason));
+    }
+
+    /**
+     * Invoke if the test should be considered to have failed.  This will
+     * stop test execution.
+     */
+    public void fail(Throwable error) {
+        synchronized(this) {
+            if (this.error == null) {
+                if (error instanceof InvocationTargetException) {
+                    this.error = ((InvocationTargetException)error).
+                            getCause();
+                }
+                else {
+                    this.error = error;
+                }
+                this.done = true;
+                notifyAll();
+            }
+        }
+    }
+
+    /**
+     * Invoke to prematurely stop test execution while there are remaining
+     * methods.  You typically don't invoke this, instead if all methods have
+     * been executed and fail hasn't been invoked, the test is considered to
+     * have passed.
+     */
+    public void succeeded() {
+        synchronized(this) {
+            this.done = true;
+            notifyAll();
+        }
+    }
+
+    /**
+     * Creates and returns the Robot that will be used.  You generally don't
+     * need to override this.
+     */
+    protected JRobot createRobot() {
+        JRobot robot = JRobot.getRobot(false);
+        return robot;
+    }
+
+
+    private class FocusListener implements PropertyChangeListener {
+        public void propertyChange(PropertyChangeEvent e) {
+            if (componentWaitingForFocus != null &&
+                    "focusOwner".equals(e.getPropertyName()) &&
+                    componentWaitingForFocus == e.getNewValue()) {
+                synchronized(SwingTestHelper.this) {
+                    componentWaitingForFocus = null;
+                    SwingTestHelper.this.notifyAll();
+                }
+            }
+        }
+    }
+
+
+    private class EventCondition implements Runnable {
+        private Component component;
+        private int eventID;
+        private boolean received;
+
+        EventCondition(Component component, int eventID) {
+            this.component = component;
+            this.eventID = eventID;
+        }
+
+        public int getEventID() {
+            return eventID;
+        }
+
+        public Component getComponent() {
+            return component;
+        }
+
+        public void received() {
+            synchronized(SwingTestHelper.this) {
+                this.received = true;
+                SwingTestHelper.this.notifyAll();
+            }
+        }
+
+        public boolean isWaiting() {
+            return !received;
+        }
+
+        public void run() {
+            synchronized(SwingTestHelper.this) {
+                while (!received) {
+                    try {
+                        SwingTestHelper.this.wait();
+                    } catch (InterruptedException ie) {
+                        fail(ie);
+                    }
+                }
+            }
+        }
+    }
+
+
+    private class FocusCondition implements Runnable {
+        public void run() {
+            synchronized(SwingTestHelper.this) {
+                while (componentWaitingForFocus != null) {
+                    try {
+                        SwingTestHelper.this.wait();
+                    } catch (InterruptedException ie) {
+                        fail(ie);
+                    }
+                }
+            }
+        }
+    }
+
+
+    private class PauseCondition implements Runnable {
+        private int time;
+        PauseCondition(int time) {
+            this.time = time;
+        }
+        public void run() {
+            try {
+                Thread.sleep(time);
+            } catch (InterruptedException ie) {
+                fail(ie);
+            }
+        }
+    }
+
+
+    private class EventListener implements AWTEventListener {
+        public void eventDispatched(AWTEvent ev) {
+            int eventID = ev.getID();
+            synchronized (SwingTestHelper.this) {
+                for (Runnable condition : conditions) {
+                    if (condition instanceof EventCondition) {
+                        EventCondition ec = (EventCondition)condition;
+                        if (ec.isWaiting()) {
+                            if (eventID == ec.getEventID() &&
+                                    (ec.getComponent() == null ||
+                                     ev.getSource() == ec.getComponent())) {
+                                ec.received();
+                            }
+                            return;
+                        }
+                    }
+                    else {
+                        return;
+                    }
+                }
+            }
+        }
+    }
+}
diff --git a/hotspot/src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/jdi/ValueImpl.java b/jdk/test/javax/swing/regtesthelpers/Test.java
similarity index 72%
rename from hotspot/src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/jdi/ValueImpl.java
rename to jdk/test/javax/swing/regtesthelpers/Test.java
index b046ae5..2ce9287 100644
--- a/hotspot/src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/jdi/ValueImpl.java
+++ b/jdk/test/javax/swing/regtesthelpers/Test.java
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2002, 2003, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2007, 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
@@ -19,17 +19,16 @@
  * 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.jvm.hotspot.jdi;
+import java.lang.annotation.ElementType;
+import java.lang.annotation.Retention;
+import java.lang.annotation.RetentionPolicy;
+import java.lang.annotation.Target;
 
-import com.sun.jdi.*;
-
-abstract class ValueImpl extends MirrorImpl implements Value {
-    ValueImpl(VirtualMachine aVm) {
-        super(aVm);
-    }
-
-    // type() is in the subclasses
-}
+@Retention(RetentionPolicy.RUNTIME)
+@Target(ElementType.METHOD)
+public @interface Test {
+    int value();
+    boolean onEDT() default true;
+}
\ No newline at end of file
diff --git a/jdk/test/javax/swing/regtesthelpers/Util.java b/jdk/test/javax/swing/regtesthelpers/Util.java
index 534d997..4724fa2 100644
--- a/jdk/test/javax/swing/regtesthelpers/Util.java
+++ b/jdk/test/javax/swing/regtesthelpers/Util.java
@@ -81,7 +81,8 @@
 
     /**
      * Fills the heap until OutOfMemoryError occurs. This method is useful for
-     * WeakReferences removing.
+     * WeakReferences removing. To minimize the amount of filled memory the
+     * test should provide reasonable heap size via -mx option.
      */
     public static void generateOOME() {
         List<Object> bigLeak = new LinkedList<Object>();
diff --git a/jdk/test/javax/swing/reliability/TaskUndJFrameProperties.java b/jdk/test/javax/swing/reliability/TaskUndJFrameProperties.java
index 4cea8f9..cec296f 100644
--- a/jdk/test/javax/swing/reliability/TaskUndJFrameProperties.java
+++ b/jdk/test/javax/swing/reliability/TaskUndJFrameProperties.java
@@ -26,6 +26,7 @@
 
 /*
  * @test
+ * @key headful
  * @summary Construct a Undecorated JFrame, try to change the properties
  *          using setVisible() method.
  * @author Aruna Samji
diff --git a/jdk/test/javax/swing/reliability/TaskZoomJFrameChangeState.java b/jdk/test/javax/swing/reliability/TaskZoomJFrameChangeState.java
index d8a3374..1ab5df6 100644
--- a/jdk/test/javax/swing/reliability/TaskZoomJFrameChangeState.java
+++ b/jdk/test/javax/swing/reliability/TaskZoomJFrameChangeState.java
@@ -26,6 +26,7 @@
 
 /*
  * @test
+ * @key headful
  * @summary Construct a JFrame, zoom it from the normal state and back forth
  *          using Frame.ZOOMED and Frame.NORMAL. Iconofy from the zoomed
  *          state and back forth using Frame.ICONIFIED and Frame.NORMAL and
diff --git a/jdk/test/javax/swing/reliability/TaskZoomJFrameRepaint.java b/jdk/test/javax/swing/reliability/TaskZoomJFrameRepaint.java
index 54e434b..0099210 100644
--- a/jdk/test/javax/swing/reliability/TaskZoomJFrameRepaint.java
+++ b/jdk/test/javax/swing/reliability/TaskZoomJFrameRepaint.java
@@ -26,6 +26,7 @@
 
 /*
  * @test
+ * @key headful
  * @summary Construct a jframe with some components and zoom the frame and bring it back to normal state.
  * @author Aruna Samji
  * @library ../../../lib/testlibrary
diff --git a/jdk/test/javax/swing/text/AbstractDocument/6968363/Test6968363.java b/jdk/test/javax/swing/text/AbstractDocument/6968363/Test6968363.java
index 333bfed..5d1eb6c 100644
--- a/jdk/test/javax/swing/text/AbstractDocument/6968363/Test6968363.java
+++ b/jdk/test/javax/swing/text/AbstractDocument/6968363/Test6968363.java
@@ -42,6 +42,7 @@
 
 /*
  * @test
+ * @key headful
  * @bug 6968363
  * @summary Ensures that a custom document may not extend AbstractDocument
  * @author Sergey Malenkov
diff --git a/jdk/test/javax/swing/text/CSSBorder/6796710/bug6796710.java b/jdk/test/javax/swing/text/CSSBorder/6796710/bug6796710.java
index 46cfd90..1cd3c71 100644
--- a/jdk/test/javax/swing/text/CSSBorder/6796710/bug6796710.java
+++ b/jdk/test/javax/swing/text/CSSBorder/6796710/bug6796710.java
@@ -23,6 +23,7 @@
 
 /*
  * @test
+ * @key headful
  * @bug 6796710 7124242
  * @summary Html content in JEditorPane is overlapping on swing components while resizing the application.
  * @library ../../../regtesthelpers
diff --git a/jdk/test/javax/swing/text/DefaultEditorKit/4278839/bug4278839.java b/jdk/test/javax/swing/text/DefaultEditorKit/4278839/bug4278839.java
index 07b79d6..65cf42c 100644
--- a/jdk/test/javax/swing/text/DefaultEditorKit/4278839/bug4278839.java
+++ b/jdk/test/javax/swing/text/DefaultEditorKit/4278839/bug4278839.java
@@ -21,7 +21,9 @@
  * questions.
  */
 
-/* @test Jan 16, 2003
+/*
+ * @test
+ * @key headful
  * @bug 4278839
  * @summary Incorrect cursor movement between words at the end of line
  * @author Anton Nashatyrev
diff --git a/jdk/test/javax/swing/text/DefaultStyledDocument/6636983/bug6636983.java b/jdk/test/javax/swing/text/DefaultStyledDocument/6636983/bug6636983.java
index 9f38cd1..9d14605 100644
--- a/jdk/test/javax/swing/text/DefaultStyledDocument/6636983/bug6636983.java
+++ b/jdk/test/javax/swing/text/DefaultStyledDocument/6636983/bug6636983.java
@@ -23,6 +23,7 @@
 
 /*
  * @test
+ * @key headful
  * @bug 6636983
  * @summary test that composed text at the line starts is handled correctly
  * @author Sergey Groznyh
diff --git a/jdk/test/javax/swing/text/FlowView/LayoutTest.java b/jdk/test/javax/swing/text/FlowView/LayoutTest.java
new file mode 100644
index 0000000..1cb9eff
--- /dev/null
+++ b/jdk/test/javax/swing/text/FlowView/LayoutTest.java
@@ -0,0 +1,90 @@
+/*
+ * Copyright (c) 2007, 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.
+ */
+
+/* @test
+   @bug 6452106 6606443 8161195
+   @author Peter Zhelezniakov
+   @library ../../regtesthelpers
+   @build Test JRobot SwingTestHelper
+   @run main/timeout=300 LayoutTest
+*/
+
+import javax.swing.text.*;
+import javax.swing.*;
+import java.awt.event.*;
+import java.awt.*;
+
+public class LayoutTest extends SwingTestHelper {
+    JTextPane text;
+
+    public static void main(String[] args) throws Throwable {
+        new LayoutTest().run(args);
+    }
+
+    protected Component createContentPane() {
+        return text = new JTextPane();
+    }
+
+    @Test(value=10, onEDT=true)
+    private void onEDT10() {
+        requestAndWaitForFocus(text);
+    }
+
+
+    @Test(value=100, onEDT=true)
+    private void prepare6452106() {
+        text.setText("This is easily generated on my\nmachine");
+        Document doc = text.getDocument();
+
+        // wrap the long paragraph
+        Dimension d = text.getPreferredSize();
+        Dimension size = new Dimension(d.width * 2 / 3, d.height * 5);
+        window.setSize(size);
+
+        // place caret at the end of 2nd line
+        Element p1 = doc.getDefaultRootElement().getElement(0);
+        int pos = p1.getEndOffset();
+        text.setCaretPosition(pos - 1);
+    }
+
+    @Test(value=110, onEDT=false)
+    private void test6452106() {
+        robot.setDelay(300);
+        robot.hitKey(KeyEvent.VK_DELETE);
+        robot.hitKey(KeyEvent.VK_SPACE);
+        robot.hitKey(KeyEvent.VK_SPACE);
+    }
+
+
+    @Test(value=200, onEDT=true)
+    private void prepare6606443() {
+        text.setText("This is easily\ngenerated\non my machine");
+        text.setSelectionStart(15);
+        text.setSelectionEnd(24);
+    }
+
+    @Test(value=210, onEDT=false)
+    private void test6606443() {
+        robot.hitKey(KeyEvent.VK_ENTER);
+    }
+}
diff --git a/jdk/test/javax/swing/text/JTextComponent/5074573/bug5074573.java b/jdk/test/javax/swing/text/JTextComponent/5074573/bug5074573.java
index a2067bb..bdadb11 100644
--- a/jdk/test/javax/swing/text/JTextComponent/5074573/bug5074573.java
+++ b/jdk/test/javax/swing/text/JTextComponent/5074573/bug5074573.java
@@ -23,6 +23,7 @@
 
 /*
  * @test
+ * @key headful
  * @bug 5074573
  * @summary tests delte-next-word and delete-prev-word actions for all text compnents and all look&feels
  * @author Igor Kushnirskiy
diff --git a/jdk/test/javax/swing/text/NavigationFilter/6735293/bug6735293.java b/jdk/test/javax/swing/text/NavigationFilter/6735293/bug6735293.java
index 08658b4..431baac 100644
--- a/jdk/test/javax/swing/text/NavigationFilter/6735293/bug6735293.java
+++ b/jdk/test/javax/swing/text/NavigationFilter/6735293/bug6735293.java
@@ -23,6 +23,7 @@
 
 /*
  * @test
+ * @key headful
  * @bug 6735293
  * @summary javax.swing.text.NavigationFilter.getNextVisualPositionFrom() not always throws BadLocationException
  * @author Pavel Porvatov
diff --git a/jdk/test/javax/swing/text/NavigationFilter/8058305/bug8058305.java b/jdk/test/javax/swing/text/NavigationFilter/8058305/bug8058305.java
index 9ef6968..6f17816 100644
--- a/jdk/test/javax/swing/text/NavigationFilter/8058305/bug8058305.java
+++ b/jdk/test/javax/swing/text/NavigationFilter/8058305/bug8058305.java
@@ -30,6 +30,7 @@
 
 /*
  * @test
+ * @key headful
  * @bug 8058305
  * @summary BadLocationException is not thrown by
  *   javax.swing.text.View.getNextVisualPositionFrom() for invalid positions
diff --git a/jdk/test/javax/swing/text/TableView/I18nLayoutTest.java b/jdk/test/javax/swing/text/TableView/I18nLayoutTest.java
index 49f7a4d..61bf8a0 100644
--- a/jdk/test/javax/swing/text/TableView/I18nLayoutTest.java
+++ b/jdk/test/javax/swing/text/TableView/I18nLayoutTest.java
@@ -23,6 +23,7 @@
 
 /*
  * @test
+ * @key headful
  * @bug 8133864
  * @summary  Wrong display, when the document I18n properties is true.
  * @author Semyon Sadetsky
@@ -345,4 +346,4 @@
             Specs.add(cellEnd);
         }
     }
-}
\ No newline at end of file
+}
diff --git a/jdk/test/javax/swing/text/Utilities/bug7045593.java b/jdk/test/javax/swing/text/Utilities/bug7045593.java
index 1de7cc1..3f882a6 100644
--- a/jdk/test/javax/swing/text/Utilities/bug7045593.java
+++ b/jdk/test/javax/swing/text/Utilities/bug7045593.java
@@ -23,6 +23,7 @@
 
 /*
  * @test
+ * @key headful
  * @bug 7045593
  * @summary Possible Regression : JTextfield cursor placement behavior algorithm has changed
  * @author Pavel Porvatov
diff --git a/jdk/test/javax/swing/text/View/8014863/bug8014863.java b/jdk/test/javax/swing/text/View/8014863/bug8014863.java
index 892d5aa..9205349 100644
--- a/jdk/test/javax/swing/text/View/8014863/bug8014863.java
+++ b/jdk/test/javax/swing/text/View/8014863/bug8014863.java
@@ -23,6 +23,7 @@
 
 /*
  * @test
+ * @key headful
  * @bug 8014863
  * @bug 8024395
  * @summary  Tests the calculation of the line breaks when a text is inserted
diff --git a/jdk/test/javax/swing/text/View/8048110/bug8048110.java b/jdk/test/javax/swing/text/View/8048110/bug8048110.java
index 85ae357..17d18cb 100644
--- a/jdk/test/javax/swing/text/View/8048110/bug8048110.java
+++ b/jdk/test/javax/swing/text/View/8048110/bug8048110.java
@@ -21,7 +21,9 @@
  * questions.
  */
 
-/* @test
+/*
+ * @test
+ * @key headful
  * @bug 8048110
  * @summary Using tables in JTextPane leads to infinite loop in FlowLayout.layoutRow
  * @author Dmitry Markov
diff --git a/jdk/test/javax/swing/text/html/7189299/bug7189299.java b/jdk/test/javax/swing/text/html/7189299/bug7189299.java
index 609635c..46ec4e5 100644
--- a/jdk/test/javax/swing/text/html/7189299/bug7189299.java
+++ b/jdk/test/javax/swing/text/html/7189299/bug7189299.java
@@ -39,6 +39,7 @@
 
 /*
  * @test
+ * @key headful
  * @bug 8008289
  * @summary Shared ButtonModel instance should deregister previous listeners.
  * @author Frank Ding
diff --git a/jdk/test/javax/swing/text/html/8031109/bug8031109.java b/jdk/test/javax/swing/text/html/8031109/bug8031109.java
index 2288d59..d6e2146 100644
--- a/jdk/test/javax/swing/text/html/8031109/bug8031109.java
+++ b/jdk/test/javax/swing/text/html/8031109/bug8031109.java
@@ -31,6 +31,7 @@
 import javax.swing.text.EditorKit;
 /*
  * @test
+ * @key headful
  * @bug 8031109
  * @author Victor Dyakov
  * @summary  Rendering HTML code in JEditorPane throws NumberFormatException
diff --git a/jdk/test/javax/swing/text/html/8034955/bug8034955.java b/jdk/test/javax/swing/text/html/8034955/bug8034955.java
index 3e7bba2..2d78e41 100644
--- a/jdk/test/javax/swing/text/html/8034955/bug8034955.java
+++ b/jdk/test/javax/swing/text/html/8034955/bug8034955.java
@@ -27,6 +27,7 @@
 
 /**
  * @test
+ * @key headful
  * @bug 8034955
  * @author Alexander Scherbatiy
  * @summary JLabel/JToolTip throw ClassCastException for "<html>a<title>"
diff --git a/jdk/test/javax/swing/text/html/CSS/4530474/bug4530474.java b/jdk/test/javax/swing/text/html/CSS/4530474/bug4530474.java
index 4f23b28..7803f93 100644
--- a/jdk/test/javax/swing/text/html/CSS/4530474/bug4530474.java
+++ b/jdk/test/javax/swing/text/html/CSS/4530474/bug4530474.java
@@ -23,6 +23,7 @@
 
 /*
  * @test
+ * @key headful
  * @bug 4530474
  * @summary  Tests if background-color CSS attribute in HTML font tag in class attribute
  * @author Denis Sharypov
diff --git a/jdk/test/javax/swing/text/html/HTMLDocument/8058120/bug8058120.java b/jdk/test/javax/swing/text/html/HTMLDocument/8058120/bug8058120.java
index 7b5e9a9..0d06d6a 100644
--- a/jdk/test/javax/swing/text/html/HTMLDocument/8058120/bug8058120.java
+++ b/jdk/test/javax/swing/text/html/HTMLDocument/8058120/bug8058120.java
@@ -22,6 +22,7 @@
  */
 
 /* @test
+ * @key headful
  * @bug 8058120
  * @summary Rendering / caret errors with HTMLDocument
  * @author Dmitry Markov
diff --git a/jdk/test/javax/swing/text/html/HTMLEditorKit/4242228/bug4242228.java b/jdk/test/javax/swing/text/html/HTMLEditorKit/4242228/bug4242228.java
index 835990f..b3145e78 100644
--- a/jdk/test/javax/swing/text/html/HTMLEditorKit/4242228/bug4242228.java
+++ b/jdk/test/javax/swing/text/html/HTMLEditorKit/4242228/bug4242228.java
@@ -21,11 +21,13 @@
  * questions.
  */
 
-/* @test
-   @bug 4242228
-   @summary Tests that HTMLEditorKit.setText() doesn't throw exceptions
-   @author Peter Zhelezniakov
-*/
+/*
+ * @test
+ * @key headful
+ * @bug 4242228
+ * @summary Tests that HTMLEditorKit.setText() doesn't throw exceptions
+ * @author Peter Zhelezniakov
+ */
 
 import javax.swing.*;
 import javax.swing.event.ChangeEvent;
diff --git a/jdk/test/javax/swing/text/html/HTMLEditorKit/5043626/bug5043626.java b/jdk/test/javax/swing/text/html/HTMLEditorKit/5043626/bug5043626.java
index de4019c..8184b6a 100644
--- a/jdk/test/javax/swing/text/html/HTMLEditorKit/5043626/bug5043626.java
+++ b/jdk/test/javax/swing/text/html/HTMLEditorKit/5043626/bug5043626.java
@@ -23,6 +23,7 @@
 
 /*
  * @test
+ * @key headful
  * @bug 5043626
  * @summary  Tests pressing Home or Ctrl+Home set cursor to invisible element <head>
  * @author Alexander Potochkin
diff --git a/jdk/test/javax/swing/text/rtf/RTFWriteParagraphAlignTest.java b/jdk/test/javax/swing/text/rtf/RTFWriteParagraphAlignTest.java
index 31b6053..efbd781 100644
--- a/jdk/test/javax/swing/text/rtf/RTFWriteParagraphAlignTest.java
+++ b/jdk/test/javax/swing/text/rtf/RTFWriteParagraphAlignTest.java
@@ -21,11 +21,13 @@
  * questions.
  */
 
-/* @test
-   @bug 8139215
-   @summary RTFEditorKit does not save alignment
-   @author Semyon Sadetsky
-  */
+/*
+ * @test
+ * @key headful
+ * @bug 8139215
+ * @summary RTFEditorKit does not save alignment
+ * @author Semyon Sadetsky
+ */
 
 import javax.swing.*;
 import javax.swing.text.*;
diff --git a/jdk/test/lib/testlibrary/jdk/testlibrary/Platform.java b/jdk/test/lib/testlibrary/jdk/testlibrary/Platform.java
index 523e6e6..635f37f 100644
--- a/jdk/test/lib/testlibrary/jdk/testlibrary/Platform.java
+++ b/jdk/test/lib/testlibrary/jdk/testlibrary/Platform.java
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2013, 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2013, 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
@@ -58,10 +58,6 @@
         return vmName.endsWith(" Minimal VM");
     }
 
-    public static boolean isEmbedded() {
-        return vmName.contains("Embedded");
-    }
-
     public static boolean isTieredSupported() {
         return compiler.contains("Tiered Compilers");
     }
diff --git a/jdk/test/sun/awt/dnd/8024061/bug8024061.java b/jdk/test/sun/awt/dnd/8024061/bug8024061.java
index 98f29ac..e220880 100644
--- a/jdk/test/sun/awt/dnd/8024061/bug8024061.java
+++ b/jdk/test/sun/awt/dnd/8024061/bug8024061.java
@@ -21,7 +21,9 @@
  * questions.
  */
 
-/* @test
+/*
+ * @test
+ * @key headful
  * @bug 8024061
  * @summary Checks that no exception is thrown if dragGestureRecognized
  *          takes a while to complete.
diff --git a/jdk/test/sun/awt/image/OffScreenImageSource/ImageConsumerUnregisterTest.java b/jdk/test/sun/awt/image/OffScreenImageSource/ImageConsumerUnregisterTest.java
index 888f138..51bb420 100644
--- a/jdk/test/sun/awt/image/OffScreenImageSource/ImageConsumerUnregisterTest.java
+++ b/jdk/test/sun/awt/image/OffScreenImageSource/ImageConsumerUnregisterTest.java
@@ -22,7 +22,7 @@
  */
 
 /* @test
- * @bug 8160421
+ * @bug 8160421 8161902
  * @summary Test to check OffScreenImageSource handles case where
  *          imageComplete(ImageConsumer.SINGLEFRAMEDONE) unregisters.
  * @run main/othervm ImageConsumerUnregisterTest
@@ -35,7 +35,7 @@
 
     public static void main(String[] args) throws Exception {
 
-        final java.awt.Component component = new TestBug8160421();
+        final java.awt.Component component = new ImageConsumerUnregisterTest();
 
         // Redirect the System.err stream and verify there is no
         // stacktrace printed
@@ -59,7 +59,8 @@
             System.setErr(obj);
 
             if (!str.isEmpty()) {
-                throw new RuntimeException("Invalid imageComplete(STATICIMAGEDONE) call");
+                throw new RuntimeException("Invalid"
+                        + " imageComplete(STATICIMAGEDONE) call");
             }
         }
     }
diff --git a/jdk/test/sun/java2d/ClassCastExceptionForInvalidSurface.java b/jdk/test/sun/java2d/ClassCastExceptionForInvalidSurface.java
index 956815e..5018ed9 100644
--- a/jdk/test/sun/java2d/ClassCastExceptionForInvalidSurface.java
+++ b/jdk/test/sun/java2d/ClassCastExceptionForInvalidSurface.java
@@ -40,6 +40,7 @@
 
 /**
  * @test
+ * @key headful
  * @bug 8158072 7172749
  */
 public final class ClassCastExceptionForInvalidSurface {
diff --git a/jdk/test/sun/java2d/Disposer/TestDisposerLeak.java b/jdk/test/sun/java2d/Disposer/TestDisposerLeak.java
index 4eb9575..0fcf8cd 100644
--- a/jdk/test/sun/java2d/Disposer/TestDisposerLeak.java
+++ b/jdk/test/sun/java2d/Disposer/TestDisposerLeak.java
@@ -31,7 +31,7 @@
  * @test
  * @bug 8129457
  * @summary Check Disposer disposes all objects without any memory leaks
- * @run main/othervm TestDisposerLeak
+ * @run main/othervm -mx128m TestDisposerLeak
  * @modules java.desktop/sun.java2d
  */
 public final class TestDisposerLeak {
diff --git a/jdk/test/sun/java2d/SunGraphics2D/SourceClippingBlitTest/SourceClippingBlitTest.java b/jdk/test/sun/java2d/SunGraphics2D/SourceClippingBlitTest/SourceClippingBlitTest.java
index 6dcfe8a..25f1950 100644
--- a/jdk/test/sun/java2d/SunGraphics2D/SourceClippingBlitTest/SourceClippingBlitTest.java
+++ b/jdk/test/sun/java2d/SunGraphics2D/SourceClippingBlitTest/SourceClippingBlitTest.java
@@ -23,6 +23,7 @@
 
 /*
   @test
+  @key headful
   @bug 6244574
   @bug 6258142
   @bug 6395165
diff --git a/jdk/test/sun/java2d/X11SurfaceData/SharedMemoryPixmapsTest/SharedMemoryPixmapsTest.sh b/jdk/test/sun/java2d/X11SurfaceData/SharedMemoryPixmapsTest/SharedMemoryPixmapsTest.sh
index 103b702..f383db7 100644
--- a/jdk/test/sun/java2d/X11SurfaceData/SharedMemoryPixmapsTest/SharedMemoryPixmapsTest.sh
+++ b/jdk/test/sun/java2d/X11SurfaceData/SharedMemoryPixmapsTest/SharedMemoryPixmapsTest.sh
@@ -23,6 +23,7 @@
 #
 
 # @test
+# @key headful
 # @bug 6363434 6588884
 # @summary Verify that shared memory pixmaps are not broken
 # by filling a VolatileImage with red color and copying it
diff --git a/jdk/test/sun/misc/Safe.java b/jdk/test/sun/misc/GetSunMiscUnsafe.java
similarity index 89%
rename from jdk/test/sun/misc/Safe.java
rename to jdk/test/sun/misc/GetSunMiscUnsafe.java
index c499a0a..44ac2f7 100644
--- a/jdk/test/sun/misc/Safe.java
+++ b/jdk/test/sun/misc/GetSunMiscUnsafe.java
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2001, 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
@@ -29,12 +29,12 @@
  */
 
 
-public class Safe {
+public class GetSunMiscUnsafe {
 
     public static void main(String[] args) throws Exception {
         try {
             sun.misc.Unsafe.getUnsafe();
-        } catch (Exception x) {
+        } catch (SecurityException x) {
             System.err.println("Thrown as expected: " + x);
             return;
         }
diff --git a/jdk/test/sun/net/www/protocol/http/HttpInputStream.java b/jdk/test/sun/net/www/protocol/http/HttpInputStream.java
index 413f55a..d9478ca 100644
--- a/jdk/test/sun/net/www/protocol/http/HttpInputStream.java
+++ b/jdk/test/sun/net/www/protocol/http/HttpInputStream.java
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2003, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2003, 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
@@ -23,77 +23,95 @@
 
 /* @test
  * @bug 4937598
- * @summary http://www.clipstream.com vedio does not play; read() problem
+ * @summary http://www.clipstream.com video does not play; read() problem
  */
-import java.util.*;
-import java.io.*;
-import java.net.*;
-import java.text.*;
-
-public class HttpInputStream implements Runnable {
-
-  ServerSocket serverSock;
-
-  public void run() {
-      try {
-          Socket s = serverSock.accept();
-          InputStream in = s.getInputStream();
-          byte b[] = new byte[4096];
-
-          // assume we read the entire http request
-          // (bad assumption but okay for test case)
-          int nread = in.read(b);
-
-          OutputStream o = s.getOutputStream();
-
-          o.write( "HTTP/1.1 200 OK".getBytes() );
-          o.write( "Content-Length: 20".getBytes() );
-          o.write( (byte)'\r' );
-          o.write( (byte)'\n' );
-          o.write( (byte)'\r' );
-          o.write( (byte)'\n' );
-
-          for (int i = 0; i < 20; i++) {
-              o.write((byte)0xff);
-          }
-
-          o.flush();
-          o.close();
-
-      } catch (Exception e) { }
-  }
 
 
-  public HttpInputStream() throws Exception {
+import java.io.IOException;
+import java.io.InputStream;
+import java.io.OutputStream;
+import java.net.ServerSocket;
+import java.net.Socket;
+import java.net.URL;
 
-     serverSock = new ServerSocket(0);
-     int port = serverSock.getLocalPort();
+public class HttpInputStream {
 
-     Thread thr = new Thread(this);
-     thr.start();
+    private static final int CONTENT_LENGTH = 20;
 
-     Date date = new Date(new Date().getTime()-1440000); // this time yesterday
-     URL url;
-     HttpURLConnection con;
+    static class Server implements AutoCloseable, Runnable {
 
-     url = new URL("http://localhost:" + String.valueOf(port) +
-                   "/anything");
-     con = (HttpURLConnection)url.openConnection();
+        final ServerSocket serverSocket;
+        static final byte[] requestEnd = new byte[]{'\r', '\n', '\r', '\n'};
+        static final int TIMEOUT = 10 * 1000;
 
-     int ret = con.getResponseCode();
-     byte[] b = new byte[20];
-     InputStream is = con.getInputStream();
-     int i = 0, count = 0;
-     while ((i = is.read()) != -1) {
-         System.out.println("i = "+i);
-         count++;
-     }
-     if (count != 20) {
-         throw new RuntimeException("HttpInputStream.read() failed with 0xff");
-     }
-  }
+        Server() throws IOException {
+            serverSocket = new ServerSocket(0);
+        }
 
-  public static void main(String args[]) throws Exception {
-      new HttpInputStream();
-  }
+        void readOneRequest(InputStream is) throws IOException {
+            int requestEndCount = 0, r;
+            while ((r = is.read()) != -1) {
+                if (r == requestEnd[requestEndCount]) {
+                    requestEndCount++;
+                    if (requestEndCount == 4) {
+                        break;
+                    }
+                } else {
+                    requestEndCount = 0;
+                }
+            }
+        }
+
+        @Override
+        public void run() {
+            try (Socket s = serverSocket.accept()) {
+                s.setSoTimeout(TIMEOUT);
+                readOneRequest(s.getInputStream());
+                try (OutputStream os =
+                             s.getOutputStream()) {
+                    os.write("HTTP/1.1 200 OK".getBytes());
+                    os.write(("Content-Length: " + CONTENT_LENGTH).getBytes());
+                    os.write("\r\n\r\n".getBytes());
+                    for (int i = 0; i < CONTENT_LENGTH; i++) {
+                        os.write(0xff);
+                    }
+                    os.flush();
+                }
+            } catch (IOException e) {
+                e.printStackTrace();
+            }
+        }
+
+        @Override
+        public void close() throws IOException {
+            if (!serverSocket.isClosed()) {
+                serverSocket.close();
+            }
+        }
+
+        public int getPort() {
+            return serverSocket.getLocalPort();
+        }
+    }
+
+
+    private static int read(InputStream is) throws IOException {
+        int len = 0;
+        while (is.read() != -1) {
+            len++;
+        }
+        return len;
+    }
+
+    public static void main(String args[]) throws IOException {
+        try (Server server = new Server()) {
+            (new Thread(server)).start();
+            URL url = new URL("http://localhost:" + server.getPort() + "/anything");
+            try (InputStream is = url.openConnection().getInputStream()) {
+                if (read(is) != CONTENT_LENGTH) {
+                    throw new RuntimeException("HttpInputStream.read() failed with 0xff");
+                }
+            }
+        }
+    }
 }
diff --git a/jdk/test/sun/security/pkcs11/rsa/TestKeyPairGenerator.java b/jdk/test/sun/security/pkcs11/rsa/TestKeyPairGenerator.java
index 8be0750..dd60d40 100644
--- a/jdk/test/sun/security/pkcs11/rsa/TestKeyPairGenerator.java
+++ b/jdk/test/sun/security/pkcs11/rsa/TestKeyPairGenerator.java
@@ -32,7 +32,7 @@
  * @run main/othervm -Djava.security.debug=sunpkcs11 TestKeyPairGenerator
  * @run main/othervm -Djava.security.debug=sunpkcs11 TestKeyPairGenerator
  *                                                   sm TestKeyPairGenerator.policy
- * @key intermittent randomness
+ * @key randomness
  */
 
 import java.math.BigInteger;
diff --git a/jdk/test/sun/tools/jhsdb/BasicLauncherTest.java b/jdk/test/sun/tools/jhsdb/BasicLauncherTest.java
index 04701af..4125dbf 100644
--- a/jdk/test/sun/tools/jhsdb/BasicLauncherTest.java
+++ b/jdk/test/sun/tools/jhsdb/BasicLauncherTest.java
@@ -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
@@ -182,6 +182,7 @@
 
         launchCLHSDB();
 
+        launch("compiler detected", "jmap", "--clstats");
         launchNotOSX("No deadlocks found", "jstack");
         launch("compiler detected", "jmap");
         launch("Java System Properties", "jinfo");
diff --git a/jdk/test/tools/jlink/IntegrationTest.java b/jdk/test/tools/jlink/IntegrationTest.java
index 48d4457..ad0a01b 100644
--- a/jdk/test/tools/jlink/IntegrationTest.java
+++ b/jdk/test/tools/jlink/IntegrationTest.java
@@ -22,6 +22,7 @@
  */
 
 import java.io.File;
+import java.io.FileReader;
 import java.io.IOException;
 import java.io.UncheckedIOException;
 import java.nio.file.Files;
@@ -33,6 +34,7 @@
 import java.util.HashSet;
 import java.util.List;
 import java.util.Map;
+import java.util.Properties;
 import java.util.Set;
 import java.util.function.Function;
 import jdk.tools.jlink.Jlink;
@@ -203,6 +205,27 @@
             throw new AssertionError("release not generated");
         }
 
+        Properties props = new Properties();
+        try (FileReader reader = new FileReader(release)) {
+            props.load(reader);
+        }
+
+        if (props.getProperty("JAVA_VERSION") == null) {
+            throw new AssertionError("release file does not contain JAVA_VERSION");
+        }
+
+        if (props.getProperty("OS_NAME") == null) {
+            throw new AssertionError("release file does not contain OS_NAME");
+        }
+
+        if (props.getProperty("OS_ARCH") == null) {
+            throw new AssertionError("release file does not contain OS_ARCH");
+        }
+
+        if (props.getProperty("OS_VERSION") == null) {
+            throw new AssertionError("release file does not contain OS_VERSION");
+        }
+
         if (!Files.exists(output.resolve("toto.txt"))) {
             throw new AssertionError("Post processing not called");
         }
diff --git a/jdk/test/tools/jlink/JLinkTest.java b/jdk/test/tools/jlink/JLinkTest.java
index bf1a31d..189be84 100644
--- a/jdk/test/tools/jlink/JLinkTest.java
+++ b/jdk/test/tools/jlink/JLinkTest.java
@@ -131,6 +131,25 @@
         }
 
         {
+            String moduleName = "m"; // 8163382
+            Path jmod = helper.generateDefaultJModule(moduleName).assertSuccess();
+            JImageGenerator.getJLinkTask()
+                    .modulePath(helper.defaultModulePath())
+                    .output(helper.createNewImageDir(moduleName))
+                    .addMods("m")
+                    .option("")
+                    .call().assertSuccess();
+            moduleName = "mod";
+            jmod = helper.generateDefaultJModule(moduleName).assertSuccess();
+            JImageGenerator.getJLinkTask()
+                    .modulePath(helper.defaultModulePath())
+                    .output(helper.createNewImageDir(moduleName))
+                    .addMods("m")
+                    .option("")
+                    .call().assertSuccess();
+        }
+
+        {
             // Help
             StringWriter writer = new StringWriter();
             jdk.tools.jlink.internal.Main.run(new String[]{"--help"}, new PrintWriter(writer));
diff --git a/jdk/test/tools/jlink/plugins/ExcludeVMPluginTest.java b/jdk/test/tools/jlink/plugins/ExcludeVMPluginTest.java
index 77febda..48947c1 100644
--- a/jdk/test/tools/jlink/plugins/ExcludeVMPluginTest.java
+++ b/jdk/test/tools/jlink/plugins/ExcludeVMPluginTest.java
@@ -30,6 +30,9 @@
  * @run main ExcludeVMPluginTest
  */
 import java.io.ByteArrayInputStream;
+import java.net.URI;
+import java.nio.file.Path;
+import java.nio.file.Paths;
 import java.util.HashMap;
 import java.util.Map;
 import jdk.tools.jlink.internal.ResourcePoolManager;
@@ -167,6 +170,13 @@
         poolMgr.add(
             ResourcePoolEntry.create("/java.base/native/jvm.cfg",
                 ResourcePoolEntry.Type.NATIVE_LIB, jvmcfgContent));
+
+        // java.base/module-info.class is used by exclude vm plugin
+        // to get current osName(). We read it from jrt-fs and add a
+        // ResourcePoolEntry
+        poolMgr.add(
+            ResourcePoolEntry.create("/java.base/module-info.class",
+                ResourcePoolEntry.Type.CLASS_OR_RESOURCE, getJavaBaseModuleInfo()));
         for (String in : input) {
             poolMgr.add(ResourcePoolEntry.create(in,
                     ResourcePoolEntry.Type.NATIVE_LIB, new byte[0]));
@@ -187,15 +197,19 @@
             throw new Exception("Got content " + newContent + " expected " + expectdJvmCfg);
         }
 
-        if (out.entryCount() != (expectedOutput.length + 1)) {
+        // Apart from native resources, we should find jvm.cfg and
+        // java.base/module-info.class. So, we add 2 here to the
+        // expected count!
+        if (out.entryCount() != (expectedOutput.length + 2)) {
             out.entries().forEach(m -> {
                 System.err.println(m.path());
             });
-            throw new Exception("Invalid output size " + out.entryCount() + " expected " + (expectedOutput.length + 1));
+            throw new Exception("Invalid output size " + out.entryCount() + " expected " + (expectedOutput.length + 2));
         }
 
         out.entries().forEach(md -> {
-            if (md.path().equals("/java.base/native/jvm.cfg")) {
+            if (md.path().equals("/java.base/native/jvm.cfg") ||
+                md.path().equals("/java.base/module-info.class")) {
                 return;
             }
             boolean contained = false;
@@ -209,7 +223,11 @@
                 throw new RuntimeException(md.path() + " not expected");
             }
         });
+    }
 
+    // read java.base/module-info.class from jrt-fs
+    private static Path getJavaBaseModuleInfo() {
+        return Paths.get(URI.create("jrt:/modules/java.base/module-info.class"));
     }
 
     private static boolean isWindows() {
diff --git a/jdk/test/tools/jlink/plugins/FileCopierPluginTest.java b/jdk/test/tools/jlink/plugins/FileCopierPluginTest.java
index 4f064fb..712f987 100644
--- a/jdk/test/tools/jlink/plugins/FileCopierPluginTest.java
+++ b/jdk/test/tools/jlink/plugins/FileCopierPluginTest.java
@@ -32,8 +32,10 @@
  */
 
 import java.io.File;
+import java.net.URI;
 import java.nio.file.Files;
 import java.nio.file.Path;
+import java.nio.file.Paths;
 import java.util.Collections;
 import java.util.HashMap;
 import java.util.Map;
@@ -41,6 +43,7 @@
 import jdk.tools.jlink.builder.DefaultImageBuilder;
 
 import jdk.tools.jlink.internal.plugins.FileCopierPlugin;
+import jdk.tools.jlink.plugin.PluginException;
 import jdk.tools.jlink.plugin.ResourcePoolEntry;
 import jdk.tools.jlink.plugin.ResourcePool;
 
@@ -86,6 +89,12 @@
         conf.put(FileCopierPlugin.NAME, builder.toString());
         plug.configure(conf);
         ResourcePoolManager poolMgr = new ResourcePoolManager();
+        // java.base/module-info.class is used to add "release" file
+        // We read it from jrt-fs and add a ResourcePoolEntry
+        poolMgr.add(
+            ResourcePoolEntry.create("/java.base/module-info.class",
+                ResourcePoolEntry.Type.CLASS_OR_RESOURCE, getJavaBaseModuleInfo()));
+        expected++;
         ResourcePool pool = plug.transform(
                 new ResourcePoolManager().resourcePool(),
                 poolMgr.resourcePoolBuilder());
@@ -93,7 +102,8 @@
             throw new AssertionError("Wrong number of added files");
         }
         pool.entries().forEach(f -> {
-            if (!f.type().equals(ResourcePoolEntry.Type.OTHER)) {
+            if (!f.type().equals(ResourcePoolEntry.Type.OTHER) &&
+                !f.type().equals(ResourcePoolEntry.Type.CLASS_OR_RESOURCE)) {
                 throw new AssertionError("Invalid type " + f.type()
                         + " for file " + f.path());
             }
@@ -145,4 +155,9 @@
             throw new AssertionError("Invalid Content in src2 dir");
         }
     }
+
+    // read java.base/module-info.class from jrt-fs
+    private static Path getJavaBaseModuleInfo() {
+        return Paths.get(URI.create("jrt:/modules/java.base/module-info.class"));
+    }
 }
diff --git a/jdk/test/tools/launcher/VersionCheck.java b/jdk/test/tools/launcher/VersionCheck.java
index ebad0a5..10fce97 100644
--- a/jdk/test/tools/launcher/VersionCheck.java
+++ b/jdk/test/tools/launcher/VersionCheck.java
@@ -93,7 +93,6 @@
         "jps",
         "jrunscript",
         "jjs",
-        "jsadebugd",
         "jstack",
         "jstat",
         "jstatd",
diff --git a/langtools/.hgtags b/langtools/.hgtags
index 620edb5..c950141 100644
--- a/langtools/.hgtags
+++ b/langtools/.hgtags
@@ -372,3 +372,4 @@
 a42768b48cb0c5af9063e12093975baeeca3b5fa jdk-9+127
 2764986661b6d339ba73af52d69d3506ce12e648 jdk-9+128
 e181909291981038b041ed4d22714c4760e049cd jdk-9+129
+3665ebc22a42c8f33777ee025ba0e300e6086a8c jdk-9+130
diff --git a/langtools/make/gensrc/GensrcCommon.gmk b/langtools/make/gensrc/GensrcCommon.gmk
index 3b72d56..09879df 100644
--- a/langtools/make/gensrc/GensrcCommon.gmk
+++ b/langtools/make/gensrc/GensrcCommon.gmk
@@ -117,7 +117,7 @@
     $$(addprefix _SPACE_, $$(PARSEPROPALLDIRS))))
 
   # Now setup the rule for the generation of the resource bundles.
-  $(SUPPORT_OUTPUTDIR)/gensrc/$(MODULE)/_the_parsed_props: $(PARSEPROPSOURCES)
+  $(SUPPORT_OUTPUTDIR)/gensrc/$(MODULE)/_the_parsed_props: $$(PARSEPROPSOURCES)
 	$(MKDIR) -p $$(@D) $$(PARSEPROPDIRS)
 	$(FIND) $$(@D) -name "*Properties.java" $(FIND_DELETE)
 	$(ECHO) Parsing $$(words $$(PARSEPROPSOURCES)) properties into enum-like class for $(MODULE)
diff --git a/langtools/src/jdk.compiler/share/classes/com/sun/tools/javac/api/JavacTool.java b/langtools/src/jdk.compiler/share/classes/com/sun/tools/javac/api/JavacTool.java
index ed412ec..fba01f1 100644
--- a/langtools/src/jdk.compiler/share/classes/com/sun/tools/javac/api/JavacTool.java
+++ b/langtools/src/jdk.compiler/share/classes/com/sun/tools/javac/api/JavacTool.java
@@ -97,7 +97,7 @@
         PrintWriter pw = (charset == null)
                 ? new PrintWriter(System.err, true)
                 : new PrintWriter(new OutputStreamWriter(System.err, charset), true);
-        context.put(Log.outKey, pw);
+        context.put(Log.errKey, pw);
         CacheFSInfo.preRegister(context);
         return new JavacFileManager(context, true, charset);
     }
@@ -161,9 +161,9 @@
                 context.put(DiagnosticListener.class, ccw.wrap(diagnosticListener));
 
             if (out == null)
-                context.put(Log.outKey, new PrintWriter(System.err, true));
+                context.put(Log.errKey, new PrintWriter(System.err, true));
             else
-                context.put(Log.outKey, new PrintWriter(out, true));
+                context.put(Log.errKey, new PrintWriter(out, true));
 
             if (fileManager == null) {
                 fileManager = getStandardFileManager(diagnosticListener, null, null);
diff --git a/langtools/src/jdk.compiler/share/classes/com/sun/tools/javac/code/Scope.java b/langtools/src/jdk.compiler/share/classes/com/sun/tools/javac/code/Scope.java
index 87ef700..fbdb07e 100644
--- a/langtools/src/jdk.compiler/share/classes/com/sun/tools/javac/code/Scope.java
+++ b/langtools/src/jdk.compiler/share/classes/com/sun/tools/javac/code/Scope.java
@@ -296,6 +296,8 @@
          */
         int nelems = 0;
 
+        int removeCount = 0;
+
         /** Use as a "not-found" result for lookup.
          * Also used to mark deleted entries in the table.
          */
@@ -474,6 +476,8 @@
                 te = te.sibling;
             }
 
+            removeCount++;
+
             //notify listeners
             listeners.symbolRemoved(sym, this);
         }
@@ -569,15 +573,29 @@
                     return new Iterator<Symbol>() {
                         private ScopeImpl currScope = ScopeImpl.this;
                         private Scope.Entry currEntry = elems;
+                        private int seenRemoveCount = currScope.removeCount;
                         {
                             update();
                         }
 
                         public boolean hasNext() {
+                            if (seenRemoveCount != currScope.removeCount &&
+                                currEntry != null &&
+                                !currEntry.scope.includes(currEntry.sym)) {
+                                doNext(); //skip entry that is no longer in the Scope
+                                seenRemoveCount = currScope.removeCount;
+                            }
                             return currEntry != null;
                         }
 
                         public Symbol next() {
+                            if (!hasNext()) {
+                                throw new NoSuchElementException();
+                            }
+
+                            return doNext();
+                        }
+                        private Symbol doNext() {
                             Symbol sym = (currEntry == null ? null : currEntry.sym);
                             if (currEntry != null) {
                                 currEntry = currEntry.sibling;
@@ -596,6 +614,7 @@
                                 while (currEntry == null && currScope.next != null) {
                                     currScope = currScope.next;
                                     currEntry = currScope.elems;
+                                    seenRemoveCount = currScope.removeCount;
                                     skipToNextMatchingEntry();
                                 }
                             }
@@ -618,13 +637,26 @@
                 public Iterator<Symbol> iterator() {
                      return new Iterator<Symbol>() {
                         Scope.Entry currentEntry = lookup(name, sf);
+                        int seenRemoveCount = currentEntry.scope != null ?
+                                currentEntry.scope.removeCount : -1;
 
                         public boolean hasNext() {
+                            if (currentEntry.scope != null &&
+                                seenRemoveCount != currentEntry.scope.removeCount &&
+                                !currentEntry.scope.includes(currentEntry.sym)) {
+                                doNext(); //skip entry that is no longer in the Scope
+                            }
                             return currentEntry.scope != null &&
                                     (lookupKind == RECURSIVE ||
                                      currentEntry.scope == ScopeImpl.this);
                         }
                         public Symbol next() {
+                            if (!hasNext()) {
+                                throw new NoSuchElementException();
+                            }
+                            return doNext();
+                        }
+                        private Symbol doNext() {
                             Scope.Entry prevEntry = currentEntry;
                             currentEntry = currentEntry.next(sf);
                             return prevEntry.sym;
@@ -686,9 +718,9 @@
         /** The entry's scope.
          *  scope == null   iff   this == sentinel
          */
-        public Scope scope;
+        public ScopeImpl scope;
 
-        public Entry(Symbol sym, Entry shadowed, Entry sibling, Scope scope) {
+        public Entry(Symbol sym, Entry shadowed, Entry sibling, ScopeImpl scope) {
             this.sym = sym;
             this.shadowed = shadowed;
             this.sibling = sibling;
diff --git a/langtools/src/jdk.compiler/share/classes/com/sun/tools/javac/comp/Lower.java b/langtools/src/jdk.compiler/share/classes/com/sun/tools/javac/comp/Lower.java
index f3dae95..f06a238 100644
--- a/langtools/src/jdk.compiler/share/classes/com/sun/tools/javac/comp/Lower.java
+++ b/langtools/src/jdk.compiler/share/classes/com/sun/tools/javac/comp/Lower.java
@@ -52,6 +52,7 @@
 import static com.sun.tools.javac.code.Kinds.Kind.*;
 import static com.sun.tools.javac.code.Symbol.OperatorSymbol.AccessCode.DEREF;
 import static com.sun.tools.javac.jvm.ByteCodes.*;
+import static com.sun.tools.javac.tree.JCTree.JCOperatorExpression.OperandPos.LEFT;
 import static com.sun.tools.javac.tree.JCTree.Tag.*;
 
 /** This pass translates away some syntactic sugar: inner classes,
@@ -850,12 +851,9 @@
         else if (enclOp.hasTag(ASSIGN) &&
                  tree == TreeInfo.skipParens(((JCAssign) enclOp).lhs))
             return AccessCode.ASSIGN.code;
-        else if (enclOp.getTag().isIncOrDecUnaryOp() &&
-                 tree == TreeInfo.skipParens(((JCUnary) enclOp).arg))
-            return (((JCUnary) enclOp).operator).getAccessCode(enclOp.getTag());
-        else if (enclOp.getTag().isAssignop() &&
-                 tree == TreeInfo.skipParens(((JCAssignOp) enclOp).lhs))
-            return (((JCAssignOp) enclOp).operator).getAccessCode(enclOp.getTag());
+        else if ((enclOp.getTag().isIncOrDecUnaryOp() || enclOp.getTag().isAssignop()) &&
+                tree == TreeInfo.skipParens(((JCOperatorExpression) enclOp).getOperand(LEFT)))
+            return (((JCOperatorExpression) enclOp).operator).getAccessCode(enclOp.getTag());
         else
             return AccessCode.DEREF.code;
     }
diff --git a/langtools/src/jdk.compiler/share/classes/com/sun/tools/javac/main/Main.java b/langtools/src/jdk.compiler/share/classes/com/sun/tools/javac/main/Main.java
index e65b436..b4bd026 100644
--- a/langtools/src/jdk.compiler/share/classes/com/sun/tools/javac/main/Main.java
+++ b/langtools/src/jdk.compiler/share/classes/com/sun/tools/javac/main/Main.java
@@ -62,9 +62,13 @@
      */
     String ownName;
 
+    /** The writer to use for normal output.
+     */
+    PrintWriter stdOut;
+
     /** The writer to use for diagnostic output.
      */
-    PrintWriter out;
+    PrintWriter stdErr;
 
     /** The log to use for diagnostic output.
      */
@@ -102,7 +106,7 @@
      * @param name the name of this tool
      */
     public Main(String name) {
-        this(name, new PrintWriter(System.err, true));
+        this.ownName = name;
     }
 
     /**
@@ -112,7 +116,7 @@
      */
     public Main(String name, PrintWriter out) {
         this.ownName = name;
-        this.out = out;
+        this.stdOut = this.stdErr = out;
     }
 
     /** Report a usage error.
@@ -161,7 +165,14 @@
      * @return the result of the compilation
      */
     public Result compile(String[] argv, Context context) {
-        context.put(Log.outKey, out);
+        if (stdOut != null) {
+            context.put(Log.outKey, stdOut);
+        }
+
+        if (stdErr != null) {
+            context.put(Log.errKey, stdErr);
+        }
+
         log = Log.instance(context);
 
         if (argv.length == 0) {
diff --git a/langtools/src/jdk.compiler/share/classes/com/sun/tools/javac/main/Option.java b/langtools/src/jdk.compiler/share/classes/com/sun/tools/javac/main/Option.java
index 155097a..2ac078f 100644
--- a/langtools/src/jdk.compiler/share/classes/com/sun/tools/javac/main/Option.java
+++ b/langtools/src/jdk.compiler/share/classes/com/sun/tools/javac/main/Option.java
@@ -96,23 +96,23 @@
             if (this.kind != kind)
                 return;
 
-            log.printRawLines(WriterKind.NOTICE,
+            log.printRawLines(WriterKind.STDOUT,
                               String.format(HELP_LINE_FORMAT,
                                             log.localize(PrefixKind.JAVAC, "opt.Xlint.subopts"),
                                             log.localize(PrefixKind.JAVAC, "opt.Xlint.suboptlist")));
-            log.printRawLines(WriterKind.NOTICE,
+            log.printRawLines(WriterKind.STDOUT,
                               String.format(LINT_KEY_FORMAT,
                                             "all",
                                             log.localize(PrefixKind.JAVAC, "opt.Xlint.all")));
             for (LintCategory lc : LintCategory.values()) {
                 if (lc.hidden) continue;
-                log.printRawLines(WriterKind.NOTICE,
+                log.printRawLines(WriterKind.STDOUT,
                                   String.format(LINT_KEY_FORMAT,
                                                 lc.option,
                                                 log.localize(PrefixKind.JAVAC,
                                                              "opt.Xlint.desc." + lc.option)));
             }
-            log.printRawLines(WriterKind.NOTICE,
+            log.printRawLines(WriterKind.STDOUT,
                               String.format(LINT_KEY_FORMAT,
                                             "none",
                                             log.localize(PrefixKind.JAVAC, "opt.Xlint.none")));
@@ -307,7 +307,7 @@
                 delim = ", ";
             }
 
-            log.printRawLines(WriterKind.NOTICE,
+            log.printRawLines(WriterKind.STDOUT,
                     String.format(HELP_LINE_FORMAT,
                         super.helpSynopsis(log),
                         log.localize(PrefixKind.JAVAC, descrKey, targets.toString())));
@@ -331,7 +331,7 @@
         public boolean process(OptionHelper helper, String option) {
             Log log = helper.getLog();
             String ownName = helper.getOwnName();
-            log.printLines(PrefixKind.JAVAC, "version", ownName,  JavaCompiler.version());
+            log.printLines(WriterKind.STDOUT, PrefixKind.JAVAC, "version", ownName,  JavaCompiler.version());
             return super.process(helper, option);
         }
     },
@@ -341,7 +341,7 @@
         public boolean process(OptionHelper helper, String option) {
             Log log = helper.getLog();
             String ownName = helper.getOwnName();
-            log.printLines(PrefixKind.JAVAC, "fullVersion", ownName,  JavaCompiler.fullVersion());
+            log.printLines(WriterKind.STDOUT, PrefixKind.JAVAC, "fullVersion", ownName,  JavaCompiler.fullVersion());
             return super.process(helper, option);
         }
     },
@@ -351,11 +351,11 @@
         public boolean process(OptionHelper helper, String option) {
             Log log = helper.getLog();
             String ownName = helper.getOwnName();
-            log.printLines(PrefixKind.JAVAC, "msg.usage.header", ownName);
+            log.printLines(WriterKind.STDOUT, PrefixKind.JAVAC, "msg.usage.header", ownName);
             for (Option o: getJavaCompilerOptions()) {
                 o.help(log, OptionKind.STANDARD);
             }
-            log.printNewline();
+            log.printNewline(WriterKind.STDOUT);
             return super.process(helper, option);
         }
     },
@@ -396,8 +396,8 @@
             for (Option o: getJavaCompilerOptions()) {
                 o.help(log, OptionKind.EXTENDED);
             }
-            log.printNewline();
-            log.printLines(PrefixKind.JAVAC, "msg.usage.nonstandard.footer");
+            log.printNewline(WriterKind.STDOUT);
+            log.printLines(WriterKind.STDOUT, PrefixKind.JAVAC, "msg.usage.nonstandard.footer");
             return super.process(helper, option);
         }
     },
@@ -840,7 +840,7 @@
         if (this.kind != kind)
             return;
 
-        log.printRawLines(WriterKind.NOTICE,
+        log.printRawLines(WriterKind.STDOUT,
                 String.format(HELP_LINE_FORMAT,
                     helpSynopsis(log),
                     log.localize(PrefixKind.JAVAC, descrKey)));
diff --git a/langtools/src/jdk.compiler/share/classes/com/sun/tools/javac/processing/JavacFiler.java b/langtools/src/jdk.compiler/share/classes/com/sun/tools/javac/processing/JavacFiler.java
index 8749bc5..6d38668 100644
--- a/langtools/src/jdk.compiler/share/classes/com/sun/tools/javac/processing/JavacFiler.java
+++ b/langtools/src/jdk.compiler/share/classes/com/sun/tools/javac/processing/JavacFiler.java
@@ -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
@@ -604,7 +604,7 @@
      * Debugging function to display internal state.
      */
     public void displayState() {
-        PrintWriter xout = context.get(Log.outKey);
+        PrintWriter xout = context.get(Log.logKey).getWriter(Log.WriterKind.STDERR);
         xout.println("File Object History : " +  fileObjectHistory);
         xout.println("Open Type Names     : " +  openTypeNames);
         xout.println("Gen. Src Names      : " +  generatedSourceNames);
diff --git a/langtools/src/jdk.compiler/share/classes/com/sun/tools/javac/processing/JavacProcessingEnvironment.java b/langtools/src/jdk.compiler/share/classes/com/sun/tools/javac/processing/JavacProcessingEnvironment.java
index e8ba1d8..f8107a5 100644
--- a/langtools/src/jdk.compiler/share/classes/com/sun/tools/javac/processing/JavacProcessingEnvironment.java
+++ b/langtools/src/jdk.compiler/share/classes/com/sun/tools/javac/processing/JavacProcessingEnvironment.java
@@ -26,12 +26,10 @@
 package com.sun.tools.javac.processing;
 
 import java.io.Closeable;
-import java.io.File;
 import java.io.IOException;
 import java.io.PrintWriter;
 import java.io.StringWriter;
 import java.lang.reflect.Method;
-import java.lang.reflect.Constructor;
 import java.net.MalformedURLException;
 import java.net.URL;
 import java.nio.file.Path;
diff --git a/langtools/src/jdk.compiler/share/classes/com/sun/tools/javac/tree/JCTree.java b/langtools/src/jdk.compiler/share/classes/com/sun/tools/javac/tree/JCTree.java
index d8cccd8..58f6296 100644
--- a/langtools/src/jdk.compiler/share/classes/com/sun/tools/javac/tree/JCTree.java
+++ b/langtools/src/jdk.compiler/share/classes/com/sun/tools/javac/tree/JCTree.java
@@ -1869,14 +1869,33 @@
         }
     }
 
+    public static abstract class JCOperatorExpression extends JCExpression {
+        public enum OperandPos {
+            LEFT,
+            RIGHT
+        }
+
+        protected Tag opcode;
+        public OperatorSymbol operator;
+
+        public OperatorSymbol getOperator() {
+            return operator;
+        }
+
+        @Override
+        public Tag getTag() {
+            return opcode;
+        }
+
+        public abstract JCExpression getOperand(OperandPos pos);
+    }
+
     /**
      * An assignment with "+=", "|=" ...
      */
-    public static class JCAssignOp extends JCExpression implements CompoundAssignmentTree {
-        private Tag opcode;
+    public static class JCAssignOp extends JCOperatorExpression implements CompoundAssignmentTree {
         public JCExpression lhs;
         public JCExpression rhs;
-        public OperatorSymbol operator;
         protected JCAssignOp(Tag opcode, JCTree lhs, JCTree rhs, OperatorSymbol operator) {
             this.opcode = opcode;
             this.lhs = (JCExpression)lhs;
@@ -1892,26 +1911,21 @@
         public JCExpression getVariable() { return lhs; }
         @DefinedBy(Api.COMPILER_TREE)
         public JCExpression getExpression() { return rhs; }
-        public OperatorSymbol getOperator() {
-            return operator;
-        }
         @Override @DefinedBy(Api.COMPILER_TREE)
         public <R,D> R accept(TreeVisitor<R,D> v, D d) {
             return v.visitCompoundAssignment(this, d);
         }
         @Override
-        public Tag getTag() {
-            return opcode;
+        public JCExpression getOperand(OperandPos pos) {
+            return pos == OperandPos.LEFT ? lhs : rhs;
         }
     }
 
     /**
      * A unary operation.
      */
-    public static class JCUnary extends JCExpression implements UnaryTree {
-        private Tag opcode;
+    public static class JCUnary extends JCOperatorExpression implements UnaryTree {
         public JCExpression arg;
-        public OperatorSymbol operator;
         protected JCUnary(Tag opcode, JCExpression arg) {
             this.opcode = opcode;
             this.arg = arg;
@@ -1923,31 +1937,25 @@
         public Kind getKind() { return TreeInfo.tagToKind(getTag()); }
         @DefinedBy(Api.COMPILER_TREE)
         public JCExpression getExpression() { return arg; }
-        public OperatorSymbol getOperator() {
-            return operator;
-        }
         @Override @DefinedBy(Api.COMPILER_TREE)
         public <R,D> R accept(TreeVisitor<R,D> v, D d) {
             return v.visitUnary(this, d);
         }
-        @Override
-        public Tag getTag() {
-            return opcode;
-        }
-
         public void setTag(Tag tag) {
             opcode = tag;
         }
+        @Override
+        public JCExpression getOperand(OperandPos pos) {
+            return arg;
+        }
     }
 
     /**
      * A binary operation.
      */
-    public static class JCBinary extends JCExpression implements BinaryTree {
-        private Tag opcode;
+    public static class JCBinary extends JCOperatorExpression implements BinaryTree {
         public JCExpression lhs;
         public JCExpression rhs;
-        public OperatorSymbol operator;
         protected JCBinary(Tag opcode,
                          JCExpression lhs,
                          JCExpression rhs,
@@ -1966,16 +1974,13 @@
         public JCExpression getLeftOperand() { return lhs; }
         @DefinedBy(Api.COMPILER_TREE)
         public JCExpression getRightOperand() { return rhs; }
-        public OperatorSymbol getOperator() {
-            return operator;
-        }
         @Override @DefinedBy(Api.COMPILER_TREE)
         public <R,D> R accept(TreeVisitor<R,D> v, D d) {
             return v.visitBinary(this, d);
         }
         @Override
-        public Tag getTag() {
-            return opcode;
+        public JCExpression getOperand(OperandPos pos) {
+            return pos == OperandPos.LEFT ? lhs : rhs;
         }
     }
 
diff --git a/langtools/src/jdk.compiler/share/classes/com/sun/tools/javac/tree/TreeInfo.java b/langtools/src/jdk.compiler/share/classes/com/sun/tools/javac/tree/TreeInfo.java
index 6d94218..5210067 100644
--- a/langtools/src/jdk.compiler/share/classes/com/sun/tools/javac/tree/TreeInfo.java
+++ b/langtools/src/jdk.compiler/share/classes/com/sun/tools/javac/tree/TreeInfo.java
@@ -36,14 +36,19 @@
 import com.sun.tools.javac.tree.JCTree.JCPolyExpression.*;
 import com.sun.tools.javac.util.*;
 import com.sun.tools.javac.util.JCDiagnostic.DiagnosticPosition;
+
 import static com.sun.tools.javac.code.Flags.*;
 import static com.sun.tools.javac.code.Kinds.Kind.*;
 import static com.sun.tools.javac.code.TypeTag.BOT;
 import static com.sun.tools.javac.tree.JCTree.Tag.*;
 import static com.sun.tools.javac.tree.JCTree.Tag.BLOCK;
 import static com.sun.tools.javac.tree.JCTree.Tag.SYNCHRONIZED;
+
 import javax.tools.JavaFileObject;
 
+import static com.sun.tools.javac.tree.JCTree.JCOperatorExpression.OperandPos.LEFT;
+import static com.sun.tools.javac.tree.JCTree.JCOperatorExpression.OperandPos.RIGHT;
+
 /** Utility class containing inspector methods for trees.
  *
  *  <p><b>This is NOT part of any supported API.
@@ -386,7 +391,6 @@
             case SL_ASG: case SR_ASG: case USR_ASG:
             case PLUS_ASG: case MINUS_ASG: case MUL_ASG:
             case DIV_ASG: case MOD_ASG:
-                return getStartPos(((JCAssignOp) tree).lhs);
             case OR: case AND: case BITOR:
             case BITXOR: case BITAND: case EQ:
             case NE: case LT: case GT:
@@ -394,7 +398,9 @@
             case SR: case USR: case PLUS:
             case MINUS: case MUL: case DIV:
             case MOD:
-                return getStartPos(((JCBinary) tree).lhs);
+            case POSTINC:
+            case POSTDEC:
+                return getStartPos(((JCOperatorExpression) tree).getOperand(LEFT));
             case CLASSDEF: {
                 JCClassDecl node = (JCClassDecl)tree;
                 if (node.mods.pos != Position.NOPOS)
@@ -423,9 +429,6 @@
                 return getStartPos(((JCArrayTypeTree) tree).elemtype);
             case TYPETEST:
                 return getStartPos(((JCInstanceOf) tree).expr);
-            case POSTINC:
-            case POSTDEC:
-                return getStartPos(((JCUnary) tree).arg);
             case ANNOTATED_TYPE: {
                 JCAnnotatedType node = (JCAnnotatedType) tree;
                 if (node.annotations.nonEmpty()) {
@@ -486,7 +489,6 @@
             case SL_ASG: case SR_ASG: case USR_ASG:
             case PLUS_ASG: case MINUS_ASG: case MUL_ASG:
             case DIV_ASG: case MOD_ASG:
-                return getEndPos(((JCAssignOp) tree).rhs, endPosTable);
             case OR: case AND: case BITOR:
             case BITXOR: case BITAND: case EQ:
             case NE: case LT: case GT:
@@ -494,7 +496,13 @@
             case SR: case USR: case PLUS:
             case MINUS: case MUL: case DIV:
             case MOD:
-                return getEndPos(((JCBinary) tree).rhs, endPosTable);
+            case POS:
+            case NEG:
+            case NOT:
+            case COMPL:
+            case PREINC:
+            case PREDEC:
+                return getEndPos(((JCOperatorExpression) tree).getOperand(RIGHT), endPosTable);
             case CASE:
                 return getEndPos(((JCCase) tree).stats.last(), endPosTable);
             case CATCH:
@@ -537,13 +545,6 @@
                 return getEndPos(((JCTypeCast) tree).expr, endPosTable);
             case TYPETEST:
                 return getEndPos(((JCInstanceOf) tree).clazz, endPosTable);
-            case POS:
-            case NEG:
-            case NOT:
-            case COMPL:
-            case PREINC:
-            case PREDEC:
-                return getEndPos(((JCUnary) tree).arg, endPosTable);
             case WHILELOOP:
                 return getEndPos(((JCWhileLoop) tree).body, endPosTable);
             case ANNOTATED_TYPE:
diff --git a/langtools/src/jdk.compiler/share/classes/com/sun/tools/javac/util/Log.java b/langtools/src/jdk.compiler/share/classes/com/sun/tools/javac/util/Log.java
index f84f427..63febd6 100644
--- a/langtools/src/jdk.compiler/share/classes/com/sun/tools/javac/util/Log.java
+++ b/langtools/src/jdk.compiler/share/classes/com/sun/tools/javac/util/Log.java
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1999, 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1999, 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,10 +27,13 @@
 
 import java.io.*;
 import java.util.Arrays;
+import java.util.EnumMap;
 import java.util.EnumSet;
 import java.util.HashSet;
+import java.util.Map;
 import java.util.Queue;
 import java.util.Set;
+
 import javax.tools.DiagnosticListener;
 import javax.tools.JavaFileObject;
 
@@ -56,9 +59,12 @@
     /** The context key for the log. */
     public static final Context.Key<Log> logKey = new Context.Key<>();
 
-    /** The context key for the output PrintWriter. */
+    /** The context key for the standard output PrintWriter. */
     public static final Context.Key<PrintWriter> outKey = new Context.Key<>();
 
+    /** The context key for the diagnostic PrintWriter. */
+    public static final Context.Key<PrintWriter> errKey = new Context.Key<>();
+
     /* TODO: Should unify this with prefix handling in JCDiagnostic.Factory. */
     public enum PrefixKind {
         JAVAC("javac."),
@@ -111,6 +117,7 @@
             install(log);
         }
 
+        @Override
         public void report(JCDiagnostic diag) { }
     }
 
@@ -134,6 +141,7 @@
             install(log);
         }
 
+        @Override
         public void report(JCDiagnostic diag) {
             if (!diag.isFlagSet(JCDiagnostic.DiagnosticFlag.NON_DEFERRABLE) &&
                 (filter == null || filter.accepts(diag))) {
@@ -163,13 +171,9 @@
         }
     }
 
-    public enum WriterKind { NOTICE, WARNING, ERROR }
+    public enum WriterKind { NOTICE, WARNING, ERROR, STDOUT, STDERR }
 
-    protected PrintWriter errWriter;
-
-    protected PrintWriter warnWriter;
-
-    protected PrintWriter noticeWriter;
+    private final Map<WriterKind, PrintWriter> writers;
 
     /** The maximum number of errors/warnings that are reported.
      */
@@ -223,14 +227,130 @@
      */
     private DiagnosticHandler diagnosticHandler;
 
-    /** Construct a log with given I/O redirections.
+    /** Get the Log instance for this context. */
+    public static Log instance(Context context) {
+        Log instance = context.get(logKey);
+        if (instance == null)
+            instance = new Log(context);
+        return instance;
+    }
+
+    /**
+     * Register a Context.Factory to create a Log.
      */
+    public static void preRegister(Context context, PrintWriter w) {
+        context.put(Log.class, (Context.Factory<Log>) (c -> new Log(c, w)));
+    }
+
+    /**
+     * Construct a log with default settings.
+     * If no streams are set in the context, the log will be initialized to use
+     * System.out for normal output, and System.err for all diagnostic output.
+     * If one stream is set in the context, with either Log.outKey or Log.errKey,
+     * it will be used for all output.
+     * Otherwise, the log will be initialized to use both streams found in the context.
+     */
+    protected Log(Context context) {
+        this(context, initWriters(context));
+    }
+
+    /**
+     * Initialize a map of writers based on values found in the context
+     * @param context the context in which to find writers to use
+     * @return a map of writers
+     */
+    private static Map<WriterKind, PrintWriter> initWriters(Context context) {
+        PrintWriter out = context.get(outKey);
+        PrintWriter err = context.get(errKey);
+        if (out == null && err == null) {
+            out = new PrintWriter(System.out, true);
+            err = new PrintWriter(System.err, true);
+            return initWriters(out, err);
+        } else if (out == null || err == null) {
+            PrintWriter pw = (out != null) ? out : err;
+            return initWriters(pw, pw);
+        } else {
+            return initWriters(out, err);
+        }
+    }
+
+    /**
+     * Construct a log with all output sent to a single output stream.
+     */
+    protected Log(Context context, PrintWriter writer) {
+        this(context, initWriters(writer, writer));
+    }
+
+    /**
+     * Construct a log.
+     * The log will be initialized to use stdOut for normal output, and stdErr
+     * for all diagnostic output.
+     */
+    protected Log(Context context, PrintWriter out, PrintWriter err) {
+        this(context, initWriters(out, err));
+    }
+
+    /**
+     * Initialize a writer map for a stream for normal output, and a stream for diagnostics.
+     * @param out a stream to be used for normal output
+     * @param err a stream to be used for diagnostic messages, such as errors, warnings, etc
+     * @return a map of writers
+     */
+    private static Map<WriterKind, PrintWriter> initWriters(PrintWriter out, PrintWriter err) {
+        Map<WriterKind, PrintWriter> writers = new EnumMap<>(WriterKind.class);
+        writers.put(WriterKind.ERROR, err);
+        writers.put(WriterKind.WARNING, err);
+        writers.put(WriterKind.NOTICE, err);
+
+        writers.put(WriterKind.STDOUT, out);
+        writers.put(WriterKind.STDERR, err);
+
+        return writers;
+    }
+
+    /**
+     * Construct a log with given I/O redirections.
+     * @deprecated
+     * This constructor is provided to support the supported but now-deprecated javadoc entry point
+     *      com.sun.tools.javadoc.Main.execute(String programName,
+     *          PrintWriter errWriter, PrintWriter warnWriter, PrintWriter noticeWriter,
+     *          String defaultDocletClassName, String... args)
+     */
+    @Deprecated
     protected Log(Context context, PrintWriter errWriter, PrintWriter warnWriter, PrintWriter noticeWriter) {
+        this(context, initWriters(errWriter, warnWriter, noticeWriter));
+    }
+
+    /**
+     * Initialize a writer map with different streams for different types of diagnostics.
+     * @param errWriter a stream for writing error messages
+     * @param warnWriter a stream for writing warning messages
+     * @param noticeWriter a stream for writing notice messages
+     * @return a map of writers
+     * @deprecated This method exists to support a supported but now deprecated javadoc entry point.
+     */
+    @Deprecated
+    private static Map<WriterKind, PrintWriter>  initWriters(PrintWriter errWriter, PrintWriter warnWriter, PrintWriter noticeWriter) {
+        Map<WriterKind, PrintWriter> writers = new EnumMap<>(WriterKind.class);
+        writers.put(WriterKind.ERROR, errWriter);
+        writers.put(WriterKind.WARNING, warnWriter);
+        writers.put(WriterKind.NOTICE, noticeWriter);
+
+        writers.put(WriterKind.STDOUT, noticeWriter);
+        writers.put(WriterKind.STDERR, errWriter);
+
+        return writers;
+    }
+
+    /**
+     * Creates a log.
+     * @param context the context in which the log should be registered
+     * @param writers a map of writers that can be accessed by the kind of writer required
+     */
+    private Log(Context context, Map<WriterKind, PrintWriter> writers) {
         super(JCDiagnostic.Factory.instance(context));
         context.put(logKey, this);
-        this.errWriter = errWriter;
-        this.warnWriter = warnWriter;
-        this.noticeWriter = noticeWriter;
+        this.writers = writers;
 
         @SuppressWarnings("unchecked") // FIXME
         DiagnosticListener<? super JavaFileObject> dl =
@@ -245,6 +365,7 @@
         final Options options = Options.instance(context);
         initOptions(options);
         options.addListener(new Runnable() {
+            @Override
             public void run() {
                 initOptions(options);
             }
@@ -293,42 +414,6 @@
             return 100;
         }
 
-    /** The default writer for diagnostics
-     */
-    static PrintWriter defaultWriter(Context context) {
-        PrintWriter result = context.get(outKey);
-        if (result == null)
-            context.put(outKey, result = new PrintWriter(System.err));
-        return result;
-    }
-
-    /** Construct a log with default settings.
-     */
-    protected Log(Context context) {
-        this(context, defaultWriter(context));
-    }
-
-    /** Construct a log with all output redirected.
-     */
-    protected Log(Context context, PrintWriter defaultWriter) {
-        this(context, defaultWriter, defaultWriter, defaultWriter);
-    }
-
-    /** Get the Log instance for this context. */
-    public static Log instance(Context context) {
-        Log instance = context.get(logKey);
-        if (instance == null)
-            instance = new Log(context);
-        return instance;
-    }
-
-    /**
-     * Register a Context.Factory to create a Log.
-     */
-    public static void preRegister(Context context, PrintWriter w) {
-        context.put(Log.class, (Context.Factory<Log>) (c -> new Log(c, w)));
-    }
-
     /** The number of errors encountered so far.
      */
     public int nerrors = 0;
@@ -371,26 +456,18 @@
     }
 
     public PrintWriter getWriter(WriterKind kind) {
-        switch (kind) {
-            case NOTICE:    return noticeWriter;
-            case WARNING:   return warnWriter;
-            case ERROR:     return errWriter;
-            default:        throw new IllegalArgumentException();
-        }
+        return writers.get(kind);
     }
 
     public void setWriter(WriterKind kind, PrintWriter pw) {
         Assert.checkNonNull(pw);
-        switch (kind) {
-            case NOTICE:    noticeWriter = pw;  break;
-            case WARNING:   warnWriter = pw;    break;
-            case ERROR:     errWriter = pw;     break;
-            default:        throw new IllegalArgumentException();
-        }
+        writers.put(kind, pw);
     }
 
     public void setWriters(PrintWriter pw) {
-        noticeWriter = warnWriter = errWriter = Assert.checkNonNull(pw);
+        Assert.checkNonNull(pw);
+        for (WriterKind k: WriterKind.values())
+            writers.put(k, pw);
     }
 
     /**
@@ -407,9 +484,9 @@
     /** Flush the logs
      */
     public void flush() {
-        errWriter.flush();
-        warnWriter.flush();
-        noticeWriter.flush();
+        for (PrintWriter pw: writers.values()) {
+            pw.flush();
+        }
     }
 
     public void flush(WriterKind kind) {
@@ -470,6 +547,7 @@
     }
 
     public void printNewline() {
+        PrintWriter noticeWriter = writers.get(WriterKind.NOTICE);
         noticeWriter.println();
     }
 
@@ -478,10 +556,12 @@
     }
 
     public void printLines(String key, Object... args) {
+        PrintWriter noticeWriter = writers.get(WriterKind.NOTICE);
         printRawLines(noticeWriter, localize(key, args));
     }
 
     public void printLines(PrefixKind pk, String key, Object... args) {
+        PrintWriter noticeWriter = writers.get(WriterKind.NOTICE);
         printRawLines(noticeWriter, localize(pk, key, args));
     }
 
@@ -497,6 +577,7 @@
      *  for the platform.
      */
     public void printRawLines(String msg) {
+        PrintWriter noticeWriter = writers.get(WriterKind.NOTICE);
         printRawLines(noticeWriter, msg);
     }
 
@@ -524,10 +605,13 @@
      * noticeWriter stream.
      */
     public void printVerbose(String key, Object... args) {
+        PrintWriter noticeWriter = writers.get(WriterKind.NOTICE);
         printRawLines(noticeWriter, localize("verbose." + key, args));
     }
 
+    @Override
     protected void directError(String key, Object... args) {
+        PrintWriter errWriter = writers.get(WriterKind.ERROR);
         printRawLines(errWriter, localize(key, args));
         errWriter.flush();
     }
@@ -546,6 +630,7 @@
      * Primary method to report a diagnostic.
      * @param diagnostic
      */
+    @Override
     public void report(JCDiagnostic diagnostic) {
         diagnosticHandler.report(diagnostic);
      }
@@ -556,6 +641,7 @@
      * reported so far, the diagnostic may be handed off to writeDiagnostic.
      */
     private class DefaultDiagnosticHandler extends DiagnosticHandler {
+        @Override
         public void report(JCDiagnostic diagnostic) {
             if (expectDiagKeys != null)
                 expectDiagKeys.remove(diagnostic.getCode());
@@ -631,13 +717,13 @@
             throw new IllegalArgumentException();
 
         case NOTE:
-            return noticeWriter;
+            return writers.get(WriterKind.NOTICE);
 
         case WARNING:
-            return warnWriter;
+            return writers.get(WriterKind.WARNING);
 
         case ERROR:
-            return errWriter;
+            return writers.get(WriterKind.ERROR);
 
         default:
             throw new Error();
@@ -683,26 +769,27 @@
 
     /** print an error or warning message:
      */
-    private void printRawError(int pos, String msg) {
+    private void printRawDiag(PrintWriter pw, String prefix, int pos, String msg) {
         if (source == null || pos == Position.NOPOS) {
-            printRawLines(errWriter, "error: " + msg);
+            printRawLines(pw, prefix + msg);
         } else {
             int line = source.getLineNumber(pos);
             JavaFileObject file = source.getFile();
             if (file != null)
-                printRawLines(errWriter,
+                printRawLines(pw,
                            file.getName() + ":" +
                            line + ": " + msg);
-            printErrLine(pos, errWriter);
+            printErrLine(pos, pw);
         }
-        errWriter.flush();
+        pw.flush();
     }
 
     /** report an error:
      */
     public void rawError(int pos, String msg) {
+        PrintWriter errWriter = writers.get(WriterKind.ERROR);
         if (nerrors < MaxErrors && shouldReport(currentSourceFile(), pos)) {
-            printRawError(pos, msg);
+            printRawDiag(errWriter, "error: ", pos, msg);
             prompt();
             nerrors++;
         }
@@ -712,12 +799,13 @@
     /** report a warning:
      */
     public void rawWarning(int pos, String msg) {
+        PrintWriter warnWriter = writers.get(WriterKind.ERROR);
         if (nwarnings < MaxWarnings && emitWarnings) {
-            printRawError(pos, "warning: " + msg);
+            printRawDiag(warnWriter, "warning: ", pos, msg);
         }
         prompt();
         nwarnings++;
-        errWriter.flush();
+        warnWriter.flush();
     }
 
     public static String format(String fmt, Object... args) {
diff --git a/langtools/src/jdk.compiler/share/classes/com/sun/tools/javah/JavahFileManager.java b/langtools/src/jdk.compiler/share/classes/com/sun/tools/javah/JavahFileManager.java
index e27eff2..03771d9 100644
--- a/langtools/src/jdk.compiler/share/classes/com/sun/tools/javah/JavahFileManager.java
+++ b/langtools/src/jdk.compiler/share/classes/com/sun/tools/javah/JavahFileManager.java
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2007, 2012, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2007, 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,7 +52,7 @@
 
         if (dl != null)
             javac_context.put(DiagnosticListener.class, dl);
-        javac_context.put(com.sun.tools.javac.util.Log.outKey, log);
+        javac_context.put(com.sun.tools.javac.util.Log.errKey, log);
 
         return new JavahFileManager(javac_context, null);
     }
diff --git a/langtools/src/jdk.javadoc/share/classes/com/sun/tools/javadoc/main/Messager.java b/langtools/src/jdk.javadoc/share/classes/com/sun/tools/javadoc/main/Messager.java
index 416df5a..f996c3d 100644
--- a/langtools/src/jdk.javadoc/share/classes/com/sun/tools/javadoc/main/Messager.java
+++ b/langtools/src/jdk.javadoc/share/classes/com/sun/tools/javadoc/main/Messager.java
@@ -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
@@ -174,6 +174,7 @@
 
         if (nerrors < MaxErrors) {
             String prefix = (pos == null) ? programName : pos.toString();
+            PrintWriter errWriter = getWriter(WriterKind.ERROR);
             errWriter.println(prefix + ": " + getText("javadoc.error") + " - " + msg);
             errWriter.flush();
             prompt();
@@ -206,6 +207,7 @@
 
         if (nwarnings < MaxWarnings) {
             String prefix = (pos == null) ? programName : pos.toString();
+            PrintWriter warnWriter = getWriter(WriterKind.WARNING);
             warnWriter.println(prefix +  ": " + getText("javadoc.warning") +" - " + msg);
             warnWriter.flush();
             nwarnings++;
@@ -235,6 +237,7 @@
             return;
         }
 
+        PrintWriter noticeWriter = getWriter(WriterKind.NOTICE);
         if (pos == null)
             noticeWriter.println(msg);
         else
diff --git a/langtools/src/jdk.javadoc/share/classes/com/sun/tools/javadoc/main/Start.java b/langtools/src/jdk.javadoc/share/classes/com/sun/tools/javadoc/main/Start.java
index cd07780..5b5b588 100644
--- a/langtools/src/jdk.javadoc/share/classes/com/sun/tools/javadoc/main/Start.java
+++ b/langtools/src/jdk.javadoc/share/classes/com/sun/tools/javadoc/main/Start.java
@@ -158,7 +158,7 @@
         if (log instanceof Messager)
             messager = (Messager) log;
         else {
-            PrintWriter out = context.get(Log.outKey);
+            PrintWriter out = context.get(Log.errKey);
             messager = (out == null) ? new Messager(context, javadocName)
                     : new Messager(context, javadocName, out, out, out);
         }
diff --git a/langtools/src/jdk.javadoc/share/classes/jdk/javadoc/internal/api/JavadocTool.java b/langtools/src/jdk.javadoc/share/classes/jdk/javadoc/internal/api/JavadocTool.java
index 8b91c15..f85a52b 100644
--- a/langtools/src/jdk.javadoc/share/classes/jdk/javadoc/internal/api/JavadocTool.java
+++ b/langtools/src/jdk.javadoc/share/classes/jdk/javadoc/internal/api/JavadocTool.java
@@ -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
@@ -107,11 +107,11 @@
                 context.put(DiagnosticListener.class, ccw.wrap(diagnosticListener));
 
             if (out == null)
-                context.put(Log.outKey, new PrintWriter(System.err, true));
+                context.put(Log.errKey, new PrintWriter(System.err, true));
             else if (out instanceof PrintWriter)
-                context.put(Log.outKey, ((PrintWriter) out));
+                context.put(Log.errKey, ((PrintWriter) out));
             else
-                context.put(Log.outKey, new PrintWriter(out, true));
+                context.put(Log.errKey, new PrintWriter(out, true));
 
             if (fileManager == null) {
                 fileManager = getStandardFileManager(diagnosticListener, null, null);
@@ -141,7 +141,7 @@
         PrintWriter pw = (charset == null)
                 ? new PrintWriter(System.err, true)
                 : new PrintWriter(new OutputStreamWriter(System.err, charset), true);
-        context.put(Log.outKey, pw);
+        context.put(Log.errKey, pw);
         return new JavacFileManager(context, true, charset);
     }
 
diff --git a/langtools/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/HtmlDoclet.java b/langtools/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/HtmlDoclet.java
index 4c289cc..f2251e3 100644
--- a/langtools/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/HtmlDoclet.java
+++ b/langtools/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/HtmlDoclet.java
@@ -275,6 +275,7 @@
             int i = 0;
             for (ModuleElement mdle : mdles) {
                 ModulePackageIndexFrameWriter.generate(configuration, mdle);
+                ModuleFrameWriter.generate(configuration, mdle);
                 nextModule = (i + 1 < mdles.size()) ? mdles.get(i + 1) : null;
                 AbstractBuilder moduleSummaryBuilder =
                         configuration.getBuilderFactory().getModuleSummaryBuilder(
diff --git a/langtools/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/ModuleFrameWriter.java b/langtools/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/ModuleFrameWriter.java
new file mode 100644
index 0000000..3f25c5d
--- /dev/null
+++ b/langtools/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/ModuleFrameWriter.java
@@ -0,0 +1,204 @@
+/*
+ * 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.javadoc.internal.doclets.formats.html;
+
+import java.io.*;
+import java.util.*;
+
+import javax.lang.model.element.ModuleElement;
+import javax.lang.model.element.PackageElement;
+import javax.lang.model.element.TypeElement;
+import javax.lang.model.util.ElementFilter;
+
+import jdk.javadoc.internal.doclets.formats.html.markup.HtmlConstants;
+import jdk.javadoc.internal.doclets.formats.html.markup.HtmlStyle;
+import jdk.javadoc.internal.doclets.formats.html.markup.HtmlTag;
+import jdk.javadoc.internal.doclets.formats.html.markup.HtmlTree;
+import jdk.javadoc.internal.doclets.formats.html.markup.StringContent;
+import jdk.javadoc.internal.doclets.toolkit.Content;
+import jdk.javadoc.internal.doclets.toolkit.util.DocPaths;
+import jdk.javadoc.internal.doclets.toolkit.util.DocletAbortException;
+
+
+/**
+ * Class to generate file for each module contents in the left-hand bottom
+ * frame. This will list all the Class Kinds in the module. A click on any
+ * class-kind will update the right-hand frame with the clicked class-kind page.
+ *
+ *  <p><b>This is NOT part of any supported API.
+ *  If you write code that depends on this, you do so at your own risk.
+ *  This code and its internal interfaces are subject to change or
+ *  deletion without notice.</b>
+ *
+ * @author Bhavesh Patel
+ */
+public class ModuleFrameWriter extends HtmlDocletWriter {
+
+    /**
+     * The module being documented.
+     */
+    private ModuleElement mdle;
+
+    /**
+     * The classes to be documented.  Use this to filter out classes
+     * that will not be documented.
+     */
+    private SortedSet<TypeElement> documentedClasses;
+
+    /**
+     * Constructor to construct ModuleFrameWriter object and to generate
+     * "module_name-type-frame.html" file. For example for module "java.base" this will generate file
+     * "java.base-type-frame.html" file.
+     *
+     * @param configuration the configuration of the doclet.
+     * @param moduleElement moduleElement under consideration.
+     */
+    public ModuleFrameWriter(ConfigurationImpl configuration, ModuleElement moduleElement)
+            throws IOException {
+        super(configuration, DocPaths.moduleTypeFrame(moduleElement));
+        this.mdle = moduleElement;
+        if (utils.getSpecifiedPackages().isEmpty()) {
+            documentedClasses = new TreeSet<>(utils.makeGeneralPurposeComparator());
+            documentedClasses.addAll(configuration.docEnv.getIncludedClasses());
+        }
+    }
+
+    /**
+     * Generate a module type summary page for the left-hand bottom frame.
+     *
+     * @param configuration the current configuration of the doclet.
+     * @param moduleElement The package for which "module_name-type-frame.html" is to be generated.
+     */
+    public static void generate(ConfigurationImpl configuration, ModuleElement moduleElement) {
+        ModuleFrameWriter mdlgen;
+        try {
+            mdlgen = new ModuleFrameWriter(configuration, moduleElement);
+            String mdlName = moduleElement.getQualifiedName().toString();
+            Content mdlLabel = new StringContent(mdlName);
+            HtmlTree body = mdlgen.getBody(false, mdlgen.getWindowTitle(mdlName));
+            HtmlTree htmlTree = (configuration.allowTag(HtmlTag.MAIN))
+                    ? HtmlTree.MAIN()
+                    : body;
+            Content heading = HtmlTree.HEADING(HtmlConstants.TITLE_HEADING, HtmlStyle.bar,
+                    mdlgen.getHyperLink(DocPaths.moduleSummary(moduleElement), mdlLabel, "", "classFrame"));
+            htmlTree.addContent(heading);
+            HtmlTree div = new HtmlTree(HtmlTag.DIV);
+            div.addStyle(HtmlStyle.indexContainer);
+            mdlgen.addClassListing(div);
+            htmlTree.addContent(div);
+            if (configuration.allowTag(HtmlTag.MAIN)) {
+                body.addContent(htmlTree);
+            }
+            mdlgen.printHtmlDocument(
+                    configuration.metakeywords.getMetaKeywordsForModule(moduleElement), false, body);
+            mdlgen.close();
+        } catch (IOException exc) {
+            configuration.standardmessage.error(
+                    "doclet.exception_encountered",
+                    exc.toString(), DocPaths.moduleTypeFrame(moduleElement).getPath());
+            throw new DocletAbortException(exc);
+        }
+    }
+
+    /**
+     * Add class listing for all the classes in this module. Divide class
+     * listing as per the class kind and generate separate listing for
+     * Classes, Interfaces, Exceptions and Errors.
+     *
+     * @param contentTree the content tree to which the listing will be added
+     */
+    protected void addClassListing(HtmlTree contentTree) {
+        List<PackageElement> packagesIn = ElementFilter.packagesIn(mdle.getEnclosedElements());
+        SortedSet<TypeElement> interfaces = new TreeSet<>(utils.makeGeneralPurposeComparator());
+        SortedSet<TypeElement> classes = new TreeSet<>(utils.makeGeneralPurposeComparator());
+        SortedSet<TypeElement> enums = new TreeSet<>(utils.makeGeneralPurposeComparator());
+        SortedSet<TypeElement> exceptions = new TreeSet<>(utils.makeGeneralPurposeComparator());
+        SortedSet<TypeElement> errors = new TreeSet<>(utils.makeGeneralPurposeComparator());
+        SortedSet<TypeElement> annotationTypes = new TreeSet<>(utils.makeGeneralPurposeComparator());
+        for (PackageElement pkg : packagesIn) {
+            if (utils.isIncluded(pkg)) {
+                interfaces.addAll(utils.getInterfaces(pkg));
+                classes.addAll(utils.getOrdinaryClasses(pkg));
+                enums.addAll(utils.getEnums(pkg));
+                exceptions.addAll(utils.getExceptions(pkg));
+                errors.addAll(utils.getErrors(pkg));
+                annotationTypes.addAll(utils.getAnnotationTypes(pkg));
+            }
+        }
+        addClassKindListing(interfaces, getResource("doclet.Interfaces"), contentTree);
+        addClassKindListing(classes, getResource("doclet.Classes"), contentTree);
+        addClassKindListing(enums, getResource("doclet.Enums"), contentTree);
+        addClassKindListing(exceptions, getResource("doclet.Exceptions"), contentTree);
+        addClassKindListing(errors, getResource("doclet.Errors"), contentTree);
+        addClassKindListing(annotationTypes, getResource("doclet.AnnotationTypes"), contentTree);
+    }
+
+    /**
+     * Add specific class kind listing. Also add label to the listing.
+     *
+     * @param list Iterable list of TypeElements
+     * @param labelContent content tree of the label to be added
+     * @param contentTree the content tree to which the class kind listing will be added
+     */
+    protected void addClassKindListing(Iterable<TypeElement> list, Content labelContent,
+            HtmlTree contentTree) {
+        SortedSet<TypeElement> tset = utils.filterOutPrivateClasses(list, configuration.javafx);
+        if (!tset.isEmpty()) {
+            boolean printedHeader = false;
+            HtmlTree htmlTree = (configuration.allowTag(HtmlTag.SECTION))
+                    ? HtmlTree.SECTION()
+                    : contentTree;
+            HtmlTree ul = new HtmlTree(HtmlTag.UL);
+            ul.setTitle(labelContent);
+            for (TypeElement typeElement : tset) {
+                if (documentedClasses != null && !documentedClasses.contains(typeElement)) {
+                    continue;
+                }
+                if (!utils.isCoreClass(typeElement) || !configuration.isGeneratedDoc(typeElement)) {
+                    continue;
+                }
+                if (!printedHeader) {
+                    Content heading = HtmlTree.HEADING(HtmlConstants.CONTENT_HEADING,
+                            true, labelContent);
+                    htmlTree.addContent(heading);
+                    printedHeader = true;
+                }
+                Content arr_i_name = new StringContent(utils.getSimpleName(typeElement));
+                if (utils.isInterface(typeElement)) {
+                    arr_i_name = HtmlTree.SPAN(HtmlStyle.interfaceName, arr_i_name);
+                }
+                Content link = getLink(new LinkInfoImpl(configuration,
+                        LinkInfoImpl.Kind.ALL_CLASSES_FRAME, typeElement).label(arr_i_name).target("classFrame"));
+                Content li = HtmlTree.LI(link);
+                ul.addContent(li);
+            }
+            htmlTree.addContent(ul);
+            if (configuration.allowTag(HtmlTag.SECTION)) {
+                contentTree.addContent(htmlTree);
+            }
+        }
+    }
+}
diff --git a/langtools/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/ModuleIndexFrameWriter.java b/langtools/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/ModuleIndexFrameWriter.java
index 38bd8cc..ce18032 100644
--- a/langtools/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/ModuleIndexFrameWriter.java
+++ b/langtools/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/ModuleIndexFrameWriter.java
@@ -110,15 +110,13 @@
     /**
      * Returns each module name as a separate link.
      *
-     * @param moduleName the module being documented
+     * @param mdle the module being documented
      * @return content for the module link
      */
     protected Content getModuleLink(ModuleElement mdle) {
         Content moduleLinkContent;
-        Content moduleLabel;
-        moduleLabel = new StringContent(mdle.getQualifiedName().toString());
-        moduleLinkContent = getHyperLink(DocPaths.moduleFrame(mdle),
-                moduleLabel, "", "packageListFrame");
+        Content mdlLabel = new StringContent(mdle.getQualifiedName());
+        moduleLinkContent = getModuleFramesHyperLink(mdle, mdlLabel, "packageListFrame");
         Content li = HtmlTree.LI(moduleLinkContent);
         return li;
     }
diff --git a/langtools/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/markup/HtmlAttr.java b/langtools/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/markup/HtmlAttr.java
index 69ae2aa..35b8eed 100644
--- a/langtools/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/markup/HtmlAttr.java
+++ b/langtools/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/markup/HtmlAttr.java
@@ -49,6 +49,7 @@
     ID,
     LANG,
     NAME,
+    ONCLICK,
     ONLOAD,
     REL,
     ROLE,
diff --git a/langtools/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/markup/HtmlDocWriter.java b/langtools/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/markup/HtmlDocWriter.java
index d7aec84..080041e 100644
--- a/langtools/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/markup/HtmlDocWriter.java
+++ b/langtools/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/markup/HtmlDocWriter.java
@@ -28,6 +28,7 @@
 import java.io.*;
 import java.util.*;
 
+import javax.lang.model.element.ModuleElement;
 import javax.lang.model.element.PackageElement;
 import javax.lang.model.element.TypeElement;
 
@@ -282,6 +283,21 @@
         return anchor;
     }
 
+    public Content getModuleFramesHyperLink(ModuleElement mdle, Content label, String target) {
+        DocLink mdlLink = new DocLink(DocPaths.moduleFrame(mdle));
+        DocLink mtFrameLink = new DocLink(DocPaths.moduleTypeFrame(mdle));
+        DocLink cFrameLink = new DocLink(DocPaths.moduleSummary(mdle));
+        HtmlTree anchor = HtmlTree.A(mdlLink.toString(), label);
+        StringBuilder onclickStr = new StringBuilder("updateModuleFrame('")
+                .append(mtFrameLink.toString())
+                .append("','")
+                .append(cFrameLink.toString())
+                .append("');");
+        anchor.addAttr(HtmlAttr.TARGET, target);
+        anchor.addAttr(HtmlAttr.ONCLICK, onclickStr.toString());
+        return anchor;
+    }
+
     /**
      * Get the enclosed name of the package
      *
diff --git a/langtools/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/toolkit/resources/script.js b/langtools/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/toolkit/resources/script.js
index 98a31fe..a12a61e 100644
--- a/langtools/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/toolkit/resources/script.js
+++ b/langtools/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/toolkit/resources/script.js
@@ -107,3 +107,9 @@
         }
     }
 }
+
+function updateModuleFrame(pFrame, cFrame)
+{
+    top.packageFrame.location = pFrame;
+    top.classFrame.location = cFrame;
+}
diff --git a/langtools/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/toolkit/util/DocPaths.java b/langtools/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/toolkit/util/DocPaths.java
index 57956f9..f679e87 100644
--- a/langtools/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/toolkit/util/DocPaths.java
+++ b/langtools/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/toolkit/util/DocPaths.java
@@ -155,6 +155,11 @@
         return DocPath.create(mdle.getQualifiedName() + "-summary.html");
     }
 
+    /** The name of the file for the module frame. */
+    public static DocPath moduleTypeFrame(ModuleElement mdle) {
+        return DocPath.create(mdle.getQualifiedName() + "-type-frame.html");
+    }
+
     /** The name of the file for the module overview frame. */
     public static final DocPath MODULE_OVERVIEW_FRAME = DocPath.create("module-overview-frame.html");
 
diff --git a/langtools/src/jdk.javadoc/share/classes/jdk/javadoc/internal/tool/Messager.java b/langtools/src/jdk.javadoc/share/classes/jdk/javadoc/internal/tool/Messager.java
index d251569..0da657f 100644
--- a/langtools/src/jdk.javadoc/share/classes/jdk/javadoc/internal/tool/Messager.java
+++ b/langtools/src/jdk.javadoc/share/classes/jdk/javadoc/internal/tool/Messager.java
@@ -165,8 +165,8 @@
     /**
      * Constructor
      * @param programName  Name of the program (for error messages).
-     * @param outWriter    Stream for notices etc.
-     * @param errWriter    Stream for errors and warnings
+     * @param stdOut    Stream for notices etc.
+     * @param stdErr    Stream for errors and warnings
      */
     @SuppressWarnings("deprecation")
     public Messager(Context context, String programName, PrintWriter outWriter, PrintWriter errWriter) {
@@ -254,6 +254,7 @@
 
     private void incrementErrorCount(String prefix, String msg) {
         if (nerrors < MaxErrors) {
+            PrintWriter errWriter = getWriter(WriterKind.ERROR);
             errWriter.println(prefix + ": " + getText("javadoc.error") + " - " + msg);
             errWriter.flush();
             prompt();
@@ -291,6 +292,7 @@
 
     private void incrementWarningCount(String prefix, String msg) {
         if (nwarnings < MaxWarnings) {
+            PrintWriter warnWriter = getWriter(WriterKind.WARNING);
             warnWriter.println(prefix + ": " + getText("javadoc.warning") + " - " + msg);
             warnWriter.flush();
             nwarnings++;
@@ -314,6 +316,7 @@
             return;
         }
 
+        PrintWriter noticeWriter = getWriter(WriterKind.NOTICE);
         if (path == null) {
             noticeWriter.println(msg);
         } else {
@@ -329,6 +332,7 @@
             return;
         }
 
+        PrintWriter noticeWriter = getWriter(WriterKind.NOTICE);
         if (e == null) {
             noticeWriter.println(msg);
         } else {
diff --git a/langtools/src/jdk.javadoc/share/classes/jdk/javadoc/internal/tool/Start.java b/langtools/src/jdk.javadoc/share/classes/jdk/javadoc/internal/tool/Start.java
index ca96d6c..30fdb0b 100644
--- a/langtools/src/jdk.javadoc/share/classes/jdk/javadoc/internal/tool/Start.java
+++ b/langtools/src/jdk.javadoc/share/classes/jdk/javadoc/internal/tool/Start.java
@@ -155,7 +155,7 @@
             if (log instanceof Messager) {
                 messager = (Messager) log;
             } else {
-                PrintWriter out = context.get(Log.outKey);
+                PrintWriter out = context.get(Log.errKey);
                 messager = (out == null)
                         ? new Messager(context, ProgramName)
                         : new Messager(context, ProgramName, out, out);
diff --git a/langtools/src/jdk.jdeps/share/classes/com/sun/tools/javap/JavapFileManager.java b/langtools/src/jdk.jdeps/share/classes/com/sun/tools/javap/JavapFileManager.java
index cf491bf..65976b2 100644
--- a/langtools/src/jdk.jdeps/share/classes/com/sun/tools/javap/JavapFileManager.java
+++ b/langtools/src/jdk.jdeps/share/classes/com/sun/tools/javap/JavapFileManager.java
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2007, 2012, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2007, 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,7 +52,7 @@
 
         if (dl != null)
             javac_context.put(DiagnosticListener.class, dl);
-        javac_context.put(com.sun.tools.javac.util.Log.outKey, log);
+        javac_context.put(com.sun.tools.javac.util.Log.errKey, log);
 
         return new JavapFileManager(javac_context, null);
     }
diff --git a/langtools/src/jdk.jshell/share/classes/jdk/jshell/CompletenessAnalyzer.java b/langtools/src/jdk.jshell/share/classes/jdk/jshell/CompletenessAnalyzer.java
index 2ae696a..10a0069 100644
--- a/langtools/src/jdk.jshell/share/classes/jdk/jshell/CompletenessAnalyzer.java
+++ b/langtools/src/jdk.jshell/share/classes/jdk/jshell/CompletenessAnalyzer.java
@@ -110,14 +110,13 @@
 
         private static CaLog createLog(Context context) {
             PrintWriter pw = new PrintWriter(new StringWriter());
-            CaLog log = new CaLog(context, pw, pw, pw);
-            context.put(outKey, pw);
+            CaLog log = new CaLog(context, pw);
             context.put(logKey, log);
             return log;
         }
 
-        private CaLog(Context context, PrintWriter errWriter, PrintWriter warnWriter, PrintWriter noticeWriter) {
-            super(context, errWriter, warnWriter, noticeWriter);
+        private CaLog(Context context, PrintWriter pw) {
+            super(context, pw);
         }
 
         @Override
diff --git a/langtools/test/jdk/javadoc/doclet/testModules/TestModules.java b/langtools/test/jdk/javadoc/doclet/testModules/TestModules.java
index b9648811..3d9234a 100644
--- a/langtools/test/jdk/javadoc/doclet/testModules/TestModules.java
+++ b/langtools/test/jdk/javadoc/doclet/testModules/TestModules.java
@@ -23,7 +23,7 @@
 
 /*
  * @test
- * @bug 8154119 8154262 8156077 8157987 8154261
+ * @bug 8154119 8154262 8156077 8157987 8154261 8154817
  * @summary Test modules support in javadoc.
  * @author bpatel
  * @library ../lib
@@ -50,6 +50,8 @@
         testNoDescription(false);
         testOverviewSummaryModules();
         testModuleLink();
+        testModuleClickThroughLinks();
+        testModuleClickThrough(true);
     }
 
     @Test
@@ -63,6 +65,8 @@
         testHtml5NoDescription(false);
         testHtml5OverviewSummaryModules();
         testModuleLink();
+        testModuleClickThroughLinks();
+        testModuleClickThrough(true);
     }
 
     @Test
@@ -96,6 +100,7 @@
                 "testpkgnomodule", "testpkgnomodule1");
         checkExit(Exit.OK);
         testOverviewSummaryPackages();
+        testModuleClickThrough(false);
     }
 
    @Test
@@ -442,4 +447,27 @@
                 + "<!--   -->\n"
                 + "</a>");
     }
+
+     void testModuleClickThroughLinks() {
+        checkOutput("module-overview-frame.html", true,
+                "<li><a href=\"module1-frame.html\" target=\"packageListFrame\" "
+                + "onclick=\"updateModuleFrame('module1-type-frame.html','module1-summary.html');"
+                + "\">module1</a></li>");
+        checkOutput("module-overview-frame.html", true,
+                "<li><a href=\"module2-frame.html\" target=\"packageListFrame\" "
+                + "onclick=\"updateModuleFrame('module2-type-frame.html','module2-summary.html');"
+                + "\">module2</a></li>");
+        checkOutput("script.js", true,
+                 "function updateModuleFrame(pFrame, cFrame)\n"
+                 + "{\n"
+                 + "    top.packageFrame.location = pFrame;\n"
+                 + "    top.classFrame.location = cFrame;\n"
+                 + "}");
+}
+
+     void testModuleClickThrough(boolean found) {
+        checkFiles(found,
+                "module1-type-frame.html",
+                "module2-type-frame.html");
+     }
 }
diff --git a/langtools/test/tools/javac/annotations/repeatingAnnotations/combo/ReflectionTest.java b/langtools/test/tools/javac/annotations/repeatingAnnotations/combo/ReflectionTest.java
index bfebfba..cd57377 100644
--- a/langtools/test/tools/javac/annotations/repeatingAnnotations/combo/ReflectionTest.java
+++ b/langtools/test/tools/javac/annotations/repeatingAnnotations/combo/ReflectionTest.java
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2013, 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2013, 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
@@ -23,7 +23,7 @@
 
 /**
  * @test
- * @bug      8001457 8027477
+ * @bug      8001457 8027477 8163113
  * @author   sogoel
  * @summary  Reflection api tests
  * @modules jdk.compiler
@@ -483,17 +483,17 @@
         BasicContainer_Legacy(
         "@ExpectedBase(value = Foo.class, "
                 + "getAnnotationVal = \"NULL\","
-                + "getAnnotationsVals = {\"ExpectedBase\", \"ExpectedContainer\", \"@FooContainer(value=[@Foo(value=1), @Foo(value=2)])\"}, "
-                + "getDeclAnnosVals = {\"ExpectedBase\", \"ExpectedContainer\", \"@FooContainer(value=[@Foo(value=1), @Foo(value=2)])\"}, "
+                + "getAnnotationsVals = {\"ExpectedBase\", \"ExpectedContainer\", \"@FooContainer(value={@Foo(value=1), @Foo(value=2)})\"}, "
+                + "getDeclAnnosVals = {\"ExpectedBase\", \"ExpectedContainer\", \"@FooContainer(value={@Foo(value=1), @Foo(value=2)})\"}, "
                 + "getDeclAnnoVal = \"NULL\", " + "getAnnosArgs = {}, "
                 + "getDeclAnnosArgs = {} )",
         "@ExpectedContainer(value=FooContainer.class, "
-                + "getAnnotationVal = \"@FooContainer(value=[@Foo(value=1), @Foo(value=2)])\", "
-                + "getAnnotationsVals = {\"ExpectedBase\", \"ExpectedContainer\", \"@FooContainer(value=[@Foo(value=1), @Foo(value=2)])\"}, "
-                + "getDeclAnnosVals = {\"ExpectedBase\", \"ExpectedContainer\", \"@FooContainer(value=[@Foo(value=1), @Foo(value=2)])\"}, "
-                + "getDeclAnnoVal = \"@FooContainer(value=[@Foo(value=1), @Foo(value=2)])\", "
-                + "getAnnosArgs = {\"@FooContainer(value=[@Foo(value=1), @Foo(value=2)])\"}, "
-                + "getDeclAnnosArgs = {\"@FooContainer(value=[@Foo(value=1), @Foo(value=2)])\"} )") {
+                + "getAnnotationVal = \"@FooContainer(value={@Foo(value=1), @Foo(value=2)})\", "
+                + "getAnnotationsVals = {\"ExpectedBase\", \"ExpectedContainer\", \"@FooContainer(value={@Foo(value=1), @Foo(value=2)})\"}, "
+                + "getDeclAnnosVals = {\"ExpectedBase\", \"ExpectedContainer\", \"@FooContainer(value={@Foo(value=1), @Foo(value=2)})\"}, "
+                + "getDeclAnnoVal = \"@FooContainer(value={@Foo(value=1), @Foo(value=2)})\", "
+                + "getAnnosArgs = {\"@FooContainer(value={@Foo(value=1), @Foo(value=2)})\"}, "
+                + "getDeclAnnosArgs = {\"@FooContainer(value={@Foo(value=1), @Foo(value=2)})\"} )") {
 
             @Override
             public Iterable<? extends JavaFileObject> getTestFiles(SrcType srcType,
@@ -583,21 +583,21 @@
         "@ExpectedBase(value = Foo.class, "
                 + "getAnnotationVal = \"@Foo(value=0)\","
                 + "getAnnotationsVals = {"
-                +       "\"ExpectedBase\", \"ExpectedContainer\", \"@Foo(value=0)\", \"@FooContainer(value=[@Foo(value=1), @Foo(value=2)])\"}, "
+                +       "\"ExpectedBase\", \"ExpectedContainer\", \"@Foo(value=0)\", \"@FooContainer(value={@Foo(value=1), @Foo(value=2)})\"}, "
                 + "getDeclAnnosVals = {"
-                +       "\"ExpectedBase\", \"ExpectedContainer\", \"@Foo(value=0)\", \"@FooContainer(value=[@Foo(value=1), @Foo(value=2)])\"}, "
+                +       "\"ExpectedBase\", \"ExpectedContainer\", \"@Foo(value=0)\", \"@FooContainer(value={@Foo(value=1), @Foo(value=2)})\"}, "
                 + "getDeclAnnoVal = \"@Foo(value=0)\", "
                 + "getAnnosArgs = {\"@Foo(value=0)\"}, "
                 + "getDeclAnnosArgs = {\"@Foo(value=0)\"} )",
         "@ExpectedContainer(value=FooContainer.class, "
-                + "getAnnotationVal = \"@FooContainer(value=[@Foo(value=1), @Foo(value=2)])\", "
+                + "getAnnotationVal = \"@FooContainer(value={@Foo(value=1), @Foo(value=2)})\", "
                 + "getAnnotationsVals = {"
-                +       "\"ExpectedBase\", \"ExpectedContainer\", \"@Foo(value=0)\", \"@FooContainer(value=[@Foo(value=1), @Foo(value=2)])\"}, "
+                +       "\"ExpectedBase\", \"ExpectedContainer\", \"@Foo(value=0)\", \"@FooContainer(value={@Foo(value=1), @Foo(value=2)})\"}, "
                 + "getDeclAnnosVals = {"
-                +       "\"ExpectedBase\", \"ExpectedContainer\", \"@Foo(value=0)\", \"@FooContainer(value=[@Foo(value=1), @Foo(value=2)])\"}, "
-                + "getDeclAnnoVal = \"@FooContainer(value=[@Foo(value=1), @Foo(value=2)])\", "
-                + "getAnnosArgs = {\"@FooContainer(value=[@Foo(value=1), @Foo(value=2)])\"}, "
-                + "getDeclAnnosArgs = {\"@FooContainer(value=[@Foo(value=1), @Foo(value=2)])\"} )") {
+                +       "\"ExpectedBase\", \"ExpectedContainer\", \"@Foo(value=0)\", \"@FooContainer(value={@Foo(value=1), @Foo(value=2)})\"}, "
+                + "getDeclAnnoVal = \"@FooContainer(value={@Foo(value=1), @Foo(value=2)})\", "
+                + "getAnnosArgs = {\"@FooContainer(value={@Foo(value=1), @Foo(value=2)})\"}, "
+                + "getDeclAnnosArgs = {\"@FooContainer(value={@Foo(value=1), @Foo(value=2)})\"} )") {
 
             @Override
             public Iterable<? extends JavaFileObject> getTestFiles(SrcType srcType,
@@ -691,17 +691,17 @@
         BasicContainer_Inherited_Legacy(
         "@ExpectedBase(value = Foo.class, "
                 + "getAnnotationVal = \"NULL\","
-                + "getAnnotationsVals = {\"ExpectedBase\", \"ExpectedContainer\", \"@FooContainer(value=[@Foo(value=1), @Foo(value=2)])\"}, "
+                + "getAnnotationsVals = {\"ExpectedBase\", \"ExpectedContainer\", \"@FooContainer(value={@Foo(value=1), @Foo(value=2)})\"}, "
                 + "getDeclAnnosVals = {\"ExpectedBase\", \"ExpectedContainer\"}, "
                 + "getDeclAnnoVal = \"NULL\", "
                 + "getAnnosArgs = {}, "
                 + "getDeclAnnosArgs = {} )",
         "@ExpectedContainer(value=FooContainer.class, "
-                + "getAnnotationVal = \"@FooContainer(value=[@Foo(value=1), @Foo(value=2)])\", "
-                + "getAnnotationsVals = {\"ExpectedBase\", \"ExpectedContainer\", \"@FooContainer(value=[@Foo(value=1), @Foo(value=2)])\"}, "
+                + "getAnnotationVal = \"@FooContainer(value={@Foo(value=1), @Foo(value=2)})\", "
+                + "getAnnotationsVals = {\"ExpectedBase\", \"ExpectedContainer\", \"@FooContainer(value={@Foo(value=1), @Foo(value=2)})\"}, "
                 + "getDeclAnnosVals = {\"ExpectedBase\", \"ExpectedContainer\"}, "
                 + "getDeclAnnoVal = \"NULL\", "
-                + "getAnnosArgs = {\"@FooContainer(value=[@Foo(value=1), @Foo(value=2)])\"}, "
+                + "getAnnosArgs = {\"@FooContainer(value={@Foo(value=1), @Foo(value=2)})\"}, "
                 + "getDeclAnnosArgs = {} )") {
 
             @Override
@@ -765,18 +765,18 @@
         "@ExpectedBase(value=Foo.class, "
                 + "getAnnotationVal = \"@Foo(value=0)\", "
                 + "getAnnotationsVals = {"
-                +       "\"ExpectedBase\", \"ExpectedContainer\", \"@FooContainer(value=[@Foo(value=1), @Foo(value=2)])\", \"@Foo(value=0)\"}, "
+                +       "\"ExpectedBase\", \"ExpectedContainer\", \"@FooContainer(value={@Foo(value=1), @Foo(value=2)})\", \"@Foo(value=0)\"}, "
                 + "getDeclAnnosVals = {\"ExpectedBase\", \"ExpectedContainer\", \"@Foo(value=0)\"},"
                 + "getDeclAnnoVal = \"@Foo(value=0)\","
                 + "getAnnosArgs = {\"@Foo(value=0)\"},"
                 + "getDeclAnnosArgs = {\"@Foo(value=0)\"})",
         "@ExpectedContainer(value=FooContainer.class, "
-                + "getAnnotationVal = \"@FooContainer(value=[@Foo(value=1), @Foo(value=2)])\", "
+                + "getAnnotationVal = \"@FooContainer(value={@Foo(value=1), @Foo(value=2)})\", "
                 + "getAnnotationsVals = {"
-                +       "\"ExpectedBase\", \"ExpectedContainer\", \"@FooContainer(value=[@Foo(value=1), @Foo(value=2)])\", \"@Foo(value=0)\"}, "
+                +       "\"ExpectedBase\", \"ExpectedContainer\", \"@FooContainer(value={@Foo(value=1), @Foo(value=2)})\", \"@Foo(value=0)\"}, "
                 + "getDeclAnnosVals = {\"ExpectedBase\", \"ExpectedContainer\", \"@Foo(value=0)\"},"
                 + "getDeclAnnoVal = \"NULL\","
-                + "getAnnosArgs = {\"@FooContainer(value=[@Foo(value=1), @Foo(value=2)])\"},"
+                + "getAnnosArgs = {\"@FooContainer(value={@Foo(value=1), @Foo(value=2)})\"},"
                 + "getDeclAnnosArgs = {})") {
 
             @Override
@@ -844,18 +844,18 @@
         "@ExpectedBase(value=Foo.class, "
                 + "getAnnotationVal = \"@Foo(value=0)\", "
                 + "getAnnotationsVals = {"
-                +       "\"ExpectedBase\", \"ExpectedContainer\", \"@FooContainer(value=[@Foo(value=1), @Foo(value=2)])\", \"@Foo(value=0)\"}, "
+                +       "\"ExpectedBase\", \"ExpectedContainer\", \"@FooContainer(value={@Foo(value=1), @Foo(value=2)})\", \"@Foo(value=0)\"}, "
                 + "getDeclAnnosVals = {\"ExpectedBase\", \"ExpectedContainer\", \"@Foo(value=0)\"},"
                 + "getDeclAnnoVal = \"@Foo(value=0)\","
                 + "getAnnosArgs = {\"@Foo(value=0)\"},"
                 + "getDeclAnnosArgs = {\"@Foo(value=0)\"})",
         "@ExpectedContainer(value=FooContainer.class, "
-                + "getAnnotationVal = \"@FooContainer(value=[@Foo(value=1), @Foo(value=2)])\", "
+                + "getAnnotationVal = \"@FooContainer(value={@Foo(value=1), @Foo(value=2)})\", "
                 + "getAnnotationsVals = {"
-                +       "\"ExpectedBase\", \"ExpectedContainer\", \"@FooContainer(value=[@Foo(value=1), @Foo(value=2)])\", \"@Foo(value=0)\"}, "
+                +       "\"ExpectedBase\", \"ExpectedContainer\", \"@FooContainer(value={@Foo(value=1), @Foo(value=2)})\", \"@Foo(value=0)\"}, "
                 + "getDeclAnnosVals = {\"ExpectedBase\", \"ExpectedContainer\", \"@Foo(value=0)\"},"
                 + "getDeclAnnoVal = \"NULL\","
-                + "getAnnosArgs = {\"@FooContainer(value=[@Foo(value=1), @Foo(value=2)])\"},"
+                + "getAnnosArgs = {\"@FooContainer(value={@Foo(value=1), @Foo(value=2)})\"},"
                 + "getDeclAnnosArgs = {})") {
 
             @Override
@@ -923,19 +923,19 @@
         "@ExpectedBase(value=Foo.class, "
                 + "getAnnotationVal = \"@Foo(value=0)\", "
                 + "getAnnotationsVals = {"
-                +       "\"ExpectedBase\", \"ExpectedContainer\", \"@Foo(value=0)\", \"@FooContainer(value=[@Foo(value=1), @Foo(value=2)])\"}, "
-                + "getDeclAnnosVals = {\"ExpectedBase\", \"ExpectedContainer\", \"@FooContainer(value=[@Foo(value=1), @Foo(value=2)])\"},"
+                +       "\"ExpectedBase\", \"ExpectedContainer\", \"@Foo(value=0)\", \"@FooContainer(value={@Foo(value=1), @Foo(value=2)})\"}, "
+                + "getDeclAnnosVals = {\"ExpectedBase\", \"ExpectedContainer\", \"@FooContainer(value={@Foo(value=1), @Foo(value=2)})\"},"
                 + "getDeclAnnoVal = \"NULL\","
                 + "getAnnosArgs = {\"@Foo(value=0)\"},"
                 + "getDeclAnnosArgs = {})",
         "@ExpectedContainer(value=FooContainer.class, "
-                + "getAnnotationVal = \"@FooContainer(value=[@Foo(value=1), @Foo(value=2)])\", "
+                + "getAnnotationVal = \"@FooContainer(value={@Foo(value=1), @Foo(value=2)})\", "
                 + "getAnnotationsVals = {"
-                +       "\"ExpectedBase\", \"ExpectedContainer\", \"@Foo(value=0)\", \"@FooContainer(value=[@Foo(value=1), @Foo(value=2)])\"}, "
-                + "getDeclAnnosVals = {\"ExpectedBase\", \"ExpectedContainer\", \"@FooContainer(value=[@Foo(value=1), @Foo(value=2)])\"},"
-                + "getDeclAnnoVal = \"@FooContainer(value=[@Foo(value=1), @Foo(value=2)])\","
-                + "getAnnosArgs = {\"@FooContainer(value=[@Foo(value=1), @Foo(value=2)])\"},"
-                + "getDeclAnnosArgs = {\"@FooContainer(value=[@Foo(value=1), @Foo(value=2)])\"})") {
+                +       "\"ExpectedBase\", \"ExpectedContainer\", \"@Foo(value=0)\", \"@FooContainer(value={@Foo(value=1), @Foo(value=2)})\"}, "
+                + "getDeclAnnosVals = {\"ExpectedBase\", \"ExpectedContainer\", \"@FooContainer(value={@Foo(value=1), @Foo(value=2)})\"},"
+                + "getDeclAnnoVal = \"@FooContainer(value={@Foo(value=1), @Foo(value=2)})\","
+                + "getAnnosArgs = {\"@FooContainer(value={@Foo(value=1), @Foo(value=2)})\"},"
+                + "getDeclAnnosArgs = {\"@FooContainer(value={@Foo(value=1), @Foo(value=2)})\"})") {
 
             @Override
             public Iterable<? extends JavaFileObject> getTestFiles(SrcType srcType,
@@ -1000,21 +1000,21 @@
         "@ExpectedBase(value=Foo.class, "
                 + "getAnnotationVal = \"@Foo(value=3)\", "
                 + "getAnnotationsVals = {"
-                +       "\"ExpectedBase\", \"ExpectedContainer\", \"@FooContainer(value=[@Foo(value=1), @Foo(value=2)])\", \"@Foo(value=3)\"}, "
+                +       "\"ExpectedBase\", \"ExpectedContainer\", \"@FooContainer(value={@Foo(value=1), @Foo(value=2)})\", \"@Foo(value=3)\"}, "
                 + "getDeclAnnosVals = {"
-                +       "\"ExpectedBase\", \"ExpectedContainer\", \"@FooContainer(value=[@Foo(value=1), @Foo(value=2)])\", \"@Foo(value=3)\"},"
+                +       "\"ExpectedBase\", \"ExpectedContainer\", \"@FooContainer(value={@Foo(value=1), @Foo(value=2)})\", \"@Foo(value=3)\"},"
                 + "getDeclAnnoVal = \"@Foo(value=3)\","
                 + "getAnnosArgs = {\"@Foo(value=3)\"},"
                 + "getDeclAnnosArgs = {\"@Foo(value=3)\"})",
         "@ExpectedContainer(value=FooContainer.class, "
-                + "getAnnotationVal = \"@FooContainer(value=[@Foo(value=1), @Foo(value=2)])\", "
+                + "getAnnotationVal = \"@FooContainer(value={@Foo(value=1), @Foo(value=2)})\", "
                 + "getAnnotationsVals = {"
-                +       "\"ExpectedBase\", \"ExpectedContainer\", \"@FooContainer(value=[@Foo(value=1), @Foo(value=2)])\", \"@Foo(value=3)\"}, "
+                +       "\"ExpectedBase\", \"ExpectedContainer\", \"@FooContainer(value={@Foo(value=1), @Foo(value=2)})\", \"@Foo(value=3)\"}, "
                 + "getDeclAnnosVals = {"
-                +       "\"ExpectedBase\", \"ExpectedContainer\", \"@FooContainer(value=[@Foo(value=1), @Foo(value=2)])\", \"@Foo(value=3)\"},"
-                + "getDeclAnnoVal = \"@FooContainer(value=[@Foo(value=1), @Foo(value=2)])\","
-                + "getAnnosArgs = {\"@FooContainer(value=[@Foo(value=1), @Foo(value=2)])\"},"
-                + "getDeclAnnosArgs = {\"@FooContainer(value=[@Foo(value=1), @Foo(value=2)])\"})") {
+                +       "\"ExpectedBase\", \"ExpectedContainer\", \"@FooContainer(value={@Foo(value=1), @Foo(value=2)})\", \"@Foo(value=3)\"},"
+                + "getDeclAnnoVal = \"@FooContainer(value={@Foo(value=1), @Foo(value=2)})\","
+                + "getAnnosArgs = {\"@FooContainer(value={@Foo(value=1), @Foo(value=2)})\"},"
+                + "getDeclAnnosArgs = {\"@FooContainer(value={@Foo(value=1), @Foo(value=2)})\"})") {
 
             @Override
             public Iterable<? extends JavaFileObject> getTestFiles(SrcType srcType,
@@ -1077,18 +1077,18 @@
         BasicRepeatable(
         "@ExpectedBase(value=Foo.class, "
                 + "getAnnotationVal = \"NULL\", "
-                + "getAnnotationsVals = {\"ExpectedBase\", \"ExpectedContainer\", \"@FooContainer(value=[@Foo(value=1), @Foo(value=2)])\" }, "
-                + "getDeclAnnosVals = {\"ExpectedBase\", \"ExpectedContainer\", \"@FooContainer(value=[@Foo(value=1), @Foo(value=2)])\"},"
+                + "getAnnotationsVals = {\"ExpectedBase\", \"ExpectedContainer\", \"@FooContainer(value={@Foo(value=1), @Foo(value=2)})\" }, "
+                + "getDeclAnnosVals = {\"ExpectedBase\", \"ExpectedContainer\", \"@FooContainer(value={@Foo(value=1), @Foo(value=2)})\"},"
                 + "getDeclAnnoVal = \"NULL\","
                 + "getAnnosArgs = {\"@Foo(value=1)\", \"@Foo(value=2)\"},"
                 + "getDeclAnnosArgs = {\"@Foo(value=1)\", \"@Foo(value=2)\"})",
         "@ExpectedContainer(value=FooContainer.class, "
-                + "getAnnotationVal = \"@FooContainer(value=[@Foo(value=1), @Foo(value=2)])\","
-                + "getAnnotationsVals = {\"ExpectedBase\", \"ExpectedContainer\", \"@FooContainer(value=[@Foo(value=1), @Foo(value=2)])\"},"
-                + "getDeclAnnosVals = {\"ExpectedBase\", \"ExpectedContainer\", \"@FooContainer(value=[@Foo(value=1), @Foo(value=2)])\"}, "
-                + "getDeclAnnoVal = \"@FooContainer(value=[@Foo(value=1), @Foo(value=2)])\","
-                + "getAnnosArgs = {\"@FooContainer(value=[@Foo(value=1), @Foo(value=2)])\"},"
-                + "getDeclAnnosArgs = {\"@FooContainer(value=[@Foo(value=1), @Foo(value=2)])\"} )") {
+                + "getAnnotationVal = \"@FooContainer(value={@Foo(value=1), @Foo(value=2)})\","
+                + "getAnnotationsVals = {\"ExpectedBase\", \"ExpectedContainer\", \"@FooContainer(value={@Foo(value=1), @Foo(value=2)})\"},"
+                + "getDeclAnnosVals = {\"ExpectedBase\", \"ExpectedContainer\", \"@FooContainer(value={@Foo(value=1), @Foo(value=2)})\"}, "
+                + "getDeclAnnoVal = \"@FooContainer(value={@Foo(value=1), @Foo(value=2)})\","
+                + "getAnnosArgs = {\"@FooContainer(value={@Foo(value=1), @Foo(value=2)})\"},"
+                + "getDeclAnnosArgs = {\"@FooContainer(value={@Foo(value=1), @Foo(value=2)})\"} )") {
 
             @Override
             public Iterable<? extends JavaFileObject> getTestFiles(SrcType srcType,
@@ -1179,21 +1179,21 @@
         "@ExpectedBase(value=Foo.class, "
                 + "getAnnotationVal = \"NULL\", "
                 + "getAnnotationsVals = {"
-                +       "\"ExpectedBase\", \"ExpectedContainer\", \"@FooContainer(value=[@Foo(value=1), @Foo(value=2)])\"}, "
+                +       "\"ExpectedBase\", \"ExpectedContainer\", \"@FooContainer(value={@Foo(value=1), @Foo(value=2)})\"}, "
                 + "getDeclAnnosVals = {"
-                +       "\"ExpectedBase\", \"ExpectedContainer\", \"@FooContainer(value=[@Foo(value=1), @Foo(value=2)])\"},"
+                +       "\"ExpectedBase\", \"ExpectedContainer\", \"@FooContainer(value={@Foo(value=1), @Foo(value=2)})\"},"
                 + "getDeclAnnoVal = \"NULL\","
                 + "getAnnosArgs = {\"@Foo(value=1)\", \"@Foo(value=2)\"},"
                 + "getDeclAnnosArgs = {\"@Foo(value=1)\", \"@Foo(value=2)\"})",
         "@ExpectedContainer(value=FooContainer.class, "
-                + "getAnnotationVal = \"@FooContainer(value=[@Foo(value=1), @Foo(value=2)])\","
+                + "getAnnotationVal = \"@FooContainer(value={@Foo(value=1), @Foo(value=2)})\","
                 + "getAnnotationsVals = {"
-                +       "\"ExpectedBase\", \"ExpectedContainer\", \"@FooContainer(value=[@Foo(value=1), @Foo(value=2)])\"},"
+                +       "\"ExpectedBase\", \"ExpectedContainer\", \"@FooContainer(value={@Foo(value=1), @Foo(value=2)})\"},"
                 + "getDeclAnnosVals = {"
-                +       "\"ExpectedBase\", \"ExpectedContainer\", \"@FooContainer(value=[@Foo(value=1), @Foo(value=2)])\"}, "
-                + "getDeclAnnoVal = \"@FooContainer(value=[@Foo(value=1), @Foo(value=2)])\","
-                + "getAnnosArgs = {\"@FooContainer(value=[@Foo(value=1), @Foo(value=2)])\"},"
-                + "getDeclAnnosArgs = {\"@FooContainer(value=[@Foo(value=1), @Foo(value=2)])\"} )") {
+                +       "\"ExpectedBase\", \"ExpectedContainer\", \"@FooContainer(value={@Foo(value=1), @Foo(value=2)})\"}, "
+                + "getDeclAnnoVal = \"@FooContainer(value={@Foo(value=1), @Foo(value=2)})\","
+                + "getAnnosArgs = {\"@FooContainer(value={@Foo(value=1), @Foo(value=2)})\"},"
+                + "getDeclAnnosArgs = {\"@FooContainer(value={@Foo(value=1), @Foo(value=2)})\"} )") {
 
             @Override
             public Iterable<? extends JavaFileObject> getTestFiles(SrcType srcType,
@@ -1283,17 +1283,17 @@
         BasicContainerRepeatable_Inherited(
         "@ExpectedBase(value=Foo.class, "
                 + "getAnnotationVal = \"NULL\", "
-                + "getAnnotationsVals = {\"ExpectedBase\", \"ExpectedContainer\", \"@FooContainer(value=[@Foo(value=1), @Foo(value=2)])\"}, "
+                + "getAnnotationsVals = {\"ExpectedBase\", \"ExpectedContainer\", \"@FooContainer(value={@Foo(value=1), @Foo(value=2)})\"}, "
                 + "getDeclAnnosVals = {\"ExpectedBase\", \"ExpectedContainer\"}, "
                 + "getDeclAnnoVal = \"NULL\", "
                 + "getAnnosArgs = {\"@Foo(value=1)\", \"@Foo(value=2)\"}, "
                 + "getDeclAnnosArgs = {})",
         "@ExpectedContainer(value=FooContainer.class, "
-                + "getAnnotationVal = \"@FooContainer(value=[@Foo(value=1), @Foo(value=2)])\", "
-                + "getAnnotationsVals = {\"ExpectedBase\", \"ExpectedContainer\", \"@FooContainer(value=[@Foo(value=1), @Foo(value=2)])\"}, "
+                + "getAnnotationVal = \"@FooContainer(value={@Foo(value=1), @Foo(value=2)})\", "
+                + "getAnnotationsVals = {\"ExpectedBase\", \"ExpectedContainer\", \"@FooContainer(value={@Foo(value=1), @Foo(value=2)})\"}, "
                 + "getDeclAnnosVals = { \"ExpectedBase\", \"ExpectedContainer\"}, "
                 + "getDeclAnnoVal = \"NULL\", "
-                + "getAnnosArgs = {\"@FooContainer(value=[@Foo(value=1), @Foo(value=2)])\"}, "
+                + "getAnnosArgs = {\"@FooContainer(value={@Foo(value=1), @Foo(value=2)})\"}, "
                 + "getDeclAnnosArgs = {})") {
 
             @Override
@@ -1356,7 +1356,7 @@
         RepeatableAnnoInherited(
         "@ExpectedBase(value=Foo.class, "
                 + "getAnnotationVal = \"NULL\", "
-                + "getAnnotationsVals = {\"ExpectedBase\", \"ExpectedContainer\", \"@FooContainer(value=[@Foo(value=1), @Foo(value=2)])\"}, "
+                + "getAnnotationsVals = {\"ExpectedBase\", \"ExpectedContainer\", \"@FooContainer(value={@Foo(value=1), @Foo(value=2)})\"}, "
                 + "getDeclAnnosVals = {\"ExpectedBase\", \"ExpectedContainer\"}, "
                 + // ignores inherited annotations
                 "getDeclAnnoVal = \"NULL\", "
@@ -1364,13 +1364,13 @@
                 "getAnnosArgs = {\"@Foo(value=1)\", \"@Foo(value=2)\"}, "
                 + "getDeclAnnosArgs = {})", // ignores inherited
         "@ExpectedContainer(value=FooContainer.class, "
-                + "getAnnotationVal = \"@FooContainer(value=[@Foo(value=1), @Foo(value=2)])\", "
-                + "getAnnotationsVals = {\"ExpectedBase\", \"ExpectedContainer\", \"@FooContainer(value=[@Foo(value=1), @Foo(value=2)])\"}, "
+                + "getAnnotationVal = \"@FooContainer(value={@Foo(value=1), @Foo(value=2)})\", "
+                + "getAnnotationsVals = {\"ExpectedBase\", \"ExpectedContainer\", \"@FooContainer(value={@Foo(value=1), @Foo(value=2)})\"}, "
                 + "getDeclAnnosVals = { \"ExpectedBase\", \"ExpectedContainer\"}, "
                 + // ignores inherited annotations
                 "getDeclAnnoVal = \"NULL\", "
                 + // ignores inherited
-                "getAnnosArgs = {\"@FooContainer(value=[@Foo(value=1), @Foo(value=2)])\"}, "
+                "getAnnosArgs = {\"@FooContainer(value={@Foo(value=1), @Foo(value=2)})\"}, "
                 + "getDeclAnnosArgs = {})") { // ignores inherited
 
             @Override
@@ -1436,21 +1436,21 @@
         "@ExpectedBase(value=Foo.class, "
                 + "getAnnotationVal = \"@Foo(value=0)\", "
                 + "getAnnotationsVals = {"
-                +       "\"ExpectedBase\", \"ExpectedContainer\", \"@Foo(value=0)\", \"@FooContainer(value=[@Foo(value=1), @Foo(value=2)])\"},"
+                +       "\"ExpectedBase\", \"ExpectedContainer\", \"@Foo(value=0)\", \"@FooContainer(value={@Foo(value=1), @Foo(value=2)})\"},"
                 + "getDeclAnnosVals = {"
-                +       "\"ExpectedBase\", \"ExpectedContainer\", \"@Foo(value=0)\", \"@FooContainer(value=[@Foo(value=1), @Foo(value=2)])\"},"
+                +       "\"ExpectedBase\", \"ExpectedContainer\", \"@Foo(value=0)\", \"@FooContainer(value={@Foo(value=1), @Foo(value=2)})\"},"
                 + "getDeclAnnoVal = \"@Foo(value=0)\","
                 + "getAnnosArgs = {\"@Foo(value=0)\", \"@Foo(value=1)\", \"@Foo(value=2)\"},"
                 + "getDeclAnnosArgs = {\"@Foo(value=0)\", \"@Foo(value=1)\",\"@Foo(value=2)\"})",
         "@ExpectedContainer(value=FooContainer.class, "
-                + "getAnnotationVal = \"@FooContainer(value=[@Foo(value=1), @Foo(value=2)])\", "
+                + "getAnnotationVal = \"@FooContainer(value={@Foo(value=1), @Foo(value=2)})\", "
                 + "getAnnotationsVals = {"
-                +       "\"ExpectedBase\", \"ExpectedContainer\", \"@Foo(value=0)\", \"@FooContainer(value=[@Foo(value=1), @Foo(value=2)])\"},"
+                +       "\"ExpectedBase\", \"ExpectedContainer\", \"@Foo(value=0)\", \"@FooContainer(value={@Foo(value=1), @Foo(value=2)})\"},"
                 + "getDeclAnnosVals = {"
-                +       "\"ExpectedBase\", \"ExpectedContainer\", \"@Foo(value=0)\", \"@FooContainer(value=[@Foo(value=1), @Foo(value=2)])\"}, "
-                + "getDeclAnnoVal = \"@FooContainer(value=[@Foo(value=1), @Foo(value=2)])\","
-                + "getDeclAnnosArgs = {\"@FooContainer(value=[@Foo(value=1), @Foo(value=2)])\"},"
-                + "getAnnosArgs = {\"@FooContainer(value=[@Foo(value=1), @Foo(value=2)])\"})") {
+                +       "\"ExpectedBase\", \"ExpectedContainer\", \"@Foo(value=0)\", \"@FooContainer(value={@Foo(value=1), @Foo(value=2)})\"}, "
+                + "getDeclAnnoVal = \"@FooContainer(value={@Foo(value=1), @Foo(value=2)})\","
+                + "getDeclAnnosArgs = {\"@FooContainer(value={@Foo(value=1), @Foo(value=2)})\"},"
+                + "getAnnosArgs = {\"@FooContainer(value={@Foo(value=1), @Foo(value=2)})\"})") {
 
             @Override
             public Iterable<? extends JavaFileObject> getTestFiles(SrcType srcType,
@@ -1624,7 +1624,7 @@
         "@ExpectedBase(value=Foo.class, "
                 + "getAnnotationVal = \"@Foo(value=3)\", "
                 + "getAnnotationsVals = {"
-                + "\"ExpectedBase\", \"ExpectedContainer\", \"@Foo(value=3)\", \"@FooContainer(value=[@Foo(value=1), @Foo(value=2)])\"}, "
+                + "\"ExpectedBase\", \"ExpectedContainer\", \"@Foo(value=3)\", \"@FooContainer(value={@Foo(value=1), @Foo(value=2)})\"}, "
                 + //override every annotation on superClass
                 "getDeclAnnosVals = {\"ExpectedBase\", \"ExpectedContainer\", \"@Foo(value=3)\"}, "
                 + // ignores inherited annotations
@@ -1632,13 +1632,13 @@
                 + "getAnnosArgs = {\"@Foo(value=3)\"}, "
                 + "getDeclAnnosArgs = { \"@Foo(value=3)\" })", // ignores inherited
         "@ExpectedContainer(value=FooContainer.class, "
-                + "getAnnotationVal = \"@FooContainer(value=[@Foo(value=1), @Foo(value=2)])\", "
+                + "getAnnotationVal = \"@FooContainer(value={@Foo(value=1), @Foo(value=2)})\", "
                 + "getAnnotationsVals = {"
-                + "\"ExpectedBase\", \"ExpectedContainer\", \"@Foo(value=3)\", \"@FooContainer(value=[@Foo(value=1), @Foo(value=2)])\"}, "
+                + "\"ExpectedBase\", \"ExpectedContainer\", \"@Foo(value=3)\", \"@FooContainer(value={@Foo(value=1), @Foo(value=2)})\"}, "
                 + "getDeclAnnosVals = {\"ExpectedBase\", \"ExpectedContainer\", \"@Foo(value=3)\"}, "
                 + // ignores inherited annotations
                 "getDeclAnnoVal = \"NULL\", "
-                + "getAnnosArgs = {\"@FooContainer(value=[@Foo(value=1), @Foo(value=2)])\"}, "
+                + "getAnnosArgs = {\"@FooContainer(value={@Foo(value=1), @Foo(value=2)})\"}, "
                 + "getDeclAnnosArgs = {}) // ignores inherited ") {
 
             @Override
@@ -1704,22 +1704,22 @@
         "@ExpectedBase(value=Foo.class, "
                 + "getAnnotationVal = \"@Foo(value=0)\", "
                 + "getAnnotationsVals = {"
-                + "\"ExpectedBase\", \"ExpectedContainer\", \"@Foo(value=0)\", \"@FooContainer(value=[@Foo(value=1), @Foo(value=2)])\"}, "
+                + "\"ExpectedBase\", \"ExpectedContainer\", \"@Foo(value=0)\", \"@FooContainer(value={@Foo(value=1), @Foo(value=2)})\"}, "
                 + //override every annotation on superClass
-                "getDeclAnnosVals = {\"ExpectedBase\", \"ExpectedContainer\", \"@FooContainer(value=[@Foo(value=1), @Foo(value=2)])\"}, "
+                "getDeclAnnosVals = {\"ExpectedBase\", \"ExpectedContainer\", \"@FooContainer(value={@Foo(value=1), @Foo(value=2)})\"}, "
                 + // ignores inherited annotations
                 "getDeclAnnoVal = \"NULL\","// ignores inherited
                 + "getAnnosArgs = {\"@Foo(value=1)\", \"@Foo(value=2)\"}, "
                 + "getDeclAnnosArgs = { \"@Foo(value=1)\", \"@Foo(value=2)\"})",
         "@ExpectedContainer(value=FooContainer.class, "
-                + "getAnnotationVal = \"@FooContainer(value=[@Foo(value=1), @Foo(value=2)])\", "
+                + "getAnnotationVal = \"@FooContainer(value={@Foo(value=1), @Foo(value=2)})\", "
                 + "getAnnotationsVals = {"
-                + "\"ExpectedBase\", \"ExpectedContainer\", \"@Foo(value=0)\", \"@FooContainer(value=[@Foo(value=1), @Foo(value=2)])\"}, "
-                + "getDeclAnnosVals = {\"ExpectedBase\", \"ExpectedContainer\", \"@FooContainer(value=[@Foo(value=1), @Foo(value=2)])\"}, "
+                + "\"ExpectedBase\", \"ExpectedContainer\", \"@Foo(value=0)\", \"@FooContainer(value={@Foo(value=1), @Foo(value=2)})\"}, "
+                + "getDeclAnnosVals = {\"ExpectedBase\", \"ExpectedContainer\", \"@FooContainer(value={@Foo(value=1), @Foo(value=2)})\"}, "
                 + // ignores inherited annotations
-                "getDeclAnnoVal = \"@FooContainer(value=[@Foo(value=1), @Foo(value=2)])\", "// ignores inherited
-                + "getAnnosArgs = {\"@FooContainer(value=[@Foo(value=1), @Foo(value=2)])\"}, "
-                + "getDeclAnnosArgs = {\"@FooContainer(value=[@Foo(value=1), @Foo(value=2)])\"})") {
+                "getDeclAnnoVal = \"@FooContainer(value={@Foo(value=1), @Foo(value=2)})\", "// ignores inherited
+                + "getAnnosArgs = {\"@FooContainer(value={@Foo(value=1), @Foo(value=2)})\"}, "
+                + "getDeclAnnosArgs = {\"@FooContainer(value={@Foo(value=1), @Foo(value=2)})\"})") {
 
             @Override
             public Iterable<? extends JavaFileObject> getTestFiles(SrcType srcType,
@@ -1785,18 +1785,18 @@
         "@ExpectedBase(value=Foo.class, "
                 + "getAnnotationVal = \"@Foo(value=0)\", "
                 + "getAnnotationsVals = {"
-                + "\"ExpectedBase\", \"ExpectedContainer\", \"@Foo(value=0)\", \"@FooContainer(value=[@Foo(value=1), @Foo(value=2)])\"}, "
+                + "\"ExpectedBase\", \"ExpectedContainer\", \"@Foo(value=0)\", \"@FooContainer(value={@Foo(value=1), @Foo(value=2)})\"}, "
                 + "getDeclAnnosVals = {\"ExpectedBase\", \"ExpectedContainer\", \"@Foo(value=0)\"},"
                 + "getDeclAnnoVal = \"@Foo(value=0)\","
                 + "getAnnosArgs = {\"@Foo(value=0)\"},"
                 + "getDeclAnnosArgs = {\"@Foo(value=0)\"})",
         "@ExpectedContainer(value=FooContainer.class, "
-                + "getAnnotationVal = \"@FooContainer(value=[@Foo(value=1), @Foo(value=2)])\", "
+                + "getAnnotationVal = \"@FooContainer(value={@Foo(value=1), @Foo(value=2)})\", "
                 + "getAnnotationsVals = {"
-                + "\"ExpectedBase\", \"ExpectedContainer\", \"@Foo(value=0)\", \"@FooContainer(value=[@Foo(value=1), @Foo(value=2)])\"}, "
+                + "\"ExpectedBase\", \"ExpectedContainer\", \"@Foo(value=0)\", \"@FooContainer(value={@Foo(value=1), @Foo(value=2)})\"}, "
                 + "getDeclAnnosVals = {\"ExpectedBase\", \"ExpectedContainer\", \"@Foo(value=0)\"},"
                 + "getDeclAnnoVal = \"NULL\","
-                + "getAnnosArgs = {\"@FooContainer(value=[@Foo(value=1), @Foo(value=2)])\"},"
+                + "getAnnosArgs = {\"@FooContainer(value={@Foo(value=1), @Foo(value=2)})\"},"
                 + "getDeclAnnosArgs = {})") {
 
             @Override
@@ -1863,19 +1863,19 @@
         "@ExpectedBase(value=Foo.class, "
                 + "getAnnotationVal = \"@Foo(value=0)\", "
                 + "getAnnotationsVals = {"
-                + "\"ExpectedBase\", \"ExpectedContainer\", \"@Foo(value=0)\", \"@FooContainer(value=[@Foo(value=1), @Foo(value=2)])\"}, "
-                + "getDeclAnnosVals = {\"ExpectedBase\", \"ExpectedContainer\", \"@FooContainer(value=[@Foo(value=1), @Foo(value=2)])\"},"
+                + "\"ExpectedBase\", \"ExpectedContainer\", \"@Foo(value=0)\", \"@FooContainer(value={@Foo(value=1), @Foo(value=2)})\"}, "
+                + "getDeclAnnosVals = {\"ExpectedBase\", \"ExpectedContainer\", \"@FooContainer(value={@Foo(value=1), @Foo(value=2)})\"},"
                 + "getDeclAnnoVal = \"NULL\","
                 + "getAnnosArgs = {\"@Foo(value=1)\", \"@Foo(value=2)\"},"
                 + "getDeclAnnosArgs = {\"@Foo(value=1)\", \"@Foo(value=2)\"})",
         "@ExpectedContainer(value=FooContainer.class, "
-                + "getAnnotationVal = \"@FooContainer(value=[@Foo(value=1), @Foo(value=2)])\", "
+                + "getAnnotationVal = \"@FooContainer(value={@Foo(value=1), @Foo(value=2)})\", "
                 + "getAnnotationsVals = {"
-                + "\"ExpectedBase\", \"ExpectedContainer\", \"@Foo(value=0)\", \"@FooContainer(value=[@Foo(value=1), @Foo(value=2)])\"}, "
-                + "getDeclAnnosVals = {\"ExpectedBase\", \"ExpectedContainer\", \"@FooContainer(value=[@Foo(value=1), @Foo(value=2)])\"},"
-                + "getDeclAnnoVal = \"@FooContainer(value=[@Foo(value=1), @Foo(value=2)])\","
-                + "getAnnosArgs = {\"@FooContainer(value=[@Foo(value=1), @Foo(value=2)])\"},"
-                + "getDeclAnnosArgs = {\"@FooContainer(value=[@Foo(value=1), @Foo(value=2)])\"})") {
+                + "\"ExpectedBase\", \"ExpectedContainer\", \"@Foo(value=0)\", \"@FooContainer(value={@Foo(value=1), @Foo(value=2)})\"}, "
+                + "getDeclAnnosVals = {\"ExpectedBase\", \"ExpectedContainer\", \"@FooContainer(value={@Foo(value=1), @Foo(value=2)})\"},"
+                + "getDeclAnnoVal = \"@FooContainer(value={@Foo(value=1), @Foo(value=2)})\","
+                + "getAnnosArgs = {\"@FooContainer(value={@Foo(value=1), @Foo(value=2)})\"},"
+                + "getDeclAnnosArgs = {\"@FooContainer(value={@Foo(value=1), @Foo(value=2)})\"})") {
 
             @Override
             public Iterable<? extends JavaFileObject> getTestFiles(SrcType srcType,
@@ -1941,21 +1941,21 @@
         "@ExpectedBase(value=Foo.class, "
                 + "getAnnotationVal = \"@Foo(value=3)\", "
                 + "getAnnotationsVals = {"
-                +       "\"ExpectedBase\", \"ExpectedContainer\", \"@FooContainer(value=[@Foo(value=1), @Foo(value=2)])\", \"@Foo(value=3)\"}, "
+                +       "\"ExpectedBase\", \"ExpectedContainer\", \"@FooContainer(value={@Foo(value=1), @Foo(value=2)})\", \"@Foo(value=3)\"}, "
                 + "getDeclAnnosVals = {"
-                +       "\"ExpectedBase\", \"ExpectedContainer\", \"@FooContainer(value=[@Foo(value=1), @Foo(value=2)])\", \"@Foo(value=3)\"},"
+                +       "\"ExpectedBase\", \"ExpectedContainer\", \"@FooContainer(value={@Foo(value=1), @Foo(value=2)})\", \"@Foo(value=3)\"},"
                 + "getDeclAnnoVal = \"@Foo(value=3)\","
                 + "getAnnosArgs = {\"@Foo(value=1)\", \"@Foo(value=2)\", \"@Foo(value=3)\"},"
                 + "getDeclAnnosArgs = {\"@Foo(value=1)\", \"@Foo(value=2)\", \"@Foo(value=3)\"})",
         "@ExpectedContainer(value=FooContainer.class, "
-                + "getAnnotationVal = \"@FooContainer(value=[@Foo(value=1), @Foo(value=2)])\", "
+                + "getAnnotationVal = \"@FooContainer(value={@Foo(value=1), @Foo(value=2)})\", "
                 + "getAnnotationsVals = {"
-                +       "\"ExpectedBase\", \"ExpectedContainer\", \"@FooContainer(value=[@Foo(value=1), @Foo(value=2)])\", \"@Foo(value=3)\"}, "
+                +       "\"ExpectedBase\", \"ExpectedContainer\", \"@FooContainer(value={@Foo(value=1), @Foo(value=2)})\", \"@Foo(value=3)\"}, "
                 + "getDeclAnnosVals = {"
-                +       "\"ExpectedBase\", \"ExpectedContainer\", \"@FooContainer(value=[@Foo(value=1), @Foo(value=2)])\", \"@Foo(value=3)\"},"
-                + "getDeclAnnoVal = \"@FooContainer(value=[@Foo(value=1), @Foo(value=2)])\","
-                + "getAnnosArgs = {\"@FooContainer(value=[@Foo(value=1), @Foo(value=2)])\"},"
-                + "getDeclAnnosArgs = {\"@FooContainer(value=[@Foo(value=1), @Foo(value=2)])\"})") {
+                +       "\"ExpectedBase\", \"ExpectedContainer\", \"@FooContainer(value={@Foo(value=1), @Foo(value=2)})\", \"@Foo(value=3)\"},"
+                + "getDeclAnnoVal = \"@FooContainer(value={@Foo(value=1), @Foo(value=2)})\","
+                + "getAnnosArgs = {\"@FooContainer(value={@Foo(value=1), @Foo(value=2)})\"},"
+                + "getDeclAnnosArgs = {\"@FooContainer(value={@Foo(value=1), @Foo(value=2)})\"})") {
 
             @Override
             public Iterable<? extends JavaFileObject> getTestFiles(SrcType srcType,
@@ -2021,18 +2021,18 @@
         "@ExpectedBase(value=Foo.class, "
                 + "getAnnotationVal = \"@Foo(value=0)\", "
                 + "getAnnotationsVals = {"
-                + "\"ExpectedBase\", \"ExpectedContainer\", \"@Foo(value=0)\", \"@FooContainer(value=[@Foo(value=1), @Foo(value=2)])\"}, "
+                + "\"ExpectedBase\", \"ExpectedContainer\", \"@Foo(value=0)\", \"@FooContainer(value={@Foo(value=1), @Foo(value=2)})\"}, "
                 + "getDeclAnnosVals = {\"ExpectedBase\", \"ExpectedContainer\", \"@Foo(value=0)\"},"
                 + "getDeclAnnoVal = \"@Foo(value=0)\","
                 + "getAnnosArgs = {\"@Foo(value=0)\"},"
                 + "getDeclAnnosArgs = {\"@Foo(value=0)\"})",
         "@ExpectedContainer(value=FooContainer.class, "
-                + "getAnnotationVal = \"@FooContainer(value=[@Foo(value=1), @Foo(value=2)])\", "
+                + "getAnnotationVal = \"@FooContainer(value={@Foo(value=1), @Foo(value=2)})\", "
                 + "getAnnotationsVals = {"
-                + "\"ExpectedBase\", \"ExpectedContainer\", \"@Foo(value=0)\", \"@FooContainer(value=[@Foo(value=1), @Foo(value=2)])\"}, "
+                + "\"ExpectedBase\", \"ExpectedContainer\", \"@Foo(value=0)\", \"@FooContainer(value={@Foo(value=1), @Foo(value=2)})\"}, "
                 + "getDeclAnnosVals = {\"ExpectedBase\", \"ExpectedContainer\", \"@Foo(value=0)\"},"
                 + "getDeclAnnoVal = \"NULL\","
-                + "getAnnosArgs = {\"@FooContainer(value=[@Foo(value=1), @Foo(value=2)])\"},"
+                + "getAnnosArgs = {\"@FooContainer(value={@Foo(value=1), @Foo(value=2)})\"},"
                 + "getDeclAnnosArgs = {})") {
 
             @Override
diff --git a/langtools/test/tools/javac/lib/DPrinter.java b/langtools/test/tools/javac/lib/DPrinter.java
index 49320b1..2aaa848 100644
--- a/langtools/test/tools/javac/lib/DPrinter.java
+++ b/langtools/test/tools/javac/lib/DPrinter.java
@@ -138,7 +138,7 @@
 
     protected DPrinter(Context context) {
         context.put(DPrinter.class, this);
-        out = context.get(Log.outKey);
+        out = context.get(Log.logKey).getWriter(Log.WriterKind.STDERR);
         trees = JavacTrees.instance(context);
     }
 
diff --git a/langtools/test/tools/javac/lib/combo/ReusableContext.java b/langtools/test/tools/javac/lib/combo/ReusableContext.java
index 2d24145..7550c76 100644
--- a/langtools/test/tools/javac/lib/combo/ReusableContext.java
+++ b/langtools/test/tools/javac/lib/combo/ReusableContext.java
@@ -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
@@ -83,6 +83,7 @@
         drop(Arguments.argsKey);
         drop(DiagnosticListener.class);
         drop(Log.outKey);
+        drop(Log.errKey);
         drop(JavaFileManager.class);
         drop(JavacTask.class);
 
diff --git a/langtools/test/tools/javac/main/StreamsTest.java b/langtools/test/tools/javac/main/StreamsTest.java
new file mode 100644
index 0000000..a47e98f
--- /dev/null
+++ b/langtools/test/tools/javac/main/StreamsTest.java
@@ -0,0 +1,155 @@
+/*
+ * 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.
+ */
+
+/*
+ * @test
+ * @bug 8162359
+ * @summary extra space in javac -help for -J and @ options
+ * @modules jdk.compiler
+ * @library /tools/lib
+ * @build toolbox.TestRunner toolbox.ToolBox
+ * @run main StreamsTest
+ */
+
+import java.io.ByteArrayOutputStream;
+import java.io.IOException;
+import java.io.PrintStream;
+import java.nio.file.Path;
+import java.nio.file.Paths;
+import java.util.List;
+
+import static java.util.Arrays.asList;
+
+import toolbox.TestRunner;
+import toolbox.ToolBox;
+
+public class StreamsTest extends TestRunner {
+    public static void main(String... args) throws Exception {
+        new StreamsTest().runTests(m -> new Object[] { Paths.get(m.getName()) });
+    }
+
+    StreamsTest() {
+        super(System.err);
+    }
+
+    ToolBox tb = new ToolBox();
+    static final String LINESEP = System.getProperty("line.separator");
+
+    @Test // errors should be written to stderr
+    public void testError(Path base) throws Exception {
+        Path src = base.resolve("src");
+        Path classes = base.resolve("classes");
+        tb.writeJavaFiles(src,
+            "import java.util.*; class C { # }");
+        test(asList("-d", classes.toString(), src.resolve("C.java").toString()),
+                null, "illegal character: '#'");
+    }
+
+    @Test // warnings should be written to stderr
+    public void testWarning(Path base) throws Exception {
+        Path src = base.resolve("src");
+        Path classes = base.resolve("classes");
+        tb.writeJavaFiles(src,
+            "import java.util.*; class C { List list = new ArrayList(); }");
+        test(asList("-d", classes.toString(), "-Xlint", src.resolve("C.java").toString()),
+                null, "warning: [rawtypes]");
+    }
+
+    @Test // notes should be written to stderr
+    public void testNote(Path base) throws Exception {
+        Path src = base.resolve("src");
+        Path classes = base.resolve("classes");
+        tb.writeJavaFiles(src,
+            "import java.util.*; class C { List<String> list = (List<String>) new ArrayList(); }");
+        test(asList("-d", classes.toString(), src.resolve("C.java").toString()),
+                null, "uses unchecked or unsafe operations.");
+    }
+
+    @Test // help output should be written to stdout
+    public void testHelp(Path base) throws Exception {
+        test(asList("-help"), "Usage: javac <options> <source files>", null);
+    }
+
+    @Test // version output should be written to stdout
+    public void testVersion(Path base) throws Exception {
+        test(asList("-version"), "javac", null);
+    }
+
+    @Test // version output should be written to stdout
+    public void testFullVersion(Path base) throws Exception {
+        test(asList("-fullversion"), "javac full version", null);
+    }
+
+    /**
+     * Run javac as though run from the command line (but avoiding the entry point that
+     * calls System.exit()), and that that expected output appears on appropriate output streams.
+     * @param options the command-line options for javac
+     * @param expectOut a string that should be contained in the output generated on stdout,
+     *      or null, if no output should be generated to stdout
+     * @param expectErra string that should be contained in the output generated on stderr,
+     *      or null, if no output should be generated to stderr
+     * @throws IOException if a problem occurs while setting up the streams
+     */
+    void test(List<String> options, String expectOut, String expectErr) throws IOException {
+        out.println("test " + options);
+        ByteArrayOutputStream bsOut = new ByteArrayOutputStream();
+        ByteArrayOutputStream bsErr = new ByteArrayOutputStream();
+        try (PrintStream psOut = new PrintStream(bsOut); PrintStream psErr = new PrintStream(bsErr)) {
+            int rc;
+            PrintStream saveOut = System.out;
+            PrintStream saveErr = System.err;
+            try {
+                System.setOut(psOut);
+                System.setErr(psErr);
+                rc = com.sun.tools.javac.Main.compile(options.toArray(new String[0]));
+            } finally {
+                System.setErr(saveErr);
+                System.setOut(saveOut);
+            }
+            System.err.println("javac exit code: " + rc);
+        }
+        check("stdout", bsOut.toString(), expectOut);
+        check("stderr", bsErr.toString(), expectErr);
+    }
+
+    /**
+     * Check that output is as expected.
+     * @param name the name of the stream on which the output was found
+     * @param actual the contents written to the stream
+     * @param expect string that should be contained in the output, or null, if the output should be empty
+     */
+    void check(String name, String actual, String expect) {
+        out.println("Check " + name);
+        out.println("Expected: " + (expect == null ? "(nothing)" : expect));
+        out.println("Actual:");
+        out.println(actual.replace("\n", LINESEP));
+        if (expect == null) {
+            if (!actual.isEmpty()) {
+                error(name + ": unexpected output");
+            }
+        } else if (!actual.contains(expect)) {
+            error(name + ": expected output not found");
+        }
+    }
+}
+
diff --git a/langtools/test/tools/javac/modules/ModuleTestBase.java b/langtools/test/tools/javac/modules/ModuleTestBase.java
index d1dcfa9..8da371c 100644
--- a/langtools/test/tools/javac/modules/ModuleTestBase.java
+++ b/langtools/test/tools/javac/modules/ModuleTestBase.java
@@ -71,10 +71,4 @@
     Path[] findJavaFiles(Path... paths) throws IOException {
         return tb.findJavaFiles(paths);
     }
-
-    void error(String message) {
-        out.println("Error: " + message);
-        errors++;
-    }
-
 }
diff --git a/langtools/test/tools/javac/newlines/NewLineTest.java b/langtools/test/tools/javac/newlines/NewLineTest.java
index 280e157..b1567d3 100644
--- a/langtools/test/tools/javac/newlines/NewLineTest.java
+++ b/langtools/test/tools/javac/newlines/NewLineTest.java
@@ -42,17 +42,23 @@
 import toolbox.ToolBox;
 
 //original test: test/tools/javac/newlines/Newlines.sh
+/*
+ * Checks that the usage message, contained in the properties in the
+ * resource file javac.properties, is correctly rendered, including
+ * embedded newlines in the resource strings. For more context,
+ * see JDK-4110560.
+ */
 public class NewLineTest {
 
     public static void main(String args[]) throws Exception {
         ToolBox tb = new ToolBox();
-        File javacErrOutput = new File("output.txt");
+        File javacOutput = new File("output.txt");
         new JavacTask(tb, Task.Mode.EXEC)
-                .redirect(Task.OutputKind.STDERR, javacErrOutput.getPath())
+                .redirect(Task.OutputKind.STDOUT, javacOutput.getPath())
                 .options("-J-Dline.separator='@'")
                 .run(Task.Expect.FAIL);
 
-        List<String> lines = Files.readAllLines(javacErrOutput.toPath(),
+        List<String> lines = Files.readAllLines(javacOutput.toPath(),
                 Charset.defaultCharset());
         if (lines.size() != 1) {
             throw new AssertionError("The compiler output should have one line only");
diff --git a/langtools/test/tools/javac/processing/model/element/TestMissingElement/TestMissingElement.java b/langtools/test/tools/javac/processing/model/element/TestMissingElement/TestMissingElement.java
index c22dfcb..c6014ae 100644
--- a/langtools/test/tools/javac/processing/model/element/TestMissingElement/TestMissingElement.java
+++ b/langtools/test/tools/javac/processing/model/element/TestMissingElement/TestMissingElement.java
@@ -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
@@ -49,7 +49,7 @@
     @Override
     public void init(ProcessingEnvironment env) {
         super.init(env);
-        out = ((JavacProcessingEnvironment) env).getContext().get(Log.outKey);
+        out = ((JavacProcessingEnvironment) env).getContext().get(Log.logKey).getWriter(Log.WriterKind.STDERR);
     }
 
     @Override
diff --git a/langtools/test/tools/javac/processing/model/element/repeatingAnnotations/MixRepeatableAndOfficialContainerBasicTest.java b/langtools/test/tools/javac/processing/model/element/repeatingAnnotations/MixRepeatableAndOfficialContainerBasicTest.java
index d1f2a3c..10dc03a 100644
--- a/langtools/test/tools/javac/processing/model/element/repeatingAnnotations/MixRepeatableAndOfficialContainerBasicTest.java
+++ b/langtools/test/tools/javac/processing/model/element/repeatingAnnotations/MixRepeatableAndOfficialContainerBasicTest.java
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2013, 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2013, 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
@@ -23,7 +23,7 @@
 
 /*
  * @test
- * @bug     8004822
+ * @bug     8004822 8163113
  * @author  mnunez
  * @summary Language model api test basics for repeating annotations
  * @library /tools/javac/lib
@@ -57,8 +57,8 @@
         })
 @ExpectedContainer(
         value = BarContainer.class,
-        getAnnotation = "@BarContainer(value=[@Bar(value=1), @Bar(value=2)])",
-        getAnnotationsByType = {"@BarContainer(value=[@Bar(value=1), @Bar(value=2)])"})
+        getAnnotation = "@BarContainer(value={@Bar(value=1), @Bar(value=2)})",
+        getAnnotationsByType = {"@BarContainer(value={@Bar(value=1), @Bar(value=2)})"})
 @Bar(value = 0)
 @BarContainer(value = {@Bar(value = 1), @Bar(value = 2)})
 class MixRepeatableAndOfficialContainerBasicTest {
@@ -85,8 +85,8 @@
             })
     @ExpectedContainer(
             value = BarContainer.class,
-            getAnnotation = "@BarContainer(value=[@Bar(value=1), @Bar(value=2)])",
-            getAnnotationsByType = {"@BarContainer(value=[@Bar(value=1), @Bar(value=2)])"})
+            getAnnotation = "@BarContainer(value={@Bar(value=1), @Bar(value=2)})",
+            getAnnotationsByType = {"@BarContainer(value={@Bar(value=1), @Bar(value=2)})"})
     @Bar(value = 0)
     @BarContainer(value = {@Bar(value = 1), @Bar(value = 2)})
     int testField = 0;
@@ -113,8 +113,8 @@
             })
     @ExpectedContainer(
             value = BarContainer.class,
-            getAnnotation = "@BarContainer(value=[@Bar(value=1), @Bar(value=2)])",
-            getAnnotationsByType = {"@BarContainer(value=[@Bar(value=1), @Bar(value=2)])"})
+            getAnnotation = "@BarContainer(value={@Bar(value=1), @Bar(value=2)})",
+            getAnnotationsByType = {"@BarContainer(value={@Bar(value=1), @Bar(value=2)})"})
     @Bar(value = 0)
     @BarContainer(value = {@Bar(value = 1), @Bar(value = 2)})
     void testMethod() {}
diff --git a/langtools/test/tools/javac/processing/model/element/repeatingAnnotations/MixRepeatableAndOfficialContainerInheritedA1Test.java b/langtools/test/tools/javac/processing/model/element/repeatingAnnotations/MixRepeatableAndOfficialContainerInheritedA1Test.java
index 5abbdc7..541aff0 100644
--- a/langtools/test/tools/javac/processing/model/element/repeatingAnnotations/MixRepeatableAndOfficialContainerInheritedA1Test.java
+++ b/langtools/test/tools/javac/processing/model/element/repeatingAnnotations/MixRepeatableAndOfficialContainerInheritedA1Test.java
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2013, 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2013, 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
@@ -23,7 +23,7 @@
 
 /*
  * @test
- * @bug     8004822 8007961
+ * @bug     8004822 8007961 8163113
  * @author  mnunez
  * @summary Language model api test basics for repeating annotations
  * @library /tools/javac/lib
@@ -59,8 +59,8 @@
 @ExpectedContainer(
         value = BarInheritedContainer.class,
         getAnnotation = "@BarInheritedContainer("
-        + "value=[@BarInherited(value=1), @BarInherited(value=2)])",
+        + "value={@BarInherited(value=1), @BarInherited(value=2)})",
         getAnnotationsByType = {"@BarInheritedContainer("
-                + "value=[@BarInherited(value=1), @BarInherited(value=2)])"})
+                + "value={@BarInherited(value=1), @BarInherited(value=2)})"})
 @BarInheritedContainer(value = {@BarInherited(value = 1), @BarInherited(value = 2)})
 class MixRepeatableAndOfficialContainerInheritedA1Test extends E {}
diff --git a/langtools/test/tools/javac/processing/model/element/repeatingAnnotations/MixRepeatableAndOfficialContainerInheritedA2Test.java b/langtools/test/tools/javac/processing/model/element/repeatingAnnotations/MixRepeatableAndOfficialContainerInheritedA2Test.java
index 639a056..9330661 100644
--- a/langtools/test/tools/javac/processing/model/element/repeatingAnnotations/MixRepeatableAndOfficialContainerInheritedA2Test.java
+++ b/langtools/test/tools/javac/processing/model/element/repeatingAnnotations/MixRepeatableAndOfficialContainerInheritedA2Test.java
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2013, 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2013, 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
@@ -23,7 +23,7 @@
 
 /*
  * @test
- * @bug     8004822
+ * @bug     8004822 8163113
  * @author  mnunez
  * @summary Language model api test basics for repeating annotations
  * @library /tools/javac/lib
@@ -61,9 +61,9 @@
 @ExpectedContainer(
         value = BarInheritedContainer.class,
         getAnnotation = "@BarInheritedContainer("
-        + "value=[@BarInherited(value=1), @BarInherited(value=2)])",
+        + "value={@BarInherited(value=1), @BarInherited(value=2)})",
         getAnnotationsByType = {"@BarInheritedContainer("
-                + "value=[@BarInherited(value=1), @BarInherited(value=2)])"})
+                + "value={@BarInherited(value=1), @BarInherited(value=2)})"})
 @BarInheritedContainer(value = {@BarInherited(value = 1), @BarInherited(value = 2)})
 @BarInherited(value = 3)
 class MixRepeatableAndOfficialContainerInheritedA2Test extends N {}
diff --git a/langtools/test/tools/javac/processing/model/element/repeatingAnnotations/MixRepeatableAndOfficialContainerInheritedB1Test.java b/langtools/test/tools/javac/processing/model/element/repeatingAnnotations/MixRepeatableAndOfficialContainerInheritedB1Test.java
index 8cfdde7..13339a4 100644
--- a/langtools/test/tools/javac/processing/model/element/repeatingAnnotations/MixRepeatableAndOfficialContainerInheritedB1Test.java
+++ b/langtools/test/tools/javac/processing/model/element/repeatingAnnotations/MixRepeatableAndOfficialContainerInheritedB1Test.java
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2013, 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2013, 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
@@ -23,7 +23,7 @@
 
 /*
  * @test
- * @bug     8004822 8007961
+ * @bug     8004822 8007961 8163113
  * @author  mnunez
  * @summary Language model api test basics for repeating annotations
  * @library /tools/javac/lib
@@ -56,8 +56,8 @@
 @ExpectedContainer(
         value = BarInheritedContainer.class,
         getAnnotation = "@BarInheritedContainer("
-        + "value=[@BarInherited(value=1), @BarInherited(value=2)])",
+        + "value={@BarInherited(value=1), @BarInherited(value=2)})",
         getAnnotationsByType = {"@BarInheritedContainer("
-                + "value=[@BarInherited(value=1), @BarInherited(value=2)])"})
+                + "value={@BarInherited(value=1), @BarInherited(value=2)})"})
 @BarInherited(value = 0)
 class MixRepeatableAndOfficialContainerInheritedB1Test extends M {}
diff --git a/langtools/test/tools/javac/processing/model/element/repeatingAnnotations/MixRepeatableAndOfficialContainerInheritedB2Test.java b/langtools/test/tools/javac/processing/model/element/repeatingAnnotations/MixRepeatableAndOfficialContainerInheritedB2Test.java
index 44c373d..ba0991f 100644
--- a/langtools/test/tools/javac/processing/model/element/repeatingAnnotations/MixRepeatableAndOfficialContainerInheritedB2Test.java
+++ b/langtools/test/tools/javac/processing/model/element/repeatingAnnotations/MixRepeatableAndOfficialContainerInheritedB2Test.java
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2013, 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2013, 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
@@ -23,7 +23,7 @@
 
 /*
  * @test
- * @bug     8004822 8007961
+ * @bug     8004822 8007961 8163113
  * @author  mnunez
  * @summary Language model api test basics for repeating annotations
  * @library /tools/javac/lib
@@ -57,8 +57,8 @@
 @ExpectedContainer(
         value = BarInheritedContainer.class,
         getAnnotation = "@BarInheritedContainer("
-        + "value=[@BarInherited(value=1), @BarInherited(value=2)])",
+        + "value={@BarInherited(value=1), @BarInherited(value=2)})",
         getAnnotationsByType = {"@BarInheritedContainer("
-                + "value=[@BarInherited(value=1), @BarInherited(value=2)])"})
+                + "value={@BarInherited(value=1), @BarInherited(value=2)})"})
 @BarInherited(value = 0)
 class MixRepeatableAndOfficialContainerInheritedB2Test extends H {}
diff --git a/langtools/test/tools/javac/processing/model/element/repeatingAnnotations/MixSingularAndUnofficialContainerBasicTest.java b/langtools/test/tools/javac/processing/model/element/repeatingAnnotations/MixSingularAndUnofficialContainerBasicTest.java
index b391fad..fdb4b81 100644
--- a/langtools/test/tools/javac/processing/model/element/repeatingAnnotations/MixSingularAndUnofficialContainerBasicTest.java
+++ b/langtools/test/tools/javac/processing/model/element/repeatingAnnotations/MixSingularAndUnofficialContainerBasicTest.java
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2013, 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2013, 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
@@ -23,7 +23,7 @@
 
 /*
  * @test
- * @bug     8004822
+ * @bug     8004822 8163113
  * @author  mnunez
  * @summary Language model api test basics for repeating annotations
  * @library /tools/javac/lib
@@ -53,9 +53,9 @@
 @ExpectedContainer(
         value = UnofficialContainer.class,
         getAnnotation = "@UnofficialContainer("
-        + "value=[@Foo(value=1), @Foo(value=2)])",
+        + "value={@Foo(value=1), @Foo(value=2)})",
         getAnnotationsByType = {"@UnofficialContainer("
-                + "value=[@Foo(value=1), @Foo(value=2)])"})
+                + "value={@Foo(value=1), @Foo(value=2)})"})
 @Foo(value = 0)
 @UnofficialContainer(value = {@Foo(value = 1), @Foo(value = 2)})
 class MixSingularAndUnofficialContainerBasicTest {
@@ -79,9 +79,9 @@
     @ExpectedContainer(
             value = UnofficialContainer.class,
             getAnnotation = "@UnofficialContainer("
-            + "value=[@Foo(value=1), @Foo(value=2)])",
+            + "value={@Foo(value=1), @Foo(value=2)})",
             getAnnotationsByType = {"@UnofficialContainer("
-                    + "value=[@Foo(value=1), @Foo(value=2)])"})
+                    + "value={@Foo(value=1), @Foo(value=2)})"})
     @Foo(value = 0)
     @UnofficialContainer(value = {@Foo(value = 1), @Foo(value = 2)})
     int testField = 0;
@@ -105,9 +105,9 @@
     @ExpectedContainer(
             value = UnofficialContainer.class,
             getAnnotation = "@UnofficialContainer("
-            + "value=[@Foo(value=1), @Foo(value=2)])",
+            + "value={@Foo(value=1), @Foo(value=2)})",
             getAnnotationsByType = {"@UnofficialContainer("
-                    + "value=[@Foo(value=1), @Foo(value=2)])"})
+                    + "value={@Foo(value=1), @Foo(value=2)})"})
     @Foo(value = 0)
     @UnofficialContainer(value = {@Foo(value = 1), @Foo(value = 2)})
     void testMethod() {}
diff --git a/langtools/test/tools/javac/processing/model/element/repeatingAnnotations/MixSingularAndUnofficialContainerInheritedA1Test.java b/langtools/test/tools/javac/processing/model/element/repeatingAnnotations/MixSingularAndUnofficialContainerInheritedA1Test.java
index 30376e3..ff4c4b2 100644
--- a/langtools/test/tools/javac/processing/model/element/repeatingAnnotations/MixSingularAndUnofficialContainerInheritedA1Test.java
+++ b/langtools/test/tools/javac/processing/model/element/repeatingAnnotations/MixSingularAndUnofficialContainerInheritedA1Test.java
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2013, 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2013, 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
@@ -23,7 +23,7 @@
 
 /*
  * @test
- * @bug     8004822
+ * @bug     8004822 8163113
  * @author  mnunez
  * @summary Language model api test basics for repeating annotations
  * @library /tools/javac/lib
@@ -56,8 +56,8 @@
 @ExpectedContainer(
         value = UnofficialInheritedContainer.class,
         getAnnotation = "@UnofficialInheritedContainer("
-        + "value=[@FooInherited(value=1), @FooInherited(value=2)])",
+        + "value={@FooInherited(value=1), @FooInherited(value=2)})",
         getAnnotationsByType = {"@UnofficialInheritedContainer("
-                + "value=[@FooInherited(value=1), @FooInherited(value=2)])"})
+                + "value={@FooInherited(value=1), @FooInherited(value=2)})"})
 @UnofficialInheritedContainer(value = {@FooInherited(value = 1), @FooInherited(value = 2)})
 class MixSingularAndUnofficialContainerInheritedA1Test extends L {}
diff --git a/langtools/test/tools/javac/processing/model/element/repeatingAnnotations/MixSingularAndUnofficialContainerInheritedA2Test.java b/langtools/test/tools/javac/processing/model/element/repeatingAnnotations/MixSingularAndUnofficialContainerInheritedA2Test.java
index 5ee7402..cf90a63 100644
--- a/langtools/test/tools/javac/processing/model/element/repeatingAnnotations/MixSingularAndUnofficialContainerInheritedA2Test.java
+++ b/langtools/test/tools/javac/processing/model/element/repeatingAnnotations/MixSingularAndUnofficialContainerInheritedA2Test.java
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2013, 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2013, 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
@@ -23,7 +23,7 @@
 
 /*
  * @test
- * @bug     8004822
+ * @bug     8004822 8163113
  * @author  mnunez
  * @summary Language model api test basics for repeating annotations
  * @library /tools/javac/lib
@@ -57,9 +57,9 @@
 @ExpectedContainer(
         value = UnofficialInheritedContainer.class,
         getAnnotation = "@UnofficialInheritedContainer("
-        + "value=[@FooInherited(value=1), @FooInherited(value=2)])",
+        + "value={@FooInherited(value=1), @FooInherited(value=2)})",
         getAnnotationsByType = {"@UnofficialInheritedContainer("
-                + "value=[@FooInherited(value=1), @FooInherited(value=2)])"})
+                + "value={@FooInherited(value=1), @FooInherited(value=2)})"})
 @UnofficialInheritedContainer(value = {@FooInherited(value = 1), @FooInherited(value = 2)})
 @FooInherited(value = 3)
 class MixSingularAndUnofficialContainerInheritedA2Test extends K {}
diff --git a/langtools/test/tools/javac/processing/model/element/repeatingAnnotations/MixSingularAndUnofficialContainerInheritedB1Test.java b/langtools/test/tools/javac/processing/model/element/repeatingAnnotations/MixSingularAndUnofficialContainerInheritedB1Test.java
index f0de204..1c47d69 100644
--- a/langtools/test/tools/javac/processing/model/element/repeatingAnnotations/MixSingularAndUnofficialContainerInheritedB1Test.java
+++ b/langtools/test/tools/javac/processing/model/element/repeatingAnnotations/MixSingularAndUnofficialContainerInheritedB1Test.java
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2013, 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2013, 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
@@ -23,7 +23,7 @@
 
 /*
  * @test
- * @bug     8004822
+ * @bug     8004822 8163113
  * @author  mnunez
  * @summary Language model api test basics for repeating annotations
  * @library /tools/javac/lib
@@ -56,8 +56,8 @@
 @ExpectedContainer(
         value = UnofficialInheritedContainer.class,
         getAnnotation = "@UnofficialInheritedContainer("
-        + "value=[@FooInherited(value=1), @FooInherited(value=2)])",
+        + "value={@FooInherited(value=1), @FooInherited(value=2)})",
         getAnnotationsByType = {"@UnofficialInheritedContainer("
-                + "value=[@FooInherited(value=1), @FooInherited(value=2)])"})
+                + "value={@FooInherited(value=1), @FooInherited(value=2)})"})
 @FooInherited(value = 0)
 class MixSingularAndUnofficialContainerInheritedB1Test extends J {}
diff --git a/langtools/test/tools/javac/processing/model/element/repeatingAnnotations/MixSingularAndUnofficialContainerInheritedB2Test.java b/langtools/test/tools/javac/processing/model/element/repeatingAnnotations/MixSingularAndUnofficialContainerInheritedB2Test.java
index 30c3cf7..c08524a 100644
--- a/langtools/test/tools/javac/processing/model/element/repeatingAnnotations/MixSingularAndUnofficialContainerInheritedB2Test.java
+++ b/langtools/test/tools/javac/processing/model/element/repeatingAnnotations/MixSingularAndUnofficialContainerInheritedB2Test.java
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2013, 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2013, 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
@@ -23,7 +23,7 @@
 
 /*
  * @test
- * @bug     8004822
+ * @bug     8004822 8163113
  * @author  mnunez
  * @summary Language model api test basics for repeating annotations
  * @library /tools/javac/lib
@@ -57,8 +57,8 @@
 @ExpectedContainer(
         value = UnofficialInheritedContainer.class,
         getAnnotation = "@UnofficialInheritedContainer("
-        + "value=[@FooInherited(value=1), @FooInherited(value=2)])",
+        + "value={@FooInherited(value=1), @FooInherited(value=2)})",
         getAnnotationsByType = {"@UnofficialInheritedContainer("
-                + "value=[@FooInherited(value=1), @FooInherited(value=2)])"})
+                + "value={@FooInherited(value=1), @FooInherited(value=2)})"})
 @FooInherited(value = 0)
 class MixSingularAndUnofficialContainerInheritedB2Test extends G{}
diff --git a/langtools/test/tools/javac/processing/model/element/repeatingAnnotations/OfficialContainerBasicTest.java b/langtools/test/tools/javac/processing/model/element/repeatingAnnotations/OfficialContainerBasicTest.java
index ee1d563..7cbaa7c 100644
--- a/langtools/test/tools/javac/processing/model/element/repeatingAnnotations/OfficialContainerBasicTest.java
+++ b/langtools/test/tools/javac/processing/model/element/repeatingAnnotations/OfficialContainerBasicTest.java
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2013, 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2013, 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
@@ -23,7 +23,7 @@
 
 /*
  * @test
- * @bug     8004822
+ * @bug     8004822 8163113
  * @author  mnunez
  * @summary Language model api test basics for repeating annotations
  * @library /tools/javac/lib
@@ -53,8 +53,8 @@
         })
 @ExpectedContainer(
         value = BarContainer.class,
-        getAnnotation = "@BarContainer(value=[@Bar(value=1), @Bar(value=2)])",
-        getAnnotationsByType = {"@BarContainer(value=[@Bar(value=1), @Bar(value=2)])"})
+        getAnnotation = "@BarContainer(value={@Bar(value=1), @Bar(value=2)})",
+        getAnnotationsByType = {"@BarContainer(value={@Bar(value=1), @Bar(value=2)})"})
 @BarContainer(value = {@Bar(value = 1), @Bar(value = 2)})
 class OfficialContainerBasicTest {
 
@@ -77,8 +77,8 @@
             })
     @ExpectedContainer(
             value = BarContainer.class,
-            getAnnotation = "@BarContainer(value=[@Bar(value=1), @Bar(value=2)])",
-            getAnnotationsByType = {"@BarContainer(value=[@Bar(value=1), @Bar(value=2)])"})
+            getAnnotation = "@BarContainer(value={@Bar(value=1), @Bar(value=2)})",
+            getAnnotationsByType = {"@BarContainer(value={@Bar(value=1), @Bar(value=2)})"})
     @BarContainer(value = {@Bar(value = 1), @Bar(value = 2)})
     int testField = 0;
 
@@ -101,8 +101,8 @@
             })
     @ExpectedContainer(
             value = BarContainer.class,
-            getAnnotation = "@BarContainer(value=[@Bar(value=1), @Bar(value=2)])",
-            getAnnotationsByType = {"@BarContainer(value=[@Bar(value=1), @Bar(value=2)])"})
+            getAnnotation = "@BarContainer(value={@Bar(value=1), @Bar(value=2)})",
+            getAnnotationsByType = {"@BarContainer(value={@Bar(value=1), @Bar(value=2)})"})
     @BarContainer(value = {@Bar(value = 1), @Bar(value = 2)})
     void testMethod() {}
 }
diff --git a/langtools/test/tools/javac/processing/model/element/repeatingAnnotations/OfficialContainerInheritedTest.java b/langtools/test/tools/javac/processing/model/element/repeatingAnnotations/OfficialContainerInheritedTest.java
index f2f3f69..2e9047e0 100644
--- a/langtools/test/tools/javac/processing/model/element/repeatingAnnotations/OfficialContainerInheritedTest.java
+++ b/langtools/test/tools/javac/processing/model/element/repeatingAnnotations/OfficialContainerInheritedTest.java
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2013, 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2013, 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
@@ -23,7 +23,7 @@
 
 /*
  * @test
- * @bug     8004822
+ * @bug     8004822 8163113
  * @author  mnunez
  * @summary Language model api test basics for repeating annotations
  * @library /tools/javac/lib
@@ -56,7 +56,7 @@
 @ExpectedContainer(
         value = BarInheritedContainer.class,
         getAnnotation = "@BarInheritedContainer("
-        + "value=[@BarInherited(value=1), @BarInherited(value=2)])",
+        + "value={@BarInherited(value=1), @BarInherited(value=2)})",
         getAnnotationsByType = {"@BarInheritedContainer("
-                + "value=[@BarInherited(value=1), @BarInherited(value=2)])"})
+                + "value={@BarInherited(value=1), @BarInherited(value=2)})"})
 class OfficialContainerInheritedTest extends D {}
diff --git a/langtools/test/tools/javac/processing/model/element/repeatingAnnotations/RepeatableBasicTest.java b/langtools/test/tools/javac/processing/model/element/repeatingAnnotations/RepeatableBasicTest.java
index f05eedb..c50306d 100644
--- a/langtools/test/tools/javac/processing/model/element/repeatingAnnotations/RepeatableBasicTest.java
+++ b/langtools/test/tools/javac/processing/model/element/repeatingAnnotations/RepeatableBasicTest.java
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2013, 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2013, 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
@@ -23,7 +23,7 @@
 
 /*
  * @test
- * @bug     8004822
+ * @bug     8004822 8163113
  * @author  mnunez
  * @summary Language model api test basics for repeating annotations
  * @library /tools/javac/lib
@@ -53,8 +53,8 @@
         })
 @ExpectedContainer(
         value = BarContainer.class,
-        getAnnotation = "@BarContainer(value=[@Bar(value=1), @Bar(value=2)])",
-        getAnnotationsByType = {"@BarContainer(value=[@Bar(value=1), @Bar(value=2)])"})
+        getAnnotation = "@BarContainer(value={@Bar(value=1), @Bar(value=2)})",
+        getAnnotationsByType = {"@BarContainer(value={@Bar(value=1), @Bar(value=2)})"})
 @Bar(value = 1)
 @Bar(value = 2)
 class RepeatableBasicTest {
@@ -78,8 +78,8 @@
             })
     @ExpectedContainer(
             value = BarContainer.class,
-            getAnnotation = "@BarContainer(value=[@Bar(value=1), @Bar(value=2)])",
-            getAnnotationsByType = {"@BarContainer(value=[@Bar(value=1), @Bar(value=2)])"})
+            getAnnotation = "@BarContainer(value={@Bar(value=1), @Bar(value=2)})",
+            getAnnotationsByType = {"@BarContainer(value={@Bar(value=1), @Bar(value=2)})"})
     @Bar(value = 1)
     @Bar(value = 2)
     int testField = 0;
@@ -103,8 +103,8 @@
             })
     @ExpectedContainer(
             value = BarContainer.class,
-            getAnnotation = "@BarContainer(value=[@Bar(value=1), @Bar(value=2)])",
-            getAnnotationsByType = {"@BarContainer(value=[@Bar(value=1), @Bar(value=2)])"})
+            getAnnotation = "@BarContainer(value={@Bar(value=1), @Bar(value=2)})",
+            getAnnotationsByType = {"@BarContainer(value={@Bar(value=1), @Bar(value=2)})"})
     @Bar(value = 1)
     @Bar(value = 2)
     void testMethod() {}
diff --git a/langtools/test/tools/javac/processing/model/element/repeatingAnnotations/RepeatableInheritedTest.java b/langtools/test/tools/javac/processing/model/element/repeatingAnnotations/RepeatableInheritedTest.java
index b9075cf..59b5d95 100644
--- a/langtools/test/tools/javac/processing/model/element/repeatingAnnotations/RepeatableInheritedTest.java
+++ b/langtools/test/tools/javac/processing/model/element/repeatingAnnotations/RepeatableInheritedTest.java
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2013, 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2013, 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
@@ -23,7 +23,7 @@
 
 /*
  * @test
- * @bug     8004822
+ * @bug     8004822 8163113
  * @author  mnunez
  * @summary Language model api test basics for repeating annotations
  * @library /tools/javac/lib
@@ -57,7 +57,7 @@
 @ExpectedContainer(
         value = BarInheritedContainer.class,
         getAnnotation = "@BarInheritedContainer("
-        + "value=[@BarInherited(value=1), @BarInherited(value=2)])",
+        + "value={@BarInherited(value=1), @BarInherited(value=2)})",
         getAnnotationsByType = {"@BarInheritedContainer("
-                + "value=[@BarInherited(value=1), @BarInherited(value=2)])"})
+                + "value={@BarInherited(value=1), @BarInherited(value=2)})"})
 class RepeatableInheritedTest extends I {}
diff --git a/langtools/test/tools/javac/processing/model/element/repeatingAnnotations/RepeatableOfficialContainerBasicTest.java b/langtools/test/tools/javac/processing/model/element/repeatingAnnotations/RepeatableOfficialContainerBasicTest.java
index e512891..39f856a 100644
--- a/langtools/test/tools/javac/processing/model/element/repeatingAnnotations/RepeatableOfficialContainerBasicTest.java
+++ b/langtools/test/tools/javac/processing/model/element/repeatingAnnotations/RepeatableOfficialContainerBasicTest.java
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2013, 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2013, 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
@@ -23,7 +23,7 @@
 
 /*
  * @test
- * @bug     8004822
+ * @bug     8004822 8163113
  * @author  mnunez
  * @summary Language model api test basics for repeating annotations
  * @library /tools/javac/lib
@@ -52,8 +52,8 @@
         value = BarContainer.class,
         getAnnotation = "null",
         getAnnotationsByType = {
-            "@BarContainer(value=[@Bar(value=1)])",
-            "@BarContainer(value=[@Bar(value=2)])"})
+            "@BarContainer(value={@Bar(value=1)})",
+            "@BarContainer(value={@Bar(value=2)})"})
 @BarContainer(value = {@Bar(value = 1)})
 @BarContainer(value = {@Bar(value = 2)})
 class RepeatableOfficialContainerBasicTest {
@@ -76,8 +76,8 @@
             value = BarContainer.class,
             getAnnotation = "null",
             getAnnotationsByType = {
-                "@BarContainer(value=[@Bar(value=1)])",
-                "@BarContainer(value=[@Bar(value=2)])"})
+                "@BarContainer(value={@Bar(value=1)})",
+                "@BarContainer(value={@Bar(value=2)})"})
     @BarContainer(value = {@Bar(value = 1)})
     @BarContainer(value = {@Bar(value = 2)})
     int testField = 0;
@@ -100,8 +100,8 @@
             value = BarContainer.class,
             getAnnotation = "null",
             getAnnotationsByType = {
-                "@BarContainer(value=[@Bar(value=1)])",
-                "@BarContainer(value=[@Bar(value=2)])"})
+                "@BarContainer(value={@Bar(value=1)})",
+                "@BarContainer(value={@Bar(value=2)})"})
     @BarContainer(value = {@Bar(value = 1)})
     @BarContainer(value = {@Bar(value = 2)})
     void testMethod() {}
diff --git a/langtools/test/tools/javac/processing/model/element/repeatingAnnotations/RepeatableOfficialContainerInheritedTest.java b/langtools/test/tools/javac/processing/model/element/repeatingAnnotations/RepeatableOfficialContainerInheritedTest.java
index 579cf06..f3029fa 100644
--- a/langtools/test/tools/javac/processing/model/element/repeatingAnnotations/RepeatableOfficialContainerInheritedTest.java
+++ b/langtools/test/tools/javac/processing/model/element/repeatingAnnotations/RepeatableOfficialContainerInheritedTest.java
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2013, 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2013, 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
@@ -23,7 +23,7 @@
 
 /*
  * @test
- * @bug     8004822
+ * @bug     8004822 8163113
  * @author  mnunez
  * @summary Language model api test basics for repeating annotations
  * @library /tools/javac/lib
@@ -43,8 +43,8 @@
         value = BarInheritedContainer.class,
         getAnnotation = "null",
         getAnnotationsByType = {
-            "@BarInheritedContainer(value=[@BarInherited(value=1)])",
-            "@BarInheritedContainer(value=[@BarInherited(value=2)])"
+            "@BarInheritedContainer(value={@BarInherited(value=1)})",
+            "@BarInheritedContainer(value={@BarInherited(value=2)})"
         },
         getAllAnnotationMirrors = {
             "@BarInheritedContainerContainer("
@@ -60,9 +60,9 @@
 @ExpectedContainer(
         value = BarInheritedContainerContainer.class,
         getAnnotation = "@BarInheritedContainerContainer("
-        + "value=[@BarInheritedContainer(value=[@BarInherited(value=1)]),"
-        + " @BarInheritedContainer(value=[@BarInherited(value=2)])])",
+        + "value={@BarInheritedContainer(value={@BarInherited(value=1)}),"
+        + " @BarInheritedContainer(value={@BarInherited(value=2)})})",
         getAnnotationsByType = {"@BarInheritedContainerContainer("
-                + "value=[@BarInheritedContainer(value=[@BarInherited(value=1)]),"
-        + " @BarInheritedContainer(value=[@BarInherited(value=2)])])"})
+                + "value={@BarInheritedContainer(value={@BarInherited(value=1)}),"
+        + " @BarInheritedContainer(value={@BarInherited(value=2)})})"})
 class RepeatableOfficialContainerInheritedTest extends O {}
diff --git a/langtools/test/tools/javac/processing/model/element/repeatingAnnotations/RepeatableOverrideATest.java b/langtools/test/tools/javac/processing/model/element/repeatingAnnotations/RepeatableOverrideATest.java
index 2596648..6e4a2c2 100644
--- a/langtools/test/tools/javac/processing/model/element/repeatingAnnotations/RepeatableOverrideATest.java
+++ b/langtools/test/tools/javac/processing/model/element/repeatingAnnotations/RepeatableOverrideATest.java
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2013, 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2013, 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
@@ -23,7 +23,7 @@
 
 /*
  * @test
- * @bug     8004822 8007961
+ * @bug     8004822 8007961 8163113
  * @author  mnunez
  * @summary Language model api test basics for repeating annotations
  * @library /tools/javac/lib
@@ -56,8 +56,8 @@
 @ExpectedContainer(
         value = BarInheritedContainer.class,
         getAnnotation = "@BarInheritedContainer("
-        + "value=[@BarInherited(value=1), @BarInherited(value=2)])",
+        + "value={@BarInherited(value=1), @BarInherited(value=2)})",
         getAnnotationsByType = {"@BarInheritedContainer("
-                + "value=[@BarInherited(value=1), @BarInherited(value=2)])"})
+                + "value={@BarInherited(value=1), @BarInherited(value=2)})"})
 @BarInherited(value = 3)
 class RepeatableOverrideATest extends B {}
diff --git a/langtools/test/tools/javac/processing/model/element/repeatingAnnotations/RepeatableOverrideBTest.java b/langtools/test/tools/javac/processing/model/element/repeatingAnnotations/RepeatableOverrideBTest.java
index f047d17..73cd25c 100644
--- a/langtools/test/tools/javac/processing/model/element/repeatingAnnotations/RepeatableOverrideBTest.java
+++ b/langtools/test/tools/javac/processing/model/element/repeatingAnnotations/RepeatableOverrideBTest.java
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2013, 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2013, 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
@@ -23,7 +23,7 @@
 
 /*
  * @test
- * @bug     8004822 8007961
+ * @bug     8004822 8007961 8163113
  * @author  mnunez
  * @summary Language model api test basics for repeating annotations
  * @library /tools/javac/lib
@@ -58,9 +58,9 @@
 @ExpectedContainer(
         value = BarInheritedContainer.class,
         getAnnotation = "@BarInheritedContainer("
-        + "value=[@BarInherited(value=1), @BarInherited(value=2)])",
+        + "value={@BarInherited(value=1), @BarInherited(value=2)})",
         getAnnotationsByType = {"@BarInheritedContainer("
-                + "value=[@BarInherited(value=1), @BarInherited(value=2)])"})
+                + "value={@BarInherited(value=1), @BarInherited(value=2)})"})
 @BarInherited(value = 1)
 @BarInherited(value = 2)
 class RepeatableOverrideBTest extends C {}
diff --git a/langtools/test/tools/javac/processing/model/element/repeatingAnnotations/UnofficialContainerBasicTest.java b/langtools/test/tools/javac/processing/model/element/repeatingAnnotations/UnofficialContainerBasicTest.java
index de793d4..0150b1c 100644
--- a/langtools/test/tools/javac/processing/model/element/repeatingAnnotations/UnofficialContainerBasicTest.java
+++ b/langtools/test/tools/javac/processing/model/element/repeatingAnnotations/UnofficialContainerBasicTest.java
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2013, 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2013, 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
@@ -23,7 +23,7 @@
 
 /*
  * @test
- * @bug     8004822
+ * @bug     8004822 8163113
  * @author  mnunez
  * @summary Language model api test basics for repeating annotations
  * @library /tools/javac/lib
@@ -50,8 +50,8 @@
         })
 @ExpectedContainer(
         value = UnofficialContainer.class,
-        getAnnotation = "@UnofficialContainer(value=[@Foo(value=1), @Foo(value=2)])",
-        getAnnotationsByType = {"@UnofficialContainer(value=[@Foo(value=1), @Foo(value=2)])"})
+        getAnnotation = "@UnofficialContainer(value={@Foo(value=1), @Foo(value=2)})",
+        getAnnotationsByType = {"@UnofficialContainer(value={@Foo(value=1), @Foo(value=2)})"})
 @UnofficialContainer(value = {@Foo(value = 1), @Foo(value = 2)})
 class UnofficialContainerBasicTest {
 
@@ -71,8 +71,8 @@
             })
     @ExpectedContainer(
             value = UnofficialContainer.class,
-            getAnnotation = "@UnofficialContainer(value=[@Foo(value=1), @Foo(value=2)])",
-            getAnnotationsByType = {"@UnofficialContainer(value=[@Foo(value=1), @Foo(value=2)])"})
+            getAnnotation = "@UnofficialContainer(value={@Foo(value=1), @Foo(value=2)})",
+            getAnnotationsByType = {"@UnofficialContainer(value={@Foo(value=1), @Foo(value=2)})"})
     @UnofficialContainer(value = {@Foo(value = 1), @Foo(value = 2)})
     int testField = 0;
 
@@ -92,8 +92,8 @@
             })
     @ExpectedContainer(
             value = UnofficialContainer.class,
-            getAnnotation = "@UnofficialContainer(value=[@Foo(value=1), @Foo(value=2)])",
-            getAnnotationsByType = {"@UnofficialContainer(value=[@Foo(value=1), @Foo(value=2)])"})
+            getAnnotation = "@UnofficialContainer(value={@Foo(value=1), @Foo(value=2)})",
+            getAnnotationsByType = {"@UnofficialContainer(value={@Foo(value=1), @Foo(value=2)})"})
     @UnofficialContainer(value = {@Foo(value = 1), @Foo(value = 2)})
     void testMethod() {}
 }
diff --git a/langtools/test/tools/javac/processing/model/element/repeatingAnnotations/UnofficialContainerInheritedTest.java b/langtools/test/tools/javac/processing/model/element/repeatingAnnotations/UnofficialContainerInheritedTest.java
index dde7d04..a25145e 100644
--- a/langtools/test/tools/javac/processing/model/element/repeatingAnnotations/UnofficialContainerInheritedTest.java
+++ b/langtools/test/tools/javac/processing/model/element/repeatingAnnotations/UnofficialContainerInheritedTest.java
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2013, 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2013, 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
@@ -23,7 +23,7 @@
 
 /*
  * @test
- * @bug     8004822
+ * @bug     8004822 8163113
  * @author  mnunez
  * @summary Language model api test basics for repeating annotations
  * @library /tools/javac/lib
@@ -54,7 +54,7 @@
 @ExpectedContainer(
         value = UnofficialInheritedContainer.class,
         getAnnotation = "@UnofficialInheritedContainer("
-        + "value=[@FooInherited(value=1), @FooInherited(value=2)])",
+        + "value={@FooInherited(value=1), @FooInherited(value=2)})",
         getAnnotationsByType = {"@UnofficialInheritedContainer("
-                + "value=[@FooInherited(value=1), @FooInherited(value=2)])"})
+                + "value={@FooInherited(value=1), @FooInherited(value=2)})"})
 class UnofficialContainerInheritedTest extends F {}
diff --git a/langtools/test/tools/javac/scope/IterateAndRemove.java b/langtools/test/tools/javac/scope/IterateAndRemove.java
new file mode 100644
index 0000000..fab5ea5
--- /dev/null
+++ b/langtools/test/tools/javac/scope/IterateAndRemove.java
@@ -0,0 +1,106 @@
+/*
+ * 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.
+ */
+
+/**
+ * @test
+ * @bug 8144733
+ * @summary Verify that Scope.remove removes the Symbol also from already running iterations.
+ * @modules jdk.compiler/com.sun.tools.javac.code
+ *          jdk.compiler/com.sun.tools.javac.util
+ */
+
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.Collections;
+import java.util.Iterator;
+import java.util.List;
+import java.util.function.Function;
+
+import com.sun.tools.javac.code.Scope;
+import com.sun.tools.javac.code.Scope.WriteableScope;
+import com.sun.tools.javac.code.Symbol;
+import com.sun.tools.javac.code.Symbol.PackageSymbol;
+import com.sun.tools.javac.util.Context;
+import com.sun.tools.javac.util.Name;
+import com.sun.tools.javac.util.Names;
+
+public class IterateAndRemove {
+    public static void main(String... args) {
+        new IterateAndRemove().run();
+    }
+
+    void run() {
+        Context ctx = new Context();
+        Names names = Names.instance(ctx);
+        Symbol root = new PackageSymbol(names.empty, null);
+        Name one = names.fromString("1");
+        PackageSymbol sym1 = new PackageSymbol(one, new PackageSymbol(names.fromString("a"), root));
+        PackageSymbol sym2 = new PackageSymbol(one, new PackageSymbol(names.fromString("b"), root));
+        PackageSymbol sym3 = new PackageSymbol(one, new PackageSymbol(names.fromString("c"), root));
+        List<Symbol> symbols = Arrays.asList(sym1, sym2, sym3);
+
+        List<Function<Scope, Iterable<Symbol>>> getters = Arrays.asList(
+                scope -> scope.getSymbols(),
+                scope -> scope.getSymbolsByName(one)
+        );
+        for (Function<Scope, Iterable<Symbol>> scope2Content : getters) {
+            for (int removeAt : new int[] {0, 1, 2, 3}) {
+                for (Symbol removeWhat : new Symbol[] {sym1, sym2, sym3}) {
+                    WriteableScope s = WriteableScope.create(root);
+
+                    symbols.forEach(s :: enter);
+
+                    Iterator<Symbol> it = scope2Content.apply(s).iterator();
+                    List<PackageSymbol> actual = new ArrayList<>();
+                    int count = 0;
+
+                    while (true) {
+                        if (count++ == removeAt)
+                            s.remove(removeWhat);
+                        if (!it.hasNext())
+                            break;
+                        actual.add((PackageSymbol) it.next());
+                    }
+
+                    List<Symbol> copy = new ArrayList<>(symbols);
+
+                    Collections.reverse(copy);
+
+                    count = 0;
+
+                    while (true) {
+                        if (count == removeAt && copy.indexOf(removeWhat) >= count)
+                            copy.remove(removeWhat);
+                        count++;
+                        if (count >= copy.size())
+                            break;
+                    }
+
+                    if (!copy.equals(actual)) {
+                        throw new AssertionError("differs: actual: " + actual + "; expected: " + copy);
+                    }
+                }
+            }
+        }
+    }
+}
\ No newline at end of file
diff --git a/langtools/test/tools/lib/toolbox/TestRunner.java b/langtools/test/tools/lib/toolbox/TestRunner.java
index f0a921e..05839fd 100644
--- a/langtools/test/tools/lib/toolbox/TestRunner.java
+++ b/langtools/test/tools/lib/toolbox/TestRunner.java
@@ -116,4 +116,9 @@
             throw new Exception(errorCount + " errors found");
         }
     }
+
+    public void error(String message) {
+        out.println("Error: " + message);
+        errorCount++;
+    }
 }
diff --git a/make/Bundles.gmk b/make/Bundles.gmk
index 84b7afc..111d7ce 100644
--- a/make/Bundles.gmk
+++ b/make/Bundles.gmk
@@ -187,7 +187,11 @@
           $(JDK_SYMBOLS_EXCLUDE_PATTERN) \
           $(SYMBOLS_EXCLUDE_PATTERN) \
           , \
-          $(ALL_JDK_FILES) \
+          $(filter-out \
+              $(JDK_IMAGE_HOMEDIR)/demo/% $(JDK_IMAGE_HOMEDIR)/sample/% \
+              , \
+              $(ALL_JDK_FILES) \
+          ) \
       ) \
       $(call CacheFind, $(SYMBOLS_IMAGE_DIR))
 
diff --git a/make/CreateJmods.gmk b/make/CreateJmods.gmk
index bc8e464..42ef855 100644
--- a/make/CreateJmods.gmk
+++ b/make/CreateJmods.gmk
@@ -1,5 +1,5 @@
 
-# Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved.
+# Copyright (c) 2014, 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
@@ -82,8 +82,10 @@
   endif
 endif
 
-# Changes to the jmod tool itself should also trigger a rebuild of all jmods
-DEPS += $(JMOD_CMD)
+# Changes to the jmod tool itself should also trigger a rebuild of all jmods.
+# The variable JMOD_CMD could contain an environment variable assignment before
+# the actual command. Filter that out using wildcard before adding to DEPS.
+DEPS += $(wildcard $(JMOD_CMD))
 ifeq ($(EXTERNAL_BUILDJDK), false)
   DEPS += $(call CacheFind, $(JDK_OUTPUTDIR)/modules/jdk.jlink/jdk/tools/jmod)
 endif
@@ -100,7 +102,7 @@
             --os-name $(REQUIRED_OS_NAME) \
             --os-arch $(OPENJDK_TARGET_CPU_LEGACY) \
             --os-version $(REQUIRED_OS_VERSION) \
-	        --modulepath $(JMODS_DIR) \
+            --modulepath $(JMODS_DIR) \
             --exclude '**{_the.*,*.diz,*.debuginfo,*.dSYM/**,*.pdb,*.map}' \
 	    $(JMOD_FLAGS) $(SUPPORT_OUTPUTDIR)/jmods/$(notdir $@)
 	$(MV) $(SUPPORT_OUTPUTDIR)/jmods/$(notdir $@) $@
diff --git a/make/Images.gmk b/make/Images.gmk
index 7ba9528..a1b0a70 100644
--- a/make/Images.gmk
+++ b/make/Images.gmk
@@ -1,5 +1,5 @@
 #
-# Copyright (c) 2014, 2015, Oracle and/or its affiliates. All rights reserved.
+# Copyright (c) 2014, 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
@@ -225,7 +225,6 @@
       jmap.1 \
       jps.1 \
       jrunscript.1 \
-      jsadebugd.1 \
       jstack.1 \
       jstat.1 \
       jstatd.1 \
diff --git a/make/Javadoc.gmk b/make/Javadoc.gmk
index d1607b2..866e3d7 100644
--- a/make/Javadoc.gmk
+++ b/make/Javadoc.gmk
@@ -82,7 +82,7 @@
 PLUGIN2_FIRST_COPYRIGHT_YEAR = 2007
 JDKNET_FIRST_COPYRIGHT_YEAR = 2014
 JACCESSAPI_FIRST_COPYRIGHT_YEAR = 2002
-
+JSOBJECT_FIRST_COPYRIGHT_YEAR = 1993
 
 # Oracle name
 FULL_COMPANY_NAME = Oracle and/or its affiliates
@@ -576,14 +576,14 @@
 ALL_OTHER_TARGETS += tagletapidocs
 TAGLETAPI_DOCDIR := $(OLD_DOCLET_DIR)/taglet
 TAGLETAPI2COREAPI := ../../../$(JDKJRE2COREAPI)
+TAGLETAPI_DOCTITLE := Taglet API
+TAGLETAPI_WINDOWTITLE := Taglet API
+TAGLETAPI_HEADER := <strong>Taglet API</strong>
 TAGLETAPI_BOTTOM := $(call CommonTrademarkBottom,$(TAGLETAPI_FIRST_COPYRIGHT_YEAR))
 # TAGLETAPI_FILE is located in NON_CORE_PKGS.gmk
 
-# Temporary directory (special generation rules)
-TAGLETAPI_TEMPDIR = $(DOCSTMPDIR)/taglets_temp
-
 # The index.html, options, and packages files
-TAGLETAPI_INDEX_FILE = $(TAGLETAPI_DOCDIR)/com/sun/tools/doclets/Taglet.html
+TAGLETAPI_INDEX_FILE = $(TAGLETAPI_DOCDIR)/index.html
 TAGLETAPI_OPTIONS_FILE = $(DOCSTMPDIR)/tagletapi.options
 TAGLETAPI_PACKAGES_FILE = $(DOCSTMPDIR)/tagletapi.packages
 
@@ -592,20 +592,12 @@
 
 tagletapidocs: $(TAGLETAPI_INDEX_FILE)
 
-# Set relative location to core api document root
-$(TAGLETAPI_INDEX_FILE): GET2DOCSDIR=$(TAGLETAPI2COREAPI)/..
-
 # Run javadoc if the index file is out of date or missing
 $(TAGLETAPI_INDEX_FILE): $(TAGLETAPI_OPTIONS_FILE) $(TAGLETAPI_PACKAGES_FILE) $(COREAPI_INDEX_FILE)
 	$(prep-javadoc)
-	$(RM) -r $(TAGLETAPI_TEMPDIR)
-	$(MKDIR) -p $(TAGLETAPI_TEMPDIR)
 	$(call JavadocSummary,$(TAGLETAPI_OPTIONS_FILE),$(TAGLETAPI_PACKAGES_FILE))
-	$(JAVADOC_CMD_SMALL) -d $(TAGLETAPI_TEMPDIR) \
+	$(JAVADOC_CMD_SMALL) -d $(@D) \
 	    @$(TAGLETAPI_OPTIONS_FILE) @$(TAGLETAPI_PACKAGES_FILE)
-	cp -r $(TAGLETAPI_TEMPDIR)/com $(TAGLETAPI_DOCDIR)
-	cp $(TAGLETAPI_TEMPDIR)/stylesheet.css $(TAGLETAPI_DOCDIR)
-	$(RM) -r $(TAGLETAPI_TEMPDIR)
 
 # Create file with javadoc options in it
 $(TAGLETAPI_OPTIONS_FILE):
@@ -617,6 +609,10 @@
 	  $(call OptionPair,-modulesourcepath,$(RELEASEDOCS_MODULESOURCEPATH)) ; \
 	  $(call OptionPair,-addmods,$(TAGLETAPI_MODULES)) ; \
 	  $(call OptionPair,-encoding,ascii) ; \
+	  $(call OptionOnly,-breakiterator) ; \
+	  $(call OptionPair,-doctitle,$(TAGLETAPI_DOCTITLE)) ; \
+	  $(call OptionPair,-windowtitle,$(TAGLETAPI_WINDOWTITLE) $(DRAFT_WINTITLE)); \
+	  $(call OptionPair,-header,$(TAGLETAPI_HEADER)$(DRAFT_HEADER)) ; \
 	  $(call OptionOnly,-nonavbar) ; \
 	  $(call OptionOnly,-noindex) ; \
 	  $(call OptionPair,-bottom,$(TAGLETAPI_BOTTOM)$(DRAFT_BOTTOM)) ; \
@@ -1027,6 +1023,64 @@
 
 #############################################################
 #
+# jsobjectdocs
+#
+
+ALL_OTHER_TARGETS += jsobjectdocs
+
+JSOBJECT_DOCDIR := $(JRE_API_DOCSDIR)/plugin/jsobject
+JSOBJECT2COREAPI := ../../$(JDKJRE2COREAPI)
+JSOBJECT_DOCTITLE := Java$(TRADEMARK) JSObject Doc
+JSOBJECT_WINDOWTITLE := Java JSObject Doc
+JSOBJECT_HEADER := <strong>Java JSObject Doc</strong>
+JSOBJECT_BOTTOM := $(call CommonBottom,$(JSOBJECT_FIRST_COPYRIGHT_YEAR))
+# JSOBJECT_PKGS is located in NON_CORE_PKGS.gmk
+
+JSOBJECT_INDEX_HTML = $(JSOBJECT_DOCDIR)/index.html
+JSOBJECT_OPTIONS_FILE = $(DOCSTMPDIR)/jsobject.options
+JSOBJECT_PACKAGES_FILE = $(DOCSTMPDIR)/jsobject.packages
+
+# The modules required to be documented
+JSOBJECT_MODULES = jdk.jsobject
+
+jsobjectdocs: $(JSOBJECT_INDEX_HTML)
+
+# Set relative location to core api document root
+$(JSOBJECT_INDEX_HTML): GET2DOCSDIR=$(JSOBJECT2COREAPI)/..
+
+# Run javadoc if the index file is out of date or missing
+$(JSOBJECT_INDEX_HTML): $(JSOBJECT_OPTIONS_FILE) $(JSOBJECT_PACKAGES_FILE) $(COREAPI_INDEX_FILE)
+	$(prep-javadoc)
+	$(call JavadocSummary,$(JSOBJECT_OPTIONS_FILE),$(JSOBJECT_PACKAGES_FILE))
+	$(JAVADOC_CMD_SMALL) -d $(@D) \
+	    @$(JSOBJECT_OPTIONS_FILE) @$(JSOBJECT_PACKAGES_FILE)
+
+# Create file with javadoc options in it
+$(JSOBJECT_OPTIONS_FILE):
+	$(prep-target)
+	@($(call COMMON_JAVADOCFLAGS) ; \
+          $(call COMMON_JAVADOCTAGS) ; \
+	  $(call OptionOnly,-Xdoclint:none) ; \
+          $(call OptionPair,-system,none) ; \
+	  $(call OptionPair,-modulesourcepath,$(RELEASEDOCS_MODULESOURCEPATH)) ; \
+	  $(call OptionPair,-addmods,$(JSOBJECT_MODULES)) ; \
+	  $(call OptionPair,-encoding,ascii) ; \
+	  $(call OptionOnly,-nodeprecatedlist) ; \
+	  $(call OptionPair,-doctitle,$(JSOBJECT_DOCTITLE)) ; \
+	  $(call OptionPair,-windowtitle,$(JSOBJECT_WINDOWTITLE) $(DRAFT_WINTITLE)); \
+	  $(call OptionPair,-header,$(JSOBJECT_HEADER)$(DRAFT_HEADER)); \
+	  $(call OptionPair,-bottom,$(JSOBJECT_BOTTOM)$(DRAFT_BOTTOM)); \
+	  $(call OptionTrip,-linkoffline,$(JSOBJECT2COREAPI),$(COREAPI_DOCSDIR)/); \
+	) >> $@
+
+# Create a file with the package names in it
+$(JSOBJECT_PACKAGES_FILE): $(call PackageDependencies,$(JSOBJECT_PKGS))
+	$(prep-target)
+	$(call PackageFilter,$(JSOBJECT_PKGS))
+
+
+#############################################################
+#
 # mgmtdocs
 #
 
@@ -1610,7 +1664,7 @@
 #
 # TODO: Need to decide when the plugin API is ready to publish as experimental API.
 # This target is temporarily added for internal use for now.
-#        
+#
 
 ALL_OTHER_TARGETS += jlinkdocs
 
diff --git a/make/Main.gmk b/make/Main.gmk
index d2c7461..f126729 100644
--- a/make/Main.gmk
+++ b/make/Main.gmk
@@ -704,7 +704,7 @@
 
   test-image-failure-handler: build-test-failure-handler
 
-  build-test-hotspot-jtreg-native: buildtools-jdk
+  build-test-hotspot-jtreg-native: buildtools-jdk import-hotspot
 
   build-test-jdk-jtreg-native: buildtools-jdk
 
diff --git a/make/common/NON_CORE_PKGS.gmk b/make/common/NON_CORE_PKGS.gmk
index ad546a4..e17ff14 100644
--- a/make/common/NON_CORE_PKGS.gmk
+++ b/make/common/NON_CORE_PKGS.gmk
@@ -114,8 +114,11 @@
 
 JACCESSAPI_PKGS = com.sun.java.accessibility.util
 
+JSOBJECT_PKGS = netscape.javascript
+
 # non-core packages in rt.jar
 NON_CORE_PKGS = $(DOMAPI_PKGS) \
+    $(JSOBJECT_PKGS) \
     $(MGMT_PKGS) \
     $(JAAS_PKGS) \
     $(JGSS_PKGS) \
diff --git a/nashorn/.hgtags b/nashorn/.hgtags
index 8e090a1..5d335c3 100644
--- a/nashorn/.hgtags
+++ b/nashorn/.hgtags
@@ -363,3 +363,4 @@
 ff07be6106fa56b72c163244f45a3ecb4c995564 jdk-9+127
 5a189c5b396c353786343b590f6c19a5d929f01d jdk-9+128
 68020a486500422e2c8b94b0f35cafe54c9e219a jdk-9+129
+0de67a63e2c73781ecf5979a2f3aa9619a445c37 jdk-9+130
diff --git a/nashorn/docs/DEVELOPER_README b/nashorn/docs/DEVELOPER_README
index deb525d..2c116bf 100644
--- a/nashorn/docs/DEVELOPER_README
+++ b/nashorn/docs/DEVELOPER_README
@@ -302,6 +302,16 @@
 See -Dnashorn.debug for methods to access the event queue.
 The default value is 1024.
 
+SYSTEM PROPERTY: -Dnashorn.anonymous.classes.threshold=<value>
+
+Nashorn can use anonymous classes for loading compiled scripts, depending
+on the --anonymous-classes=[auto|true|false] option. Anonymous classes load
+faster, but the loaded classes get less optimization applied to them and
+therefore usually run slower. In the default "auto" setting, scripts are
+loaded as anonymous classes if the script size does not exceed 512 bytes.
+The above system property allows to set this threshold to a user defined
+value.
+
 ===============
 2. The loggers.
 ===============
diff --git a/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/codegen/OptimisticTypesCalculator.java b/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/codegen/OptimisticTypesCalculator.java
index 6f1fdeb..ac05a5f 100644
--- a/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/codegen/OptimisticTypesCalculator.java
+++ b/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/codegen/OptimisticTypesCalculator.java
@@ -99,7 +99,9 @@
                     tagNeverOptimistic(binaryNode.rhs());
                 }
             }
-        } else if(binaryNode.isTokenType(TokenType.INSTANCEOF)) {
+        } else if(binaryNode.isTokenType(TokenType.INSTANCEOF)
+                || binaryNode.isTokenType(TokenType.EQ_STRICT)
+                || binaryNode.isTokenType(TokenType.NE_STRICT)) {
             tagNeverOptimistic(binaryNode.lhs());
             tagNeverOptimistic(binaryNode.rhs());
         }
diff --git a/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/runtime/Context.java b/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/runtime/Context.java
index 21155f9..17ff028 100644
--- a/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/runtime/Context.java
+++ b/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/runtime/Context.java
@@ -1502,7 +1502,7 @@
         final URL          url    = source.getURL();
         final CodeSource   cs     = new CodeSource(url, (CodeSigner[])null);
         final CodeInstaller installer;
-        if (!env.useAnonymousClasses(isEval) || env._persistent_cache || !env._lazy_compilation) {
+        if (!env.useAnonymousClasses(source.getLength()) || env._persistent_cache || !env._lazy_compilation) {
             // Persistent code cache and eager compilation preclude use of VM anonymous classes
             final ScriptLoader loader = env._loader_per_compile ? createNewLoader() : scriptLoader;
             installer = new NamedContextCodeInstaller(this, cs, loader);
diff --git a/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/runtime/ScriptEnvironment.java b/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/runtime/ScriptEnvironment.java
index 3e358cc..5b62cf9 100644
--- a/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/runtime/ScriptEnvironment.java
+++ b/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/runtime/ScriptEnvironment.java
@@ -222,7 +222,7 @@
     /** Timing */
     public final Timing _timing;
 
-    /** Whether to use anonymous classes. See {@link #useAnonymousClasses(boolean)}. */
+    /** Whether to use anonymous classes. See {@link #useAnonymousClasses(int)}. */
     private final AnonymousClasses _anonymousClasses;
     private enum AnonymousClasses {
         AUTO,
@@ -230,6 +230,12 @@
         ON
     }
 
+    /** Size threshold up to which we use anonymous classes in {@link AnonymousClasses#AUTO} setting */
+    private final int _anonymous_classes_threshold;
+
+    /** Default value for anonymous class threshold */
+    private final static int DEFAULT_ANON_CLASS_THRESHOLD = 512;
+
     /**
      * Constructor
      *
@@ -327,6 +333,8 @@
             throw new RuntimeException("Unsupported value for anonymous classes: " + anonClasses);
         }
 
+        this._anonymous_classes_threshold = Options.getIntProperty(
+                "nashorn.anonymous.classes.threshold", DEFAULT_ANON_CLASS_THRESHOLD);
 
         final String language = options.getString("language");
         if (language == null || language.equals("es5")) {
@@ -462,11 +470,12 @@
 
     /**
      * Returns true if compilation should use anonymous classes.
-     * @param isEval true if compilation is an eval call.
+     * @param sourceLength length of source being compiled.
      * @return true if anonymous classes should be used
      */
-    public boolean useAnonymousClasses(final boolean isEval) {
-        return _anonymousClasses == AnonymousClasses.ON || (_anonymousClasses == AnonymousClasses.AUTO && isEval);
+    public boolean useAnonymousClasses(final int sourceLength) {
+        return _anonymousClasses == AnonymousClasses.ON
+                || (_anonymousClasses == AnonymousClasses.AUTO && sourceLength <= _anonymous_classes_threshold);
     }
 
 }
diff --git a/nashorn/test/script/basic/JDK-8160034.js b/nashorn/test/script/basic/JDK-8160034.js
index 4d019d3..9f6a130 100644
--- a/nashorn/test/script/basic/JDK-8160034.js
+++ b/nashorn/test/script/basic/JDK-8160034.js
@@ -22,7 +22,7 @@
  */
 
 /**
- * JDK-8160034.js: The `this` value in the `with` is broken by the repetition of a function call
+ * JDK-8160034: The `this` value in the `with` is broken by the repetition of a function call
  *
  * @test
  * @option --unstable-relink-threshold=4
diff --git a/nashorn/test/script/basic/JDK-8162771.js b/nashorn/test/script/basic/JDK-8162771.js
new file mode 100644
index 0000000..8298b4c
--- /dev/null
+++ b/nashorn/test/script/basic/JDK-8162771.js
@@ -0,0 +1,54 @@
+/*
+ * 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.
+ */
+
+/**
+ * JDK-8162771: Strict equality operators should not be optimistic
+ *
+ * @test
+ * @run
+ */
+
+var l = new java.lang.Long(1);
+
+Assert.assertTrue(typeof l === "object");
+Assert.assertTrue(typeof l.longValue() === "object");
+
+Assert.assertTrue(1 == l);
+Assert.assertTrue(1 == l.longValue());
+Assert.assertTrue(l == 1);
+Assert.assertTrue(l.longValue() == 1);
+
+Assert.assertFalse(1 != l);
+Assert.assertFalse(1 != l.longValue());
+Assert.assertFalse(l != 1);
+Assert.assertFalse(l.longValue() != 1);
+
+Assert.assertFalse(1 === l);
+Assert.assertFalse(1 === l.longValue());
+Assert.assertFalse(l === 1);
+Assert.assertFalse(l.longValue() === 1);
+
+Assert.assertTrue(1 !== l);
+Assert.assertTrue(1 !== l.longValue());
+Assert.assertTrue(l !== 1);
+Assert.assertTrue(l.longValue() !== 1);
diff --git a/test/jtreg-ext/requires/VMProps.java b/test/jtreg-ext/requires/VMProps.java
index 945d754..644c8cd 100644
--- a/test/jtreg-ext/requires/VMProps.java
+++ b/test/jtreg-ext/requires/VMProps.java
@@ -23,8 +23,6 @@
 package requires;
 
 import java.io.IOException;
-import java.lang.management.ManagementFactory;
-import java.lang.management.RuntimeMXBean;
 import java.nio.file.Files;
 import java.nio.file.Paths;
 import java.util.ArrayList;
@@ -35,14 +33,18 @@
 import java.util.regex.Matcher;
 import java.util.regex.Pattern;
 import sun.hotspot.gc.GC;
+import sun.hotspot.WhiteBox;
 
 /**
  * The Class to be invoked by jtreg prior Test Suite execution to
  * collect information about VM.
+ * Do not use any API's that may not be available in all target VMs.
  * Properties set by this Class will be available in the @requires expressions.
  */
 public class VMProps implements Callable<Map<String, String>> {
 
+    private static final WhiteBox WB = WhiteBox.getWhiteBox();
+
     /**
      * Collects information about VM properties.
      * This method will be invoked by jtreg.
@@ -131,17 +133,14 @@
      * @return "true" if Flight Recorder is enabled, "false" if is disabled.
      */
     protected String vmFlightRecorder() {
-        RuntimeMXBean runtimeMxBean = ManagementFactory.getRuntimeMXBean();
-        List<String> arguments = runtimeMxBean.getInputArguments();
-        if (arguments.contains("-XX:+UnlockCommercialFeatures")) {
-            if (arguments.contains("-XX:+FlightRecorder")) {
+        Boolean isUnlockedCommercialFatures = WB.getBooleanVMFlag("UnlockCommercialFeatures");
+        Boolean isFlightRecorder = WB.getBooleanVMFlag("FlightRecorder");
+        String startFROptions = WB.getStringVMFlag("StartFlightRecording");
+        if (isUnlockedCommercialFatures != null && isUnlockedCommercialFatures) {
+            if (isFlightRecorder != null && isFlightRecorder) {
                 return "true";
             }
-            if (arguments.contains("-XX:-FlightRecorder")) {
-                return "false";
-            }
-            if (arguments.stream()
-                    .anyMatch(option -> option.startsWith("-XX:StartFlightRecording"))) {
+            if (startFROptions != null && !startFROptions.isEmpty()) {
                 return "true";
             }
         }
diff --git a/test/lib/share/classes/jdk/test/lib/Platform.java b/test/lib/share/classes/jdk/test/lib/Platform.java
index 966f70d..8c55f09 100644
--- a/test/lib/share/classes/jdk/test/lib/Platform.java
+++ b/test/lib/share/classes/jdk/test/lib/Platform.java
@@ -26,15 +26,15 @@
 import java.util.regex.Pattern;
 
 public class Platform {
+    public  static final String vmName      = System.getProperty("java.vm.name");
+    public  static final String vmInfo      = System.getProperty("java.vm.info");
     private static final String osName      = System.getProperty("os.name");
     private static final String dataModel   = System.getProperty("sun.arch.data.model");
     private static final String vmVersion   = System.getProperty("java.vm.version");
     private static final String javaVersion = System.getProperty("java.version");
     private static final String osArch      = System.getProperty("os.arch");
-    private static final String vmName      = System.getProperty("java.vm.name");
     private static final String userName    = System.getProperty("user.name");
     private static final String compiler    = System.getProperty("sun.management.compiler");
-    private static final String vmInfo      = System.getProperty("java.vm.info");
 
     public static boolean isClient() {
         return vmName.endsWith(" Client VM");
diff --git a/test/lib/sun/hotspot/WhiteBox.java b/test/lib/sun/hotspot/WhiteBox.java
index e34b27a..1db761d 100644
--- a/test/lib/sun/hotspot/WhiteBox.java
+++ b/test/lib/sun/hotspot/WhiteBox.java
@@ -84,6 +84,7 @@
   public native long getVMAllocationGranularity();
   public native long getVMLargePageSize();
   public native long getHeapSpaceAlignment();
+  public native long getHeapAlignment();
 
   private native boolean isObjectInOldGen0(Object o);
   public         boolean isObjectInOldGen(Object o) {