Merge from default JEP-230-microbenchmarks-branch
authorihse
Wed, 03 Oct 2018 16:02:24 +0200
branchJEP-230-microbenchmarks-branch
changeset 56921 69544f53b8bf
parent 56920 e0750e33f818 (current diff)
parent 51997 9ce37fa2e179 (diff)
child 56922 4219852032ba
Merge from default
make/Jprt.gmk
make/Main.gmk
make/conf/jib-profiles.js
make/jprt.properties
src/java.desktop/share/classes/com/sun/awt/SecurityWarning.java
src/java.desktop/share/classes/sun/applet/AppletClassLoader.java
src/java.desktop/share/classes/sun/applet/AppletSecurity.java
src/java.desktop/share/classes/sun/applet/AppletThreadGroup.java
src/java.desktop/share/classes/sun/awt/HToolkit.java
src/java.desktop/unix/native/libawt_xawt/awt/HPkeysym.h
test/hotspot/jtreg/jprt.config
test/jaxp/javax/xml/jaxp/libs/jaxp/library/JarUtils.java
test/jdk/com/sun/awt/SecurityWarning/CustomSecurityManager.java
test/jdk/com/sun/awt/SecurityWarning/GetSizeShouldNotReturnZero.java
test/jdk/com/sun/awt/TEST.properties
test/jdk/com/sun/jdi/CatchPatternTest.sh
test/jdk/com/sun/jdi/ImmutableResourceTest.sh
test/jdk/com/sun/jdi/JITDebug.sh
test/jdk/com/sun/jdi/PrivateTransportTest.sh
test/jdk/com/sun/jdi/connect/spi/JdiLoadedByCustomLoader.sh
test/jdk/com/sun/jdi/redefine/RedefineSetUp.sh
test/jdk/com/sun/jdi/redefineMethod/RedefineSetUp.sh
test/jdk/java/awt/dnd/BadSerializaionTest/BadSerializationTest.java
test/jdk/java/awt/dnd/BadSerializaionTest/badAction
test/jdk/java/awt/dnd/BadSerializaionTest/good
test/jdk/java/awt/dnd/BadSerializaionTest/noEvents
test/jdk/java/awt/dnd/BadSerializaionTest/nullComponent
test/jdk/java/awt/dnd/BadSerializaionTest/nullDragSource
test/jdk/java/awt/dnd/BadSerializaionTest/nullOrigin
test/jdk/jprt.config
test/jdk/lib/testlibrary/JarUtils.java
test/jdk/sun/security/tools/keytool/autotest.sh
test/jdk/sun/security/tools/keytool/standard.sh
test/langtools/tools/javadoc/api/basic/IsSupportedOptionTest.java
--- a/.hgtags	Wed Oct 03 15:54:35 2018 +0200
+++ b/.hgtags	Wed Oct 03 16:02:24 2018 +0200
@@ -513,3 +513,4 @@
 8f594f75e0547d4ca16649cb3501659e3155e81b jdk-12+10
 f0f5d23449d31f1b3580c8a73313918cafeaefd7 jdk-12+11
 15094d12a632f452a2064318a4e416d0c7a9ce0c jdk-12+12
+511a9946f83e3e3c7b9dbe1840367063fb39b4e1 jdk-12+13
--- a/make/Jprt.gmk	Wed Oct 03 15:54:35 2018 +0200
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,107 +0,0 @@
-#
-# 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
-# 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 contains targets and utilities needed by JPRT.
-
-# Cygpath is only defined when running on Cygwin
-ifneq ($(CYGPATH), )
-  # If we get JPRT_ARCHIVE_*BUNDLE externally, make sure they have /cygdrive
-  # style paths
-  ifdef JPRT_ARCHIVE_BUNDLE
-    override JPRT_ARCHIVE_BUNDLE := $(shell $(CYGPATH) -u $(JPRT_ARCHIVE_BUNDLE))
-  endif
-  ifdef JPRT_ARCHIVE_TEST_BUNDLE
-    override JPRT_ARCHIVE_TEST_BUNDLE := \
-        $(shell $(CYGPATH) -u $(JPRT_ARCHIVE_TEST_BUNDLE))
-  endif
-  ifdef JPRT_ARCHIVE_SYMBOLS_BUNDLE
-    override JPRT_ARCHIVE_SYMBOLS_BUNDLE := \
-        $(shell $(CYGPATH) -u $(JPRT_ARCHIVE_SYMBOLS_BUNDLE))
-  endif
-endif
-
-# When running in JPRT these will be provided. Need defaults so that this makefile
-# is valid anyway.
-ifndef JPRT_ARCHIVE_BUNDLE
-  JPRT_ARCHIVE_BUNDLE=/tmp/jprt_bundles/jdk-image.zip
-endif
-ifndef JPRT_ARCHIVE_TEST_BUNDLE
-  JPRT_ARCHIVE_TEST_BUNDLE=/tmp/jprt_bundles/test-image.zip
-endif
-ifndef JPRT_ARCHIVE_SYMBOLS_BUNDLE
-  JPRT_ARCHIVE_SYMBOLS_BUNDLE=/tmp/jprt_bundles/symbols-image.zip
-endif
-
-ifeq ($(SKIP_BOOT_CYCLE), false)
-  jprt_bundle: bootcycle-images
-endif
-
-################################################################################
-# JPRT specific bundling targets
-JPRT_TARGET ?= $(DEFAULT_MAKE_TARGET)
-ifeq ($(JPRT_TARGET), $(DEFAULT_MAKE_TARGET))
-  jprt_bundle: $(DEFAULT_MAKE_TARGET) $(JPRT_ARCHIVE_BUNDLE) \
-      $(JPRT_ARCHIVE_TEST_BUNDLE)
-
-  SRC_JDK_IMAGE_DIR := $(JDK_IMAGE_DIR)
-  SRC_TEST_IMAGE_DIR := $(TEST_IMAGE_DIR)
-
-  # This target must be called in the context of a SPEC file
-  $(JPRT_ARCHIVE_BUNDLE): product-images
-	$(call MakeDir, $(@D))
-	$(CD) $(SRC_JDK_IMAGE_DIR) && $(ZIPEXE) -y -q -r $@ .
-
-  $(JPRT_ARCHIVE_TEST_BUNDLE): test-image
-	$(call MakeDir, $(@D))
-	$(CD) $(SRC_TEST_IMAGE_DIR) && $(ZIPEXE) -y -q -r $@ .
-
-  ##############################################################################
-  # Optional symbols bundle
-  ifeq ($(GCOV_ENABLED), true)
-    jprt_bundle: $(JPRT_ARCHIVE_SYMBOLS_BUNDLE)
-
-    $(JPRT_ARCHIVE_SYMBOLS_BUNDLE): product-images
-	$(call MakeDir, $(@D))
-	$(CD) $(SYMBOLS_IMAGE_DIR) && $(ZIPEXE) -y -q -r $@ .
-
-  endif
-
-  ##############################################################################
-
-else
-  # Just fake the main bundle to satisfy JPRT
-  jprt_bundle: $(JPRT_TARGET)
-	@$(call TargetEnter)
-	$(MKDIR) -p $(OUTPUTDIR)/bundles
-	$(CD) $(TOPDIR) && $(TAR) cf - README | $(GZIP) > \
-	    $(JPRT_ARCHIVE_BUNDLE)
-	@$(call TargetExit)
-endif
-
-ALL_TARGETS += jprt_bundle
-
-################################################################################
-
-$(eval $(call IncludeCustomExtension, Jprt.gmk))
--- a/make/Main.gmk	Wed Oct 03 15:54:35 2018 +0200
+++ b/make/Main.gmk	Wed Oct 03 16:02:24 2018 +0200
@@ -1140,11 +1140,6 @@
 
 ################################################################################
 
-# Include JPRT targets
-include $(TOPDIR)/make/Jprt.gmk
-
-################################################################################
-
 # The following targets are intentionally not added to ALL_TARGETS since they
 # are internal only, to support Init.gmk.
 
--- a/make/autoconf/hotspot.m4	Wed Oct 03 15:54:35 2018 +0200
+++ b/make/autoconf/hotspot.m4	Wed Oct 03 16:02:24 2018 +0200
@@ -351,6 +351,11 @@
     AC_MSG_RESULT([no])
   fi
 
+  # Disable unsupported GCs for Zero
+  if HOTSPOT_CHECK_JVM_VARIANT(zero); then
+    DISABLED_JVM_FEATURES="$DISABLED_JVM_FEATURES epsilongc g1gc zgc"
+  fi
+
   # Turn on additional features based on other parts of configure
   if test "x$INCLUDE_DTRACE" = "xtrue"; then
     JVM_FEATURES="$JVM_FEATURES dtrace"
--- a/make/conf/jib-profiles.js	Wed Oct 03 15:54:35 2018 +0200
+++ b/make/conf/jib-profiles.js	Wed Oct 03 16:02:24 2018 +0200
@@ -525,8 +525,7 @@
             profiles[maketestName].default_make_targets = [ "test-make" ];
         });
 
-    // Profiles for building the zero jvm variant. These are used for verification
-    // in JPRT.
+    // Profiles for building the zero jvm variant. These are used for verification.
     var zeroProfiles = {
         "linux-x64-zero": {
             target_os: "linux",
@@ -733,18 +732,8 @@
         });
     });
 
-    // Profiles used to run tests. Used in JPRT and Mach 5.
+    // Profiles used to run tests.
     var testOnlyProfiles = {
-        "run-test-jprt": {
-            target_os: input.build_os,
-            target_cpu: input.build_cpu,
-            dependencies: [ "jtreg", "gnumake", "boot_jdk", "devkit", "jib" ],
-            labels: "test",
-            environment: {
-                "JT_JAVA": common.boot_jdk_home
-            }
-        },
-
         "run-test": {
             target_os: input.build_os,
             target_cpu: input.build_cpu,
@@ -806,7 +795,6 @@
                 + "/Xcode.app/Contents/Developer/usr/bin"
         };
         profiles["run-test"] = concatObjects(profiles["run-test"], macosxRunTestExtra);
-        profiles["run-test-jprt"] = concatObjects(profiles["run-test-jprt"], macosxRunTestExtra);
         profiles["run-test-prebuilt"] = concatObjects(profiles["run-test-prebuilt"], macosxRunTestExtra);
     }
     // On windows we want the debug symbols available at test time
@@ -840,7 +828,7 @@
         linux_x64: "gcc7.3.0-OEL6.4+1.0",
         macosx_x64: "Xcode9.4-MacOSX10.13+1.0",
         solaris_x64: "SS12u4-Solaris11u1+1.0",
-        solaris_sparcv9: "SS12u4-Solaris11u1+1.1",
+        solaris_sparcv9: "SS12u6-Solaris11u3+1.0",
         windows_x64: "VS2017-15.5.5+1.0",
         linux_aarch64: (input.profile != null && input.profile.indexOf("arm64") >= 0
                     ? "gcc-linaro-aarch64-linux-gnu-4.8-2013.11_linux+1.0"
--- a/make/devkit/createSolarisDevkit12.6.sh	Wed Oct 03 15:54:35 2018 +0200
+++ b/make/devkit/createSolarisDevkit12.6.sh	Wed Oct 03 16:02:24 2018 +0200
@@ -34,18 +34,19 @@
 # install in a separate temporary image.
 #
 # The Solaris Studio installation must contain at least these packages:
-# developer/developerstudio-126/backend               12.6-1.0.0.0               i--
-# developer/developerstudio-126/c++                   12.6-1.0.0.0               i--
-# developer/developerstudio-126/cc                    12.6-1.0.0.0               i--
-# developer/developerstudio-126/dbx (solarisstudio)   12.6-1.0.0.0               i--
-# developer/developerstudio-126/library/c++-libs      12.6-1.0.0.0               i--
-# developer/developerstudio-126/library/math-libs     12.6-1.0.0.0               i--
-# developer/developerstudio-126/library/c-libs        12.6-1.0.0.0               i--
-# developer/developerstudio-126/library/studio-gccrt  12.6-1.0.0.0               i--
-# developer/developerstudio-126/studio-common         12.6-1.0.0.0               i--
-# developer/developerstudio-126/studio-ja             12.6-1.0.0.0               i--
-# developer/developerstudio-126/studio-legal          12.6-1.0.0.0               i--
-# developer/developerstudio-126/studio-zhCN           12.6-1.0.0.0               i--
+#developer/developerstudio-126/backend                12.6-1.0.0.1
+#developer/developerstudio-126/c++                    12.6-1.0.2.0
+#developer/developerstudio-126/cc                     12.6-1.0.1.0
+#developer/developerstudio-126/dbx                    12.6-1.0.0.1
+#developer/developerstudio-126/library/c++-libs       12.6-1.0.2.0
+#developer/developerstudio-126/library/c-libs         12.6-1.0.0.1
+#developer/developerstudio-126/library/f90-libs       12.6-1.0.0.1
+#developer/developerstudio-126/library/math-libs      12.6-1.0.0.1
+#developer/developerstudio-126/library/studio-gccrt   12.6-1.0.0.1
+#developer/developerstudio-126/studio-common          12.6-1.0.0.1
+#developer/developerstudio-126/studio-ja              12.6-1.0.0.1
+#developer/developerstudio-126/studio-legal           12.6-1.0.0.1
+#developer/developerstudio-126/studio-zhCN            12.6-1.0.0.1
 #
 # erik.joelsson@oracle.com
 
@@ -93,7 +94,7 @@
   pkg -R $INSTALL_ROOT set-publisher -P -g ${PUBLISHER_URI} solaris
   sudo pkg -R $INSTALL_ROOT install --accept entire@$SOLARIS_ENTIRE_VERSION \
       system/install developer/gnu-binutils system/library/mmheap system/picl \
-      developer/assembler
+      developer/assembler system/library/freetype-2
 else
   echo "Skipping installing packages"
 fi
--- a/make/jprt.properties	Wed Oct 03 15:54:35 2018 +0200
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,503 +0,0 @@
-#
-# Copyright (c) 2006, 2018, Oracle and/or its affiliates. All rights reserved.
-# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
-#
-# This code is free software; you can redistribute it and/or modify it
-# 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.
-#
-
-##############
-#
-# Global settings
-#
-
-# Install test bundle for targets in jprt.test.bundle.targets set
-jprt.selective.test.bundle.installation=true
-
-# The current release name
-jprt.tools.default.release=jdk9
-
-# Allow concurrent changes to be merged in prior to pushing
-jprt.sync.push=true
-
-# Directories to be excluded from the source bundles
-jprt.bundle.exclude.src.dirs=build dist webrev ${jprt.bundle.exclude.src.dirs.extra}
-
-# Use configure when building
-jprt.build.use.configure=true
-jprt.build.use.jib=true
-jprt.test.use.jib=true
-jprt.jib.launcher=bin/jib.sh
-jprt.build.use.jib.publish=true
-
-# Clear out all the build needs as JIB handles this
-jprt.jdk9.build.needs=
-jprt.macosx.jdk9.build.needs=
-jprt.windows_i586.jdk9.build.needs=
-jprt.windows_x64.jdk9.build.needs=
-jprt.solaris.jdk9.build.needs=
-jprt.linux_i586.jdk9.build.needs=
-jprt.linux_x64.jdk9.build.needs=
-jprt.linux_armv6.jdk9.build.needs=
-jprt.linux_armvh.jdk9.build.needs=
-jprt.linux_arm64.jdk9.build.needs=
-jprt.linux_armsflt.jdk9.build.needs=
-jprt.linux_armvfpsflt.jdk9.build.needs=
-jprt.linux_armvfphflt.jdk9.build.needs=
-jprt.linux_armv6vfphflt.jdk9.build.needs=
-jprt.solaris.client.build.needs=
-jprt.linux.client.build.needs=
-jprt.solaris.jdk9.compiler=
-jprt.linux.jdk9.compiler=
-jprt.jdk9.test.needs=
-
-# Disable the need for preinstalled Visual Studio and Xcode
-jprt.windows.jdk9.compiler=
-jprt.windows.6.2.jdk9.compiler=
-jprt.windows.6.3.jdk9.compiler=
-jprt.windows.jdk9.target.attribute.compilerVS2013.appliesTo.builds=none
-jprt.macosx.jdk9.target.attribute.compilerXcode511.appliesTo.builds=none
-
-# Set up the run flavors (jvm variants)
-jprt.run.flavors=c2,default,${my.additional.run.flavors}
-
-# Setup jib profiles
-jprt.linux_i586.product.build.jib.profile=linux-x86
-jprt.linux_x64.product.build.jib.profile=linux-x64
-jprt.macosx_x64.product.build.jib.profile=macosx-x64
-jprt.solaris_sparcv9.product.build.jib.profile=solaris-sparcv9
-jprt.solaris_x64.product.build.jib.profile=solaris-x64
-jprt.windows_i586.product.build.jib.profile=windows-x86
-jprt.windows_x64.product.build.jib.profile=windows-x64
-
-jprt.linux_i586.fastdebug.build.jib.profile=linux-x86-debug
-jprt.linux_x64.fastdebug.build.jib.profile=linux-x64-debug
-jprt.macosx_x64.fastdebug.build.jib.profile=macosx-x64-debug
-jprt.solaris_sparcv9.fastdebug.build.jib.profile=solaris-sparcv9-debug
-jprt.solaris_x64.fastdebug.build.jib.profile=solaris-x64-debug
-jprt.windows_i586.fastdebug.build.jib.profile=windows-x86-debug
-jprt.windows_x64.fastdebug.build.jib.profile=windows-x64-debug
-
-jprt.linux_i586.slowdebug.build.jib.profile=linux-x86-slowdebug
-jprt.linux_x64.slowdebug.build.jib.profile=linux-x64-slowdebug
-jprt.macosx_x64.slowdebug.build.jib.profile=macosx-x64-slowdebug
-jprt.solaris_sparcv9.slowdebug.build.jib.profile=solaris-sparcv9-slowdebug
-jprt.solaris_x64.slowdebug.build.jib.profile=solaris-x64-slowdebug
-jprt.windows_i586.slowdebug.build.jib.profile=windows-x86-slowdebug
-jprt.windows_x64.slowdebug.build.jib.profile=windows-x64-slowdebug
-
-jprt.linux_i586.productOpen.build.jib.profile=linux-x86-open
-jprt.linux_x64.productOpen.build.jib.profile=linux-x64-open
-jprt.macosx_x64.productOpen.build.jib.profile=macosx-x64-open
-jprt.solaris_sparcv9.productOpen.build.jib.profile=solaris-sparcv9-open
-jprt.solaris_x64.productOpen.build.jib.profile=solaris-x64-open
-jprt.windows_i586.productOpen.build.jib.profile=windows-x86-open
-jprt.windows_x64.productOpen.build.jib.profile=windows-x64-open
-
-jprt.linux_i586.fastdebugOpen.build.jib.profile=linux-x86-open-debug
-jprt.linux_x64.fastdebugOpen.build.jib.profile=linux-x64-open-debug
-jprt.macosx_x64.fastdebugOpen.build.jib.profile=macosx-x64-open-debug
-jprt.solaris_sparcv9.fastdebugOpen.build.jib.profile=solaris-sparcv9-open-debug
-jprt.solaris_x64.fastdebugOpen.build.jib.profile=solaris-x64-open-debug
-jprt.windows_i586.fastdebugOpen.build.jib.profile=windows-x86-open-debug
-jprt.windows_x64.fastdebugOpen.build.jib.profile=windows-x64-open-debug
-
-jprt.linux_i586.productZero.build.jib.profile=linux-x86-zero
-jprt.linux_x64.productZero.build.jib.profile=linux-x64-zero
-
-jprt.linux_i586.fastdebugZero.build.jib.profile=linux-x86-zero-debug
-jprt.linux_x64.fastdebugZero.build.jib.profile=linux-x64-zero-debug
-
-jprt.test.jib.profile=run-test-jprt
-
-# Set make target to use for different build flavors
-jprt.build.flavor.fastdebugOpen.target=jprt_bundle
-jprt.build.flavor.fastdebug.target=jprt_bundle
-jprt.build.flavor.product.target=jprt_bundle
-jprt.build.flavor.productOpen.target=jprt_bundle
-jprt.build.flavor.optimized.target=jprt_bundle
-jprt.build.flavor.optimizedOpen.target=jprt_bundle
-jprt.build.flavor.slowdebug.target=jprt_bundle
-jprt.build.flavor.productZero.target=jprt_bundle
-jprt.build.flavor.fastdebugZero.target=jprt_bundle
-
-# Use these configure args to define debug level or provide specific
-# configuration details not covered by Jib profiles.
-jprt.slowdebug.build.configure.args=
-jprt.fastdebug.build.configure.args=--disable-precompiled-headers
-# Don't disable precompiled headers on windows. It's simply too slow.
-jprt.windows_i586.fastdebug.build.configure.args=
-jprt.windows_x64.fastdebug.build.configure.args=
-jprt.windows_i586.fastdebugOpen.build.configure.args=
-jprt.windows_x64.fastdebugOpen.build.configure.args=
-jprt.product.build.configure.args=
-jprt.optimized.build.configure.args=--with-debug-level=optimized
-jprt.slowdebugOpen.build.configure.args=${jprt.slowdebug.build.configure.args}
-jprt.fastdebugOpen.build.configure.args=${jprt.fastdebug.build.configure.args}
-jprt.productOpen.build.configure.args=${jprt.product.build.configure.args}
-jprt.optimizedOpen.build.configure.args=${jprt.product.build.configure.args}
-
-
-# hotspot testset has custom build flavors and build targets
-my.jprt.testsetHasCustomBuildFlavors.hotspot=true
-my.jprt.testsetHasCustomBuildTargets.hotspot=true
-my.jprt.testsetHasCustomBuildFlavors.buildinfra=true
-my.jprt.testsetHasCustomBuildTargets.buildinfra=true
-
-# determine if the specified testset has custom build flavors or build targets
-my.jprt.testsetHasCustomBuildFlavors=${my.jprt.testsetHasCustomBuildFlavors.${jprt.test.set}}
-my.jprt.testsetHasCustomBuildTargets=${my.jprt.testsetHasCustomBuildTargets.${jprt.test.set}}
-
-# Select build flavors and build targets based on the specified testset
-jprt.build.flavors=${my.jprt.testsetHasCustomBuildFlavors ? \
-    ${my.build.flavors.${jprt.test.set}} : ${my.build.flavors.default}}
-jprt.build.targets=${my.jprt.testsetHasCustomBuildTargets ? \
-    ${my.build.targets.${jprt.test.set}} : ${my.build.targets.default}}
-
-# Select test targets - jprt default for jprt.test.set is "default"
-jprt.test.targets=${my.test.targets.${jprt.test.set}}
-jprt.make.rule.test.targets=${my.make.rule.test.targets.${jprt.test.set}}
-
-# Not all test targets need the test image
-jprt.test.bundle.targets=\
-  ${my.make.rule.test.targets.svc}, \
-  ${my.make.rule.test.targets.hotspot.reg}, \
-  ${my.make.rule.test.targets.hotspot.gtest} \
-  ${my.make.rule.test.targets.nativesanity} \
-  ${my.test.target.set:TESTNAME=jdk_lang} \
-  ${my.test.target.set:TESTNAME=jdk_nio}
-
-# 7155453: Work-around to prevent popups on OSX from blocking test completion
-# but the work-around is added to all platforms to be consistent
-jprt.jbb.options=-Djava.awt.headless=true
-
-########
-#
-# Build options (generic)
-#
-
-# Configure args common to all builds
-# Also allows for additional, testset specific configure arguments to be set
-jprt.build.configure.args=						\
-    --with-output-sync=recurse						\
-    --with-jobs=$ALT_PARALLEL_COMPILE_JOBS				\
-    --with-version-opt=$JPRT_JOB_ID				 	\
-    ${my.additional.build.configure.args.${jprt.test.set}}		\
-    ${my.custom.build.configure.args}
-
-########
-#
-# Build targets and options (default/jdk)
-#
-
-# The default build flavors
-my.build.flavors.default=fastdebug,product
-
-# Standard list of jprt build targets for this source tree
-my.build.targets.default= \
-    solaris_sparcv9_5.11-{product|fastdebug}, \
-    solaris_x64_5.11-{product|fastdebug}, \
-    linux_i586_3.8-{product|fastdebug}, \
-    linux_x64_3.8-{product|fastdebug}, \
-    macosx_x64_10.9-{product|fastdebug}, \
-    windows_i586_6.3-{product|fastdebug}, \
-    windows_x64_6.3-{product|fastdebug}, \
-    ${my.additional.build.targets.default}
-
-# Test target list (no fastdebug & limited c2 testing)
-my.test.target.set=							\
-    solaris_sparcv9_5.11-product-c2-TESTNAME,				\
-    solaris_x64_5.11-product-c2-TESTNAME,				\
-    linux_i586_3.8-product-c2-TESTNAME, 				\
-    linux_x64_3.8-product-c2-TESTNAME,					\
-    macosx_x64_10.9-product-c2-TESTNAME,				\
-    windows_i586_6.3-product-c2-TESTNAME,				\
-    windows_x64_6.3-product-c2-TESTNAME
-
-# Default vm test targets (testset=default)
-my.test.targets.default=						\
-    ${my.test.target.set:TESTNAME=jvm98},				\
-    ${my.test.target.set:TESTNAME=scimark}
-
-# Default jdk test targets (testset=default)
-my.make.rule.test.targets.default=					\
-    ${my.test.target.set:TESTNAME=langtools_jtreg},			\
-    ${my.test.target.set:TESTNAME=jdk_lang},				\
-    ${my.test.target.set:TESTNAME=jdk_math},				\
-    ${my.test.target.set:TESTNAME=jdk_util}
-
-# Default vm test targets (testset=core)
-my.test.targets.core=
-
-# Core jdk test targets (testset=core)
-my.make.rule.test.targets.core=						\
-    ${my.test.target.set:TESTNAME=jdk_lang},				\
-    ${my.test.target.set:TESTNAME=jdk_math},				\
-    ${my.test.target.set:TESTNAME=jdk_util},				\
-    ${my.test.target.set:TESTNAME=jdk_io},				\
-    ${my.test.target.set:TESTNAME=jdk_net},				\
-    ${my.test.target.set:TESTNAME=jdk_nio},				\
-    ${my.test.target.set:TESTNAME=jdk_security1},			\
-    ${my.test.target.set:TESTNAME=jdk_security2},			\
-    ${my.test.target.set:TESTNAME=jdk_security3},			\
-    ${my.test.target.set:TESTNAME=jdk_security4},			\
-    ${my.test.target.set:TESTNAME=jdk_rmi},				\
-    ${my.test.target.set:TESTNAME=jdk_text},				\
-    ${my.test.target.set:TESTNAME=jdk_time},				\
-    ${my.test.target.set:TESTNAME=jdk_other},				\
-    ${my.test.target.set:TESTNAME=core_tools}
-
-# Svc vm test targets (testset=svc)
-my.test.targets.svc=
-
-# Core jdk test targets (testset=svc)
-my.make.rule.test.targets.svc=						\
-    ${my.test.target.set:TESTNAME=jdk_management},			\
-    ${my.test.target.set:TESTNAME=jdk_instrument},			\
-    ${my.test.target.set:TESTNAME=jdk_jmx},				\
-    ${my.test.target.set:TESTNAME=jdk_jdi},				\
-    ${my.test.target.set:TESTNAME=jdk_jfr},                             \
-    ${my.test.target.set:TESTNAME=svc_tools},                           \
-    ${my.make.rule.test.targets.svc.extra}
-
-# JAXP vm test targets (testset=jaxp)
-my.test.targets.jaxp=
-
-# JAXP test targets (testset=jaxp)
-my.make.rule.test.targets.jaxp=						\
-    ${my.test.target.set:TESTNAME=jaxp_all}
-
-# All vm test targets (testset=all)
-my.test.targets.all=							\
-    ${my.test.targets.default},						\
-    ${my.test.target.set:TESTNAME=runThese},				\
-    ${my.test.target.set:TESTNAME=jbb_default}
-
-# All jdk test targets (testset=all)
-my.make.rule.test.targets.all=						\
-    ${my.make.rule.test.targets.core},					\
-    ${my.make.rule.test.targets.svc},					\
-    ${my.test.target.set:TESTNAME=jdk_awt},				\
-    ${my.test.target.set:TESTNAME=jdk_beans},				\
-    ${my.test.target.set:TESTNAME=jdk_sound},				\
-    ${my.test.target.set:TESTNAME=jdk_swing}
-
-# PIT vm test targets (testset=pit)
-my.test.targets.pit=							\
-   ${my.test.targets.all}
-
-# PIT jdk test targets (testset=pit)
-my.make.rule.test.targets.pit=						\
-    ${my.test.target.set:TESTNAME=langtools_jtreg},			\
-    ${my.make.rule.test.targets.core},					\
-    ${my.make.rule.test.targets.svc}                                    \
-    ${my.make.rule.test.targets.jaxp}
-
-# JCK test targets in test/Makefile (no windows)
-my.test.target.set.jck=							\
-    solaris_sparcv9_5.11-product-c2-JCK7TESTRULE,			\
-    solaris_x64_5.11-product-c2-JCK7TESTRULE,				\
-    linux_i586_3.8-product-c2-JCK7TESTRULE,				\
-    linux_x64_3.8-product-c2-JCK7TESTRULE
-
-# JCK testset targets
-my.make.rule.test.targets.jck=						\
-    ${my.test.target.set.jck:JCK7TESTRULE=jck7devtools},		\
-    ${my.test.target.set.jck:JCK7TESTRULE=jck7runtime},			\
-    ${my.test.target.set.jck:JCK7TESTRULE=jck7compiler}
-
-
-#############
-#
-# Hotspot related settings (testset=hotspot)
-#
-
-# The hotspot build flavors
-my.build.flavors.hotspot=						\
-    fastdebugOpen,fastdebug,product,productOpen,optimized,optimizedOpen \
-    ${my.additional.build.flavors.hotspot}
-
-# Platforms built for hotspot push jobs
-my.build.targets.hotspot=						\
-    solaris_sparcv9_5.11-{product|fastdebug},				\
-    solaris_x64_5.11-{product|fastdebug},				\
-    linux_i586_3.8-{product|fastdebug},					\
-    linux_x64_3.8-{product|fastdebug},					\
-    macosx_x64_10.9-{product|fastdebug},				\
-    windows_i586_6.3-{product|fastdebug},				\
-    windows_x64_6.3-{product|fastdebug},				\
-    solaris_x64_5.11-{fastdebugOpen},					\
-    linux_x64_3.8-{productOpen},					\
-    ${my.additional.build.targets.hotspot}
-
-# Tests to run on the various platforms for hotspot push jobs
-my.test.targets.hotspot.solaris.sparcv9=				\
-    solaris_sparcv9_5.11-{product|fastdebug}-c2-jvm98,			\
-    solaris_sparcv9_5.11-{product|fastdebug}-c2-jvm98_nontiered,	\
-    solaris_sparcv9_5.11-{product|fastdebug}-c2-scimark,		\
-    solaris_sparcv9_5.11-product-c2-runThese8,
-
-my.test.targets.hotspot.solaris.x64=					\
-    solaris_x64_5.11-{product|fastdebug}-c2-jvm98,			\
-    solaris_x64_5.11-{product|fastdebug}-c2-jvm98_nontiered,		\
-    solaris_x64_5.11-{product|fastdebug}-c2-scimark,			\
-    solaris_x64_5.11-product-c2-runThese8,				\
-    solaris_x64_5.11-product-c2-runThese8_Xcomp_lang,			\
-    solaris_x64_5.11-product-c2-runThese8_Xcomp_vm,
-
-my.test.targets.hotspot.linux.i586=					\
-    linux_i586_3.8-{product|fastdebug}-c2-jvm98,			\
-    linux_i586_3.8-{product|fastdebug}-c2-jvm98_nontiered,		\
-    linux_i586_3.8-{product|fastdebug}-c2-scimark,			\
-    linux_i586_3.8-fastdebug-c2-runThese8_Xcomp_lang,			\
-    linux_i586_3.8-fastdebug-c2-runThese8_Xcomp_vm
-
-my.test.targets.hotspot.linux.x64=					\
-    linux_x64_3.8-{product|fastdebug}-c2-jvm98,				\
-    linux_x64_3.8-{product|fastdebug}-c2-jvm98_nontiered,		\
-    linux_x64_3.8-{product|fastdebug}-c2-scimark
-
-my.test.targets.hotspot.macosx.x64=					\
-    macosx_x64_10.9-{product|fastdebug}-c2-jvm98,			\
-    macosx_x64_10.9-{product|fastdebug}-c2-jvm98_nontiered,		\
-    macosx_x64_10.9-{product|fastdebug}-c2-scimark
-
-my.test.targets.hotspot.windows.i586=					\
-    windows_i586_6.3-{product|fastdebug}-c2-jvm98,			\
-    windows_i586_6.3-{product|fastdebug}-c2-jvm98_nontiered,		\
-    windows_i586_6.3-{product|fastdebug}-c2-scimark,			\
-    windows_i586_6.3-product-c2-runThese8,				\
-    windows_i586_6.3-product-c2-runThese8_Xcomp_lang,			\
-    windows_i586_6.3-product-c2-runThese8_Xcomp_vm,
-
-my.test.targets.hotspot.windows.x64=					\
-    windows_x64_6.3-{product|fastdebug}-c2-jvm98,			\
-    windows_x64_6.3-{product|fastdebug}-c2-jvm98_nontiered,		\
-    windows_x64_6.3-{product|fastdebug}-c2-scimark,			\
-    windows_x64_6.3-product-c2-runThese8,				\
-    windows_x64_6.3-product-c2-runThese8_Xcomp_lang,			\
-    windows_x64_6.3-product-c2-runThese8_Xcomp_vm,
-
-# Some basic "smoke" tests for OpenJDK builds
-my.test.targets.hotspot.open=						\
-    solaris_x64_5.11-{productOpen|fastdebugOpen}-c2-jvm98,		\
-    linux_x64_3.8-{productOpen|fastdebugOpen}-c2-jvm98
-
-# The complete list of test targets for jprt
-my.test.targets.hotspot=						\
-  ${my.test.targets.hotspot.open},					\
-  ${my.test.targets.hotspot.solaris.sparcv9},				\
-  ${my.test.targets.hotspot.solaris.x64},				\
-  ${my.test.targets.hotspot.linux.i586},				\
-  ${my.test.targets.hotspot.linux.x64},					\
-  ${my.test.targets.hotspot.macosx.x64},				\
-  ${my.test.targets.hotspot.windows.i586},				\
-  ${my.test.targets.hotspot.windows.x64},				\
-  ${my.test.targets.hotspot.solaris.sparcv9},				\
-  ${my.test.targets.hotspot.solaris.x64},				\
-  ${my.test.targets.hotspot.linux.x64},					\
-  ${my.test.targets.hotspot.windows.i586},				\
-  ${my.test.targets.hotspot.windows.x64},				\
-  ${my.additional.test.targets.hotspot}
-
-
-# Make file based test targets
-
-my.make.rule.test.targets.hotspot.gtest= \
-  linux_i586_3.8-*-default-hotspot_gtest, \
-  linux_x64_3.8-*-default-hotspot_gtest, \
-  macosx_x64_10.9-*-default-hotspot_gtest, \
-  solaris_sparcv9_5.11-*-default-hotspot_gtest, \
-  solaris_x64_5.11-*-default-hotspot_gtest, \
-  windows_i586_6.3-*-default-hotspot_gtest, \
-  windows_x64_6.3-*-default-hotspot_gtest, \
-  ${my.additional.make.rule.test.targets.hotspot.gtest}
-
-my.make.rule.test.targets.hotspot.reg.group=				\
-  solaris_sparcv9_5.11-fastdebug-c2-GROUP,				\
-  solaris_x64_5.11-fastdebug-c2-GROUP,					\
-  linux_i586_3.8-fastdebug-c2-GROUP,					\
-  linux_x64_3.8-fastdebug-c2-GROUP,					\
-  macosx_x64_10.9-fastdebug-c2-GROUP,					\
-  windows_i586_6.3-fastdebug-c2-GROUP,					\
-  windows_x64_6.3-fastdebug-c2-GROUP
-
-# Hotspot jtreg tests
-my.make.rule.test.targets.hotspot.reg=							\
-  ${my.make.rule.test.targets.hotspot.reg.group:GROUP=hotspot_tier1_compiler_1},		\
-  ${my.make.rule.test.targets.hotspot.reg.group:GROUP=hotspot_tier1_compiler_2},		\
-  ${my.make.rule.test.targets.hotspot.reg.group:GROUP=hotspot_tier1_compiler_3},		\
-  ${my.make.rule.test.targets.hotspot.reg.group:GROUP=hotspot_tier1_compiler_closed},	\
-  ${my.make.rule.test.targets.hotspot.reg.group:GROUP=hotspot_tier1_gc_1},		\
-  ${my.make.rule.test.targets.hotspot.reg.group:GROUP=hotspot_tier1_gc_2},		\
-  ${my.make.rule.test.targets.hotspot.reg.group:GROUP=hotspot_tier1_gc_closed},		\
-  ${my.make.rule.test.targets.hotspot.reg.group:GROUP=hotspot_tier1_gc_gcold},		\
-  ${my.make.rule.test.targets.hotspot.reg.group:GROUP=hotspot_tier1_gc_gcbasher},	\
-  ${my.make.rule.test.targets.hotspot.reg.group:GROUP=hotspot_tier1_runtime},		\
-  ${my.make.rule.test.targets.hotspot.reg.group:GROUP=hotspot_tier1_serviceability},	\
-  ${my.make.rule.test.targets.hotspot.reg.group:GROUP=jdk_svc_sanity},			\
-  solaris_sparcv9_5.11-product-c2-hotspot_tier1_gc_gcbasher,				\
-  solaris_x64_5.11-product-c2-hotspot_tier1_gc_gcbasher,					\
-  linux_i586_3.8-product-c2-hotspot_tier1_gc_gcbasher,					\
-  linux_x64_3.8-product-c2-hotspot_tier1_gc_gcbasher,					\
-  macosx_x64_10.9-product-c2-hotspot_tier1_gc_gcbasher,					\
-  windows_i586_6.3-product-c2-hotspot_tier1_gc_gcbasher,					\
-  windows_x64_6.3-product-c2-hotspot_tier1_gc_gcbasher,                                  \
-  ${my.additional.make.rule.test.targets.hotspot.reg}
-
-# Other Makefile based Hotspot tests
-my.make.rule.test.targets.hotspot.other=                                \
-  ${my.make.rule.test.targets.hotspot.gtest},                           \
-  ${my.additional.make.rule.test.targets.hotspot.other}
-
-# All the makefile based tests to run
-my.make.rule.test.targets.hotspot=                                      \
-  ${my.make.rule.test.targets.hotspot.reg}                              \
-  ${my.make.rule.test.targets.hotspot.other}
-
-# Native jdk and hotspot test targets (testset=nativesanity)
-my.make.rule.test.targets.nativesanity=					\
-    ${my.test.target.set:TESTNAME=jdk_native_sanity},			\
-    ${my.test.target.set:TESTNAME=hotspot_native_sanity}
-
-################################################################################
-# Testset buildinfra
-my.build.flavors.buildinfra = \
-    product,fastdebug,slowdebug,productZero,fastdebugZero \
-    ${my.additional.build.flavors.buildinfra}
-
-# Platforms built for hotspot push jobs
-my.build.targets.buildinfra = \
-    solaris_sparcv9_5.11-{product|fastdebug|slowdebug}, \
-    solaris_x64_5.11-{product|fastdebug|slowdebug}, \
-    linux_i586_3.8-{product|fastdebug|slowdebug|productZero|fastdebugZero}, \
-    linux_x64_3.8-{product|fastdebug|slowdebug|productZero|fastdebugZero}, \
-    macosx_x64_10.9-{product|fastdebug|slowdebug}, \
-    windows_i586_6.3-{product|fastdebug|slowdebug}, \
-    windows_x64_6.3-{product|fastdebug|slowdebug}, \
-    ${my.additional.build.targets.buildinfra}
-
-my.test.targets.buildinfra = \
-    ${my.test.targets.default}, \
-    ${my.test.targets.hotspot}
-
-my.make.rule.test.targets.buildinfra = \
-    ${my.make.rule.test.targets.default}, \
-    ${my.make.rule.test.targets.hotspot}
--- a/make/langtools/tools/propertiesparser/gen/ClassGenerator.java	Wed Oct 03 15:54:35 2018 +0200
+++ b/make/langtools/tools/propertiesparser/gen/ClassGenerator.java	Wed Oct 03 16:02:24 2018 +0200
@@ -25,6 +25,8 @@
 
 package propertiesparser.gen;
 
+import static java.util.stream.Collectors.toList;
+
 import propertiesparser.parser.Message;
 import propertiesparser.parser.MessageFile;
 import propertiesparser.parser.MessageInfo;
@@ -44,11 +46,12 @@
 import java.util.ArrayList;
 import java.util.Arrays;
 import java.util.Collections;
-import java.util.TreeSet;
 import java.util.List;
 import java.util.Map;
+import java.util.Properties;
 import java.util.Set;
-import java.util.Properties;
+import java.util.TreeMap;
+import java.util.TreeSet;
 import java.util.stream.Collectors;
 import java.util.stream.Stream;
 
@@ -150,7 +153,11 @@
     public void generateFactory(MessageFile messageFile, File outDir) {
         Map<FactoryKind, List<Map.Entry<String, Message>>> groupedEntries =
                 messageFile.messages.entrySet().stream()
-                        .collect(Collectors.groupingBy(e -> FactoryKind.parseFrom(e.getKey().split("\\.")[1])));
+                        .collect(
+                                Collectors.groupingBy(
+                                        e -> FactoryKind.parseFrom(e.getKey().split("\\.")[1]),
+                                        TreeMap::new,
+                                        toList()));
         //generate nested classes
         List<String> nestedDecls = new ArrayList<>();
         Set<String> importedTypes = new TreeSet<>();
--- a/make/lib/CoreLibraries.gmk	Wed Oct 03 15:54:35 2018 +0200
+++ b/make/lib/CoreLibraries.gmk	Wed Oct 03 16:02:24 2018 +0200
@@ -244,7 +244,7 @@
       EXCLUDE_FILES := $(LIBJLI_EXCLUDE_FILES), \
       EXTRA_FILES := $(LIBJLI_EXTRA_FILES), \
       OPTIMIZATION := HIGH, \
-      CFLAGS := $(STATIC_LIBRARY_FLAGS) $(LIBJLI_CFLAGS_JDKLIB) $(LIBJLI_CFLAGS) \
+      CFLAGS := $(STATIC_LIBRARY_FLAGS) $(CFLAGS_JDKLIB) $(LIBJLI_CFLAGS) \
           $(addprefix -I, $(LIBJLI_SRC_DIRS)), \
       ARFLAGS := $(ARFLAGS), \
       OBJECT_DIR := $(SUPPORT_OUTPUTDIR)/native/$(MODULE)/libjli_static))
--- a/make/src/classes/build/tools/jfr/GenerateJfrFiles.java	Wed Oct 03 15:54:35 2018 +0200
+++ b/make/src/classes/build/tools/jfr/GenerateJfrFiles.java	Wed Oct 03 16:02:24 2018 +0200
@@ -477,6 +477,7 @@
             out.write("");
             out.write("#else // !INCLUDE_JFR");
             out.write("");
+            out.write("template <typename T>");
             out.write("class JfrEvent {");
             out.write(" public:");
             out.write("  JfrEvent() {}");
@@ -497,103 +498,83 @@
 
     private static void printTypes(Printer out, Metadata metadata, boolean empty) {
         for (TypeElement t : metadata.getStructs()) {
-            if (empty) {
-                out.write("");
-                printEmptyType(out, t);
-            } else {
-                printType(out, t);
-            }
+            printType(out, t, empty);
             out.write("");
         }
         for (EventElement e : metadata.getEvents()) {
-            if (empty) {
-                printEmptyEvent(out, e);
-            } else {
-                printEvent(out, e);
-            }
+            printEvent(out, e, empty);
             out.write("");
         }
     }
 
-    private static void printEmptyEvent(Printer out, EventElement event) {
-        out.write("class Event" + event.name + " : public JfrEvent");
-        out.write("{");
-        out.write(" public:");
-        out.write("  Event" + event.name + "(EventStartTime ignore=TIMED) {}");
-        if (event.startTime) {
-            StringJoiner sj = new StringJoiner(",\n    ");
-            for (FieldElement f : event.fields) {
-                sj.add(f.getParameterType());
-            }
-            out.write("  Event" + event.name + "(");
-            out.write("    " + sj.toString() + ") { }");
-        }
-        for (FieldElement f : event.fields) {
-            out.write("  void set_" + f.name + "(" + f.getParameterType() + ") { }");
-        }
-        out.write("};");
-    }
-
-    private static void printEmptyType(Printer out, TypeElement t) {
+    private static void printType(Printer out, TypeElement t, boolean empty) {
         out.write("struct JfrStruct" + t.name);
         out.write("{");
+        if (!empty) {
+          out.write(" private:");
+          for (FieldElement f : t.fields) {
+              printField(out, f);
+          }
+          out.write("");
+        }
         out.write(" public:");
         for (FieldElement f : t.fields) {
-            out.write("  void set_" + f.name + "(" + f.getParameterType() + ") { }");
-        }
-        out.write("};");
-    }
-
-    private static void printType(Printer out, TypeElement t) {
-        out.write("struct JfrStruct" + t.name);
-        out.write("{");
-        out.write(" private:");
-        for (FieldElement f : t.fields) {
-            printField(out, f);
+           printTypeSetter(out, f, empty);
         }
         out.write("");
-        out.write(" public:");
-        for (FieldElement f : t.fields) {
-            printTypeSetter(out, f);
+        if (!empty) {
+          printWriteData(out, t.fields);
         }
-        out.write("");
-        printWriteData(out, t.fields);
         out.write("};");
         out.write("");
     }
 
-    private static void printEvent(Printer out, EventElement event) {
+    private static void printEvent(Printer out, EventElement event, boolean empty) {
         out.write("class Event" + event.name + " : public JfrEvent<Event" + event.name + ">");
         out.write("{");
-        out.write(" private:");
-        for (FieldElement f : event.fields) {
-            printField(out, f);
+        if (!empty) {
+          out.write(" private:");
+          for (FieldElement f : event.fields) {
+              printField(out, f);
+          }
+          out.write("");
         }
-        out.write("");
         out.write(" public:");
-        out.write("  static const bool hasThread = " + event.thread + ";");
-        out.write("  static const bool hasStackTrace = " + event.stackTrace + ";");
-        out.write("  static const bool isInstant = " + !event.startTime + ";");
-        out.write("  static const bool hasCutoff = " + event.cutoff + ";");
-        out.write("  static const bool isRequestable = " + event.periodic + ";");
-        out.write("  static const JfrEventId eventId = Jfr" + event.name + "Event;");
-        out.write("");
-        out.write("  Event" + event.name + "(EventStartTime timing=TIMED) : JfrEvent<Event" + event.name + ">(timing) {}");
+        if (!empty) {
+          out.write("  static const bool hasThread = " + event.thread + ";");
+          out.write("  static const bool hasStackTrace = " + event.stackTrace + ";");
+          out.write("  static const bool isInstant = " + !event.startTime + ";");
+          out.write("  static const bool hasCutoff = " + event.cutoff + ";");
+          out.write("  static const bool isRequestable = " + event.periodic + ";");
+          out.write("  static const JfrEventId eventId = Jfr" + event.name + "Event;");
+          out.write("");
+        }
+        if (!empty) {
+          out.write("  Event" + event.name + "(EventStartTime timing=TIMED) : JfrEvent<Event" + event.name + ">(timing) {}");
+        } else {
+          out.write("  Event" + event.name + "(EventStartTime timing=TIMED) {}");
+        }
         out.write("");
         int index = 0;
         for (FieldElement f : event.fields) {
             out.write("  void set_" + f.name + "(" + f.getParameterType() + " " + f.getParameterName() + ") {");
-            out.write("    this->_" + f.name + " = " + f.getParameterName() + ";");
-            out.write("    DEBUG_ONLY(set_field_bit(" + index++ + "));");
+            if (!empty) {
+              out.write("    this->_" + f.name + " = " + f.getParameterName() + ";");
+              out.write("    DEBUG_ONLY(set_field_bit(" + index++ + "));");
+            }
             out.write("  }");
         }
         out.write("");
-        printWriteData(out, event.fields);
-        out.write("");
+        if (!empty) {
+          printWriteData(out, event.fields);
+          out.write("");
+        }
         out.write("  using JfrEvent<Event" + event.name + ">::commit; // else commit() is hidden by overloaded versions in this class");
-        printConstructor2(out, event);
-        printCommitMethod(out, event);
-        printVerify(out, event.fields);
+        printConstructor2(out, event, empty);
+        printCommitMethod(out, event, empty);
+        if (!empty) {
+          printVerify(out, event.fields);
+        }
         out.write("};");
     }
 
@@ -610,8 +591,12 @@
         out.write("  }");
     }
 
-    private static void printTypeSetter(Printer out, FieldElement field) {
-        out.write("  void set_" + field.name + "(" + field.getParameterType() + " new_value) { this->_" + field.name + " = new_value; }");
+    private static void printTypeSetter(Printer out, FieldElement field, boolean empty) {
+        if (!empty) {
+          out.write("  void set_" + field.name + "(" + field.getParameterType() + " new_value) { this->_" + field.name + " = new_value; }");
+        } else {
+          out.write("  void set_" + field.name + "(" + field.getParameterType() + " new_value) { }");
+        }
     }
 
     private static void printVerify(Printer out, List<FieldElement> fields) {
@@ -626,7 +611,7 @@
         out.write("#endif");
     }
 
-    private static void printCommitMethod(Printer out, EventElement event) {
+    private static void printCommitMethod(Printer out, EventElement event, boolean empty) {
         if (event.startTime) {
             StringJoiner sj = new StringJoiner(",\n              ");
             for (FieldElement f : event.fields) {
@@ -634,12 +619,14 @@
             }
             out.write("");
             out.write("  void commit(" + sj.toString() + ") {");
-            out.write("    if (should_commit()) {");
-            for (FieldElement f : event.fields) {
-                out.write("      set_" + f.name + "(" + f.name + ");");
+            if (!empty) {
+              out.write("    if (should_commit()) {");
+              for (FieldElement f : event.fields) {
+                  out.write("      set_" + f.name + "(" + f.name + ");");
+              }
+              out.write("      commit();");
+              out.write("    }");
             }
-            out.write("      commit();");
-            out.write("    }");
             out.write("  }");
         }
         out.write("");
@@ -652,22 +639,24 @@
             sj.add(f.getParameterType() + " " + f.name);
         }
         out.write("  static void commit(" + sj.toString() + ") {");
-        out.write("    Event" + event.name + " me(UNTIMED);");
-        out.write("");
-        out.write("    if (me.should_commit()) {");
-        if (event.startTime) {
-            out.write("      me.set_starttime(startTicks);");
-            out.write("      me.set_endtime(endTicks);");
+        if (!empty) {
+          out.write("    Event" + event.name + " me(UNTIMED);");
+          out.write("");
+          out.write("    if (me.should_commit()) {");
+          if (event.startTime) {
+              out.write("      me.set_starttime(startTicks);");
+              out.write("      me.set_endtime(endTicks);");
+          }
+          for (FieldElement f : event.fields) {
+              out.write("      me.set_" + f.name + "(" + f.name + ");");
+          }
+          out.write("      me.commit();");
+          out.write("    }");
         }
-        for (FieldElement f : event.fields) {
-            out.write("      me.set_" + f.name + "(" + f.name + ");");
-        }
-        out.write("      me.commit();");
-        out.write("    }");
         out.write("  }");
     }
 
-    private static void printConstructor2(Printer out, EventElement event) {
+    private static void printConstructor2(Printer out, EventElement event, boolean empty) {
         if (!event.startTime) {
             out.write("");
             out.write("");
@@ -679,12 +668,16 @@
             for (FieldElement f : event.fields) {
                 sj.add(f.getParameterType() + " " + f.name);
             }
-            out.write("    " + sj.toString() + ") : JfrEvent<Event" + event.name + ">(TIMED) {");
-            out.write("    if (should_commit()) {");
-            for (FieldElement f : event.fields) {
-                out.write("      set_" + f.name + "(" + f.name + ");");
+            if (!empty) {
+              out.write("    " + sj.toString() + ") : JfrEvent<Event" + event.name + ">(TIMED) {");
+              out.write("    if (should_commit()) {");
+              for (FieldElement f : event.fields) {
+                  out.write("      set_" + f.name + "(" + f.name + ");");
+              }
+              out.write("    }");
+            } else {
+              out.write("    " + sj.toString() + ") {");
             }
-            out.write("    }");
             out.write("  }");
         }
     }
--- a/src/demo/share/jfc/J2Ddemo/java2d/DemoInstVarsAccessor.java	Wed Oct 03 15:54:35 2018 +0200
+++ b/src/demo/share/jfc/J2Ddemo/java2d/DemoInstVarsAccessor.java	Wed Oct 03 16:02:24 2018 +0200
@@ -1,3 +1,34 @@
+/*
+ *
+ * Copyright (c) 2015, 2018, 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
+ * are met:
+ *
+ *   - Redistributions of source code must retain the above copyright
+ *     notice, this list of conditions and the following disclaimer.
+ *
+ *   - Redistributions in binary form must reproduce the above copyright
+ *     notice, this list of conditions and the following disclaimer in the
+ *     documentation and/or other materials provided with the distribution.
+ *
+ *   - Neither the name of Oracle nor the names of its
+ *     contributors may be used to endorse or promote products derived
+ *     from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS
+ * IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE COPYRIGHT OWNER OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
+ * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
+ * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
 package java2d;
 
 import java.awt.Color;
--- a/src/demo/share/jfc/J2Ddemo/java2d/DemoInstVarsAccessorImplBase.java	Wed Oct 03 15:54:35 2018 +0200
+++ b/src/demo/share/jfc/J2Ddemo/java2d/DemoInstVarsAccessorImplBase.java	Wed Oct 03 16:02:24 2018 +0200
@@ -1,3 +1,34 @@
+/*
+ *
+ * Copyright (c) 2015, 2018, 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
+ * are met:
+ *
+ *   - Redistributions of source code must retain the above copyright
+ *     notice, this list of conditions and the following disclaimer.
+ *
+ *   - Redistributions in binary form must reproduce the above copyright
+ *     notice, this list of conditions and the following disclaimer in the
+ *     documentation and/or other materials provided with the distribution.
+ *
+ *   - Neither the name of Oracle nor the names of its
+ *     contributors may be used to endorse or promote products derived
+ *     from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS
+ * IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE COPYRIGHT OWNER OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
+ * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
+ * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
 package java2d;
 
 import java.awt.Color;
--- a/src/hotspot/cpu/aarch64/c1_LIRAssembler_aarch64.cpp	Wed Oct 03 15:54:35 2018 +0200
+++ b/src/hotspot/cpu/aarch64/c1_LIRAssembler_aarch64.cpp	Wed Oct 03 16:02:24 2018 +0200
@@ -1025,37 +1025,17 @@
   return exact_log2(elem_size);
 }
 
-void LIR_Assembler::arithmetic_idiv(LIR_Op3* op, bool is_irem) {
-  Register Rdividend = op->in_opr1()->as_register();
-  Register Rdivisor  = op->in_opr2()->as_register();
-  Register Rscratch  = op->in_opr3()->as_register();
-  Register Rresult   = op->result_opr()->as_register();
-  int divisor = -1;
-
-  /*
-  TODO: For some reason, using the Rscratch that gets passed in is
-  not possible because the register allocator does not see the tmp reg
-  as used, and assignes it the same register as Rdividend. We use rscratch1
-   instead.
-
-  assert(Rdividend != Rscratch, "");
-  assert(Rdivisor  != Rscratch, "");
-  */
-
-  if (Rdivisor == noreg && is_power_of_2(divisor)) {
-    // convert division by a power of two into some shifts and logical operations
-  }
-
-  __ corrected_idivl(Rresult, Rdividend, Rdivisor, is_irem, rscratch1);
-}
 
 void LIR_Assembler::emit_op3(LIR_Op3* op) {
   switch (op->code()) {
   case lir_idiv:
-    arithmetic_idiv(op, false);
-    break;
   case lir_irem:
-    arithmetic_idiv(op, true);
+    arithmetic_idiv(op->code(),
+                    op->in_opr1(),
+                    op->in_opr2(),
+                    op->in_opr3(),
+                    op->result_opr(),
+                    op->info());
     break;
   case lir_fmad:
     __ fmaddd(op->result_opr()->as_double_reg(),
@@ -1729,6 +1709,7 @@
         default: ShouldNotReachHere();
         }
         break;
+      default:
         ShouldNotReachHere();
       }
     } else {
@@ -1752,16 +1733,43 @@
       }
 
     } else if (right->is_constant()) {
-      jlong c = right->as_constant_ptr()->as_jlong_bits();
+      jlong c = right->as_constant_ptr()->as_jlong();
       Register dreg = as_reg(dest);
-      assert(code == lir_add || code == lir_sub, "mismatched arithmetic op");
-      if (c == 0 && dreg == lreg_lo) {
-        COMMENT("effective nop elided");
-        return;
-      }
       switch (code) {
-        case lir_add: __ add(dreg, lreg_lo, c); break;
-        case lir_sub: __ sub(dreg, lreg_lo, c); break;
+        case lir_add:
+        case lir_sub:
+          if (c == 0 && dreg == lreg_lo) {
+            COMMENT("effective nop elided");
+            return;
+          }
+          code == lir_add ? __ add(dreg, lreg_lo, c) : __ sub(dreg, lreg_lo, c);
+          break;
+        case lir_div:
+          assert(c > 0 && is_power_of_2_long(c), "divisor must be power-of-2 constant");
+          if (c == 1) {
+            // move lreg_lo to dreg if divisor is 1
+            __ mov(dreg, lreg_lo);
+          } else {
+            unsigned int shift = exact_log2_long(c);
+            // use rscratch1 as intermediate result register
+            __ asr(rscratch1, lreg_lo, 63);
+            __ add(rscratch1, lreg_lo, rscratch1, Assembler::LSR, 64 - shift);
+            __ asr(dreg, rscratch1, shift);
+          }
+          break;
+        case lir_rem:
+          assert(c > 0 && is_power_of_2_long(c), "divisor must be power-of-2 constant");
+          if (c == 1) {
+            // move 0 to dreg if divisor is 1
+            __ mov(dreg, zr);
+          } else {
+            // use rscratch1 as intermediate result register
+            __ negs(rscratch1, lreg_lo);
+            __ andr(dreg, lreg_lo, c - 1);
+            __ andr(rscratch1, rscratch1, c - 1);
+            __ csneg(dreg, dreg, rscratch1, Assembler::MI);
+          }
+          break;
         default:
           ShouldNotReachHere();
       }
@@ -1862,7 +1870,51 @@
 
 
 
-void LIR_Assembler::arithmetic_idiv(LIR_Code code, LIR_Opr left, LIR_Opr right, LIR_Opr temp, LIR_Opr result, CodeEmitInfo* info) { Unimplemented(); }
+void LIR_Assembler::arithmetic_idiv(LIR_Code code, LIR_Opr left, LIR_Opr right, LIR_Opr illegal, LIR_Opr result, CodeEmitInfo* info) {
+
+  // opcode check
+  assert((code == lir_idiv) || (code == lir_irem), "opcode must be idiv or irem");
+  bool is_irem = (code == lir_irem);
+
+  // operand check
+  assert(left->is_single_cpu(),   "left must be register");
+  assert(right->is_single_cpu() || right->is_constant(),  "right must be register or constant");
+  assert(result->is_single_cpu(), "result must be register");
+  Register lreg = left->as_register();
+  Register dreg = result->as_register();
+
+  // power-of-2 constant check and codegen
+  if (right->is_constant()) {
+    int c = right->as_constant_ptr()->as_jint();
+    assert(c > 0 && is_power_of_2(c), "divisor must be power-of-2 constant");
+    if (is_irem) {
+      if (c == 1) {
+        // move 0 to dreg if divisor is 1
+        __ movw(dreg, zr);
+      } else {
+        // use rscratch1 as intermediate result register
+        __ negsw(rscratch1, lreg);
+        __ andw(dreg, lreg, c - 1);
+        __ andw(rscratch1, rscratch1, c - 1);
+        __ csnegw(dreg, dreg, rscratch1, Assembler::MI);
+      }
+    } else {
+      if (c == 1) {
+        // move lreg to dreg if divisor is 1
+        __ movw(dreg, lreg);
+      } else {
+        unsigned int shift = exact_log2(c);
+        // use rscratch1 as intermediate result register
+        __ asrw(rscratch1, lreg, 31);
+        __ addw(rscratch1, lreg, rscratch1, Assembler::LSR, 32 - shift);
+        __ asrw(dreg, rscratch1, shift);
+      }
+    }
+  } else {
+    Register rreg = right->as_register();
+    __ corrected_idivl(dreg, lreg, rreg, is_irem, rscratch1);
+  }
+}
 
 
 void LIR_Assembler::comp_op(LIR_Condition condition, LIR_Opr opr1, LIR_Opr opr2, LIR_Op2* op) {
--- a/src/hotspot/cpu/aarch64/c1_LIRAssembler_aarch64.hpp	Wed Oct 03 15:54:35 2018 +0200
+++ b/src/hotspot/cpu/aarch64/c1_LIRAssembler_aarch64.hpp	Wed Oct 03 16:02:24 2018 +0200
@@ -75,8 +75,6 @@
     _deopt_handler_size = 7 * NativeInstruction::instruction_size
   };
 
-  void arithmetic_idiv(LIR_Op3* op, bool is_irem);
-
 public:
 
   void store_parameter(Register r, int offset_from_esp_in_words);
--- a/src/hotspot/cpu/aarch64/c1_LIRGenerator_aarch64.cpp	Wed Oct 03 15:54:35 2018 +0200
+++ b/src/hotspot/cpu/aarch64/c1_LIRGenerator_aarch64.cpp	Wed Oct 03 16:02:24 2018 +0200
@@ -440,17 +440,26 @@
 
   if (x->op() == Bytecodes::_ldiv || x->op() == Bytecodes::_lrem) {
 
-    // the check for division by zero destroys the right operand
-    right.set_destroys_register();
-
-    // check for division by zero (destroys registers of right operand!)
-    CodeEmitInfo* info = state_for(x);
-
     left.load_item();
-    right.load_item();
-
-    __ cmp(lir_cond_equal, right.result(), LIR_OprFact::longConst(0));
-    __ branch(lir_cond_equal, T_LONG, new DivByZeroStub(info));
+    bool need_zero_check = true;
+    if (right.is_constant()) {
+      jlong c = right.get_jlong_constant();
+      // no need to do div-by-zero check if the divisor is a non-zero constant
+      if (c != 0) need_zero_check = false;
+      // do not load right if the divisor is a power-of-2 constant
+      if (c > 0 && is_power_of_2_long(c)) {
+        right.dont_load_item();
+      } else {
+        right.load_item();
+      }
+    } else {
+      right.load_item();
+    }
+    if (need_zero_check) {
+      CodeEmitInfo* info = state_for(x);
+      __ cmp(lir_cond_equal, right.result(), LIR_OprFact::longConst(0));
+      __ branch(lir_cond_equal, T_LONG, new DivByZeroStub(info));
+    }
 
     rlock_result(x);
     switch (x->op()) {
@@ -506,19 +515,32 @@
   // do not need to load right, as we can handle stack and constants
   if (x->op() == Bytecodes::_idiv || x->op() == Bytecodes::_irem) {
 
-    right_arg->load_item();
     rlock_result(x);
+    bool need_zero_check = true;
+    if (right.is_constant()) {
+      jint c = right.get_jint_constant();
+      // no need to do div-by-zero check if the divisor is a non-zero constant
+      if (c != 0) need_zero_check = false;
+      // do not load right if the divisor is a power-of-2 constant
+      if (c > 0 && is_power_of_2(c)) {
+        right_arg->dont_load_item();
+      } else {
+        right_arg->load_item();
+      }
+    } else {
+      right_arg->load_item();
+    }
+    if (need_zero_check) {
+      CodeEmitInfo* info = state_for(x);
+      __ cmp(lir_cond_equal, right_arg->result(), LIR_OprFact::longConst(0));
+      __ branch(lir_cond_equal, T_INT, new DivByZeroStub(info));
+    }
 
-    CodeEmitInfo* info = state_for(x);
-    LIR_Opr tmp = new_register(T_INT);
-    __ cmp(lir_cond_equal, right_arg->result(), LIR_OprFact::longConst(0));
-    __ branch(lir_cond_equal, T_INT, new DivByZeroStub(info));
-    info = state_for(x);
-
+    LIR_Opr ill = LIR_OprFact::illegalOpr;
     if (x->op() == Bytecodes::_irem) {
-      __ irem(left_arg->result(), right_arg->result(), x->operand(), tmp, NULL);
+      __ irem(left_arg->result(), right_arg->result(), x->operand(), ill, NULL);
     } else if (x->op() == Bytecodes::_idiv) {
-      __ idiv(left_arg->result(), right_arg->result(), x->operand(), tmp, NULL);
+      __ idiv(left_arg->result(), right_arg->result(), x->operand(), ill, NULL);
     }
 
   } else if (x->op() == Bytecodes::_iadd || x->op() == Bytecodes::_isub) {
@@ -562,8 +584,8 @@
     case doubleTag:  do_ArithmeticOp_FPU(x);  return;
     case longTag:    do_ArithmeticOp_Long(x); return;
     case intTag:     do_ArithmeticOp_Int(x);  return;
+    default:         ShouldNotReachHere();    return;
   }
-  ShouldNotReachHere();
 }
 
 // _ishl, _lshl, _ishr, _lshr, _iushr, _lushr
@@ -770,9 +792,13 @@
           __ abs(value.result(), dst, LIR_OprFact::illegalOpr);
           break;
         }
+        default:
+          ShouldNotReachHere();
       }
       break;
     }
+    default:
+      ShouldNotReachHere();
   }
 }
 
--- a/src/hotspot/cpu/aarch64/compiledIC_aarch64.cpp	Wed Oct 03 15:54:35 2018 +0200
+++ b/src/hotspot/cpu/aarch64/compiledIC_aarch64.cpp	Wed Oct 03 16:02:24 2018 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1997, 2016, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1997, 2018, Oracle and/or its affiliates. All rights reserved.
  * Copyright (c) 2014, 2018, Red Hat Inc. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
@@ -195,9 +195,7 @@
 void CompiledDirectStaticCall::verify() {
   // Verify call.
   _call->verify();
-  if (os::is_MP()) {
-    _call->verify_alignment();
-  }
+  _call->verify_alignment();
 
   // Verify stub.
   address stub = find_stub(false /* is_aot */);
--- a/src/hotspot/cpu/aarch64/macroAssembler_aarch64.cpp	Wed Oct 03 15:54:35 2018 +0200
+++ b/src/hotspot/cpu/aarch64/macroAssembler_aarch64.cpp	Wed Oct 03 16:02:24 2018 +0200
@@ -822,6 +822,15 @@
   return stub_start_addr;
 }
 
+void MacroAssembler::c2bool(Register x) {
+  // implements x == 0 ? 0 : 1
+  // note: must only look at least-significant byte of x
+  //       since C-style booleans are stored in one byte
+  //       only! (was bug)
+  tst(x, 0xff);
+  cset(x, Assembler::NE);
+}
+
 address MacroAssembler::ic_call(address entry, jint method_index) {
   RelocationHolder rh = virtual_call_Relocation::spec(pc(), method_index);
   // address const_ptr = long_constant((jlong)Universe::non_oop_word());
@@ -1496,7 +1505,7 @@
 #ifndef PRODUCT
   {
     char buffer[64];
-    snprintf(buffer, sizeof(buffer), "0x%"PRIX64, imm64);
+    snprintf(buffer, sizeof(buffer), "0x%" PRIX64, imm64);
     block_comment(buffer);
   }
 #endif
@@ -1559,7 +1568,7 @@
 #ifndef PRODUCT
   {
     char buffer[64];
-    snprintf(buffer, sizeof(buffer), "0x%"PRIX64, imm64);
+    snprintf(buffer, sizeof(buffer), "0x%" PRIX64, imm64);
     block_comment(buffer);
   }
 #endif
@@ -1672,7 +1681,7 @@
 #ifndef PRODUCT
     {
       char buffer[64];
-      snprintf(buffer, sizeof(buffer), "0x%"PRIX32, imm32);
+      snprintf(buffer, sizeof(buffer), "0x%" PRIX32, imm32);
       block_comment(buffer);
     }
 #endif
--- a/src/hotspot/cpu/aarch64/macroAssembler_aarch64.hpp	Wed Oct 03 15:54:35 2018 +0200
+++ b/src/hotspot/cpu/aarch64/macroAssembler_aarch64.hpp	Wed Oct 03 16:02:24 2018 +0200
@@ -782,6 +782,9 @@
 
   void resolve_jobject(Register value, Register thread, Register tmp);
 
+  // C 'boolean' to Java boolean: x == 0 ? 0 : 1
+  void c2bool(Register x);
+
   // oop manipulations
   void load_klass(Register dst, Register src);
   void store_klass(Register dst, Register src);
--- a/src/hotspot/cpu/aarch64/sharedRuntime_aarch64.cpp	Wed Oct 03 15:54:35 2018 +0200
+++ b/src/hotspot/cpu/aarch64/sharedRuntime_aarch64.cpp	Wed Oct 03 16:02:24 2018 +0200
@@ -1924,7 +1924,7 @@
 
   // Unpack native results.
   switch (ret_type) {
-  case T_BOOLEAN: __ ubfx(r0, r0, 0, 8);             break;
+  case T_BOOLEAN: __ c2bool(r0);                     break;
   case T_CHAR   : __ ubfx(r0, r0, 0, 16);            break;
   case T_BYTE   : __ sbfx(r0, r0, 0, 8);             break;
   case T_SHORT  : __ sbfx(r0, r0, 0, 16);            break;
@@ -1950,24 +1950,20 @@
   //     didn't see any synchronization is progress, and escapes.
   __ mov(rscratch1, _thread_in_native_trans);
 
-  if(os::is_MP()) {
-    if (UseMembar) {
-      __ strw(rscratch1, Address(rthread, JavaThread::thread_state_offset()));
-
-      // Force this write out before the read below
-      __ dmb(Assembler::ISH);
-    } else {
-      __ lea(rscratch2, Address(rthread, JavaThread::thread_state_offset()));
-      __ stlrw(rscratch1, rscratch2);
-
-      // Write serialization page so VM thread can do a pseudo remote membar.
-      // We use the current thread pointer to calculate a thread specific
-      // offset to write to within the page. This minimizes bus traffic
-      // due to cache line collision.
-      __ serialize_memory(rthread, r2);
-    }
+  if (UseMembar) {
+    __ strw(rscratch1, Address(rthread, JavaThread::thread_state_offset()));
+
+    // Force this write out before the read below
+    __ dmb(Assembler::ISH);
   } else {
-    __ strw(rscratch1, Address(rthread, JavaThread::thread_state_offset()));
+    __ lea(rscratch2, Address(rthread, JavaThread::thread_state_offset()));
+    __ stlrw(rscratch1, rscratch2);
+
+    // Write serialization page so VM thread can do a pseudo remote membar.
+    // We use the current thread pointer to calculate a thread specific
+    // offset to write to within the page. This minimizes bus traffic
+    // due to cache line collision.
+    __ serialize_memory(rthread, r2);
   }
 
   // check for safepoint operation in progress and/or pending suspend requests
--- a/src/hotspot/cpu/aarch64/templateInterpreterGenerator_aarch64.cpp	Wed Oct 03 15:54:35 2018 +0200
+++ b/src/hotspot/cpu/aarch64/templateInterpreterGenerator_aarch64.cpp	Wed Oct 03 16:02:24 2018 +0200
@@ -557,7 +557,7 @@
         BasicType type) {
     address entry = __ pc();
   switch (type) {
-  case T_BOOLEAN: __ uxtb(r0, r0);        break;
+  case T_BOOLEAN: __ c2bool(r0);         break;
   case T_CHAR   : __ uxth(r0, r0);       break;
   case T_BYTE   : __ sxtb(r0, r0);        break;
   case T_SHORT  : __ sxth(r0, r0);        break;
@@ -1394,17 +1394,15 @@
   __ lea(rscratch2, Address(rthread, JavaThread::thread_state_offset()));
   __ stlrw(rscratch1, rscratch2);
 
-  if (os::is_MP()) {
-    if (UseMembar) {
-      // Force this write out before the read below
-      __ dmb(Assembler::ISH);
-    } else {
-      // Write serialization page so VM thread can do a pseudo remote membar.
-      // We use the current thread pointer to calculate a thread specific
-      // offset to write to within the page. This minimizes bus traffic
-      // due to cache line collision.
-      __ serialize_memory(rthread, rscratch2);
-    }
+  if (UseMembar) {
+    // Force this write out before the read below
+    __ dmb(Assembler::ISH);
+  } else {
+    // Write serialization page so VM thread can do a pseudo remote membar.
+    // We use the current thread pointer to calculate a thread specific
+    // offset to write to within the page. This minimizes bus traffic
+    // due to cache line collision.
+    __ serialize_memory(rthread, rscratch2);
   }
 
   // check for safepoint operation in progress and/or pending suspend requests
--- a/src/hotspot/cpu/aarch64/templateTable_aarch64.cpp	Wed Oct 03 15:54:35 2018 +0200
+++ b/src/hotspot/cpu/aarch64/templateTable_aarch64.cpp	Wed Oct 03 16:02:24 2018 +0200
@@ -412,7 +412,7 @@
     // Stash null_sentinel address to get its value later
     __ movptr(rarg, (uintptr_t)Universe::the_null_sentinel_addr());
     __ ldr(tmp, Address(rarg));
-    __ cmp(result, tmp);
+    __ cmpoop(result, tmp);
     __ br(Assembler::NE, notNull);
     __ mov(result, 0);  // NULL object reference
     __ bind(notNull);
@@ -2329,6 +2329,7 @@
   switch (code) {
   case Bytecodes::_nofast_getfield: code = Bytecodes::_getfield; break;
   case Bytecodes::_nofast_putfield: code = Bytecodes::_putfield; break;
+  default: break;
   }
 
   assert(byte_no == f1_byte || byte_no == f2_byte, "byte_no out of range");
@@ -2953,6 +2954,7 @@
     case Bytecodes::_fast_dputfield: __ pop_d(); break;
     case Bytecodes::_fast_fputfield: __ pop_f(); break;
     case Bytecodes::_fast_lputfield: __ pop_l(r0); break;
+    default: break;
     }
     __ bind(L2);
   }
--- a/src/hotspot/cpu/arm/arm.ad	Wed Oct 03 15:54:35 2018 +0200
+++ b/src/hotspot/cpu/arm/arm.ad	Wed Oct 03 16:02:24 2018 +0200
@@ -5316,8 +5316,7 @@
 // Prefetch instructions.
 // Must be safe to execute with invalid address (cannot fault).
 
-instruct prefetchAlloc_mp( memoryP mem ) %{
-  predicate(os::is_MP());
+instruct prefetchAlloc( memoryP mem ) %{
   match( PrefetchAllocation mem );
   ins_cost(MEMORY_REF_COST);
   size(4);
@@ -5333,23 +5332,6 @@
   ins_pipe(iload_mem);
 %}
 
-instruct prefetchAlloc_sp( memoryP mem ) %{
-  predicate(!os::is_MP());
-  match( PrefetchAllocation mem );
-  ins_cost(MEMORY_REF_COST);
-  size(4);
-
-  format %{ "PLD $mem\t! Prefetch allocation" %}
-  ins_encode %{
-#ifdef AARCH64
-    __ prfm(pstl1keep, $mem$$Address);
-#else
-    __ pld($mem$$Address);
-#endif
-  %}
-  ins_pipe(iload_mem);
-%}
-
 //----------Store Instructions-------------------------------------------------
 // Store Byte
 instruct storeB(memoryB mem, store_RegI src) %{
--- a/src/hotspot/cpu/arm/c1_LIRGenerator_arm.cpp	Wed Oct 03 15:54:35 2018 +0200
+++ b/src/hotspot/cpu/arm/c1_LIRGenerator_arm.cpp	Wed Oct 03 16:02:24 2018 +0200
@@ -870,8 +870,8 @@
     case doubleTag:  do_ArithmeticOp_FPU(x);  return;
     case longTag:    do_ArithmeticOp_Long(x); return;
     case intTag:     do_ArithmeticOp_Int(x);  return;
+    default:         ShouldNotReachHere();    return;
   }
-  ShouldNotReachHere();
 }
 
 
--- a/src/hotspot/cpu/arm/compiledIC_arm.cpp	Wed Oct 03 15:54:35 2018 +0200
+++ b/src/hotspot/cpu/arm/compiledIC_arm.cpp	Wed Oct 03 16:02:24 2018 +0200
@@ -155,9 +155,7 @@
 void CompiledDirectStaticCall::verify() {
   // Verify call.
   _call->verify();
-  if (os::is_MP()) {
-    _call->verify_alignment();
-  }
+  _call->verify_alignment();
 
   // Verify stub.
   address stub = find_stub(/*is_aot*/ false);
--- a/src/hotspot/cpu/arm/jniFastGetField_arm.cpp	Wed Oct 03 15:54:35 2018 +0200
+++ b/src/hotspot/cpu/arm/jniFastGetField_arm.cpp	Wed Oct 03 16:02:24 2018 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2008, 2017, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2008, 2018, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -127,13 +127,9 @@
   __ bic(R1, R1, JNIHandles::weak_tag_mask);
 #endif
 
-  if (os::is_MP()) {
-    // Address dependency restricts memory access ordering. It's cheaper than explicit LoadLoad barrier
-    __ andr(Rtmp1, Rsafept_cnt, (unsigned)1);
-    __ ldr(Robj, Address(R1, Rtmp1));
-  } else {
-    __ ldr(Robj, Address(R1));
-  }
+  // Address dependency restricts memory access ordering. It's cheaper than explicit LoadLoad barrier
+  __ andr(Rtmp1, Rsafept_cnt, (unsigned)1);
+  __ ldr(Robj, Address(R1, Rtmp1));
 
 #ifdef AARCH64
   __ add(Robj, Robj, AsmOperand(R2, lsr, 2));
@@ -198,25 +194,21 @@
       ShouldNotReachHere();
   }
 
-  if(os::is_MP()) {
-      // Address dependency restricts memory access ordering. It's cheaper than explicit LoadLoad barrier
+  // Address dependency restricts memory access ordering. It's cheaper than explicit LoadLoad barrier
 #if defined(__ABI_HARD__) && !defined(AARCH64)
-    if (type == T_FLOAT || type == T_DOUBLE) {
-      __ ldr_literal(Rsafepoint_counter_addr, safepoint_counter_addr);
-      __ fmrrd(Rres, Rres_hi, D0);
-      __ eor(Rtmp2, Rres, Rres);
-      __ ldr_s32(Rsafept_cnt2, Address(Rsafepoint_counter_addr, Rtmp2));
-    } else
+  if (type == T_FLOAT || type == T_DOUBLE) {
+    __ ldr_literal(Rsafepoint_counter_addr, safepoint_counter_addr);
+    __ fmrrd(Rres, Rres_hi, D0);
+    __ eor(Rtmp2, Rres, Rres);
+    __ ldr_s32(Rsafept_cnt2, Address(Rsafepoint_counter_addr, Rtmp2));
+  } else
 #endif // __ABI_HARD__ && !AARCH64
-    {
+  {
 #ifndef AARCH64
-      __ ldr_literal(Rsafepoint_counter_addr, safepoint_counter_addr);
+    __ ldr_literal(Rsafepoint_counter_addr, safepoint_counter_addr);
 #endif // !AARCH64
-      __ eor(Rtmp2, Rres, Rres);
-      __ ldr_s32(Rsafept_cnt2, Address(Rsafepoint_counter_addr, Rtmp2));
-    }
-  } else {
-    __ ldr_s32(Rsafept_cnt2, Address(Rsafepoint_counter_addr));
+    __ eor(Rtmp2, Rres, Rres);
+    __ ldr_s32(Rsafept_cnt2, Address(Rsafepoint_counter_addr, Rtmp2));
   }
   __ cmp(Rsafept_cnt2, Rsafept_cnt);
 #ifdef AARCH64
--- a/src/hotspot/cpu/arm/macroAssembler_arm.cpp	Wed Oct 03 15:54:35 2018 +0200
+++ b/src/hotspot/cpu/arm/macroAssembler_arm.cpp	Wed Oct 03 16:02:24 2018 +0200
@@ -1563,8 +1563,6 @@
 // Serializes memory.
 // tmp register is not used on AArch64, this parameter is provided solely for better compatibility with 32-bit ARM
 void MacroAssembler::membar(Membar_mask_bits order_constraint, Register tmp) {
-  if (!os::is_MP()) return;
-
   // TODO-AARCH64 investigate dsb vs dmb effects
   if (order_constraint == StoreStore) {
     dmb(DMB_st);
@@ -1585,7 +1583,6 @@
                             Register tmp,
                             bool preserve_flags,
                             Register load_tgt) {
-  if (!os::is_MP()) return;
 
   if (order_constraint == StoreStore) {
     dmb(DMB_st, tmp);
--- a/src/hotspot/cpu/arm/templateTable_arm.cpp	Wed Oct 03 15:54:35 2018 +0200
+++ b/src/hotspot/cpu/arm/templateTable_arm.cpp	Wed Oct 03 16:02:24 2018 +0200
@@ -2996,6 +2996,7 @@
   switch (code) {
   case Bytecodes::_nofast_getfield: code = Bytecodes::_getfield; break;
   case Bytecodes::_nofast_putfield: code = Bytecodes::_putfield; break;
+  default: break;
   }
 
   assert(byte_no == f1_byte || byte_no == f2_byte, "byte_no out of range");
@@ -3145,15 +3146,11 @@
   const Register Rindex   = R5_tmp;
   const Register Rflags   = R5_tmp;
 
-  const bool gen_volatile_check = os::is_MP();
-
   resolve_cache_and_index(byte_no, Rcache, Rindex, sizeof(u2));
   jvmti_post_field_access(Rcache, Rindex, is_static, false);
   load_field_cp_cache_entry(Rcache, Rindex, Roffset, Rflags, Robj, is_static);
 
-  if (gen_volatile_check) {
-    __ mov(Rflagsav, Rflags);
-  }
+  __ mov(Rflagsav, Rflags);
 
   if (!is_static) pop_and_check_object(Robj);
 
@@ -3390,16 +3387,13 @@
 
   __ bind(Done);
 
-  if (gen_volatile_check) {
-    // Check for volatile field
-    Label notVolatile;
-    __ tbz(Rflagsav, ConstantPoolCacheEntry::is_volatile_shift, notVolatile);
-
-    volatile_barrier(MacroAssembler::Membar_mask_bits(MacroAssembler::LoadLoad | MacroAssembler::LoadStore), Rtemp);
-
-    __ bind(notVolatile);
-  }
-
+  // Check for volatile field
+  Label notVolatile;
+  __ tbz(Rflagsav, ConstantPoolCacheEntry::is_volatile_shift, notVolatile);
+
+  volatile_barrier(MacroAssembler::Membar_mask_bits(MacroAssembler::LoadLoad | MacroAssembler::LoadStore), Rtemp);
+
+  __ bind(notVolatile);
 }
 
 void TemplateTable::getfield(int byte_no) {
@@ -3491,22 +3485,18 @@
   const Register Rindex   = R5_tmp;
   const Register Rflags   = R5_tmp;
 
-  const bool gen_volatile_check = os::is_MP();
-
   resolve_cache_and_index(byte_no, Rcache, Rindex, sizeof(u2));
   jvmti_post_field_mod(Rcache, Rindex, is_static);
   load_field_cp_cache_entry(Rcache, Rindex, Roffset, Rflags, Robj, is_static);
 
-  if (gen_volatile_check) {
-    // Check for volatile field
-    Label notVolatile;
-    __ mov(Rflagsav, Rflags);
-    __ tbz(Rflagsav, ConstantPoolCacheEntry::is_volatile_shift, notVolatile);
-
-    volatile_barrier(MacroAssembler::Membar_mask_bits(MacroAssembler::StoreStore | MacroAssembler::LoadStore), Rtemp);
-
-    __ bind(notVolatile);
-  }
+  // Check for volatile field
+  Label notVolatile;
+  __ mov(Rflagsav, Rflags);
+  __ tbz(Rflagsav, ConstantPoolCacheEntry::is_volatile_shift, notVolatile);
+
+  volatile_barrier(MacroAssembler::Membar_mask_bits(MacroAssembler::StoreStore | MacroAssembler::LoadStore), Rtemp);
+
+  __ bind(notVolatile);
 
   Label Done, Lint, shouldNotReachHere;
   Label Ltable, Lbtos, Lztos, Lctos, Lstos, Litos, Lltos, Lftos, Ldtos, Latos;
@@ -3732,36 +3722,33 @@
 
   __ bind(Done);
 
-  if (gen_volatile_check) {
-    Label notVolatile;
-    if (is_static) {
-      // Just check for volatile. Memory barrier for static final field
-      // is handled by class initialization.
-      __ tbz(Rflagsav, ConstantPoolCacheEntry::is_volatile_shift, notVolatile);
-      volatile_barrier(MacroAssembler::StoreLoad, Rtemp);
-      __ bind(notVolatile);
-    } else {
-      // Check for volatile field and final field
-      Label skipMembar;
-
-      __ tst(Rflagsav, 1 << ConstantPoolCacheEntry::is_volatile_shift |
-                       1 << ConstantPoolCacheEntry::is_final_shift);
-      __ b(skipMembar, eq);
-
-      __ tbz(Rflagsav, ConstantPoolCacheEntry::is_volatile_shift, notVolatile);
-
-      // StoreLoad barrier after volatile field write
-      volatile_barrier(MacroAssembler::StoreLoad, Rtemp);
-      __ b(skipMembar);
-
-      // StoreStore barrier after final field write
-      __ bind(notVolatile);
-      volatile_barrier(MacroAssembler::StoreStore, Rtemp);
-
-      __ bind(skipMembar);
-    }
+  Label notVolatile2;
+  if (is_static) {
+    // Just check for volatile. Memory barrier for static final field
+    // is handled by class initialization.
+    __ tbz(Rflagsav, ConstantPoolCacheEntry::is_volatile_shift, notVolatile2);
+    volatile_barrier(MacroAssembler::StoreLoad, Rtemp);
+    __ bind(notVolatile2);
+  } else {
+    // Check for volatile field and final field
+    Label skipMembar;
+
+    __ tst(Rflagsav, 1 << ConstantPoolCacheEntry::is_volatile_shift |
+           1 << ConstantPoolCacheEntry::is_final_shift);
+    __ b(skipMembar, eq);
+
+    __ tbz(Rflagsav, ConstantPoolCacheEntry::is_volatile_shift, notVolatile2);
+
+    // StoreLoad barrier after volatile field write
+    volatile_barrier(MacroAssembler::StoreLoad, Rtemp);
+    __ b(skipMembar);
+
+    // StoreStore barrier after final field write
+    __ bind(notVolatile2);
+    volatile_barrier(MacroAssembler::StoreStore, Rtemp);
+
+    __ bind(skipMembar);
   }
-
 }
 
 void TemplateTable::putfield(int byte_no) {
@@ -3831,31 +3818,25 @@
   const Register Rflags  = Rtmp_save0; // R4/R19
   const Register Robj    = R5_tmp;
 
-  const bool gen_volatile_check = os::is_MP();
-
   // access constant pool cache
   __ get_cache_and_index_at_bcp(Rcache, Rindex, 1);
 
   __ add(Rcache, Rcache, AsmOperand(Rindex, lsl, LogBytesPerWord));
 
-  if (gen_volatile_check) {
-    // load flags to test volatile
-    __ ldr_u32(Rflags, Address(Rcache, base + ConstantPoolCacheEntry::flags_offset()));
-  }
+  // load flags to test volatile
+  __ ldr_u32(Rflags, Address(Rcache, base + ConstantPoolCacheEntry::flags_offset()));
 
   // replace index with field offset from cache entry
   __ ldr(Roffset, Address(Rcache, base + ConstantPoolCacheEntry::f2_offset()));
 
-  if (gen_volatile_check) {
-    // Check for volatile store
-    Label notVolatile;
-    __ tbz(Rflags, ConstantPoolCacheEntry::is_volatile_shift, notVolatile);
-
-    // TODO-AARCH64 on AArch64, store-release instructions can be used to get rid of this explict barrier
-    volatile_barrier(MacroAssembler::Membar_mask_bits(MacroAssembler::StoreStore | MacroAssembler::LoadStore), Rtemp);
-
-    __ bind(notVolatile);
-  }
+  // Check for volatile store
+  Label notVolatile;
+  __ tbz(Rflags, ConstantPoolCacheEntry::is_volatile_shift, notVolatile);
+
+  // TODO-AARCH64 on AArch64, store-release instructions can be used to get rid of this explict barrier
+  volatile_barrier(MacroAssembler::Membar_mask_bits(MacroAssembler::StoreStore | MacroAssembler::LoadStore), Rtemp);
+
+  __ bind(notVolatile);
 
   // Get object from stack
   pop_and_check_object(Robj);
@@ -3902,28 +3883,25 @@
       ShouldNotReachHere();
   }
 
-  if (gen_volatile_check) {
-    Label notVolatile;
-    Label skipMembar;
-    __ tst(Rflags, 1 << ConstantPoolCacheEntry::is_volatile_shift |
-                   1 << ConstantPoolCacheEntry::is_final_shift);
-    __ b(skipMembar, eq);
-
-    __ tbz(Rflags, ConstantPoolCacheEntry::is_volatile_shift, notVolatile);
-
-    // StoreLoad barrier after volatile field write
-    volatile_barrier(MacroAssembler::StoreLoad, Rtemp);
-    __ b(skipMembar);
-
-    // StoreStore barrier after final field write
-    __ bind(notVolatile);
-    volatile_barrier(MacroAssembler::StoreStore, Rtemp);
-
-    __ bind(skipMembar);
-  }
+  Label notVolatile2;
+  Label skipMembar;
+  __ tst(Rflags, 1 << ConstantPoolCacheEntry::is_volatile_shift |
+         1 << ConstantPoolCacheEntry::is_final_shift);
+  __ b(skipMembar, eq);
+
+  __ tbz(Rflags, ConstantPoolCacheEntry::is_volatile_shift, notVolatile2);
+
+  // StoreLoad barrier after volatile field write
+  volatile_barrier(MacroAssembler::StoreLoad, Rtemp);
+  __ b(skipMembar);
+
+  // StoreStore barrier after final field write
+  __ bind(notVolatile2);
+  volatile_barrier(MacroAssembler::StoreStore, Rtemp);
+
+  __ bind(skipMembar);
 }
 
-
 void TemplateTable::fast_accessfield(TosState state) {
   transition(atos, state);
 
@@ -3953,18 +3931,14 @@
   const Register Rindex  = R3_tmp;
   const Register Roffset = R3_tmp;
 
-  const bool gen_volatile_check = os::is_MP();
-
   // access constant pool cache
   __ get_cache_and_index_at_bcp(Rcache, Rindex, 1);
   // replace index with field offset from cache entry
   __ add(Rtemp, Rcache, AsmOperand(Rindex, lsl, LogBytesPerWord));
   __ ldr(Roffset, Address(Rtemp, ConstantPoolCache::base_offset() + ConstantPoolCacheEntry::f2_offset()));
 
-  if (gen_volatile_check) {
-    // load flags to test volatile
-    __ ldr_u32(Rflags, Address(Rtemp, ConstantPoolCache::base_offset() + ConstantPoolCacheEntry::flags_offset()));
-  }
+  // load flags to test volatile
+  __ ldr_u32(Rflags, Address(Rtemp, ConstantPoolCache::base_offset() + ConstantPoolCacheEntry::flags_offset()));
 
   __ verify_oop(Robj);
   __ null_check(Robj, Rtemp);
@@ -4007,16 +3981,14 @@
       ShouldNotReachHere();
   }
 
-  if (gen_volatile_check) {
-    // Check for volatile load
-    Label notVolatile;
-    __ tbz(Rflags, ConstantPoolCacheEntry::is_volatile_shift, notVolatile);
-
-    // TODO-AARCH64 on AArch64, load-acquire instructions can be used to get rid of this explict barrier
-    volatile_barrier(MacroAssembler::Membar_mask_bits(MacroAssembler::LoadLoad | MacroAssembler::LoadStore), Rtemp);
-
-    __ bind(notVolatile);
-  }
+  // Check for volatile load
+  Label notVolatile;
+  __ tbz(Rflags, ConstantPoolCacheEntry::is_volatile_shift, notVolatile);
+
+  // TODO-AARCH64 on AArch64, load-acquire instructions can be used to get rid of this explict barrier
+  volatile_barrier(MacroAssembler::Membar_mask_bits(MacroAssembler::LoadLoad | MacroAssembler::LoadStore), Rtemp);
+
+  __ bind(notVolatile);
 }
 
 
@@ -4038,12 +4010,8 @@
   __ add(Rtemp, Rcache, AsmOperand(Rindex, lsl, LogBytesPerWord));
   __ ldr(Roffset, Address(Rtemp, ConstantPoolCache::base_offset() + ConstantPoolCacheEntry::f2_offset()));
 
-  const bool gen_volatile_check = os::is_MP();
-
-  if (gen_volatile_check) {
-    // load flags to test volatile
-    __ ldr_u32(Rflags, Address(Rtemp, ConstantPoolCache::base_offset() + ConstantPoolCacheEntry::flags_offset()));
-  }
+  // load flags to test volatile
+  __ ldr_u32(Rflags, Address(Rtemp, ConstantPoolCache::base_offset() + ConstantPoolCacheEntry::flags_offset()));
 
   // make sure exception is reported in correct bcp range (getfield is next instruction)
   __ add(Rbcp, Rbcp, 1);
@@ -4051,32 +4019,30 @@
   __ sub(Rbcp, Rbcp, 1);
 
 #ifdef AARCH64
-  if (gen_volatile_check) {
-    Label notVolatile;
-    __ tbz(Rflags, ConstantPoolCacheEntry::is_volatile_shift, notVolatile);
-
-    __ add(Rtemp, Robj, Roffset);
-
-    if (state == itos) {
+  Label notVolatile;
+  __ tbz(Rflags, ConstantPoolCacheEntry::is_volatile_shift, notVolatile);
+
+  __ add(Rtemp, Robj, Roffset);
+
+  if (state == itos) {
+    __ ldar_w(R0_tos, Rtemp);
+  } else if (state == atos) {
+    if (UseCompressedOops) {
       __ ldar_w(R0_tos, Rtemp);
-    } else if (state == atos) {
-      if (UseCompressedOops) {
-        __ ldar_w(R0_tos, Rtemp);
-        __ decode_heap_oop(R0_tos);
-      } else {
-        __ ldar(R0_tos, Rtemp);
-      }
-      __ verify_oop(R0_tos);
-    } else if (state == ftos) {
-      __ ldar_w(R0_tos, Rtemp);
-      __ fmov_sw(S0_tos, R0_tos);
+      __ decode_heap_oop(R0_tos);
     } else {
-      ShouldNotReachHere();
+      __ ldar(R0_tos, Rtemp);
     }
-    __ b(done);
-
-    __ bind(notVolatile);
+    __ verify_oop(R0_tos);
+  } else if (state == ftos) {
+    __ ldar_w(R0_tos, Rtemp);
+    __ fmov_sw(S0_tos, R0_tos);
+  } else {
+    ShouldNotReachHere();
   }
+  __ b(done);
+
+  __ bind(notVolatile);
 #endif // AARCH64
 
   if (state == itos) {
@@ -4099,15 +4065,13 @@
   }
 
 #ifndef AARCH64
-  if (gen_volatile_check) {
-    // Check for volatile load
-    Label notVolatile;
-    __ tbz(Rflags, ConstantPoolCacheEntry::is_volatile_shift, notVolatile);
-
-    volatile_barrier(MacroAssembler::Membar_mask_bits(MacroAssembler::LoadLoad | MacroAssembler::LoadStore), Rtemp);
-
-    __ bind(notVolatile);
-  }
+  // Check for volatile load
+  Label notVolatile;
+  __ tbz(Rflags, ConstantPoolCacheEntry::is_volatile_shift, notVolatile);
+
+  volatile_barrier(MacroAssembler::Membar_mask_bits(MacroAssembler::LoadLoad | MacroAssembler::LoadStore), Rtemp);
+
+  __ bind(notVolatile);
 #endif // !AARCH64
 
   __ bind(done);
--- a/src/hotspot/cpu/ppc/c1_LIRGenerator_ppc.cpp	Wed Oct 03 15:54:35 2018 +0200
+++ b/src/hotspot/cpu/ppc/c1_LIRGenerator_ppc.cpp	Wed Oct 03 16:02:24 2018 +0200
@@ -535,8 +535,8 @@
     case doubleTag: do_ArithmeticOp_FPU(x);  return;
     case longTag:   do_ArithmeticOp_Long(x); return;
     case intTag:    do_ArithmeticOp_Int(x);  return;
+    default: ShouldNotReachHere();
   }
-  ShouldNotReachHere();
 }
 
 
@@ -735,39 +735,39 @@
         break;
       } // else fallthru
     }
+    case vmIntrinsics::_dsin:   // fall through
+    case vmIntrinsics::_dcos:   // fall through
+    case vmIntrinsics::_dtan:   // fall through
+    case vmIntrinsics::_dlog:   // fall through
     case vmIntrinsics::_dlog10: // fall through
-    case vmIntrinsics::_dlog: // fall through
-    case vmIntrinsics::_dsin: // fall through
-    case vmIntrinsics::_dtan: // fall through
-    case vmIntrinsics::_dcos: // fall through
     case vmIntrinsics::_dexp: {
       assert(x->number_of_arguments() == 1, "wrong type");
 
       address runtime_entry = NULL;
       switch (x->id()) {
-      case vmIntrinsics::_dsqrt:
-        runtime_entry = CAST_FROM_FN_PTR(address, SharedRuntime::dsqrt);
-        break;
-      case vmIntrinsics::_dsin:
-        runtime_entry = CAST_FROM_FN_PTR(address, SharedRuntime::dsin);
-        break;
-      case vmIntrinsics::_dcos:
-        runtime_entry = CAST_FROM_FN_PTR(address, SharedRuntime::dcos);
-        break;
-      case vmIntrinsics::_dtan:
-        runtime_entry = CAST_FROM_FN_PTR(address, SharedRuntime::dtan);
-        break;
-      case vmIntrinsics::_dlog:
-        runtime_entry = CAST_FROM_FN_PTR(address, SharedRuntime::dlog);
-        break;
-      case vmIntrinsics::_dlog10:
-        runtime_entry = CAST_FROM_FN_PTR(address, SharedRuntime::dlog10);
-        break;
-      case vmIntrinsics::_dexp:
-        runtime_entry = CAST_FROM_FN_PTR(address, SharedRuntime::dexp);
-        break;
-      default:
-        ShouldNotReachHere();
+        case vmIntrinsics::_dsqrt:
+          runtime_entry = CAST_FROM_FN_PTR(address, SharedRuntime::dsqrt);
+          break;
+        case vmIntrinsics::_dsin:
+          runtime_entry = CAST_FROM_FN_PTR(address, SharedRuntime::dsin);
+          break;
+        case vmIntrinsics::_dcos:
+          runtime_entry = CAST_FROM_FN_PTR(address, SharedRuntime::dcos);
+          break;
+        case vmIntrinsics::_dtan:
+          runtime_entry = CAST_FROM_FN_PTR(address, SharedRuntime::dtan);
+          break;
+        case vmIntrinsics::_dlog:
+          runtime_entry = CAST_FROM_FN_PTR(address, SharedRuntime::dlog);
+          break;
+        case vmIntrinsics::_dlog10:
+          runtime_entry = CAST_FROM_FN_PTR(address, SharedRuntime::dlog10);
+          break;
+        case vmIntrinsics::_dexp:
+          runtime_entry = CAST_FROM_FN_PTR(address, SharedRuntime::dexp);
+          break;
+        default:
+          ShouldNotReachHere();
       }
 
       LIR_Opr result = call_runtime(x->argument_at(0), runtime_entry, x->type(), NULL);
@@ -781,6 +781,8 @@
       set_result(x, result);
       break;
     }
+    default:
+      break;
   }
 }
 
--- a/src/hotspot/cpu/ppc/compiledIC_ppc.cpp	Wed Oct 03 15:54:35 2018 +0200
+++ b/src/hotspot/cpu/ppc/compiledIC_ppc.cpp	Wed Oct 03 16:02:24 2018 +0200
@@ -215,9 +215,7 @@
 void CompiledDirectStaticCall::verify() {
   // Verify call.
   _call->verify();
-  if (os::is_MP()) {
-    _call->verify_alignment();
-  }
+  _call->verify_alignment();
 
   // Verify stub.
   address stub = find_stub(/*is_aot*/ false);
--- a/src/hotspot/cpu/ppc/sharedRuntime_ppc.cpp	Wed Oct 03 15:54:35 2018 +0200
+++ b/src/hotspot/cpu/ppc/sharedRuntime_ppc.cpp	Wed Oct 03 16:02:24 2018 +0200
@@ -2430,17 +2430,15 @@
   {
     Label no_block, sync;
 
-    if (os::is_MP()) {
-      if (UseMembar) {
-        // Force this write out before the read below.
-        __ fence();
-      } else {
-        // Write serialization page so VM thread can do a pseudo remote membar.
-        // We use the current thread pointer to calculate a thread specific
-        // offset to write to within the page. This minimizes bus traffic
-        // due to cache line collision.
-        __ serialize_memory(R16_thread, r_temp_4, r_temp_5);
-      }
+    if (UseMembar) {
+      // Force this write out before the read below.
+      __ fence();
+    } else {
+      // Write serialization page so VM thread can do a pseudo remote membar.
+      // We use the current thread pointer to calculate a thread specific
+      // offset to write to within the page. This minimizes bus traffic
+      // due to cache line collision.
+      __ serialize_memory(R16_thread, r_temp_4, r_temp_5);
     }
 
     Register sync_state_addr = r_temp_4;
--- a/src/hotspot/cpu/ppc/templateTable_ppc_64.cpp	Wed Oct 03 15:54:35 2018 +0200
+++ b/src/hotspot/cpu/ppc/templateTable_ppc_64.cpp	Wed Oct 03 16:02:24 2018 +0200
@@ -2236,8 +2236,10 @@
 
   Bytecodes::Code code = bytecode();
   switch (code) {
-  case Bytecodes::_nofast_getfield: code = Bytecodes::_getfield; break;
-  case Bytecodes::_nofast_putfield: code = Bytecodes::_putfield; break;
+    case Bytecodes::_nofast_getfield: code = Bytecodes::_getfield; break;
+    case Bytecodes::_nofast_putfield: code = Bytecodes::_putfield; break;
+    default:
+      break;
   }
 
   assert(byte_no == f1_byte || byte_no == f2_byte, "byte_no out of range");
--- a/src/hotspot/cpu/s390/assembler_s390.cpp	Wed Oct 03 15:54:35 2018 +0200
+++ b/src/hotspot/cpu/s390/assembler_s390.cpp	Wed Oct 03 16:02:24 2018 +0200
@@ -121,14 +121,14 @@
     case bcondNotOrdered  : inverse_cc = bcondOrdered;     break;  // 14
     case bcondOrdered     : inverse_cc = bcondNotOrdered;  break;  //  1
 
-    case bcondEqual                      : inverse_cc = (branch_condition)(bcondNotEqual + bcondNotOrdered);  break; //  8
-    case bcondNotEqual + bcondNotOrdered : inverse_cc = bcondEqual;  break;                                          //  7
+    case bcondEqual                : inverse_cc = bcondNotEqualOrNotOrdered; break;  //  8
+    case bcondNotEqualOrNotOrdered : inverse_cc = bcondEqual;                break;  //  7
 
-    case bcondLow      + bcondNotOrdered : inverse_cc = (branch_condition)(bcondHigh + bcondEqual);      break;      //  5
-    case bcondNotLow                     : inverse_cc = (branch_condition)(bcondLow  + bcondNotOrdered); break;      // 10
+    case bcondLowOrNotOrdered      : inverse_cc = bcondNotLow;               break;  //  5
+    case bcondNotLow               : inverse_cc = bcondLowOrNotOrdered;      break;  // 10
 
-    case bcondHigh                       : inverse_cc = (branch_condition)(bcondLow  + bcondNotOrdered + bcondEqual); break;  //  2
-    case bcondNotHigh  + bcondNotOrdered : inverse_cc = bcondHigh; break;                                                     // 13
+    case bcondHigh                 : inverse_cc = bcondNotHighOrNotOrdered;  break;  //  2
+    case bcondNotHighOrNotOrdered  : inverse_cc = bcondHigh;                 break;  // 13
 
     default :
       fprintf(stderr, "inverse_float_condition(%d)\n", (int)cc);
--- a/src/hotspot/cpu/s390/assembler_s390.hpp	Wed Oct 03 15:54:35 2018 +0200
+++ b/src/hotspot/cpu/s390/assembler_s390.hpp	Wed Oct 03 16:02:24 2018 +0200
@@ -1442,8 +1442,11 @@
     bcondNotPositive =  bcondNotHigh,
     bcondNotOrdered  =  1,  // float comparisons
     bcondOrdered     = 14,  // float comparisons
-    bcondLowOrNotOrdered  =  bcondLow|bcondNotOrdered,  // float comparisons
-    bcondHighOrNotOrdered =  bcondHigh|bcondNotOrdered, // float comparisons
+    bcondLowOrNotOrdered  =  bcondLow  | bcondNotOrdered,  // float comparisons
+    bcondHighOrNotOrdered =  bcondHigh | bcondNotOrdered,  // float comparisons
+    bcondNotLowOrNotOrdered   =  bcondNotLow   | bcondNotOrdered,  // float comparisons
+    bcondNotHighOrNotOrdered  =  bcondNotHigh  | bcondNotOrdered,  // float comparisons
+    bcondNotEqualOrNotOrdered =  bcondNotEqual | bcondNotOrdered,  // float comparisons
     // unsigned arithmetic calculation instructions
     // Mask bit#0 is not used by these instructions.
     // There is no indication of overflow for these instr.
--- a/src/hotspot/cpu/s390/c1_LIRGenerator_s390.cpp	Wed Oct 03 15:54:35 2018 +0200
+++ b/src/hotspot/cpu/s390/c1_LIRGenerator_s390.cpp	Wed Oct 03 16:02:24 2018 +0200
@@ -529,8 +529,9 @@
     case doubleTag: do_ArithmeticOp_FPU(x);  return;
     case longTag:   do_ArithmeticOp_Long(x); return;
     case intTag:    do_ArithmeticOp_Int(x);  return;
+    default:
+      ShouldNotReachHere();
   }
-  ShouldNotReachHere();
 }
 
 // _ishl, _lshl, _ishr, _lshr, _iushr, _lushr
@@ -634,47 +635,49 @@
       LIR_Opr dst = rlock_result(x);
 
       switch (x->id()) {
-      case vmIntrinsics::_dsqrt: {
-        __ sqrt(value.result(), dst, LIR_OprFact::illegalOpr);
-        break;
-      }
-      case vmIntrinsics::_dabs: {
-        __ abs(value.result(), dst, LIR_OprFact::illegalOpr);
-        break;
-      }
+        case vmIntrinsics::_dsqrt: {
+          __ sqrt(value.result(), dst, LIR_OprFact::illegalOpr);
+          break;
+        }
+        case vmIntrinsics::_dabs: {
+          __ abs(value.result(), dst, LIR_OprFact::illegalOpr);
+          break;
+        }
+        default:
+          ShouldNotReachHere();
       }
       break;
     }
+    case vmIntrinsics::_dsin:   // fall through
+    case vmIntrinsics::_dcos:   // fall through
+    case vmIntrinsics::_dtan:   // fall through
+    case vmIntrinsics::_dlog:   // fall through
     case vmIntrinsics::_dlog10: // fall through
-    case vmIntrinsics::_dlog: // fall through
-    case vmIntrinsics::_dsin: // fall through
-    case vmIntrinsics::_dtan: // fall through
-    case vmIntrinsics::_dcos: // fall through
     case vmIntrinsics::_dexp: {
       assert(x->number_of_arguments() == 1, "wrong type");
 
       address runtime_entry = NULL;
       switch (x->id()) {
-      case vmIntrinsics::_dsin:
-        runtime_entry = CAST_FROM_FN_PTR(address, SharedRuntime::dsin);
-        break;
-      case vmIntrinsics::_dcos:
-        runtime_entry = CAST_FROM_FN_PTR(address, SharedRuntime::dcos);
-        break;
-      case vmIntrinsics::_dtan:
-        runtime_entry = CAST_FROM_FN_PTR(address, SharedRuntime::dtan);
-        break;
-      case vmIntrinsics::_dlog:
-        runtime_entry = CAST_FROM_FN_PTR(address, SharedRuntime::dlog);
-        break;
-      case vmIntrinsics::_dlog10:
-        runtime_entry = CAST_FROM_FN_PTR(address, SharedRuntime::dlog10);
-        break;
-      case vmIntrinsics::_dexp:
-        runtime_entry = CAST_FROM_FN_PTR(address, SharedRuntime::dexp);
-        break;
-      default:
-        ShouldNotReachHere();
+        case vmIntrinsics::_dsin:
+          runtime_entry = CAST_FROM_FN_PTR(address, SharedRuntime::dsin);
+          break;
+        case vmIntrinsics::_dcos:
+          runtime_entry = CAST_FROM_FN_PTR(address, SharedRuntime::dcos);
+          break;
+        case vmIntrinsics::_dtan:
+          runtime_entry = CAST_FROM_FN_PTR(address, SharedRuntime::dtan);
+          break;
+        case vmIntrinsics::_dlog:
+          runtime_entry = CAST_FROM_FN_PTR(address, SharedRuntime::dlog);
+          break;
+        case vmIntrinsics::_dlog10:
+          runtime_entry = CAST_FROM_FN_PTR(address, SharedRuntime::dlog10);
+          break;
+        case vmIntrinsics::_dexp:
+          runtime_entry = CAST_FROM_FN_PTR(address, SharedRuntime::dexp);
+          break;
+        default:
+          ShouldNotReachHere();
       }
 
       LIR_Opr result = call_runtime(x->argument_at(0), runtime_entry, x->type(), NULL);
@@ -688,6 +691,8 @@
       set_result(x, result);
       break;
     }
+    default:
+      break;
   }
 }
 
--- a/src/hotspot/cpu/s390/compiledIC_s390.cpp	Wed Oct 03 15:54:35 2018 +0200
+++ b/src/hotspot/cpu/s390/compiledIC_s390.cpp	Wed Oct 03 16:02:24 2018 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2016, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2016, 2018, 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.
  *
@@ -145,9 +145,7 @@
 void CompiledDirectStaticCall::verify() {
   // Verify call.
   _call->verify();
-  if (os::is_MP()) {
-    _call->verify_alignment();
-  }
+  _call->verify_alignment();
 
   // Verify stub.
   address stub = find_stub(/*is_aot*/ false);
--- a/src/hotspot/cpu/s390/macroAssembler_s390.hpp	Wed Oct 03 15:54:35 2018 +0200
+++ b/src/hotspot/cpu/s390/macroAssembler_s390.hpp	Wed Oct 03 16:02:24 2018 +0200
@@ -593,7 +593,6 @@
   static int call_far_patchable_ret_addr_offset() { return call_far_patchable_size(); }
 
   static bool call_far_patchable_requires_alignment_nop(address pc) {
-    if (!os::is_MP()) return false;
     int size = call_far_patchable_size();
     return ((intptr_t)(pc + size) & 0x03L) != 0;
   }
--- a/src/hotspot/cpu/s390/sharedRuntime_s390.cpp	Wed Oct 03 15:54:35 2018 +0200
+++ b/src/hotspot/cpu/s390/sharedRuntime_s390.cpp	Wed Oct 03 16:02:24 2018 +0200
@@ -587,6 +587,9 @@
     case T_DOUBLE:
       __ freg2mem_opt(Z_FRET, memaddr);
       break;
+    default:
+      ShouldNotReachHere();
+      break;
   }
 }
 
@@ -616,6 +619,9 @@
     case T_DOUBLE:
       __ mem2freg_opt(Z_FRET, memaddr);
       break;
+    default:
+      ShouldNotReachHere();
+      break;
   }
 }
 
@@ -2155,18 +2161,17 @@
 
     save_native_result(masm, ret_type, workspace_slot_offset); // Make Z_R2 available as work reg.
 
-    if (os::is_MP()) {
-      if (UseMembar) {
-        // Force this write out before the read below.
-        __ z_fence();
-      } else {
-        // Write serialization page so VM thread can do a pseudo remote membar.
-        // We use the current thread pointer to calculate a thread specific
-        // offset to write to within the page. This minimizes bus traffic
-        // due to cache line collision.
-        __ serialize_memory(Z_thread, Z_R1, Z_R2);
-      }
+    if (UseMembar) {
+      // Force this write out before the read below.
+      __ z_fence();
+    } else {
+      // Write serialization page so VM thread can do a pseudo remote membar.
+      // We use the current thread pointer to calculate a thread specific
+      // offset to write to within the page. This minimizes bus traffic
+      // due to cache line collision.
+      __ serialize_memory(Z_thread, Z_R1, Z_R2);
     }
+
     __ safepoint_poll(sync, Z_R1);
 
     __ load_and_test_int(Z_R0, Address(Z_thread, JavaThread::suspend_flags_offset()));
--- a/src/hotspot/cpu/s390/templateTable_s390.cpp	Wed Oct 03 15:54:35 2018 +0200
+++ b/src/hotspot/cpu/s390/templateTable_s390.cpp	Wed Oct 03 16:02:24 2018 +0200
@@ -2417,6 +2417,8 @@
   switch (code) {
     case Bytecodes::_nofast_getfield: code = Bytecodes::_getfield; break;
     case Bytecodes::_nofast_putfield: code = Bytecodes::_putfield; break;
+    default:
+      break;
   }
 
   {
@@ -3213,6 +3215,8 @@
     case Bytecodes::_fast_lputfield:
       __ pop_l(Z_tos);
       break;
+    default:
+      break;
   }
 
   __ bind(exit);
--- a/src/hotspot/cpu/sparc/compiledIC_sparc.cpp	Wed Oct 03 15:54:35 2018 +0200
+++ b/src/hotspot/cpu/sparc/compiledIC_sparc.cpp	Wed Oct 03 16:02:24 2018 +0200
@@ -142,9 +142,7 @@
 void CompiledDirectStaticCall::verify() {
   // Verify call.
   _call->verify();
-  if (os::is_MP()) {
-    _call->verify_alignment();
-  }
+  _call->verify_alignment();
 
   // Verify stub.
   address stub = find_stub(/*is_aot*/ false);
--- a/src/hotspot/cpu/sparc/macroAssembler_sparc.cpp	Wed Oct 03 15:54:35 2018 +0200
+++ b/src/hotspot/cpu/sparc/macroAssembler_sparc.cpp	Wed Oct 03 16:02:24 2018 +0200
@@ -2786,7 +2786,7 @@
    delayed()->
    st_ptr(G0, Address(Rmark, OM_OFFSET_NO_MONITOR_VALUE_TAG(owner)));
 
-   if (os::is_MP()) { membar(StoreLoad); }
+   membar(StoreLoad);
    // Check that _succ is (or remains) non-zero
    ld_ptr(Address(Rmark, OM_OFFSET_NO_MONITOR_VALUE_TAG(succ)), Rscratch);
    andcc(Rscratch, Rscratch, G0);
--- a/src/hotspot/cpu/sparc/macroAssembler_sparc.inline.hpp	Wed Oct 03 15:54:35 2018 +0200
+++ b/src/hotspot/cpu/sparc/macroAssembler_sparc.inline.hpp	Wed Oct 03 16:02:24 2018 +0200
@@ -614,17 +614,12 @@
 // returns if membar generates anything, obviously this code should mirror
 // membar below.
 inline bool MacroAssembler::membar_has_effect( Membar_mask_bits const7a ) {
-  if (!os::is_MP())
-    return false;  // Not needed on single CPU
   const Membar_mask_bits effective_mask =
       Membar_mask_bits(const7a & ~(LoadLoad | LoadStore | StoreStore));
   return (effective_mask != 0);
 }
 
 inline void MacroAssembler::membar( Membar_mask_bits const7a ) {
-  // Uniprocessors do not need memory barriers
-  if (!os::is_MP())
-    return;
   // Weakened for current Sparcs and TSO.  See the v9 manual, sections 8.4.3,
   // 8.4.4.3, a.31 and a.50.
   // Under TSO, setting bit 3, 2, or 0 is redundant, so the only value
--- a/src/hotspot/cpu/sparc/sharedRuntime_sparc.cpp	Wed Oct 03 15:54:35 2018 +0200
+++ b/src/hotspot/cpu/sparc/sharedRuntime_sparc.cpp	Wed Oct 03 16:02:24 2018 +0200
@@ -2371,17 +2371,16 @@
     //     didn't see any synchronization is progress, and escapes.
     __ set(_thread_in_native_trans, G3_scratch);
     __ st(G3_scratch, G2_thread, JavaThread::thread_state_offset());
-    if(os::is_MP()) {
-      if (UseMembar) {
-        // Force this write out before the read below
-        __ membar(Assembler::StoreLoad);
-      } else {
-        // Write serialization page so VM thread can do a pseudo remote membar.
-        // We use the current thread pointer to calculate a thread specific
-        // offset to write to within the page. This minimizes bus traffic
-        // due to cache line collision.
-        __ serialize_memory(G2_thread, G1_scratch, G3_scratch);
-      }
+
+    if (UseMembar) {
+      // Force this write out before the read below
+      __ membar(Assembler::StoreLoad);
+    } else {
+      // Write serialization page so VM thread can do a pseudo remote membar.
+      // We use the current thread pointer to calculate a thread specific
+      // offset to write to within the page. This minimizes bus traffic
+      // due to cache line collision.
+      __ serialize_memory(G2_thread, G1_scratch, G3_scratch);
     }
 
     Label L;
--- a/src/hotspot/cpu/sparc/templateInterpreterGenerator_sparc.cpp	Wed Oct 03 15:54:35 2018 +0200
+++ b/src/hotspot/cpu/sparc/templateInterpreterGenerator_sparc.cpp	Wed Oct 03 16:02:24 2018 +0200
@@ -1373,17 +1373,16 @@
     //     didn't see any synchronization is progress, and escapes.
     __ set(_thread_in_native_trans, G3_scratch);
     __ st(G3_scratch, thread_state);
-    if (os::is_MP()) {
-      if (UseMembar) {
-        // Force this write out before the read below
-        __ membar(Assembler::StoreLoad);
-      } else {
-        // Write serialization page so VM thread can do a pseudo remote membar.
-        // We use the current thread pointer to calculate a thread specific
-        // offset to write to within the page. This minimizes bus traffic
-        // due to cache line collision.
-        __ serialize_memory(G2_thread, G1_scratch, G3_scratch);
-      }
+
+    if (UseMembar) {
+      // Force this write out before the read below
+      __ membar(Assembler::StoreLoad);
+    } else {
+      // Write serialization page so VM thread can do a pseudo remote membar.
+      // We use the current thread pointer to calculate a thread specific
+      // offset to write to within the page. This minimizes bus traffic
+      // due to cache line collision.
+      __ serialize_memory(G2_thread, G1_scratch, G3_scratch);
     }
 
     Label L;
--- a/src/hotspot/cpu/x86/assembler_x86.cpp	Wed Oct 03 15:54:35 2018 +0200
+++ b/src/hotspot/cpu/x86/assembler_x86.cpp	Wed Oct 03 16:02:24 2018 +0200
@@ -972,7 +972,6 @@
     return ip;
 
   case 0xF0:                    // Lock
-    assert(os::is_MP(), "only on MP");
     goto again_after_prefix;
 
   case 0xF3:                    // For SSE
@@ -1773,7 +1772,7 @@
 
 void Assembler::cvtdq2pd(XMMRegister dst, XMMRegister src) {
   NOT_LP64(assert(VM_Version::supports_sse2(), ""));
-  InstructionAttr attributes(AVX_128bit, /* rex_w */ false, /* legacy_mode */ false, /* no_mask_reg */ false, /* uses_vl */ true);
+  InstructionAttr attributes(AVX_128bit, /* rex_w */ false, /* legacy_mode */ false, /* no_mask_reg */ true, /* uses_vl */ true);
   int encode = simd_prefix_and_encode(dst, xnoreg, src, VEX_SIMD_F3, VEX_OPCODE_0F, &attributes);
   emit_int8((unsigned char)0xE6);
   emit_int8((unsigned char)(0xC0 | encode));
@@ -1781,7 +1780,7 @@
 
 void Assembler::cvtdq2ps(XMMRegister dst, XMMRegister src) {
   NOT_LP64(assert(VM_Version::supports_sse2(), ""));
-  InstructionAttr attributes(AVX_128bit, /* rex_w */ false, /* legacy_mode */ false, /* no_mask_reg */ false, /* uses_vl */ true);
+  InstructionAttr attributes(AVX_128bit, /* rex_w */ false, /* legacy_mode */ false, /* no_mask_reg */ true, /* uses_vl */ true);
   int encode = simd_prefix_and_encode(dst, xnoreg, src, VEX_SIMD_NONE, VEX_OPCODE_0F, &attributes);
   emit_int8(0x5B);
   emit_int8((unsigned char)(0xC0 | encode));
@@ -1889,7 +1888,7 @@
 void Assembler::cvttpd2dq(XMMRegister dst, XMMRegister src) {
   NOT_LP64(assert(VM_Version::supports_sse2(), ""));
   int vector_len = VM_Version::supports_avx512novl() ? AVX_512bit : AVX_128bit;
-  InstructionAttr attributes(vector_len, /* rex_w */ true, /* legacy_mode */ false, /* no_mask_reg */ false, /* uses_vl */ true);
+  InstructionAttr attributes(vector_len, /* rex_w */ true, /* legacy_mode */ false, /* no_mask_reg */ true, /* uses_vl */ true);
   int encode = simd_prefix_and_encode(dst, xnoreg, src, VEX_SIMD_66, VEX_OPCODE_0F, &attributes);
   emit_int8((unsigned char)0xE6);
   emit_int8((unsigned char)(0xC0 | encode));
@@ -2199,7 +2198,7 @@
 void Assembler::movapd(XMMRegister dst, XMMRegister src) {
   NOT_LP64(assert(VM_Version::supports_sse2(), ""));
   int vector_len = VM_Version::supports_avx512novl() ? AVX_512bit : AVX_128bit;
-  InstructionAttr attributes(vector_len, /* rex_w */ VM_Version::supports_evex(), /* legacy_mode */ false, /* no_mask_reg */ false, /* uses_vl */ true);
+  InstructionAttr attributes(vector_len, /* rex_w */ VM_Version::supports_evex(), /* legacy_mode */ false, /* no_mask_reg */ true, /* uses_vl */ true);
   attributes.set_rex_vex_w_reverted();
   int encode = simd_prefix_and_encode(dst, xnoreg, src, VEX_SIMD_66, VEX_OPCODE_0F, &attributes);
   emit_int8(0x28);
@@ -2209,7 +2208,7 @@
 void Assembler::movaps(XMMRegister dst, XMMRegister src) {
   NOT_LP64(assert(VM_Version::supports_sse(), ""));
   int vector_len = VM_Version::supports_avx512novl() ? AVX_512bit : AVX_128bit;
-  InstructionAttr attributes(vector_len, /* rex_w */ false, /* legacy_mode */ false, /* no_mask_reg */ false, /* uses_vl */ true);
+  InstructionAttr attributes(vector_len, /* rex_w */ false, /* legacy_mode */ false, /* no_mask_reg */ true, /* uses_vl */ true);
   int encode = simd_prefix_and_encode(dst, xnoreg, src, VEX_SIMD_NONE, VEX_OPCODE_0F, &attributes);
   emit_int8(0x28);
   emit_int8((unsigned char)(0xC0 | encode));
@@ -2234,7 +2233,7 @@
 void Assembler::movddup(XMMRegister dst, XMMRegister src) {
   NOT_LP64(assert(VM_Version::supports_sse3(), ""));
   int vector_len = VM_Version::supports_avx512novl() ? AVX_512bit : AVX_128bit;
-  InstructionAttr attributes(vector_len, /* rex_w */ VM_Version::supports_evex(), /* legacy_mode */ false, /* no_mask_reg */ false, /* uses_vl */ true);
+  InstructionAttr attributes(vector_len, /* rex_w */ VM_Version::supports_evex(), /* legacy_mode */ false, /* no_mask_reg */ true, /* uses_vl */ true);
   attributes.set_rex_vex_w_reverted();
   int encode = simd_prefix_and_encode(dst, xnoreg, src, VEX_SIMD_F2, VEX_OPCODE_0F, &attributes);
   emit_int8(0x12);
@@ -2465,7 +2464,7 @@
 
 void Assembler::movdqa(XMMRegister dst, XMMRegister src) {
   NOT_LP64(assert(VM_Version::supports_sse2(), ""));
-  InstructionAttr attributes(AVX_128bit, /* rex_w */ false, /* legacy_mode */ false, /* no_mask_reg */ false, /* uses_vl */ true);
+  InstructionAttr attributes(AVX_128bit, /* rex_w */ false, /* legacy_mode */ false, /* no_mask_reg */ true, /* uses_vl */ true);
   int encode = simd_prefix_and_encode(dst, xnoreg, src, VEX_SIMD_66, VEX_OPCODE_0F, &attributes);
   emit_int8(0x6F);
   emit_int8((unsigned char)(0xC0 | encode));
@@ -2474,7 +2473,7 @@
 void Assembler::movdqa(XMMRegister dst, Address src) {
   NOT_LP64(assert(VM_Version::supports_sse2(), ""));
   InstructionMark im(this);
-  InstructionAttr attributes(AVX_128bit, /* rex_w */ false, /* legacy_mode */ false, /* no_mask_reg */ false, /* uses_vl */ true);
+  InstructionAttr attributes(AVX_128bit, /* rex_w */ false, /* legacy_mode */ false, /* no_mask_reg */ true, /* uses_vl */ true);
   attributes.set_address_attributes(/* tuple_type */ EVEX_FVM, /* input_size_in_bits */ EVEX_NObit);
   simd_prefix(dst, xnoreg, src, VEX_SIMD_66, VEX_OPCODE_0F, &attributes);
   emit_int8(0x6F);
@@ -2484,7 +2483,7 @@
 void Assembler::movdqu(XMMRegister dst, Address src) {
   NOT_LP64(assert(VM_Version::supports_sse2(), ""));
   InstructionMark im(this);
-  InstructionAttr attributes(AVX_128bit, /* rex_w */ false, /* legacy_mode */ false, /* no_mask_reg */ false, /* uses_vl */ true);
+  InstructionAttr attributes(AVX_128bit, /* rex_w */ false, /* legacy_mode */ false, /* no_mask_reg */ true, /* uses_vl */ true);
   attributes.set_address_attributes(/* tuple_type */ EVEX_FVM, /* input_size_in_bits */ EVEX_NObit);
   simd_prefix(dst, xnoreg, src, VEX_SIMD_F3, VEX_OPCODE_0F, &attributes);
   emit_int8(0x6F);
@@ -2493,7 +2492,7 @@
 
 void Assembler::movdqu(XMMRegister dst, XMMRegister src) {
   NOT_LP64(assert(VM_Version::supports_sse2(), ""));
-  InstructionAttr attributes(AVX_128bit, /* rex_w */ false, /* legacy_mode */ false, /* no_mask_reg */ false, /* uses_vl */ true);
+  InstructionAttr attributes(AVX_128bit, /* rex_w */ false, /* legacy_mode */ false, /* no_mask_reg */ true, /* uses_vl */ true);
   int encode = simd_prefix_and_encode(dst, xnoreg, src, VEX_SIMD_F3, VEX_OPCODE_0F, &attributes);
   emit_int8(0x6F);
   emit_int8((unsigned char)(0xC0 | encode));
@@ -2502,7 +2501,7 @@
 void Assembler::movdqu(Address dst, XMMRegister src) {
   NOT_LP64(assert(VM_Version::supports_sse2(), ""));
   InstructionMark im(this);
-  InstructionAttr attributes(AVX_128bit, /* rex_w */ false, /* legacy_mode */ false, /* no_mask_reg */ false, /* uses_vl */ true);
+  InstructionAttr attributes(AVX_128bit, /* rex_w */ false, /* legacy_mode */ false, /* no_mask_reg */ true, /* uses_vl */ true);
   attributes.set_address_attributes(/* tuple_type */ EVEX_FVM, /* input_size_in_bits */ EVEX_NObit);
   attributes.reset_is_clear_context();
   simd_prefix(src, xnoreg, dst, VEX_SIMD_F3, VEX_OPCODE_0F, &attributes);
@@ -2513,7 +2512,7 @@
 // Move Unaligned 256bit Vector
 void Assembler::vmovdqu(XMMRegister dst, XMMRegister src) {
   assert(UseAVX > 0, "");
-  InstructionAttr attributes(AVX_256bit, /* vex_w */ false, /* legacy_mode */ false, /* no_mask_reg */ false, /* uses_vl */ true);
+  InstructionAttr attributes(AVX_256bit, /* vex_w */ false, /* legacy_mode */ false, /* no_mask_reg */ true, /* uses_vl */ true);
   int encode = vex_prefix_and_encode(dst->encoding(), 0, src->encoding(), VEX_SIMD_F3, VEX_OPCODE_0F, &attributes);
   emit_int8(0x6F);
   emit_int8((unsigned char)(0xC0 | encode));
@@ -2522,7 +2521,7 @@
 void Assembler::vmovdqu(XMMRegister dst, Address src) {
   assert(UseAVX > 0, "");
   InstructionMark im(this);
-  InstructionAttr attributes(AVX_256bit, /* vex_w */ false, /* legacy_mode */ false, /* no_mask_reg */ false, /* uses_vl */ true);
+  InstructionAttr attributes(AVX_256bit, /* vex_w */ false, /* legacy_mode */ false, /* no_mask_reg */ true, /* uses_vl */ true);
   attributes.set_address_attributes(/* tuple_type */ EVEX_FVM, /* input_size_in_bits */ EVEX_NObit);
   vex_prefix(src, 0, dst->encoding(), VEX_SIMD_F3, VEX_OPCODE_0F, &attributes);
   emit_int8(0x6F);
@@ -2532,7 +2531,7 @@
 void Assembler::vmovdqu(Address dst, XMMRegister src) {
   assert(UseAVX > 0, "");
   InstructionMark im(this);
-  InstructionAttr attributes(AVX_256bit, /* vex_w */ false, /* legacy_mode */ false, /* no_mask_reg */ false, /* uses_vl */ true);
+  InstructionAttr attributes(AVX_256bit, /* vex_w */ false, /* legacy_mode */ false, /* no_mask_reg */ true, /* uses_vl */ true);
   attributes.set_address_attributes(/* tuple_type */ EVEX_FVM, /* input_size_in_bits */ EVEX_NObit);
   attributes.reset_is_clear_context();
   // swap src<->dst for encoding
@@ -2580,7 +2579,6 @@
 
 void Assembler::evmovdqub(XMMRegister dst, KRegister mask, Address src, int vector_len) {
   assert(VM_Version::supports_avx512vlbw(), "");
-  assert(is_vector_masking(), "");    // For stub code use only
   InstructionMark im(this);
   InstructionAttr attributes(vector_len, /* vex_w */ false, /* legacy_mode */ false, /* no_mask_reg */ false, /* uses_vl */ true);
   attributes.set_address_attributes(/* tuple_type */ EVEX_FVM, /* input_size_in_bits */ EVEX_NObit);
@@ -2604,7 +2602,6 @@
 }
 
 void Assembler::evmovdquw(XMMRegister dst, KRegister mask, Address src, int vector_len) {
-  assert(is_vector_masking(), "");
   assert(VM_Version::supports_avx512vlbw(), "");
   InstructionMark im(this);
   InstructionAttr attributes(vector_len, /* vex_w */ true, /* legacy_mode */ false, /* no_mask_reg */ false, /* uses_vl */ true);
@@ -2645,7 +2642,7 @@
 
 void Assembler::evmovdqul(XMMRegister dst, XMMRegister src, int vector_len) {
   assert(VM_Version::supports_evex(), "");
-  InstructionAttr attributes(vector_len, /* vex_w */ false, /* legacy_mode */ false, /* no_mask_reg */ false, /* uses_vl */ true);
+  InstructionAttr attributes(vector_len, /* vex_w */ false, /* legacy_mode */ false, /* no_mask_reg */ true, /* uses_vl */ true);
   attributes.set_is_evex_instruction();
   int encode = vex_prefix_and_encode(dst->encoding(), 0, src->encoding(), VEX_SIMD_F3, VEX_OPCODE_0F, &attributes);
   emit_int8(0x6F);
@@ -2655,7 +2652,7 @@
 void Assembler::evmovdqul(XMMRegister dst, Address src, int vector_len) {
   assert(VM_Version::supports_evex(), "");
   InstructionMark im(this);
-  InstructionAttr attributes(vector_len, /* vex_w */ false, /* legacy_mode */ false, /* no_mask_reg */ false , /* uses_vl */ true);
+  InstructionAttr attributes(vector_len, /* vex_w */ false, /* legacy_mode */ false, /* no_mask_reg */ true , /* uses_vl */ true);
   attributes.set_address_attributes(/* tuple_type */ EVEX_FVM, /* input_size_in_bits */ EVEX_NObit);
   attributes.set_is_evex_instruction();
   vex_prefix(src, 0, dst->encoding(), VEX_SIMD_F3, VEX_OPCODE_0F, &attributes);
@@ -2667,7 +2664,7 @@
   assert(VM_Version::supports_evex(), "");
   assert(src != xnoreg, "sanity");
   InstructionMark im(this);
-  InstructionAttr attributes(vector_len, /* vex_w */ false, /* legacy_mode */ false, /* no_mask_reg */ false, /* uses_vl */ true);
+  InstructionAttr attributes(vector_len, /* vex_w */ false, /* legacy_mode */ false, /* no_mask_reg */ true, /* uses_vl */ true);
   attributes.set_address_attributes(/* tuple_type */ EVEX_FVM, /* input_size_in_bits */ EVEX_NObit);
   attributes.reset_is_clear_context();
   attributes.set_is_evex_instruction();
@@ -2678,7 +2675,7 @@
 
 void Assembler::evmovdquq(XMMRegister dst, XMMRegister src, int vector_len) {
   assert(VM_Version::supports_evex(), "");
-  InstructionAttr attributes(vector_len, /* vex_w */ true, /* legacy_mode */ false, /* no_mask_reg */ false, /* uses_vl */ true);
+  InstructionAttr attributes(vector_len, /* vex_w */ true, /* legacy_mode */ false, /* no_mask_reg */ true, /* uses_vl */ true);
   attributes.set_is_evex_instruction();
   int encode = vex_prefix_and_encode(dst->encoding(), 0, src->encoding(), VEX_SIMD_F3, VEX_OPCODE_0F, &attributes);
   emit_int8(0x6F);
@@ -2688,7 +2685,7 @@
 void Assembler::evmovdquq(XMMRegister dst, Address src, int vector_len) {
   assert(VM_Version::supports_evex(), "");
   InstructionMark im(this);
-  InstructionAttr attributes(vector_len, /* vex_w */ true, /* legacy_mode */ false, /* no_mask_reg */ false, /* uses_vl */ true);
+  InstructionAttr attributes(vector_len, /* vex_w */ true, /* legacy_mode */ false, /* no_mask_reg */ true, /* uses_vl */ true);
   attributes.set_address_attributes(/* tuple_type */ EVEX_FVM, /* input_size_in_bits */ EVEX_NObit);
   attributes.set_is_evex_instruction();
   vex_prefix(src, 0, dst->encoding(), VEX_SIMD_F3, VEX_OPCODE_0F, &attributes);
@@ -2700,7 +2697,7 @@
   assert(VM_Version::supports_evex(), "");
   assert(src != xnoreg, "sanity");
   InstructionMark im(this);
-  InstructionAttr attributes(vector_len, /* vex_w */ true, /* legacy_mode */ false, /* no_mask_reg */ false, /* uses_vl */ true);
+  InstructionAttr attributes(vector_len, /* vex_w */ true, /* legacy_mode */ false, /* no_mask_reg */ true, /* uses_vl */ true);
   attributes.set_address_attributes(/* tuple_type */ EVEX_FVM, /* input_size_in_bits */ EVEX_NObit);
   attributes.reset_is_clear_context();
   attributes.set_is_evex_instruction();
@@ -3416,7 +3413,7 @@
 
 void Assembler::vpermq(XMMRegister dst, XMMRegister src, int imm8, int vector_len) {
   assert(VM_Version::supports_avx2(), "");
-  InstructionAttr attributes(vector_len, /* rex_w */ true, /* legacy_mode */ false, /* no_mask_reg */ false, /* uses_vl */ true);
+  InstructionAttr attributes(vector_len, /* rex_w */ true, /* legacy_mode */ false, /* no_mask_reg */ true, /* uses_vl */ true);
   int encode = vex_prefix_and_encode(dst->encoding(), 0, src->encoding(), VEX_SIMD_66, VEX_OPCODE_0F_3A, &attributes);
   emit_int8(0x00);
   emit_int8(0xC0 | encode);
@@ -3425,7 +3422,7 @@
 
 void Assembler::vperm2i128(XMMRegister dst,  XMMRegister nds, XMMRegister src, int imm8) {
   assert(VM_Version::supports_avx2(), "");
-  InstructionAttr attributes(AVX_256bit, /* rex_w */ false, /* legacy_mode */ true, /* no_mask_reg */ false, /* uses_vl */ false);
+  InstructionAttr attributes(AVX_256bit, /* rex_w */ false, /* legacy_mode */ true, /* no_mask_reg */ true, /* uses_vl */ false);
   int encode = vex_prefix_and_encode(dst->encoding(), nds->encoding(), src->encoding(), VEX_SIMD_66, VEX_OPCODE_0F_3A, &attributes);
   emit_int8(0x46);
   emit_int8(0xC0 | encode);
@@ -3434,7 +3431,7 @@
 
 void Assembler::vperm2f128(XMMRegister dst, XMMRegister nds, XMMRegister src, int imm8) {
   assert(VM_Version::supports_avx(), "");
-  InstructionAttr attributes(AVX_256bit, /* rex_w */ false, /* legacy_mode */ true, /* no_mask_reg */ false, /* uses_vl */ false);
+  InstructionAttr attributes(AVX_256bit, /* rex_w */ false, /* legacy_mode */ true, /* no_mask_reg */ true, /* uses_vl */ false);
   int encode = vex_prefix_and_encode(dst->encoding(), nds->encoding(), src->encoding(), VEX_SIMD_66, VEX_OPCODE_0F_3A, &attributes);
   emit_int8(0x06);
   emit_int8(0xC0 | encode);
@@ -3464,7 +3461,7 @@
 void Assembler::pcmpestri(XMMRegister dst, Address src, int imm8) {
   assert(VM_Version::supports_sse4_2(), "");
   InstructionMark im(this);
-  InstructionAttr attributes(AVX_128bit, /* rex_w */ false, /* legacy_mode */ true, /* no_mask_reg */ false, /* uses_vl */ false);
+  InstructionAttr attributes(AVX_128bit, /* rex_w */ false, /* legacy_mode */ true, /* no_mask_reg */ true, /* uses_vl */ false);
   simd_prefix(dst, xnoreg, src, VEX_SIMD_66, VEX_OPCODE_0F_3A, &attributes);
   emit_int8(0x61);
   emit_operand(dst, src);
@@ -3473,7 +3470,7 @@
 
 void Assembler::pcmpestri(XMMRegister dst, XMMRegister src, int imm8) {
   assert(VM_Version::supports_sse4_2(), "");
-  InstructionAttr attributes(AVX_128bit, /* rex_w */ false, /* legacy_mode */ true, /* no_mask_reg */ false, /* uses_vl */ false);
+  InstructionAttr attributes(AVX_128bit, /* rex_w */ false, /* legacy_mode */ true, /* no_mask_reg */ true, /* uses_vl */ false);
   int encode = simd_prefix_and_encode(dst, xnoreg, src, VEX_SIMD_66, VEX_OPCODE_0F_3A, &attributes);
   emit_int8(0x61);
   emit_int8((unsigned char)(0xC0 | encode));
@@ -3483,7 +3480,7 @@
 // In this context, the dst vector contains the components that are equal, non equal components are zeroed in dst
 void Assembler::pcmpeqb(XMMRegister dst, XMMRegister src) {
   assert(VM_Version::supports_sse2(), "");
-  InstructionAttr attributes(AVX_128bit, /* rex_w */ false, /* legacy_mode */ true, /* no_mask_reg */ false, /* uses_vl */ false);
+  InstructionAttr attributes(AVX_128bit, /* rex_w */ false, /* legacy_mode */ true, /* no_mask_reg */ true, /* uses_vl */ false);
   int encode = simd_prefix_and_encode(dst, dst, src, VEX_SIMD_66, VEX_OPCODE_0F, &attributes);
   emit_int8(0x74);
   emit_int8((unsigned char)(0xC0 | encode));
@@ -3492,7 +3489,7 @@
 // In this context, the dst vector contains the components that are equal, non equal components are zeroed in dst
 void Assembler::vpcmpeqb(XMMRegister dst, XMMRegister nds, XMMRegister src, int vector_len) {
   assert(VM_Version::supports_avx(), "");
-  InstructionAttr attributes(vector_len, /* rex_w */ false, /* legacy_mode */ true, /* no_mask_reg */ false, /* uses_vl */ false);
+  InstructionAttr attributes(vector_len, /* rex_w */ false, /* legacy_mode */ true, /* no_mask_reg */ true, /* uses_vl */ false);
   int encode = vex_prefix_and_encode(dst->encoding(), nds->encoding(), src->encoding(), VEX_SIMD_66, VEX_OPCODE_0F, &attributes);
   emit_int8(0x74);
   emit_int8((unsigned char)(0xC0 | encode));
@@ -3521,7 +3518,6 @@
 }
 
 void Assembler::evpcmpgtb(KRegister kdst, KRegister mask, XMMRegister nds, Address src, int vector_len) {
-  assert(is_vector_masking(), "");
   assert(VM_Version::supports_avx512vlbw(), "");
   InstructionMark im(this);
   InstructionAttr attributes(vector_len, /* rex_w */ false, /* legacy_mode */ false, /* no_mask_reg */ false, /* uses_vl */ true);
@@ -3546,7 +3542,6 @@
 }
 
 void Assembler::evpcmpuw(KRegister kdst, KRegister mask, XMMRegister nds, XMMRegister src, ComparisonPredicate vcc, int vector_len) {
-  assert(is_vector_masking(), "");
   assert(VM_Version::supports_avx512vlbw(), "");
   InstructionAttr attributes(vector_len, /* rex_w */ true, /* legacy_mode */ false, /* no_mask_reg */ false, /* uses_vl */ true);
   attributes.reset_is_clear_context();
@@ -3585,7 +3580,6 @@
 
 void Assembler::evpcmpeqb(KRegister kdst, KRegister mask, XMMRegister nds, Address src, int vector_len) {
   assert(VM_Version::supports_avx512vlbw(), "");
-  assert(is_vector_masking(), "");    // For stub code use only
   InstructionMark im(this);
   InstructionAttr attributes(vector_len, /* vex_w */ false, /* legacy_mode */ false, /* no_reg_mask */ false, /* uses_vl */ true);
   attributes.set_address_attributes(/* tuple_type */ EVEX_FVM, /* input_size_in_bits */ EVEX_NObit);
@@ -3600,7 +3594,7 @@
 // In this context, the dst vector contains the components that are equal, non equal components are zeroed in dst
 void Assembler::pcmpeqw(XMMRegister dst, XMMRegister src) {
   assert(VM_Version::supports_sse2(), "");
-  InstructionAttr attributes(AVX_128bit, /* rex_w */ false, /* legacy_mode */ true, /* no_mask_reg */ false, /* uses_vl */ false);
+  InstructionAttr attributes(AVX_128bit, /* rex_w */ false, /* legacy_mode */ true, /* no_mask_reg */ true, /* uses_vl */ false);
   int encode = simd_prefix_and_encode(dst, dst, src, VEX_SIMD_66, VEX_OPCODE_0F, &attributes);
   emit_int8(0x75);
   emit_int8((unsigned char)(0xC0 | encode));
@@ -3609,7 +3603,7 @@
 // In this context, the dst vector contains the components that are equal, non equal components are zeroed in dst
 void Assembler::vpcmpeqw(XMMRegister dst, XMMRegister nds, XMMRegister src, int vector_len) {
   assert(VM_Version::supports_avx(), "");
-  InstructionAttr attributes(vector_len, /* rex_w */ false, /* legacy_mode */ true, /* no_mask_reg */ false, /* uses_vl */ false);
+  InstructionAttr attributes(vector_len, /* rex_w */ false, /* legacy_mode */ true, /* no_mask_reg */ true, /* uses_vl */ false);
   int encode = vex_prefix_and_encode(dst->encoding(), nds->encoding(), src->encoding(), VEX_SIMD_66, VEX_OPCODE_0F, &attributes);
   emit_int8(0x75);
   emit_int8((unsigned char)(0xC0 | encode));
@@ -3640,7 +3634,7 @@
 // In this context, the dst vector contains the components that are equal, non equal components are zeroed in dst
 void Assembler::pcmpeqd(XMMRegister dst, XMMRegister src) {
   assert(VM_Version::supports_sse2(), "");
-  InstructionAttr attributes(AVX_128bit, /* rex_w */ false, /* legacy_mode */ true, /* no_mask_reg */ false, /* uses_vl */ false);
+  InstructionAttr attributes(AVX_128bit, /* rex_w */ false, /* legacy_mode */ true, /* no_mask_reg */ true, /* uses_vl */ false);
   int encode = simd_prefix_and_encode(dst, dst, src, VEX_SIMD_66, VEX_OPCODE_0F, &attributes);
   emit_int8(0x76);
   emit_int8((unsigned char)(0xC0 | encode));
@@ -3649,7 +3643,7 @@
 // In this context, the dst vector contains the components that are equal, non equal components are zeroed in dst
 void Assembler::vpcmpeqd(XMMRegister dst, XMMRegister nds, XMMRegister src, int vector_len) {
   assert(VM_Version::supports_avx(), "");
-  InstructionAttr attributes(vector_len, /* rex_w */ false, /* legacy_mode */ true, /* no_mask_reg */ false, /* uses_vl */ false);
+  InstructionAttr attributes(vector_len, /* rex_w */ false, /* legacy_mode */ true, /* no_mask_reg */ true, /* uses_vl */ false);
   int encode = vex_prefix_and_encode(dst->encoding(), nds->encoding(), src->encoding(), VEX_SIMD_66, VEX_OPCODE_0F, &attributes);
   emit_int8(0x76);
   emit_int8((unsigned char)(0xC0 | encode));
@@ -3658,7 +3652,7 @@
 // In this context, kdst is written the mask used to process the equal components
 void Assembler::evpcmpeqd(KRegister kdst, XMMRegister nds, XMMRegister src, int vector_len) {
   assert(VM_Version::supports_evex(), "");
-  InstructionAttr attributes(vector_len, /* rex_w */ false, /* legacy_mode */ false, /* no_mask_reg */ false, /* uses_vl */ true);
+  InstructionAttr attributes(vector_len, /* rex_w */ false, /* legacy_mode */ false, /* no_mask_reg */ true, /* uses_vl */ true);
   attributes.set_is_evex_instruction();
   attributes.reset_is_clear_context();
   int encode = vex_prefix_and_encode(kdst->encoding(), nds->encoding(), src->encoding(), VEX_SIMD_66, VEX_OPCODE_0F, &attributes);
@@ -3669,7 +3663,7 @@
 void Assembler::evpcmpeqd(KRegister kdst, XMMRegister nds, Address src, int vector_len) {
   assert(VM_Version::supports_evex(), "");
   InstructionMark im(this);
-  InstructionAttr attributes(vector_len, /* rex_w */ false, /* legacy_mode */ false, /* no_mask_reg */ false, /* uses_vl */ true);
+  InstructionAttr attributes(vector_len, /* rex_w */ false, /* legacy_mode */ false, /* no_mask_reg */ true, /* uses_vl */ true);
   attributes.set_address_attributes(/* tuple_type */ EVEX_FV, /* input_size_in_bits */ EVEX_32bit);
   attributes.reset_is_clear_context();
   attributes.set_is_evex_instruction();
@@ -3682,7 +3676,7 @@
 // In this context, the dst vector contains the components that are equal, non equal components are zeroed in dst
 void Assembler::pcmpeqq(XMMRegister dst, XMMRegister src) {
   assert(VM_Version::supports_sse4_1(), "");
-  InstructionAttr attributes(AVX_128bit, /* rex_w */ false, /* legacy_mode */ true, /* no_mask_reg */ false, /* uses_vl */ false);
+  InstructionAttr attributes(AVX_128bit, /* rex_w */ false, /* legacy_mode */ true, /* no_mask_reg */ true, /* uses_vl */ false);
   int encode = simd_prefix_and_encode(dst, dst, src, VEX_SIMD_66, VEX_OPCODE_0F_38, &attributes);
   emit_int8(0x29);
   emit_int8((unsigned char)(0xC0 | encode));
@@ -3691,7 +3685,7 @@
 // In this context, the dst vector contains the components that are equal, non equal components are zeroed in dst
 void Assembler::vpcmpeqq(XMMRegister dst, XMMRegister nds, XMMRegister src, int vector_len) {
   assert(VM_Version::supports_avx(), "");
-  InstructionAttr attributes(vector_len, /* rex_w */ false, /* legacy_mode */ true, /* no_mask_reg */ false, /* uses_vl */ false);
+  InstructionAttr attributes(vector_len, /* rex_w */ false, /* legacy_mode */ true, /* no_mask_reg */ true, /* uses_vl */ false);
   int encode = vex_prefix_and_encode(dst->encoding(), nds->encoding(), src->encoding(), VEX_SIMD_66, VEX_OPCODE_0F_38, &attributes);
   emit_int8(0x29);
   emit_int8((unsigned char)(0xC0 | encode));
@@ -3700,7 +3694,7 @@
 // In this context, kdst is written the mask used to process the equal components
 void Assembler::evpcmpeqq(KRegister kdst, XMMRegister nds, XMMRegister src, int vector_len) {
   assert(VM_Version::supports_evex(), "");
-  InstructionAttr attributes(vector_len, /* rex_w */ true, /* legacy_mode */ false, /* no_mask_reg */ false, /* uses_vl */ true);
+  InstructionAttr attributes(vector_len, /* rex_w */ true, /* legacy_mode */ false, /* no_mask_reg */ true, /* uses_vl */ true);
   attributes.reset_is_clear_context();
   attributes.set_is_evex_instruction();
   int encode = vex_prefix_and_encode(kdst->encoding(), nds->encoding(), src->encoding(), VEX_SIMD_66, VEX_OPCODE_0F_38, &attributes);
@@ -3712,7 +3706,7 @@
 void Assembler::evpcmpeqq(KRegister kdst, XMMRegister nds, Address src, int vector_len) {
   assert(VM_Version::supports_evex(), "");
   InstructionMark im(this);
-  InstructionAttr attributes(vector_len, /* rex_w */ true, /* legacy_mode */ false, /* no_mask_reg */ false, /* uses_vl */ true);
+  InstructionAttr attributes(vector_len, /* rex_w */ true, /* legacy_mode */ false, /* no_mask_reg */ true, /* uses_vl */ true);
   attributes.reset_is_clear_context();
   attributes.set_is_evex_instruction();
   attributes.set_address_attributes(/* tuple_type */ EVEX_FV, /* input_size_in_bits */ EVEX_64bit);
@@ -3724,7 +3718,7 @@
 
 void Assembler::pmovmskb(Register dst, XMMRegister src) {
   assert(VM_Version::supports_sse2(), "");
-  InstructionAttr attributes(AVX_128bit, /* rex_w */ false, /* legacy_mode */ true, /* no_mask_reg */ false, /* uses_vl */ false);
+  InstructionAttr attributes(AVX_128bit, /* rex_w */ false, /* legacy_mode */ true, /* no_mask_reg */ true, /* uses_vl */ false);
   int encode = simd_prefix_and_encode(as_XMMRegister(dst->encoding()), xnoreg, src, VEX_SIMD_66, VEX_OPCODE_0F, &attributes);
   emit_int8((unsigned char)0xD7);
   emit_int8((unsigned char)(0xC0 | encode));
@@ -3732,7 +3726,7 @@
 
 void Assembler::vpmovmskb(Register dst, XMMRegister src) {
   assert(VM_Version::supports_avx2(), "");
-  InstructionAttr attributes(AVX_256bit, /* rex_w */ false, /* legacy_mode */ true, /* no_mask_reg */ false, /* uses_vl */ false);
+  InstructionAttr attributes(AVX_256bit, /* rex_w */ false, /* legacy_mode */ true, /* no_mask_reg */ true, /* uses_vl */ false);
   int encode = vex_prefix_and_encode(dst->encoding(), 0, src->encoding(), VEX_SIMD_66, VEX_OPCODE_0F, &attributes);
   emit_int8((unsigned char)0xD7);
   emit_int8((unsigned char)(0xC0 | encode));
@@ -3913,7 +3907,6 @@
 
 
 void Assembler::evpmovzxbw(XMMRegister dst, KRegister mask, Address src, int vector_len) {
-  assert(is_vector_masking(), "");
   assert(VM_Version::supports_avx512vlbw(), "");
   assert(dst != xnoreg, "sanity");
   InstructionMark im(this);
@@ -3938,7 +3931,6 @@
 }
 
 void Assembler::evpmovwb(Address dst, KRegister mask, XMMRegister src, int vector_len) {
-  assert(is_vector_masking(), "");
   assert(VM_Version::supports_avx512vlbw(), "");
   assert(src != xnoreg, "sanity");
   InstructionMark im(this);
@@ -4001,7 +3993,7 @@
 
 void Assembler::vpopcntd(XMMRegister dst, XMMRegister src, int vector_len) {
   assert(VM_Version::supports_vpopcntdq(), "must support vpopcntdq feature");
-  InstructionAttr attributes(vector_len, /* vex_w */ false, /* legacy_mode */ false, /* no_mask_reg */ false, /* uses_vl */ true);
+  InstructionAttr attributes(vector_len, /* vex_w */ false, /* legacy_mode */ false, /* no_mask_reg */ true, /* uses_vl */ true);
   attributes.set_is_evex_instruction();
   int encode = vex_prefix_and_encode(dst->encoding(), 0, src->encoding(), VEX_SIMD_66, VEX_OPCODE_0F_38, &attributes);
   emit_int8(0x55);
@@ -4111,7 +4103,7 @@
   assert(isByte(mode), "invalid value");
   NOT_LP64(assert(VM_Version::supports_sse2(), ""));
   int vector_len = VM_Version::supports_avx512novl() ? AVX_512bit : AVX_128bit;
-  InstructionAttr attributes(vector_len, /* rex_w */ false, /* legacy_mode */ false, /* no_mask_reg */ false, /* uses_vl */ true);
+  InstructionAttr attributes(vector_len, /* rex_w */ false, /* legacy_mode */ false, /* no_mask_reg */ true, /* uses_vl */ true);
   int encode = simd_prefix_and_encode(dst, xnoreg, src, VEX_SIMD_66, VEX_OPCODE_0F, &attributes);
   emit_int8(0x70);
   emit_int8((unsigned char)(0xC0 | encode));
@@ -4123,7 +4115,7 @@
          vector_len == AVX_256bit? VM_Version::supports_avx2() :
          0, "");
   NOT_LP64(assert(VM_Version::supports_sse2(), ""));
-  InstructionAttr attributes(vector_len, /* rex_w */ false, /* legacy_mode */ false, /* no_mask_reg */ false, /* uses_vl */ true);
+  InstructionAttr attributes(vector_len, /* rex_w */ false, /* legacy_mode */ false, /* no_mask_reg */ true, /* uses_vl */ true);
   int encode = simd_prefix_and_encode(dst, xnoreg, src, VEX_SIMD_66, VEX_OPCODE_0F, &attributes);
   emit_int8(0x70);
   emit_int8((unsigned char)(0xC0 | encode));
@@ -4135,7 +4127,7 @@
   NOT_LP64(assert(VM_Version::supports_sse2(), ""));
   assert((UseAVX > 0), "SSE mode requires address alignment 16 bytes");
   InstructionMark im(this);
-  InstructionAttr attributes(AVX_128bit, /* rex_w */ false, /* legacy_mode */ false, /* no_mask_reg */ false, /* uses_vl */ true);
+  InstructionAttr attributes(AVX_128bit, /* rex_w */ false, /* legacy_mode */ false, /* no_mask_reg */ true, /* uses_vl */ true);
   attributes.set_address_attributes(/* tuple_type */ EVEX_FV, /* input_size_in_bits */ EVEX_32bit);
   simd_prefix(dst, xnoreg, src, VEX_SIMD_66, VEX_OPCODE_0F, &attributes);
   emit_int8(0x70);
@@ -4201,7 +4193,7 @@
   assert(VM_Version::supports_sse4_1(), "");
   assert((UseAVX > 0), "SSE mode requires address alignment 16 bytes");
   InstructionMark im(this);
-  InstructionAttr attributes(AVX_128bit, /* rex_w */ false, /* legacy_mode */ true, /* no_mask_reg */ false, /* uses_vl */ false);
+  InstructionAttr attributes(AVX_128bit, /* rex_w */ false, /* legacy_mode */ true, /* no_mask_reg */ true, /* uses_vl */ false);
   simd_prefix(dst, xnoreg, src, VEX_SIMD_66, VEX_OPCODE_0F_38, &attributes);
   emit_int8(0x17);
   emit_operand(dst, src);
@@ -4209,7 +4201,7 @@
 
 void Assembler::ptest(XMMRegister dst, XMMRegister src) {
   assert(VM_Version::supports_sse4_1(), "");
-  InstructionAttr attributes(AVX_128bit, /* rex_w */ false, /* legacy_mode */ true, /* no_mask_reg */ false, /* uses_vl */ false);
+  InstructionAttr attributes(AVX_128bit, /* rex_w */ false, /* legacy_mode */ true, /* no_mask_reg */ true, /* uses_vl */ false);
   int encode = simd_prefix_and_encode(dst, xnoreg, src, VEX_SIMD_66, VEX_OPCODE_0F_38, &attributes);
   emit_int8(0x17);
   emit_int8((unsigned char)(0xC0 | encode));
@@ -4218,7 +4210,7 @@
 void Assembler::vptest(XMMRegister dst, Address src) {
   assert(VM_Version::supports_avx(), "");
   InstructionMark im(this);
-  InstructionAttr attributes(AVX_256bit, /* rex_w */ false, /* legacy_mode */ true, /* no_mask_reg */ false, /* uses_vl */ false);
+  InstructionAttr attributes(AVX_256bit, /* rex_w */ false, /* legacy_mode */ true, /* no_mask_reg */ true, /* uses_vl */ false);
   assert(dst != xnoreg, "sanity");
   // swap src<->dst for encoding
   vex_prefix(src, 0, dst->encoding(), VEX_SIMD_66, VEX_OPCODE_0F_38, &attributes);
@@ -4228,7 +4220,7 @@
 
 void Assembler::vptest(XMMRegister dst, XMMRegister src) {
   assert(VM_Version::supports_avx(), "");
-  InstructionAttr attributes(AVX_256bit, /* rex_w */ false, /* legacy_mode */ true, /* no_mask_reg */ false, /* uses_vl */ false);
+  InstructionAttr attributes(AVX_256bit, /* rex_w */ false, /* legacy_mode */ true, /* no_mask_reg */ true, /* uses_vl */ false);
   int encode = vex_prefix_and_encode(dst->encoding(), 0, src->encoding(), VEX_SIMD_66, VEX_OPCODE_0F_38, &attributes);
   emit_int8(0x17);
   emit_int8((unsigned char)(0xC0 | encode));
@@ -4238,7 +4230,7 @@
   NOT_LP64(assert(VM_Version::supports_sse2(), ""));
   assert((UseAVX > 0), "SSE mode requires address alignment 16 bytes");
   InstructionMark im(this);
-  InstructionAttr attributes(AVX_128bit, /* rex_w */ false, /* legacy_mode */ _legacy_mode_vlbw, /* no_mask_reg */ false, /* uses_vl */ true);
+  InstructionAttr attributes(AVX_128bit, /* rex_w */ false, /* legacy_mode */ _legacy_mode_vlbw, /* no_mask_reg */ true, /* uses_vl */ true);
   attributes.set_address_attributes(/* tuple_type */ EVEX_FVM, /* input_size_in_bits */ EVEX_NObit);
   simd_prefix(dst, dst, src, VEX_SIMD_66, VEX_OPCODE_0F, &attributes);
   emit_int8(0x60);
@@ -4247,7 +4239,7 @@
 
 void Assembler::punpcklbw(XMMRegister dst, XMMRegister src) {
   NOT_LP64(assert(VM_Version::supports_sse2(), ""));
-  InstructionAttr attributes(AVX_128bit, /* rex_w */ false, /* legacy_mode */ _legacy_mode_vlbw, /* no_mask_reg */ false, /* uses_vl */ true);
+  InstructionAttr attributes(AVX_128bit, /* rex_w */ false, /* legacy_mode */ _legacy_mode_vlbw, /* no_mask_reg */ true, /* uses_vl */ true);
   int encode = simd_prefix_and_encode(dst, dst, src, VEX_SIMD_66, VEX_OPCODE_0F, &attributes);
   emit_int8(0x60);
   emit_int8((unsigned char)(0xC0 | encode));
@@ -4257,7 +4249,7 @@
   NOT_LP64(assert(VM_Version::supports_sse2(), ""));
   assert((UseAVX > 0), "SSE mode requires address alignment 16 bytes");
   InstructionMark im(this);
-  InstructionAttr attributes(AVX_128bit, /* rex_w */ false, /* legacy_mode */ false, /* no_mask_reg */ false, /* uses_vl */ true);
+  InstructionAttr attributes(AVX_128bit, /* rex_w */ false, /* legacy_mode */ false, /* no_mask_reg */ true, /* uses_vl */ true);
   attributes.set_address_attributes(/* tuple_type */ EVEX_FV, /* input_size_in_bits */ EVEX_32bit);
   simd_prefix(dst, dst, src, VEX_SIMD_66, VEX_OPCODE_0F, &attributes);
   emit_int8(0x62);
@@ -4266,7 +4258,7 @@
 
 void Assembler::punpckldq(XMMRegister dst, XMMRegister src) {
   NOT_LP64(assert(VM_Version::supports_sse2(), ""));
-  InstructionAttr attributes(AVX_128bit, /* rex_w */ false, /* legacy_mode */ false, /* no_mask_reg */ false, /* uses_vl */ true);
+  InstructionAttr attributes(AVX_128bit, /* rex_w */ false, /* legacy_mode */ false, /* no_mask_reg */ true, /* uses_vl */ true);
   int encode = simd_prefix_and_encode(dst, dst, src, VEX_SIMD_66, VEX_OPCODE_0F, &attributes);
   emit_int8(0x62);
   emit_int8((unsigned char)(0xC0 | encode));
@@ -4274,7 +4266,7 @@
 
 void Assembler::punpcklqdq(XMMRegister dst, XMMRegister src) {
   NOT_LP64(assert(VM_Version::supports_sse2(), ""));
-  InstructionAttr attributes(AVX_128bit, /* rex_w */ VM_Version::supports_evex(), /* legacy_mode */ false, /* no_mask_reg */ false, /* uses_vl */ true);
+  InstructionAttr attributes(AVX_128bit, /* rex_w */ VM_Version::supports_evex(), /* legacy_mode */ false, /* no_mask_reg */ true, /* uses_vl */ true);
   attributes.set_rex_vex_w_reverted();
   int encode = simd_prefix_and_encode(dst, dst, src, VEX_SIMD_66, VEX_OPCODE_0F, &attributes);
   emit_int8(0x6C);
@@ -4323,7 +4315,7 @@
 
 void Assembler::rcpps(XMMRegister dst, XMMRegister src) {
   NOT_LP64(assert(VM_Version::supports_sse(), ""));
-  InstructionAttr attributes(AVX_128bit, /* rex_w */ false, /* legacy_mode */ true, /* no_mask_reg */ false, /* uses_vl */ false);
+  InstructionAttr attributes(AVX_128bit, /* rex_w */ false, /* legacy_mode */ true, /* no_mask_reg */ true, /* uses_vl */ false);
   int encode = simd_prefix_and_encode(dst, xnoreg, src, VEX_SIMD_NONE, VEX_OPCODE_0F, &attributes);
   emit_int8(0x53);
   emit_int8((unsigned char)(0xC0 | encode));
@@ -4331,7 +4323,7 @@
 
 void Assembler::rcpss(XMMRegister dst, XMMRegister src) {
   NOT_LP64(assert(VM_Version::supports_sse(), ""));
-  InstructionAttr attributes(AVX_128bit, /* rex_w */ false, /* legacy_mode */ true, /* no_mask_reg */ false, /* uses_vl */ false);
+  InstructionAttr attributes(AVX_128bit, /* rex_w */ false, /* legacy_mode */ true, /* no_mask_reg */ true, /* uses_vl */ false);
   int encode = simd_prefix_and_encode(dst, dst, src, VEX_SIMD_F3, VEX_OPCODE_0F, &attributes);
   emit_int8(0x53);
   emit_int8((unsigned char)(0xC0 | encode));
@@ -4455,7 +4447,7 @@
 
 void Assembler::palignr(XMMRegister dst, XMMRegister src, int imm8) {
   assert(VM_Version::supports_ssse3(), "");
-  InstructionAttr attributes(AVX_128bit, /* rex_w */ false, /* legacy_mode */ _legacy_mode_bw, /* no_mask_reg */ false, /* uses_vl */ true);
+  InstructionAttr attributes(AVX_128bit, /* rex_w */ false, /* legacy_mode */ _legacy_mode_bw, /* no_mask_reg */ true, /* uses_vl */ true);
   int encode = simd_prefix_and_encode(dst, dst, src, VEX_SIMD_66, VEX_OPCODE_0F_3A, &attributes);
   emit_int8((unsigned char)0x0F);
   emit_int8((unsigned char)(0xC0 | encode));
@@ -4466,7 +4458,7 @@
   assert(vector_len == AVX_128bit? VM_Version::supports_avx() :
          vector_len == AVX_256bit? VM_Version::supports_avx2() :
          0, "");
-  InstructionAttr attributes(vector_len, /* rex_w */ false, /* legacy_mode */ _legacy_mode_bw, /* no_mask_reg */ false, /* uses_vl */ true);
+  InstructionAttr attributes(vector_len, /* rex_w */ false, /* legacy_mode */ _legacy_mode_bw, /* no_mask_reg */ true, /* uses_vl */ true);
   int encode = simd_prefix_and_encode(dst, nds, src, VEX_SIMD_66, VEX_OPCODE_0F_3A, &attributes);
   emit_int8((unsigned char)0x0F);
   emit_int8((unsigned char)(0xC0 | encode));
@@ -4475,7 +4467,7 @@
 
 void Assembler::evalignq(XMMRegister dst, XMMRegister nds, XMMRegister src, uint8_t imm8) {
   assert(VM_Version::supports_evex(), "");
-  InstructionAttr attributes(AVX_512bit, /* vex_w */ true, /* legacy_mode */ false, /* no_mask_reg */ false, /* uses_vl */ true);
+  InstructionAttr attributes(AVX_512bit, /* vex_w */ true, /* legacy_mode */ false, /* no_mask_reg */ true, /* uses_vl */ true);
   attributes.set_is_evex_instruction();
   int encode = vex_prefix_and_encode(dst->encoding(), nds->encoding(), src->encoding(), VEX_SIMD_66, VEX_OPCODE_0F_3A, &attributes);
   emit_int8(0x3);
@@ -4628,7 +4620,7 @@
   if (UseAVX > 0 ) {
     assert(VM_Version::supports_avx(), "");
     InstructionMark im(this);
-    InstructionAttr attributes(AVX_128bit, /* vex_w */ false, /* legacy_mode */ true, /* no_mask_reg */ false, /* uses_vl */ false);
+    InstructionAttr attributes(AVX_128bit, /* vex_w */ false, /* legacy_mode */ true, /* no_mask_reg */ true, /* uses_vl */ false);
     vex_prefix(dst, 0, 0, VEX_SIMD_NONE, VEX_OPCODE_0F, &attributes);
     emit_int8((unsigned char)0xAE);
     emit_operand(as_Register(3), dst);
@@ -5102,7 +5094,7 @@
 
 void Assembler::addpd(XMMRegister dst, XMMRegister src) {
   NOT_LP64(assert(VM_Version::supports_sse2(), ""));
-  InstructionAttr attributes(AVX_128bit, /* rex_w */ VM_Version::supports_evex(), /* legacy_mode */ false, /* no_mask_reg */ false, /* uses_vl */ true);
+  InstructionAttr attributes(AVX_128bit, /* rex_w */ VM_Version::supports_evex(), /* legacy_mode */ false, /* no_mask_reg */ true, /* uses_vl */ true);
   attributes.set_rex_vex_w_reverted();
   int encode = simd_prefix_and_encode(dst, dst, src, VEX_SIMD_66, VEX_OPCODE_0F, &attributes);
   emit_int8(0x58);
@@ -5112,7 +5104,7 @@
 void Assembler::addpd(XMMRegister dst, Address src) {
   NOT_LP64(assert(VM_Version::supports_sse2(), ""));
   InstructionMark im(this);
-  InstructionAttr attributes(AVX_128bit, /* rex_w */ VM_Version::supports_evex(), /* legacy_mode */ false, /* no_mask_reg */ false, /* uses_vl */ true);
+  InstructionAttr attributes(AVX_128bit, /* rex_w */ VM_Version::supports_evex(), /* legacy_mode */ false, /* no_mask_reg */ true, /* uses_vl */ true);
   attributes.set_rex_vex_w_reverted();
   attributes.set_address_attributes(/* tuple_type */ EVEX_FV, /* input_size_in_bits */ EVEX_64bit);
   simd_prefix(dst, dst, src, VEX_SIMD_66, VEX_OPCODE_0F, &attributes);
@@ -5123,7 +5115,7 @@
 
 void Assembler::addps(XMMRegister dst, XMMRegister src) {
   NOT_LP64(assert(VM_Version::supports_sse2(), ""));
-  InstructionAttr attributes(AVX_128bit, /* rex_w */ false, /* legacy_mode */ false, /* no_mask_reg */ false, /* uses_vl */ true);
+  InstructionAttr attributes(AVX_128bit, /* rex_w */ false, /* legacy_mode */ false, /* no_mask_reg */ true, /* uses_vl */ true);
   int encode = simd_prefix_and_encode(dst, dst, src, VEX_SIMD_NONE, VEX_OPCODE_0F, &attributes);
   emit_int8(0x58);
   emit_int8((unsigned char)(0xC0 | encode));
@@ -5131,7 +5123,7 @@
 
 void Assembler::vaddpd(XMMRegister dst, XMMRegister nds, XMMRegister src, int vector_len) {
   assert(VM_Version::supports_avx(), "");
-  InstructionAttr attributes(vector_len, /* vex_w */ VM_Version::supports_evex(), /* legacy_mode */ false, /* no_mask_reg */ false, /* uses_vl */ true);
+  InstructionAttr attributes(vector_len, /* vex_w */ VM_Version::supports_evex(), /* legacy_mode */ false, /* no_mask_reg */ true, /* uses_vl */ true);
   attributes.set_rex_vex_w_reverted();
   int encode = vex_prefix_and_encode(dst->encoding(), nds->encoding(), src->encoding(), VEX_SIMD_66, VEX_OPCODE_0F, &attributes);
   emit_int8(0x58);
@@ -5140,7 +5132,7 @@
 
 void Assembler::vaddps(XMMRegister dst, XMMRegister nds, XMMRegister src, int vector_len) {
   assert(VM_Version::supports_avx(), "");
-  InstructionAttr attributes(vector_len, /* vex_w */ false, /* legacy_mode */ false, /* no_mask_reg */ false, /* uses_vl */ true);
+  InstructionAttr attributes(vector_len, /* vex_w */ false, /* legacy_mode */ false, /* no_mask_reg */ true, /* uses_vl */ true);
   int encode = vex_prefix_and_encode(dst->encoding(), nds->encoding(), src->encoding(), VEX_SIMD_NONE, VEX_OPCODE_0F, &attributes);
   emit_int8(0x58);
   emit_int8((unsigned char)(0xC0 | encode));
@@ -5149,7 +5141,7 @@
 void Assembler::vaddpd(XMMRegister dst, XMMRegister nds, Address src, int vector_len) {
   assert(VM_Version::supports_avx(), "");
   InstructionMark im(this);
-  InstructionAttr attributes(vector_len, /* vex_w */ VM_Version::supports_evex(), /* legacy_mode */ false, /* no_mask_reg */ false, /* uses_vl */ true);
+  InstructionAttr attributes(vector_len, /* vex_w */ VM_Version::supports_evex(), /* legacy_mode */ false, /* no_mask_reg */ true, /* uses_vl */ true);
   attributes.set_address_attributes(/* tuple_type */ EVEX_FV, /* input_size_in_bits */ EVEX_64bit);
   attributes.set_rex_vex_w_reverted();
   vex_prefix(src, nds->encoding(), dst->encoding(), VEX_SIMD_66, VEX_OPCODE_0F, &attributes);
@@ -5160,7 +5152,7 @@
 void Assembler::vaddps(XMMRegister dst, XMMRegister nds, Address src, int vector_len) {
   assert(VM_Version::supports_avx(), "");
   InstructionMark im(this);
-  InstructionAttr attributes(vector_len, /* vex_w */ false, /* legacy_mode */ false, /* no_mask_reg */ false, /* uses_vl */ true);
+  InstructionAttr attributes(vector_len, /* vex_w */ false, /* legacy_mode */ false, /* no_mask_reg */ true, /* uses_vl */ true);
   attributes.set_address_attributes(/* tuple_type */ EVEX_FV, /* input_size_in_bits */ EVEX_32bit);
   vex_prefix(src, nds->encoding(), dst->encoding(), VEX_SIMD_NONE, VEX_OPCODE_0F, &attributes);
   emit_int8(0x58);
@@ -5169,7 +5161,7 @@
 
 void Assembler::subpd(XMMRegister dst, XMMRegister src) {
   NOT_LP64(assert(VM_Version::supports_sse2(), ""));
-  InstructionAttr attributes(AVX_128bit, /* rex_w */ VM_Version::supports_evex(), /* legacy_mode */ false, /* no_mask_reg */ false, /* uses_vl */ true);
+  InstructionAttr attributes(AVX_128bit, /* rex_w */ VM_Version::supports_evex(), /* legacy_mode */ false, /* no_mask_reg */ true, /* uses_vl */ true);
   attributes.set_rex_vex_w_reverted();
   int encode = simd_prefix_and_encode(dst, dst, src, VEX_SIMD_66, VEX_OPCODE_0F, &attributes);
   emit_int8(0x5C);
@@ -5178,7 +5170,7 @@
 
 void Assembler::subps(XMMRegister dst, XMMRegister src) {
   NOT_LP64(assert(VM_Version::supports_sse2(), ""));
-  InstructionAttr attributes(AVX_128bit, /* rex_w */ false, /* legacy_mode */ false, /* no_mask_reg */ false, /* uses_vl */ true);
+  InstructionAttr attributes(AVX_128bit, /* rex_w */ false, /* legacy_mode */ false, /* no_mask_reg */ true, /* uses_vl */ true);
   int encode = simd_prefix_and_encode(dst, dst, src, VEX_SIMD_NONE, VEX_OPCODE_0F, &attributes);
   emit_int8(0x5C);
   emit_int8((unsigned char)(0xC0 | encode));
@@ -5186,7 +5178,7 @@
 
 void Assembler::vsubpd(XMMRegister dst, XMMRegister nds, XMMRegister src, int vector_len) {
   assert(VM_Version::supports_avx(), "");
-  InstructionAttr attributes(vector_len, /* vex_w */ VM_Version::supports_evex(), /* legacy_mode */ false, /* no_mask_reg */ false, /* uses_vl */ true);
+  InstructionAttr attributes(vector_len, /* vex_w */ VM_Version::supports_evex(), /* legacy_mode */ false, /* no_mask_reg */ true, /* uses_vl */ true);
   attributes.set_rex_vex_w_reverted();
   int encode = vex_prefix_and_encode(dst->encoding(), nds->encoding(), src->encoding(), VEX_SIMD_66, VEX_OPCODE_0F, &attributes);
   emit_int8(0x5C);
@@ -5195,7 +5187,7 @@
 
 void Assembler::vsubps(XMMRegister dst, XMMRegister nds, XMMRegister src, int vector_len) {
   assert(VM_Version::supports_avx(), "");
-  InstructionAttr attributes(vector_len, /* vex_w */ false, /* legacy_mode */ false, /* no_mask_reg */ false, /* uses_vl */ true);
+  InstructionAttr attributes(vector_len, /* vex_w */ false, /* legacy_mode */ false, /* no_mask_reg */ true, /* uses_vl */ true);
   int encode = vex_prefix_and_encode(dst->encoding(), nds->encoding(), src->encoding(), VEX_SIMD_NONE, VEX_OPCODE_0F, &attributes);
   emit_int8(0x5C);
   emit_int8((unsigned char)(0xC0 | encode));
@@ -5204,7 +5196,7 @@
 void Assembler::vsubpd(XMMRegister dst, XMMRegister nds, Address src, int vector_len) {
   assert(VM_Version::supports_avx(), "");
   InstructionMark im(this);
-  InstructionAttr attributes(vector_len, /* vex_w */ VM_Version::supports_evex(), /* legacy_mode */ false, /* no_mask_reg */ false, /* uses_vl */ true);
+  InstructionAttr attributes(vector_len, /* vex_w */ VM_Version::supports_evex(), /* legacy_mode */ false, /* no_mask_reg */ true, /* uses_vl */ true);
   attributes.set_address_attributes(/* tuple_type */ EVEX_FV, /* input_size_in_bits */ EVEX_64bit);
   attributes.set_rex_vex_w_reverted();
   vex_prefix(src, nds->encoding(), dst->encoding(), VEX_SIMD_66, VEX_OPCODE_0F, &attributes);
@@ -5215,7 +5207,7 @@
 void Assembler::vsubps(XMMRegister dst, XMMRegister nds, Address src, int vector_len) {
   assert(VM_Version::supports_avx(), "");
   InstructionMark im(this);
-  InstructionAttr attributes(vector_len, /* vex_w */ false, /* legacy_mode */ false, /* no_mask_reg */ false, /* uses_vl */ true);
+  InstructionAttr attributes(vector_len, /* vex_w */ false, /* legacy_mode */ false, /* no_mask_reg */ true, /* uses_vl */ true);
   attributes.set_address_attributes(/* tuple_type */ EVEX_FV, /* input_size_in_bits */ EVEX_32bit);
   vex_prefix(src, nds->encoding(), dst->encoding(), VEX_SIMD_NONE, VEX_OPCODE_0F, &attributes);
   emit_int8(0x5C);
@@ -5224,7 +5216,7 @@
 
 void Assembler::mulpd(XMMRegister dst, XMMRegister src) {
   NOT_LP64(assert(VM_Version::supports_sse2(), ""));
-  InstructionAttr attributes(AVX_128bit, /* rex_w */ VM_Version::supports_evex(), /* legacy_mode */ false, /* no_mask_reg */ false, /* uses_vl */ true);
+  InstructionAttr attributes(AVX_128bit, /* rex_w */ VM_Version::supports_evex(), /* legacy_mode */ false, /* no_mask_reg */ true, /* uses_vl */ true);
   attributes.set_rex_vex_w_reverted();
   int encode = simd_prefix_and_encode(dst, dst, src, VEX_SIMD_66, VEX_OPCODE_0F, &attributes);
   emit_int8(0x59);
@@ -5234,7 +5226,7 @@
 void Assembler::mulpd(XMMRegister dst, Address src) {
   NOT_LP64(assert(VM_Version::supports_sse2(), ""));
   InstructionMark im(this);
-  InstructionAttr attributes(AVX_128bit, /* vex_w */ VM_Version::supports_evex(), /* legacy_mode */ false, /* no_mask_reg */ false, /* uses_vl */ true);
+  InstructionAttr attributes(AVX_128bit, /* vex_w */ VM_Version::supports_evex(), /* legacy_mode */ false, /* no_mask_reg */ true, /* uses_vl */ true);
   attributes.set_address_attributes(/* tuple_type */ EVEX_FV, /* input_size_in_bits */ EVEX_64bit);
   attributes.set_rex_vex_w_reverted();
   simd_prefix(dst, dst, src, VEX_SIMD_66, VEX_OPCODE_0F, &attributes);
@@ -5244,7 +5236,7 @@
 
 void Assembler::mulps(XMMRegister dst, XMMRegister src) {
   NOT_LP64(assert(VM_Version::supports_sse2(), ""));
-  InstructionAttr attributes(AVX_128bit, /* rex_w */ false, /* legacy_mode */ false, /* no_mask_reg */ false, /* uses_vl */ true);
+  InstructionAttr attributes(AVX_128bit, /* rex_w */ false, /* legacy_mode */ false, /* no_mask_reg */ true, /* uses_vl */ true);
   int encode = simd_prefix_and_encode(dst, dst, src, VEX_SIMD_NONE, VEX_OPCODE_0F, &attributes);
   emit_int8(0x59);
   emit_int8((unsigned char)(0xC0 | encode));
@@ -5252,7 +5244,7 @@
 
 void Assembler::vmulpd(XMMRegister dst, XMMRegister nds, XMMRegister src, int vector_len) {
   assert(VM_Version::supports_avx(), "");
-  InstructionAttr attributes(vector_len, /* vex_w */ VM_Version::supports_evex(), /* legacy_mode */ false, /* no_mask_reg */ false, /* uses_vl */ true);
+  InstructionAttr attributes(vector_len, /* vex_w */ VM_Version::supports_evex(), /* legacy_mode */ false, /* no_mask_reg */ true, /* uses_vl */ true);
   attributes.set_rex_vex_w_reverted();
   int encode = vex_prefix_and_encode(dst->encoding(), nds->encoding(), src->encoding(), VEX_SIMD_66, VEX_OPCODE_0F, &attributes);
   emit_int8(0x59);
@@ -5261,7 +5253,7 @@
 
 void Assembler::vmulps(XMMRegister dst, XMMRegister nds, XMMRegister src, int vector_len) {
   assert(VM_Version::supports_avx(), "");
-  InstructionAttr attributes(vector_len, /* vex_w */ false, /* legacy_mode */ false, /* no_mask_reg */ false, /* uses_vl */ true);
+  InstructionAttr attributes(vector_len, /* vex_w */ false, /* legacy_mode */ false, /* no_mask_reg */ true, /* uses_vl */ true);
   int encode = vex_prefix_and_encode(dst->encoding(), nds->encoding(), src->encoding(), VEX_SIMD_NONE, VEX_OPCODE_0F, &attributes);
   emit_int8(0x59);
   emit_int8((unsigned char)(0xC0 | encode));
@@ -5270,7 +5262,7 @@
 void Assembler::vmulpd(XMMRegister dst, XMMRegister nds, Address src, int vector_len) {
   assert(VM_Version::supports_avx(), "");
   InstructionMark im(this);
-  InstructionAttr attributes(vector_len, /* vex_w */ VM_Version::supports_evex(), /* legacy_mode */ false, /* no_mask_reg */ false, /* uses_vl */ true);
+  InstructionAttr attributes(vector_len, /* vex_w */ VM_Version::supports_evex(), /* legacy_mode */ false, /* no_mask_reg */ true, /* uses_vl */ true);
   attributes.set_address_attributes(/* tuple_type */ EVEX_FV, /* input_size_in_bits */ EVEX_64bit);
   attributes.set_rex_vex_w_reverted();
   vex_prefix(src, nds->encoding(), dst->encoding(), VEX_SIMD_66, VEX_OPCODE_0F, &attributes);
@@ -5281,7 +5273,7 @@
 void Assembler::vmulps(XMMRegister dst, XMMRegister nds, Address src, int vector_len) {
   assert(VM_Version::supports_avx(), "");
   InstructionMark im(this);
-  InstructionAttr attributes(vector_len, /* vex_w */ false, /* legacy_mode */ false, /* no_mask_reg */ false, /* uses_vl */ true);
+  InstructionAttr attributes(vector_len, /* vex_w */ false, /* legacy_mode */ false, /* no_mask_reg */ true, /* uses_vl */ true);
   attributes.set_address_attributes(/* tuple_type */ EVEX_FV, /* input_size_in_bits */ EVEX_32bit);
   vex_prefix(src, nds->encoding(), dst->encoding(), VEX_SIMD_NONE, VEX_OPCODE_0F, &attributes);
   emit_int8(0x59);
@@ -5290,7 +5282,7 @@
 
 void Assembler::vfmadd231pd(XMMRegister dst, XMMRegister src1, XMMRegister src2, int vector_len) {
   assert(VM_Version::supports_fma(), "");
-  InstructionAttr attributes(vector_len, /* vex_w */ true, /* legacy_mode */ false, /* no_mask_reg */ false, /* uses_vl */ true);
+  InstructionAttr attributes(vector_len, /* vex_w */ true, /* legacy_mode */ false, /* no_mask_reg */ true, /* uses_vl */ true);
   int encode = vex_prefix_and_encode(dst->encoding(), src1->encoding(), src2->encoding(), VEX_SIMD_66, VEX_OPCODE_0F_38, &attributes);
   emit_int8((unsigned char)0xB8);
   emit_int8((unsigned char)(0xC0 | encode));
@@ -5298,7 +5290,7 @@
 
 void Assembler::vfmadd231ps(XMMRegister dst, XMMRegister src1, XMMRegister src2, int vector_len) {
   assert(VM_Version::supports_fma(), "");
-  InstructionAttr attributes(vector_len, /* vex_w */ false, /* legacy_mode */ false, /* no_mask_reg */ false, /* uses_vl */ true);
+  InstructionAttr attributes(vector_len, /* vex_w */ false, /* legacy_mode */ false, /* no_mask_reg */ true, /* uses_vl */ true);
   int encode = vex_prefix_and_encode(dst->encoding(), src1->encoding(), src2->encoding(), VEX_SIMD_66, VEX_OPCODE_0F_38, &attributes);
   emit_int8((unsigned char)0xB8);
   emit_int8((unsigned char)(0xC0 | encode));
@@ -5307,7 +5299,7 @@
 void Assembler::vfmadd231pd(XMMRegister dst, XMMRegister src1, Address src2, int vector_len) {
   assert(VM_Version::supports_fma(), "");
   InstructionMark im(this);
-  InstructionAttr attributes(vector_len, /* vex_w */ true, /* legacy_mode */ false, /* no_mask_reg */ false, /* uses_vl */ true);
+  InstructionAttr attributes(vector_len, /* vex_w */ true, /* legacy_mode */ false, /* no_mask_reg */ true, /* uses_vl */ true);
   attributes.set_address_attributes(/* tuple_type */ EVEX_FV, /* input_size_in_bits */ EVEX_64bit);
   vex_prefix(src2, src1->encoding(), dst->encoding(), VEX_SIMD_66, VEX_OPCODE_0F_38, &attributes);
   emit_int8((unsigned char)0xB8);
@@ -5317,7 +5309,7 @@
 void Assembler::vfmadd231ps(XMMRegister dst, XMMRegister src1, Address src2, int vector_len) {
   assert(VM_Version::supports_fma(), "");
   InstructionMark im(this);
-  InstructionAttr attributes(vector_len, /* vex_w */ false, /* legacy_mode */ false, /* no_mask_reg */ false, /* uses_vl */ true);
+  InstructionAttr attributes(vector_len, /* vex_w */ false, /* legacy_mode */ false, /* no_mask_reg */ true, /* uses_vl */ true);
   attributes.set_address_attributes(/* tuple_type */ EVEX_FV, /* input_size_in_bits */ EVEX_32bit);
   vex_prefix(src2, src1->encoding(), dst->encoding(), VEX_SIMD_66, VEX_OPCODE_0F_38, &attributes);
   emit_int8((unsigned char)0xB8);
@@ -5326,7 +5318,7 @@
 
 void Assembler::divpd(XMMRegister dst, XMMRegister src) {
   NOT_LP64(assert(VM_Version::supports_sse2(), ""));
-  InstructionAttr attributes(AVX_128bit, /* rex_w */ VM_Version::supports_evex(), /* legacy_mode */ false, /* no_mask_reg */ false, /* uses_vl */ true);
+  InstructionAttr attributes(AVX_128bit, /* rex_w */ VM_Version::supports_evex(), /* legacy_mode */ false, /* no_mask_reg */ true, /* uses_vl */ true);
   attributes.set_rex_vex_w_reverted();
   int encode = simd_prefix_and_encode(dst, dst, src, VEX_SIMD_66, VEX_OPCODE_0F, &attributes);
   emit_int8(0x5E);
@@ -5335,7 +5327,7 @@
 
 void Assembler::divps(XMMRegister dst, XMMRegister src) {
   NOT_LP64(assert(VM_Version::supports_sse2(), ""));
-  InstructionAttr attributes(AVX_128bit, /* rex_w */ false, /* legacy_mode */ false, /* no_mask_reg */ false, /* uses_vl */ true);
+  InstructionAttr attributes(AVX_128bit, /* rex_w */ false, /* legacy_mode */ false, /* no_mask_reg */ true, /* uses_vl */ true);
   int encode = simd_prefix_and_encode(dst, dst, src, VEX_SIMD_NONE, VEX_OPCODE_0F, &attributes);
   emit_int8(0x5E);
   emit_int8((unsigned char)(0xC0 | encode));
@@ -5343,7 +5335,7 @@
 
 void Assembler::vdivpd(XMMRegister dst, XMMRegister nds, XMMRegister src, int vector_len) {
   assert(VM_Version::supports_avx(), "");
-  InstructionAttr attributes(vector_len, /* vex_w */ VM_Version::supports_evex(), /* legacy_mode */ false, /* no_mask_reg */ false, /* uses_vl */ true);
+  InstructionAttr attributes(vector_len, /* vex_w */ VM_Version::supports_evex(), /* legacy_mode */ false, /* no_mask_reg */ true, /* uses_vl */ true);
   attributes.set_rex_vex_w_reverted();
   int encode = vex_prefix_and_encode(dst->encoding(), nds->encoding(), src->encoding(), VEX_SIMD_66, VEX_OPCODE_0F, &attributes);
   emit_int8(0x5E);
@@ -5352,7 +5344,7 @@
 
 void Assembler::vdivps(XMMRegister dst, XMMRegister nds, XMMRegister src, int vector_len) {
   assert(VM_Version::supports_avx(), "");
-  InstructionAttr attributes(vector_len, /* vex_w */ false, /* legacy_mode */ false, /* no_mask_reg */ false, /* uses_vl */ true);
+  InstructionAttr attributes(vector_len, /* vex_w */ false, /* legacy_mode */ false, /* no_mask_reg */ true, /* uses_vl */ true);
   int encode = vex_prefix_and_encode(dst->encoding(), nds->encoding(), src->encoding(), VEX_SIMD_NONE, VEX_OPCODE_0F, &attributes);
   emit_int8(0x5E);
   emit_int8((unsigned char)(0xC0 | encode));
@@ -5361,7 +5353,7 @@
 void Assembler::vdivpd(XMMRegister dst, XMMRegister nds, Address src, int vector_len) {
   assert(VM_Version::supports_avx(), "");
   InstructionMark im(this);
-  InstructionAttr attributes(vector_len, /* vex_w */ VM_Version::supports_evex(), /* legacy_mode */ false, /* no_mask_reg */ false, /* uses_vl */ true);
+  InstructionAttr attributes(vector_len, /* vex_w */ VM_Version::supports_evex(), /* legacy_mode */ false, /* no_mask_reg */ true, /* uses_vl */ true);
   attributes.set_address_attributes(/* tuple_type */ EVEX_FV, /* input_size_in_bits */ EVEX_64bit);
   attributes.set_rex_vex_w_reverted();
   vex_prefix(src, nds->encoding(), dst->encoding(), VEX_SIMD_66, VEX_OPCODE_0F, &attributes);
@@ -5372,7 +5364,7 @@
 void Assembler::vdivps(XMMRegister dst, XMMRegister nds, Address src, int vector_len) {
   assert(VM_Version::supports_avx(), "");
   InstructionMark im(this);
-  InstructionAttr attributes(vector_len, /* vex_w */ false, /* legacy_mode */ false, /* no_mask_reg */ false, /* uses_vl */ true);
+  InstructionAttr attributes(vector_len, /* vex_w */ false, /* legacy_mode */ false, /* no_mask_reg */ true, /* uses_vl */ true);
   attributes.set_address_attributes(/* tuple_type */ EVEX_FV, /* input_size_in_bits */ EVEX_32bit);
   vex_prefix(src, nds->encoding(), dst->encoding(), VEX_SIMD_NONE, VEX_OPCODE_0F, &attributes);
   emit_int8(0x5E);
@@ -5381,7 +5373,7 @@
 
 void Assembler::vsqrtpd(XMMRegister dst, XMMRegister src, int vector_len) {
   assert(VM_Version::supports_avx(), "");
-  InstructionAttr attributes(vector_len, /* vex_w */ VM_Version::supports_evex(), /* legacy_mode */ false, /* no_mask_reg */ false, /* uses_vl */ true);
+  InstructionAttr attributes(vector_len, /* vex_w */ VM_Version::supports_evex(), /* legacy_mode */ false, /* no_mask_reg */ true, /* uses_vl */ true);
   attributes.set_rex_vex_w_reverted();
   int encode = vex_prefix_and_encode(dst->encoding(), 0, src->encoding(), VEX_SIMD_66, VEX_OPCODE_0F, &attributes);
   emit_int8(0x51);
@@ -5391,7 +5383,7 @@
 void Assembler::vsqrtpd(XMMRegister dst, Address src, int vector_len) {
   assert(VM_Version::supports_avx(), "");
   InstructionMark im(this);
-  InstructionAttr attributes(vector_len, /* vex_w */ VM_Version::supports_evex(), /* legacy_mode */ false, /* no_mask_reg */ false, /* uses_vl */ true);
+  InstructionAttr attributes(vector_len, /* vex_w */ VM_Version::supports_evex(), /* legacy_mode */ false, /* no_mask_reg */ true, /* uses_vl */ true);
   attributes.set_address_attributes(/* tuple_type */ EVEX_FV, /* input_size_in_bits */ EVEX_64bit);
   attributes.set_rex_vex_w_reverted();
   vex_prefix(src, 0, dst->encoding(), VEX_SIMD_66, VEX_OPCODE_0F, &attributes);
@@ -5401,7 +5393,7 @@
 
 void Assembler::vsqrtps(XMMRegister dst, XMMRegister src, int vector_len) {
   assert(VM_Version::supports_avx(), "");
-  InstructionAttr attributes(vector_len, /* vex_w */ false, /* legacy_mode */ false, /* no_mask_reg */ false, /* uses_vl */ true);
+  InstructionAttr attributes(vector_len, /* vex_w */ false, /* legacy_mode */ false, /* no_mask_reg */ true, /* uses_vl */ true);
   int encode = vex_prefix_and_encode(dst->encoding(), 0, src->encoding(), VEX_SIMD_NONE, VEX_OPCODE_0F, &attributes);
   emit_int8(0x51);
   emit_int8((unsigned char)(0xC0 | encode));
@@ -5410,7 +5402,7 @@
 void Assembler::vsqrtps(XMMRegister dst, Address src, int vector_len) {
   assert(VM_Version::supports_avx(), "");
   InstructionMark im(this);
-  InstructionAttr attributes(vector_len, /* vex_w */ false, /* legacy_mode */ false, /* no_mask_reg */ false, /* uses_vl */ true);
+  InstructionAttr attributes(vector_len, /* vex_w */ false, /* legacy_mode */ false, /* no_mask_reg */ true, /* uses_vl */ true);
   attributes.set_address_attributes(/* tuple_type */ EVEX_FV, /* input_size_in_bits */ EVEX_64bit);
   vex_prefix(src, 0, dst->encoding(), VEX_SIMD_NONE, VEX_OPCODE_0F, &attributes);
   emit_int8(0x51);
@@ -5419,7 +5411,7 @@
 
 void Assembler::andpd(XMMRegister dst, XMMRegister src) {
   NOT_LP64(assert(VM_Version::supports_sse2(), ""));
-  InstructionAttr attributes(AVX_128bit, /* rex_w */ !_legacy_mode_dq, /* legacy_mode */ _legacy_mode_dq, /* no_mask_reg */ false, /* uses_vl */ true);
+  InstructionAttr attributes(AVX_128bit, /* rex_w */ !_legacy_mode_dq, /* legacy_mode */ _legacy_mode_dq, /* no_mask_reg */ true, /* uses_vl */ true);
   attributes.set_rex_vex_w_reverted();
   int encode = simd_prefix_and_encode(dst, dst, src, VEX_SIMD_66, VEX_OPCODE_0F, &attributes);
   emit_int8(0x54);
@@ -5428,7 +5420,7 @@
 
 void Assembler::andps(XMMRegister dst, XMMRegister src) {
   NOT_LP64(assert(VM_Version::supports_sse(), ""));
-  InstructionAttr attributes(AVX_128bit, /* rex_w */ false, /* legacy_mode */ _legacy_mode_dq, /* no_mask_reg */ false, /* uses_vl */ true);
+  InstructionAttr attributes(AVX_128bit, /* rex_w */ false, /* legacy_mode */ _legacy_mode_dq, /* no_mask_reg */ true, /* uses_vl */ true);
   int encode = simd_prefix_and_encode(dst, dst, src, VEX_SIMD_NONE, VEX_OPCODE_0F, &attributes);
   emit_int8(0x54);
   emit_int8((unsigned char)(0xC0 | encode));
@@ -5437,7 +5429,7 @@
 void Assembler::andps(XMMRegister dst, Address src) {
   NOT_LP64(assert(VM_Version::supports_sse(), ""));
   InstructionMark im(this);
-  InstructionAttr attributes(AVX_128bit, /* rex_w */ false, /* legacy_mode */ _legacy_mode_dq, /* no_mask_reg */ false, /* uses_vl */ true);
+  InstructionAttr attributes(AVX_128bit, /* rex_w */ false, /* legacy_mode */ _legacy_mode_dq, /* no_mask_reg */ true, /* uses_vl */ true);
   attributes.set_address_attributes(/* tuple_type */ EVEX_FV, /* input_size_in_bits */ EVEX_32bit);
   simd_prefix(dst, dst, src, VEX_SIMD_NONE, VEX_OPCODE_0F, &attributes);
   emit_int8(0x54);
@@ -5447,7 +5439,7 @@
 void Assembler::andpd(XMMRegister dst, Address src) {
   NOT_LP64(assert(VM_Version::supports_sse2(), ""));
   InstructionMark im(this);
-  InstructionAttr attributes(AVX_128bit, /* rex_w */ !_legacy_mode_dq, /* legacy_mode */ _legacy_mode_dq, /* no_mask_reg */ false, /* uses_vl */ true);
+  InstructionAttr attributes(AVX_128bit, /* rex_w */ !_legacy_mode_dq, /* legacy_mode */ _legacy_mode_dq, /* no_mask_reg */ true, /* uses_vl */ true);
   attributes.set_address_attributes(/* tuple_type */ EVEX_FV, /* input_size_in_bits */ EVEX_64bit);
   attributes.set_rex_vex_w_reverted();
   simd_prefix(dst, dst, src, VEX_SIMD_66, VEX_OPCODE_0F, &attributes);
@@ -5457,7 +5449,7 @@
 
 void Assembler::vandpd(XMMRegister dst, XMMRegister nds, XMMRegister src, int vector_len) {
   assert(VM_Version::supports_avx(), "");
-  InstructionAttr attributes(vector_len, /* vex_w */ !_legacy_mode_dq, /* legacy_mode */ _legacy_mode_dq, /* no_mask_reg */ false, /* uses_vl */ true);
+  InstructionAttr attributes(vector_len, /* vex_w */ !_legacy_mode_dq, /* legacy_mode */ _legacy_mode_dq, /* no_mask_reg */ true, /* uses_vl */ true);
   attributes.set_rex_vex_w_reverted();
   int encode = vex_prefix_and_encode(dst->encoding(), nds->encoding(), src->encoding(), VEX_SIMD_66, VEX_OPCODE_0F, &attributes);
   emit_int8(0x54);
@@ -5466,7 +5458,7 @@
 
 void Assembler::vandps(XMMRegister dst, XMMRegister nds, XMMRegister src, int vector_len) {
   assert(VM_Version::supports_avx(), "");
-  InstructionAttr attributes(vector_len, /* vex_w */ false, /* legacy_mode */ _legacy_mode_dq, /* no_mask_reg */ false, /* uses_vl */ true);
+  InstructionAttr attributes(vector_len, /* vex_w */ false, /* legacy_mode */ _legacy_mode_dq, /* no_mask_reg */ true, /* uses_vl */ true);
   int encode = vex_prefix_and_encode(dst->encoding(), nds->encoding(), src->encoding(), VEX_SIMD_NONE, VEX_OPCODE_0F, &attributes);
   emit_int8(0x54);
   emit_int8((unsigned char)(0xC0 | encode));
@@ -5475,7 +5467,7 @@
 void Assembler::vandpd(XMMRegister dst, XMMRegister nds, Address src, int vector_len) {
   assert(VM_Version::supports_avx(), "");
   InstructionMark im(this);
-  InstructionAttr attributes(vector_len, /* vex_w */ !_legacy_mode_dq, /* legacy_mode */ _legacy_mode_dq, /* no_mask_reg */ false, /* uses_vl */ true);
+  InstructionAttr attributes(vector_len, /* vex_w */ !_legacy_mode_dq, /* legacy_mode */ _legacy_mode_dq, /* no_mask_reg */ true, /* uses_vl */ true);
   attributes.set_address_attributes(/* tuple_type */ EVEX_FV, /* input_size_in_bits */ EVEX_64bit);
   attributes.set_rex_vex_w_reverted();
   vex_prefix(src, nds->encoding(), dst->encoding(), VEX_SIMD_66, VEX_OPCODE_0F, &attributes);
@@ -5486,7 +5478,7 @@
 void Assembler::vandps(XMMRegister dst, XMMRegister nds, Address src, int vector_len) {
   assert(VM_Version::supports_avx(), "");
   InstructionMark im(this);
-  InstructionAttr attributes(vector_len, /* vex_w */ false, /* legacy_mode */ _legacy_mode_dq, /* no_mask_reg */ false, /* uses_vl */ true);
+  InstructionAttr attributes(vector_len, /* vex_w */ false, /* legacy_mode */ _legacy_mode_dq, /* no_mask_reg */ true, /* uses_vl */ true);
   attributes.set_address_attributes(/* tuple_type */ EVEX_FV, /* input_size_in_bits */ EVEX_32bit);
   vex_prefix(src, nds->encoding(), dst->encoding(), VEX_SIMD_NONE, VEX_OPCODE_0F, &attributes);
   emit_int8(0x54);
@@ -5495,7 +5487,7 @@
 
 void Assembler::unpckhpd(XMMRegister dst, XMMRegister src) {
   NOT_LP64(assert(VM_Version::supports_sse2(), ""));
-  InstructionAttr attributes(AVX_128bit, /* rex_w */ VM_Version::supports_evex(), /* legacy_mode */ false, /* no_mask_reg */ false, /* uses_vl */ true);
+  InstructionAttr attributes(AVX_128bit, /* rex_w */ VM_Version::supports_evex(), /* legacy_mode */ false, /* no_mask_reg */ true, /* uses_vl */ true);
   attributes.set_rex_vex_w_reverted();
   int encode = simd_prefix_and_encode(dst, dst, src, VEX_SIMD_66, VEX_OPCODE_0F, &attributes);
   emit_int8(0x15);
@@ -5504,7 +5496,7 @@
 
 void Assembler::unpcklpd(XMMRegister dst, XMMRegister src) {
   NOT_LP64(assert(VM_Version::supports_sse2(), ""));
-  InstructionAttr attributes(AVX_128bit, /* rex_w */ VM_Version::supports_evex(), /* legacy_mode */ false, /* no_mask_reg */ false, /* uses_vl */ true);
+  InstructionAttr attributes(AVX_128bit, /* rex_w */ VM_Version::supports_evex(), /* legacy_mode */ false, /* no_mask_reg */ true, /* uses_vl */ true);
   attributes.set_rex_vex_w_reverted();
   int encode = simd_prefix_and_encode(dst, dst, src, VEX_SIMD_66, VEX_OPCODE_0F, &attributes);
   emit_int8(0x14);
@@ -5513,7 +5505,7 @@
 
 void Assembler::xorpd(XMMRegister dst, XMMRegister src) {
   NOT_LP64(assert(VM_Version::supports_sse2(), ""));
-  InstructionAttr attributes(AVX_128bit, /* rex_w */ !_legacy_mode_dq, /* legacy_mode */ _legacy_mode_dq, /* no_mask_reg */ false, /* uses_vl */ true);
+  InstructionAttr attributes(AVX_128bit, /* rex_w */ !_legacy_mode_dq, /* legacy_mode */ _legacy_mode_dq, /* no_mask_reg */ true, /* uses_vl */ true);
   attributes.set_rex_vex_w_reverted();
   int encode = simd_prefix_and_encode(dst, dst, src, VEX_SIMD_66, VEX_OPCODE_0F, &attributes);
   emit_int8(0x57);
@@ -5522,7 +5514,7 @@
 
 void Assembler::xorps(XMMRegister dst, XMMRegister src) {
   NOT_LP64(assert(VM_Version::supports_sse(), ""));
-  InstructionAttr attributes(AVX_128bit, /* rex_w */ false, /* legacy_mode */ _legacy_mode_dq, /* no_mask_reg */ false, /* uses_vl */ true);
+  InstructionAttr attributes(AVX_128bit, /* rex_w */ false, /* legacy_mode */ _legacy_mode_dq, /* no_mask_reg */ true, /* uses_vl */ true);
   int encode = simd_prefix_and_encode(dst, dst, src, VEX_SIMD_NONE, VEX_OPCODE_0F, &attributes);
   emit_int8(0x57);
   emit_int8((unsigned char)(0xC0 | encode));
@@ -5531,7 +5523,7 @@
 void Assembler::xorpd(XMMRegister dst, Address src) {
   NOT_LP64(assert(VM_Version::supports_sse2(), ""));
   InstructionMark im(this);
-  InstructionAttr attributes(AVX_128bit, /* rex_w */ !_legacy_mode_dq, /* legacy_mode */ _legacy_mode_dq, /* no_mask_reg */ false, /* uses_vl */ true);
+  InstructionAttr attributes(AVX_128bit, /* rex_w */ !_legacy_mode_dq, /* legacy_mode */ _legacy_mode_dq, /* no_mask_reg */ true, /* uses_vl */ true);
   attributes.set_address_attributes(/* tuple_type */ EVEX_FV, /* input_size_in_bits */ EVEX_64bit);
   attributes.set_rex_vex_w_reverted();
   simd_prefix(dst, dst, src, VEX_SIMD_66, VEX_OPCODE_0F, &attributes);
@@ -5542,7 +5534,7 @@
 void Assembler::xorps(XMMRegister dst, Address src) {
   NOT_LP64(assert(VM_Version::supports_sse(), ""));
   InstructionMark im(this);
-  InstructionAttr attributes(AVX_128bit, /* rex_w */ false, /* legacy_mode */ _legacy_mode_dq, /* no_mask_reg */ false, /* uses_vl */ true);
+  InstructionAttr attributes(AVX_128bit, /* rex_w */ false, /* legacy_mode */ _legacy_mode_dq, /* no_mask_reg */ true, /* uses_vl */ true);
   attributes.set_address_attributes(/* tuple_type */ EVEX_FV, /* input_size_in_bits */ EVEX_32bit);
   simd_prefix(dst, dst, src, VEX_SIMD_NONE, VEX_OPCODE_0F, &attributes);
   emit_int8(0x57);
@@ -5551,7 +5543,7 @@
 
 void Assembler::vxorpd(XMMRegister dst, XMMRegister nds, XMMRegister src, int vector_len) {
   assert(VM_Version::supports_avx(), "");
-  InstructionAttr attributes(vector_len, /* vex_w */ !_legacy_mode_dq, /* legacy_mode */ _legacy_mode_dq, /* no_mask_reg */ false, /* uses_vl */ true);
+  InstructionAttr attributes(vector_len, /* vex_w */ !_legacy_mode_dq, /* legacy_mode */ _legacy_mode_dq, /* no_mask_reg */ true, /* uses_vl */ true);
   attributes.set_rex_vex_w_reverted();
   int encode = vex_prefix_and_encode(dst->encoding(), nds->encoding(), src->encoding(), VEX_SIMD_66, VEX_OPCODE_0F, &attributes);
   emit_int8(0x57);
@@ -5560,7 +5552,7 @@
 
 void Assembler::vxorps(XMMRegister dst, XMMRegister nds, XMMRegister src, int vector_len) {
   assert(VM_Version::supports_avx(), "");
-  InstructionAttr attributes(vector_len, /* vex_w */ false, /* legacy_mode */ _legacy_mode_dq, /* no_mask_reg */ false, /* uses_vl */ true);
+  InstructionAttr attributes(vector_len, /* vex_w */ false, /* legacy_mode */ _legacy_mode_dq, /* no_mask_reg */ true, /* uses_vl */ true);
   int encode = vex_prefix_and_encode(dst->encoding(), nds->encoding(), src->encoding(), VEX_SIMD_NONE, VEX_OPCODE_0F, &attributes);
   emit_int8(0x57);
   emit_int8((unsigned char)(0xC0 | encode));
@@ -5569,7 +5561,7 @@
 void Assembler::vxorpd(XMMRegister dst, XMMRegister nds, Address src, int vector_len) {
   assert(VM_Version::supports_avx(), "");
   InstructionMark im(this);
-  InstructionAttr attributes(vector_len, /* vex_w */ !_legacy_mode_dq, /* legacy_mode */ _legacy_mode_dq, /* no_mask_reg */ false, /* uses_vl */ true);
+  InstructionAttr attributes(vector_len, /* vex_w */ !_legacy_mode_dq, /* legacy_mode */ _legacy_mode_dq, /* no_mask_reg */ true, /* uses_vl */ true);
   attributes.set_address_attributes(/* tuple_type */ EVEX_FV, /* input_size_in_bits */ EVEX_64bit);
   attributes.set_rex_vex_w_reverted();
   vex_prefix(src, nds->encoding(), dst->encoding(), VEX_SIMD_66, VEX_OPCODE_0F, &attributes);
@@ -5580,7 +5572,7 @@
 void Assembler::vxorps(XMMRegister dst, XMMRegister nds, Address src, int vector_len) {
   assert(VM_Version::supports_avx(), "");
   InstructionMark im(this);
-  InstructionAttr attributes(vector_len, /* vex_w */ false, /* legacy_mode */ _legacy_mode_dq, /* no_mask_reg */ false, /* uses_vl */ true);
+  InstructionAttr attributes(vector_len, /* vex_w */ false, /* legacy_mode */ _legacy_mode_dq, /* no_mask_reg */ true, /* uses_vl */ true);
   attributes.set_address_attributes(/* tuple_type */ EVEX_FV, /* input_size_in_bits */ EVEX_32bit);
   vex_prefix(src, nds->encoding(), dst->encoding(), VEX_SIMD_NONE, VEX_OPCODE_0F, &attributes);
   emit_int8(0x57);
@@ -5600,7 +5592,7 @@
 void Assembler::vphaddd(XMMRegister dst, XMMRegister nds, XMMRegister src, int vector_len) {
   assert(VM_Version::supports_avx() && (vector_len == 0) ||
          VM_Version::supports_avx2(), "256 bit integer vectors requires AVX2");
-  InstructionAttr attributes(vector_len, /* vex_w */ false, /* legacy_mode */ true, /* no_mask_reg */ false, /* uses_vl */ true);
+  InstructionAttr attributes(vector_len, /* vex_w */ false, /* legacy_mode */ true, /* no_mask_reg */ true, /* uses_vl */ true);
   int encode = vex_prefix_and_encode(dst->encoding(), nds->encoding(), src->encoding(), VEX_SIMD_66, VEX_OPCODE_0F_38, &attributes);
   emit_int8(0x02);
   emit_int8((unsigned char)(0xC0 | encode));
@@ -5624,7 +5616,7 @@
 
 void Assembler::paddd(XMMRegister dst, XMMRegister src) {
   NOT_LP64(assert(VM_Version::supports_sse2(), ""));
-  InstructionAttr attributes(AVX_128bit, /* rex_w */ false, /* legacy_mode */ false, /* no_mask_reg */ false, /* uses_vl */ true);
+  InstructionAttr attributes(AVX_128bit, /* rex_w */ false, /* legacy_mode */ false, /* no_mask_reg */ true, /* uses_vl */ true);
   int encode = simd_prefix_and_encode(dst, dst, src, VEX_SIMD_66, VEX_OPCODE_0F, &attributes);
   emit_int8((unsigned char)0xFE);
   emit_int8((unsigned char)(0xC0 | encode));
@@ -5633,7 +5625,7 @@
 void Assembler::paddd(XMMRegister dst, Address src) {
   NOT_LP64(assert(VM_Version::supports_sse2(), ""));
   InstructionMark im(this);
-  InstructionAttr attributes(AVX_128bit, /* rex_w */ false, /* legacy_mode */ false, /* no_mask_reg */ false, /* uses_vl */ true);
+  InstructionAttr attributes(AVX_128bit, /* rex_w */ false, /* legacy_mode */ false, /* no_mask_reg */ true, /* uses_vl */ true);
   simd_prefix(dst, dst, src, VEX_SIMD_66, VEX_OPCODE_0F, &attributes);
   emit_int8((unsigned char)0xFE);
   emit_operand(dst, src);
@@ -5641,7 +5633,7 @@
 
 void Assembler::paddq(XMMRegister dst, XMMRegister src) {
   NOT_LP64(assert(VM_Version::supports_sse2(), ""));
-  InstructionAttr attributes(AVX_128bit, /* rex_w */ VM_Version::supports_evex(), /* legacy_mode */ false, /* no_mask_reg */ false, /* uses_vl */ true);
+  InstructionAttr attributes(AVX_128bit, /* rex_w */ VM_Version::supports_evex(), /* legacy_mode */ false, /* no_mask_reg */ true, /* uses_vl */ true);
   attributes.set_rex_vex_w_reverted();
   int encode = simd_prefix_and_encode(dst, dst, src, VEX_SIMD_66, VEX_OPCODE_0F, &attributes);
   emit_int8((unsigned char)0xD4);
@@ -5658,7 +5650,7 @@
 
 void Assembler::phaddd(XMMRegister dst, XMMRegister src) {
   assert(VM_Version::supports_sse3(), "");
-  InstructionAttr attributes(AVX_128bit, /* rex_w */ false, /* legacy_mode */ true, /* no_mask_reg */ false, /* uses_vl */ true);
+  InstructionAttr attributes(AVX_128bit, /* rex_w */ false, /* legacy_mode */ true, /* no_mask_reg */ true, /* uses_vl */ true);
   int encode = simd_prefix_and_encode(dst, dst, src, VEX_SIMD_66, VEX_OPCODE_0F_38, &attributes);
   emit_int8(0x02);
   emit_int8((unsigned char)(0xC0 | encode));
@@ -5682,7 +5674,7 @@
 
 void Assembler::vpaddd(XMMRegister dst, XMMRegister nds, XMMRegister src, int vector_len) {
   assert(UseAVX > 0, "requires some form of AVX");
-  InstructionAttr attributes(vector_len, /* vex_w */ false, /* legacy_mode */ false, /* no_mask_reg */ false, /* uses_vl */ true);
+  InstructionAttr attributes(vector_len, /* vex_w */ false, /* legacy_mode */ false, /* no_mask_reg */ true, /* uses_vl */ true);
   int encode = vex_prefix_and_encode(dst->encoding(), nds->encoding(), src->encoding(), VEX_SIMD_66, VEX_OPCODE_0F, &attributes);
   emit_int8((unsigned char)0xFE);
   emit_int8((unsigned char)(0xC0 | encode));
@@ -5690,7 +5682,7 @@
 
 void Assembler::vpaddq(XMMRegister dst, XMMRegister nds, XMMRegister src, int vector_len) {
   assert(UseAVX > 0, "requires some form of AVX");
-  InstructionAttr attributes(vector_len, /* vex_w */ VM_Version::supports_evex(), /* legacy_mode */ false, /* no_mask_reg */ false, /* uses_vl */ true);
+  InstructionAttr attributes(vector_len, /* vex_w */ VM_Version::supports_evex(), /* legacy_mode */ false, /* no_mask_reg */ true, /* uses_vl */ true);
   attributes.set_rex_vex_w_reverted();
   int encode = vex_prefix_and_encode(dst->encoding(), nds->encoding(), src->encoding(), VEX_SIMD_66, VEX_OPCODE_0F, &attributes);
   emit_int8((unsigned char)0xD4);
@@ -5720,7 +5712,7 @@
 void Assembler::vpaddd(XMMRegister dst, XMMRegister nds, Address src, int vector_len) {
   assert(UseAVX > 0, "requires some form of AVX");
   InstructionMark im(this);
-  InstructionAttr attributes(vector_len, /* vex_w */ false, /* legacy_mode */ false, /* no_mask_reg */ false, /* uses_vl */ true);
+  InstructionAttr attributes(vector_len, /* vex_w */ false, /* legacy_mode */ false, /* no_mask_reg */ true, /* uses_vl */ true);
   attributes.set_address_attributes(/* tuple_type */ EVEX_FV, /* input_size_in_bits */ EVEX_32bit);
   vex_prefix(src, nds->encoding(), dst->encoding(), VEX_SIMD_66, VEX_OPCODE_0F, &attributes);
   emit_int8((unsigned char)0xFE);
@@ -5730,7 +5722,7 @@
 void Assembler::vpaddq(XMMRegister dst, XMMRegister nds, Address src, int vector_len) {
   assert(UseAVX > 0, "requires some form of AVX");
   InstructionMark im(this);
-  InstructionAttr attributes(vector_len, /* vex_w */ VM_Version::supports_evex(), /* legacy_mode */ false, /* no_mask_reg */ false, /* uses_vl */ true);
+  InstructionAttr attributes(vector_len, /* vex_w */ VM_Version::supports_evex(), /* legacy_mode */ false, /* no_mask_reg */ true, /* uses_vl */ true);
   attributes.set_address_attributes(/* tuple_type */ EVEX_FV, /* input_size_in_bits */ EVEX_64bit);
   attributes.set_rex_vex_w_reverted();
   vex_prefix(src, nds->encoding(), dst->encoding(), VEX_SIMD_66, VEX_OPCODE_0F, &attributes);
@@ -5755,7 +5747,7 @@
 }
 
 void Assembler::psubd(XMMRegister dst, XMMRegister src) {
-  InstructionAttr attributes(AVX_128bit, /* rex_w */ false, /* legacy_mode */ false, /* no_mask_reg */ false, /* uses_vl */ true);
+  InstructionAttr attributes(AVX_128bit, /* rex_w */ false, /* legacy_mode */ false, /* no_mask_reg */ true, /* uses_vl */ true);
   int encode = simd_prefix_and_encode(dst, dst, src, VEX_SIMD_66, VEX_OPCODE_0F, &attributes);
   emit_int8((unsigned char)0xFA);
   emit_int8((unsigned char)(0xC0 | encode));
@@ -5763,7 +5755,7 @@
 
 void Assembler::psubq(XMMRegister dst, XMMRegister src) {
   NOT_LP64(assert(VM_Version::supports_sse2(), ""));
-  InstructionAttr attributes(AVX_128bit, /* rex_w */ VM_Version::supports_evex(), /* legacy_mode */ false, /* no_mask_reg */ false, /* uses_vl */ true);
+  InstructionAttr attributes(AVX_128bit, /* rex_w */ VM_Version::supports_evex(), /* legacy_mode */ false, /* no_mask_reg */ true, /* uses_vl */ true);
   attributes.set_rex_vex_w_reverted();
   int encode = simd_prefix_and_encode(dst, dst, src, VEX_SIMD_66, VEX_OPCODE_0F, &attributes);
   emit_int8((unsigned char)0xFB);
@@ -5788,7 +5780,7 @@
 
 void Assembler::vpsubd(XMMRegister dst, XMMRegister nds, XMMRegister src, int vector_len) {
   assert(UseAVX > 0, "requires some form of AVX");
-  InstructionAttr attributes(vector_len, /* vex_w */ false, /* legacy_mode */ false, /* no_mask_reg */ false, /* uses_vl */ true);
+  InstructionAttr attributes(vector_len, /* vex_w */ false, /* legacy_mode */ false, /* no_mask_reg */ true, /* uses_vl */ true);
   int encode = vex_prefix_and_encode(dst->encoding(), nds->encoding(), src->encoding(), VEX_SIMD_66, VEX_OPCODE_0F, &attributes);
   emit_int8((unsigned char)0xFA);
   emit_int8((unsigned char)(0xC0 | encode));
@@ -5796,7 +5788,7 @@
 
 void Assembler::vpsubq(XMMRegister dst, XMMRegister nds, XMMRegister src, int vector_len) {
   assert(UseAVX > 0, "requires some form of AVX");
-  InstructionAttr attributes(vector_len, /* rex_w */ VM_Version::supports_evex(), /* legacy_mode */ false, /* no_mask_reg */ false, /* uses_vl */ true);
+  InstructionAttr attributes(vector_len, /* rex_w */ VM_Version::supports_evex(), /* legacy_mode */ false, /* no_mask_reg */ true, /* uses_vl */ true);
   attributes.set_rex_vex_w_reverted();
   int encode = vex_prefix_and_encode(dst->encoding(), nds->encoding(), src->encoding(), VEX_SIMD_66, VEX_OPCODE_0F, &attributes);
   emit_int8((unsigned char)0xFB);
@@ -5826,7 +5818,7 @@
 void Assembler::vpsubd(XMMRegister dst, XMMRegister nds, Address src, int vector_len) {
   assert(UseAVX > 0, "requires some form of AVX");
   InstructionMark im(this);
-  InstructionAttr attributes(vector_len, /* vex_w */ false, /* legacy_mode */ false, /* no_mask_reg */ false, /* uses_vl */ true);
+  InstructionAttr attributes(vector_len, /* vex_w */ false, /* legacy_mode */ false, /* no_mask_reg */ true, /* uses_vl */ true);
   attributes.set_address_attributes(/* tuple_type */ EVEX_FV, /* input_size_in_bits */ EVEX_32bit);
   vex_prefix(src, nds->encoding(), dst->encoding(), VEX_SIMD_66, VEX_OPCODE_0F, &attributes);
   emit_int8((unsigned char)0xFA);
@@ -5836,7 +5828,7 @@
 void Assembler::vpsubq(XMMRegister dst, XMMRegister nds, Address src, int vector_len) {
   assert(UseAVX > 0, "requires some form of AVX");
   InstructionMark im(this);
-  InstructionAttr attributes(vector_len, /* vex_w */ VM_Version::supports_evex(), /* legacy_mode */ false, /* no_mask_reg */ false, /* uses_vl */ true);
+  InstructionAttr attributes(vector_len, /* vex_w */ VM_Version::supports_evex(), /* legacy_mode */ false, /* no_mask_reg */ true, /* uses_vl */ true);
   attributes.set_address_attributes(/* tuple_type */ EVEX_FV, /* input_size_in_bits */ EVEX_64bit);
   attributes.set_rex_vex_w_reverted();
   vex_prefix(src, nds->encoding(), dst->encoding(), VEX_SIMD_66, VEX_OPCODE_0F, &attributes);
@@ -5854,7 +5846,7 @@
 
 void Assembler::pmulld(XMMRegister dst, XMMRegister src) {
   assert(VM_Version::supports_sse4_1(), "");
-  InstructionAttr attributes(AVX_128bit, /* rex_w */ false, /* legacy_mode */ false, /* no_mask_reg */ false, /* uses_vl */ true);
+  InstructionAttr attributes(AVX_128bit, /* rex_w */ false, /* legacy_mode */ false, /* no_mask_reg */ true, /* uses_vl */ true);
   int encode = simd_prefix_and_encode(dst, dst, src, VEX_SIMD_66, VEX_OPCODE_0F_38, &attributes);
   emit_int8(0x40);
   emit_int8((unsigned char)(0xC0 | encode));
@@ -5870,7 +5862,7 @@
 
 void Assembler::vpmulld(XMMRegister dst, XMMRegister nds, XMMRegister src, int vector_len) {
   assert(UseAVX > 0, "requires some form of AVX");
-  InstructionAttr attributes(vector_len, /* vex_w */ false, /* legacy_mode */ false, /* no_mask_reg */ false, /* uses_vl */ true);
+  InstructionAttr attributes(vector_len, /* vex_w */ false, /* legacy_mode */ false, /* no_mask_reg */ true, /* uses_vl */ true);
   int encode = vex_prefix_and_encode(dst->encoding(), nds->encoding(), src->encoding(), VEX_SIMD_66, VEX_OPCODE_0F_38, &attributes);
   emit_int8(0x40);
   emit_int8((unsigned char)(0xC0 | encode));
@@ -5878,7 +5870,7 @@
 
 void Assembler::vpmullq(XMMRegister dst, XMMRegister nds, XMMRegister src, int vector_len) {
   assert(UseAVX > 2, "requires some form of EVEX");
-  InstructionAttr attributes(vector_len, /* vex_w */ true, /* legacy_mode */ _legacy_mode_dq, /* no_mask_reg */ false, /* uses_vl */ true);
+  InstructionAttr attributes(vector_len, /* vex_w */ true, /* legacy_mode */ _legacy_mode_dq, /* no_mask_reg */ true, /* uses_vl */ true);
   attributes.set_is_evex_instruction();
   int encode = vex_prefix_and_encode(dst->encoding(), nds->encoding(), src->encoding(), VEX_SIMD_66, VEX_OPCODE_0F_38, &attributes);
   emit_int8(0x40);
@@ -5898,7 +5890,7 @@
 void Assembler::vpmulld(XMMRegister dst, XMMRegister nds, Address src, int vector_len) {
   assert(UseAVX > 0, "requires some form of AVX");
   InstructionMark im(this);
-  InstructionAttr attributes(vector_len, /* vex_w */ false, /* legacy_mode */ false, /* no_mask_reg */ false, /* uses_vl */ true);
+  InstructionAttr attributes(vector_len, /* vex_w */ false, /* legacy_mode */ false, /* no_mask_reg */ true, /* uses_vl */ true);
   attributes.set_address_attributes(/* tuple_type */ EVEX_FV, /* input_size_in_bits */ EVEX_32bit);
   vex_prefix(src, nds->encoding(), dst->encoding(), VEX_SIMD_66, VEX_OPCODE_0F_38, &attributes);
   emit_int8(0x40);
@@ -5908,7 +5900,7 @@
 void Assembler::vpmullq(XMMRegister dst, XMMRegister nds, Address src, int vector_len) {
   assert(UseAVX > 2, "requires some form of EVEX");
   InstructionMark im(this);
-  InstructionAttr attributes(vector_len, /* vex_w */ true, /* legacy_mode */ _legacy_mode_dq, /* no_mask_reg */ false, /* uses_vl */ true);
+  InstructionAttr attributes(vector_len, /* vex_w */ true, /* legacy_mode */ _legacy_mode_dq, /* no_mask_reg */ true, /* uses_vl */ true);
   attributes.set_address_attributes(/* tuple_type */ EVEX_FV, /* input_size_in_bits */ EVEX_64bit);
   attributes.set_is_evex_instruction();
   vex_prefix(src, nds->encoding(), dst->encoding(), VEX_SIMD_66, VEX_OPCODE_0F_38, &attributes);
@@ -5929,7 +5921,7 @@
 
 void Assembler::pslld(XMMRegister dst, int shift) {
   NOT_LP64(assert(VM_Version::supports_sse2(), ""));
-  InstructionAttr attributes(AVX_128bit, /* rex_w */ false, /* legacy_mode */ false, /* no_mask_reg */ false, /* uses_vl */ true);
+  InstructionAttr attributes(AVX_128bit, /* rex_w */ false, /* legacy_mode */ false, /* no_mask_reg */ true, /* uses_vl */ true);
   // XMM6 is for /6 encoding: 66 0F 72 /6 ib
   int encode = simd_prefix_and_encode(xmm6, dst, dst, VEX_SIMD_66, VEX_OPCODE_0F, &attributes);
   emit_int8(0x72);
@@ -5939,7 +5931,7 @@
 
 void Assembler::psllq(XMMRegister dst, int shift) {
   NOT_LP64(assert(VM_Version::supports_sse2(), ""));
-  InstructionAttr attributes(AVX_128bit, /* rex_w */ true, /* legacy_mode */ false, /* no_mask_reg */ false, /* uses_vl */ true);
+  InstructionAttr attributes(AVX_128bit, /* rex_w */ true, /* legacy_mode */ false, /* no_mask_reg */ true, /* uses_vl */ true);
   // XMM6 is for /6 encoding: 66 0F 73 /6 ib
   int encode = simd_prefix_and_encode(xmm6, dst, dst, VEX_SIMD_66, VEX_OPCODE_0F, &attributes);
   emit_int8(0x73);
@@ -5957,7 +5949,7 @@
 
 void Assembler::pslld(XMMRegister dst, XMMRegister shift) {
   NOT_LP64(assert(VM_Version::supports_sse2(), ""));
-  InstructionAttr attributes(AVX_128bit, /* rex_w */ false, /* legacy_mode */ false, /* no_mask_reg */ false, /* uses_vl */ true);
+  InstructionAttr attributes(AVX_128bit, /* rex_w */ false, /* legacy_mode */ false, /* no_mask_reg */ true, /* uses_vl */ true);
   int encode = simd_prefix_and_encode(dst, dst, shift, VEX_SIMD_66, VEX_OPCODE_0F, &attributes);
   emit_int8((unsigned char)0xF2);
   emit_int8((unsigned char)(0xC0 | encode));
@@ -5965,7 +5957,7 @@
 
 void Assembler::psllq(XMMRegister dst, XMMRegister shift) {
   NOT_LP64(assert(VM_Version::supports_sse2(), ""));
-  InstructionAttr attributes(AVX_128bit, /* rex_w */ VM_Version::supports_evex(), /* legacy_mode */ false, /* no_mask_reg */ false, /* uses_vl */ true);
+  InstructionAttr attributes(AVX_128bit, /* rex_w */ VM_Version::supports_evex(), /* legacy_mode */ false, /* no_mask_reg */ true, /* uses_vl */ true);
   attributes.set_rex_vex_w_reverted();
   int encode = simd_prefix_and_encode(dst, dst, shift, VEX_SIMD_66, VEX_OPCODE_0F, &attributes);
   emit_int8((unsigned char)0xF3);
@@ -5985,7 +5977,7 @@
 void Assembler::vpslld(XMMRegister dst, XMMRegister src, int shift, int vector_len) {
   assert(UseAVX > 0, "requires some form of AVX");
   NOT_LP64(assert(VM_Version::supports_sse2(), ""));
-  InstructionAttr attributes(vector_len, /* vex_w */ false, /* legacy_mode */ false, /* no_mask_reg */ false, /* uses_vl */ true);
+  InstructionAttr attributes(vector_len, /* vex_w */ false, /* legacy_mode */ false, /* no_mask_reg */ true, /* uses_vl */ true);
   // XMM6 is for /6 encoding: 66 0F 72 /6 ib
   int encode = vex_prefix_and_encode(xmm6->encoding(), dst->encoding(), src->encoding(), VEX_SIMD_66, VEX_OPCODE_0F, &attributes);
   emit_int8(0x72);
@@ -5995,7 +5987,7 @@
 
 void Assembler::vpsllq(XMMRegister dst, XMMRegister src, int shift, int vector_len) {
   assert(UseAVX > 0, "requires some form of AVX");
-  InstructionAttr attributes(vector_len, /* vex_w */ VM_Version::supports_evex(), /* legacy_mode */ false, /* no_mask_reg */ false, /* uses_vl */ true);
+  InstructionAttr attributes(vector_len, /* vex_w */ VM_Version::supports_evex(), /* legacy_mode */ false, /* no_mask_reg */ true, /* uses_vl */ true);
   attributes.set_rex_vex_w_reverted();
   // XMM6 is for /6 encoding: 66 0F 73 /6 ib
   int encode = vex_prefix_and_encode(xmm6->encoding(), dst->encoding(), src->encoding(), VEX_SIMD_66, VEX_OPCODE_0F, &attributes);
@@ -6014,7 +6006,7 @@
 
 void Assembler::vpslld(XMMRegister dst, XMMRegister src, XMMRegister shift, int vector_len) {
   assert(UseAVX > 0, "requires some form of AVX");
-  InstructionAttr attributes(vector_len, /* vex_w */ false, /* legacy_mode */ false, /* no_mask_reg */ false, /* uses_vl */ true);
+  InstructionAttr attributes(vector_len, /* vex_w */ false, /* legacy_mode */ false, /* no_mask_reg */ true, /* uses_vl */ true);
   int encode = vex_prefix_and_encode(dst->encoding(), src->encoding(), shift->encoding(), VEX_SIMD_66, VEX_OPCODE_0F, &attributes);
   emit_int8((unsigned char)0xF2);
   emit_int8((unsigned char)(0xC0 | encode));
@@ -6022,7 +6014,7 @@
 
 void Assembler::vpsllq(XMMRegister dst, XMMRegister src, XMMRegister shift, int vector_len) {
   assert(UseAVX > 0, "requires some form of AVX");
-  InstructionAttr attributes(vector_len, /* vex_w */ VM_Version::supports_evex(), /* legacy_mode */ false, /* no_mask_reg */ false, /* uses_vl */ true);
+  InstructionAttr attributes(vector_len, /* vex_w */ VM_Version::supports_evex(), /* legacy_mode */ false, /* no_mask_reg */ true, /* uses_vl */ true);
   attributes.set_rex_vex_w_reverted();
   int encode = vex_prefix_and_encode(dst->encoding(), src->encoding(), shift->encoding(), VEX_SIMD_66, VEX_OPCODE_0F, &attributes);
   emit_int8((unsigned char)0xF3);
@@ -6042,7 +6034,7 @@
 
 void Assembler::psrld(XMMRegister dst, int shift) {
   NOT_LP64(assert(VM_Version::supports_sse2(), ""));
-  InstructionAttr attributes(AVX_128bit, /* rex_w */ false, /* legacy_mode */ false, /* no_mask_reg */ false, /* uses_vl */ true);
+  InstructionAttr attributes(AVX_128bit, /* rex_w */ false, /* legacy_mode */ false, /* no_mask_reg */ true, /* uses_vl */ true);
   // XMM2 is for /2 encoding: 66 0F 72 /2 ib
   int encode = simd_prefix_and_encode(xmm2, dst, dst, VEX_SIMD_66, VEX_OPCODE_0F, &attributes);
   emit_int8(0x72);
@@ -6054,7 +6046,7 @@
   // Do not confuse it with psrldq SSE2 instruction which
   // shifts 128 bit value in xmm register by number of bytes.
   NOT_LP64(assert(VM_Version::supports_sse2(), ""));
-  InstructionAttr attributes(AVX_128bit, /* rex_w */ VM_Version::supports_evex(), /* legacy_mode */ false, /* no_mask_reg */ false, /* uses_vl */ true);
+  InstructionAttr attributes(AVX_128bit, /* rex_w */ VM_Version::supports_evex(), /* legacy_mode */ false, /* no_mask_reg */ true, /* uses_vl */ true);
   attributes.set_rex_vex_w_reverted();
   // XMM2 is for /2 encoding: 66 0F 73 /2 ib
   int encode = simd_prefix_and_encode(xmm2, dst, dst, VEX_SIMD_66, VEX_OPCODE_0F, &attributes);
@@ -6073,7 +6065,7 @@
 
 void Assembler::psrld(XMMRegister dst, XMMRegister shift) {
   NOT_LP64(assert(VM_Version::supports_sse2(), ""));
-  InstructionAttr attributes(AVX_128bit, /* rex_w */ false, /* legacy_mode */ false, /* no_mask_reg */ false, /* uses_vl */ true);
+  InstructionAttr attributes(AVX_128bit, /* rex_w */ false, /* legacy_mode */ false, /* no_mask_reg */ true, /* uses_vl */ true);
   int encode = simd_prefix_and_encode(dst, dst, shift, VEX_SIMD_66, VEX_OPCODE_0F, &attributes);
   emit_int8((unsigned char)0xD2);
   emit_int8((unsigned char)(0xC0 | encode));
@@ -6081,7 +6073,7 @@
 
 void Assembler::psrlq(XMMRegister dst, XMMRegister shift) {
   NOT_LP64(assert(VM_Version::supports_sse2(), ""));
-  InstructionAttr attributes(AVX_128bit, /* rex_w */ VM_Version::supports_evex(), /* legacy_mode */ false, /* no_mask_reg */ false, /* uses_vl */ true);
+  InstructionAttr attributes(AVX_128bit, /* rex_w */ VM_Version::supports_evex(), /* legacy_mode */ false, /* no_mask_reg */ true, /* uses_vl */ true);
   attributes.set_rex_vex_w_reverted();
   int encode = simd_prefix_and_encode(dst, dst, shift, VEX_SIMD_66, VEX_OPCODE_0F, &attributes);
   emit_int8((unsigned char)0xD3);
@@ -6100,7 +6092,7 @@
 
 void Assembler::vpsrld(XMMRegister dst, XMMRegister src, int shift, int vector_len) {
   assert(UseAVX > 0, "requires some form of AVX");
-  InstructionAttr attributes(vector_len, /* vex_w */ false, /* legacy_mode */ false, /* no_mask_reg */ false, /* uses_vl */ true);
+  InstructionAttr attributes(vector_len, /* vex_w */ false, /* legacy_mode */ false, /* no_mask_reg */ true, /* uses_vl */ true);
   // XMM2 is for /2 encoding: 66 0F 72 /2 ib
   int encode = vex_prefix_and_encode(xmm2->encoding(), dst->encoding(), src->encoding(), VEX_SIMD_66, VEX_OPCODE_0F, &attributes);
   emit_int8(0x72);
@@ -6110,7 +6102,7 @@
 
 void Assembler::vpsrlq(XMMRegister dst, XMMRegister src, int shift, int vector_len) {
   assert(UseAVX > 0, "requires some form of AVX");
-  InstructionAttr attributes(vector_len, /* vex_w */ VM_Version::supports_evex(), /* legacy_mode */ false, /* no_mask_reg */ false, /* uses_vl */ true);
+  InstructionAttr attributes(vector_len, /* vex_w */ VM_Version::supports_evex(), /* legacy_mode */ false, /* no_mask_reg */ true, /* uses_vl */ true);
   attributes.set_rex_vex_w_reverted();
   // XMM2 is for /2 encoding: 66 0F 73 /2 ib
   int encode = vex_prefix_and_encode(xmm2->encoding(), dst->encoding(), src->encoding(), VEX_SIMD_66, VEX_OPCODE_0F, &attributes);
@@ -6129,7 +6121,7 @@
 
 void Assembler::vpsrld(XMMRegister dst, XMMRegister src, XMMRegister shift, int vector_len) {
   assert(UseAVX > 0, "requires some form of AVX");
-  InstructionAttr attributes(vector_len, /* vex_w */ false, /* legacy_mode */ false, /* no_mask_reg */ false, /* uses_vl */ true);
+  InstructionAttr attributes(vector_len, /* vex_w */ false, /* legacy_mode */ false, /* no_mask_reg */ true, /* uses_vl */ true);
   int encode = vex_prefix_and_encode(dst->encoding(), src->encoding(), shift->encoding(), VEX_SIMD_66, VEX_OPCODE_0F, &attributes);
   emit_int8((unsigned char)0xD2);
   emit_int8((unsigned char)(0xC0 | encode));
@@ -6137,7 +6129,7 @@
 
 void Assembler::vpsrlq(XMMRegister dst, XMMRegister src, XMMRegister shift, int vector_len) {
   assert(UseAVX > 0, "requires some form of AVX");
-  InstructionAttr attributes(vector_len, /* vex_w */ VM_Version::supports_evex(), /* legacy_mode */ false, /* no_mask_reg */ false, /* uses_vl */ true);
+  InstructionAttr attributes(vector_len, /* vex_w */ VM_Version::supports_evex(), /* legacy_mode */ false, /* no_mask_reg */ true, /* uses_vl */ true);
   attributes.set_rex_vex_w_reverted();
   int encode = vex_prefix_and_encode(dst->encoding(), src->encoding(), shift->encoding(), VEX_SIMD_66, VEX_OPCODE_0F, &attributes);
   emit_int8((unsigned char)0xD3);
@@ -6146,7 +6138,7 @@
 
 void Assembler::evpsrlvw(XMMRegister dst, XMMRegister nds, XMMRegister src, int vector_len) {
   assert(VM_Version::supports_avx512bw(), "");
-  InstructionAttr attributes(vector_len, /* vex_w */ true, /* legacy_mode */ false, /* no_mask_reg */ false, /* uses_vl */ true);
+  InstructionAttr attributes(vector_len, /* vex_w */ true, /* legacy_mode */ false, /* no_mask_reg */ true, /* uses_vl */ true);
   attributes.set_is_evex_instruction();
   int encode = vex_prefix_and_encode(dst->encoding(), nds->encoding(), src->encoding(), VEX_SIMD_66, VEX_OPCODE_0F_38, &attributes);
   emit_int8(0x10);
@@ -6155,7 +6147,7 @@
 
 void Assembler::evpsllvw(XMMRegister dst, XMMRegister nds, XMMRegister src, int vector_len) {
   assert(VM_Version::supports_avx512bw(), "");
-  InstructionAttr attributes(vector_len, /* rex_w */ true, /* legacy_mode */ false, /* no_mask_reg */ false, /* uses_vl */ true);
+  InstructionAttr attributes(vector_len, /* rex_w */ true, /* legacy_mode */ false, /* no_mask_reg */ true, /* uses_vl */ true);
   attributes.set_is_evex_instruction();
   int encode = vex_prefix_and_encode(dst->encoding(), nds->encoding(), src->encoding(), VEX_SIMD_66, VEX_OPCODE_0F_38, &attributes);
   emit_int8(0x12);
@@ -6175,7 +6167,7 @@
 
 void Assembler::psrad(XMMRegister dst, int shift) {
   NOT_LP64(assert(VM_Version::supports_sse2(), ""));
-  InstructionAttr attributes(AVX_128bit, /* rex_w */ false, /* legacy_mode */ false, /* no_mask_reg */ false, /* uses_vl */ true);
+  InstructionAttr attributes(AVX_128bit, /* rex_w */ false, /* legacy_mode */ false, /* no_mask_reg */ true, /* uses_vl */ true);
   // XMM4 is for /4 encoding: 66 0F 72 /4 ib
   int encode = simd_prefix_and_encode(xmm4, dst, dst, VEX_SIMD_66, VEX_OPCODE_0F, &attributes);
   emit_int8(0x72);
@@ -6193,7 +6185,7 @@
 
 void Assembler::psrad(XMMRegister dst, XMMRegister shift) {
   NOT_LP64(assert(VM_Version::supports_sse2(), ""));
-  InstructionAttr attributes(AVX_128bit, /* rex_w */ false, /* legacy_mode */ false, /* no_mask_reg */ false, /* uses_vl */ true);
+  InstructionAttr attributes(AVX_128bit, /* rex_w */ false, /* legacy_mode */ false, /* no_mask_reg */ true, /* uses_vl */ true);
   int encode = simd_prefix_and_encode(dst, dst, shift, VEX_SIMD_66, VEX_OPCODE_0F, &attributes);
   emit_int8((unsigned char)0xE2);
   emit_int8((unsigned char)(0xC0 | encode));
@@ -6211,7 +6203,7 @@
 
 void Assembler::vpsrad(XMMRegister dst, XMMRegister src, int shift, int vector_len) {
   assert(UseAVX > 0, "requires some form of AVX");
-  InstructionAttr attributes(vector_len, /* vex_w */ false, /* legacy_mode */ false, /* no_mask_reg */ false, /* uses_vl */ true);
+  InstructionAttr attributes(vector_len, /* vex_w */ false, /* legacy_mode */ false, /* no_mask_reg */ true, /* uses_vl */ true);
   // XMM4 is for /4 encoding: 66 0F 71 /4 ib
   int encode = vex_prefix_and_encode(xmm4->encoding(), dst->encoding(), src->encoding(), VEX_SIMD_66, VEX_OPCODE_0F, &attributes);
   emit_int8(0x72);
@@ -6229,7 +6221,7 @@
 
 void Assembler::vpsrad(XMMRegister dst, XMMRegister src, XMMRegister shift, int vector_len) {
   assert(UseAVX > 0, "requires some form of AVX");
-  InstructionAttr attributes(vector_len, /* vex_w */ false, /* legacy_mode */ false, /* no_mask_reg */ false, /* uses_vl */ true);
+  InstructionAttr attributes(vector_len, /* vex_w */ false, /* legacy_mode */ false, /* no_mask_reg */ true, /* uses_vl */ true);
   int encode = vex_prefix_and_encode(dst->encoding(), src->encoding(), shift->encoding(), VEX_SIMD_66, VEX_OPCODE_0F, &attributes);
   emit_int8((unsigned char)0xE2);
   emit_int8((unsigned char)(0xC0 | encode));
@@ -6239,7 +6231,7 @@
 // logical operations packed integers
 void Assembler::pand(XMMRegister dst, XMMRegister src) {
   NOT_LP64(assert(VM_Version::supports_sse2(), ""));
-  InstructionAttr attributes(AVX_128bit, /* rex_w */ false, /* legacy_mode */ false, /* no_mask_reg */ false, /* uses_vl */ true);
+  InstructionAttr attributes(AVX_128bit, /* rex_w */ false, /* legacy_mode */ false, /* no_mask_reg */ true, /* uses_vl */ true);
   int encode = simd_prefix_and_encode(dst, dst, src, VEX_SIMD_66, VEX_OPCODE_0F, &attributes);
   emit_int8((unsigned char)0xDB);
   emit_int8((unsigned char)(0xC0 | encode));
@@ -6247,7 +6239,7 @@
 
 void Assembler::vpand(XMMRegister dst, XMMRegister nds, XMMRegister src, int vector_len) {
   assert(UseAVX > 0, "requires some form of AVX");
-  InstructionAttr attributes(vector_len, /* vex_w */ false, /* legacy_mode */ false, /* no_mask_reg */ false, /* uses_vl */ true);
+  InstructionAttr attributes(vector_len, /* vex_w */ false, /* legacy_mode */ false, /* no_mask_reg */ true, /* uses_vl */ true);
   int encode = vex_prefix_and_encode(dst->encoding(), nds->encoding(), src->encoding(), VEX_SIMD_66, VEX_OPCODE_0F, &attributes);
   emit_int8((unsigned char)0xDB);
   emit_int8((unsigned char)(0xC0 | encode));
@@ -6256,7 +6248,7 @@
 void Assembler::vpand(XMMRegister dst, XMMRegister nds, Address src, int vector_len) {
   assert(UseAVX > 0, "requires some form of AVX");
   InstructionMark im(this);
-  InstructionAttr attributes(vector_len, /* vex_w */ false, /* legacy_mode */ false, /* no_mask_reg */ false, /* uses_vl */ true);
+  InstructionAttr attributes(vector_len, /* vex_w */ false, /* legacy_mode */ false, /* no_mask_reg */ true, /* uses_vl */ true);
   attributes.set_address_attributes(/* tuple_type */ EVEX_FV, /* input_size_in_bits */ EVEX_32bit);
   vex_prefix(src, nds->encoding(), dst->encoding(), VEX_SIMD_66, VEX_OPCODE_0F, &attributes);
   emit_int8((unsigned char)0xDB);
@@ -6265,7 +6257,7 @@
 
 void Assembler::vpandq(XMMRegister dst, XMMRegister nds, XMMRegister src, int vector_len) {
   assert(VM_Version::supports_evex(), "");
-  InstructionAttr attributes(vector_len, /* vex_w */ true, /* legacy_mode */ false, /* no_mask_reg */ false, /* uses_vl */ true);
+  InstructionAttr attributes(vector_len, /* vex_w */ true, /* legacy_mode */ false, /* no_mask_reg */ true, /* uses_vl */ true);
   int encode = vex_prefix_and_encode(dst->encoding(), nds->encoding(), src->encoding(), VEX_SIMD_66, VEX_OPCODE_0F, &attributes);
   emit_int8((unsigned char)0xDB);
   emit_int8((unsigned char)(0xC0 | encode));
@@ -6274,7 +6266,7 @@
 
 void Assembler::pandn(XMMRegister dst, XMMRegister src) {
   NOT_LP64(assert(VM_Version::supports_sse2(), ""));
-  InstructionAttr attributes(AVX_128bit, /* vex_w */ VM_Version::supports_evex(), /* legacy_mode */ false, /* no_mask_reg */ false, /* uses_vl */ true);
+  InstructionAttr attributes(AVX_128bit, /* vex_w */ VM_Version::supports_evex(), /* legacy_mode */ false, /* no_mask_reg */ true, /* uses_vl */ true);
   attributes.set_rex_vex_w_reverted();
   int encode = simd_prefix_and_encode(dst, dst, src, VEX_SIMD_66, VEX_OPCODE_0F, &attributes);
   emit_int8((unsigned char)0xDF);
@@ -6283,7 +6275,7 @@
 
 void Assembler::vpandn(XMMRegister dst, XMMRegister nds, XMMRegister src, int vector_len) {
   assert(UseAVX > 0, "requires some form of AVX");
-  InstructionAttr attributes(vector_len, /* vex_w */ false, /* legacy_mode */ false, /* no_mask_reg */ false, /* uses_vl */ true);
+  InstructionAttr attributes(vector_len, /* vex_w */ false, /* legacy_mode */ false, /* no_mask_reg */ true, /* uses_vl */ true);
   int encode = vex_prefix_and_encode(dst->encoding(), nds->encoding(), src->encoding(), VEX_SIMD_66, VEX_OPCODE_0F, &attributes);
   emit_int8((unsigned char)0xDF);
   emit_int8((unsigned char)(0xC0 | encode));
@@ -6292,7 +6284,7 @@
 
 void Assembler::por(XMMRegister dst, XMMRegister src) {
   NOT_LP64(assert(VM_Version::supports_sse2(), ""));
-  InstructionAttr attributes(AVX_128bit, /* vex_w */ false, /* legacy_mode */ false, /* no_mask_reg */ false, /* uses_vl */ true);
+  InstructionAttr attributes(AVX_128bit, /* vex_w */ false, /* legacy_mode */ false, /* no_mask_reg */ true, /* uses_vl */ true);
   int encode = simd_prefix_and_encode(dst, dst, src, VEX_SIMD_66, VEX_OPCODE_0F, &attributes);
   emit_int8((unsigned char)0xEB);
   emit_int8((unsigned char)(0xC0 | encode));
@@ -6300,7 +6292,7 @@
 
 void Assembler::vpor(XMMRegister dst, XMMRegister nds, XMMRegister src, int vector_len) {
   assert(UseAVX > 0, "requires some form of AVX");
-  InstructionAttr attributes(vector_len, /* vex_w */ false, /* legacy_mode */ false, /* no_mask_reg */ false, /* uses_vl */ true);
+  InstructionAttr attributes(vector_len, /* vex_w */ false, /* legacy_mode */ false, /* no_mask_reg */ true, /* uses_vl */ true);
   int encode = vex_prefix_and_encode(dst->encoding(), nds->encoding(), src->encoding(), VEX_SIMD_66, VEX_OPCODE_0F, &attributes);
   emit_int8((unsigned char)0xEB);
   emit_int8((unsigned char)(0xC0 | encode));
@@ -6309,7 +6301,7 @@
 void Assembler::vpor(XMMRegister dst, XMMRegister nds, Address src, int vector_len) {
   assert(UseAVX > 0, "requires some form of AVX");
   InstructionMark im(this);
-  InstructionAttr attributes(vector_len, /* vex_w */ false, /* legacy_mode */ false, /* no_mask_reg */ false, /* uses_vl */ true);
+  InstructionAttr attributes(vector_len, /* vex_w */ false, /* legacy_mode */ false, /* no_mask_reg */ true, /* uses_vl */ true);
   attributes.set_address_attributes(/* tuple_type */ EVEX_FV, /* input_size_in_bits */ EVEX_32bit);
   vex_prefix(src, nds->encoding(), dst->encoding(), VEX_SIMD_66, VEX_OPCODE_0F, &attributes);
   emit_int8((unsigned char)0xEB);
@@ -6318,7 +6310,7 @@
 
 void Assembler::vporq(XMMRegister dst, XMMRegister nds, XMMRegister src, int vector_len) {
   assert(VM_Version::supports_evex(), "");
-  InstructionAttr attributes(vector_len, /* vex_w */ true, /* legacy_mode */ false, /* no_mask_reg */ false, /* uses_vl */ true);
+  InstructionAttr attributes(vector_len, /* vex_w */ true, /* legacy_mode */ false, /* no_mask_reg */ true, /* uses_vl */ true);
   int encode = vex_prefix_and_encode(dst->encoding(), nds->encoding(), src->encoding(), VEX_SIMD_66, VEX_OPCODE_0F, &attributes);
   emit_int8((unsigned char)0xEB);
   emit_int8((unsigned char)(0xC0 | encode));
@@ -6327,7 +6319,7 @@
 
 void Assembler::pxor(XMMRegister dst, XMMRegister src) {
   NOT_LP64(assert(VM_Version::supports_sse2(), ""));
-  InstructionAttr attributes(AVX_128bit, /* rex_w */ false, /* legacy_mode */ false, /* no_mask_reg */ false, /* uses_vl */ true);
+  InstructionAttr attributes(AVX_128bit, /* rex_w */ false, /* legacy_mode */ false, /* no_mask_reg */ true, /* uses_vl */ true);
   int encode = simd_prefix_and_encode(dst, dst, src, VEX_SIMD_66, VEX_OPCODE_0F, &attributes);
   emit_int8((unsigned char)0xEF);
   emit_int8((unsigned char)(0xC0 | encode));
@@ -6335,7 +6327,7 @@
 
 void Assembler::vpxor(XMMRegister dst, XMMRegister nds, XMMRegister src, int vector_len) {
   assert(UseAVX > 0, "requires some form of AVX");
-  InstructionAttr attributes(vector_len, /* vex_w */ false, /* legacy_mode */ false, /* no_mask_reg */ false, /* uses_vl */ true);
+  InstructionAttr attributes(vector_len, /* vex_w */ false, /* legacy_mode */ false, /* no_mask_reg */ true, /* uses_vl */ true);
   int encode = vex_prefix_and_encode(dst->encoding(), nds->encoding(), src->encoding(), VEX_SIMD_66, VEX_OPCODE_0F, &attributes);
   emit_int8((unsigned char)0xEF);
   emit_int8((unsigned char)(0xC0 | encode));
@@ -6344,7 +6336,7 @@
 void Assembler::vpxor(XMMRegister dst, XMMRegister nds, Address src, int vector_len) {
   assert(UseAVX > 0, "requires some form of AVX");
   InstructionMark im(this);
-  InstructionAttr attributes(vector_len, /* vex_w */ false, /* legacy_mode */ false, /* no_mask_reg */ false, /* uses_vl */ true);
+  InstructionAttr attributes(vector_len, /* vex_w */ false, /* legacy_mode */ false, /* no_mask_reg */ true, /* uses_vl */ true);
   attributes.set_address_attributes(/* tuple_type */ EVEX_FV, /* input_size_in_bits */ EVEX_32bit);
   vex_prefix(src, nds->encoding(), dst->encoding(), VEX_SIMD_66, VEX_OPCODE_0F, &attributes);
   emit_int8((unsigned char)0xEF);
@@ -6378,7 +6370,7 @@
 void Assembler::vinserti128(XMMRegister dst, XMMRegister nds, XMMRegister src, uint8_t imm8) {
   assert(VM_Version::supports_avx2(), "");
   assert(imm8 <= 0x01, "imm8: %u", imm8);
-  InstructionAttr attributes(AVX_256bit, /* vex_w */ false, /* legacy_mode */ false, /* no_mask_reg */ false, /* uses_vl */ true);
+  InstructionAttr attributes(AVX_256bit, /* vex_w */ false, /* legacy_mode */ false, /* no_mask_reg */ true, /* uses_vl */ true);
   int encode = vex_prefix_and_encode(dst->encoding(), nds->encoding(), src->encoding(), VEX_SIMD_66, VEX_OPCODE_0F_3A, &attributes);
   emit_int8(0x38);
   emit_int8((unsigned char)(0xC0 | encode));
@@ -6392,7 +6384,7 @@
   assert(dst != xnoreg, "sanity");
   assert(imm8 <= 0x01, "imm8: %u", imm8);
   InstructionMark im(this);
-  InstructionAttr attributes(AVX_256bit, /* vex_w */ false, /* legacy_mode */ false, /* no_mask_reg */ false, /* uses_vl */ true);
+  InstructionAttr attributes(AVX_256bit, /* vex_w */ false, /* legacy_mode */ false, /* no_mask_reg */ true, /* uses_vl */ true);
   attributes.set_address_attributes(/* tuple_type */ EVEX_T4, /* input_size_in_bits */ EVEX_32bit);
   vex_prefix(src, nds->encoding(), dst->encoding(), VEX_SIMD_66, VEX_OPCODE_0F_3A, &attributes);
   emit_int8(0x38);
@@ -6405,7 +6397,7 @@
 void Assembler::vinserti32x4(XMMRegister dst, XMMRegister nds, XMMRegister src, uint8_t imm8) {
   assert(VM_Version::supports_evex(), "");
   assert(imm8 <= 0x03, "imm8: %u", imm8);
-  InstructionAttr attributes(AVX_512bit, /* vex_w */ false, /* legacy_mode */ false, /* no_mask_reg */ false, /* uses_vl */ true);
+  InstructionAttr attributes(AVX_512bit, /* vex_w */ false, /* legacy_mode */ false, /* no_mask_reg */ true, /* uses_vl */ true);
   attributes.set_is_evex_instruction();
   int encode = vex_prefix_and_encode(dst->encoding(), nds->encoding(), src->encoding(), VEX_SIMD_66, VEX_OPCODE_0F_3A, &attributes);
   emit_int8(0x38);
@@ -6422,7 +6414,7 @@
   assert(dst != xnoreg, "sanity");
   assert(imm8 <= 0x03, "imm8: %u", imm8);
   InstructionMark im(this);
-  InstructionAttr attributes(AVX_512bit, /* vex_w */ false, /* legacy_mode */ false, /* no_mask_reg */ false, /* uses_vl */ true);
+  InstructionAttr attributes(AVX_512bit, /* vex_w */ false, /* legacy_mode */ false, /* no_mask_reg */ true, /* uses_vl */ true);
   attributes.set_address_attributes(/* tuple_type */ EVEX_T4, /* input_size_in_bits */ EVEX_32bit);
   attributes.set_is_evex_instruction();
   vex_prefix(src, nds->encoding(), dst->encoding(), VEX_SIMD_66, VEX_OPCODE_0F_3A, &attributes);
@@ -6438,7 +6430,7 @@
 void Assembler::vinserti64x4(XMMRegister dst, XMMRegister nds, XMMRegister src, uint8_t imm8) {
   assert(VM_Version::supports_evex(), "");
   assert(imm8 <= 0x01, "imm8: %u", imm8);
-  InstructionAttr attributes(AVX_512bit, /* vex_w */ true, /* legacy_mode */ false, /* no_mask_reg */ false, /* uses_vl */ true);
+  InstructionAttr attributes(AVX_512bit, /* vex_w */ true, /* legacy_mode */ false, /* no_mask_reg */ true, /* uses_vl */ true);
   attributes.set_is_evex_instruction();
   int encode = vex_prefix_and_encode(dst->encoding(), nds->encoding(), src->encoding(), VEX_SIMD_66, VEX_OPCODE_0F_3A, &attributes);
   emit_int8(0x3A);
@@ -6454,7 +6446,7 @@
 void Assembler::vinsertf128(XMMRegister dst, XMMRegister nds, XMMRegister src, uint8_t imm8) {
   assert(VM_Version::supports_avx(), "");
   assert(imm8 <= 0x01, "imm8: %u", imm8);
-  InstructionAttr attributes(AVX_256bit, /* vex_w */ false, /* legacy_mode */ false, /* no_mask_reg */ false, /* uses_vl */ true);
+  InstructionAttr attributes(AVX_256bit, /* vex_w */ false, /* legacy_mode */ false, /* no_mask_reg */ true, /* uses_vl */ true);
   int encode = vex_prefix_and_encode(dst->encoding(), nds->encoding(), src->encoding(), VEX_SIMD_66, VEX_OPCODE_0F_3A, &attributes);
   emit_int8(0x18);
   emit_int8((unsigned char)(0xC0 | encode));
@@ -6468,7 +6460,7 @@
   assert(dst != xnoreg, "sanity");
   assert(imm8 <= 0x01, "imm8: %u", imm8);
   InstructionMark im(this);
-  InstructionAttr attributes(AVX_256bit, /* vex_w */ false, /* legacy_mode */ false, /* no_mask_reg */ false, /* uses_vl */ true);
+  InstructionAttr attributes(AVX_256bit, /* vex_w */ false, /* legacy_mode */ false, /* no_mask_reg */ true, /* uses_vl */ true);
   attributes.set_address_attributes(/* tuple_type */ EVEX_T4, /* input_size_in_bits */ EVEX_32bit);
   vex_prefix(src, nds->encoding(), dst->encoding(), VEX_SIMD_66, VEX_OPCODE_0F_3A, &attributes);
   emit_int8(0x18);
@@ -6481,7 +6473,7 @@
 void Assembler::vinsertf32x4(XMMRegister dst, XMMRegister nds, XMMRegister src, uint8_t imm8) {
   assert(VM_Version::supports_avx2(), "");
   assert(imm8 <= 0x03, "imm8: %u", imm8);
-  InstructionAttr attributes(AVX_512bit, /* vex_w */ false, /* legacy_mode */ false, /* no_mask_reg */ false, /* uses_vl */ true);
+  InstructionAttr attributes(AVX_512bit, /* vex_w */ false, /* legacy_mode */ false, /* no_mask_reg */ true, /* uses_vl */ true);
   int encode = vex_prefix_and_encode(dst->encoding(), nds->encoding(), src->encoding(), VEX_SIMD_66, VEX_OPCODE_0F_3A, &attributes);
   emit_int8(0x18);
   emit_int8((unsigned char)(0xC0 | encode));
@@ -6497,7 +6489,7 @@
   assert(dst != xnoreg, "sanity");
   assert(imm8 <= 0x03, "imm8: %u", imm8);
   InstructionMark im(this);
-  InstructionAttr attributes(AVX_512bit, /* vex_w */ false, /* legacy_mode */ false, /* no_mask_reg */ false, /* uses_vl */ true);
+  InstructionAttr attributes(AVX_512bit, /* vex_w */ false, /* legacy_mode */ false, /* no_mask_reg */ true, /* uses_vl */ true);
   attributes.set_address_attributes(/* tuple_type */ EVEX_T4, /* input_size_in_bits */ EVEX_32bit);
   vex_prefix(src, nds->encoding(), dst->encoding(), VEX_SIMD_66, VEX_OPCODE_0F_3A, &attributes);
   emit_int8(0x18);
@@ -6512,7 +6504,7 @@
 void Assembler::vinsertf64x4(XMMRegister dst, XMMRegister nds, XMMRegister src, uint8_t imm8) {
   assert(VM_Version::supports_evex(), "");
   assert(imm8 <= 0x01, "imm8: %u", imm8);
-  InstructionAttr attributes(AVX_512bit, /* vex_w */ true, /* legacy_mode */ false, /* no_mask_reg */ false, /* uses_vl */ true);
+  InstructionAttr attributes(AVX_512bit, /* vex_w */ true, /* legacy_mode */ false, /* no_mask_reg */ true, /* uses_vl */ true);
   attributes.set_is_evex_instruction();
   int encode = vex_prefix_and_encode(dst->encoding(), nds->encoding(), src->encoding(), VEX_SIMD_66, VEX_OPCODE_0F_3A, &attributes);
   emit_int8(0x1A);
@@ -6527,7 +6519,7 @@
   assert(dst != xnoreg, "sanity");
   assert(imm8 <= 0x01, "imm8: %u", imm8);
   InstructionMark im(this);
-  InstructionAttr attributes(AVX_512bit, /* vex_w */ true, /* legacy_mode */ false, /* no_mask_reg */ false, /* uses_vl */ true);
+  InstructionAttr attributes(AVX_512bit, /* vex_w */ true, /* legacy_mode */ false, /* no_mask_reg */ true, /* uses_vl */ true);
   attributes.set_address_attributes(/* tuple_type */ EVEX_T4, /* input_size_in_bits */ EVEX_64bit);
   attributes.set_is_evex_instruction();
   vex_prefix(src, nds->encoding(), dst->encoding(), VEX_SIMD_66, VEX_OPCODE_0F_3A, &attributes);
@@ -6544,7 +6536,7 @@
 void Assembler::vextracti128(XMMRegister dst, XMMRegister src, uint8_t imm8) {
   assert(VM_Version::supports_avx2(), "");
   assert(imm8 <= 0x01, "imm8: %u", imm8);
-  InstructionAttr attributes(AVX_256bit, /* vex_w */ false, /* legacy_mode */ false, /* no_mask_reg */ false, /* uses_vl */ true);
+  InstructionAttr attributes(AVX_256bit, /* vex_w */ false, /* legacy_mode */ false, /* no_mask_reg */ true, /* uses_vl */ true);
   int encode = vex_prefix_and_encode(src->encoding(), 0, dst->encoding(), VEX_SIMD_66, VEX_OPCODE_0F_3A, &attributes);
   emit_int8(0x39);
   emit_int8((unsigned char)(0xC0 | encode));
@@ -6558,7 +6550,7 @@
   assert(src != xnoreg, "sanity");
   assert(imm8 <= 0x01, "imm8: %u", imm8);
   InstructionMark im(this);
-  InstructionAttr attributes(AVX_256bit, /* vex_w */ false, /* legacy_mode */ false, /* no_mask_reg */ false, /* uses_vl */ true);
+  InstructionAttr attributes(AVX_256bit, /* vex_w */ false, /* legacy_mode */ false, /* no_mask_reg */ true, /* uses_vl */ true);
   attributes.set_address_attributes(/* tuple_type */ EVEX_T4, /* input_size_in_bits */ EVEX_32bit);
   attributes.reset_is_clear_context();
   vex_prefix(dst, 0, src->encoding(), VEX_SIMD_66, VEX_OPCODE_0F_3A, &attributes);
@@ -6572,7 +6564,7 @@
 void Assembler::vextracti32x4(XMMRegister dst, XMMRegister src, uint8_t imm8) {
   assert(VM_Version::supports_evex(), "");
   assert(imm8 <= 0x03, "imm8: %u", imm8);
-  InstructionAttr attributes(AVX_512bit, /* vex_w */ false, /* legacy_mode */ false, /* no_mask_reg */ false, /* uses_vl */ true);
+  InstructionAttr attributes(AVX_512bit, /* vex_w */ false, /* legacy_mode */ false, /* no_mask_reg */ true, /* uses_vl */ true);
   attributes.set_is_evex_instruction();
   int encode = vex_prefix_and_encode(src->encoding(), 0, dst->encoding(), VEX_SIMD_66, VEX_OPCODE_0F_3A, &attributes);
   emit_int8(0x39);
@@ -6589,7 +6581,7 @@
   assert(src != xnoreg, "sanity");
   assert(imm8 <= 0x03, "imm8: %u", imm8);
   InstructionMark im(this);
-  InstructionAttr attributes(AVX_512bit, /* vex_w */ false, /* legacy_mode */ false, /* no_mask_reg */ false, /* uses_vl */ true);
+  InstructionAttr attributes(AVX_512bit, /* vex_w */ false, /* legacy_mode */ false, /* no_mask_reg */ true, /* uses_vl */ true);
   attributes.set_address_attributes(/* tuple_type */ EVEX_T4, /* input_size_in_bits */ EVEX_32bit);
   attributes.reset_is_clear_context();
   attributes.set_is_evex_instruction();
@@ -6606,7 +6598,7 @@
 void Assembler::vextracti64x2(XMMRegister dst, XMMRegister src, uint8_t imm8) {
   assert(VM_Version::supports_avx512dq(), "");
   assert(imm8 <= 0x03, "imm8: %u", imm8);
-  InstructionAttr attributes(AVX_512bit, /* vex_w */ true, /* legacy_mode */ false, /* no_mask_reg */ false, /* uses_vl */ true);
+  InstructionAttr attributes(AVX_512bit, /* vex_w */ true, /* legacy_mode */ false, /* no_mask_reg */ true, /* uses_vl */ true);
   attributes.set_is_evex_instruction();
   int encode = vex_prefix_and_encode(src->encoding(), 0, dst->encoding(), VEX_SIMD_66, VEX_OPCODE_0F_3A, &attributes);
   emit_int8(0x39);
@@ -6621,7 +6613,7 @@
 void Assembler::vextracti64x4(XMMRegister dst, XMMRegister src, uint8_t imm8) {
   assert(VM_Version::supports_evex(), "");
   assert(imm8 <= 0x01, "imm8: %u", imm8);
-  InstructionAttr attributes(AVX_512bit, /* vex_w */ true, /* legacy_mode */ false, /* no_mask_reg */ false, /* uses_vl */ true);
+  InstructionAttr attributes(AVX_512bit, /* vex_w */ true, /* legacy_mode */ false, /* no_mask_reg */ true, /* uses_vl */ true);
   attributes.set_is_evex_instruction();
   int encode = vex_prefix_and_encode(src->encoding(), 0, dst->encoding(), VEX_SIMD_66, VEX_OPCODE_0F_3A, &attributes);
   emit_int8(0x3B);
@@ -6636,7 +6628,7 @@
   assert(src != xnoreg, "sanity");
   assert(imm8 <= 0x01, "imm8: %u", imm8);
   InstructionMark im(this);
-  InstructionAttr attributes(AVX_512bit, /* vex_w */ true, /* legacy_mode */ false, /* no_mask_reg */ false, /* uses_vl */ true);
+  InstructionAttr attributes(AVX_512bit, /* vex_w */ true, /* legacy_mode */ false, /* no_mask_reg */ true, /* uses_vl */ true);
   attributes.set_address_attributes(/* tuple_type */ EVEX_T4, /* input_size_in_bits */ EVEX_64bit);
   attributes.reset_is_clear_context();
   attributes.set_is_evex_instruction();
@@ -6652,7 +6644,7 @@
 void Assembler::vextractf128(XMMRegister dst, XMMRegister src, uint8_t imm8) {
   assert(VM_Version::supports_avx(), "");
   assert(imm8 <= 0x01, "imm8: %u", imm8);
-  InstructionAttr attributes(AVX_256bit, /* vex_w */ false, /* legacy_mode */ false, /* no_mask_reg */ false, /* uses_vl */ true);
+  InstructionAttr attributes(AVX_256bit, /* vex_w */ false, /* legacy_mode */ false, /* no_mask_reg */ true, /* uses_vl */ true);
   int encode = vex_prefix_and_encode(src->encoding(), 0, dst->encoding(), VEX_SIMD_66, VEX_OPCODE_0F_3A, &attributes);
   emit_int8(0x19);
   emit_int8((unsigned char)(0xC0 | encode));
@@ -6666,7 +6658,7 @@
   assert(src != xnoreg, "sanity");
   assert(imm8 <= 0x01, "imm8: %u", imm8);
   InstructionMark im(this);
-  InstructionAttr attributes(AVX_256bit, /* vex_w */ false, /* legacy_mode */ false, /* no_mask_reg */ false, /* uses_vl */ true);
+  InstructionAttr attributes(AVX_256bit, /* vex_w */ false, /* legacy_mode */ false, /* no_mask_reg */ true, /* uses_vl */ true);
   attributes.set_address_attributes(/* tuple_type */ EVEX_T4, /* input_size_in_bits */ EVEX_32bit);
   attributes.reset_is_clear_context();
   vex_prefix(dst, 0, src->encoding(), VEX_SIMD_66, VEX_OPCODE_0F_3A, &attributes);
@@ -6680,7 +6672,7 @@
 void Assembler::vextractf32x4(XMMRegister dst, XMMRegister src, uint8_t imm8) {
   assert(VM_Version::supports_evex(), "");
   assert(imm8 <= 0x03, "imm8: %u", imm8);
-  InstructionAttr attributes(AVX_512bit, /* vex_w */ false, /* legacy_mode */ false, /* no_mask_reg */ false, /* uses_vl */ true);
+  InstructionAttr attributes(AVX_512bit, /* vex_w */ false, /* legacy_mode */ false, /* no_mask_reg */ true, /* uses_vl */ true);
   attributes.set_is_evex_instruction();
   int encode = vex_prefix_and_encode(src->encoding(), 0, dst->encoding(), VEX_SIMD_66, VEX_OPCODE_0F_3A, &attributes);
   emit_int8(0x19);
@@ -6697,7 +6689,7 @@
   assert(src != xnoreg, "sanity");
   assert(imm8 <= 0x03, "imm8: %u", imm8);
   InstructionMark im(this);
-  InstructionAttr attributes(AVX_512bit, /* vex_w */ false, /* legacy_mode */ false, /* no_mask_reg */ false, /* uses_vl */ true);
+  InstructionAttr attributes(AVX_512bit, /* vex_w */ false, /* legacy_mode */ false, /* no_mask_reg */ true, /* uses_vl */ true);
   attributes.set_address_attributes(/* tuple_type */ EVEX_T4, /* input_size_in_bits */ EVEX_32bit);
   attributes.reset_is_clear_context();
   attributes.set_is_evex_instruction();
@@ -6714,7 +6706,7 @@
 void Assembler::vextractf64x2(XMMRegister dst, XMMRegister src, uint8_t imm8) {
   assert(VM_Version::supports_avx512dq(), "");
   assert(imm8 <= 0x03, "imm8: %u", imm8);
-  InstructionAttr attributes(AVX_512bit, /* vex_w */ true, /* legacy_mode */ false, /* no_mask_reg */ false, /* uses_vl */ true);
+  InstructionAttr attributes(AVX_512bit, /* vex_w */ true, /* legacy_mode */ false, /* no_mask_reg */ true, /* uses_vl */ true);
   attributes.set_is_evex_instruction();
   int encode = vex_prefix_and_encode(src->encoding(), 0, dst->encoding(), VEX_SIMD_66, VEX_OPCODE_0F_3A, &attributes);
   emit_int8(0x19);
@@ -6729,7 +6721,7 @@
 void Assembler::vextractf64x4(XMMRegister dst, XMMRegister src, uint8_t imm8) {
   assert(VM_Version::supports_evex(), "");
   assert(imm8 <= 0x01, "imm8: %u", imm8);
-  InstructionAttr attributes(AVX_512bit, /* vex_w */ true, /* legacy_mode */ false, /* no_mask_reg */ false, /* uses_vl */ true);
+  InstructionAttr attributes(AVX_512bit, /* vex_w */ true, /* legacy_mode */ false, /* no_mask_reg */ true, /* uses_vl */ true);
   attributes.set_is_evex_instruction();
   int encode = vex_prefix_and_encode(src->encoding(), 0, dst->encoding(), VEX_SIMD_66, VEX_OPCODE_0F_3A, &attributes);
   emit_int8(0x1B);
@@ -6744,7 +6736,7 @@
   assert(src != xnoreg, "sanity");
   assert(imm8 <= 0x01, "imm8: %u", imm8);
   InstructionMark im(this);
-  InstructionAttr attributes(AVX_512bit, /* vex_w */ true, /* legacy_mode */ false, /* no_mask_reg */ false, /* uses_vl */ true);
+  InstructionAttr attributes(AVX_512bit, /* vex_w */ true, /* legacy_mode */ false, /* no_mask_reg */ true, /* uses_vl */ true);
   attributes.set_address_attributes(/* tuple_type */ EVEX_T4,/* input_size_in_bits */  EVEX_64bit);
   attributes.reset_is_clear_context();
   attributes.set_is_evex_instruction();
@@ -6803,7 +6795,7 @@
 // duplicate 4-byte integer data from src into programmed locations in dest : requires AVX512VL
 void Assembler::vpbroadcastd(XMMRegister dst, XMMRegister src, int vector_len) {
   assert(UseAVX >= 2, "");
-  InstructionAttr attributes(vector_len, /* vex_w */ false, /* legacy_mode */ false, /* no_mask_reg */ false, /* uses_vl */ true);
+  InstructionAttr attributes(vector_len, /* vex_w */ false, /* legacy_mode */ false, /* no_mask_reg */ true, /* uses_vl */ true);
   int encode = vex_prefix_and_encode(dst->encoding(), 0, src->encoding(), VEX_SIMD_66, VEX_OPCODE_0F_38, &attributes);
   emit_int8(0x58);
   emit_int8((unsigned char)(0xC0 | encode));
@@ -6813,7 +6805,7 @@
   assert(VM_Version::supports_avx2(), "");
   assert(dst != xnoreg, "sanity");
   InstructionMark im(this);
-  InstructionAttr attributes(vector_len, /* vex_w */ false, /* legacy_mode */ false, /* no_mask_reg */ false, /* uses_vl */ true);
+  InstructionAttr attributes(vector_len, /* vex_w */ false, /* legacy_mode */ false, /* no_mask_reg */ true, /* uses_vl */ true);
   attributes.set_address_attributes(/* tuple_type */ EVEX_T1S, /* input_size_in_bits */ EVEX_32bit);
   // swap src<->dst for encoding
   vex_prefix(src, 0, dst->encoding(), VEX_SIMD_66, VEX_OPCODE_0F_38, &attributes);
@@ -6824,7 +6816,7 @@
 // duplicate 8-byte integer data from src into programmed locations in dest : requires AVX512VL
 void Assembler::vpbroadcastq(XMMRegister dst, XMMRegister src, int vector_len) {
   assert(VM_Version::supports_avx2(), "");
-  InstructionAttr attributes(vector_len, /* vex_w */ VM_Version::supports_evex(), /* legacy_mode */ false, /* no_mask_reg */ false, /* uses_vl */ true);
+  InstructionAttr attributes(vector_len, /* vex_w */ VM_Version::supports_evex(), /* legacy_mode */ false, /* no_mask_reg */ true, /* uses_vl */ true);
   attributes.set_rex_vex_w_reverted();
   int encode = vex_prefix_and_encode(dst->encoding(), 0, src->encoding(), VEX_SIMD_66, VEX_OPCODE_0F_38, &attributes);
   emit_int8(0x59);
@@ -6835,7 +6827,7 @@
   assert(VM_Version::supports_avx2(), "");
   assert(dst != xnoreg, "sanity");
   InstructionMark im(this);
-  InstructionAttr attributes(vector_len, /* vex_w */ VM_Version::supports_evex(), /* legacy_mode */ false, /* no_mask_reg */ false, /* uses_vl */ true);
+  InstructionAttr attributes(vector_len, /* vex_w */ VM_Version::supports_evex(), /* legacy_mode */ false, /* no_mask_reg */ true, /* uses_vl */ true);
   attributes.set_rex_vex_w_reverted();
   attributes.set_address_attributes(/* tuple_type */ EVEX_T1S, /* input_size_in_bits */ EVEX_64bit);
   // swap src<->dst for encoding
@@ -6846,7 +6838,7 @@
 void Assembler::evbroadcasti64x2(XMMRegister dst, XMMRegister src, int vector_len) {
   assert(vector_len != Assembler::AVX_128bit, "");
   assert(VM_Version::supports_avx512dq(), "");
-  InstructionAttr attributes(vector_len, /* vex_w */ true, /* legacy_mode */ false, /* no_mask_reg */ false, /* uses_vl */ true);
+  InstructionAttr attributes(vector_len, /* vex_w */ true, /* legacy_mode */ false, /* no_mask_reg */ true, /* uses_vl */ true);
   attributes.set_rex_vex_w_reverted();
   int encode = vex_prefix_and_encode(dst->encoding(), 0, src->encoding(), VEX_SIMD_66, VEX_OPCODE_0F_38, &attributes);
   emit_int8(0x5A);
@@ -6858,7 +6850,7 @@
   assert(VM_Version::supports_avx512dq(), "");
   assert(dst != xnoreg, "sanity");
   InstructionMark im(this);
-  InstructionAttr attributes(vector_len, /* vex_w */ true, /* legacy_mode */ false, /* no_mask_reg */ false, /* uses_vl */ true);
+  InstructionAttr attributes(vector_len, /* vex_w */ true, /* legacy_mode */ false, /* no_mask_reg */ true, /* uses_vl */ true);
   attributes.set_rex_vex_w_reverted();
   attributes.set_address_attributes(/* tuple_type */ EVEX_T2, /* input_size_in_bits */ EVEX_64bit);
   // swap src<->dst for encoding
@@ -6872,7 +6864,7 @@
 // duplicate single precision data from src into programmed locations in dest : requires AVX512VL
 void Assembler::vpbroadcastss(XMMRegister dst, XMMRegister src, int vector_len) {
   assert(VM_Version::supports_avx(), "");
-  InstructionAttr attributes(vector_len, /* vex_w */ false, /* legacy_mode */ false, /* no_mask_reg */ false, /* uses_vl */ true);
+  InstructionAttr attributes(vector_len, /* vex_w */ false, /* legacy_mode */ false, /* no_mask_reg */ true, /* uses_vl */ true);
   int encode = vex_prefix_and_encode(dst->encoding(), 0, src->encoding(), VEX_SIMD_66, VEX_OPCODE_0F_38, &attributes);
   emit_int8(0x18);
   emit_int8((unsigned char)(0xC0 | encode));
@@ -6882,7 +6874,7 @@
   assert(VM_Version::supports_avx(), "");
   assert(dst != xnoreg, "sanity");
   InstructionMark im(this);
-  InstructionAttr attributes(vector_len, /* vex_w */ false, /* legacy_mode */ false, /* no_mask_reg */ false, /* uses_vl */ true);
+  InstructionAttr attributes(vector_len, /* vex_w */ false, /* legacy_mode */ false, /* no_mask_reg */ true, /* uses_vl */ true);
   attributes.set_address_attributes(/* tuple_type */ EVEX_T1S, /* input_size_in_bits */ EVEX_32bit);
   // swap src<->dst for encoding
   vex_prefix(src, 0, dst->encoding(), VEX_SIMD_66, VEX_OPCODE_0F_38, &attributes);
@@ -6893,7 +6885,7 @@
 // duplicate double precision data from src into programmed locations in dest : requires AVX512VL
 void Assembler::vpbroadcastsd(XMMRegister dst, XMMRegister src, int vector_len) {
   assert(VM_Version::supports_avx(), "");
-  InstructionAttr attributes(vector_len, /* vex_w */ VM_Version::supports_evex(), /* legacy_mode */ false, /* no_mask_reg */ false, /* uses_vl */ true);
+  InstructionAttr attributes(vector_len, /* vex_w */ VM_Version::supports_evex(), /* legacy_mode */ false, /* no_mask_reg */ true, /* uses_vl */ true);
   attributes.set_rex_vex_w_reverted();
   int encode = vex_prefix_and_encode(dst->encoding(), 0, src->encoding(), VEX_SIMD_66, VEX_OPCODE_0F_38, &attributes);
   emit_int8(0x19);
@@ -6904,7 +6896,7 @@
   assert(VM_Version::supports_avx(), "");
   assert(dst != xnoreg, "sanity");
   InstructionMark im(this);
-  InstructionAttr attributes(vector_len, /* vex_w */ VM_Version::supports_evex(), /* legacy_mode */ false, /* no_mask_reg */ false, /* uses_vl */ true);
+  InstructionAttr attributes(vector_len, /* vex_w */ VM_Version::supports_evex(), /* legacy_mode */ false, /* no_mask_reg */ true, /* uses_vl */ true);
   attributes.set_address_attributes(/* tuple_type */ EVEX_T1S, /* input_size_in_bits */ EVEX_64bit);
   attributes.set_rex_vex_w_reverted();
   // swap src<->dst for encoding
@@ -6939,7 +6931,7 @@
 // duplicate 4-byte integer data from src into programmed locations in dest : requires AVX512VL
 void Assembler::evpbroadcastd(XMMRegister dst, Register src, int vector_len) {
   assert(VM_Version::supports_evex(), "");
-  InstructionAttr attributes(vector_len, /* vex_w */ false, /* legacy_mode */ false, /* no_mask_reg */ false, /* uses_vl */ true);
+  InstructionAttr attributes(vector_len, /* vex_w */ false, /* legacy_mode */ false, /* no_mask_reg */ true, /* uses_vl */ true);
   attributes.set_is_evex_instruction();
   int encode = vex_prefix_and_encode(dst->encoding(), 0, src->encoding(), VEX_SIMD_66, VEX_OPCODE_0F_38, &attributes);
   emit_int8(0x7C);
@@ -6949,7 +6941,7 @@
 // duplicate 8-byte integer data from src into programmed locations in dest : requires AVX512VL
 void Assembler::evpbroadcastq(XMMRegister dst, Register src, int vector_len) {
   assert(VM_Version::supports_evex(), "");
-  InstructionAttr attributes(vector_len, /* vex_w */ true, /* legacy_mode */ false, /* no_mask_reg */ false, /* uses_vl */ true);
+  InstructionAttr attributes(vector_len, /* vex_w */ true, /* legacy_mode */ false, /* no_mask_reg */ true, /* uses_vl */ true);
   attributes.set_is_evex_instruction();
   int encode = vex_prefix_and_encode(dst->encoding(), 0, src->encoding(), VEX_SIMD_66, VEX_OPCODE_0F_38, &attributes);
   emit_int8(0x7C);
@@ -6974,7 +6966,7 @@
 // Carry-Less Multiplication Quadword
 void Assembler::pclmulqdq(XMMRegister dst, XMMRegister src, int mask) {
   assert(VM_Version::supports_clmul(), "");
-  InstructionAttr attributes(AVX_128bit, /* rex_w */ false, /* legacy_mode */ true, /* no_mask_reg */ false, /* uses_vl */ true);
+  InstructionAttr attributes(AVX_128bit, /* rex_w */ false, /* legacy_mode */ true, /* no_mask_reg */ true, /* uses_vl */ true);
   int encode = simd_prefix_and_encode(dst, dst, src, VEX_SIMD_66, VEX_OPCODE_0F_3A, &attributes);
   emit_int8(0x44);
   emit_int8((unsigned char)(0xC0 | encode));
@@ -6984,7 +6976,7 @@
 // Carry-Less Multiplication Quadword
 void Assembler::vpclmulqdq(XMMRegister dst, XMMRegister nds, XMMRegister src, int mask) {
   assert(VM_Version::supports_avx() && VM_Version::supports_clmul(), "");
-  InstructionAttr attributes(AVX_128bit, /* vex_w */ false, /* legacy_mode */ true, /* no_mask_reg */ false, /* uses_vl */ true);
+  InstructionAttr attributes(AVX_128bit, /* vex_w */ false, /* legacy_mode */ true, /* no_mask_reg */ true, /* uses_vl */ true);
   int encode = vex_prefix_and_encode(dst->encoding(), nds->encoding(), src->encoding(), VEX_SIMD_66, VEX_OPCODE_0F_3A, &attributes);
   emit_int8(0x44);
   emit_int8((unsigned char)(0xC0 | encode));
@@ -7575,7 +7567,7 @@
   emit_int8(byte3);
 
   // P2: byte 4 as zL'Lbv'aaa
-  // kregs are implemented in the low 3 bits as aaa (hard code k1, it will be initialized for now)
+  // kregs are implemented in the low 3 bits as aaa
   int byte4 = (_attributes->is_no_reg_mask()) ?
               0 :
               _attributes->get_embedded_opmask_register_specifier();
@@ -7726,7 +7718,7 @@
 void Assembler::cmppd(XMMRegister dst, XMMRegister nds, XMMRegister src, int cop, int vector_len) {
   assert(VM_Version::supports_avx(), "");
   assert(!VM_Version::supports_evex(), "");
-  InstructionAttr attributes(vector_len, /* vex_w */ false, /* legacy_mode */ true, /* no_mask_reg */ false, /* uses_vl */ true);
+  InstructionAttr attributes(vector_len, /* vex_w */ false, /* legacy_mode */ true, /* no_mask_reg */ true, /* uses_vl */ true);
   int encode = simd_prefix_and_encode(dst, nds, src, VEX_SIMD_66, VEX_OPCODE_0F, &attributes);
   emit_int8((unsigned char)0xC2);
   emit_int8((unsigned char)(0xC0 | encode));
@@ -7736,7 +7728,7 @@
 void Assembler::blendvpd(XMMRegister dst, XMMRegister nds, XMMRegister src1, XMMRegister src2, int vector_len) {
   assert(VM_Version::supports_avx(), "");
   assert(!VM_Version::supports_evex(), "");
-  InstructionAttr attributes(vector_len, /* vex_w */ false, /* legacy_mode */ true, /* no_mask_reg */ false, /* uses_vl */ true);
+  InstructionAttr attributes(vector_len, /* vex_w */ false, /* legacy_mode */ true, /* no_mask_reg */ true, /* uses_vl */ true);
   int encode = vex_prefix_and_encode(dst->encoding(), nds->encoding(), src1->encoding(), VEX_SIMD_66, VEX_OPCODE_0F_3A, &attributes);
   emit_int8((unsigned char)0x4B);
   emit_int8((unsigned char)(0xC0 | encode));
@@ -7747,7 +7739,7 @@
 void Assembler::cmpps(XMMRegister dst, XMMRegister nds, XMMRegister src, int cop, int vector_len) {
   assert(VM_Version::supports_avx(), "");
   assert(!VM_Version::supports_evex(), "");
-  InstructionAttr attributes(vector_len, /* vex_w */ false, /* legacy_mode */ true, /* no_mask_reg */ false, /* uses_vl */ true);
+  InstructionAttr attributes(vector_len, /* vex_w */ false, /* legacy_mode */ true, /* no_mask_reg */ true, /* uses_vl */ true);
   int encode = simd_prefix_and_encode(dst, nds, src, VEX_SIMD_NONE, VEX_OPCODE_0F, &attributes);
   emit_int8((unsigned char)0xC2);
   emit_int8((unsigned char)(0xC0 | encode));
@@ -7757,7 +7749,7 @@
 void Assembler::blendvps(XMMRegister dst, XMMRegister nds, XMMRegister src1, XMMRegister src2, int vector_len) {
   assert(VM_Version::supports_avx(), "");
   assert(!VM_Version::supports_evex(), "");
-  InstructionAttr attributes(vector_len, /* vex_w */ false, /* legacy_mode */ true, /* no_mask_reg */ false, /* uses_vl */ true);
+  InstructionAttr attributes(vector_len, /* vex_w */ false, /* legacy_mode */ true, /* no_mask_reg */ true, /* uses_vl */ true);
   int encode = vex_prefix_and_encode(dst->encoding(), nds->encoding(), src1->encoding(), VEX_SIMD_66, VEX_OPCODE_0F_3A, &attributes);
   emit_int8((unsigned char)0x4A);
   emit_int8((unsigned char)(0xC0 | encode));
@@ -7767,7 +7759,7 @@
 
 void Assembler::vpblendd(XMMRegister dst, XMMRegister nds, XMMRegister src, int imm8, int vector_len) {
   assert(VM_Version::supports_avx2(), "");
-  InstructionAttr attributes(vector_len, /* vex_w */ false, /* legacy_mode */ true, /* no_mask_reg */ false, /* uses_vl */ true);
+  InstructionAttr attributes(vector_len, /* vex_w */ false, /* legacy_mode */ true, /* no_mask_reg */ true, /* uses_vl */ true);
   int encode = vex_prefix_and_encode(dst->encoding(), nds->encoding(), src->encoding(), VEX_SIMD_66, VEX_OPCODE_0F_3A, &attributes);
   emit_int8((unsigned char)0x02);
   emit_int8((unsigned char)(0xC0 | encode));
--- a/src/hotspot/cpu/x86/assembler_x86.hpp	Wed Oct 03 15:54:35 2018 +0200
+++ b/src/hotspot/cpu/x86/assembler_x86.hpp	Wed Oct 03 16:02:24 2018 +0200
@@ -871,11 +871,6 @@
   void clear_managed(void) { _is_managed = false; }
   bool is_managed(void) { return _is_managed; }
 
-  // Following functions are for stub code use only
-  void set_vector_masking(void) { _vector_masking = true; }
-  void clear_vector_masking(void) { _vector_masking = false; }
-  bool is_vector_masking(void) { return _vector_masking; }
-
   void lea(Register dst, Address src);
 
   void mov(Register dst, Register src);
@@ -1350,40 +1345,38 @@
 
   // Serializes memory and blows flags
   void membar(Membar_mask_bits order_constraint) {
-    if (os::is_MP()) {
-      // We only have to handle StoreLoad
-      if (order_constraint & StoreLoad) {
-        // All usable chips support "locked" instructions which suffice
-        // as barriers, and are much faster than the alternative of
-        // using cpuid instruction. We use here a locked add [esp-C],0.
-        // This is conveniently otherwise a no-op except for blowing
-        // flags, and introducing a false dependency on target memory
-        // location. We can't do anything with flags, but we can avoid
-        // memory dependencies in the current method by locked-adding
-        // somewhere else on the stack. Doing [esp+C] will collide with
-        // something on stack in current method, hence we go for [esp-C].
-        // It is convenient since it is almost always in data cache, for
-        // any small C.  We need to step back from SP to avoid data
-        // dependencies with other things on below SP (callee-saves, for
-        // example). Without a clear way to figure out the minimal safe
-        // distance from SP, it makes sense to step back the complete
-        // cache line, as this will also avoid possible second-order effects
-        // with locked ops against the cache line. Our choice of offset
-        // is bounded by x86 operand encoding, which should stay within
-        // [-128; +127] to have the 8-byte displacement encoding.
-        //
-        // Any change to this code may need to revisit other places in
-        // the code where this idiom is used, in particular the
-        // orderAccess code.
-
-        int offset = -VM_Version::L1_line_size();
-        if (offset < -128) {
-          offset = -128;
-        }
-
-        lock();
-        addl(Address(rsp, offset), 0);// Assert the lock# signal here
+    // We only have to handle StoreLoad
+    if (order_constraint & StoreLoad) {
+      // All usable chips support "locked" instructions which suffice
+      // as barriers, and are much faster than the alternative of
+      // using cpuid instruction. We use here a locked add [esp-C],0.
+      // This is conveniently otherwise a no-op except for blowing
+      // flags, and introducing a false dependency on target memory
+      // location. We can't do anything with flags, but we can avoid
+      // memory dependencies in the current method by locked-adding
+      // somewhere else on the stack. Doing [esp+C] will collide with
+      // something on stack in current method, hence we go for [esp-C].
+      // It is convenient since it is almost always in data cache, for
+      // any small C.  We need to step back from SP to avoid data
+      // dependencies with other things on below SP (callee-saves, for
+      // example). Without a clear way to figure out the minimal safe
+      // distance from SP, it makes sense to step back the complete
+      // cache line, as this will also avoid possible second-order effects
+      // with locked ops against the cache line. Our choice of offset
+      // is bounded by x86 operand encoding, which should stay within
+      // [-128; +127] to have the 8-byte displacement encoding.
+      //
+      // Any change to this code may need to revisit other places in
+      // the code where this idiom is used, in particular the
+      // orderAccess code.
+
+      int offset = -VM_Version::L1_line_size();
+      if (offset < -128) {
+        offset = -128;
       }
+
+      lock();
+      addl(Address(rsp, offset), 0);// Assert the lock# signal here
     }
   }
 
@@ -2210,7 +2203,7 @@
     int vector_len,     // The length of vector to be applied in encoding - for both AVX and EVEX
     bool rex_vex_w,     // Width of data: if 32-bits or less, false, else if 64-bit or specially defined, true
     bool legacy_mode,   // Details if either this instruction is conditionally encoded to AVX or earlier if true else possibly EVEX
-    bool no_reg_mask,   // when true, k0 is used when EVEX encoding is chosen, else k1 is used under the same condition
+    bool no_reg_mask,   // when true, k0 is used when EVEX encoding is chosen, else embedded_opmask_register_specifier is used
     bool uses_vl)       // This instruction may have legacy constraints based on vector length for EVEX
     :
       _avx_vector_len(vector_len),
@@ -2225,7 +2218,7 @@
       _evex_encoding(0),
       _is_clear_context(true),
       _is_extended_context(false),
-      _embedded_opmask_register_specifier(1), // hard code k1, it will be initialized for now
+      _embedded_opmask_register_specifier(0), // hard code k0
       _current_assembler(NULL) {
     if (UseAVX < 3) _legacy_mode = true;
   }
--- a/src/hotspot/cpu/x86/c1_LIRAssembler_x86.cpp	Wed Oct 03 15:54:35 2018 +0200
+++ b/src/hotspot/cpu/x86/c1_LIRAssembler_x86.cpp	Wed Oct 03 16:02:24 2018 +0200
@@ -1906,9 +1906,7 @@
     assert(op->new_value()->as_register_lo() == rbx, "wrong register");
     assert(op->new_value()->as_register_hi() == rcx, "wrong register");
     Register addr = op->addr()->as_register();
-    if (os::is_MP()) {
-      __ lock();
-    }
+    __ lock();
     NOT_LP64(__ cmpxchg8(Address(addr, 0)));
 
   } else if (op->code() == lir_cas_int || op->code() == lir_cas_obj ) {
@@ -1928,24 +1926,18 @@
         __ encode_heap_oop(cmpval);
         __ mov(rscratch1, newval);
         __ encode_heap_oop(rscratch1);
-        if (os::is_MP()) {
-          __ lock();
-        }
+        __ lock();
         // cmpval (rax) is implicitly used by this instruction
         __ cmpxchgl(rscratch1, Address(addr, 0));
       } else
 #endif
       {
-        if (os::is_MP()) {
-          __ lock();
-        }
+        __ lock();
         __ cmpxchgptr(newval, Address(addr, 0));
       }
     } else {
       assert(op->code() == lir_cas_int, "lir_cas_int expected");
-      if (os::is_MP()) {
-        __ lock();
-      }
+      __ lock();
       __ cmpxchgl(newval, Address(addr, 0));
     }
 #ifdef _LP64
@@ -1958,9 +1950,7 @@
     assert(cmpval != newval, "cmp and new values must be in different registers");
     assert(cmpval != addr, "cmp and addr must be in different registers");
     assert(newval != addr, "new value and addr must be in different registers");
-    if (os::is_MP()) {
-      __ lock();
-    }
+    __ lock();
     __ cmpxchgq(newval, Address(addr, 0));
 #endif // _LP64
   } else {
@@ -2403,8 +2393,9 @@
           if (UseAVX > 2 && !VM_Version::supports_avx512vl()) {
             assert(tmp->is_valid(), "need temporary");
             __ vpandn(dest->as_xmm_double_reg(), tmp->as_xmm_double_reg(), value->as_xmm_double_reg(), 2);
-          } else {
+          } else
 #endif
+          {
             if (dest->as_xmm_double_reg() != value->as_xmm_double_reg()) {
               __ movdbl(dest->as_xmm_double_reg(), value->as_xmm_double_reg());
             }
@@ -2803,28 +2794,26 @@
 
 
 void LIR_Assembler::align_call(LIR_Code code) {
-  if (os::is_MP()) {
-    // make sure that the displacement word of the call ends up word aligned
-    int offset = __ offset();
-    switch (code) {
-      case lir_static_call:
-      case lir_optvirtual_call:
-      case lir_dynamic_call:
-        offset += NativeCall::displacement_offset;
-        break;
-      case lir_icvirtual_call:
-        offset += NativeCall::displacement_offset + NativeMovConstReg::instruction_size;
-      break;
-      case lir_virtual_call:  // currently, sparc-specific for niagara
-      default: ShouldNotReachHere();
-    }
-    __ align(BytesPerWord, offset);
+  // make sure that the displacement word of the call ends up word aligned
+  int offset = __ offset();
+  switch (code) {
+  case lir_static_call:
+  case lir_optvirtual_call:
+  case lir_dynamic_call:
+    offset += NativeCall::displacement_offset;
+    break;
+  case lir_icvirtual_call:
+    offset += NativeCall::displacement_offset + NativeMovConstReg::instruction_size;
+    break;
+  case lir_virtual_call:  // currently, sparc-specific for niagara
+  default: ShouldNotReachHere();
   }
+  __ align(BytesPerWord, offset);
 }
 
 
 void LIR_Assembler::call(LIR_OpJavaCall* op, relocInfo::relocType rtype) {
-  assert(!os::is_MP() || (__ offset() + NativeCall::displacement_offset) % BytesPerWord == 0,
+  assert((__ offset() + NativeCall::displacement_offset) % BytesPerWord == 0,
          "must be aligned");
   __ call(AddressLiteral(op->addr(), rtype));
   add_call_info(code_offset(), op->info());
@@ -2834,8 +2823,7 @@
 void LIR_Assembler::ic_call(LIR_OpJavaCall* op) {
   __ ic_call(op->addr());
   add_call_info(code_offset(), op->info());
-  assert(!os::is_MP() ||
-         (__ offset() - NativeCall::instruction_size + NativeCall::displacement_offset) % BytesPerWord == 0,
+  assert((__ offset() - NativeCall::instruction_size + NativeCall::displacement_offset) % BytesPerWord == 0,
          "must be aligned");
 }
 
@@ -2855,14 +2843,13 @@
   }
 
   int start = __ offset();
-  if (os::is_MP()) {
-    // make sure that the displacement word of the call ends up word aligned
-    __ align(BytesPerWord, __ offset() + NativeMovConstReg::instruction_size + NativeCall::displacement_offset);
-  }
+
+  // make sure that the displacement word of the call ends up word aligned
+  __ align(BytesPerWord, __ offset() + NativeMovConstReg::instruction_size + NativeCall::displacement_offset);
   __ relocate(static_stub_Relocation::spec(call_pc, false /* is_aot */));
   __ mov_metadata(rbx, (Metadata*)NULL);
   // must be set to -1 at code generation time
-  assert(!os::is_MP() || ((__ offset() + 1) % BytesPerWord) == 0, "must be aligned on MP");
+  assert(((__ offset() + 1) % BytesPerWord) == 0, "must be aligned");
   // On 64bit this will die since it will take a movq & jmp, must be only a jmp
   __ jump(RuntimeAddress(__ pc()));
 
@@ -3991,9 +3978,7 @@
 
   if (data->type() == T_INT) {
     if (code == lir_xadd) {
-      if (os::is_MP()) {
-        __ lock();
-      }
+      __ lock();
       __ xaddl(as_Address(src->as_address_ptr()), data->as_register());
     } else {
       __ xchgl(data->as_register(), as_Address(src->as_address_ptr()));
@@ -4016,9 +4001,7 @@
 #ifdef _LP64
     assert(data->as_register_lo() == data->as_register_hi(), "should be a single register");
     if (code == lir_xadd) {
-      if (os::is_MP()) {
-        __ lock();
-      }
+      __ lock();
       __ xaddq(as_Address(src->as_address_ptr()), data->as_register_lo());
     } else {
       __ xchgq(data->as_register_lo(), as_Address(src->as_address_ptr()));
--- a/src/hotspot/cpu/x86/c1_MacroAssembler_x86.cpp	Wed Oct 03 15:54:35 2018 +0200
+++ b/src/hotspot/cpu/x86/c1_MacroAssembler_x86.cpp	Wed Oct 03 16:02:24 2018 +0200
@@ -65,7 +65,7 @@
   // test if object header is still the same (i.e. unlocked), and if so, store the
   // displaced header address in the object header - if it is not the same, get the
   // object header instead
-  if (os::is_MP()) MacroAssembler::lock(); // must be immediately before cmpxchg!
+  MacroAssembler::lock(); // must be immediately before cmpxchg!
   cmpxchgptr(disp_hdr, Address(obj, hdr_offset));
   // if the object header was the same, we're done
   if (PrintBiasedLockingStatistics) {
@@ -126,7 +126,7 @@
   // test if object header is pointing to the displaced header, and if so, restore
   // the displaced header in the object - if the object header is not pointing to
   // the displaced header, get the object header instead
-  if (os::is_MP()) MacroAssembler::lock(); // must be immediately before cmpxchg!
+  MacroAssembler::lock(); // must be immediately before cmpxchg!
   cmpxchgptr(hdr, Address(obj, hdr_offset));
   // if the object header was not pointing to the displaced header,
   // we do unlocking via runtime call
--- a/src/hotspot/cpu/x86/compiledIC_x86.cpp	Wed Oct 03 15:54:35 2018 +0200
+++ b/src/hotspot/cpu/x86/compiledIC_x86.cpp	Wed Oct 03 16:02:24 2018 +0200
@@ -198,9 +198,7 @@
 void CompiledDirectStaticCall::verify() {
   // Verify call.
   _call->verify();
-  if (os::is_MP()) {
-    _call->verify_alignment();
-  }
+  _call->verify_alignment();
 
 #ifdef ASSERT
   CodeBlob *cb = CodeCache::find_blob_unsafe((address) _call);
--- a/src/hotspot/cpu/x86/interp_masm_x86.cpp	Wed Oct 03 15:54:35 2018 +0200
+++ b/src/hotspot/cpu/x86/interp_masm_x86.cpp	Wed Oct 03 16:02:24 2018 +0200
@@ -1191,7 +1191,7 @@
     assert(lock_offset == 0,
            "displaced header must be first word in BasicObjectLock");
 
-    if (os::is_MP()) lock();
+    lock();
     cmpxchgptr(lock_reg, Address(obj_reg, oopDesc::mark_offset_in_bytes()));
     if (PrintBiasedLockingStatistics) {
       cond_inc32(Assembler::zero,
@@ -1288,7 +1288,7 @@
     jcc(Assembler::zero, done);
 
     // Atomic swap back the old header
-    if (os::is_MP()) lock();
+    lock();
     cmpxchgptr(header_reg, Address(obj_reg, oopDesc::mark_offset_in_bytes()));
 
     // zero for simple unlock of a stack-lock case
--- a/src/hotspot/cpu/x86/jniFastGetField_x86_32.cpp	Wed Oct 03 15:54:35 2018 +0200
+++ b/src/hotspot/cpu/x86/jniFastGetField_x86_32.cpp	Wed Oct 03 16:02:24 2018 +0200
@@ -75,15 +75,11 @@
   __ mov32 (rcx, counter);
   __ testb (rcx, 1);
   __ jcc (Assembler::notZero, slow);
-  if (os::is_MP()) {
-    __ mov(rax, rcx);
-    __ andptr(rax, 1);                         // rax, must end up 0
-    __ movptr(rdx, Address(rsp, rax, Address::times_1, 2*wordSize));
-                                              // obj, notice rax, is 0.
-                                              // rdx is data dependent on rcx.
-  } else {
-    __ movptr (rdx, Address(rsp, 2*wordSize));  // obj
-  }
+  __ mov(rax, rcx);
+  __ andptr(rax, 1);                         // rax, must end up 0
+  __ movptr(rdx, Address(rsp, rax, Address::times_1, 2*wordSize));
+                                            // obj, notice rax, is 0.
+                                            // rdx is data dependent on rcx.
   __ movptr(rax, Address(rsp, 3*wordSize));  // jfieldID
 
   __ clear_jweak_tag(rdx);
@@ -103,17 +99,13 @@
   }
 
   Address ca1;
-  if (os::is_MP()) {
-    __ lea(rdx, counter);
-    __ xorptr(rdx, rax);
-    __ xorptr(rdx, rax);
-    __ cmp32(rcx, Address(rdx, 0));
-    // ca1 is the same as ca because
-    // rax, ^ counter_addr ^ rax, = address
-    // ca1 is data dependent on rax,.
-  } else {
-    __ cmp32(rcx, counter);
-  }
+  __ lea(rdx, counter);
+  __ xorptr(rdx, rax);
+  __ xorptr(rdx, rax);
+  __ cmp32(rcx, Address(rdx, 0));
+  // ca1 is the same as ca because
+  // rax, ^ counter_addr ^ rax, = address
+  // ca1 is data dependent on rax,.
   __ jcc (Assembler::notEqual, slow);
 
 #ifndef _WINDOWS
@@ -131,7 +123,8 @@
     case T_BYTE:    slow_case_addr = jni_GetByteField_addr();    break;
     case T_CHAR:    slow_case_addr = jni_GetCharField_addr();    break;
     case T_SHORT:   slow_case_addr = jni_GetShortField_addr();   break;
-    case T_INT:     slow_case_addr = jni_GetIntField_addr();
+    case T_INT:     slow_case_addr = jni_GetIntField_addr();     break;
+    default:        ShouldNotReachHere();
   }
   // tail call
   __ jump (ExternalAddress(slow_case_addr));
@@ -195,15 +188,11 @@
   __ mov32 (rcx, counter);
   __ testb (rcx, 1);
   __ jcc (Assembler::notZero, slow);
-  if (os::is_MP()) {
-    __ mov(rax, rcx);
-    __ andptr(rax, 1);                         // rax, must end up 0
-    __ movptr(rdx, Address(rsp, rax, Address::times_1, 3*wordSize));
-                                              // obj, notice rax, is 0.
-                                              // rdx is data dependent on rcx.
-  } else {
-    __ movptr(rdx, Address(rsp, 3*wordSize));  // obj
-  }
+  __ mov(rax, rcx);
+  __ andptr(rax, 1);                         // rax, must end up 0
+  __ movptr(rdx, Address(rsp, rax, Address::times_1, 3*wordSize));
+                                            // obj, notice rax, is 0.
+                                            // rdx is data dependent on rcx.
   __ movptr(rsi, Address(rsp, 4*wordSize));  // jfieldID
 
   __ clear_jweak_tag(rdx);
@@ -219,19 +208,15 @@
   __ movl(rdx, Address(rdx, rsi, Address::times_1, 4));
 #endif // _LP64
 
-  if (os::is_MP()) {
-    __ lea(rsi, counter);
-    __ xorptr(rsi, rdx);
-    __ xorptr(rsi, rax);
-    __ xorptr(rsi, rdx);
-    __ xorptr(rsi, rax);
-    __ cmp32(rcx, Address(rsi, 0));
-    // ca1 is the same as ca because
-    // rax, ^ rdx ^ counter_addr ^ rax, ^ rdx = address
-    // ca1 is data dependent on both rax, and rdx.
-  } else {
-    __ cmp32(rcx, counter);
-  }
+  __ lea(rsi, counter);
+  __ xorptr(rsi, rdx);
+  __ xorptr(rsi, rax);
+  __ xorptr(rsi, rdx);
+  __ xorptr(rsi, rax);
+  __ cmp32(rcx, Address(rsi, 0));
+  // ca1 is the same as ca because
+  // rax, ^ rdx ^ counter_addr ^ rax, ^ rdx = address
+  // ca1 is data dependent on both rax, and rdx.
   __ jcc (Assembler::notEqual, slow);
 
   __ pop (rsi);
@@ -287,15 +272,11 @@
   __ mov32 (rcx, counter);
   __ testb (rcx, 1);
   __ jcc (Assembler::notZero, slow);
-  if (os::is_MP()) {
-    __ mov(rax, rcx);
-    __ andptr(rax, 1);                         // rax, must end up 0
-    __ movptr(rdx, Address(rsp, rax, Address::times_1, 2*wordSize));
-                                              // obj, notice rax, is 0.
-                                              // rdx is data dependent on rcx.
-  } else {
-    __ movptr(rdx, Address(rsp, 2*wordSize)); // obj
-  }
+  __ mov(rax, rcx);
+  __ andptr(rax, 1);                         // rax, must end up 0
+  __ movptr(rdx, Address(rsp, rax, Address::times_1, 2*wordSize));
+                                            // obj, notice rax, is 0.
+                                            // rdx is data dependent on rcx.
   __ movptr(rax, Address(rsp, 3*wordSize));  // jfieldID
 
   __ clear_jweak_tag(rdx);
@@ -317,20 +298,16 @@
   }
 
   Address ca1;
-  if (os::is_MP()) {
-    __ fst_s (Address(rsp, -4));
-    __ lea(rdx, counter);
-    __ movl (rax, Address(rsp, -4));
-    // garbage hi-order bits on 64bit are harmless.
-    __ xorptr(rdx, rax);
-    __ xorptr(rdx, rax);
-    __ cmp32(rcx, Address(rdx, 0));
-                                          // rax, ^ counter_addr ^ rax, = address
-                                          // ca1 is data dependent on the field
-                                          // access.
-  } else {
-    __ cmp32(rcx, counter);
-  }
+  __ fst_s (Address(rsp, -4));
+  __ lea(rdx, counter);
+  __ movl (rax, Address(rsp, -4));
+  // garbage hi-order bits on 64bit are harmless.
+  __ xorptr(rdx, rax);
+  __ xorptr(rdx, rax);
+  __ cmp32(rcx, Address(rdx, 0));
+  // rax, ^ counter_addr ^ rax, = address
+  // ca1 is data dependent on the field
+  // access.
   __ jcc (Assembler::notEqual, slow_with_pop);
 
 #ifndef _WINDOWS
--- a/src/hotspot/cpu/x86/jniFastGetField_x86_64.cpp	Wed Oct 03 15:54:35 2018 +0200
+++ b/src/hotspot/cpu/x86/jniFastGetField_x86_64.cpp	Wed Oct 03 16:02:24 2018 +0200
@@ -77,12 +77,11 @@
   __ mov   (robj, c_rarg1);
   __ testb (rcounter, 1);
   __ jcc (Assembler::notZero, slow);
-  if (os::is_MP()) {
-    __ xorptr(robj, rcounter);
-    __ xorptr(robj, rcounter);                   // obj, since
-                                                // robj ^ rcounter ^ rcounter == robj
-                                                // robj is data dependent on rcounter.
-  }
+
+  __ xorptr(robj, rcounter);
+  __ xorptr(robj, rcounter);  // obj, since
+                              // robj ^ rcounter ^ rcounter == robj
+                              // robj is data dependent on rcounter.
 
   __ mov   (roffset, c_rarg2);
   __ shrptr(roffset, 2);                         // offset
@@ -104,15 +103,12 @@
     default:        ShouldNotReachHere();
   }
 
-  if (os::is_MP()) {
-    __ lea(rcounter_addr, counter);
-    // ca is data dependent on rax.
-    __ xorptr(rcounter_addr, rax);
-    __ xorptr(rcounter_addr, rax);
-    __ cmpl (rcounter, Address(rcounter_addr, 0));
-  } else {
-    __ cmp32 (rcounter, counter);
-  }
+  // create data dependency on rax
+  __ lea(rcounter_addr, counter);
+  __ xorptr(rcounter_addr, rax);
+  __ xorptr(rcounter_addr, rax);
+  __ cmpl (rcounter, Address(rcounter_addr, 0));
+
   __ jcc (Assembler::notEqual, slow);
 
   __ ret (0);
@@ -181,12 +177,11 @@
   __ mov   (robj, c_rarg1);
   __ testb (rcounter, 1);
   __ jcc (Assembler::notZero, slow);
-  if (os::is_MP()) {
-    __ xorptr(robj, rcounter);
-    __ xorptr(robj, rcounter);                   // obj, since
-                                                // robj ^ rcounter ^ rcounter == robj
-                                                // robj is data dependent on rcounter.
-  }
+
+  __ xorptr(robj, rcounter);
+  __ xorptr(robj, rcounter);  // obj, since
+                              // robj ^ rcounter ^ rcounter == robj
+                              // robj is data dependent on rcounter.
 
   // Both robj and rtmp are clobbered by try_resolve_jobject_in_native.
   BarrierSetAssembler* bs = BarrierSet::barrier_set()->barrier_set_assembler();
@@ -204,16 +199,12 @@
     default:        ShouldNotReachHere();
   }
 
-  if (os::is_MP()) {
-    __ lea(rcounter_addr, counter);
-    __ movdq (rax, xmm0);
-    // counter address is data dependent on xmm0.
-    __ xorptr(rcounter_addr, rax);
-    __ xorptr(rcounter_addr, rax);
-    __ cmpl (rcounter, Address(rcounter_addr, 0));
-  } else {
-    __ cmp32 (rcounter, counter);
-  }
+  __ lea(rcounter_addr, counter);
+  __ movdq (rax, xmm0);
+  // counter address is data dependent on xmm0.
+  __ xorptr(rcounter_addr, rax);
+  __ xorptr(rcounter_addr, rax);
+  __ cmpl (rcounter, Address(rcounter_addr, 0));
   __ jcc (Assembler::notEqual, slow);
 
   __ ret (0);
--- a/src/hotspot/cpu/x86/macroAssembler_x86.cpp	Wed Oct 03 15:54:35 2018 +0200
+++ b/src/hotspot/cpu/x86/macroAssembler_x86.cpp	Wed Oct 03 16:02:24 2018 +0200
@@ -1030,8 +1030,7 @@
 }
 
 void MacroAssembler::atomic_incl(Address counter_addr) {
-  if (os::is_MP())
-    lock();
+  lock();
   incrementl(counter_addr);
 }
 
@@ -1046,8 +1045,7 @@
 
 #ifdef _LP64
 void MacroAssembler::atomic_incq(Address counter_addr) {
-  if (os::is_MP())
-    lock();
+  lock();
   incrementq(counter_addr);
 }
 
@@ -1213,9 +1211,7 @@
   get_thread(tmp_reg);
   orptr(tmp_reg, swap_reg);
 #endif
-  if (os::is_MP()) {
-    lock();
-  }
+  lock();
   cmpxchgptr(tmp_reg, mark_addr); // compare tmp_reg and swap_reg
   // If the biasing toward our thread failed, this means that
   // another thread succeeded in biasing it toward itself and we
@@ -1248,9 +1244,7 @@
   orptr(tmp_reg, swap_reg);
   movptr(swap_reg, saved_mark_addr);
 #endif
-  if (os::is_MP()) {
-    lock();
-  }
+  lock();
   cmpxchgptr(tmp_reg, mark_addr); // compare tmp_reg and swap_reg
   // If the biasing toward our thread failed, then another thread
   // succeeded in biasing it toward itself and we need to revoke that
@@ -1278,9 +1272,7 @@
   // bits in this situation. Should attempt to preserve them.
   NOT_LP64( movptr(swap_reg, saved_mark_addr); )
   load_prototype_header(tmp_reg, obj_reg);
-  if (os::is_MP()) {
-    lock();
-  }
+  lock();
   cmpxchgptr(tmp_reg, mark_addr); // compare tmp_reg and swap_reg
   // Fall through to the normal CAS-based lock, because no matter what
   // the result of the above CAS, some thread must have succeeded in
@@ -1376,9 +1368,7 @@
   if (method_data != NULL) {
     // set rtm_state to "no rtm" in MDO
     mov_metadata(tmpReg, method_data);
-    if (os::is_MP()) {
-      lock();
-    }
+    lock();
     orl(Address(tmpReg, MethodData::rtm_state_offset_in_bytes()), NoRTM);
   }
   jmpb(L_done);
@@ -1392,9 +1382,7 @@
   if (method_data != NULL) {
     // set rtm_state to "always rtm" in MDO
     mov_metadata(tmpReg, method_data);
-    if (os::is_MP()) {
-      lock();
-    }
+    lock();
     orl(Address(tmpReg, MethodData::rtm_state_offset_in_bytes()), UseRTM);
   }
   bind(L_done);
@@ -1605,9 +1593,7 @@
   get_thread(scrReg);
   Register threadReg = scrReg;
 #endif
-  if (os::is_MP()) {
-    lock();
-  }
+  lock();
   cmpxchgptr(threadReg, Address(boxReg, owner_offset)); // Updates tmpReg
 
   if (RTMRetryCount > 0) {
@@ -1767,9 +1753,7 @@
   // Attempt stack-locking ...
   orptr (tmpReg, markOopDesc::unlocked_value);
   movptr(Address(boxReg, 0), tmpReg);          // Anticipate successful CAS
-  if (os::is_MP()) {
-    lock();
-  }
+  lock();
   cmpxchgptr(boxReg, Address(objReg, oopDesc::mark_offset_in_bytes()));      // Updates tmpReg
   if (counters != NULL) {
     cond_inc32(Assembler::equal,
@@ -1826,9 +1810,7 @@
   // we later store "Self" into m->Owner.  Transiently storing a stack address
   // (rsp or the address of the box) into  m->owner is harmless.
   // Invariant: tmpReg == 0.  tmpReg is EAX which is the implicit cmpxchg comparand.
-  if (os::is_MP()) {
-    lock();
-  }
+  lock();
   cmpxchgptr(scrReg, Address(boxReg, OM_OFFSET_NO_MONITOR_VALUE_TAG(owner)));
   movptr(Address(scrReg, 0), 3);          // box->_displaced_header = 3
   // If we weren't able to swing _owner from NULL to the BasicLock
@@ -1851,9 +1833,7 @@
   movq(scrReg, tmpReg);
   xorq(tmpReg, tmpReg);
 
-  if (os::is_MP()) {
-    lock();
-  }
+  lock();
   cmpxchgptr(r15_thread, Address(scrReg, OM_OFFSET_NO_MONITOR_VALUE_TAG(owner)));
   // Unconditionally set box->_displaced_header = markOopDesc::unused_mark().
   // Without cast to int32_t movptr will destroy r10 which is typically obj.
@@ -2000,9 +1980,7 @@
   // The "box" value on the stack is stable, so we can reload
   // and be assured we observe the same value as above.
   movptr(tmpReg, Address(boxReg, 0));
-  if (os::is_MP()) {
-    lock();
-  }
+  lock();
   cmpxchgptr(tmpReg, Address(objReg, oopDesc::mark_offset_in_bytes())); // Uses RAX which is box
   // Intention fall-thru into DONE_LABEL
 
@@ -2036,16 +2014,16 @@
 
   xorptr(boxReg, boxReg);
   movptr(Address(tmpReg, OM_OFFSET_NO_MONITOR_VALUE_TAG(owner)), (int32_t)NULL_WORD);
-  if (os::is_MP()) {
-    // Memory barrier/fence
-    // Dekker pivot point -- fulcrum : ST Owner; MEMBAR; LD Succ
-    // Instead of MFENCE we use a dummy locked add of 0 to the top-of-stack.
-    // This is faster on Nehalem and AMD Shanghai/Barcelona.
-    // See https://blogs.oracle.com/dave/entry/instruction_selection_for_volatile_fences
-    // We might also restructure (ST Owner=0;barrier;LD _Succ) to
-    // (mov box,0; xchgq box, &m->Owner; LD _succ) .
-    lock(); addl(Address(rsp, 0), 0);
-  }
+
+  // Memory barrier/fence
+  // Dekker pivot point -- fulcrum : ST Owner; MEMBAR; LD Succ
+  // Instead of MFENCE we use a dummy locked add of 0 to the top-of-stack.
+  // This is faster on Nehalem and AMD Shanghai/Barcelona.
+  // See https://blogs.oracle.com/dave/entry/instruction_selection_for_volatile_fences
+  // We might also restructure (ST Owner=0;barrier;LD _Succ) to
+  // (mov box,0; xchgq box, &m->Owner; LD _succ) .
+  lock(); addl(Address(rsp, 0), 0);
+
   cmpptr(Address(tmpReg, OM_OFFSET_NO_MONITOR_VALUE_TAG(succ)), (int32_t)NULL_WORD);
   jccb  (Assembler::notZero, LSuccess);
 
@@ -2063,7 +2041,7 @@
 
   // box is really RAX -- the following CMPXCHG depends on that binding
   // cmpxchg R,[M] is equivalent to rax = CAS(M,rax,R)
-  if (os::is_MP()) { lock(); }
+  lock();
   cmpxchgptr(r15_thread, Address(tmpReg, OM_OFFSET_NO_MONITOR_VALUE_TAG(owner)));
   // There's no successor so we tried to regrab the lock.
   // If that didn't work, then another thread grabbed the
@@ -2081,7 +2059,7 @@
 
   bind  (Stacked);
   movptr(tmpReg, Address (boxReg, 0));      // re-fetch
-  if (os::is_MP()) { lock(); }
+  lock();
   cmpxchgptr(tmpReg, Address(objReg, oopDesc::mark_offset_in_bytes())); // Uses RAX which is box
 
 #endif
@@ -2633,13 +2611,11 @@
 
 void MacroAssembler::locked_cmpxchgptr(Register reg, AddressLiteral adr) {
   if (reachable(adr)) {
-    if (os::is_MP())
-      lock();
+    lock();
     cmpxchgptr(reg, as_Address(adr));
   } else {
     lea(rscratch1, adr);
-    if (os::is_MP())
-      lock();
+    lock();
     cmpxchgptr(reg, Address(rscratch1, 0));
   }
 }
@@ -3267,6 +3243,7 @@
 }
 
 void MacroAssembler::setvectmask(Register dst, Register src) {
+  guarantee(PostLoopMultiversioning == true, "must be");
   Assembler::movl(dst, 1);
   Assembler::shlxl(dst, dst, src);
   Assembler::decl(dst);
@@ -3275,6 +3252,7 @@
 }
 
 void MacroAssembler::restorevectmask() {
+  guarantee(PostLoopMultiversioning == true, "must be");
   Assembler::knotwl(k1, k0);
 }
 
@@ -5026,7 +5004,7 @@
   // Clear upper bits of YMM registers to avoid SSE <-> AVX transition penalty.
   vzeroupper();
   // Reset k1 to 0xffff.
-  if (VM_Version::supports_evex()) {
+  if (PostLoopMultiversioning && VM_Version::supports_evex()) {
     push(rcx);
     movl(rcx, 0xffff);
     kmovwl(k1, rcx);
@@ -6681,8 +6659,6 @@
     VM_Version::supports_avx512vlbw() &&
     VM_Version::supports_bmi2()) {
 
-    set_vector_masking();  // opening of the stub context for programming mask registers
-
     Label test_64_loop, test_tail;
     Register tmp3_aliased = len;
 
@@ -6711,15 +6687,12 @@
     testl(tmp1, -1);
     jcc(Assembler::zero, FALSE_LABEL);
 
-    // Save k1
-    kmovql(k3, k1);
-
     // ~(~0 << len) applied up to two times (for 32-bit scenario)
 #ifdef _LP64
     mov64(tmp3_aliased, 0xFFFFFFFFFFFFFFFF);
     shlxq(tmp3_aliased, tmp3_aliased, tmp1);
     notq(tmp3_aliased);
-    kmovql(k1, tmp3_aliased);
+    kmovql(k3, tmp3_aliased);
 #else
     Label k_init;
     jmp(k_init);
@@ -6728,7 +6701,7 @@
     // data required to compose 64 1's to the instruction stream
     // We emit 64 byte wide series of elements from 0..63 which later on would
     // be used as a compare targets with tail count contained in tmp1 register.
-    // Result would be a k1 register having tmp1 consecutive number or 1
+    // Result would be a k register having tmp1 consecutive number or 1
     // counting from least significant bit.
     address tmp = pc();
     emit_int64(0x0706050403020100);
@@ -6744,18 +6717,14 @@
     lea(len, InternalAddress(tmp));
     // create mask to test for negative byte inside a vector
     evpbroadcastb(vec1, tmp1, Assembler::AVX_512bit);
-    evpcmpgtb(k1, vec1, Address(len, 0), Assembler::AVX_512bit);
+    evpcmpgtb(k3, vec1, Address(len, 0), Assembler::AVX_512bit);
 
 #endif
-    evpcmpgtb(k2, k1, vec2, Address(ary1, 0), Assembler::AVX_512bit);
-    ktestq(k2, k1);
-    // Restore k1
-    kmovql(k1, k3);
+    evpcmpgtb(k2, k3, vec2, Address(ary1, 0), Assembler::AVX_512bit);
+    ktestq(k2, k3);
     jcc(Assembler::notZero, TRUE_LABEL);
 
     jmp(FALSE_LABEL);
-
-    clear_vector_masking();   // closing of the stub context for programming mask registers
   } else {
     movl(result, len); // copy
 
@@ -7197,10 +7166,6 @@
     {
       assert( UseSSE >= 2, "supported cpu only" );
       Label L_fill_32_bytes_loop, L_check_fill_8_bytes, L_fill_8_bytes_loop, L_fill_8_bytes;
-      if (UseAVX > 2) {
-        movl(rtmp, 0xffff);
-        kmovwl(k1, rtmp);
-      }
       movdl(xtmp, value);
       if (UseAVX > 2 && UseUnalignedLoadStores) {
         // Fill 64-byte chunks
@@ -7945,7 +7910,6 @@
       VM_Version::supports_avx512vlbw()) {
     Label VECTOR64_LOOP, VECTOR64_NOT_EQUAL, VECTOR32_TAIL;
 
-    set_vector_masking();  // opening of the stub context for programming mask registers
     cmpq(length, 64);
     jcc(Assembler::less, VECTOR32_TAIL);
     movq(tmp1, length);
@@ -7968,19 +7932,15 @@
 
     //bind(VECTOR64_TAIL);
     // AVX512 code to compare upto 63 byte vectors.
-    // Save k1
-    kmovql(k3, k1);
     mov64(tmp2, 0xFFFFFFFFFFFFFFFF);
     shlxq(tmp2, tmp2, tmp1);
     notq(tmp2);
-    kmovql(k1, tmp2);
-
-    evmovdqub(rymm0, k1, Address(obja, result), Assembler::AVX_512bit);
-    evpcmpeqb(k7, k1, rymm0, Address(objb, result), Assembler::AVX_512bit);
-
-    ktestql(k7, k1);
-    // Restore k1
-    kmovql(k1, k3);
+    kmovql(k3, tmp2);
+
+    evmovdqub(rymm0, k3, Address(obja, result), Assembler::AVX_512bit);
+    evpcmpeqb(k7, k3, rymm0, Address(objb, result), Assembler::AVX_512bit);
+
+    ktestql(k7, k3);
     jcc(Assembler::below, SAME_TILL_END);     // not mismatch
 
     bind(VECTOR64_NOT_EQUAL);
@@ -7991,7 +7951,6 @@
     shrq(result);
     jmp(DONE);
     bind(VECTOR32_TAIL);
-    clear_vector_masking();   // closing of the stub context for programming mask registers
   }
 
   cmpq(length, 8);
@@ -8752,11 +8711,6 @@
   // For EVEX with VL and BW, provide a standard mask, VL = 128 will guide the merge
   // context for the registers used, where all instructions below are using 128-bit mode
   // On EVEX without VL and BW, these instructions will all be AVX.
-  if (VM_Version::supports_avx512vlbw()) {
-    movl(tmp, 0xffff);
-    kmovwl(k1, tmp);
-  }
-
   lea(table, ExternalAddress(StubRoutines::crc_table_addr()));
   notl(crc); // ~crc
   cmpl(len, 16);
@@ -9418,9 +9372,7 @@
     VM_Version::supports_avx512vlbw() &&
     VM_Version::supports_bmi2()) {
 
-    set_vector_masking();  // opening of the stub context for programming mask registers
-
-    Label copy_32_loop, copy_loop_tail, restore_k1_return_zero, below_threshold;
+    Label copy_32_loop, copy_loop_tail, below_threshold;
 
     // alignment
     Label post_alignment;
@@ -9434,9 +9386,6 @@
     movl(result, 0x00FF);
     evpbroadcastw(tmp2Reg, result, Assembler::AVX_512bit);
 
-    // Save k1
-    kmovql(k3, k1);
-
     testl(len, -64);
     jcc(Assembler::zero, post_alignment);
 
@@ -9453,14 +9402,14 @@
     movl(result, 0xFFFFFFFF);
     shlxl(result, result, tmp5);
     notl(result);
-    kmovdl(k1, result);
-
-    evmovdquw(tmp1Reg, k1, Address(src, 0), Assembler::AVX_512bit);
-    evpcmpuw(k2, k1, tmp1Reg, tmp2Reg, Assembler::le, Assembler::AVX_512bit);
-    ktestd(k2, k1);
-    jcc(Assembler::carryClear, restore_k1_return_zero);
-
-    evpmovwb(Address(dst, 0), k1, tmp1Reg, Assembler::AVX_512bit);
+    kmovdl(k3, result);
+
+    evmovdquw(tmp1Reg, k3, Address(src, 0), Assembler::AVX_512bit);
+    evpcmpuw(k2, k3, tmp1Reg, tmp2Reg, Assembler::le, Assembler::AVX_512bit);
+    ktestd(k2, k3);
+    jcc(Assembler::carryClear, return_zero);
+
+    evpmovwb(Address(dst, 0), k3, tmp1Reg, Assembler::AVX_512bit);
 
     addptr(src, tmp5);
     addptr(src, tmp5);
@@ -9483,7 +9432,7 @@
     evmovdquw(tmp1Reg, Address(src, len, Address::times_2), Assembler::AVX_512bit);
     evpcmpuw(k2, tmp1Reg, tmp2Reg, Assembler::le, Assembler::AVX_512bit);
     kortestdl(k2, k2);
-    jcc(Assembler::carryClear, restore_k1_return_zero);
+    jcc(Assembler::carryClear, return_zero);
 
     // All elements in current processed chunk are valid candidates for
     // compression. Write a truncated byte elements to the memory.
@@ -9494,8 +9443,6 @@
     bind(copy_loop_tail);
     // bail out when there is nothing to be done
     testl(tmp5, 0xFFFFFFFF);
-    // Restore k1
-    kmovql(k1, k3);
     jcc(Assembler::zero, return_length);
 
     movl(len, tmp5);
@@ -9505,25 +9452,16 @@
     shlxl(result, result, len);
     notl(result);
 
-    kmovdl(k1, result);
-
-    evmovdquw(tmp1Reg, k1, Address(src, 0), Assembler::AVX_512bit);
-    evpcmpuw(k2, k1, tmp1Reg, tmp2Reg, Assembler::le, Assembler::AVX_512bit);
-    ktestd(k2, k1);
-    jcc(Assembler::carryClear, restore_k1_return_zero);
-
-    evpmovwb(Address(dst, 0), k1, tmp1Reg, Assembler::AVX_512bit);
-    // Restore k1
-    kmovql(k1, k3);
+    kmovdl(k3, result);
+
+    evmovdquw(tmp1Reg, k3, Address(src, 0), Assembler::AVX_512bit);
+    evpcmpuw(k2, k3, tmp1Reg, tmp2Reg, Assembler::le, Assembler::AVX_512bit);
+    ktestd(k2, k3);
+    jcc(Assembler::carryClear, return_zero);
+
+    evpmovwb(Address(dst, 0), k3, tmp1Reg, Assembler::AVX_512bit);
     jmp(return_length);
 
-    bind(restore_k1_return_zero);
-    // Restore k1
-    kmovql(k1, k3);
-    jmp(return_zero);
-
-    clear_vector_masking();   // closing of the stub context for programming mask registers
-
     bind(below_threshold);
   }
 
@@ -9637,8 +9575,6 @@
     VM_Version::supports_avx512vlbw() &&
     VM_Version::supports_bmi2()) {
 
-    set_vector_masking();  // opening of the stub context for programming mask registers
-
     Label copy_32_loop, copy_tail;
     Register tmp3_aliased = len;
 
@@ -9670,22 +9606,15 @@
     testl(tmp2, -1); // we don't destroy the contents of tmp2 here
     jcc(Assembler::zero, done);
 
-    // Save k1
-    kmovql(k2, k1);
-
     // ~(~0 << length), where length is the # of remaining elements to process
     movl(tmp3_aliased, -1);
     shlxl(tmp3_aliased, tmp3_aliased, tmp2);
     notl(tmp3_aliased);
-    kmovdl(k1, tmp3_aliased);
-    evpmovzxbw(tmp1, k1, Address(src, 0), Assembler::AVX_512bit);
-    evmovdquw(Address(dst, 0), k1, tmp1, Assembler::AVX_512bit);
-
-    // Restore k1
-    kmovql(k1, k2);
+    kmovdl(k2, tmp3_aliased);
+    evpmovzxbw(tmp1, k2, Address(src, 0), Assembler::AVX_512bit);
+    evmovdquw(Address(dst, 0), k2, tmp1, Assembler::AVX_512bit);
+
     jmp(done);
-
-    clear_vector_masking();   // closing of the stub context for programming mask registers
   }
   if (UseSSE42Intrinsics) {
     Label copy_16_loop, copy_8_loop, copy_bytes, copy_new_tail, copy_tail;
--- a/src/hotspot/cpu/x86/nativeInst_x86.cpp	Wed Oct 03 15:54:35 2018 +0200
+++ b/src/hotspot/cpu/x86/nativeInst_x86.cpp	Wed Oct 03 16:02:24 2018 +0200
@@ -202,9 +202,7 @@
   assert (instr_addr != NULL, "illegal address for code patching");
 
   NativeCall* n_call =  nativeCall_at (instr_addr); // checking that it is a call
-  if (os::is_MP()) {
-    guarantee((intptr_t)instr_addr % BytesPerWord == 0, "must be aligned");
-  }
+  guarantee((intptr_t)instr_addr % BytesPerWord == 0, "must be aligned");
 
   // First patch dummy jmp in place
   unsigned char patch[4];
@@ -262,67 +260,14 @@
   assert(Patching_lock->is_locked() ||
          SafepointSynchronize::is_at_safepoint(), "concurrent code patching");
   // Both C1 and C2 should now be generating code which aligns the patched address
-  // to be within a single cache line except that C1 does not do the alignment on
-  // uniprocessor systems.
+  // to be within a single cache line.
   bool is_aligned = ((uintptr_t)displacement_address() + 0) / cache_line_size ==
                     ((uintptr_t)displacement_address() + 3) / cache_line_size;
 
-  guarantee(!os::is_MP() || is_aligned, "destination must be aligned");
-
-  if (is_aligned) {
-    // Simple case:  The destination lies within a single cache line.
-    set_destination(dest);
-  } else if ((uintptr_t)instruction_address() / cache_line_size ==
-             ((uintptr_t)instruction_address()+1) / cache_line_size) {
-    // Tricky case:  The instruction prefix lies within a single cache line.
-    intptr_t disp = dest - return_address();
-#ifdef AMD64
-    guarantee(disp == (intptr_t)(jint)disp, "must be 32-bit offset");
-#endif // AMD64
-
-    int call_opcode = instruction_address()[0];
-
-    // First patch dummy jump in place:
-    {
-      u_char patch_jump[2];
-      patch_jump[0] = 0xEB;       // jmp rel8
-      patch_jump[1] = 0xFE;       // jmp to self
-
-      assert(sizeof(patch_jump)==sizeof(short), "sanity check");
-      *(short*)instruction_address() = *(short*)patch_jump;
-    }
-    // Invalidate.  Opteron requires a flush after every write.
-    wrote(0);
+  guarantee(is_aligned, "destination must be aligned");
 
-    // (Note: We assume any reader which has already started to read
-    // the unpatched call will completely read the whole unpatched call
-    // without seeing the next writes we are about to make.)
-
-    // Next, patch the last three bytes:
-    u_char patch_disp[5];
-    patch_disp[0] = call_opcode;
-    *(int32_t*)&patch_disp[1] = (int32_t)disp;
-    assert(sizeof(patch_disp)==instruction_size, "sanity check");
-    for (int i = sizeof(short); i < instruction_size; i++)
-      instruction_address()[i] = patch_disp[i];
-
-    // Invalidate.  Opteron requires a flush after every write.
-    wrote(sizeof(short));
-
-    // (Note: We assume that any reader which reads the opcode we are
-    // about to repatch will also read the writes we just made.)
-
-    // Finally, overwrite the jump:
-    *(short*)instruction_address() = *(short*)patch_disp;
-    // Invalidate.  Opteron requires a flush after every write.
-    wrote(0);
-
-    debug_only(verify());
-    guarantee(destination() == dest, "patch succeeded");
-  } else {
-    // Impossible:  One or the other must be atomically writable.
-    ShouldNotReachHere();
-  }
+  // The destination lies within a single cache line.
+  set_destination(dest);
 }
 
 
--- a/src/hotspot/cpu/x86/sharedRuntime_x86_32.cpp	Wed Oct 03 15:54:35 2018 +0200
+++ b/src/hotspot/cpu/x86/sharedRuntime_x86_32.cpp	Wed Oct 03 16:02:24 2018 +0200
@@ -2007,12 +2007,9 @@
     // Save (object->mark() | 1) into BasicLock's displaced header
     __ movptr(Address(lock_reg, mark_word_offset), swap_reg);
 
-    if (os::is_MP()) {
-      __ lock();
-    }
-
     // src -> dest iff dest == rax, else rax, <- dest
     // *obj_reg = lock_reg iff *obj_reg == rax, else rax, = *(obj_reg)
+    __ lock();
     __ cmpxchgptr(lock_reg, Address(obj_reg, oopDesc::mark_offset_in_bytes()));
     __ jcc(Assembler::equal, lock_done);
 
@@ -2091,19 +2088,17 @@
   //     didn't see any synchronization is progress, and escapes.
   __ movl(Address(thread, JavaThread::thread_state_offset()), _thread_in_native_trans);
 
-  if(os::is_MP()) {
-    if (UseMembar) {
-      // Force this write out before the read below
-      __ membar(Assembler::Membar_mask_bits(
-           Assembler::LoadLoad | Assembler::LoadStore |
-           Assembler::StoreLoad | Assembler::StoreStore));
-    } else {
-      // Write serialization page so VM thread can do a pseudo remote membar.
-      // We use the current thread pointer to calculate a thread specific
-      // offset to write to within the page. This minimizes bus traffic
-      // due to cache line collision.
-      __ serialize_memory(thread, rcx);
-    }
+  if (UseMembar) {
+    // Force this write out before the read below
+    __ membar(Assembler::Membar_mask_bits(
+              Assembler::LoadLoad | Assembler::LoadStore |
+              Assembler::StoreLoad | Assembler::StoreStore));
+  } else {
+    // Write serialization page so VM thread can do a pseudo remote membar.
+    // We use the current thread pointer to calculate a thread specific
+    // offset to write to within the page. This minimizes bus traffic
+    // due to cache line collision.
+    __ serialize_memory(thread, rcx);
   }
 
   if (AlwaysRestoreFPU) {
@@ -2199,12 +2194,9 @@
     __ lea(rax, Address(rbp, lock_slot_rbp_offset));
 
     // Atomic swap old header if oop still contains the stack lock
-    if (os::is_MP()) {
-    __ lock();
-    }
-
     // src -> dest iff dest == rax, else rax, <- dest
     // *obj_reg = rbx, iff *obj_reg == rax, else rax, = *(obj_reg)
+    __ lock();
     __ cmpxchgptr(rbx, Address(obj_reg, oopDesc::mark_offset_in_bytes()));
     __ jcc(Assembler::notEqual, slow_path_unlock);
 
--- a/src/hotspot/cpu/x86/sharedRuntime_x86_64.cpp	Wed Oct 03 15:54:35 2018 +0200
+++ b/src/hotspot/cpu/x86/sharedRuntime_x86_64.cpp	Wed Oct 03 16:02:24 2018 +0200
@@ -2464,11 +2464,8 @@
     // Save (object->mark() | 1) into BasicLock's displaced header
     __ movptr(Address(lock_reg, mark_word_offset), swap_reg);
 
-    if (os::is_MP()) {
-      __ lock();
-    }
-
     // src -> dest iff dest == rax else rax <- dest
+    __ lock();
     __ cmpxchgptr(lock_reg, Address(obj_reg, oopDesc::mark_offset_in_bytes()));
     __ jcc(Assembler::equal, lock_done);
 
@@ -2558,19 +2555,17 @@
   //     didn't see any synchronization is progress, and escapes.
   __ movl(Address(r15_thread, JavaThread::thread_state_offset()), _thread_in_native_trans);
 
-  if(os::is_MP()) {
-    if (UseMembar) {
-      // Force this write out before the read below
-      __ membar(Assembler::Membar_mask_bits(
-           Assembler::LoadLoad | Assembler::LoadStore |
-           Assembler::StoreLoad | Assembler::StoreStore));
-    } else {
-      // Write serialization page so VM thread can do a pseudo remote membar.
-      // We use the current thread pointer to calculate a thread specific
-      // offset to write to within the page. This minimizes bus traffic
-      // due to cache line collision.
-      __ serialize_memory(r15_thread, rcx);
-    }
+  if (UseMembar) {
+    // Force this write out before the read below
+    __ membar(Assembler::Membar_mask_bits(
+                Assembler::LoadLoad | Assembler::LoadStore |
+                Assembler::StoreLoad | Assembler::StoreStore));
+  } else {
+    // Write serialization page so VM thread can do a pseudo remote membar.
+    // We use the current thread pointer to calculate a thread specific
+    // offset to write to within the page. This minimizes bus traffic
+    // due to cache line collision.
+    __ serialize_memory(r15_thread, rcx);
   }
 
   Label after_transition;
@@ -2661,9 +2656,7 @@
     __ movptr(old_hdr, Address(rax, 0));
 
     // Atomic swap old header if oop still contains the stack lock
-    if (os::is_MP()) {
-      __ lock();
-    }
+    __ lock();
     __ cmpxchgptr(old_hdr, Address(obj_reg, oopDesc::mark_offset_in_bytes()));
     __ jcc(Assembler::notEqual, slow_path_unlock);
 
--- a/src/hotspot/cpu/x86/stubGenerator_x86_32.cpp	Wed Oct 03 15:54:35 2018 +0200
+++ b/src/hotspot/cpu/x86/stubGenerator_x86_32.cpp	Wed Oct 03 16:02:24 2018 +0200
@@ -87,8 +87,8 @@
     case T_INT:     inc_counter_np(SharedRuntime::_jint_array_copy_ctr); return;
     case T_LONG:    inc_counter_np(SharedRuntime::_jlong_array_copy_ctr); return;
     case T_OBJECT:  inc_counter_np(SharedRuntime::_oop_array_copy_ctr); return;
+    default:        ShouldNotReachHere();
     }
-    ShouldNotReachHere();
 #endif //PRODUCT
   }
 
@@ -153,12 +153,6 @@
     __ movptr(saved_rsi, rsi);
     __ movptr(saved_rbx, rbx);
 
-    // provide initial value for required masks
-    if (UseAVX > 2) {
-      __ movl(rbx, 0xffff);
-      __ kmovwl(k1, rbx);
-    }
-
     // save and initialize %mxcsr
     if (sse_save) {
       Label skip_ldmx;
@@ -679,12 +673,7 @@
   void xmm_copy_forward(Register from, Register to_from, Register qword_count) {
     assert( UseSSE >= 2, "supported cpu only" );
     Label L_copy_64_bytes_loop, L_copy_64_bytes, L_copy_8_bytes, L_exit;
-    if (UseAVX > 2) {
-      __ push(rbx);
-      __ movl(rbx, 0xffff);
-      __ kmovwl(k1, rbx);
-      __ pop(rbx);
-    }
+
     // Copy 64-byte chunks
     __ jmpb(L_copy_64_bytes);
     __ align(OptoLoopAlignment);
@@ -2115,14 +2104,6 @@
 
     __ enter();   // required for proper stackwalking of RuntimeStub frame
 
-    // For EVEX with VL and BW, provide a standard mask, VL = 128 will guide the merge
-    // context for the registers used, where all instructions below are using 128-bit mode
-    // On EVEX without VL and BW, these instructions will all be AVX.
-    if (VM_Version::supports_avx512vlbw()) {
-      __ movl(rdx, 0xffff);
-      __ kmovdl(k1, rdx);
-    }
-
     __ movptr(from, from_param);
     __ movptr(key, key_param);
 
@@ -2222,14 +2203,6 @@
 
     __ enter(); // required for proper stackwalking of RuntimeStub frame
 
-    // For EVEX with VL and BW, provide a standard mask, VL = 128 will guide the merge
-    // context for the registers used, where all instructions below are using 128-bit mode
-    // On EVEX without VL and BW, these instructions will all be AVX.
-    if (VM_Version::supports_avx512vlbw()) {
-      __ movl(rdx, 0xffff);
-      __ kmovdl(k1, rdx);
-    }
-
     __ movptr(from, from_param);
     __ movptr(key, key_param);
 
@@ -2356,14 +2329,6 @@
     __ enter(); // required for proper stackwalking of RuntimeStub frame
     handleSOERegisters(true /*saving*/);
 
-    // For EVEX with VL and BW, provide a standard mask, VL = 128 will guide the merge
-    // context for the registers used, where all instructions below are using 128-bit mode
-    // On EVEX without VL and BW, these instructions will all be AVX.
-    if (VM_Version::supports_avx512vlbw()) {
-      __ movl(rdx, 0xffff);
-      __ kmovdl(k1, rdx);
-    }
-
     // load registers from incoming parameters
     const Address  from_param(rbp, 8+0);
     const Address  to_param  (rbp, 8+4);
@@ -2532,14 +2497,6 @@
     __ enter(); // required for proper stackwalking of RuntimeStub frame
     handleSOERegisters(true /*saving*/);
 
-    // For EVEX with VL and BW, provide a standard mask, VL = 128 will guide the merge
-    // context for the registers used, where all instructions below are using 128-bit mode
-    // On EVEX without VL and BW, these instructions will all be AVX.
-    if (VM_Version::supports_avx512vlbw()) {
-      __ movl(rdx, 0xffff);
-      __ kmovdl(k1, rdx);
-    }
-
     // load registers from incoming parameters
     const Address  from_param(rbp, 8+0);
     const Address  to_param  (rbp, 8+4);
@@ -2693,14 +2650,6 @@
     __ enter(); // required for proper stackwalking of RuntimeStub frame
     handleSOERegisters(true /*saving*/); // save rbx, rsi, rdi
 
-    // For EVEX with VL and BW, provide a standard mask, VL = 128 will guide the merge
-    // context for the registers used, where all instructions below are using 128-bit mode
-    // On EVEX without VL and BW, these instructions will all be AVX.
-    if (VM_Version::supports_avx512vlbw()) {
-      __ movl(rdx, 0xffff);
-      __ kmovdl(k1, rdx);
-    }
-
     // load registers from incoming parameters
     const Address  from_param(rbp, 8+0);
     const Address  to_param  (rbp, 8+4);
@@ -3154,14 +3103,6 @@
     __ enter();
     handleSOERegisters(true);  // Save registers
 
-    // For EVEX with VL and BW, provide a standard mask, VL = 128 will guide the merge
-    // context for the registers used, where all instructions below are using 128-bit mode
-    // On EVEX without VL and BW, these instructions will all be AVX.
-    if (VM_Version::supports_avx512vlbw()) {
-      __ movl(rdx, 0xffff);
-      __ kmovdl(k1, rdx);
-    }
-
     __ movptr(state, state_param);
     __ movptr(subkeyH, subkeyH_param);
     __ movptr(data, data_param);
--- a/src/hotspot/cpu/x86/stubGenerator_x86_64.cpp	Wed Oct 03 15:54:35 2018 +0200
+++ b/src/hotspot/cpu/x86/stubGenerator_x86_64.cpp	Wed Oct 03 16:02:24 2018 +0200
@@ -254,10 +254,7 @@
     __ movptr(r13_save, r13);
     __ movptr(r14_save, r14);
     __ movptr(r15_save, r15);
-    if (UseAVX > 2) {
-      __ movl(rbx, 0xffff);
-      __ kmovwl(k1, rbx);
-    }
+
 #ifdef _WIN64
     int last_reg = 15;
     if (UseAVX > 2) {
@@ -610,7 +607,7 @@
     address start = __ pc();
 
     __ movl(rax, c_rarg2);
-   if ( os::is_MP() ) __ lock();
+    __ lock();
     __ cmpxchgl(c_rarg0, Address(c_rarg1, 0));
     __ ret(0);
 
@@ -636,7 +633,7 @@
     address start = __ pc();
 
     __ movsbq(rax, c_rarg2);
-   if ( os::is_MP() ) __ lock();
+    __ lock();
     __ cmpxchgb(c_rarg0, Address(c_rarg1, 0));
     __ ret(0);
 
@@ -662,7 +659,7 @@
     address start = __ pc();
 
     __ movq(rax, c_rarg2);
-   if ( os::is_MP() ) __ lock();
+    __ lock();
     __ cmpxchgq(c_rarg0, Address(c_rarg1, 0));
     __ ret(0);
 
@@ -683,7 +680,7 @@
     address start = __ pc();
 
     __ movl(rax, c_rarg0);
-   if ( os::is_MP() ) __ lock();
+    __ lock();
     __ xaddl(Address(c_rarg1, 0), c_rarg0);
     __ addl(rax, c_rarg0);
     __ ret(0);
@@ -705,7 +702,7 @@
     address start = __ pc();
 
     __ movptr(rax, c_rarg0); // Copy to eax we need a return value anyhow
-   if ( os::is_MP() ) __ lock();
+    __ lock();
     __ xaddptr(Address(c_rarg1, 0), c_rarg0);
     __ addptr(rax, c_rarg0);
     __ ret(0);
@@ -1257,10 +1254,6 @@
     __ align(OptoLoopAlignment);
     if (UseUnalignedLoadStores) {
       Label L_end;
-      if (UseAVX > 2) {
-        __ movl(to, 0xffff);
-        __ kmovwl(k1, to);
-      }
       // Copy 64-bytes per iteration
       __ BIND(L_loop);
       if (UseAVX > 2) {
@@ -1341,10 +1334,6 @@
     __ align(OptoLoopAlignment);
     if (UseUnalignedLoadStores) {
       Label L_end;
-      if (UseAVX > 2) {
-        __ movl(to, 0xffff);
-        __ kmovwl(k1, to);
-      }
       // Copy 64-bytes per iteration
       __ BIND(L_loop);
       if (UseAVX > 2) {
@@ -3005,14 +2994,6 @@
 
     __ enter(); // required for proper stackwalking of RuntimeStub frame
 
-    // For EVEX with VL and BW, provide a standard mask, VL = 128 will guide the merge
-    // context for the registers used, where all instructions below are using 128-bit mode
-    // On EVEX without VL and BW, these instructions will all be AVX.
-    if (VM_Version::supports_avx512vlbw()) {
-      __ movl(rax, 0xffff);
-      __ kmovql(k1, rax);
-    }
-
     // keylen could be only {11, 13, 15} * 4 = {44, 52, 60}
     __ movl(keylen, Address(key, arrayOopDesc::length_offset_in_bytes() - arrayOopDesc::base_offset_in_bytes(T_INT)));
 
@@ -3107,14 +3088,6 @@
 
     __ enter(); // required for proper stackwalking of RuntimeStub frame
 
-    // For EVEX with VL and BW, provide a standard mask, VL = 128 will guide the merge
-    // context for the registers used, where all instructions below are using 128-bit mode
-    // On EVEX without VL and BW, these instructions will all be AVX.
-    if (VM_Version::supports_avx512vlbw()) {
-      __ movl(rax, 0xffff);
-      __ kmovql(k1, rax);
-    }
-
     // keylen could be only {11, 13, 15} * 4 = {44, 52, 60}
     __ movl(keylen, Address(key, arrayOopDesc::length_offset_in_bytes() - arrayOopDesc::base_offset_in_bytes(T_INT)));
 
@@ -3227,14 +3200,6 @@
 
     __ enter(); // required for proper stackwalking of RuntimeStub frame
 
-    // For EVEX with VL and BW, provide a standard mask, VL = 128 will guide the merge
-    // context for the registers used, where all instructions below are using 128-bit mode
-    // On EVEX without VL and BW, these instructions will all be AVX.
-    if (VM_Version::supports_avx512vlbw()) {
-      __ movl(rax, 0xffff);
-      __ kmovql(k1, rax);
-    }
-
 #ifdef _WIN64
     // on win64, fill len_reg from stack position
     __ movl(len_reg, len_mem);
@@ -3428,14 +3393,6 @@
 
     __ enter(); // required for proper stackwalking of RuntimeStub frame
 
-    // For EVEX with VL and BW, provide a standard mask, VL = 128 will guide the merge
-    // context for the registers used, where all instructions below are using 128-bit mode
-    // On EVEX without VL and BW, these instructions will all be AVX.
-    if (VM_Version::supports_avx512vlbw()) {
-      __ movl(rax, 0xffff);
-      __ kmovql(k1, rax);
-    }
-
 #ifdef _WIN64
     // on win64, fill len_reg from stack position
     __ movl(len_reg, len_mem);
@@ -3902,14 +3859,6 @@
 
     __ enter(); // required for proper stackwalking of RuntimeStub frame
 
-    // For EVEX with VL and BW, provide a standard mask, VL = 128 will guide the merge
-    // context for the registers used, where all instructions below are using 128-bit mode
-    // On EVEX without VL and BW, these instructions will all be AVX.
-    if (VM_Version::supports_avx512vlbw()) {
-        __ movl(rax, 0xffff);
-        __ kmovql(k1, rax);
-    }
-
 #ifdef _WIN64
     // allocate spill slots for r13, r14
     enum {
@@ -4484,14 +4433,6 @@
 
     __ enter();
 
-    // For EVEX with VL and BW, provide a standard mask, VL = 128 will guide the merge
-    // context for the registers used, where all instructions below are using 128-bit mode
-    // On EVEX without VL and BW, these instructions will all be AVX.
-    if (VM_Version::supports_avx512vlbw()) {
-      __ movl(rax, 0xffff);
-      __ kmovql(k1, rax);
-    }
-
     __ movdqu(xmm_temp10, ExternalAddress(StubRoutines::x86::ghash_long_swap_mask_addr()));
 
     __ movdqu(xmm_temp0, Address(state, 0));
@@ -4761,7 +4702,6 @@
     __ push(r13);
     __ push(r14);
     __ push(r15);
-    __ push(rbx);
 
     // arguments
     const Register source = c_rarg0; // Source Array
@@ -4790,8 +4730,6 @@
     __ cmpl(length, 0);
     __ jcc(Assembler::lessEqual, L_exit);
 
-    // Save k1 value in rbx
-    __ kmovql(rbx, k1);
     __ lea(r11, ExternalAddress(StubRoutines::x86::base64_charset_addr()));
     // check if base64 charset(isURL=0) or base64 url charset(isURL=1) needs to be loaded
     __ cmpl(isURL, 0);
@@ -4802,7 +4740,7 @@
     __ BIND(L_processdata);
     __ movdqu(xmm16, ExternalAddress(StubRoutines::x86::base64_gather_mask_addr()));
     // Set 64 bits of K register.
-    __ evpcmpeqb(k1, xmm16, xmm16, Assembler::AVX_512bit);
+    __ evpcmpeqb(k3, xmm16, xmm16, Assembler::AVX_512bit);
     __ evmovdquq(xmm12, ExternalAddress(StubRoutines::x86::base64_bswap_mask_addr()), Assembler::AVX_256bit, r13);
     __ evmovdquq(xmm13, ExternalAddress(StubRoutines::x86::base64_right_shift_mask_addr()), Assembler::AVX_512bit, r13);
     __ evmovdquq(xmm14, ExternalAddress(StubRoutines::x86::base64_left_shift_mask_addr()), Assembler::AVX_512bit, r13);
@@ -4881,17 +4819,17 @@
     __ vextracti64x4(xmm4, xmm5, 1);
     __ vpmovzxwd(xmm7, xmm4, Assembler::AVX_512bit);
 
-    __ kmovql(k2, k1);
+    __ kmovql(k2, k3);
     __ evpgatherdd(xmm4, k2, Address(r11, xmm0, Address::times_4, 0), Assembler::AVX_512bit);
-    __ kmovql(k2, k1);
+    __ kmovql(k2, k3);
     __ evpgatherdd(xmm5, k2, Address(r11, xmm1, Address::times_4, 0), Assembler::AVX_512bit);
-    __ kmovql(k2, k1);
+    __ kmovql(k2, k3);
     __ evpgatherdd(xmm8, k2, Address(r11, xmm2, Address::times_4, 0), Assembler::AVX_512bit);
-    __ kmovql(k2, k1);
+    __ kmovql(k2, k3);
     __ evpgatherdd(xmm9, k2, Address(r11, xmm3, Address::times_4, 0), Assembler::AVX_512bit);
-    __ kmovql(k2, k1);
+    __ kmovql(k2, k3);
     __ evpgatherdd(xmm10, k2, Address(r11, xmm6, Address::times_4, 0), Assembler::AVX_512bit);
-    __ kmovql(k2, k1);
+    __ kmovql(k2, k3);
     __ evpgatherdd(xmm11, k2, Address(r11, xmm7, Address::times_4, 0), Assembler::AVX_512bit);
 
     //Down convert dword to byte. Final output is 16*6 = 96 bytes long
@@ -4927,9 +4865,9 @@
     __ vpmovzxwd(xmm6, xmm9, Assembler::AVX_512bit);
     __ vextracti64x4(xmm9, xmm1, 1);
     __ vpmovzxwd(xmm5, xmm9,  Assembler::AVX_512bit);
-    __ kmovql(k2, k1);
+    __ kmovql(k2, k3);
     __ evpgatherdd(xmm8, k2, Address(r11, xmm6, Address::times_4, 0), Assembler::AVX_512bit);
-    __ kmovql(k2, k1);
+    __ kmovql(k2, k3);
     __ evpgatherdd(xmm10, k2, Address(r11, xmm5, Address::times_4, 0), Assembler::AVX_512bit);
     __ evpmovdb(Address(dest, dp, Address::times_1, 0), xmm8, Assembler::AVX_512bit);
     __ evpmovdb(Address(dest, dp, Address::times_1, 16), xmm10, Assembler::AVX_512bit);
@@ -4985,9 +4923,6 @@
     __ addq(source, 3);
     __ jmp(L_process3);
     __ BIND(L_exit);
-    // restore k1 register value
-    __ kmovql(k1, rbx);
-    __ pop(rbx);
     __ pop(r15);
     __ pop(r14);
     __ pop(r13);
--- a/src/hotspot/cpu/x86/templateInterpreterGenerator_x86.cpp	Wed Oct 03 15:54:35 2018 +0200
+++ b/src/hotspot/cpu/x86/templateInterpreterGenerator_x86.cpp	Wed Oct 03 16:02:24 2018 +0200
@@ -1090,19 +1090,17 @@
   __ movl(Address(thread, JavaThread::thread_state_offset()),
           _thread_in_native_trans);
 
-  if (os::is_MP()) {
-    if (UseMembar) {
-      // Force this write out before the read below
-      __ membar(Assembler::Membar_mask_bits(
-           Assembler::LoadLoad | Assembler::LoadStore |
-           Assembler::StoreLoad | Assembler::StoreStore));
-    } else {
-      // Write serialization page so VM thread can do a pseudo remote membar.
-      // We use the current thread pointer to calculate a thread specific
-      // offset to write to within the page. This minimizes bus traffic
-      // due to cache line collision.
-      __ serialize_memory(thread, rcx);
-    }
+  if (UseMembar) {
+    // Force this write out before the read below
+    __ membar(Assembler::Membar_mask_bits(
+                Assembler::LoadLoad | Assembler::LoadStore |
+                Assembler::StoreLoad | Assembler::StoreStore));
+  } else {
+    // Write serialization page so VM thread can do a pseudo remote membar.
+    // We use the current thread pointer to calculate a thread specific
+    // offset to write to within the page. This minimizes bus traffic
+    // due to cache line collision.
+    __ serialize_memory(thread, rcx);
   }
 
 #ifndef _LP64
--- a/src/hotspot/cpu/x86/templateTable_x86.cpp	Wed Oct 03 15:54:35 2018 +0200
+++ b/src/hotspot/cpu/x86/templateTable_x86.cpp	Wed Oct 03 16:02:24 2018 +0200
@@ -448,7 +448,7 @@
     Label notNull;
     ExternalAddress null_sentinel((address)Universe::the_null_sentinel_addr());
     __ movptr(tmp, null_sentinel);
-    __ cmpptr(tmp, result);
+    __ cmpoop(tmp, result);
     __ jccb(Assembler::notEqual, notNull);
     __ xorptr(result, result);  // NULL object reference
     __ bind(notNull);
@@ -2714,7 +2714,6 @@
 
 void TemplateTable::volatile_barrier(Assembler::Membar_mask_bits order_constraint ) {
   // Helper function to insert a is-volatile test and memory barrier
-  if(!os::is_MP()) return;    // Not needed on single CPU
   __ membar(order_constraint);
 }
 
@@ -3493,13 +3492,12 @@
   __ get_cache_and_index_at_bcp(rcx, rbx, 1);
   // replace index with field offset from cache entry
   // [jk] not needed currently
-  // if (os::is_MP()) {
-  //   __ movl(rdx, Address(rcx, rbx, Address::times_8,
-  //                        in_bytes(ConstantPoolCache::base_offset() +
-  //                                 ConstantPoolCacheEntry::flags_offset())));
-  //   __ shrl(rdx, ConstantPoolCacheEntry::is_volatile_shift);
-  //   __ andl(rdx, 0x1);
-  // }
+  // __ movl(rdx, Address(rcx, rbx, Address::times_8,
+  //                      in_bytes(ConstantPoolCache::base_offset() +
+  //                               ConstantPoolCacheEntry::flags_offset())));
+  // __ shrl(rdx, ConstantPoolCacheEntry::is_volatile_shift);
+  // __ andl(rdx, 0x1);
+  //
   __ movptr(rbx, Address(rcx, rbx, Address::times_ptr,
                          in_bytes(ConstantPoolCache::base_offset() +
                                   ConstantPoolCacheEntry::f2_offset())));
@@ -3544,13 +3542,11 @@
     ShouldNotReachHere();
   }
   // [jk] not needed currently
-  // if (os::is_MP()) {
   //   Label notVolatile;
   //   __ testl(rdx, rdx);
   //   __ jcc(Assembler::zero, notVolatile);
   //   __ membar(Assembler::LoadLoad);
   //   __ bind(notVolatile);
-  //};
 }
 
 void TemplateTable::fast_xaccess(TosState state) {
@@ -3585,17 +3581,15 @@
   }
 
   // [jk] not needed currently
-  // if (os::is_MP()) {
-  //   Label notVolatile;
-  //   __ movl(rdx, Address(rcx, rdx, Address::times_8,
-  //                        in_bytes(ConstantPoolCache::base_offset() +
-  //                                 ConstantPoolCacheEntry::flags_offset())));
-  //   __ shrl(rdx, ConstantPoolCacheEntry::is_volatile_shift);
-  //   __ testl(rdx, 0x1);
-  //   __ jcc(Assembler::zero, notVolatile);
-  //   __ membar(Assembler::LoadLoad);
-  //   __ bind(notVolatile);
-  // }
+  // Label notVolatile;
+  // __ movl(rdx, Address(rcx, rdx, Address::times_8,
+  //                      in_bytes(ConstantPoolCache::base_offset() +
+  //                               ConstantPoolCacheEntry::flags_offset())));
+  // __ shrl(rdx, ConstantPoolCacheEntry::is_volatile_shift);
+  // __ testl(rdx, 0x1);
+  // __ jcc(Assembler::zero, notVolatile);
+  // __ membar(Assembler::LoadLoad);
+  // __ bind(notVolatile);
 
   __ decrement(rbcp);
 }
--- a/src/hotspot/cpu/x86/vm_version_x86.cpp	Wed Oct 03 15:54:35 2018 +0200
+++ b/src/hotspot/cpu/x86/vm_version_x86.cpp	Wed Oct 03 16:02:24 2018 +0200
@@ -401,8 +401,6 @@
       // load value into all 64 bytes of zmm7 register
       __ movl(rcx, VM_Version::ymm_test_value());
       __ movdl(xmm0, rcx);
-      __ movl(rcx, 0xffff);
-      __ kmovwl(k1, rcx);
       __ vpbroadcastd(xmm0, xmm0, Assembler::AVX_512bit);
       __ evmovdqul(xmm7, xmm0, Assembler::AVX_512bit);
 #ifdef _LP64
@@ -885,7 +883,7 @@
     FLAG_SET_DEFAULT(UseSHA, false);
   }
 
-  if (supports_sha() && UseSHA) {
+  if (supports_sha() && supports_sse4_1() && UseSHA) {
     if (FLAG_IS_DEFAULT(UseSHA1Intrinsics)) {
       FLAG_SET_DEFAULT(UseSHA1Intrinsics, true);
     }
@@ -894,7 +892,7 @@
     FLAG_SET_DEFAULT(UseSHA1Intrinsics, false);
   }
 
-  if (UseSHA) {
+  if (supports_sse4_1() && UseSHA) {
     if (FLAG_IS_DEFAULT(UseSHA256Intrinsics)) {
       FLAG_SET_DEFAULT(UseSHA256Intrinsics, true);
     }
--- a/src/hotspot/cpu/x86/x86.ad	Wed Oct 03 15:54:35 2018 +0200
+++ b/src/hotspot/cpu/x86/x86.ad	Wed Oct 03 16:02:24 2018 +0200
@@ -2804,11 +2804,7 @@
 
   format %{
     $$template
-    if (os::is_MP()) {
-      $$emit$$"pause\t! membar_onspinwait"
-    } else {
-      $$emit$$"MEMBAR-onspinwait ! (empty encoding)"
-    }
+    $$emit$$"pause\t! membar_onspinwait"
   %}
   ins_encode %{
     __ pause();
--- a/src/hotspot/cpu/x86/x86_32.ad	Wed Oct 03 15:54:35 2018 +0200
+++ b/src/hotspot/cpu/x86/x86_32.ad	Wed Oct 03 16:02:24 2018 +0200
@@ -2087,8 +2087,7 @@
   %}
 
   enc_class lock_prefix( ) %{
-    if( os::is_MP() )
-      emit_opcode(cbuf,0xF0);         // [Lock]
+    emit_opcode(cbuf,0xF0);         // [Lock]
   %}
 
   // Cmp-xchg long value.
@@ -2102,8 +2101,7 @@
     emit_opcode(cbuf,0x87);
     emit_opcode(cbuf,0xD9);
     // [Lock]
-    if( os::is_MP() )
-      emit_opcode(cbuf,0xF0);
+    emit_opcode(cbuf,0xF0);
     // CMPXCHG8 [Eptr]
     emit_opcode(cbuf,0x0F);
     emit_opcode(cbuf,0xC7);
@@ -2115,8 +2113,7 @@
 
   enc_class enc_cmpxchg(eSIRegP mem_ptr) %{
     // [Lock]
-    if( os::is_MP() )
-      emit_opcode(cbuf,0xF0);
+    emit_opcode(cbuf,0xF0);
 
     // CMPXCHG [Eptr]
     emit_opcode(cbuf,0x0F);
@@ -2126,8 +2123,7 @@
 
   enc_class enc_cmpxchgb(eSIRegP mem_ptr) %{
     // [Lock]
-    if( os::is_MP() )
-      emit_opcode(cbuf,0xF0);
+    emit_opcode(cbuf,0xF0);
 
     // CMPXCHGB [Eptr]
     emit_opcode(cbuf,0x0F);
@@ -2137,8 +2133,7 @@
 
   enc_class enc_cmpxchgw(eSIRegP mem_ptr) %{
     // [Lock]
-    if( os::is_MP() )
-      emit_opcode(cbuf,0xF0);
+    emit_opcode(cbuf,0xF0);
 
     // 16-bit mode
     emit_opcode(cbuf, 0x66);
@@ -6764,11 +6759,7 @@
 
   format %{
     $$template
-    if (os::is_MP()) {
-      $$emit$$"LOCK ADDL [ESP + #0], 0\t! membar_volatile"
-    } else {
-      $$emit$$"MEMBAR-volatile ! (empty encoding)"
-    }
+    $$emit$$"LOCK ADDL [ESP + #0], 0\t! membar_volatile"
   %}
   ins_encode %{
     __ membar(Assembler::StoreLoad);
@@ -7373,8 +7364,7 @@
     //       rcx as the high order word of the new value to store but
     //       our register encoding uses rbx.
     __ xchgl(as_Register(EBX_enc), as_Register(ECX_enc));
-    if( os::is_MP() )
-      __ lock();
+    __ lock();
     __ cmpxchg8($mem$$Address);
     __ xchgl(as_Register(EBX_enc), as_Register(ECX_enc));
   %}
@@ -7499,7 +7489,7 @@
   effect(KILL cr);
   format %{ "ADDB  [$mem],$add" %}
   ins_encode %{
-    if (os::is_MP()) { __ lock(); }
+    __ lock();
     __ addb($mem$$Address, $add$$constant);
   %}
   ins_pipe( pipe_cmpxchg );
@@ -7511,7 +7501,7 @@
   effect(KILL cr);
   format %{ "XADDB  [$mem],$newval" %}
   ins_encode %{
-    if (os::is_MP()) { __ lock(); }
+    __ lock();
     __ xaddb($mem$$Address, $newval$$Register);
   %}
   ins_pipe( pipe_cmpxchg );
@@ -7523,7 +7513,7 @@
   effect(KILL cr);
   format %{ "ADDS  [$mem],$add" %}
   ins_encode %{
-    if (os::is_MP()) { __ lock(); }
+    __ lock();
     __ addw($mem$$Address, $add$$constant);
   %}
   ins_pipe( pipe_cmpxchg );
@@ -7534,7 +7524,7 @@
   effect(KILL cr);
   format %{ "XADDS  [$mem],$newval" %}
   ins_encode %{
-    if (os::is_MP()) { __ lock(); }
+    __ lock();
     __ xaddw($mem$$Address, $newval$$Register);
   %}
   ins_pipe( pipe_cmpxchg );
@@ -7546,7 +7536,7 @@
   effect(KILL cr);
   format %{ "ADDL  [$mem],$add" %}
   ins_encode %{
-    if (os::is_MP()) { __ lock(); }
+    __ lock();
     __ addl($mem$$Address, $add$$constant);
   %}
   ins_pipe( pipe_cmpxchg );
@@ -7557,7 +7547,7 @@
   effect(KILL cr);
   format %{ "XADDL  [$mem],$newval" %}
   ins_encode %{
-    if (os::is_MP()) { __ lock(); }
+    __ lock();
     __ xaddl($mem$$Address, $newval$$Register);
   %}
   ins_pipe( pipe_cmpxchg );
--- a/src/hotspot/cpu/x86/x86_64.ad	Wed Oct 03 15:54:35 2018 +0200
+++ b/src/hotspot/cpu/x86/x86_64.ad	Wed Oct 03 16:02:24 2018 +0200
@@ -1,5 +1,5 @@
 //
-// Copyright (c) 2003, 2017, Oracle and/or its affiliates. All rights reserved.
+// Copyright (c) 2003, 2018, Oracle and/or its affiliates. All rights reserved.
 // DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
 //
 // This code is free software; you can redistribute it and/or modify it
@@ -2341,9 +2341,7 @@
 
   enc_class lock_prefix()
   %{
-    if (os::is_MP()) {
-      emit_opcode(cbuf, 0xF0); // lock
-    }
+    emit_opcode(cbuf, 0xF0); // lock
   %}
 
   enc_class REX_mem(memory mem)
@@ -6601,11 +6599,7 @@
 
   format %{
     $$template
-    if (os::is_MP()) {
-      $$emit$$"lock addl [rsp + #0], 0\t! membar_volatile"
-    } else {
-      $$emit$$"MEMBAR-volatile ! (empty encoding)"
-    }
+    $$emit$$"lock addl [rsp + #0], 0\t! membar_volatile"
   %}
   ins_encode %{
     __ membar(Assembler::StoreLoad);
@@ -7801,7 +7795,7 @@
   effect(KILL cr);
   format %{ "ADDB  [$mem],$add" %}
   ins_encode %{
-    if (os::is_MP()) { __ lock(); }
+    __ lock();
     __ addb($mem$$Address, $add$$constant);
   %}
   ins_pipe( pipe_cmpxchg );
@@ -7812,7 +7806,7 @@
   effect(KILL cr);
   format %{ "XADDB  [$mem],$newval" %}
   ins_encode %{
-    if (os::is_MP()) { __ lock(); }
+    __ lock();
     __ xaddb($mem$$Address, $newval$$Register);
   %}
   ins_pipe( pipe_cmpxchg );
@@ -7824,7 +7818,7 @@
   effect(KILL cr);
   format %{ "ADDW  [$mem],$add" %}
   ins_encode %{
-    if (os::is_MP()) { __ lock(); }
+    __ lock();
     __ addw($mem$$Address, $add$$constant);
   %}
   ins_pipe( pipe_cmpxchg );
@@ -7835,7 +7829,7 @@
   effect(KILL cr);
   format %{ "XADDW  [$mem],$newval" %}
   ins_encode %{
-    if (os::is_MP()) { __ lock(); }
+    __ lock();
     __ xaddw($mem$$Address, $newval$$Register);
   %}
   ins_pipe( pipe_cmpxchg );
@@ -7847,7 +7841,7 @@
   effect(KILL cr);
   format %{ "ADDL  [$mem],$add" %}
   ins_encode %{
-    if (os::is_MP()) { __ lock(); }
+    __ lock();
     __ addl($mem$$Address, $add$$constant);
   %}
   ins_pipe( pipe_cmpxchg );
@@ -7858,7 +7852,7 @@
   effect(KILL cr);
   format %{ "XADDL  [$mem],$newval" %}
   ins_encode %{
-    if (os::is_MP()) { __ lock(); }
+    __ lock();
     __ xaddl($mem$$Address, $newval$$Register);
   %}
   ins_pipe( pipe_cmpxchg );
@@ -7870,7 +7864,7 @@
   effect(KILL cr);
   format %{ "ADDQ  [$mem],$add" %}
   ins_encode %{
-    if (os::is_MP()) { __ lock(); }
+    __ lock();
     __ addq($mem$$Address, $add$$constant);
   %}
   ins_pipe( pipe_cmpxchg );
@@ -7881,7 +7875,7 @@
   effect(KILL cr);
   format %{ "XADDQ  [$mem],$newval" %}
   ins_encode %{
-    if (os::is_MP()) { __ lock(); }
+    __ lock();
     __ xaddq($mem$$Address, $newval$$Register);
   %}
   ins_pipe( pipe_cmpxchg );
@@ -10898,7 +10892,7 @@
   ins_pipe(pipe_slow);
 %}
 
-instruct rep_stos_large(rcx_RegL cnt, rdi_RegP base, regD tmp, rax_RegI zero, 
+instruct rep_stos_large(rcx_RegL cnt, rdi_RegP base, regD tmp, rax_RegI zero,
                         Universe dummy, rFlagsReg cr)
 %{
   predicate(((ClearArrayNode*)n)->is_large());
@@ -10942,7 +10936,7 @@
     }
   %}
   ins_encode %{
-    __ clear_mem($base$$Register, $cnt$$Register, $zero$$Register, 
+    __ clear_mem($base$$Register, $cnt$$Register, $zero$$Register,
                  $tmp$$XMMRegister, true);
   %}
   ins_pipe(pipe_slow);
--- a/src/hotspot/os/linux/os_linux.cpp	Wed Oct 03 15:54:35 2018 +0200
+++ b/src/hotspot/os/linux/os_linux.cpp	Wed Oct 03 16:02:24 2018 +0200
@@ -137,7 +137,6 @@
 address   os::Linux::_initial_thread_stack_bottom = NULL;
 uintptr_t os::Linux::_initial_thread_stack_size   = 0;
 
-int (*os::Linux::_clock_gettime)(clockid_t, struct timespec *) = NULL;
 int (*os::Linux::_pthread_getcpuclockid)(pthread_t, clockid_t *) = NULL;
 int (*os::Linux::_pthread_setname_np)(pthread_t, const char*) = NULL;
 Mutex* os::Linux::_createThread_lock = NULL;
@@ -268,8 +267,7 @@
 
 // Most versions of linux have a bug where the number of processors are
 // determined by looking at the /proc file system.  In a chroot environment,
-// the system call returns 1.  This causes the VM to act as if it is
-// a single processor and elide locking (see is_MP() call).
+// the system call returns 1.
 static bool unsafe_chroot_detected = false;
 static const char *unstable_chroot_error = "/proc file system not found.\n"
                      "Java may be unstable running multithreaded in a chroot "
@@ -1173,6 +1171,10 @@
 ////////////////////////////////////////////////////////////////////////////////
 // time support
 
+#ifndef SUPPORTS_CLOCK_MONOTONIC
+#error "Build platform doesn't support clock_gettime and related functionality"
+#endif
+
 // Time since start-up in seconds to a fine granularity.
 // Used by VMSelfDestructTimer and the MemProfiler.
 double os::elapsedTime() {
@@ -1218,62 +1220,6 @@
   nanos = jlong(time.tv_usec) * 1000;
 }
 
-
-#ifndef CLOCK_MONOTONIC
-  #define CLOCK_MONOTONIC (1)
-#endif
-
-void os::Linux::clock_init() {
-  // we do dlopen's in this particular order due to bug in linux
-  // dynamical loader (see 6348968) leading to crash on exit
-  void* handle = dlopen("librt.so.1", RTLD_LAZY);
-  if (handle == NULL) {
-    handle = dlopen("librt.so", RTLD_LAZY);
-  }
-
-  if (handle) {
-    int (*clock_getres_func)(clockid_t, struct timespec*) =
-           (int(*)(clockid_t, struct timespec*))dlsym(handle, "clock_getres");
-    int (*clock_gettime_func)(clockid_t, struct timespec*) =
-           (int(*)(clockid_t, struct timespec*))dlsym(handle, "clock_gettime");
-    if (clock_getres_func && clock_gettime_func) {
-      // See if monotonic clock is supported by the kernel. Note that some
-      // early implementations simply return kernel jiffies (updated every
-      // 1/100 or 1/1000 second). It would be bad to use such a low res clock
-      // for nano time (though the monotonic property is still nice to have).
-      // It's fixed in newer kernels, however clock_getres() still returns
-      // 1/HZ. We check if clock_getres() works, but will ignore its reported
-      // resolution for now. Hopefully as people move to new kernels, this
-      // won't be a problem.
-      struct timespec res;
-      struct timespec tp;
-      if (clock_getres_func (CLOCK_MONOTONIC, &res) == 0 &&
-          clock_gettime_func(CLOCK_MONOTONIC, &tp)  == 0) {
-        // yes, monotonic clock is supported
-        _clock_gettime = clock_gettime_func;
-        return;
-      } else {
-        // close librt if there is no monotonic clock
-        dlclose(handle);
-      }
-    }
-  }
-  warning("No monotonic clock was available - timed services may " \
-          "be adversely affected if the time-of-day clock changes");
-}
-
-#ifndef SYS_clock_getres
-  #if defined(X86) || defined(PPC64) || defined(S390)
-    #define SYS_clock_getres AMD64_ONLY(229) IA32_ONLY(266) PPC64_ONLY(247) S390_ONLY(261)
-    #define sys_clock_getres(x,y)  ::syscall(SYS_clock_getres, x, y)
-  #else
-    #warning "SYS_clock_getres not defined for this platform, disabling fast_thread_cpu_time"
-    #define sys_clock_getres(x,y)  -1
-  #endif
-#else
-  #define sys_clock_getres(x,y)  ::syscall(SYS_clock_getres, x, y)
-#endif
-
 void os::Linux::fast_thread_clock_init() {
   if (!UseLinuxPosixThreadCPUClocks) {
     return;
@@ -1284,17 +1230,17 @@
       (int(*)(pthread_t, clockid_t *)) dlsym(RTLD_DEFAULT, "pthread_getcpuclockid");
 
   // Switch to using fast clocks for thread cpu time if
-  // the sys_clock_getres() returns 0 error code.
+  // the clock_getres() returns 0 error code.
   // Note, that some kernels may support the current thread
   // clock (CLOCK_THREAD_CPUTIME_ID) but not the clocks
   // returned by the pthread_getcpuclockid().
-  // If the fast Posix clocks are supported then the sys_clock_getres()
+  // If the fast Posix clocks are supported then the clock_getres()
   // must return at least tp.tv_sec == 0 which means a resolution
   // better than 1 sec. This is extra check for reliability.
 
   if (pthread_getcpuclockid_func &&
       pthread_getcpuclockid_func(_main_thread, &clockid) == 0 &&
-      sys_clock_getres(clockid, &tp) == 0 && tp.tv_sec == 0) {
+      os::Posix::clock_getres(clockid, &tp) == 0 && tp.tv_sec == 0) {
     _supports_fast_thread_cpu_time = true;
     _pthread_getcpuclockid = pthread_getcpuclockid_func;
   }
@@ -1303,7 +1249,7 @@
 jlong os::javaTimeNanos() {
   if (os::supports_monotonic_clock()) {
     struct timespec tp;
-    int status = Linux::clock_gettime(CLOCK_MONOTONIC, &tp);
+    int status = os::Posix::clock_gettime(CLOCK_MONOTONIC, &tp);
     assert(status == 0, "gettime error");
     jlong result = jlong(tp.tv_sec) * (1000 * 1000 * 1000) + jlong(tp.tv_nsec);
     return result;
@@ -1622,9 +1568,6 @@
         // This is OK - No Java threads have been created yet, and hence no
         // stack guard pages to fix.
         //
-        // This should happen only when you are building JDK7 using a very
-        // old version of JDK6 (e.g., with JPRT) and running test_gamma.
-        //
         // Dynamic loader will make all stacks executable after
         // this function returns, and will not do that again.
         assert(Threads::number_of_threads() == 0, "no Java threads should exist yet.");
@@ -1877,12 +1820,16 @@
   return (void*)::dlopen(NULL, RTLD_LAZY);
 }
 
-static bool _print_ascii_file(const char* filename, outputStream* st) {
+static bool _print_ascii_file(const char* filename, outputStream* st, const char* hdr = NULL) {
   int fd = ::open(filename, O_RDONLY);
   if (fd == -1) {
     return false;
   }
 
+  if (hdr != NULL) {
+    st->print_cr("%s", hdr);
+  }
+
   char buf[33];
   int bytes;
   buf[32] = '\0';
@@ -1975,6 +1922,8 @@
 
   os::Linux::print_proc_sys_info(st);
 
+  os::Linux::print_ld_preload_file(st);
+
   os::Linux::print_container_info(st);
 }
 
@@ -2133,6 +2082,11 @@
   st->cr();
 }
 
+void os::Linux::print_ld_preload_file(outputStream* st) {
+  _print_ascii_file("/etc/ld.so.preload", st, "\n/etc/ld.so.preload:");
+  st->cr();
+}
+
 void os::Linux::print_container_info(outputStream* st) {
   if (!OSContainer::is_containerized()) {
     return;
@@ -2471,7 +2425,7 @@
 static struct timespec create_semaphore_timespec(unsigned int sec, int nsec) {
   struct timespec ts;
   // Semaphore's are always associated with CLOCK_REALTIME
-  os::Linux::clock_gettime(CLOCK_REALTIME, &ts);
+  os::Posix::clock_gettime(CLOCK_REALTIME, &ts);
   // see os_posix.cpp for discussion on overflow checking
   if (sec >= MAX_SECS) {
     ts.tv_sec += MAX_SECS;
@@ -4704,7 +4658,7 @@
 
 jlong os::Linux::fast_thread_cpu_time(clockid_t clockid) {
   struct timespec tp;
-  int rc = os::Linux::clock_gettime(clockid, &tp);
+  int rc = os::Posix::clock_gettime(clockid, &tp);
   assert(rc == 0, "clock_gettime is expected to return 0 code");
 
   return (tp.tv_sec * NANOSECS_PER_SEC) + tp.tv_nsec;
@@ -4976,14 +4930,19 @@
   // _main_thread points to the thread that created/loaded the JVM.
   Linux::_main_thread = pthread_self();
 
-  Linux::clock_init();
-  initial_time_count = javaTimeNanos();
-
   // retrieve entry point for pthread_setname_np
   Linux::_pthread_setname_np =
     (int(*)(pthread_t, const char*))dlsym(RTLD_DEFAULT, "pthread_setname_np");
 
   os::Posix::init();
+
+  initial_time_count = javaTimeNanos();
+
+  // Always warn if no monotonic clock available
+  if (!os::Posix::supports_monotonic_clock()) {
+    warning("No monotonic clock was available - timed services may "    \
+            "be adversely affected if the time-of-day clock changes");
+  }
 }
 
 // To install functions for atexit system call
--- a/src/hotspot/os/linux/os_linux.hpp	Wed Oct 03 15:54:35 2018 +0200
+++ b/src/hotspot/os/linux/os_linux.hpp	Wed Oct 03 16:02:24 2018 +0200
@@ -43,7 +43,6 @@
 
   static void check_signal_handler(int sig);
 
-  static int (*_clock_gettime)(clockid_t, struct timespec *);
   static int (*_pthread_getcpuclockid)(pthread_t, clockid_t *);
   static int (*_pthread_setname_np)(pthread_t, const char*);
 
@@ -114,6 +113,7 @@
   static void print_distro_info(outputStream* st);
   static void print_libversion_info(outputStream* st);
   static void print_proc_sys_info(outputStream* st);
+  static void print_ld_preload_file(outputStream* st);
 
  public:
   static bool _stack_is_executable;
@@ -189,16 +189,9 @@
   static bool manually_expand_stack(JavaThread * t, address addr);
   static int max_register_window_saves_before_flushing();
 
-  // Real-time clock functions
-  static void clock_init(void);
-
   // fast POSIX clocks support
   static void fast_thread_clock_init(void);
 
-  static int clock_gettime(clockid_t clock_id, struct timespec *tp) {
-    return _clock_gettime ? _clock_gettime(clock_id, tp) : -1;
-  }
-
   static int pthread_getcpuclockid(pthread_t tid, clockid_t *clock_id) {
     return _pthread_getcpuclockid ? _pthread_getcpuclockid(tid, clock_id) : -1;
   }
--- a/src/hotspot/os/linux/os_linux.inline.hpp	Wed Oct 03 15:54:35 2018 +0200
+++ b/src/hotspot/os/linux/os_linux.inline.hpp	Wed Oct 03 16:02:24 2018 +0200
@@ -141,7 +141,7 @@
 }
 
 inline bool os::supports_monotonic_clock() {
-  return Linux::_clock_gettime != NULL;
+  return os::Posix::supports_monotonic_clock();
 }
 
 inline void os::exit(int num) {
--- a/src/hotspot/os/posix/os_posix.cpp	Wed Oct 03 15:54:35 2018 +0200
+++ b/src/hotspot/os/posix/os_posix.cpp	Wed Oct 03 16:02:24 2018 +0200
@@ -1609,10 +1609,25 @@
 // This means we have clockid_t, clock_gettime et al and CLOCK_MONOTONIC
 
 static int (*_clock_gettime)(clockid_t, struct timespec *);
+static int (*_clock_getres)(clockid_t, struct timespec *);
 static int (*_pthread_condattr_setclock)(pthread_condattr_t *, clockid_t);
 
 static bool _use_clock_monotonic_condattr;
 
+// Exported clock functionality
+
+int os::Posix::clock_gettime(clockid_t clock_id, struct timespec *tp) {
+  return _clock_gettime != NULL ? _clock_gettime(clock_id, tp) : -1;
+}
+
+int os::Posix::clock_getres(clockid_t clock_id, struct timespec *tp) {
+  return _clock_getres != NULL ? _clock_getres(clock_id, tp) : -1;
+}
+
+bool os::Posix::supports_monotonic_clock() {
+  return _clock_gettime != NULL;
+}
+
 // Determine what POSIX API's are present and do appropriate
 // configuration.
 void os::Posix::init(void) {
@@ -1620,8 +1635,6 @@
   // NOTE: no logging available when this is called. Put logging
   // statements in init_2().
 
-  // Copied from os::Linux::clock_init(). The duplication is temporary.
-
   // 1. Check for CLOCK_MONOTONIC support.
 
   void* handle = NULL;
@@ -1642,6 +1655,7 @@
   }
 
   _clock_gettime = NULL;
+  _clock_getres = NULL;
 
   int (*clock_getres_func)(clockid_t, struct timespec*) =
     (int(*)(clockid_t, struct timespec*))dlsym(handle, "clock_getres");
@@ -1656,6 +1670,7 @@
         clock_gettime_func(CLOCK_MONOTONIC, &tp) == 0) {
       // Yes, monotonic clock is supported.
       _clock_gettime = clock_gettime_func;
+      _clock_getres = clock_getres_func;
     } else {
 #ifdef NEEDS_LIBRT
       // Close librt if there is no monotonic clock.
--- a/src/hotspot/os/posix/os_posix.hpp	Wed Oct 03 15:54:35 2018 +0200
+++ b/src/hotspot/os/posix/os_posix.hpp	Wed Oct 03 16:02:24 2018 +0200
@@ -116,6 +116,18 @@
   // Returns true if either given uid is effective uid and given gid is
   // effective gid, or if given uid is root.
   static bool matches_effective_uid_and_gid_or_root(uid_t uid, gid_t gid);
+
+#ifdef SUPPORTS_CLOCK_MONOTONIC
+
+  static bool supports_monotonic_clock();
+  static int clock_gettime(clockid_t clock_id, struct timespec *tp);
+  static int clock_getres(clockid_t clock_id, struct timespec *tp);
+
+#else
+
+  static bool supports_monotonic_clock() { return false; }
+
+#endif
 };
 
 // On POSIX platforms the signal handler is global so we just do the write.
--- a/src/hotspot/os_cpu/bsd_x86/atomic_bsd_x86.hpp	Wed Oct 03 15:54:35 2018 +0200
+++ b/src/hotspot/os_cpu/bsd_x86/atomic_bsd_x86.hpp	Wed Oct 03 16:02:24 2018 +0200
@@ -136,7 +136,7 @@
 
 extern "C" {
   // defined in bsd_x86.s
-  int64_t _Atomic_cmpxchg_long(int64_t, volatile int64_t*, int64_t, bool);
+  int64_t _Atomic_cmpxchg_long(int64_t, volatile int64_t*, int64_t);
   void _Atomic_move_long(const volatile int64_t* src, volatile int64_t* dst);
 }
 
--- a/src/hotspot/os_cpu/bsd_x86/bsd_x86_32.s	Wed Oct 03 15:54:35 2018 +0200
+++ b/src/hotspot/os_cpu/bsd_x86/bsd_x86_32.s	Wed Oct 03 16:02:24 2018 +0200
@@ -635,8 +635,7 @@
 
         # Support for int64_t Atomic::cmpxchg(int64_t exchange_value,
         #                                     volatile int64_t* dest,
-        #                                     int64_t compare_value,
-        #                                     bool is_MP)
+        #                                     int64_t compare_value)
         #
         .p2align 4,,15
         ELF_TYPE(_Atomic_cmpxchg_long,@function)
@@ -649,10 +648,8 @@
         movl     24(%esp), %eax    # 24(%esp) : compare_value (low)
         movl     28(%esp), %edx    # 28(%esp) : compare_value (high)
         movl     20(%esp), %edi    # 20(%esp) : dest
-        cmpl     $0, 32(%esp)      # 32(%esp) : is_MP
-        je       1f
         lock
-1:      cmpxchg8b (%edi)
+        cmpxchg8b (%edi)
         popl     %edi
         popl     %ebx
         ret
--- a/src/hotspot/os_cpu/linux_arm/orderAccess_linux_arm.hpp	Wed Oct 03 15:54:35 2018 +0200
+++ b/src/hotspot/os_cpu/linux_arm/orderAccess_linux_arm.hpp	Wed Oct 03 16:02:24 2018 +0200
@@ -50,17 +50,12 @@
 //
 // inline void _OrderAccess_dsb() {
 //    volatile intptr_t dummy = 0;
-//    if (os::is_MP()) {
-//      __asm__ volatile (
-//        "mcr p15, 0, %0, c7, c10, 4"
-//        : : "r" (dummy) : "memory");
-//    }
+//    __asm__ volatile (
+//      "mcr p15, 0, %0, c7, c10, 4"
+//      : : "r" (dummy) : "memory");
 // }
 
 inline static void dmb_sy() {
-   if (!os::is_MP()) {
-     return;
-   }
 #ifdef AARCH64
    __asm__ __volatile__ ("dmb sy" : : : "memory");
 #else
@@ -82,9 +77,6 @@
 }
 
 inline static void dmb_st() {
-   if (!os::is_MP()) {
-     return;
-   }
 #ifdef AARCH64
    __asm__ __volatile__ ("dmb st" : : : "memory");
 #else
@@ -108,9 +100,6 @@
 // Load-Load/Store barrier
 inline static void dmb_ld() {
 #ifdef AARCH64
-   if (!os::is_MP()) {
-     return;
-   }
    __asm__ __volatile__ ("dmb ld" : : : "memory");
 #else
    dmb_sy();
--- a/src/hotspot/share/c1/c1_CodeStubs.hpp	Wed Oct 03 15:54:35 2018 +0200
+++ b/src/hotspot/share/c1/c1_CodeStubs.hpp	Wed Oct 03 16:02:24 2018 +0200
@@ -394,11 +394,9 @@
       _id(id)
     , _info(NULL)
     , _index(index) {
-    if (os::is_MP()) {
-      // force alignment of patch sites on MP hardware so we
-      // can guarantee atomic writes to the patch site.
-      align_patch_site(masm);
-    }
+    // force alignment of patch sites so we
+    // can guarantee atomic writes to the patch site.
+    align_patch_site(masm);
     _pc_start = masm->pc();
     masm->bind(_patch_site_entry);
   }
--- a/src/hotspot/share/c1/c1_InstructionPrinter.cpp	Wed Oct 03 15:54:35 2018 +0200
+++ b/src/hotspot/share/c1/c1_InstructionPrinter.cpp	Wed Oct 03 16:02:24 2018 +0200
@@ -918,18 +918,16 @@
 }
 
 void InstructionPrinter::do_MemBar(MemBar* x) {
-  if (os::is_MP()) {
-    LIR_Code code = x->code();
-    switch (code) {
-      case lir_membar_acquire   : output()->print("membar_acquire"); break;
-      case lir_membar_release   : output()->print("membar_release"); break;
-      case lir_membar           : output()->print("membar"); break;
-      case lir_membar_loadload  : output()->print("membar_loadload"); break;
-      case lir_membar_storestore: output()->print("membar_storestore"); break;
-      case lir_membar_loadstore : output()->print("membar_loadstore"); break;
-      case lir_membar_storeload : output()->print("membar_storeload"); break;
-      default                   : ShouldNotReachHere(); break;
-    }
+  LIR_Code code = x->code();
+  switch (code) {
+  case lir_membar_acquire   : output()->print("membar_acquire"); break;
+  case lir_membar_release   : output()->print("membar_release"); break;
+  case lir_membar           : output()->print("membar"); break;
+  case lir_membar_loadload  : output()->print("membar_loadload"); break;
+  case lir_membar_storestore: output()->print("membar_storestore"); break;
+  case lir_membar_loadstore : output()->print("membar_loadstore"); break;
+  case lir_membar_storeload : output()->print("membar_storeload"); break;
+  default                   : ShouldNotReachHere(); break;
   }
 }
 
--- a/src/hotspot/share/c1/c1_LIRAssembler.cpp	Wed Oct 03 15:54:35 2018 +0200
+++ b/src/hotspot/share/c1/c1_LIRAssembler.cpp	Wed Oct 03 16:02:24 2018 +0200
@@ -446,10 +446,8 @@
 void LIR_Assembler::emit_call(LIR_OpJavaCall* op) {
   verify_oop_map(op->info());
 
-  if (os::is_MP()) {
-    // must align calls sites, otherwise they can't be updated atomically on MP hardware
-    align_call(op->code());
-  }
+  // must align calls sites, otherwise they can't be updated atomically
+  align_call(op->code());
 
   // emit the static call stub stuff out of line
   emit_static_call_stub();
--- a/src/hotspot/share/c1/c1_LIRGenerator.cpp	Wed Oct 03 15:54:35 2018 +0200
+++ b/src/hotspot/share/c1/c1_LIRGenerator.cpp	Wed Oct 03 16:02:24 2018 +0200
@@ -3068,13 +3068,13 @@
     break;
 
   case vmIntrinsics::_loadFence :
-    if (os::is_MP()) __ membar_acquire();
+    __ membar_acquire();
     break;
   case vmIntrinsics::_storeFence:
-    if (os::is_MP()) __ membar_release();
+    __ membar_release();
     break;
   case vmIntrinsics::_fullFence :
-    if (os::is_MP()) __ membar();
+    __ membar();
     break;
   case vmIntrinsics::_onSpinWait:
     __ on_spin_wait();
@@ -3623,18 +3623,16 @@
 }
 
 void LIRGenerator::do_MemBar(MemBar* x) {
-  if (os::is_MP()) {
-    LIR_Code code = x->code();
-    switch(code) {
-      case lir_membar_acquire   : __ membar_acquire(); break;
-      case lir_membar_release   : __ membar_release(); break;
-      case lir_membar           : __ membar(); break;
-      case lir_membar_loadload  : __ membar_loadload(); break;
-      case lir_membar_storestore: __ membar_storestore(); break;
-      case lir_membar_loadstore : __ membar_loadstore(); break;
-      case lir_membar_storeload : __ membar_storeload(); break;
-      default                   : ShouldNotReachHere(); break;
-    }
+  LIR_Code code = x->code();
+  switch(code) {
+  case lir_membar_acquire   : __ membar_acquire(); break;
+  case lir_membar_release   : __ membar_release(); break;
+  case lir_membar           : __ membar(); break;
+  case lir_membar_loadload  : __ membar_loadload(); break;
+  case lir_membar_storestore: __ membar_storestore(); break;
+  case lir_membar_loadstore : __ membar_loadstore(); break;
+  case lir_membar_storeload : __ membar_storeload(); break;
+  default                   : ShouldNotReachHere(); break;
   }
 }
 
--- a/src/hotspot/share/c1/c1_Runtime1.cpp	Wed Oct 03 15:54:35 2018 +0200
+++ b/src/hotspot/share/c1/c1_Runtime1.cpp	Wed Oct 03 16:02:24 2018 +0200
@@ -847,8 +847,32 @@
 // call into patch_code and complete the patching process by copying
 // the patch body back into the main part of the nmethod and resume
 // executing.
+
+// NB:
 //
+// Patchable instruction sequences inherently exhibit race conditions,
+// where thread A is patching an instruction at the same time thread B
+// is executing it.  The algorithms we use ensure that any observation
+// that B can make on any intermediate states during A's patching will
+// always end up with a correct outcome.  This is easiest if there are
+// few or no intermediate states.  (Some inline caches have two
+// related instructions that must be patched in tandem.  For those,
+// intermediate states seem to be unavoidable, but we will get the
+// right answer from all possible observation orders.)
 //
+// When patching the entry instruction at the head of a method, or a
+// linkable call instruction inside of a method, we try very hard to
+// use a patch sequence which executes as a single memory transaction.
+// This means, in practice, that when thread A patches an instruction,
+// it should patch a 32-bit or 64-bit word that somehow overlaps the
+// instruction or is contained in it.  We believe that memory hardware
+// will never break up such a word write, if it is naturally aligned
+// for the word being written.  We also know that some CPUs work very
+// hard to create atomic updates even of naturally unaligned words,
+// but we don't want to bet the farm on this always working.
+//
+// Therefore, if there is any chance of a race condition, we try to
+// patch only naturally aligned words, as single, full-word writes.
 
 JRT_ENTRY(void, Runtime1::patch_code(JavaThread* thread, Runtime1::StubID stub_id ))
   NOT_PRODUCT(_patch_code_slowcase_cnt++;)
@@ -907,7 +931,7 @@
     // We need to only cover T_LONG and T_DOUBLE fields, as we can
     // break access atomicity only for them.
 
-    // Strictly speaking, the deoptimizaation on 64-bit platforms
+    // Strictly speaking, the deoptimization on 64-bit platforms
     // is unnecessary, and T_LONG stores on 32-bit platforms need
     // to be handled by special patching code when AlwaysAtomicAccesses
     // becomes product feature. At this point, we are still going
--- a/src/hotspot/share/ci/ciEnv.cpp	Wed Oct 03 15:54:35 2018 +0200
+++ b/src/hotspot/share/ci/ciEnv.cpp	Wed Oct 03 16:02:24 2018 +0200
@@ -399,8 +399,8 @@
 
   // Now we need to check the SystemDictionary
   Symbol* sym = name->get_symbol();
-  if (sym->byte_at(0) == 'L' &&
-    sym->byte_at(sym->utf8_length()-1) == ';') {
+  if (sym->char_at(0) == 'L' &&
+    sym->char_at(sym->utf8_length()-1) == ';') {
     // This is a name from a signature.  Strip off the trimmings.
     // Call recursive to keep scope of strippedsym.
     TempNewSymbol strippedsym = SymbolTable::new_symbol(sym->as_utf8()+1,
@@ -427,7 +427,7 @@
 
   // setup up the proper type to return on OOM
   ciKlass* fail_type;
-  if (sym->byte_at(0) == '[') {
+  if (sym->char_at(0) == '[') {
     fail_type = _unloaded_ciobjarrayklass;
   } else {
     fail_type = _unloaded_ciinstance_klass;
@@ -453,8 +453,8 @@
   // we must build an array type around it.  The CI requires array klasses
   // to be loaded if their element klasses are loaded, except when memory
   // is exhausted.
-  if (sym->byte_at(0) == '[' &&
-      (sym->byte_at(1) == '[' || sym->byte_at(1) == 'L')) {
+  if (sym->char_at(0) == '[' &&
+      (sym->char_at(1) == '[' || sym->char_at(1) == 'L')) {
     // We have an unloaded array.
     // Build it on the fly if the element class exists.
     TempNewSymbol elem_sym = SymbolTable::new_symbol(sym->as_utf8()+1,
--- a/src/hotspot/share/ci/ciInstanceKlass.cpp	Wed Oct 03 15:54:35 2018 +0200
+++ b/src/hotspot/share/ci/ciInstanceKlass.cpp	Wed Oct 03 16:02:24 2018 +0200
@@ -116,7 +116,7 @@
                                  jobject loader, jobject protection_domain)
   : ciKlass(name, T_OBJECT)
 {
-  assert(name->byte_at(0) != '[', "not an instance klass");
+  assert(name->char_at(0) != '[', "not an instance klass");
   _init_state = (InstanceKlass::ClassState)0;
   _nonstatic_field_size = -1;
   _has_nonstatic_fields = false;
@@ -299,7 +299,7 @@
     return false;
 
   // Test for trailing '/'
-  if ((char) name()->byte_at(len) != '/')
+  if (name()->char_at(len) != '/')
     return false;
 
   // Make sure it's not actually in a subpackage:
--- a/src/hotspot/share/ci/ciObjArrayKlass.cpp	Wed Oct 03 15:54:35 2018 +0200
+++ b/src/hotspot/share/ci/ciObjArrayKlass.cpp	Wed Oct 03 16:02:24 2018 +0200
@@ -112,9 +112,9 @@
   Symbol* base_name_sym = element_name->get_symbol();
   char* name;
 
-  if (base_name_sym->byte_at(0) == '[' ||
-      (base_name_sym->byte_at(0) == 'L' &&  // watch package name 'Lxx'
-       base_name_sym->byte_at(element_len-1) == ';')) {
+  if (base_name_sym->char_at(0) == '[' ||
+      (base_name_sym->char_at(0) == 'L' &&  // watch package name 'Lxx'
+       base_name_sym->char_at(element_len-1) == ';')) {
 
     int new_len = element_len + dimension + 1; // for the ['s and '\0'
     name = CURRENT_THREAD_ENV->name_buffer(new_len);
--- a/src/hotspot/share/ci/ciObjectFactory.cpp	Wed Oct 03 15:54:35 2018 +0200
+++ b/src/hotspot/share/ci/ciObjectFactory.cpp	Wed Oct 03 16:02:24 2018 +0200
@@ -466,7 +466,7 @@
 
   // Two cases: this is an unloaded ObjArrayKlass or an
   // unloaded InstanceKlass.  Deal with both.
-  if (name->byte_at(0) == '[') {
+  if (name->char_at(0) == '[') {
     // Decompose the name.'
     FieldArrayInfo fd;
     BasicType element_type = FieldType::get_array_info(name->get_symbol(),
--- a/src/hotspot/share/ci/ciSymbol.cpp	Wed Oct 03 15:54:35 2018 +0200
+++ b/src/hotspot/share/ci/ciSymbol.cpp	Wed Oct 03 16:02:24 2018 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1999, 2012, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1999, 2018, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -68,14 +68,14 @@
 
 // ------------------------------------------------------------------
 // ciSymbol::base
-const jbyte* ciSymbol::base() {
+const u1* ciSymbol::base() {
   GUARDED_VM_ENTRY(return get_symbol()->base();)
 }
 
 // ------------------------------------------------------------------
-// ciSymbol::byte_at
-int ciSymbol::byte_at(int i) {
-  GUARDED_VM_ENTRY(return get_symbol()->byte_at(i);)
+// ciSymbol::char_at
+char ciSymbol::char_at(int i) {
+  GUARDED_VM_ENTRY(return get_symbol()->char_at(i);)
 }
 
 // ------------------------------------------------------------------
--- a/src/hotspot/share/ci/ciSymbol.hpp	Wed Oct 03 15:54:35 2018 +0200
+++ b/src/hotspot/share/ci/ciSymbol.hpp	Wed Oct 03 16:02:24 2018 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1999, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1999, 2018, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -61,7 +61,7 @@
   void print_impl(outputStream* st);
 
   // This is public in Symbol* but private here, because the base can move:
-  const jbyte* base();
+  const u1* base();
 
   // Make a ciSymbol from a C string (implementation).
   static ciSymbol* make_impl(const char* s);
@@ -77,8 +77,8 @@
   // The text of the symbol as ascii with all non-printable characters quoted as \u####
   const char* as_quoted_ascii();
 
-  // Return the i-th utf8 byte, where i < utf8_length
-  int         byte_at(int i);
+  // Return the i-th utf byte as a char, where i < utf8_length
+  char        char_at(int i);
 
   // Tests if the symbol starts with the given prefix.
   bool starts_with(const char* prefix, int len) const;
--- a/src/hotspot/share/classfile/classFileParser.cpp	Wed Oct 03 15:54:35 2018 +0200
+++ b/src/hotspot/share/classfile/classFileParser.cpp	Wed Oct 03 16:02:24 2018 +0200
@@ -655,7 +655,7 @@
             "Illegal zero length constant pool entry at %d in class %s",
             name_index, CHECK);
 
-          if (sig->byte_at(0) == JVM_SIGNATURE_FUNC) {
+          if (sig->char_at(0) == JVM_SIGNATURE_FUNC) {
             // Format check method name and signature
             verify_legal_method_name(name, CHECK);
             verify_legal_method_signature(name, sig, CHECK);
@@ -682,7 +682,7 @@
           // CONSTANT_Dynamic's name and signature are verified above, when iterating NameAndType_info.
           // Need only to be sure signature is non-zero length and the right type.
           if (signature->utf8_length() == 0 ||
-              signature->byte_at(0) == JVM_SIGNATURE_FUNC) {
+              signature->char_at(0) == JVM_SIGNATURE_FUNC) {
             throwIllegalSignature("CONSTANT_Dynamic", name, signature, CHECK);
           }
         }
@@ -707,7 +707,7 @@
             // Field name and signature are verified above, when iterating NameAndType_info.
             // Need only to be sure signature is non-zero length and the right type.
             if (signature->utf8_length() == 0 ||
-                signature->byte_at(0) == JVM_SIGNATURE_FUNC) {
+                signature->char_at(0) == JVM_SIGNATURE_FUNC) {
               throwIllegalSignature("Field", name, signature, CHECK);
             }
           }
@@ -716,7 +716,7 @@
             // Method name and signature are verified above, when iterating NameAndType_info.
             // Need only to be sure signature is non-zero length and the right type.
             if (signature->utf8_length() == 0 ||
-                signature->byte_at(0) != JVM_SIGNATURE_FUNC) {
+                signature->char_at(0) != JVM_SIGNATURE_FUNC) {
               throwIllegalSignature("Method", name, signature, CHECK);
             }
           }
@@ -724,7 +724,7 @@
           const unsigned int name_len = name->utf8_length();
           if (tag == JVM_CONSTANT_Methodref &&
               name_len != 0 &&
-              name->byte_at(0) == '<' &&
+              name->char_at(0) == '<' &&
               name != vmSymbols::object_initializer_name()) {
             classfile_parse_error(
               "Bad method name at constant pool index %u in class file %s",
@@ -942,7 +942,7 @@
 
         // Don't need to check legal name because it's checked when parsing constant pool.
         // But need to make sure it's not an array type.
-        guarantee_property(unresolved_klass->byte_at(0) != JVM_SIGNATURE_ARRAY,
+        guarantee_property(unresolved_klass->char_at(0) != JVM_SIGNATURE_ARRAY,
                            "Bad interface name in class file %s", CHECK);
 
         // Call resolve_super so classcircularity is checked
@@ -3752,7 +3752,7 @@
       if (need_verify)
         is_array = super_klass->is_array_klass();
     } else if (need_verify) {
-      is_array = (cp->klass_name_at(super_class_index)->byte_at(0) == JVM_SIGNATURE_ARRAY);
+      is_array = (cp->klass_name_at(super_class_index)->char_at(0) == JVM_SIGNATURE_ARRAY);
     }
     if (need_verify) {
       guarantee_property(!is_array,
@@ -5379,7 +5379,7 @@
     // The first non-signature thing better be a ')'
     if ((length > 0) && (*p++ == JVM_SIGNATURE_ENDFUNC)) {
       length--;
-      if (name->utf8_length() > 0 && name->byte_at(0) == '<') {
+      if (name->utf8_length() > 0 && name->char_at(0) == '<') {
         // All internal methods must return void
         if ((length == 1) && (p[0] == JVM_SIGNATURE_VOID)) {
           return args_size;
@@ -5796,7 +5796,7 @@
 void ClassFileParser::fix_unsafe_anonymous_class_name(TRAPS) {
   assert(_unsafe_anonymous_host != NULL, "Expected an unsafe anonymous class");
 
-  const jbyte* anon_last_slash = UTF8::strrchr(_class_name->base(),
+  const jbyte* anon_last_slash = UTF8::strrchr((const jbyte*)_class_name->base(),
                                                _class_name->utf8_length(), '/');
   if (anon_last_slash == NULL) {  // Unnamed package
     prepend_host_package_name(_unsafe_anonymous_host, CHECK);
@@ -6119,7 +6119,7 @@
   // It has been checked when constant pool is parsed.
   // However, make sure it is not an array type.
   if (_need_verify) {
-    guarantee_property(_class_name->byte_at(0) != JVM_SIGNATURE_ARRAY,
+    guarantee_property(_class_name->char_at(0) != JVM_SIGNATURE_ARRAY,
                        "Bad class name in class file %s",
                        CHECK);
   }
--- a/src/hotspot/share/classfile/classLoaderData.cpp	Wed Oct 03 15:54:35 2018 +0200
+++ b/src/hotspot/share/classfile/classLoaderData.cpp	Wed Oct 03 16:02:24 2018 +0200
@@ -47,11 +47,10 @@
 // the singleton class the_null_class_loader_data().
 
 #include "precompiled.hpp"
-#include "classfile/classLoaderData.hpp"
 #include "classfile/classLoaderData.inline.hpp"
+#include "classfile/classLoaderDataGraph.inline.hpp"
 #include "classfile/dictionary.hpp"
 #include "classfile/javaClasses.hpp"
-#include "classfile/metadataOnStackMark.hpp"
 #include "classfile/moduleEntry.hpp"
 #include "classfile/packageEntry.hpp"
 #include "classfile/symbolTable.hpp"
@@ -60,9 +59,7 @@
 #include "logging/logStream.hpp"
 #include "memory/allocation.inline.hpp"
 #include "memory/metadataFactory.hpp"
-#include "memory/metaspaceShared.hpp"
 #include "memory/resourceArea.hpp"
-#include "memory/universe.hpp"
 #include "oops/access.inline.hpp"
 #include "oops/oop.inline.hpp"
 #include "oops/oopHandle.inline.hpp"
@@ -72,14 +69,10 @@
 #include "runtime/mutex.hpp"
 #include "runtime/orderAccess.hpp"
 #include "runtime/safepoint.hpp"
-#include "runtime/safepointVerifiers.hpp"
 #include "utilities/growableArray.hpp"
 #include "utilities/macros.hpp"
 #include "utilities/ostream.hpp"
 
-volatile size_t ClassLoaderDataGraph::_num_array_classes = 0;
-volatile size_t ClassLoaderDataGraph::_num_instance_classes = 0;
-
 ClassLoaderData * ClassLoaderData::_the_null_class_loader_data = NULL;
 
 void ClassLoaderData::init_null_class_loader_data() {
@@ -345,6 +338,11 @@
   for (Klass* k = OrderAccess::load_acquire(&_klasses); k != NULL; k = k->next_link()) {
     // Do not filter ArrayKlass oops here...
     if (k->is_array_klass() || (k->is_instance_klass() && InstanceKlass::cast(k)->is_loaded())) {
+#ifdef ASSERT
+      oop m = k->java_mirror();
+      assert(m != NULL, "NULL mirror");
+      assert(m->is_a(SystemDictionary::Class_klass()), "invalid mirror");
+#endif
       klass_closure->do_klass(k);
     }
   }
@@ -444,13 +442,6 @@
   }
 }
 
-
-void ClassLoaderDataGraph::clear_claimed_marks() {
-  for (ClassLoaderData* cld = _head; cld != NULL; cld = cld->next()) {
-    cld->clear_claimed();
-  }
-}
-
 void ClassLoaderData::add_class(Klass* k, bool publicize /* true */) {
   {
     MutexLockerEx ml(metaspace_lock(), Mutex::_no_safepoint_check_flag);
@@ -478,78 +469,6 @@
   }
 }
 
-// Class iterator used by the compiler.  It gets some number of classes at
-// a safepoint to decay invocation counters on the methods.
-class ClassLoaderDataGraphKlassIteratorStatic {
-  ClassLoaderData* _current_loader_data;
-  Klass*           _current_class_entry;
- public:
-
-  ClassLoaderDataGraphKlassIteratorStatic() : _current_loader_data(NULL), _current_class_entry(NULL) {}
-
-  InstanceKlass* try_get_next_class() {
-    assert(SafepointSynchronize::is_at_safepoint(), "only called at safepoint");
-    size_t max_classes = ClassLoaderDataGraph::num_instance_classes();
-    assert(max_classes > 0, "should not be called with no instance classes");
-    for (size_t i = 0; i < max_classes; ) {
-
-      if (_current_class_entry != NULL) {
-        Klass* k = _current_class_entry;
-        _current_class_entry = _current_class_entry->next_link();
-
-        if (k->is_instance_klass()) {
-          InstanceKlass* ik = InstanceKlass::cast(k);
-          i++;  // count all instance classes found
-          // Not yet loaded classes are counted in max_classes
-          // but only return loaded classes.
-          if (ik->is_loaded()) {
-            return ik;
-          }
-        }
-      } else {
-        // Go to next CLD
-        if (_current_loader_data != NULL) {
-          _current_loader_data = _current_loader_data->next();
-        }
-        // Start at the beginning
-        if (_current_loader_data == NULL) {
-          _current_loader_data = ClassLoaderDataGraph::_head;
-        }
-
-        _current_class_entry = _current_loader_data->klasses();
-      }
-    }
-    // Should never be reached unless all instance classes have failed or are not fully loaded.
-    // Caller handles NULL.
-    return NULL;
-  }
-
-  // If the current class for the static iterator is a class being unloaded or
-  // deallocated, adjust the current class.
-  void adjust_saved_class(ClassLoaderData* cld) {
-    if (_current_loader_data == cld) {
-      _current_loader_data = cld->next();
-      if (_current_loader_data != NULL) {
-        _current_class_entry = _current_loader_data->klasses();
-      }  // else try_get_next_class will start at the head
-    }
-  }
-
-  void adjust_saved_class(Klass* klass) {
-    if (_current_class_entry == klass) {
-      _current_class_entry = klass->next_link();
-    }
-  }
-};
-
-static ClassLoaderDataGraphKlassIteratorStatic static_klass_iterator;
-
-InstanceKlass* ClassLoaderDataGraph::try_get_next_class() {
-  assert(SafepointSynchronize::is_at_safepoint(), "only called at safepoint");
-  return static_klass_iterator.try_get_next_class();
-}
-
-
 void ClassLoaderData::initialize_holder(Handle loader_or_mirror) {
   if (loader_or_mirror() != NULL) {
     assert(_holder.is_null(), "never replace holders");
@@ -563,7 +482,7 @@
   assert(SafepointSynchronize::is_at_safepoint(), "only called at safepoint");
 
   // Adjust global class iterator.
-  static_klass_iterator.adjust_saved_class(scratch_class);
+  ClassLoaderDataGraph::adjust_saved_class(scratch_class);
 
   Klass* prev = NULL;
   for (Klass* k = _klasses; k != NULL; k = k->next_link()) {
@@ -605,12 +524,13 @@
   // if they are not already on the _klasses list.
   free_deallocate_list_C_heap_structures();
 
-  // Tell serviceability tools these classes are unloading
+  // Clean up class dependencies and tell serviceability tools
+  // these classes are unloading.  Must be called
   // after erroneous classes are released.
-  classes_do(InstanceKlass::notify_unload_class);
+  classes_do(InstanceKlass::unload_class);
 
   // Clean up global class iterator for compiler
-  static_klass_iterator.adjust_saved_class(this);
+  ClassLoaderDataGraph::adjust_saved_class(this);
 }
 
 ModuleEntryTable* ClassLoaderData::modules() {
@@ -913,41 +833,6 @@
   }
 }
 
-void ClassLoaderDataGraph::clean_deallocate_lists(bool walk_previous_versions) {
-  assert(SafepointSynchronize::is_at_safepoint(), "must only be called at safepoint");
-  uint loaders_processed = 0;
-  for (ClassLoaderData* cld = _head; cld != NULL; cld = cld->next()) {
-    // is_alive check will be necessary for concurrent class unloading.
-    if (cld->is_alive()) {
-      // clean metaspace
-      if (walk_previous_versions) {
-        cld->classes_do(InstanceKlass::purge_previous_versions);
-      }
-      cld->free_deallocate_list();
-      loaders_processed++;
-    }
-  }
-  log_debug(class, loader, data)("clean_deallocate_lists: loaders processed %u %s",
-                                 loaders_processed, walk_previous_versions ? "walk_previous_versions" : "");
-}
-
-void ClassLoaderDataGraph::walk_metadata_and_clean_metaspaces() {
-  assert(SafepointSynchronize::is_at_safepoint(), "must only be called at safepoint");
-
-  _should_clean_deallocate_lists = false; // assume everything gets cleaned
-
-  // Mark metadata seen on the stack so we can delete unreferenced entries.
-  // Walk all metadata, including the expensive code cache walk, only for class redefinition.
-  // The MetadataOnStackMark walk during redefinition saves previous versions if it finds old methods
-  // on the stack or in the code cache, so we only have to repeat the full walk if
-  // they were found at that time.
-  // TODO: have redefinition clean old methods out of the code cache.  They still exist in some places.
-  bool walk_all_metadata = InstanceKlass::has_previous_versions_and_reset();
-
-  MetadataOnStackMark md_on_stack(walk_all_metadata);
-  clean_deallocate_lists(walk_all_metadata);
-}
-
 // This is distinct from free_deallocate_list.  For class loader data that are
 // unloading, this frees the C heap memory for items on the list, and unlinks
 // scratch or error classes so that unloading events aren't triggered for these
@@ -1069,523 +954,3 @@
   }
   return false;
 }
-
-
-// GC root of class loader data created.
-ClassLoaderData* ClassLoaderDataGraph::_head = NULL;
-ClassLoaderData* ClassLoaderDataGraph::_unloading = NULL;
-ClassLoaderData* ClassLoaderDataGraph::_saved_unloading = NULL;
-ClassLoaderData* ClassLoaderDataGraph::_saved_head = NULL;
-
-bool ClassLoaderDataGraph::_should_purge = false;
-bool ClassLoaderDataGraph::_should_clean_deallocate_lists = false;
-bool ClassLoaderDataGraph::_safepoint_cleanup_needed = false;
-bool ClassLoaderDataGraph::_metaspace_oom = false;
-
-// Add a new class loader data node to the list.  Assign the newly created
-// ClassLoaderData into the java/lang/ClassLoader object as a hidden field
-ClassLoaderData* ClassLoaderDataGraph::add_to_graph(Handle loader, bool is_unsafe_anonymous) {
-
-  assert_lock_strong(ClassLoaderDataGraph_lock);
-
-  ClassLoaderData* cld;
-
-  // First check if another thread beat us to creating the CLD and installing
-  // it into the loader while we were waiting for the lock.
-  if (!is_unsafe_anonymous && loader.not_null()) {
-    cld = java_lang_ClassLoader::loader_data_acquire(loader());
-    if (cld != NULL) {
-      return cld;
-    }
-  }
-
-  // We mustn't GC until we've installed the ClassLoaderData in the Graph since the CLD
-  // contains oops in _handles that must be walked.  GC doesn't walk CLD from the
-  // loader oop in all collections, particularly young collections.
-  NoSafepointVerifier no_safepoints;
-
-  cld = new ClassLoaderData(loader, is_unsafe_anonymous);
-
-  // First install the new CLD to the Graph.
-  cld->set_next(_head);
-  _head = cld;
-
-  // Next associate with the class_loader.
-  if (!is_unsafe_anonymous) {
-    // Use OrderAccess, since readers need to get the loader_data only after
-    // it's added to the Graph
-    java_lang_ClassLoader::release_set_loader_data(loader(), cld);
-  }
-
-  // Lastly log, if requested
-  LogTarget(Trace, class, loader, data) lt;
-  if (lt.is_enabled()) {
-    ResourceMark rm;
-    LogStream ls(lt);
-    ls.print("create ");
-    cld->print_value_on(&ls);
-    ls.cr();
-  }
-  return cld;
-}
-
-ClassLoaderData* ClassLoaderDataGraph::add(Handle loader, bool is_unsafe_anonymous) {
-  MutexLocker ml(ClassLoaderDataGraph_lock);
-  ClassLoaderData* loader_data = add_to_graph(loader, is_unsafe_anonymous);
-  return loader_data;
-}
-
-void ClassLoaderDataGraph::cld_do(CLDClosure* cl) {
-  assert_locked_or_safepoint(ClassLoaderDataGraph_lock);
-  for (ClassLoaderData* cld = _head;  cld != NULL; cld = cld->_next) {
-    cl->do_cld(cld);
-  }
-}
-
-void ClassLoaderDataGraph::cld_unloading_do(CLDClosure* cl) {
-  assert_locked_or_safepoint(ClassLoaderDataGraph_lock);
-  // Only walk the head until any clds not purged from prior unloading
-  // (CMS doesn't purge right away).
-  for (ClassLoaderData* cld = _unloading; cld != _saved_unloading; cld = cld->next()) {
-    assert(cld->is_unloading(), "invariant");
-    cl->do_cld(cld);
-  }
-}
-
-void ClassLoaderDataGraph::roots_cld_do(CLDClosure* strong, CLDClosure* weak) {
-  assert_locked_or_safepoint(ClassLoaderDataGraph_lock);
-  for (ClassLoaderData* cld = _head;  cld != NULL; cld = cld->_next) {
-    CLDClosure* closure = cld->keep_alive() ? strong : weak;
-    if (closure != NULL) {
-      closure->do_cld(cld);
-    }
-  }
-}
-
-void ClassLoaderDataGraph::always_strong_cld_do(CLDClosure* cl) {
-  assert_locked_or_safepoint(ClassLoaderDataGraph_lock);
-  if (ClassUnloading) {
-    roots_cld_do(cl, NULL);
-  } else {
-    cld_do(cl);
-  }
-}
-
-// Closure for locking and iterating through classes.
-LockedClassesDo::LockedClassesDo(classes_do_func_t f) : _function(f) {
-  ClassLoaderDataGraph_lock->lock();
-}
-
-LockedClassesDo::LockedClassesDo() : _function(NULL) {
-  // callers provide their own do_klass
-  ClassLoaderDataGraph_lock->lock();
-}
-
-LockedClassesDo::~LockedClassesDo() { ClassLoaderDataGraph_lock->unlock(); }
-
-
-// Iterating over the CLDG needs to be locked because
-// unloading can remove entries concurrently soon.
-class ClassLoaderDataGraphIterator : public StackObj {
-  ClassLoaderData* _next;
-  HandleMark       _hm;  // clean up handles when this is done.
-  Handle           _holder;
-  Thread*          _thread;
-
-  void hold_next() {
-    if (_next != NULL) {
-      _holder = Handle(_thread, _next->holder_phantom());
-    }
-  }
-public:
-  ClassLoaderDataGraphIterator() : _next(ClassLoaderDataGraph::_head) {
-    _thread = Thread::current();
-    assert_locked_or_safepoint(ClassLoaderDataGraph_lock);
-    hold_next();
-  }
-
-  bool repeat() const {
-    return _next != NULL;
-  }
-
-  ClassLoaderData* get_next() {
-    ClassLoaderData* next = _next;
-    if (_next != NULL) {
-      _next = _next->next();
-      hold_next();
-    }
-    return next;
-  }
-};
-
-// These functions assume that the caller has locked the ClassLoaderDataGraph_lock
-// if they are not calling the function from a safepoint.
-void ClassLoaderDataGraph::classes_do(KlassClosure* klass_closure) {
-  ClassLoaderDataGraphIterator iter;
-  while (iter.repeat()) {
-    ClassLoaderData* cld = iter.get_next();
-    cld->classes_do(klass_closure);
-  }
-}
-
-void ClassLoaderDataGraph::classes_do(void f(Klass* const)) {
-  ClassLoaderDataGraphIterator iter;
-  while (iter.repeat()) {
-    ClassLoaderData* cld = iter.get_next();
-    cld->classes_do(f);
-  }
-}
-
-void ClassLoaderDataGraph::methods_do(void f(Method*)) {
-  ClassLoaderDataGraphIterator iter;
-  while (iter.repeat()) {
-    ClassLoaderData* cld = iter.get_next();
-    cld->methods_do(f);
-  }
-}
-
-void ClassLoaderDataGraph::modules_do(void f(ModuleEntry*)) {
-  assert_locked_or_safepoint(Module_lock);
-  ClassLoaderDataGraphIterator iter;
-  while (iter.repeat()) {
-    ClassLoaderData* cld = iter.get_next();
-    cld->modules_do(f);
-  }
-}
-
-void ClassLoaderDataGraph::modules_unloading_do(void f(ModuleEntry*)) {
-  assert_locked_or_safepoint(ClassLoaderDataGraph_lock);
-  // Only walk the head until any clds not purged from prior unloading
-  // (CMS doesn't purge right away).
-  for (ClassLoaderData* cld = _unloading; cld != _saved_unloading; cld = cld->next()) {
-    assert(cld->is_unloading(), "invariant");
-    cld->modules_do(f);
-  }
-}
-
-void ClassLoaderDataGraph::packages_do(void f(PackageEntry*)) {
-  assert_locked_or_safepoint(Module_lock);
-  ClassLoaderDataGraphIterator iter;
-  while (iter.repeat()) {
-    ClassLoaderData* cld = iter.get_next();
-    cld->packages_do(f);
-  }
-}
-
-void ClassLoaderDataGraph::packages_unloading_do(void f(PackageEntry*)) {
-  assert_locked_or_safepoint(ClassLoaderDataGraph_lock);
-  // Only walk the head until any clds not purged from prior unloading
-  // (CMS doesn't purge right away).
-  for (ClassLoaderData* cld = _unloading; cld != _saved_unloading; cld = cld->next()) {
-    assert(cld->is_unloading(), "invariant");
-    cld->packages_do(f);
-  }
-}
-
-void ClassLoaderDataGraph::loaded_classes_do(KlassClosure* klass_closure) {
-  ClassLoaderDataGraphIterator iter;
-  while (iter.repeat()) {
-    ClassLoaderData* cld = iter.get_next();
-    cld->loaded_classes_do(klass_closure);
-  }
-}
-
-// This case can block but cannot do unloading (called from CDS)
-void ClassLoaderDataGraph::unlocked_loaded_classes_do(KlassClosure* klass_closure) {
-  for (ClassLoaderData* cld = _head; cld != NULL; cld = cld->next()) {
-    cld->loaded_classes_do(klass_closure);
-  }
-}
-
-
-void ClassLoaderDataGraph::classes_unloading_do(void f(Klass* const)) {
-  assert_locked_or_safepoint(ClassLoaderDataGraph_lock);
-  // Only walk the head until any clds not purged from prior unloading
-  // (CMS doesn't purge right away).
-  for (ClassLoaderData* cld = _unloading; cld != _saved_unloading; cld = cld->next()) {
-    assert(cld->is_unloading(), "invariant");
-    cld->classes_do(f);
-  }
-}
-
-#define FOR_ALL_DICTIONARY(X)   ClassLoaderDataGraphIterator iter; \
-                                ClassLoaderData* X; \
-                                while ((X = iter.get_next()) != NULL) \
-                                  if (X->dictionary() != NULL)
-
-// Walk classes in the loaded class dictionaries in various forms.
-// Only walks the classes defined in this class loader.
-void ClassLoaderDataGraph::dictionary_classes_do(void f(InstanceKlass*)) {
-  FOR_ALL_DICTIONARY(cld) {
-    cld->dictionary()->classes_do(f);
-  }
-}
-
-// Only walks the classes defined in this class loader.
-void ClassLoaderDataGraph::dictionary_classes_do(void f(InstanceKlass*, TRAPS), TRAPS) {
-  FOR_ALL_DICTIONARY(cld) {
-    cld->dictionary()->classes_do(f, CHECK);
-  }
-}
-
-void ClassLoaderDataGraph::verify_dictionary() {
-  FOR_ALL_DICTIONARY(cld) {
-    cld->dictionary()->verify();
-  }
-}
-
-void ClassLoaderDataGraph::print_dictionary(outputStream* st) {
-  FOR_ALL_DICTIONARY(cld) {
-    st->print("Dictionary for ");
-    cld->print_value_on(st);
-    st->cr();
-    cld->dictionary()->print_on(st);
-    st->cr();
-  }
-}
-
-void ClassLoaderDataGraph::print_dictionary_statistics(outputStream* st) {
-  FOR_ALL_DICTIONARY(cld) {
-    ResourceMark rm;
-    stringStream tempst;
-    tempst.print("System Dictionary for %s class loader", cld->loader_name_and_id());
-    cld->dictionary()->print_table_statistics(st, tempst.as_string());
-  }
-}
-
-GrowableArray<ClassLoaderData*>* ClassLoaderDataGraph::new_clds() {
-  assert_locked_or_safepoint(ClassLoaderDataGraph_lock);
-  assert(_head == NULL || _saved_head != NULL, "remember_new_clds(true) not called?");
-
-  GrowableArray<ClassLoaderData*>* array = new GrowableArray<ClassLoaderData*>();
-
-  // The CLDs in [_head, _saved_head] were all added during last call to remember_new_clds(true);
-  ClassLoaderData* curr = _head;
-  while (curr != _saved_head) {
-    if (!curr->claimed()) {
-      array->push(curr);
-      LogTarget(Debug, class, loader, data) lt;
-      if (lt.is_enabled()) {
-        LogStream ls(lt);
-        ls.print("found new CLD: ");
-        curr->print_value_on(&ls);
-        ls.cr();
-      }
-    }
-
-    curr = curr->_next;
-  }
-
-  return array;
-}
-
-#ifndef PRODUCT
-bool ClassLoaderDataGraph::contains_loader_data(ClassLoaderData* loader_data) {
-  assert_locked_or_safepoint(ClassLoaderDataGraph_lock);
-  for (ClassLoaderData* data = _head; data != NULL; data = data->next()) {
-    if (loader_data == data) {
-      return true;
-    }
-  }
-
-  return false;
-}
-#endif // PRODUCT
-
-// Move class loader data from main list to the unloaded list for unloading
-// and deallocation later.
-bool ClassLoaderDataGraph::do_unloading(bool do_cleaning) {
-  assert_locked_or_safepoint(ClassLoaderDataGraph_lock);
-
-  // Indicate whether safepoint cleanup is needed.
-  _safepoint_cleanup_needed |= do_cleaning;
-
-  ClassLoaderData* data = _head;
-  ClassLoaderData* prev = NULL;
-  bool seen_dead_loader = false;
-  uint loaders_processed = 0;
-  uint loaders_removed = 0;
-
-  // Save previous _unloading pointer for CMS which may add to unloading list before
-  // purging and we don't want to rewalk the previously unloaded class loader data.
-  _saved_unloading = _unloading;
-
-  data = _head;
-  while (data != NULL) {
-    if (data->is_alive()) {
-      prev = data;
-      data = data->next();
-      loaders_processed++;
-      continue;
-    }
-    seen_dead_loader = true;
-    loaders_removed++;
-    ClassLoaderData* dead = data;
-    dead->unload();
-    data = data->next();
-    // Remove from loader list.
-    // This class loader data will no longer be found
-    // in the ClassLoaderDataGraph.
-    if (prev != NULL) {
-      prev->set_next(data);
-    } else {
-      assert(dead == _head, "sanity check");
-      _head = data;
-    }
-    dead->set_next(_unloading);
-    _unloading = dead;
-  }
-
-  log_debug(class, loader, data)("do_unloading: loaders processed %u, loaders removed %u", loaders_processed, loaders_removed);
-
-  return seen_dead_loader;
-}
-
-// There's at least one dead class loader.  Purge refererences of healthy module
-// reads lists and package export lists to modules belonging to dead loaders.
-void ClassLoaderDataGraph::clean_module_and_package_info() {
-  assert_locked_or_safepoint(ClassLoaderDataGraph_lock);
-
-  ClassLoaderData* data = _head;
-  while (data != NULL) {
-    // Remove entries in the dictionary of live class loader that have
-    // initiated loading classes in a dead class loader.
-    if (data->dictionary() != NULL) {
-      data->dictionary()->do_unloading();
-    }
-    // Walk a ModuleEntry's reads, and a PackageEntry's exports
-    // lists to determine if there are modules on those lists that are now
-    // dead and should be removed.  A module's life cycle is equivalent
-    // to its defining class loader's life cycle.  Since a module is
-    // considered dead if its class loader is dead, these walks must
-    // occur after each class loader's aliveness is determined.
-    if (data->packages() != NULL) {
-      data->packages()->purge_all_package_exports();
-    }
-    if (data->modules_defined()) {
-      data->modules()->purge_all_module_reads();
-    }
-    data = data->next();
-  }
-}
-
-void ClassLoaderDataGraph::purge() {
-  assert(SafepointSynchronize::is_at_safepoint(), "must be at safepoint!");
-  ClassLoaderData* list = _unloading;
-  _unloading = NULL;
-  ClassLoaderData* next = list;
-  bool classes_unloaded = false;
-  while (next != NULL) {
-    ClassLoaderData* purge_me = next;
-    next = purge_me->next();
-    delete purge_me;
-    classes_unloaded = true;
-  }
-  if (classes_unloaded) {
-    Metaspace::purge();
-    set_metaspace_oom(false);
-  }
-}
-
-int ClassLoaderDataGraph::resize_if_needed() {
-  assert(SafepointSynchronize::is_at_safepoint(), "must be at safepoint!");
-  int resized = 0;
-  if (Dictionary::does_any_dictionary_needs_resizing()) {
-    FOR_ALL_DICTIONARY(cld) {
-      if (cld->dictionary()->resize_if_needed()) {
-        resized++;
-      }
-    }
-  }
-  return resized;
-}
-
-ClassLoaderDataGraphKlassIteratorAtomic::ClassLoaderDataGraphKlassIteratorAtomic()
-    : _next_klass(NULL) {
-  assert(SafepointSynchronize::is_at_safepoint(), "must be at safepoint!");
-  ClassLoaderData* cld = ClassLoaderDataGraph::_head;
-  Klass* klass = NULL;
-
-  // Find the first klass in the CLDG.
-  while (cld != NULL) {
-    assert_locked_or_safepoint(cld->metaspace_lock());
-    klass = cld->_klasses;
-    if (klass != NULL) {
-      _next_klass = klass;
-      return;
-    }
-    cld = cld->next();
-  }
-}
-
-Klass* ClassLoaderDataGraphKlassIteratorAtomic::next_klass_in_cldg(Klass* klass) {
-  Klass* next = klass->next_link();
-  if (next != NULL) {
-    return next;
-  }
-
-  // No more klasses in the current CLD. Time to find a new CLD.
-  ClassLoaderData* cld = klass->class_loader_data();
-  assert_locked_or_safepoint(cld->metaspace_lock());
-  while (next == NULL) {
-    cld = cld->next();
-    if (cld == NULL) {
-      break;
-    }
-    next = cld->_klasses;
-  }
-
-  return next;
-}
-
-Klass* ClassLoaderDataGraphKlassIteratorAtomic::next_klass() {
-  Klass* head = _next_klass;
-
-  while (head != NULL) {
-    Klass* next = next_klass_in_cldg(head);
-
-    Klass* old_head = Atomic::cmpxchg(next, &_next_klass, head);
-
-    if (old_head == head) {
-      return head; // Won the CAS.
-    }
-
-    head = old_head;
-  }
-
-  // Nothing more for the iterator to hand out.
-  assert(head == NULL, "head is " PTR_FORMAT ", expected not null:", p2i(head));
-  return NULL;
-}
-
-ClassLoaderDataGraphMetaspaceIterator::ClassLoaderDataGraphMetaspaceIterator() {
-  assert(SafepointSynchronize::is_at_safepoint(), "must be at safepoint!");
-  _data = ClassLoaderDataGraph::_head;
-}
-
-ClassLoaderDataGraphMetaspaceIterator::~ClassLoaderDataGraphMetaspaceIterator() {}
-
-#ifndef PRODUCT
-// callable from debugger
-extern "C" int print_loader_data_graph() {
-  ResourceMark rm;
-  ClassLoaderDataGraph::print_on(tty);
-  return 0;
-}
-
-void ClassLoaderDataGraph::verify() {
-  ClassLoaderDataGraphIterator iter;
-  while (iter.repeat()) {
-    ClassLoaderData* cld = iter.get_next();
-    cld->verify();
-  }
-}
-
-void ClassLoaderDataGraph::print_on(outputStream * const out) {
-  ClassLoaderDataGraphIterator iter;
-  while (iter.repeat()) {
-    ClassLoaderData* cld = iter.get_next();
-    cld->print_on(out);
-  }
-}
-#endif // PRODUCT
--- a/src/hotspot/share/classfile/classLoaderData.hpp	Wed Oct 03 15:54:35 2018 +0200
+++ b/src/hotspot/share/classfile/classLoaderData.hpp	Wed Oct 03 16:02:24 2018 +0200
@@ -53,9 +53,8 @@
 // ClassLoaderData are stored in the runtime representation of classes,
 // and provides iterators for root tracing and other GC operations.
 
-class ClassLoaderData;
+class ClassLoaderDataGraph;
 class JNIMethodBlock;
-class Metadebug;
 class ModuleEntry;
 class PackageEntry;
 class ModuleEntryTable;
@@ -63,136 +62,6 @@
 class DictionaryEntry;
 class Dictionary;
 
-// GC root for walking class loader data created
-
-class ClassLoaderDataGraph : public AllStatic {
-  friend class ClassLoaderData;
-  friend class ClassLoaderDataGraphMetaspaceIterator;
-  friend class ClassLoaderDataGraphKlassIteratorAtomic;
-  friend class ClassLoaderDataGraphKlassIteratorStatic;
-  friend class ClassLoaderDataGraphIterator;
-  friend class VMStructs;
- private:
-  // All CLDs (except the null CLD) can be reached by walking _head->_next->...
-  static ClassLoaderData* _head;
-  static ClassLoaderData* _unloading;
-  // CMS support.
-  static ClassLoaderData* _saved_head;
-  static ClassLoaderData* _saved_unloading;
-  static bool _should_purge;
-
-  // Set if there's anything to purge in the deallocate lists or previous versions
-  // during a safepoint after class unloading in a full GC.
-  static bool _should_clean_deallocate_lists;
-  static bool _safepoint_cleanup_needed;
-
-  // OOM has been seen in metaspace allocation. Used to prevent some
-  // allocations until class unloading
-  static bool _metaspace_oom;
-
-  static volatile size_t  _num_instance_classes;
-  static volatile size_t  _num_array_classes;
-
-  static ClassLoaderData* add_to_graph(Handle class_loader, bool is_unsafe_anonymous);
-  static ClassLoaderData* add(Handle class_loader, bool is_unsafe_anonymous);
-
- public:
-  static ClassLoaderData* find_or_create(Handle class_loader);
-  static void clean_module_and_package_info();
-  static void purge();
-  static void clear_claimed_marks();
-  // Iteration through CLDG inside a safepoint; GC support
-  static void cld_do(CLDClosure* cl);
-  static void cld_unloading_do(CLDClosure* cl);
-  static void roots_cld_do(CLDClosure* strong, CLDClosure* weak);
-  static void always_strong_cld_do(CLDClosure* cl);
-  // klass do
-  // Walking classes through the ClassLoaderDataGraph include array classes.  It also includes
-  // classes that are allocated but not loaded, classes that have errors, and scratch classes
-  // for redefinition.  These classes are removed during the next class unloading.
-  // Walking the ClassLoaderDataGraph also includes unsafe anonymous classes.
-  static void classes_do(KlassClosure* klass_closure);
-  static void classes_do(void f(Klass* const));
-  static void methods_do(void f(Method*));
-  static void modules_do(void f(ModuleEntry*));
-  static void modules_unloading_do(void f(ModuleEntry*));
-  static void packages_do(void f(PackageEntry*));
-  static void packages_unloading_do(void f(PackageEntry*));
-  static void loaded_classes_do(KlassClosure* klass_closure);
-  static void unlocked_loaded_classes_do(KlassClosure* klass_closure);
-  static void classes_unloading_do(void f(Klass* const));
-  static bool do_unloading(bool do_cleaning);
-
-  // Expose state to avoid logging overhead in safepoint cleanup tasks.
-  static inline bool should_clean_metaspaces_and_reset();
-  static void set_should_clean_deallocate_lists() { _should_clean_deallocate_lists = true; }
-  static void clean_deallocate_lists(bool purge_previous_versions);
-  static void walk_metadata_and_clean_metaspaces();
-
-  // dictionary do
-  // Iterate over all klasses in dictionary, but
-  // just the classes from defining class loaders.
-  static void dictionary_classes_do(void f(InstanceKlass*));
-  // Added for initialize_itable_for_klass to handle exceptions.
-  static void dictionary_classes_do(void f(InstanceKlass*, TRAPS), TRAPS);
-
-  // VM_CounterDecay iteration support
-  static InstanceKlass* try_get_next_class();
-
-  static void verify_dictionary();
-  static void print_dictionary(outputStream* st);
-  static void print_dictionary_statistics(outputStream* st);
-
-  // CMS support.
-  static void remember_new_clds(bool remember) { _saved_head = (remember ? _head : NULL); }
-  static GrowableArray<ClassLoaderData*>* new_clds();
-
-  static void set_should_purge(bool b) { _should_purge = b; }
-  static void purge_if_needed() {
-    // Only purge the CLDG for CMS if concurrent sweep is complete.
-    if (_should_purge) {
-      purge();
-      // reset for next time.
-      set_should_purge(false);
-    }
-  }
-
-  static int resize_if_needed();
-
-  static bool has_metaspace_oom()           { return _metaspace_oom; }
-  static void set_metaspace_oom(bool value) { _metaspace_oom = value; }
-
-  static void print_on(outputStream * const out) PRODUCT_RETURN;
-  static void print() { print_on(tty); }
-  static void verify();
-
-  // instance and array class counters
-  static inline size_t num_instance_classes();
-  static inline size_t num_array_classes();
-  static inline void inc_instance_classes(size_t count);
-  static inline void dec_instance_classes(size_t count);
-  static inline void inc_array_classes(size_t count);
-  static inline void dec_array_classes(size_t count);
-
-#ifndef PRODUCT
-  static bool contains_loader_data(ClassLoaderData* loader_data);
-#endif
-};
-
-class LockedClassesDo : public KlassClosure {
-  typedef void (*classes_do_func_t)(Klass*);
-  classes_do_func_t _function;
-public:
-  LockedClassesDo();  // For callers who provide their own do_klass
-  LockedClassesDo(classes_do_func_t function);
-  ~LockedClassesDo();
-
-  void do_klass(Klass* k) {
-    (*_function)(k);
-  }
-};
-
-
 // ClassLoaderData class
 
 class ClassLoaderData : public CHeapObj<mtClass> {
@@ -314,7 +183,7 @@
   bool keep_alive() const       { return _keep_alive > 0; }
 
   oop holder_phantom() const;
-  void classes_do(void f(Klass*));
+  void classes_do(void f(Klass* const));
   void loaded_classes_do(KlassClosure* klass_closure);
   void classes_do(void f(InstanceKlass*));
   void methods_do(void f(Method*));
@@ -448,31 +317,4 @@
   JFR_ONLY(DEFINE_TRACE_ID_METHODS;)
 };
 
-// An iterator that distributes Klasses to parallel worker threads.
-class ClassLoaderDataGraphKlassIteratorAtomic : public StackObj {
- Klass* volatile _next_klass;
- public:
-  ClassLoaderDataGraphKlassIteratorAtomic();
-  Klass* next_klass();
- private:
-  static Klass* next_klass_in_cldg(Klass* klass);
-};
-
-class ClassLoaderDataGraphMetaspaceIterator : public StackObj {
-  ClassLoaderData* _data;
- public:
-  ClassLoaderDataGraphMetaspaceIterator();
-  ~ClassLoaderDataGraphMetaspaceIterator();
-  bool repeat() { return _data != NULL; }
-  ClassLoaderMetaspace* get_next() {
-    assert(_data != NULL, "Should not be NULL in call to the iterator");
-    ClassLoaderMetaspace* result = _data->metaspace_or_null();
-    _data = _data->next();
-    // This result might be NULL for class loaders without metaspace
-    // yet.  It would be nice to return only non-null results but
-    // there is no guarantee that there will be a non-null result
-    // down the list so the caller is going to have to check.
-    return result;
-  }
-};
 #endif // SHARE_VM_CLASSFILE_CLASSLOADERDATA_HPP
--- a/src/hotspot/share/classfile/classLoaderData.inline.hpp	Wed Oct 03 15:54:35 2018 +0200
+++ b/src/hotspot/share/classfile/classLoaderData.inline.hpp	Wed Oct 03 16:02:24 2018 +0200
@@ -55,54 +55,4 @@
   return loader_data;
 }
 
-
-inline ClassLoaderData *ClassLoaderDataGraph::find_or_create(Handle loader) {
-  guarantee(loader() != NULL && oopDesc::is_oop(loader()), "Loader must be oop");
-  // Gets the class loader data out of the java/lang/ClassLoader object, if non-null
-  // it's already in the loader_data, so no need to add
-  ClassLoaderData* loader_data= java_lang_ClassLoader::loader_data_acquire(loader());
-  if (loader_data) {
-     return loader_data;
-  }
-  return ClassLoaderDataGraph::add(loader, false);
-}
-
-size_t ClassLoaderDataGraph::num_instance_classes() {
-  return _num_instance_classes;
-}
-
-size_t ClassLoaderDataGraph::num_array_classes() {
-  return _num_array_classes;
-}
-
-void ClassLoaderDataGraph::inc_instance_classes(size_t count) {
-  Atomic::add(count, &_num_instance_classes);
-}
-
-void ClassLoaderDataGraph::dec_instance_classes(size_t count) {
-  assert(count <= _num_instance_classes, "Sanity");
-  Atomic::sub(count, &_num_instance_classes);
-}
-
-void ClassLoaderDataGraph::inc_array_classes(size_t count) {
-  Atomic::add(count, &_num_array_classes);
-}
-
-void ClassLoaderDataGraph::dec_array_classes(size_t count) {
-  assert(count <= _num_array_classes, "Sanity");
-  Atomic::sub(count, &_num_array_classes);
-}
-
-bool ClassLoaderDataGraph::should_clean_metaspaces_and_reset() {
-  // Only clean metaspaces after full GC.
-  bool do_cleaning = _safepoint_cleanup_needed;
-#if INCLUDE_JVMTI
-  do_cleaning = do_cleaning && (_should_clean_deallocate_lists || InstanceKlass::has_previous_versions());
-#else
-  do_cleaning = do_cleaning && _should_clean_deallocate_lists;
-#endif
-  _safepoint_cleanup_needed = false;  // reset
-  return do_cleaning;
-}
-
 #endif // SHARE_VM_CLASSFILE_CLASSLOADERDATA_INLINE_HPP
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/src/hotspot/share/classfile/classLoaderDataGraph.cpp	Wed Oct 03 16:02:24 2018 +0200
@@ -0,0 +1,697 @@
+/*
+ * Copyright (c) 2018, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ *
+ */
+
+#include "precompiled.hpp"
+#include "classfile/classLoaderDataGraph.inline.hpp"
+#include "classfile/dictionary.hpp"
+#include "classfile/javaClasses.hpp"
+#include "classfile/metadataOnStackMark.hpp"
+#include "classfile/moduleEntry.hpp"
+#include "classfile/packageEntry.hpp"
+#include "logging/log.hpp"
+#include "logging/logStream.hpp"
+#include "memory/allocation.inline.hpp"
+#include "memory/metaspace.hpp"
+#include "memory/resourceArea.hpp"
+#include "runtime/atomic.hpp"
+#include "runtime/handles.inline.hpp"
+#include "runtime/mutex.hpp"
+#include "runtime/safepoint.hpp"
+#include "runtime/safepointVerifiers.hpp"
+#include "utilities/growableArray.hpp"
+#include "utilities/macros.hpp"
+#include "utilities/ostream.hpp"
+
+volatile size_t ClassLoaderDataGraph::_num_array_classes = 0;
+volatile size_t ClassLoaderDataGraph::_num_instance_classes = 0;
+
+void ClassLoaderDataGraph::clear_claimed_marks() {
+  for (ClassLoaderData* cld = _head; cld != NULL; cld = cld->next()) {
+    cld->clear_claimed();
+  }
+}
+
+// Class iterator used by the compiler.  It gets some number of classes at
+// a safepoint to decay invocation counters on the methods.
+class ClassLoaderDataGraphKlassIteratorStatic {
+  ClassLoaderData* _current_loader_data;
+  Klass*           _current_class_entry;
+ public:
+
+  ClassLoaderDataGraphKlassIteratorStatic() : _current_loader_data(NULL), _current_class_entry(NULL) {}
+
+  InstanceKlass* try_get_next_class() {
+    assert(SafepointSynchronize::is_at_safepoint(), "only called at safepoint");
+    size_t max_classes = ClassLoaderDataGraph::num_instance_classes();
+    assert(max_classes > 0, "should not be called with no instance classes");
+    for (size_t i = 0; i < max_classes; ) {
+
+      if (_current_class_entry != NULL) {
+        Klass* k = _current_class_entry;
+        _current_class_entry = _current_class_entry->next_link();
+
+        if (k->is_instance_klass()) {
+          InstanceKlass* ik = InstanceKlass::cast(k);
+          i++;  // count all instance classes found
+          // Not yet loaded classes are counted in max_classes
+          // but only return loaded classes.
+          if (ik->is_loaded()) {
+            return ik;
+          }
+        }
+      } else {
+        // Go to next CLD
+        if (_current_loader_data != NULL) {
+          _current_loader_data = _current_loader_data->next();
+        }
+        // Start at the beginning
+        if (_current_loader_data == NULL) {
+          _current_loader_data = ClassLoaderDataGraph::_head;
+        }
+
+        _current_class_entry = _current_loader_data->klasses();
+      }
+    }
+    // Should never be reached unless all instance classes have failed or are not fully loaded.
+    // Caller handles NULL.
+    return NULL;
+  }
+
+  // If the current class for the static iterator is a class being unloaded or
+  // deallocated, adjust the current class.
+  void adjust_saved_class(ClassLoaderData* cld) {
+    if (_current_loader_data == cld) {
+      _current_loader_data = cld->next();
+      if (_current_loader_data != NULL) {
+        _current_class_entry = _current_loader_data->klasses();
+      }  // else try_get_next_class will start at the head
+    }
+  }
+
+  void adjust_saved_class(Klass* klass) {
+    if (_current_class_entry == klass) {
+      _current_class_entry = klass->next_link();
+    }
+  }
+};
+
+static ClassLoaderDataGraphKlassIteratorStatic static_klass_iterator;
+
+InstanceKlass* ClassLoaderDataGraph::try_get_next_class() {
+  assert(SafepointSynchronize::is_at_safepoint(), "only called at safepoint");
+  return static_klass_iterator.try_get_next_class();
+}
+
+void ClassLoaderDataGraph::adjust_saved_class(ClassLoaderData* cld) {
+  return static_klass_iterator.adjust_saved_class(cld);
+}
+
+void ClassLoaderDataGraph::adjust_saved_class(Klass* klass) {
+  return static_klass_iterator.adjust_saved_class(klass);
+}
+
+void ClassLoaderDataGraph::clean_deallocate_lists(bool walk_previous_versions) {
+  assert(SafepointSynchronize::is_at_safepoint(), "must only be called at safepoint");
+  uint loaders_processed = 0;
+  for (ClassLoaderData* cld = _head; cld != NULL; cld = cld->next()) {
+    // is_alive check will be necessary for concurrent class unloading.
+    if (cld->is_alive()) {
+      // clean metaspace
+      if (walk_previous_versions) {
+        cld->classes_do(InstanceKlass::purge_previous_versions);
+      }
+      cld->free_deallocate_list();
+      loaders_processed++;
+    }
+  }
+  log_debug(class, loader, data)("clean_deallocate_lists: loaders processed %u %s",
+                                 loaders_processed, walk_previous_versions ? "walk_previous_versions" : "");
+}
+
+void ClassLoaderDataGraph::walk_metadata_and_clean_metaspaces() {
+  assert(SafepointSynchronize::is_at_safepoint(), "must only be called at safepoint");
+
+  _should_clean_deallocate_lists = false; // assume everything gets cleaned
+
+  // Mark metadata seen on the stack so we can delete unreferenced entries.
+  // Walk all metadata, including the expensive code cache walk, only for class redefinition.
+  // The MetadataOnStackMark walk during redefinition saves previous versions if it finds old methods
+  // on the stack or in the code cache, so we only have to repeat the full walk if
+  // they were found at that time.
+  // TODO: have redefinition clean old methods out of the code cache.  They still exist in some places.
+  bool walk_all_metadata = InstanceKlass::has_previous_versions_and_reset();
+
+  MetadataOnStackMark md_on_stack(walk_all_metadata);
+  clean_deallocate_lists(walk_all_metadata);
+}
+
+// GC root of class loader data created.
+ClassLoaderData* ClassLoaderDataGraph::_head = NULL;
+ClassLoaderData* ClassLoaderDataGraph::_unloading = NULL;
+ClassLoaderData* ClassLoaderDataGraph::_saved_unloading = NULL;
+ClassLoaderData* ClassLoaderDataGraph::_saved_head = NULL;
+
+bool ClassLoaderDataGraph::_should_purge = false;
+bool ClassLoaderDataGraph::_should_clean_deallocate_lists = false;
+bool ClassLoaderDataGraph::_safepoint_cleanup_needed = false;
+bool ClassLoaderDataGraph::_metaspace_oom = false;
+
+// Add a new class loader data node to the list.  Assign the newly created
+// ClassLoaderData into the java/lang/ClassLoader object as a hidden field
+ClassLoaderData* ClassLoaderDataGraph::add_to_graph(Handle loader, bool is_unsafe_anonymous) {
+
+  assert_lock_strong(ClassLoaderDataGraph_lock);
+
+  ClassLoaderData* cld;
+
+  // First check if another thread beat us to creating the CLD and installing
+  // it into the loader while we were waiting for the lock.
+  if (!is_unsafe_anonymous && loader.not_null()) {
+    cld = java_lang_ClassLoader::loader_data_acquire(loader());
+    if (cld != NULL) {
+      return cld;
+    }
+  }
+
+  // We mustn't GC until we've installed the ClassLoaderData in the Graph since the CLD
+  // contains oops in _handles that must be walked.  GC doesn't walk CLD from the
+  // loader oop in all collections, particularly young collections.
+  NoSafepointVerifier no_safepoints;
+
+  cld = new ClassLoaderData(loader, is_unsafe_anonymous);
+
+  // First install the new CLD to the Graph.
+  cld->set_next(_head);
+  _head = cld;
+
+  // Next associate with the class_loader.
+  if (!is_unsafe_anonymous) {
+    // Use OrderAccess, since readers need to get the loader_data only after
+    // it's added to the Graph
+    java_lang_ClassLoader::release_set_loader_data(loader(), cld);
+  }
+
+  // Lastly log, if requested
+  LogTarget(Trace, class, loader, data) lt;
+  if (lt.is_enabled()) {
+    ResourceMark rm;
+    LogStream ls(lt);
+    ls.print("create ");
+    cld->print_value_on(&ls);
+    ls.cr();
+  }
+  return cld;
+}
+
+ClassLoaderData* ClassLoaderDataGraph::add(Handle loader, bool is_unsafe_anonymous) {
+  MutexLocker ml(ClassLoaderDataGraph_lock);
+  ClassLoaderData* loader_data = add_to_graph(loader, is_unsafe_anonymous);
+  return loader_data;
+}
+
+void ClassLoaderDataGraph::cld_do(CLDClosure* cl) {
+  assert_locked_or_safepoint(ClassLoaderDataGraph_lock);
+  for (ClassLoaderData* cld = _head;  cld != NULL; cld = cld->_next) {
+    cl->do_cld(cld);
+  }
+}
+
+void ClassLoaderDataGraph::cld_unloading_do(CLDClosure* cl) {
+  assert_locked_or_safepoint(ClassLoaderDataGraph_lock);
+  // Only walk the head until any clds not purged from prior unloading
+  // (CMS doesn't purge right away).
+  for (ClassLoaderData* cld = _unloading; cld != _saved_unloading; cld = cld->next()) {
+    assert(cld->is_unloading(), "invariant");
+    cl->do_cld(cld);
+  }
+}
+
+void ClassLoaderDataGraph::roots_cld_do(CLDClosure* strong, CLDClosure* weak) {
+  assert_locked_or_safepoint(ClassLoaderDataGraph_lock);
+  for (ClassLoaderData* cld = _head;  cld != NULL; cld = cld->_next) {
+    CLDClosure* closure = cld->keep_alive() ? strong : weak;
+    if (closure != NULL) {
+      closure->do_cld(cld);
+    }
+  }
+}
+
+void ClassLoaderDataGraph::always_strong_cld_do(CLDClosure* cl) {
+  assert_locked_or_safepoint(ClassLoaderDataGraph_lock);
+  if (ClassUnloading) {
+    roots_cld_do(cl, NULL);
+  } else {
+    cld_do(cl);
+  }
+}
+
+// Closure for locking and iterating through classes.
+LockedClassesDo::LockedClassesDo(classes_do_func_t f) : _function(f) {
+  ClassLoaderDataGraph_lock->lock();
+}
+
+LockedClassesDo::LockedClassesDo() : _function(NULL) {
+  // callers provide their own do_klass
+  ClassLoaderDataGraph_lock->lock();
+}
+
+LockedClassesDo::~LockedClassesDo() { ClassLoaderDataGraph_lock->unlock(); }
+
+
+// Iterating over the CLDG needs to be locked because
+// unloading can remove entries concurrently soon.
+class ClassLoaderDataGraphIterator : public StackObj {
+  ClassLoaderData* _next;
+  HandleMark       _hm;  // clean up handles when this is done.
+  Handle           _holder;
+  Thread*          _thread;
+
+  void hold_next() {
+    if (_next != NULL) {
+      _holder = Handle(_thread, _next->holder_phantom());
+    }
+  }
+public:
+  ClassLoaderDataGraphIterator() : _next(ClassLoaderDataGraph::_head) {
+    _thread = Thread::current();
+    assert_locked_or_safepoint(ClassLoaderDataGraph_lock);
+    hold_next();
+  }
+
+  bool repeat() const {
+    return _next != NULL;
+  }
+
+  ClassLoaderData* get_next() {
+    ClassLoaderData* next = _next;
+    if (_next != NULL) {
+      _next = _next->next();
+      hold_next();
+    }
+    return next;
+  }
+};
+
+// These functions assume that the caller has locked the ClassLoaderDataGraph_lock
+// if they are not calling the function from a safepoint.
+void ClassLoaderDataGraph::classes_do(KlassClosure* klass_closure) {
+  ClassLoaderDataGraphIterator iter;
+  while (iter.repeat()) {
+    ClassLoaderData* cld = iter.get_next();
+    cld->classes_do(klass_closure);
+  }
+}
+
+void ClassLoaderDataGraph::classes_do(void f(Klass* const)) {
+  ClassLoaderDataGraphIterator iter;
+  while (iter.repeat()) {
+    ClassLoaderData* cld = iter.get_next();
+    cld->classes_do(f);
+  }
+}
+
+void ClassLoaderDataGraph::methods_do(void f(Method*)) {
+  ClassLoaderDataGraphIterator iter;
+  while (iter.repeat()) {
+    ClassLoaderData* cld = iter.get_next();
+    cld->methods_do(f);
+  }
+}
+
+void ClassLoaderDataGraph::modules_do(void f(ModuleEntry*)) {
+  assert_locked_or_safepoint(Module_lock);
+  ClassLoaderDataGraphIterator iter;
+  while (iter.repeat()) {
+    ClassLoaderData* cld = iter.get_next();
+    cld->modules_do(f);
+  }
+}
+
+void ClassLoaderDataGraph::modules_unloading_do(void f(ModuleEntry*)) {
+  assert_locked_or_safepoint(ClassLoaderDataGraph_lock);
+  // Only walk the head until any clds not purged from prior unloading
+  // (CMS doesn't purge right away).
+  for (ClassLoaderData* cld = _unloading; cld != _saved_unloading; cld = cld->next()) {
+    assert(cld->is_unloading(), "invariant");
+    cld->modules_do(f);
+  }
+}
+
+void ClassLoaderDataGraph::packages_do(void f(PackageEntry*)) {
+  assert_locked_or_safepoint(Module_lock);
+  ClassLoaderDataGraphIterator iter;
+  while (iter.repeat()) {
+    ClassLoaderData* cld = iter.get_next();
+    cld->packages_do(f);
+  }
+}
+
+void ClassLoaderDataGraph::packages_unloading_do(void f(PackageEntry*)) {
+  assert_locked_or_safepoint(ClassLoaderDataGraph_lock);
+  // Only walk the head until any clds not purged from prior unloading
+  // (CMS doesn't purge right away).
+  for (ClassLoaderData* cld = _unloading; cld != _saved_unloading; cld = cld->next()) {
+    assert(cld->is_unloading(), "invariant");
+    cld->packages_do(f);
+  }
+}
+
+void ClassLoaderDataGraph::loaded_classes_do(KlassClosure* klass_closure) {
+  ClassLoaderDataGraphIterator iter;
+  while (iter.repeat()) {
+    ClassLoaderData* cld = iter.get_next();
+    cld->loaded_classes_do(klass_closure);
+  }
+}
+
+// This case can block but cannot do unloading (called from CDS)
+void ClassLoaderDataGraph::unlocked_loaded_classes_do(KlassClosure* klass_closure) {
+  for (ClassLoaderData* cld = _head; cld != NULL; cld = cld->next()) {
+    cld->loaded_classes_do(klass_closure);
+  }
+}
+
+
+void ClassLoaderDataGraph::classes_unloading_do(void f(Klass* const)) {
+  assert_locked_or_safepoint(ClassLoaderDataGraph_lock);
+  // Only walk the head until any clds not purged from prior unloading
+  // (CMS doesn't purge right away).
+  for (ClassLoaderData* cld = _unloading; cld != _saved_unloading; cld = cld->next()) {
+    assert(cld->is_unloading(), "invariant");
+    cld->classes_do(f);
+  }
+}
+
+#define FOR_ALL_DICTIONARY(X)   ClassLoaderDataGraphIterator iter; \
+                                ClassLoaderData* X; \
+                                while ((X = iter.get_next()) != NULL) \
+                                  if (X->dictionary() != NULL)
+
+// Walk classes in the loaded class dictionaries in various forms.
+// Only walks the classes defined in this class loader.
+void ClassLoaderDataGraph::dictionary_classes_do(void f(InstanceKlass*)) {
+  FOR_ALL_DICTIONARY(cld) {
+    cld->dictionary()->classes_do(f);
+  }
+}
+
+// Only walks the classes defined in this class loader.
+void ClassLoaderDataGraph::dictionary_classes_do(void f(InstanceKlass*, TRAPS), TRAPS) {
+  FOR_ALL_DICTIONARY(cld) {
+    cld->dictionary()->classes_do(f, CHECK);
+  }
+}
+
+void ClassLoaderDataGraph::verify_dictionary() {
+  FOR_ALL_DICTIONARY(cld) {
+    cld->dictionary()->verify();
+  }
+}
+
+void ClassLoaderDataGraph::print_dictionary(outputStream* st) {
+  FOR_ALL_DICTIONARY(cld) {
+    st->print("Dictionary for ");
+    cld->print_value_on(st);
+    st->cr();
+    cld->dictionary()->print_on(st);
+    st->cr();
+  }
+}
+
+void ClassLoaderDataGraph::print_dictionary_statistics(outputStream* st) {
+  FOR_ALL_DICTIONARY(cld) {
+    ResourceMark rm;
+    stringStream tempst;
+    tempst.print("System Dictionary for %s class loader", cld->loader_name_and_id());
+    cld->dictionary()->print_table_statistics(st, tempst.as_string());
+  }
+}
+
+GrowableArray<ClassLoaderData*>* ClassLoaderDataGraph::new_clds() {
+  assert_locked_or_safepoint(ClassLoaderDataGraph_lock);
+  assert(_head == NULL || _saved_head != NULL, "remember_new_clds(true) not called?");
+
+  GrowableArray<ClassLoaderData*>* array = new GrowableArray<ClassLoaderData*>();
+
+  // The CLDs in [_head, _saved_head] were all added during last call to remember_new_clds(true);
+  ClassLoaderData* curr = _head;
+  while (curr != _saved_head) {
+    if (!curr->claimed()) {
+      array->push(curr);
+      LogTarget(Debug, class, loader, data) lt;
+      if (lt.is_enabled()) {
+        LogStream ls(lt);
+        ls.print("found new CLD: ");
+        curr->print_value_on(&ls);
+        ls.cr();
+      }
+    }
+
+    curr = curr->_next;
+  }
+
+  return array;
+}
+
+#ifndef PRODUCT
+bool ClassLoaderDataGraph::contains_loader_data(ClassLoaderData* loader_data) {
+  assert_locked_or_safepoint(ClassLoaderDataGraph_lock);
+  for (ClassLoaderData* data = _head; data != NULL; data = data->next()) {
+    if (loader_data == data) {
+      return true;
+    }
+  }
+
+  return false;
+}
+#endif // PRODUCT
+
+// Move class loader data from main list to the unloaded list for unloading
+// and deallocation later.
+bool ClassLoaderDataGraph::do_unloading(bool do_cleaning) {
+  assert_locked_or_safepoint(ClassLoaderDataGraph_lock);
+
+  // Indicate whether safepoint cleanup is needed.
+  _safepoint_cleanup_needed |= do_cleaning;
+
+  ClassLoaderData* data = _head;
+  ClassLoaderData* prev = NULL;
+  bool seen_dead_loader = false;
+  uint loaders_processed = 0;
+  uint loaders_removed = 0;
+
+  // Save previous _unloading pointer for CMS which may add to unloading list before
+  // purging and we don't want to rewalk the previously unloaded class loader data.
+  _saved_unloading = _unloading;
+
+  data = _head;
+  while (data != NULL) {
+    if (data->is_alive()) {
+      prev = data;
+      data = data->next();
+      loaders_processed++;
+      continue;
+    }
+    seen_dead_loader = true;
+    loaders_removed++;
+    ClassLoaderData* dead = data;
+    dead->unload();
+    data = data->next();
+    // Remove from loader list.
+    // This class loader data will no longer be found
+    // in the ClassLoaderDataGraph.
+    if (prev != NULL) {
+      prev->set_next(data);
+    } else {
+      assert(dead == _head, "sanity check");
+      _head = data;
+    }
+    dead->set_next(_unloading);
+    _unloading = dead;
+  }
+
+  log_debug(class, loader, data)("do_unloading: loaders processed %u, loaders removed %u", loaders_processed, loaders_removed);
+
+  return seen_dead_loader;
+}
+
+// There's at least one dead class loader.  Purge refererences of healthy module
+// reads lists and package export lists to modules belonging to dead loaders.
+void ClassLoaderDataGraph::clean_module_and_package_info() {
+  assert_locked_or_safepoint(ClassLoaderDataGraph_lock);
+
+  ClassLoaderData* data = _head;
+  while (data != NULL) {
+    // Remove entries in the dictionary of live class loader that have
+    // initiated loading classes in a dead class loader.
+    if (data->dictionary() != NULL) {
+      data->dictionary()->do_unloading();
+    }
+    // Walk a ModuleEntry's reads, and a PackageEntry's exports
+    // lists to determine if there are modules on those lists that are now
+    // dead and should be removed.  A module's life cycle is equivalent
+    // to its defining class loader's life cycle.  Since a module is
+    // considered dead if its class loader is dead, these walks must
+    // occur after each class loader's aliveness is determined.
+    if (data->packages() != NULL) {
+      data->packages()->purge_all_package_exports();
+    }
+    if (data->modules_defined()) {
+      data->modules()->purge_all_module_reads();
+    }
+    data = data->next();
+  }
+}
+
+void ClassLoaderDataGraph::purge() {
+  assert(SafepointSynchronize::is_at_safepoint(), "must be at safepoint!");
+  ClassLoaderData* list = _unloading;
+  _unloading = NULL;
+  ClassLoaderData* next = list;
+  bool classes_unloaded = false;
+  while (next != NULL) {
+    ClassLoaderData* purge_me = next;
+    next = purge_me->next();
+    delete purge_me;
+    classes_unloaded = true;
+  }
+  if (classes_unloaded) {
+    Metaspace::purge();
+    set_metaspace_oom(false);
+  }
+}
+
+int ClassLoaderDataGraph::resize_if_needed() {
+  assert(SafepointSynchronize::is_at_safepoint(), "must be at safepoint!");
+  int resized = 0;
+  if (Dictionary::does_any_dictionary_needs_resizing()) {
+    FOR_ALL_DICTIONARY(cld) {
+      if (cld->dictionary()->resize_if_needed()) {
+        resized++;
+      }
+    }
+  }
+  return resized;
+}
+
+ClassLoaderDataGraphKlassIteratorAtomic::ClassLoaderDataGraphKlassIteratorAtomic()
+    : _next_klass(NULL) {
+  assert(SafepointSynchronize::is_at_safepoint(), "must be at safepoint!");
+  ClassLoaderData* cld = ClassLoaderDataGraph::_head;
+  Klass* klass = NULL;
+
+  // Find the first klass in the CLDG.
+  while (cld != NULL) {
+    assert_locked_or_safepoint(cld->metaspace_lock());
+    klass = cld->_klasses;
+    if (klass != NULL) {
+      _next_klass = klass;
+      return;
+    }
+    cld = cld->next();
+  }
+}
+
+Klass* ClassLoaderDataGraphKlassIteratorAtomic::next_klass_in_cldg(Klass* klass) {
+  Klass* next = klass->next_link();
+  if (next != NULL) {
+    return next;
+  }
+
+  // No more klasses in the current CLD. Time to find a new CLD.
+  ClassLoaderData* cld = klass->class_loader_data();
+  assert_locked_or_safepoint(cld->metaspace_lock());
+  while (next == NULL) {
+    cld = cld->next();
+    if (cld == NULL) {
+      break;
+    }
+    next = cld->_klasses;
+  }
+
+  return next;
+}
+
+Klass* ClassLoaderDataGraphKlassIteratorAtomic::next_klass() {
+  Klass* head = _next_klass;
+
+  while (head != NULL) {
+    Klass* next = next_klass_in_cldg(head);
+
+    Klass* old_head = Atomic::cmpxchg(next, &_next_klass, head);
+
+    if (old_head == head) {
+      return head; // Won the CAS.
+    }
+
+    head = old_head;
+  }
+
+  // Nothing more for the iterator to hand out.
+  assert(head == NULL, "head is " PTR_FORMAT ", expected not null:", p2i(head));
+  return NULL;
+}
+
+ClassLoaderDataGraphMetaspaceIterator::ClassLoaderDataGraphMetaspaceIterator() {
+  assert(SafepointSynchronize::is_at_safepoint(), "must be at safepoint!");
+  _data = ClassLoaderDataGraph::_head;
+}
+
+ClassLoaderDataGraphMetaspaceIterator::~ClassLoaderDataGraphMetaspaceIterator() {}
+
+ClassLoaderMetaspace* ClassLoaderDataGraphMetaspaceIterator::get_next() {
+  assert(_data != NULL, "Should not be NULL in call to the iterator");
+  ClassLoaderMetaspace* result = _data->metaspace_or_null();
+  _data = _data->next();
+  // This result might be NULL for class loaders without metaspace
+  // yet.  It would be nice to return only non-null results but
+  // there is no guarantee that there will be a non-null result
+  // down the list so the caller is going to have to check.
+  return result;
+}
+
+#ifndef PRODUCT
+// callable from debugger
+extern "C" int print_loader_data_graph() {
+  ResourceMark rm;
+  ClassLoaderDataGraph::print_on(tty);
+  return 0;
+}
+
+void ClassLoaderDataGraph::verify() {
+  ClassLoaderDataGraphIterator iter;
+  while (iter.repeat()) {
+    ClassLoaderData* cld = iter.get_next();
+    cld->verify();
+  }
+}
+
+void ClassLoaderDataGraph::print_on(outputStream * const out) {
+  ClassLoaderDataGraphIterator iter;
+  while (iter.repeat()) {
+    ClassLoaderData* cld = iter.get_next();
+    cld->print_on(out);
+  }
+}
+#endif // PRODUCT
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/src/hotspot/share/classfile/classLoaderDataGraph.hpp	Wed Oct 03 16:02:24 2018 +0200
@@ -0,0 +1,182 @@
+/*
+ * Copyright (c) 2018, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ *
+ */
+
+#ifndef SHARE_VM_CLASSFILE_CLASSLOADERDATAGRAPH_HPP
+#define SHARE_VM_CLASSFILE_CLASSLOADERDATAGRAPH_HPP
+
+#include "classfile/classLoaderData.hpp"
+#include "memory/allocation.hpp"
+#include "utilities/growableArray.hpp"
+#include "utilities/macros.hpp"
+
+// GC root for walking class loader data created
+
+class ClassLoaderDataGraph : public AllStatic {
+  friend class ClassLoaderData;
+  friend class ClassLoaderDataGraphMetaspaceIterator;
+  friend class ClassLoaderDataGraphKlassIteratorAtomic;
+  friend class ClassLoaderDataGraphKlassIteratorStatic;
+  friend class ClassLoaderDataGraphIterator;
+  friend class VMStructs;
+ private:
+  // All CLDs (except the null CLD) can be reached by walking _head->_next->...
+  static ClassLoaderData* _head;
+  static ClassLoaderData* _unloading;
+  // CMS support.
+  static ClassLoaderData* _saved_head;
+  static ClassLoaderData* _saved_unloading;
+  static bool _should_purge;
+
+  // Set if there's anything to purge in the deallocate lists or previous versions
+  // during a safepoint after class unloading in a full GC.
+  static bool _should_clean_deallocate_lists;
+  static bool _safepoint_cleanup_needed;
+
+  // OOM has been seen in metaspace allocation. Used to prevent some
+  // allocations until class unloading
+  static bool _metaspace_oom;
+
+  static volatile size_t  _num_instance_classes;
+  static volatile size_t  _num_array_classes;
+
+  static ClassLoaderData* add_to_graph(Handle class_loader, bool is_unsafe_anonymous);
+  static ClassLoaderData* add(Handle class_loader, bool is_unsafe_anonymous);
+
+ public:
+  static ClassLoaderData* find_or_create(Handle class_loader);
+  static void clean_module_and_package_info();
+  static void purge();
+  static void clear_claimed_marks();
+  // Iteration through CLDG inside a safepoint; GC support
+  static void cld_do(CLDClosure* cl);
+  static void cld_unloading_do(CLDClosure* cl);
+  static void roots_cld_do(CLDClosure* strong, CLDClosure* weak);
+  static void always_strong_cld_do(CLDClosure* cl);
+  // klass do
+  // Walking classes through the ClassLoaderDataGraph include array classes.  It also includes
+  // classes that are allocated but not loaded, classes that have errors, and scratch classes
+  // for redefinition.  These classes are removed during the next class unloading.
+  // Walking the ClassLoaderDataGraph also includes unsafe anonymous classes.
+  static void classes_do(KlassClosure* klass_closure);
+  static void classes_do(void f(Klass* const));
+  static void methods_do(void f(Method*));
+  static void modules_do(void f(ModuleEntry*));
+  static void modules_unloading_do(void f(ModuleEntry*));
+  static void packages_do(void f(PackageEntry*));
+  static void packages_unloading_do(void f(PackageEntry*));
+  static void loaded_classes_do(KlassClosure* klass_closure);
+  static void unlocked_loaded_classes_do(KlassClosure* klass_closure);
+  static void classes_unloading_do(void f(Klass* const));
+  static bool do_unloading(bool do_cleaning);
+
+  // Expose state to avoid logging overhead in safepoint cleanup tasks.
+  static inline bool should_clean_metaspaces_and_reset();
+  static void set_should_clean_deallocate_lists() { _should_clean_deallocate_lists = true; }
+  static void clean_deallocate_lists(bool purge_previous_versions);
+  static void walk_metadata_and_clean_metaspaces();
+
+  // dictionary do
+  // Iterate over all klasses in dictionary, but
+  // just the classes from defining class loaders.
+  static void dictionary_classes_do(void f(InstanceKlass*));
+  // Added for initialize_itable_for_klass to handle exceptions.
+  static void dictionary_classes_do(void f(InstanceKlass*, TRAPS), TRAPS);
+
+  // VM_CounterDecay iteration support
+  static InstanceKlass* try_get_next_class();
+  static void adjust_saved_class(ClassLoaderData* cld);
+  static void adjust_saved_class(Klass* klass);
+
+  static void verify_dictionary();
+  static void print_dictionary(outputStream* st);
+  static void print_dictionary_statistics(outputStream* st);
+
+  // CMS support.
+  static void remember_new_clds(bool remember) { _saved_head = (remember ? _head : NULL); }
+  static GrowableArray<ClassLoaderData*>* new_clds();
+
+  static void set_should_purge(bool b) { _should_purge = b; }
+  static void purge_if_needed() {
+    // Only purge the CLDG for CMS if concurrent sweep is complete.
+    if (_should_purge) {
+      purge();
+      // reset for next time.
+      set_should_purge(false);
+    }
+  }
+
+  static int resize_if_needed();
+
+  static bool has_metaspace_oom()           { return _metaspace_oom; }
+  static void set_metaspace_oom(bool value) { _metaspace_oom = value; }
+
+  static void print_on(outputStream * const out) PRODUCT_RETURN;
+  static void print() { print_on(tty); }
+  static void verify();
+
+  // instance and array class counters
+  static inline size_t num_instance_classes();
+  static inline size_t num_array_classes();
+  static inline void inc_instance_classes(size_t count);
+  static inline void dec_instance_classes(size_t count);
+  static inline void inc_array_classes(size_t count);
+  static inline void dec_array_classes(size_t count);
+
+#ifndef PRODUCT
+  static bool contains_loader_data(ClassLoaderData* loader_data);
+#endif
+};
+
+class LockedClassesDo : public KlassClosure {
+  typedef void (*classes_do_func_t)(Klass*);
+  classes_do_func_t _function;
+public:
+  LockedClassesDo();  // For callers who provide their own do_klass
+  LockedClassesDo(classes_do_func_t function);
+  ~LockedClassesDo();
+
+  void do_klass(Klass* k) {
+    (*_function)(k);
+  }
+};
+
+// An iterator that distributes Klasses to parallel worker threads.
+class ClassLoaderDataGraphKlassIteratorAtomic : public StackObj {
+ Klass* volatile _next_klass;
+ public:
+  ClassLoaderDataGraphKlassIteratorAtomic();
+  Klass* next_klass();
+ private:
+  static Klass* next_klass_in_cldg(Klass* klass);
+};
+
+class ClassLoaderDataGraphMetaspaceIterator : public StackObj {
+  ClassLoaderData* _data;
+ public:
+  ClassLoaderDataGraphMetaspaceIterator();
+  ~ClassLoaderDataGraphMetaspaceIterator();
+  bool repeat() { return _data != NULL; }
+  ClassLoaderMetaspace* get_next();
+};
+#endif // SHARE_VM_CLASSFILE_CLASSLOADERDATAGRAPH_HPP
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/src/hotspot/share/classfile/classLoaderDataGraph.inline.hpp	Wed Oct 03 16:02:24 2018 +0200
@@ -0,0 +1,82 @@
+/*
+ * Copyright (c) 2018, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ *
+ */
+
+#ifndef SHARE_VM_CLASSFILE_CLASSLOADERDATAGRAPH_INLINE_HPP
+#define SHARE_VM_CLASSFILE_CLASSLOADERDATAGRAPH_INLINE_HPP
+
+#include "classfile/classLoaderDataGraph.hpp"
+#include "classfile/javaClasses.hpp"
+#include "oops/oop.inline.hpp"
+#include "runtime/atomic.hpp"
+
+inline ClassLoaderData *ClassLoaderDataGraph::find_or_create(Handle loader) {
+  guarantee(loader() != NULL && oopDesc::is_oop(loader()), "Loader must be oop");
+  // Gets the class loader data out of the java/lang/ClassLoader object, if non-null
+  // it's already in the loader_data, so no need to add
+  ClassLoaderData* loader_data = java_lang_ClassLoader::loader_data_acquire(loader());
+  if (loader_data) {
+     return loader_data;
+  }
+  return ClassLoaderDataGraph::add(loader, false);
+}
+
+size_t ClassLoaderDataGraph::num_instance_classes() {
+  return _num_instance_classes;
+}
+
+size_t ClassLoaderDataGraph::num_array_classes() {
+  return _num_array_classes;
+}
+
+void ClassLoaderDataGraph::inc_instance_classes(size_t count) {
+  Atomic::add(count, &_num_instance_classes);
+}
+
+void ClassLoaderDataGraph::dec_instance_classes(size_t count) {
+  assert(count <= _num_instance_classes, "Sanity");
+  Atomic::sub(count, &_num_instance_classes);
+}
+
+void ClassLoaderDataGraph::inc_array_classes(size_t count) {
+  Atomic::add(count, &_num_array_classes);
+}
+
+void ClassLoaderDataGraph::dec_array_classes(size_t count) {
+  assert(count <= _num_array_classes, "Sanity");
+  Atomic::sub(count, &_num_array_classes);
+}
+
+bool ClassLoaderDataGraph::should_clean_metaspaces_and_reset() {
+  // Only clean metaspaces after full GC.
+  bool do_cleaning = _safepoint_cleanup_needed;
+#if INCLUDE_JVMTI
+  do_cleaning = do_cleaning && (_should_clean_deallocate_lists || InstanceKlass::has_previous_versions());
+#else
+  do_cleaning = do_cleaning && _should_clean_deallocate_lists;
+#endif
+  _safepoint_cleanup_needed = false;  // reset
+  return do_cleaning;
+}
+
+#endif // SHARE_VM_CLASSFILE_CLASSLOADERDATAGRAPH_INLINE_HPP
--- a/src/hotspot/share/classfile/classLoaderHierarchyDCmd.cpp	Wed Oct 03 15:54:35 2018 +0200
+++ b/src/hotspot/share/classfile/classLoaderHierarchyDCmd.cpp	Wed Oct 03 16:02:24 2018 +0200
@@ -26,6 +26,7 @@
 #include "precompiled.hpp"
 
 #include "classfile/classLoaderData.inline.hpp"
+#include "classfile/classLoaderDataGraph.hpp"
 #include "classfile/classLoaderHierarchyDCmd.hpp"
 #include "memory/allocation.hpp"
 #include "memory/resourceArea.hpp"
--- a/src/hotspot/share/classfile/classLoaderStats.cpp	Wed Oct 03 15:54:35 2018 +0200
+++ b/src/hotspot/share/classfile/classLoaderStats.cpp	Wed Oct 03 16:02:24 2018 +0200
@@ -24,6 +24,7 @@
 
 #include "precompiled.hpp"
 #include "classfile/classLoaderData.inline.hpp"
+#include "classfile/classLoaderDataGraph.hpp"
 #include "classfile/classLoaderStats.hpp"
 #include "oops/oop.inline.hpp"
 #include "utilities/globalDefinitions.hpp"
--- a/src/hotspot/share/classfile/loaderConstraints.cpp	Wed Oct 03 15:54:35 2018 +0200
+++ b/src/hotspot/share/classfile/loaderConstraints.cpp	Wed Oct 03 16:02:24 2018 +0200
@@ -23,8 +23,9 @@
  */
 
 #include "precompiled.hpp"
+#include "classfile/classLoaderData.inline.hpp"
+#include "classfile/classLoaderDataGraph.hpp"
 #include "classfile/dictionary.hpp"
-#include "classfile/classLoaderData.inline.hpp"
 #include "classfile/loaderConstraints.hpp"
 #include "logging/log.hpp"
 #include "memory/resourceArea.hpp"
--- a/src/hotspot/share/classfile/symbolTable.cpp	Wed Oct 03 15:54:35 2018 +0200
+++ b/src/hotspot/share/classfile/symbolTable.cpp	Wed Oct 03 16:02:24 2018 +0200
@@ -478,8 +478,8 @@
 #ifdef ASSERT
     assert(sym->utf8_length() == _len, "%s [%d,%d]", where, sym->utf8_length(), _len);
     for (int i = 0; i < _len; i++) {
-      assert(sym->byte_at(i) == (jbyte) _name[i],
-             "%s [%d,%d,%d]", where, i, sym->byte_at(i), _name[i]);
+      assert(sym->char_at(i) == _name[i],
+             "%s [%d,%d,%d]", where, i, sym->char_at(i), _name[i]);
     }
 #endif
   }
--- a/src/hotspot/share/classfile/systemDictionary.cpp	Wed Oct 03 15:54:35 2018 +0200
+++ b/src/hotspot/share/classfile/systemDictionary.cpp	Wed Oct 03 16:02:24 2018 +0200
@@ -29,6 +29,7 @@
 #include "classfile/classFileStream.hpp"
 #include "classfile/classLoader.hpp"
 #include "classfile/classLoaderData.inline.hpp"
+#include "classfile/classLoaderDataGraph.inline.hpp"
 #include "classfile/classLoaderExt.hpp"
 #include "classfile/dictionary.hpp"
 #include "classfile/javaClasses.inline.hpp"
@@ -2600,7 +2601,7 @@
   if (type->utf8_length() == 1) {
 
     // It's a primitive.  (Void has a primitive mirror too.)
-    char ch = (char) type->byte_at(0);
+    char ch = type->char_at(0);
     assert(is_java_primitive(char2type(ch)) || ch == 'V', "");
     return Handle(THREAD, find_java_mirror_for_type(ch));
 
--- a/src/hotspot/share/classfile/verificationType.cpp	Wed Oct 03 15:54:35 2018 +0200
+++ b/src/hotspot/share/classfile/verificationType.cpp	Wed Oct 03 16:02:24 2018 +0200
@@ -120,7 +120,7 @@
 VerificationType VerificationType::get_component(ClassVerifier *context, TRAPS) const {
   assert(is_array() && name()->utf8_length() >= 2, "Must be a valid array");
   Symbol* component;
-  switch (name()->byte_at(1)) {
+  switch (name()->char_at(1)) {
     case 'Z': return VerificationType(Boolean);
     case 'B': return VerificationType(Byte);
     case 'C': return VerificationType(Char);
--- a/src/hotspot/share/classfile/verificationType.hpp	Wed Oct 03 15:54:35 2018 +0200
+++ b/src/hotspot/share/classfile/verificationType.hpp	Wed Oct 03 16:02:24 2018 +0200
@@ -207,7 +207,7 @@
   bool is_check() const { return (_u._data & TypeQuery) == TypeQuery; }
 
   bool is_x_array(char sig) const {
-    return is_null() || (is_array() && (name()->byte_at(1) == sig));
+    return is_null() || (is_array() && (name()->char_at(1) == sig));
   }
   bool is_int_array() const { return is_x_array('I'); }
   bool is_byte_array() const { return is_x_array('B'); }
@@ -223,10 +223,10 @@
     { return is_object_array() || is_array_array(); }
   bool is_object() const
     { return (is_reference() && !is_null() && name()->utf8_length() >= 1 &&
-              name()->byte_at(0) != '['); }
+              name()->char_at(0) != '['); }
   bool is_array() const
     { return (is_reference() && !is_null() && name()->utf8_length() >= 2 &&
-              name()->byte_at(0) == '['); }
+              name()->char_at(0) == '['); }
   bool is_uninitialized() const
     { return ((_u._data & Uninitialized) == Uninitialized); }
   bool is_uninitialized_this() const
@@ -322,7 +322,7 @@
   int dimensions() const {
     assert(is_array(), "Must be an array");
     int index = 0;
-    while (name()->byte_at(index) == '[') index++;
+    while (name()->char_at(index) == '[') index++;
     return index;
   }
 
--- a/src/hotspot/share/classfile/verifier.cpp	Wed Oct 03 15:54:35 2018 +0200
+++ b/src/hotspot/share/classfile/verifier.cpp	Wed Oct 03 16:02:24 2018 +0200
@@ -2809,7 +2809,7 @@
     }
   }
 
-  if (method_name->byte_at(0) == '<') {
+  if (method_name->char_at(0) == '<') {
     // Make sure <init> can only be invoked by invokespecial
     if (opcode != Bytecodes::_invokespecial ||
         method_name != vmSymbols::object_initializer_name()) {
--- a/src/hotspot/share/classfile/vmSymbols.cpp	Wed Oct 03 15:54:35 2018 +0200
+++ b/src/hotspot/share/classfile/vmSymbols.cpp	Wed Oct 03 16:02:24 2018 +0200
@@ -212,7 +212,7 @@
 BasicType vmSymbols::signature_type(const Symbol* s) {
   assert(s != NULL, "checking");
   if (s->utf8_length() == 1) {
-    BasicType result = char2type(s->byte_at(0));
+    BasicType result = char2type(s->char_at(0));
     if (is_java_primitive(result) || result == T_VOID) {
       assert(s == _type_signatures[result], "");
       return result;
--- a/src/hotspot/share/code/dependencyContext.cpp	Wed Oct 03 15:54:35 2018 +0200
+++ b/src/hotspot/share/code/dependencyContext.cpp	Wed Oct 03 16:02:24 2018 +0200
@@ -218,18 +218,6 @@
   return marked;
 }
 
-void DependencyContext::wipe() {
-  assert_locked_or_safepoint(CodeCache_lock);
-  nmethodBucket* b = dependencies();
-  set_dependencies(NULL);
-  set_has_stale_entries(false);
-  while (b != NULL) {
-    nmethodBucket* next = b->next();
-    delete b;
-    b = next;
-  }
-}
-
 #ifndef PRODUCT
 void DependencyContext::print_dependent_nmethods(bool verbose) {
   int idx = 0;
--- a/src/hotspot/share/code/dependencyContext.hpp	Wed Oct 03 15:54:35 2018 +0200
+++ b/src/hotspot/share/code/dependencyContext.hpp	Wed Oct 03 16:02:24 2018 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2015, 2018, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -141,10 +141,6 @@
 
   void expunge_stale_entries();
 
-  // Unsafe deallocation of nmethodBuckets. Used in IK::release_C_heap_structures
-  // to clean up the context possibly containing live entries pointing to unloaded nmethods.
-  void wipe();
-
 #ifndef PRODUCT
   void print_dependent_nmethods(bool verbose);
   bool is_dependent_nmethod(nmethod* nm);
--- a/src/hotspot/share/code/nmethod.cpp	Wed Oct 03 15:54:35 2018 +0200
+++ b/src/hotspot/share/code/nmethod.cpp	Wed Oct 03 16:02:24 2018 +0200
@@ -2748,9 +2748,7 @@
   virtual void verify() const {
     // make sure code pattern is actually a call imm32 instruction
     _call->verify();
-    if (os::is_MP()) {
-      _call->verify_alignment();
-    }
+    _call->verify_alignment();
   }
 
   virtual void verify_resolve_call(address dest) const {
--- a/src/hotspot/share/gc/cms/concurrentMarkSweepGeneration.cpp	Wed Oct 03 15:54:35 2018 +0200
+++ b/src/hotspot/share/gc/cms/concurrentMarkSweepGeneration.cpp	Wed Oct 03 16:02:24 2018 +0200
@@ -23,7 +23,7 @@
  */
 
 #include "precompiled.hpp"
-#include "classfile/classLoaderData.hpp"
+#include "classfile/classLoaderDataGraph.hpp"
 #include "classfile/stringTable.hpp"
 #include "classfile/symbolTable.hpp"
 #include "classfile/systemDictionary.hpp"
--- a/src/hotspot/share/gc/g1/g1CollectedHeap.cpp	Wed Oct 03 15:54:35 2018 +0200
+++ b/src/hotspot/share/gc/g1/g1CollectedHeap.cpp	Wed Oct 03 16:02:24 2018 +0200
@@ -23,6 +23,7 @@
  */
 
 #include "precompiled.hpp"
+#include "classfile/classLoaderDataGraph.hpp"
 #include "classfile/metadataOnStackMark.hpp"
 #include "classfile/stringTable.hpp"
 #include "code/codeCache.hpp"
@@ -3169,18 +3170,24 @@
 }
 
 bool G1ParEvacuateFollowersClosure::offer_termination() {
+  EventGCPhaseParallel event;
   G1ParScanThreadState* const pss = par_scan_state();
   start_term_time();
   const bool res = terminator()->offer_termination();
   end_term_time();
+  event.commit(GCId::current(), pss->worker_id(), G1GCPhaseTimes::phase_name(G1GCPhaseTimes::Termination));
   return res;
 }
 
 void G1ParEvacuateFollowersClosure::do_void() {
+  EventGCPhaseParallel event;
   G1ParScanThreadState* const pss = par_scan_state();
   pss->trim_queue();
+  event.commit(GCId::current(), pss->worker_id(), G1GCPhaseTimes::phase_name(G1GCPhaseTimes::ObjCopy));
   do {
+    EventGCPhaseParallel event;
     pss->steal_and_trim_queue(queues());
+    event.commit(GCId::current(), pss->worker_id(), G1GCPhaseTimes::phase_name(G1GCPhaseTimes::ObjCopy));
   } while (!offer_termination());
 }
 
@@ -4050,6 +4057,7 @@
         break;
       }
 
+      EventGCPhaseParallel event;
       double start_time = os::elapsedTime();
 
       end = MIN2(end, _num_work_items);
@@ -4064,9 +4072,11 @@
         if (is_young) {
           young_time += time_taken;
           has_young_time = true;
+          event.commit(GCId::current(), worker_id, G1GCPhaseTimes::phase_name(G1GCPhaseTimes::YoungFreeCSet));
         } else {
           non_young_time += time_taken;
           has_non_young_time = true;
+          event.commit(GCId::current(), worker_id, G1GCPhaseTimes::phase_name(G1GCPhaseTimes::NonYoungFreeCSet));
         }
         start_time = end_time;
       }
--- a/src/hotspot/share/gc/g1/g1ConcurrentMark.cpp	Wed Oct 03 15:54:35 2018 +0200
+++ b/src/hotspot/share/gc/g1/g1ConcurrentMark.cpp	Wed Oct 03 16:02:24 2018 +0200
@@ -23,7 +23,7 @@
  */
 
 #include "precompiled.hpp"
-#include "classfile/metadataOnStackMark.hpp"
+#include "classfile/classLoaderDataGraph.hpp"
 #include "code/codeCache.hpp"
 #include "gc/g1/g1BarrierSet.hpp"
 #include "gc/g1/g1CollectedHeap.inline.hpp"
--- a/src/hotspot/share/gc/g1/g1ConcurrentMarkThread.cpp	Wed Oct 03 15:54:35 2018 +0200
+++ b/src/hotspot/share/gc/g1/g1ConcurrentMarkThread.cpp	Wed Oct 03 16:02:24 2018 +0200
@@ -23,7 +23,7 @@
  */
 
 #include "precompiled.hpp"
-#include "classfile/classLoaderData.hpp"
+#include "classfile/classLoaderDataGraph.hpp"
 #include "gc/g1/g1Analytics.hpp"
 #include "gc/g1/g1CollectedHeap.inline.hpp"
 #include "gc/g1/g1ConcurrentMark.inline.hpp"
--- a/src/hotspot/share/gc/g1/g1FullGCAdjustTask.cpp	Wed Oct 03 15:54:35 2018 +0200
+++ b/src/hotspot/share/gc/g1/g1FullGCAdjustTask.cpp	Wed Oct 03 16:02:24 2018 +0200
@@ -23,6 +23,7 @@
  */
 
 #include "precompiled.hpp"
+#include "classfile/classLoaderDataGraph.hpp"
 #include "gc/g1/g1CollectedHeap.hpp"
 #include "gc/g1/g1ConcurrentMarkBitMap.inline.hpp"
 #include "gc/g1/g1FullCollector.hpp"
--- a/src/hotspot/share/gc/g1/g1FullGCMarkTask.cpp	Wed Oct 03 15:54:35 2018 +0200
+++ b/src/hotspot/share/gc/g1/g1FullGCMarkTask.cpp	Wed Oct 03 16:02:24 2018 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2017, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2017, 2018, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -23,6 +23,7 @@
  */
 
 #include "precompiled.hpp"
+#include "classfile/classLoaderDataGraph.hpp"
 #include "gc/g1/g1CollectedHeap.hpp"
 #include "gc/g1/g1FullCollector.hpp"
 #include "gc/g1/g1FullGCMarker.hpp"
--- a/src/hotspot/share/gc/g1/g1GCPhaseTimes.cpp	Wed Oct 03 15:54:35 2018 +0200
+++ b/src/hotspot/share/gc/g1/g1GCPhaseTimes.cpp	Wed Oct 03 16:02:24 2018 +0200
@@ -465,6 +465,48 @@
   }
 }
 
+const char* G1GCPhaseTimes::phase_name(GCParPhases phase) {
+  static const char* names[] = {
+      "GCWorkerStart",
+      "ExtRootScan",
+      "ThreadRoots",
+      "StringTableRoots",
+      "UniverseRoots",
+      "JNIRoots",
+      "ObjectSynchronizerRoots",
+      "ManagementRoots",
+      "SystemDictionaryRoots",
+      "CLDGRoots",
+      "JVMTIRoots",
+      "CMRefRoots",
+      "WaitForStrongCLD",
+      "WeakCLDRoots",
+      "SATBFiltering",
+      "UpdateRS",
+      "ScanHCC",
+      "ScanRS",
+      "CodeRoots",
+#if INCLUDE_AOT
+      "AOTCodeRoots",
+#endif
+      "ObjCopy",
+      "Termination",
+      "Other",
+      "GCWorkerTotal",
+      "GCWorkerEnd",
+      "StringDedupQueueFixup",
+      "StringDedupTableFixup",
+      "RedirtyCards",
+      "YoungFreeCSet",
+      "NonYoungFreeCSet"
+      //GCParPhasesSentinel only used to tell end of enum
+      };
+
+  STATIC_ASSERT(ARRAY_SIZE(names) == G1GCPhaseTimes::GCParPhasesSentinel); // GCParPhases enum and corresponding string array should have the same "length", this tries to assert it
+
+  return names[phase];
+}
+
 G1EvacPhaseWithTrimTimeTracker::G1EvacPhaseWithTrimTimeTracker(G1ParScanThreadState* pss, Tickspan& total_time, Tickspan& trim_time) :
   _pss(pss),
   _start(Ticks::now()),
@@ -490,7 +532,7 @@
 }
 
 G1GCParPhaseTimesTracker::G1GCParPhaseTimesTracker(G1GCPhaseTimes* phase_times, G1GCPhaseTimes::GCParPhases phase, uint worker_id) :
-  _start_time(), _phase(phase), _phase_times(phase_times), _worker_id(worker_id) {
+  _start_time(), _phase(phase), _phase_times(phase_times), _worker_id(worker_id), _event() {
   if (_phase_times != NULL) {
     _start_time = Ticks::now();
   }
@@ -499,6 +541,7 @@
 G1GCParPhaseTimesTracker::~G1GCParPhaseTimesTracker() {
   if (_phase_times != NULL) {
     _phase_times->record_time_secs(_phase, _worker_id, (Ticks::now() - _start_time).seconds());
+    _event.commit(GCId::current(), _worker_id, G1GCPhaseTimes::phase_name(_phase));
   }
 }
 
--- a/src/hotspot/share/gc/g1/g1GCPhaseTimes.hpp	Wed Oct 03 15:54:35 2018 +0200
+++ b/src/hotspot/share/gc/g1/g1GCPhaseTimes.hpp	Wed Oct 03 16:02:24 2018 +0200
@@ -27,6 +27,7 @@
 
 #include "gc/shared/referenceProcessorPhaseTimes.hpp"
 #include "gc/shared/weakProcessorPhaseTimes.hpp"
+#include "jfr/jfrEvents.hpp"
 #include "logging/logLevel.hpp"
 #include "memory/allocation.hpp"
 #include "utilities/macros.hpp"
@@ -190,6 +191,7 @@
   G1GCPhaseTimes(STWGCTimer* gc_timer, uint max_gc_threads);
   void note_gc_start();
   void print();
+  static const char* phase_name(GCParPhases phase);
 
   // record the time a phase took in seconds
   void record_time_secs(GCParPhases phase, uint worker_i, double secs);
@@ -385,6 +387,7 @@
   G1GCPhaseTimes::GCParPhases _phase;
   G1GCPhaseTimes* _phase_times;
   uint _worker_id;
+  EventGCPhaseParallel _event;
 public:
   G1GCParPhaseTimesTracker(G1GCPhaseTimes* phase_times, G1GCPhaseTimes::GCParPhases phase, uint worker_id);
   virtual ~G1GCParPhaseTimesTracker();
--- a/src/hotspot/share/gc/g1/g1RemSet.cpp	Wed Oct 03 15:54:35 2018 +0200
+++ b/src/hotspot/share/gc/g1/g1RemSet.cpp	Wed Oct 03 16:02:24 2018 +0200
@@ -40,6 +40,7 @@
 #include "gc/g1/heapRegionRemSet.hpp"
 #include "gc/shared/gcTraceTime.inline.hpp"
 #include "gc/shared/suspendibleThreadSet.hpp"
+#include "jfr/jfrEvents.hpp"
 #include "memory/iterator.hpp"
 #include "memory/resourceArea.hpp"
 #include "oops/access.inline.hpp"
@@ -339,6 +340,7 @@
 }
 
 void G1ScanRSForRegionClosure::scan_rem_set_roots(HeapRegion* r) {
+  EventGCPhaseParallel event;
   uint const region_idx = r->hrm_index();
 
   if (_scan_state->claim_iter(region_idx)) {
@@ -392,10 +394,13 @@
 
     scan_card(mr, region_idx_for_card);
   }
+  event.commit(GCId::current(), _worker_i, G1GCPhaseTimes::phase_name(G1GCPhaseTimes::ScanRS));
 }
 
 void G1ScanRSForRegionClosure::scan_strong_code_roots(HeapRegion* r) {
+  EventGCPhaseParallel event;
   r->strong_code_roots_do(_pss->closures()->weak_codeblobs());
+  event.commit(GCId::current(), _worker_i, G1GCPhaseTimes::phase_name(G1GCPhaseTimes::CodeRoots));
 }
 
 bool G1ScanRSForRegionClosure::do_heap_region(HeapRegion* r) {
--- a/src/hotspot/share/gc/g1/g1RootProcessor.cpp	Wed Oct 03 15:54:35 2018 +0200
+++ b/src/hotspot/share/gc/g1/g1RootProcessor.cpp	Wed Oct 03 16:02:24 2018 +0200
@@ -23,8 +23,8 @@
  */
 
 #include "precompiled.hpp"
-
 #include "aot/aotLoader.hpp"
+#include "classfile/classLoaderDataGraph.hpp"
 #include "classfile/stringTable.hpp"
 #include "classfile/systemDictionary.hpp"
 #include "code/codeCache.hpp"
--- a/src/hotspot/share/gc/parallel/adjoiningGenerations.cpp	Wed Oct 03 15:54:35 2018 +0200
+++ b/src/hotspot/share/gc/parallel/adjoiningGenerations.cpp	Wed Oct 03 16:02:24 2018 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2003, 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2003, 2018, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -122,7 +122,7 @@
 }
 
 void log_before_expansion(bool old, size_t expand_in_bytes, size_t change_in_bytes, size_t max_size) {
-  Log(heap, ergo) log;
+  Log(gc, ergo, heap) log;
   if (!log.is_debug()) {
    return;
   }
@@ -136,7 +136,7 @@
 }
 
 void log_after_expansion(bool old, size_t max_size) {
-  Log(heap, ergo) log;
+  Log(gc, ergo, heap) log;
   if (!log.is_debug()) {
    return;
   }
--- a/src/hotspot/share/gc/parallel/pcTasks.cpp	Wed Oct 03 15:54:35 2018 +0200
+++ b/src/hotspot/share/gc/parallel/pcTasks.cpp	Wed Oct 03 16:02:24 2018 +0200
@@ -24,6 +24,7 @@
 
 #include "precompiled.hpp"
 #include "aot/aotLoader.hpp"
+#include "classfile/classLoaderDataGraph.hpp"
 #include "classfile/systemDictionary.hpp"
 #include "code/codeCache.hpp"
 #include "gc/parallel/parallelScavengeHeap.hpp"
--- a/src/hotspot/share/gc/parallel/psMarkSweep.cpp	Wed Oct 03 15:54:35 2018 +0200
+++ b/src/hotspot/share/gc/parallel/psMarkSweep.cpp	Wed Oct 03 16:02:24 2018 +0200
@@ -24,6 +24,7 @@
 
 #include "precompiled.hpp"
 #include "aot/aotLoader.hpp"
+#include "classfile/classLoaderDataGraph.hpp"
 #include "classfile/stringTable.hpp"
 #include "classfile/symbolTable.hpp"
 #include "classfile/systemDictionary.hpp"
@@ -432,15 +433,15 @@
     return false; // Respect young gen minimum size.
   }
 
-  log_trace(heap, ergo)(" absorbing " SIZE_FORMAT "K:  "
-                        "eden " SIZE_FORMAT "K->" SIZE_FORMAT "K "
-                        "from " SIZE_FORMAT "K, to " SIZE_FORMAT "K "
-                        "young_gen " SIZE_FORMAT "K->" SIZE_FORMAT "K ",
-                        absorb_size / K,
-                        eden_capacity / K, (eden_capacity - absorb_size) / K,
-                        young_gen->from_space()->used_in_bytes() / K,
-                        young_gen->to_space()->used_in_bytes() / K,
-                        young_gen->capacity_in_bytes() / K, new_young_size / K);
+  log_trace(gc, ergo, heap)(" absorbing " SIZE_FORMAT "K:  "
+                            "eden " SIZE_FORMAT "K->" SIZE_FORMAT "K "
+                            "from " SIZE_FORMAT "K, to " SIZE_FORMAT "K "
+                            "young_gen " SIZE_FORMAT "K->" SIZE_FORMAT "K ",
+                            absorb_size / K,
+                            eden_capacity / K, (eden_capacity - absorb_size) / K,
+                            young_gen->from_space()->used_in_bytes() / K,
+                            young_gen->to_space()->used_in_bytes() / K,
+                            young_gen->capacity_in_bytes() / K, new_young_size / K);
 
   // Fill the unused part of the old gen.
   MutableSpace* const old_space = old_gen->object_space();
--- a/src/hotspot/share/gc/parallel/psParallelCompact.cpp	Wed Oct 03 15:54:35 2018 +0200
+++ b/src/hotspot/share/gc/parallel/psParallelCompact.cpp	Wed Oct 03 16:02:24 2018 +0200
@@ -24,6 +24,7 @@
 
 #include "precompiled.hpp"
 #include "aot/aotLoader.hpp"
+#include "classfile/classLoaderDataGraph.hpp"
 #include "classfile/javaClasses.inline.hpp"
 #include "classfile/stringTable.hpp"
 #include "classfile/symbolTable.hpp"
@@ -1999,15 +2000,15 @@
     return false; // Respect young gen minimum size.
   }
 
-  log_trace(heap, ergo)(" absorbing " SIZE_FORMAT "K:  "
-                        "eden " SIZE_FORMAT "K->" SIZE_FORMAT "K "
-                        "from " SIZE_FORMAT "K, to " SIZE_FORMAT "K "
-                        "young_gen " SIZE_FORMAT "K->" SIZE_FORMAT "K ",
-                        absorb_size / K,
-                        eden_capacity / K, (eden_capacity - absorb_size) / K,
-                        young_gen->from_space()->used_in_bytes() / K,
-                        young_gen->to_space()->used_in_bytes() / K,
-                        young_gen->capacity_in_bytes() / K, new_young_size / K);
+  log_trace(gc, ergo, heap)(" absorbing " SIZE_FORMAT "K:  "
+                            "eden " SIZE_FORMAT "K->" SIZE_FORMAT "K "
+                            "from " SIZE_FORMAT "K, to " SIZE_FORMAT "K "
+                            "young_gen " SIZE_FORMAT "K->" SIZE_FORMAT "K ",
+                            absorb_size / K,
+                            eden_capacity / K, (eden_capacity - absorb_size) / K,
+                            young_gen->from_space()->used_in_bytes() / K,
+                            young_gen->to_space()->used_in_bytes() / K,
+                            young_gen->capacity_in_bytes() / K, new_young_size / K);
 
   // Fill the unused part of the old gen.
   MutableSpace* const old_space = old_gen->object_space();
--- a/src/hotspot/share/gc/parallel/psTasks.cpp	Wed Oct 03 15:54:35 2018 +0200
+++ b/src/hotspot/share/gc/parallel/psTasks.cpp	Wed Oct 03 16:02:24 2018 +0200
@@ -24,6 +24,7 @@
 
 #include "precompiled.hpp"
 #include "aot/aotLoader.hpp"
+#include "classfile/classLoaderDataGraph.hpp"
 #include "classfile/systemDictionary.hpp"
 #include "code/codeCache.hpp"
 #include "gc/parallel/gcTaskManager.hpp"
--- a/src/hotspot/share/gc/serial/genMarkSweep.cpp	Wed Oct 03 15:54:35 2018 +0200
+++ b/src/hotspot/share/gc/serial/genMarkSweep.cpp	Wed Oct 03 16:02:24 2018 +0200
@@ -23,6 +23,7 @@
  */
 
 #include "precompiled.hpp"
+#include "classfile/classLoaderDataGraph.hpp"
 #include "classfile/javaClasses.hpp"
 #include "classfile/stringTable.hpp"
 #include "classfile/symbolTable.hpp"
--- a/src/hotspot/share/gc/shared/c1/barrierSetC1.cpp	Wed Oct 03 15:54:35 2018 +0200
+++ b/src/hotspot/share/gc/shared/c1/barrierSetC1.cpp	Wed Oct 03 16:02:24 2018 +0200
@@ -135,7 +135,7 @@
 
 void BarrierSetC1::store_at_resolved(LIRAccess& access, LIR_Opr value) {
   DecoratorSet decorators = access.decorators();
-  bool is_volatile = (((decorators & MO_SEQ_CST) != 0) || AlwaysAtomicAccesses) && os::is_MP();
+  bool is_volatile = (((decorators & MO_SEQ_CST) != 0) || AlwaysAtomicAccesses);
   bool needs_patching = (decorators & C1_NEEDS_PATCHING) != 0;
   bool mask_boolean = (decorators & C1_MASK_BOOLEAN) != 0;
   LIRGenerator* gen = access.gen();
@@ -144,7 +144,7 @@
     value = gen->mask_boolean(access.base().opr(), value, access.access_emit_info());
   }
 
-  if (is_volatile && os::is_MP()) {
+  if (is_volatile) {
     __ membar_release();
   }
 
@@ -163,7 +163,7 @@
 void BarrierSetC1::load_at_resolved(LIRAccess& access, LIR_Opr result) {
   LIRGenerator *gen = access.gen();
   DecoratorSet decorators = access.decorators();
-  bool is_volatile = (((decorators & MO_SEQ_CST) != 0) || AlwaysAtomicAccesses) && os::is_MP();
+  bool is_volatile = (((decorators & MO_SEQ_CST) != 0) || AlwaysAtomicAccesses);
   bool needs_patching = (decorators & C1_NEEDS_PATCHING) != 0;
   bool mask_boolean = (decorators & C1_MASK_BOOLEAN) != 0;
   bool in_native = (decorators & IN_NATIVE) != 0;
@@ -181,7 +181,7 @@
     __ load(access.resolved_addr()->as_address_ptr(), result, access.access_emit_info(), patch_code);
   }
 
-  if (is_volatile && os::is_MP()) {
+  if (is_volatile) {
     __ membar_acquire();
   }
 
@@ -296,6 +296,10 @@
   if (gen_pre_barrier) {
     // We can have generate one runtime check here. Let's start with
     // the offset check.
+    // Allocate temp register to base and load it here, otherwise
+    // control flow below may confuse register allocator.
+    LIR_Opr base_reg = gen->new_register(T_OBJECT);
+    __ move(base.result(), base_reg);
     if (gen_offset_check) {
       // if (offset != referent_offset) -> continue
       // If offset is an int then we can do the comparison with the
@@ -318,14 +322,14 @@
     if (gen_source_check) {
       // offset is a const and equals referent offset
       // if (source == null) -> continue
-      __ cmp(lir_cond_equal, base.result(), LIR_OprFact::oopConst(NULL));
+      __ cmp(lir_cond_equal, base_reg, LIR_OprFact::oopConst(NULL));
       __ branch(lir_cond_equal, T_OBJECT, cont->label());
     }
     LIR_Opr src_klass = gen->new_register(T_METADATA);
     if (gen_type_check) {
       // We have determined that offset == referent_offset && src != null.
       // if (src->_klass->_reference_type == REF_NONE) -> continue
-      __ move(new LIR_Address(base.result(), oopDesc::klass_offset_in_bytes(), T_ADDRESS), src_klass);
+      __ move(new LIR_Address(base_reg, oopDesc::klass_offset_in_bytes(), T_ADDRESS), src_klass);
       LIR_Address* reference_type_addr = new LIR_Address(src_klass, in_bytes(InstanceKlass::reference_type_offset()), T_BYTE);
       LIR_Opr reference_type = gen->new_register(T_INT);
       __ move(reference_type_addr, reference_type);
--- a/src/hotspot/share/gc/shared/c2/barrierSetC2.cpp	Wed Oct 03 15:54:35 2018 +0200
+++ b/src/hotspot/share/gc/shared/c2/barrierSetC2.cpp	Wed Oct 03 16:02:24 2018 +0200
@@ -310,7 +310,7 @@
 
 //--------------------------- atomic operations---------------------------------
 
-static void pin_atomic_op(C2AtomicAccess& access) {
+void BarrierSetC2::pin_atomic_op(C2AtomicAccess& access) const {
   if (!access.needs_pinning()) {
     return;
   }
@@ -598,6 +598,7 @@
   ac->set_clonebasic();
   Node* n = kit->gvn().transform(ac);
   if (n == ac) {
+    ac->_adr_type = TypeRawPtr::BOTTOM;
     kit->set_predefined_output_for_runtime_call(ac, ac->in(TypeFunc::Memory), raw_adr_type);
   } else {
     kit->set_all_memory(n);
--- a/src/hotspot/share/gc/shared/c2/barrierSetC2.hpp	Wed Oct 03 15:54:35 2018 +0200
+++ b/src/hotspot/share/gc/shared/c2/barrierSetC2.hpp	Wed Oct 03 16:02:24 2018 +0200
@@ -76,14 +76,12 @@
 
 // This class wraps a node and a pointer type.
 class C2AccessValuePtr: public C2AccessValue {
-  int _alias_idx;
 
 public:
   C2AccessValuePtr(Node* node, const TypePtr* type) :
     C2AccessValue(node, reinterpret_cast<const Type*>(type)) {}
 
   const TypePtr* type() const { return reinterpret_cast<const TypePtr*>(_type); }
-  int alias_idx() const       { return _alias_idx; }
 };
 
 // This class wraps a bunch of context parameters thare are passed around in the
@@ -175,6 +173,7 @@
                                                 Node* new_val, const Type* value_type) const;
   virtual Node* atomic_xchg_at_resolved(C2AtomicAccess& access, Node* new_val, const Type* val_type) const;
   virtual Node* atomic_add_at_resolved(C2AtomicAccess& access, Node* new_val, const Type* val_type) const;
+  void pin_atomic_op(C2AtomicAccess& access) const;
 
 public:
   // This is the entry-point for the backend to perform accesses through the Access API.
@@ -198,7 +197,12 @@
                              intx prefetch_lines) const;
 
   // These are general helper methods used by C2
-  virtual bool array_copy_requires_gc_barriers(BasicType type) const { return false; }
+  enum ArrayCopyPhase {
+    Parsing,
+    Optimization,
+    Expansion
+  };
+  virtual bool array_copy_requires_gc_barriers(bool tightly_coupled_alloc, BasicType type, bool is_clone, ArrayCopyPhase phase) const { return false; }
 
   // Support for GC barriers emitted during parsing
   virtual bool has_load_barriers() const { return false; }
--- a/src/hotspot/share/gc/shared/c2/cardTableBarrierSetC2.cpp	Wed Oct 03 15:54:35 2018 +0200
+++ b/src/hotspot/share/gc/shared/c2/cardTableBarrierSetC2.cpp	Wed Oct 03 16:02:24 2018 +0200
@@ -186,6 +186,7 @@
   }
 }
 
-bool CardTableBarrierSetC2::array_copy_requires_gc_barriers(BasicType type) const {
-  return !use_ReduceInitialCardMarks();
+bool CardTableBarrierSetC2::array_copy_requires_gc_barriers(bool tightly_coupled_alloc, BasicType type, bool is_clone, ArrayCopyPhase phase) const {
+  bool is_oop = type == T_OBJECT || type == T_ARRAY;
+  return is_oop && (!tightly_coupled_alloc || !use_ReduceInitialCardMarks());
 }
--- a/src/hotspot/share/gc/shared/c2/cardTableBarrierSetC2.hpp	Wed Oct 03 15:54:35 2018 +0200
+++ b/src/hotspot/share/gc/shared/c2/cardTableBarrierSetC2.hpp	Wed Oct 03 16:02:24 2018 +0200
@@ -45,7 +45,7 @@
   virtual void clone(GraphKit* kit, Node* src, Node* dst, Node* size, bool is_array) const;
   virtual bool is_gc_barrier_node(Node* node) const;
   virtual void eliminate_gc_barrier(PhaseMacroExpand* macro, Node* node) const;
-  virtual bool array_copy_requires_gc_barriers(BasicType type) const;
+  virtual bool array_copy_requires_gc_barriers(bool tightly_coupled_alloc, BasicType type, bool is_clone, ArrayCopyPhase phase) const;
 
   bool use_ReduceInitialCardMarks() const;
 };
--- a/src/hotspot/share/gc/shared/cardTableRS.cpp	Wed Oct 03 15:54:35 2018 +0200
+++ b/src/hotspot/share/gc/shared/cardTableRS.cpp	Wed Oct 03 16:02:24 2018 +0200
@@ -23,6 +23,7 @@
  */
 
 #include "precompiled.hpp"
+#include "classfile/classLoaderDataGraph.hpp"
 #include "gc/shared/cardTableRS.hpp"
 #include "gc/shared/genCollectedHeap.hpp"
 #include "gc/shared/genOopClosures.hpp"
--- a/src/hotspot/share/gc/shared/genCollectedHeap.cpp	Wed Oct 03 15:54:35 2018 +0200
+++ b/src/hotspot/share/gc/shared/genCollectedHeap.cpp	Wed Oct 03 16:02:24 2018 +0200
@@ -24,6 +24,7 @@
 
 #include "precompiled.hpp"
 #include "aot/aotLoader.hpp"
+#include "classfile/classLoaderDataGraph.hpp"
 #include "classfile/symbolTable.hpp"
 #include "classfile/stringTable.hpp"
 #include "classfile/systemDictionary.hpp"
--- a/src/hotspot/share/gc/shared/memAllocator.hpp	Wed Oct 03 15:54:35 2018 +0200
+++ b/src/hotspot/share/gc/shared/memAllocator.hpp	Wed Oct 03 16:02:24 2018 +0200
@@ -34,9 +34,9 @@
 // These fascilities are used for allocating, and initializing newly allocated objects.
 
 class MemAllocator: StackObj {
+protected:
   class Allocation;
 
-protected:
   CollectedHeap* const _heap;
   Thread* const        _thread;
   Klass* const         _klass;
--- a/src/hotspot/share/gc/shared/parallelCleaning.hpp	Wed Oct 03 15:54:35 2018 +0200
+++ b/src/hotspot/share/gc/shared/parallelCleaning.hpp	Wed Oct 03 16:02:24 2018 +0200
@@ -25,6 +25,7 @@
 #ifndef SHARE_VM_GC_SHARED_PARALLELCLEANING_HPP
 #define SHARE_VM_GC_SHARED_PARALLELCLEANING_HPP
 
+#include "classfile/classLoaderDataGraph.inline.hpp"
 #include "gc/shared/oopStorageParState.hpp"
 #include "gc/shared/stringdedup/stringDedup.hpp"
 #include "gc/shared/workgroup.hpp"
--- a/src/hotspot/share/gc/z/c2/zBarrierSetC2.hpp	Wed Oct 03 15:54:35 2018 +0200
+++ b/src/hotspot/share/gc/z/c2/zBarrierSetC2.hpp	Wed Oct 03 16:02:24 2018 +0200
@@ -194,7 +194,7 @@
   virtual void enqueue_useful_gc_barrier(Unique_Node_List &worklist, Node* node) const;
   virtual void register_potential_barrier_node(Node* node) const;
   virtual void unregister_potential_barrier_node(Node* node) const;
-  virtual bool array_copy_requires_gc_barriers(BasicType type) const { return true; }
+  virtual bool array_copy_requires_gc_barriers(bool tightly_coupled_alloc, BasicType type, bool is_clone, ArrayCopyPhase phase) const { return true; }
   virtual Node* step_over_gc_barrier(Node* c) const;
   // If the BarrierSetC2 state has kept macro nodes in its compilation unit state to be
   // expanded later, then now is the time to do so.
--- a/src/hotspot/share/gc/z/zRootsIterator.cpp	Wed Oct 03 15:54:35 2018 +0200
+++ b/src/hotspot/share/gc/z/zRootsIterator.cpp	Wed Oct 03 16:02:24 2018 +0200
@@ -22,7 +22,7 @@
  */
 
 #include "precompiled.hpp"
-#include "classfile/classLoaderData.hpp"
+#include "classfile/classLoaderDataGraph.hpp"
 #include "classfile/stringTable.hpp"
 #include "classfile/systemDictionary.hpp"
 #include "code/codeCache.hpp"
--- a/src/hotspot/share/jfr/leakprofiler/chains/rootSetClosure.cpp	Wed Oct 03 15:54:35 2018 +0200
+++ b/src/hotspot/share/jfr/leakprofiler/chains/rootSetClosure.cpp	Wed Oct 03 16:02:24 2018 +0200
@@ -24,7 +24,7 @@
 
 #include "precompiled.hpp"
 #include "aot/aotLoader.hpp"
-#include "classfile/classLoaderData.hpp"
+#include "classfile/classLoaderDataGraph.hpp"
 #include "classfile/stringTable.hpp"
 #include "classfile/systemDictionary.hpp"
 #include "gc/shared/strongRootsScope.hpp"
--- a/src/hotspot/share/jfr/leakprofiler/checkpoint/rootResolver.cpp	Wed Oct 03 15:54:35 2018 +0200
+++ b/src/hotspot/share/jfr/leakprofiler/checkpoint/rootResolver.cpp	Wed Oct 03 16:02:24 2018 +0200
@@ -24,6 +24,7 @@
 
 #include "precompiled.hpp"
 #include "aot/aotLoader.hpp"
+#include "classfile/classLoaderDataGraph.hpp"
 #include "classfile/stringTable.hpp"
 #include "gc/shared/strongRootsScope.hpp"
 #include "jfr/leakprofiler/utilities/unifiedOop.hpp"
--- a/src/hotspot/share/jfr/leakprofiler/utilities/saveRestore.cpp	Wed Oct 03 15:54:35 2018 +0200
+++ b/src/hotspot/share/jfr/leakprofiler/utilities/saveRestore.cpp	Wed Oct 03 16:02:24 2018 +0200
@@ -23,7 +23,7 @@
  */
 
 #include "precompiled.hpp"
-#include "classfile/classLoaderData.hpp"
+#include "classfile/classLoaderDataGraph.hpp"
 #include "jfr/leakprofiler/utilities/saveRestore.hpp"
 #include "oops/oop.inline.hpp"
 
--- a/src/hotspot/share/jfr/metadata/metadata.xml	Wed Oct 03 15:54:35 2018 +0200
+++ b/src/hotspot/share/jfr/metadata/metadata.xml	Wed Oct 03 16:02:24 2018 +0200
@@ -435,6 +435,13 @@
     <Field type="string" name="name" label="Name" />
   </Event>
 
+  <Event name="GCPhaseParallel" category="Java Virtual Machine, GC, Phases" label="GC Phase Parallel"
+         startTime="true" thread="true" description="GC phases for parallel workers">
+    <Field type="uint" name="gcId" label="GC Identifier" relation="GcId"/>
+    <Field type="uint" name="gcWorkerId" label="GC Worker Identifier" />
+    <Field type="string" name="name" label="Name" />
+  </Event>
+  
   <Event name="AllocationRequiringGC" category="Java Virtual Machine, GC, Detailed" label="Allocation Requiring GC" thread="true" stackTrace="true"
     startTime="false">
     <Field type="uint" name="gcId" label="Pending GC Identifier" relation="GcId" />
--- a/src/hotspot/share/jfr/periodic/jfrModuleEvent.cpp	Wed Oct 03 15:54:35 2018 +0200
+++ b/src/hotspot/share/jfr/periodic/jfrModuleEvent.cpp	Wed Oct 03 16:02:24 2018 +0200
@@ -23,7 +23,8 @@
  */
 
 #include "precompiled.hpp"
-#include "classfile/classLoaderData.hpp"
+#include "classfile/classLoaderData.inline.hpp"
+#include "classfile/classLoaderDataGraph.hpp"
 #include "classfile/moduleEntry.hpp"
 #include "classfile/packageEntry.hpp"
 #include "jfr/jfrEvents.hpp"
--- a/src/hotspot/share/jfr/periodic/jfrPeriodic.cpp	Wed Oct 03 15:54:35 2018 +0200
+++ b/src/hotspot/share/jfr/periodic/jfrPeriodic.cpp	Wed Oct 03 16:02:24 2018 +0200
@@ -24,6 +24,7 @@
 
 #include "precompiled.hpp"
 #include "jvm.h"
+#include "classfile/classLoaderDataGraph.hpp"
 #include "classfile/classLoaderStats.hpp"
 #include "classfile/javaClasses.hpp"
 #include "code/codeCache.hpp"
--- a/src/hotspot/share/jfr/recorder/checkpoint/types/jfrTypeSet.cpp	Wed Oct 03 15:54:35 2018 +0200
+++ b/src/hotspot/share/jfr/recorder/checkpoint/types/jfrTypeSet.cpp	Wed Oct 03 16:02:24 2018 +0200
@@ -23,7 +23,7 @@
  */
 
 #include "precompiled.hpp"
-#include "classfile/classLoaderData.inline.hpp"
+#include "classfile/classLoaderDataGraph.hpp"
 #include "classfile/javaClasses.inline.hpp"
 #include "classfile/moduleEntry.hpp"
 #include "classfile/packageEntry.hpp"
--- a/src/hotspot/share/jvmci/jvmciCompilerToVM.cpp	Wed Oct 03 15:54:35 2018 +0200
+++ b/src/hotspot/share/jvmci/jvmciCompilerToVM.cpp	Wed Oct 03 16:02:24 2018 +0200
@@ -435,8 +435,8 @@
   if (resolve) {
     resolved_klass = SystemDictionary::resolve_or_null(class_name, class_loader, protection_domain, CHECK_0);
   } else {
-    if (class_name->byte_at(0) == 'L' &&
-      class_name->byte_at(class_name->utf8_length()-1) == ';') {
+    if (class_name->char_at(0) == 'L' &&
+      class_name->char_at(class_name->utf8_length()-1) == ';') {
       // This is a name from a signature.  Strip off the trimmings.
       // Call recursive to keep scope of strippedsym.
       TempNewSymbol strippedsym = SymbolTable::new_symbol(class_name->as_utf8()+1,
--- a/src/hotspot/share/jvmci/jvmciEnv.cpp	Wed Oct 03 15:54:35 2018 +0200
+++ b/src/hotspot/share/jvmci/jvmciEnv.cpp	Wed Oct 03 16:02:24 2018 +0200
@@ -98,8 +98,8 @@
   JVMCI_EXCEPTION_CONTEXT;
 
   // Now we need to check the SystemDictionary
-  if (sym->byte_at(0) == 'L' &&
-    sym->byte_at(sym->utf8_length()-1) == ';') {
+  if (sym->char_at(0) == 'L' &&
+    sym->char_at(sym->utf8_length()-1) == ';') {
     // This is a name from a signature.  Strip off the trimmings.
     // Call recursive to keep scope of strippedsym.
     TempNewSymbol strippedsym = SymbolTable::new_symbol(sym->as_utf8()+1,
@@ -132,8 +132,8 @@
   // we must build an array type around it.  The CI requires array klasses
   // to be loaded if their element klasses are loaded, except when memory
   // is exhausted.
-  if (sym->byte_at(0) == '[' &&
-      (sym->byte_at(1) == '[' || sym->byte_at(1) == 'L')) {
+  if (sym->char_at(0) == '[' &&
+      (sym->char_at(1) == '[' || sym->char_at(1) == 'L')) {
     // We have an unloaded array.
     // Build it on the fly if the element class exists.
     TempNewSymbol elem_sym = SymbolTable::new_symbol(sym->as_utf8()+1,
--- a/src/hotspot/share/memory/heapInspection.cpp	Wed Oct 03 15:54:35 2018 +0200
+++ b/src/hotspot/share/memory/heapInspection.cpp	Wed Oct 03 16:02:24 2018 +0200
@@ -24,6 +24,7 @@
 
 #include "precompiled.hpp"
 #include "classfile/classLoaderData.inline.hpp"
+#include "classfile/classLoaderDataGraph.hpp"
 #include "classfile/moduleEntry.hpp"
 #include "classfile/systemDictionary.hpp"
 #include "gc/shared/collectedHeap.hpp"
--- a/src/hotspot/share/memory/metaspace.cpp	Wed Oct 03 15:54:35 2018 +0200
+++ b/src/hotspot/share/memory/metaspace.cpp	Wed Oct 03 16:02:24 2018 +0200
@@ -23,8 +23,8 @@
  */
 
 #include "precompiled.hpp"
-
 #include "aot/aotLoader.hpp"
+#include "classfile/classLoaderDataGraph.hpp"
 #include "gc/shared/collectedHeap.hpp"
 #include "logging/log.hpp"
 #include "logging/logStream.hpp"
--- a/src/hotspot/share/memory/metaspaceShared.cpp	Wed Oct 03 15:54:35 2018 +0200
+++ b/src/hotspot/share/memory/metaspaceShared.cpp	Wed Oct 03 16:02:24 2018 +0200
@@ -24,6 +24,7 @@
 
 #include "precompiled.hpp"
 #include "jvm.h"
+#include "classfile/classLoaderDataGraph.hpp"
 #include "classfile/classListParser.hpp"
 #include "classfile/classLoaderExt.hpp"
 #include "classfile/dictionary.hpp"
--- a/src/hotspot/share/memory/universe.cpp	Wed Oct 03 15:54:35 2018 +0200
+++ b/src/hotspot/share/memory/universe.cpp	Wed Oct 03 16:02:24 2018 +0200
@@ -25,7 +25,7 @@
 #include "precompiled.hpp"
 #include "aot/aotLoader.hpp"
 #include "classfile/classLoader.hpp"
-#include "classfile/classLoaderData.hpp"
+#include "classfile/classLoaderDataGraph.hpp"
 #include "classfile/javaClasses.hpp"
 #include "classfile/stringTable.hpp"
 #include "classfile/systemDictionary.hpp"
--- a/src/hotspot/share/oops/instanceKlass.cpp	Wed Oct 03 15:54:35 2018 +0200
+++ b/src/hotspot/share/oops/instanceKlass.cpp	Wed Oct 03 16:02:24 2018 +0200
@@ -686,15 +686,6 @@
   return Verifier::verify(this, should_verify_class(), THREAD);
 }
 
-
-// Used exclusively by the shared spaces dump mechanism to prevent
-// classes mapped into the shared regions in new VMs from appearing linked.
-
-void InstanceKlass::unlink_class() {
-  assert(is_linked(), "must be linked");
-  _init_state = loaded;
-}
-
 void InstanceKlass::link_class(TRAPS) {
   assert(is_loaded(), "must be loaded");
   if (!is_linked()) {
@@ -2300,10 +2291,12 @@
     return;
   }
 
-  // Unlink the class
-  if (is_linked()) {
-    unlink_class();
-  }
+  // Reset to the 'allocated' state to prevent any premature accessing to
+  // a shared class at runtime while the class is still being loaded and
+  // restored. A class' init_state is set to 'loaded' at runtime when it's
+  // being added to class hierarchy (see SystemDictionary:::add_to_hierarchy()).
+  _init_state = allocated;
+
   {
     MutexLocker ml(Compile_lock);
     init_implementor();
@@ -2350,6 +2343,10 @@
 }
 
 void InstanceKlass::restore_unshareable_info(ClassLoaderData* loader_data, Handle protection_domain, TRAPS) {
+  // SystemDictionary::add_to_hierarchy() sets the init_state to loaded
+  // before the InstanceKlass is added to the SystemDictionary. Make
+  // sure the current state is <loaded.
+  assert(!is_loaded(), "invalid init state");
   set_package(loader_data, CHECK);
   Klass::restore_unshareable_info(loader_data, protection_domain, CHECK);
 
@@ -2417,7 +2414,10 @@
 }
 #endif
 
-void InstanceKlass::notify_unload_class(InstanceKlass* ik) {
+void InstanceKlass::unload_class(InstanceKlass* ik) {
+  // Release dependencies.
+  ik->dependencies().remove_all_dependents();
+
   // notify the debugger
   if (JvmtiExport::should_post_class_unload()) {
     JvmtiExport::post_class_unload(ik);
@@ -2462,16 +2462,8 @@
     FreeHeap(jmeths);
   }
 
-  // Release dependencies.
-  // It is desirable to use DC::remove_all_dependents() here, but, unfortunately,
-  // it is not safe (see JDK-8143408). The problem is that the klass dependency
-  // context can contain live dependencies, since there's a race between nmethod &
-  // klass unloading. If the klass is dead when nmethod unloading happens, relevant
-  // dependencies aren't removed from the context associated with the class (see
-  // nmethod::flush_dependencies). It ends up during klass unloading as seemingly
-  // live dependencies pointing to unloaded nmethods and causes a crash in
-  // DC::remove_all_dependents() when it touches unloaded nmethod.
-  dependencies().wipe();
+  assert(_dep_context == DependencyContext::EMPTY,
+         "dependencies should already be cleaned");
 
 #if INCLUDE_JVMTI
   // Deallocate breakpoint records
--- a/src/hotspot/share/oops/instanceKlass.hpp	Wed Oct 03 15:54:35 2018 +0200
+++ b/src/hotspot/share/oops/instanceKlass.hpp	Wed Oct 03 16:02:24 2018 +0200
@@ -542,7 +542,6 @@
   void initialize(TRAPS);
   void link_class(TRAPS);
   bool link_class_or_fail(TRAPS); // returns false on failure
-  void unlink_class();
   void rewrite_class(TRAPS);
   void link_methods(TRAPS);
   Method* class_initializer() const;
@@ -1180,7 +1179,7 @@
   bool on_stack() const { return _constants->on_stack(); }
 
   // callbacks for actions during class unloading
-  static void notify_unload_class(InstanceKlass* ik);
+  static void unload_class(InstanceKlass* ik);
   static void release_C_heap_structures(InstanceKlass* ik);
 
   // Naming
--- a/src/hotspot/share/oops/klassVtable.cpp	Wed Oct 03 15:54:35 2018 +0200
+++ b/src/hotspot/share/oops/klassVtable.cpp	Wed Oct 03 16:02:24 2018 +0200
@@ -24,6 +24,7 @@
 
 #include "precompiled.hpp"
 #include "jvm.h"
+#include "classfile/classLoaderDataGraph.hpp"
 #include "classfile/javaClasses.hpp"
 #include "classfile/systemDictionary.hpp"
 #include "classfile/vmSymbols.hpp"
--- a/src/hotspot/share/oops/method.cpp	Wed Oct 03 15:54:35 2018 +0200
+++ b/src/hotspot/share/oops/method.cpp	Wed Oct 03 16:02:24 2018 +0200
@@ -23,6 +23,7 @@
  */
 
 #include "precompiled.hpp"
+#include "classfile/classLoaderDataGraph.hpp"
 #include "classfile/metadataOnStackMark.hpp"
 #include "classfile/systemDictionary.hpp"
 #include "code/codeCache.hpp"
--- a/src/hotspot/share/oops/symbol.cpp	Wed Oct 03 15:54:35 2018 +0200
+++ b/src/hotspot/share/oops/symbol.cpp	Wed Oct 03 16:02:24 2018 +0200
@@ -79,7 +79,7 @@
 bool Symbol::starts_with(const char* prefix, int len) const {
   if (len > utf8_length()) return false;
   while (len-- > 0) {
-    if (prefix[len] != (char) byte_at(len))
+    if (prefix[len] != char_at(len))
       return false;
   }
   assert(len == -1, "we should be at the beginning");
@@ -117,7 +117,7 @@
   if (size > 0) {
     int len = MIN2(size - 1, utf8_length());
     for (int i = 0; i < len; i++) {
-      buf[i] = byte_at(i);
+      buf[i] = char_at(i);
     }
     buf[len] = '\0';
   }
@@ -311,7 +311,7 @@
   } else {
     st->print("'");
     for (int i = 0; i < utf8_length(); i++) {
-      st->print("%c", byte_at(i));
+      st->print("%c", char_at(i));
     }
     st->print("'");
   }
--- a/src/hotspot/share/oops/symbol.hpp	Wed Oct 03 15:54:35 2018 +0200
+++ b/src/hotspot/share/oops/symbol.hpp	Wed Oct 03 16:02:24 2018 +0200
@@ -112,7 +112,7 @@
   // in high half word. length is the number of UTF8 characters in the symbol
   volatile uint32_t _length_and_refcount;
   short _identity_hash;
-  jbyte _body[2];
+  u1 _body[2];
 
   enum {
     // max_symbol_length must fit into the top 16 bits of _length_and_refcount
@@ -128,7 +128,7 @@
     return (int)heap_word_size(byte_size(length));
   }
 
-  void byte_at_put(int index, int value) {
+  void byte_at_put(int index, u1 value) {
     assert(index >=0 && index < length(), "symbol index overflow");
     _body[index] = value;
   }
@@ -148,7 +148,7 @@
 
  public:
   // Low-level access (used with care, since not GC-safe)
-  const jbyte* base() const { return &_body[0]; }
+  const u1* base() const { return &_body[0]; }
 
   int size()                { return size(utf8_length()); }
   int byte_size()           { return byte_size(utf8_length()); }
@@ -176,12 +176,16 @@
     return (refcount() == PERM_REFCOUNT);
   }
 
-  int byte_at(int index) const {
+  // Function char_at() returns the Symbol's selected u1 byte as a char type.
+  //
+  // Note that all multi-byte chars have the sign bit set on all their bytes.
+  // No single byte chars have their sign bit set.
+  char char_at(int index) const {
     assert(index >=0 && index < length(), "symbol index overflow");
-    return base()[index];
+    return (char)base()[index];
   }
 
-  const jbyte* bytes() const { return base(); }
+  const u1* bytes() const { return base(); }
 
   int utf8_length() const { return length(); }
 
@@ -190,7 +194,7 @@
     int l = utf8_length();
     if (l != len) return false;
     while (l-- > 0) {
-      if (str[l] != (char) byte_at(l))
+      if (str[l] != char_at(l))
         return false;
     }
     assert(l == -1, "we should be at the beginning");
--- a/src/hotspot/share/opto/arraycopynode.cpp	Wed Oct 03 15:54:35 2018 +0200
+++ b/src/hotspot/share/opto/arraycopynode.cpp	Wed Oct 03 16:02:24 2018 +0200
@@ -32,7 +32,7 @@
 #include "utilities/macros.hpp"
 
 ArrayCopyNode::ArrayCopyNode(Compile* C, bool alloc_tightly_coupled, bool has_negative_length_guard)
-  : CallNode(arraycopy_type(), NULL, TypeRawPtr::BOTTOM),
+  : CallNode(arraycopy_type(), NULL, TypePtr::BOTTOM),
     _kind(None),
     _alloc_tightly_coupled(alloc_tightly_coupled),
     _has_negative_length_guard(has_negative_length_guard),
@@ -257,8 +257,7 @@
     }
 
     BarrierSetC2* bs = BarrierSet::barrier_set()->barrier_set_c2();
-    if (dest_elem == T_OBJECT && (!is_alloc_tightly_coupled() ||
-                                  bs->array_copy_requires_gc_barriers(T_OBJECT))) {
+    if (bs->array_copy_requires_gc_barriers(is_alloc_tightly_coupled(), dest_elem, false, BarrierSetC2::Optimization)) {
       // It's an object array copy but we can't emit the card marking
       // that is needed
       return false;
@@ -307,6 +306,11 @@
     BasicType elem = ary_src->klass()->as_array_klass()->element_type()->basic_type();
     if (elem == T_ARRAY)  elem = T_OBJECT;
 
+    BarrierSetC2* bs = BarrierSet::barrier_set()->barrier_set_c2();
+    if (bs->array_copy_requires_gc_barriers(true, elem, true, BarrierSetC2::Optimization)) {
+      return false;
+    }
+
     int diff = arrayOopDesc::base_offset_in_bytes(elem) - phase->type(src->in(AddPNode::Offset))->is_intptr_t()->get_con();
     assert(diff >= 0, "clone should not start after 1st array element");
     if (diff > 0) {
@@ -350,9 +354,8 @@
 
 Node* ArrayCopyNode::array_copy_forward(PhaseGVN *phase,
                                         bool can_reshape,
-                                        Node* forward_ctl,
-                                        Node* start_mem_src,
-                                        Node* start_mem_dest,
+                                        Node*& forward_ctl,
+                                        MergeMemNode* mm,
                                         const TypePtr* atp_src,
                                         const TypePtr* atp_dest,
                                         Node* adr_src,
@@ -362,12 +365,14 @@
                                         BasicType copy_type,
                                         const Type* value_type,
                                         int count) {
-  Node* mem = phase->C->top();
   if (!forward_ctl->is_top()) {
     // copy forward
-    mem = start_mem_dest;
+    mm = mm->clone()->as_MergeMem();
     uint alias_idx_src = phase->C->get_alias_index(atp_src);
     uint alias_idx_dest = phase->C->get_alias_index(atp_dest);
+    Node *start_mem_src = mm->memory_at(alias_idx_src);
+    Node *start_mem_dest = mm->memory_at(alias_idx_dest);
+    Node* mem = start_mem_dest;
     bool same_alias = (alias_idx_src == alias_idx_dest);
 
     if (count > 0) {
@@ -384,20 +389,21 @@
         mem = StoreNode::make(*phase, forward_ctl,mem,next_dest,atp_dest,v, copy_type, MemNode::unordered);
         mem = phase->transform(mem);
       }
+      mm->set_memory_at(alias_idx_dest, mem);
     } else if(can_reshape) {
       PhaseIterGVN* igvn = phase->is_IterGVN();
       igvn->_worklist.push(adr_src);
       igvn->_worklist.push(adr_dest);
     }
+    return mm;
   }
-  return mem;
+  return phase->C->top();
 }
 
 Node* ArrayCopyNode::array_copy_backward(PhaseGVN *phase,
                                          bool can_reshape,
-                                         Node* backward_ctl,
-                                         Node* start_mem_src,
-                                         Node* start_mem_dest,
+                                         Node*& backward_ctl,
+                                         MergeMemNode* mm,
                                          const TypePtr* atp_src,
                                          const TypePtr* atp_dest,
                                          Node* adr_src,
@@ -407,12 +413,17 @@
                                          BasicType copy_type,
                                          const Type* value_type,
                                          int count) {
-  Node* mem = phase->C->top();
   if (!backward_ctl->is_top()) {
     // copy backward
-    mem = start_mem_dest;
+    mm = mm->clone()->as_MergeMem();
     uint alias_idx_src = phase->C->get_alias_index(atp_src);
     uint alias_idx_dest = phase->C->get_alias_index(atp_dest);
+    Node *start_mem_src = mm->memory_at(alias_idx_src);
+    Node *start_mem_dest = mm->memory_at(alias_idx_dest);
+    Node* mem = start_mem_dest;
+
+    BarrierSetC2* bs = BarrierSet::barrier_set()->barrier_set_c2();
+    assert(copy_type != T_OBJECT || !bs->array_copy_requires_gc_barriers(false, T_OBJECT, false, BarrierSetC2::Optimization), "only tightly coupled allocations for object arrays");
     bool same_alias = (alias_idx_src == alias_idx_dest);
 
     if (count > 0) {
@@ -429,13 +440,15 @@
       v = phase->transform(v);
       mem = StoreNode::make(*phase, backward_ctl, mem, adr_dest, atp_dest, v, copy_type, MemNode::unordered);
       mem = phase->transform(mem);
+      mm->set_memory_at(alias_idx_dest, mem);
     } else if(can_reshape) {
       PhaseIterGVN* igvn = phase->is_IterGVN();
       igvn->_worklist.push(adr_src);
       igvn->_worklist.push(adr_dest);
     }
+    return phase->transform(mm);
   }
-  return mem;
+  return phase->C->top();
 }
 
 bool ArrayCopyNode::finish_transform(PhaseGVN *phase, bool can_reshape,
@@ -449,7 +462,7 @@
       BarrierSetC2* bs = BarrierSet::barrier_set()->barrier_set_c2();
       if (out_mem->outcnt() != 1 || !out_mem->raw_out(0)->is_MergeMem() ||
           out_mem->raw_out(0)->outcnt() != 1 || !out_mem->raw_out(0)->raw_out(0)->is_MemBar()) {
-        assert(bs->array_copy_requires_gc_barriers(T_OBJECT), "can only happen with card marking");
+        assert(bs->array_copy_requires_gc_barriers(true, T_OBJECT, true, BarrierSetC2::Optimization), "can only happen with card marking");
         return false;
       }
 
@@ -486,6 +499,7 @@
     if (in(TypeFunc::Control) != ctl) {
       // we can't return new memory and control from Ideal at parse time
       assert(!is_clonebasic(), "added control for clone?");
+      phase->record_for_igvn(this);
       return false;
     }
   }
@@ -559,15 +573,10 @@
   Node* dest = in(ArrayCopyNode::Dest);
   const TypePtr* atp_src = get_address_type(phase, src);
   const TypePtr* atp_dest = get_address_type(phase, dest);
-  uint alias_idx_src = phase->C->get_alias_index(atp_src);
-  uint alias_idx_dest = phase->C->get_alias_index(atp_dest);
 
   Node *in_mem = in(TypeFunc::Memory);
-  Node *start_mem_src = in_mem;
-  Node *start_mem_dest = in_mem;
-  if (in_mem->is_MergeMem()) {
-    start_mem_src = in_mem->as_MergeMem()->memory_at(alias_idx_src);
-    start_mem_dest = in_mem->as_MergeMem()->memory_at(alias_idx_dest);
+  if (!in_mem->is_MergeMem()) {
+    in_mem = MergeMemNode::make(in_mem);
   }
 
 
@@ -581,13 +590,13 @@
   array_copy_test_overlap(phase, can_reshape, disjoint_bases, count, forward_ctl, backward_ctl);
 
   Node* forward_mem = array_copy_forward(phase, can_reshape, forward_ctl,
-                                         start_mem_src, start_mem_dest,
+                                         in_mem->as_MergeMem(),
                                          atp_src, atp_dest,
                                          adr_src, base_src, adr_dest, base_dest,
                                          copy_type, value_type, count);
 
   Node* backward_mem = array_copy_backward(phase, can_reshape, backward_ctl,
-                                           start_mem_src, start_mem_dest,
+                                           in_mem->as_MergeMem(),
                                            atp_src, atp_dest,
                                            adr_src, base_src, adr_dest, base_dest,
                                            copy_type, value_type, count);
@@ -595,13 +604,21 @@
   Node* ctl = NULL;
   if (!forward_ctl->is_top() && !backward_ctl->is_top()) {
     ctl = new RegionNode(3);
-    mem = new PhiNode(ctl, Type::MEMORY, atp_dest);
     ctl->init_req(1, forward_ctl);
-    mem->init_req(1, forward_mem);
     ctl->init_req(2, backward_ctl);
-    mem->init_req(2, backward_mem);
     ctl = phase->transform(ctl);
-    mem = phase->transform(mem);
+    MergeMemNode* forward_mm = forward_mem->as_MergeMem();
+    MergeMemNode* backward_mm = backward_mem->as_MergeMem();
+    for (MergeMemStream mms(forward_mm, backward_mm); mms.next_non_empty2(); ) {
+      if (mms.memory() != mms.memory2()) {
+        Node* phi = new PhiNode(ctl, Type::MEMORY, phase->C->get_adr_type(mms.alias_idx()));
+        phi->init_req(1, mms.memory());
+        phi->init_req(2, mms.memory2());
+        phi = phase->transform(phi);
+        mms.set_memory(phi);
+      }
+    }
+    mem = forward_mem;
   } else if (!forward_ctl->is_top()) {
     ctl = forward_ctl;
     mem = forward_mem;
@@ -616,10 +633,6 @@
     phase->is_IterGVN()->set_delay_transform(false);
   }
 
-  MergeMemNode* out_mem = MergeMemNode::make(in_mem);
-  out_mem->set_memory_at(alias_idx_dest, mem);
-  mem = out_mem;
-
   if (!finish_transform(phase, can_reshape, ctl, mem)) {
     return NULL;
   }
--- a/src/hotspot/share/opto/arraycopynode.hpp	Wed Oct 03 15:54:35 2018 +0200
+++ b/src/hotspot/share/opto/arraycopynode.hpp	Wed Oct 03 16:02:24 2018 +0200
@@ -96,13 +96,13 @@
   void array_copy_test_overlap(PhaseGVN *phase, bool can_reshape,
                                bool disjoint_bases, int count,
                                Node*& forward_ctl, Node*& backward_ctl);
-  Node* array_copy_forward(PhaseGVN *phase, bool can_reshape, Node* ctl,
-                           Node* start_mem_src, Node* start_mem_dest,
+  Node* array_copy_forward(PhaseGVN *phase, bool can_reshape, Node*& ctl,
+                           MergeMemNode* mm,
                            const TypePtr* atp_src, const TypePtr* atp_dest,
                            Node* adr_src, Node* base_src, Node* adr_dest, Node* base_dest,
                            BasicType copy_type, const Type* value_type, int count);
-  Node* array_copy_backward(PhaseGVN *phase, bool can_reshape, Node* ctl,
-                            Node *start_mem_src, Node* start_mem_dest,
+  Node* array_copy_backward(PhaseGVN *phase, bool can_reshape, Node*& ctl,
+                            MergeMemNode* mm,
                             const TypePtr* atp_src, const TypePtr* atp_dest,
                             Node* adr_src, Node* base_src, Node* adr_dest, Node* base_dest,
                             BasicType copy_type, const Type* value_type, int count);
--- a/src/hotspot/share/opto/graphKit.cpp	Wed Oct 03 15:54:35 2018 +0200
+++ b/src/hotspot/share/opto/graphKit.cpp	Wed Oct 03 16:02:24 2018 +0200
@@ -605,7 +605,7 @@
 
       Node *adr = basic_plus_adr(ex_node, ex_node, offset);
       const TypeOopPtr* val_type = TypeOopPtr::make_from_klass(env()->String_klass());
-      Node *store = access_store_at(control(), ex_node, adr, adr_typ, null(), val_type, T_OBJECT, IN_HEAP);
+      Node *store = access_store_at(ex_node, adr, adr_typ, null(), val_type, T_OBJECT, IN_HEAP);
 
       add_exception_state(make_exception_state(ex_node));
       return;
@@ -1544,8 +1544,7 @@
   return st;
 }
 
-Node* GraphKit::access_store_at(Node* ctl,
-                                Node* obj,
+Node* GraphKit::access_store_at(Node* obj,
                                 Node* adr,
                                 const TypePtr* adr_type,
                                 Node* val,
@@ -1559,7 +1558,6 @@
     val = _gvn.makecon(TypePtr::NULL_PTR);
   }
 
-  set_control(ctl);
   if (stopped()) {
     return top(); // Dead path ?
   }
@@ -1612,8 +1610,7 @@
   }
 }
 
-Node* GraphKit::access_atomic_cmpxchg_val_at(Node* ctl,
-                                             Node* obj,
+Node* GraphKit::access_atomic_cmpxchg_val_at(Node* obj,
                                              Node* adr,
                                              const TypePtr* adr_type,
                                              int alias_idx,
@@ -1622,7 +1619,6 @@
                                              const Type* value_type,
                                              BasicType bt,
                                              DecoratorSet decorators) {
-  set_control(ctl);
   C2AccessValuePtr addr(adr, adr_type);
   C2AtomicAccess access(this, decorators | C2_READ_ACCESS | C2_WRITE_ACCESS,
                         bt, obj, addr, alias_idx);
@@ -1633,8 +1629,7 @@
   }
 }
 
-Node* GraphKit::access_atomic_cmpxchg_bool_at(Node* ctl,
-                                              Node* obj,
+Node* GraphKit::access_atomic_cmpxchg_bool_at(Node* obj,
                                               Node* adr,
                                               const TypePtr* adr_type,
                                               int alias_idx,
@@ -1643,7 +1638,6 @@
                                               const Type* value_type,
                                               BasicType bt,
                                               DecoratorSet decorators) {
-  set_control(ctl);
   C2AccessValuePtr addr(adr, adr_type);
   C2AtomicAccess access(this, decorators | C2_READ_ACCESS | C2_WRITE_ACCESS,
                         bt, obj, addr, alias_idx);
@@ -1654,8 +1648,7 @@
   }
 }
 
-Node* GraphKit::access_atomic_xchg_at(Node* ctl,
-                                      Node* obj,
+Node* GraphKit::access_atomic_xchg_at(Node* obj,
                                       Node* adr,
                                       const TypePtr* adr_type,
                                       int alias_idx,
@@ -1663,7 +1656,6 @@
                                       const Type* value_type,
                                       BasicType bt,
                                       DecoratorSet decorators) {
-  set_control(ctl);
   C2AccessValuePtr addr(adr, adr_type);
   C2AtomicAccess access(this, decorators | C2_READ_ACCESS | C2_WRITE_ACCESS,
                         bt, obj, addr, alias_idx);
@@ -1674,8 +1666,7 @@
   }
 }
 
-Node* GraphKit::access_atomic_add_at(Node* ctl,
-                                     Node* obj,
+Node* GraphKit::access_atomic_add_at(Node* obj,
                                      Node* adr,
                                      const TypePtr* adr_type,
                                      int alias_idx,
@@ -1683,7 +1674,6 @@
                                      const Type* value_type,
                                      BasicType bt,
                                      DecoratorSet decorators) {
-  set_control(ctl);
   C2AccessValuePtr addr(adr, adr_type);
   C2AtomicAccess access(this, decorators | C2_READ_ACCESS | C2_WRITE_ACCESS, bt, obj, addr, alias_idx);
   if (access.is_raw()) {
@@ -1693,8 +1683,7 @@
   }
 }
 
-void GraphKit::access_clone(Node* ctl, Node* src, Node* dst, Node* size, bool is_array) {
-  set_control(ctl);
+void GraphKit::access_clone(Node* src, Node* dst, Node* size, bool is_array) {
   return _barrier_set->clone(this, src, dst, size, is_array);
 }
 
@@ -3849,14 +3838,14 @@
   sync_kit(ideal);
 }
 
-Node* GraphKit::load_String_length(Node* ctrl, Node* str) {
-  Node* len = load_array_length(load_String_value(ctrl, str));
-  Node* coder = load_String_coder(ctrl, str);
+Node* GraphKit::load_String_length(Node* str, bool set_ctrl) {
+  Node* len = load_array_length(load_String_value(str, set_ctrl));
+  Node* coder = load_String_coder(str, set_ctrl);
   // Divide length by 2 if coder is UTF16
   return _gvn.transform(new RShiftINode(len, coder));
 }
 
-Node* GraphKit::load_String_value(Node* ctrl, Node* str) {
+Node* GraphKit::load_String_value(Node* str, bool set_ctrl) {
   int value_offset = java_lang_String::value_offset_in_bytes();
   const TypeInstPtr* string_type = TypeInstPtr::make(TypePtr::NotNull, C->env()->String_klass(),
                                                      false, NULL, 0);
@@ -3866,7 +3855,7 @@
                                                   ciTypeArrayKlass::make(T_BYTE), true, 0);
   Node* p = basic_plus_adr(str, str, value_offset);
   Node* load = access_load_at(str, p, value_field_type, value_type, T_OBJECT,
-                              IN_HEAP | C2_CONTROL_DEPENDENT_LOAD);
+                              IN_HEAP | (set_ctrl ? C2_CONTROL_DEPENDENT_LOAD : 0) | MO_UNORDERED);
   // String.value field is known to be @Stable.
   if (UseImplicitStableValues) {
     load = cast_array_to_stable(load, value_type);
@@ -3874,7 +3863,7 @@
   return load;
 }
 
-Node* GraphKit::load_String_coder(Node* ctrl, Node* str) {
+Node* GraphKit::load_String_coder(Node* str, bool set_ctrl) {
   if (!CompactStrings) {
     return intcon(java_lang_String::CODER_UTF16);
   }
@@ -3883,27 +3872,31 @@
                                                      false, NULL, 0);
   const TypePtr* coder_field_type = string_type->add_offset(coder_offset);
   int coder_field_idx = C->get_alias_index(coder_field_type);
-  return make_load(ctrl, basic_plus_adr(str, str, coder_offset),
-                   TypeInt::BYTE, T_BYTE, coder_field_idx, MemNode::unordered);
+
+  Node* p = basic_plus_adr(str, str, coder_offset);
+  Node* load = access_load_at(str, p, coder_field_type, TypeInt::BYTE, T_BYTE,
+                              IN_HEAP | (set_ctrl ? C2_CONTROL_DEPENDENT_LOAD : 0) | MO_UNORDERED);
+  return load;
 }
 
-void GraphKit::store_String_value(Node* ctrl, Node* str, Node* value) {
+void GraphKit::store_String_value(Node* str, Node* value) {
   int value_offset = java_lang_String::value_offset_in_bytes();
   const TypeInstPtr* string_type = TypeInstPtr::make(TypePtr::NotNull, C->env()->String_klass(),
                                                      false, NULL, 0);
   const TypePtr* value_field_type = string_type->add_offset(value_offset);
-  access_store_at(ctrl, str,  basic_plus_adr(str, value_offset), value_field_type,
-                  value, TypeAryPtr::BYTES, T_OBJECT, IN_HEAP);
+
+  access_store_at(str,  basic_plus_adr(str, value_offset), value_field_type,
+                  value, TypeAryPtr::BYTES, T_OBJECT, IN_HEAP | MO_UNORDERED);
 }
 
-void GraphKit::store_String_coder(Node* ctrl, Node* str, Node* value) {
+void GraphKit::store_String_coder(Node* str, Node* value) {
   int coder_offset = java_lang_String::coder_offset_in_bytes();
   const TypeInstPtr* string_type = TypeInstPtr::make(TypePtr::NotNull, C->env()->String_klass(),
                                                      false, NULL, 0);
   const TypePtr* coder_field_type = string_type->add_offset(coder_offset);
-  int coder_field_idx = C->get_alias_index(coder_field_type);
-  store_to_memory(ctrl, basic_plus_adr(str, coder_offset),
-                  value, T_BYTE, coder_field_idx, MemNode::unordered);
+
+  access_store_at(str, basic_plus_adr(str, coder_offset), coder_field_type,
+                  value, TypeInt::BYTE, T_BYTE, IN_HEAP | MO_UNORDERED);
 }
 
 // Capture src and dst memory state with a MergeMemNode
--- a/src/hotspot/share/opto/graphKit.hpp	Wed Oct 03 15:54:35 2018 +0200
+++ b/src/hotspot/share/opto/graphKit.hpp	Wed Oct 03 16:02:24 2018 +0200
@@ -572,8 +572,7 @@
 
   // Perform decorated accesses
 
-  Node* access_store_at(Node* ctl,
-                        Node* obj,   // containing obj
+  Node* access_store_at(Node* obj,   // containing obj
                         Node* adr,   // actual adress to store val at
                         const TypePtr* adr_type,
                         Node* val,
@@ -593,8 +592,7 @@
                     BasicType bt,
                     DecoratorSet decorators);
 
-  Node* access_atomic_cmpxchg_val_at(Node* ctl,
-                                     Node* obj,
+  Node* access_atomic_cmpxchg_val_at(Node* obj,
                                      Node* adr,
                                      const TypePtr* adr_type,
                                      int alias_idx,
@@ -604,8 +602,7 @@
                                      BasicType bt,
                                      DecoratorSet decorators);
 
-  Node* access_atomic_cmpxchg_bool_at(Node* ctl,
-                                      Node* obj,
+  Node* access_atomic_cmpxchg_bool_at(Node* obj,
                                       Node* adr,
                                       const TypePtr* adr_type,
                                       int alias_idx,
@@ -615,8 +612,7 @@
                                       BasicType bt,
                                       DecoratorSet decorators);
 
-  Node* access_atomic_xchg_at(Node* ctl,
-                              Node* obj,
+  Node* access_atomic_xchg_at(Node* obj,
                               Node* adr,
                               const TypePtr* adr_type,
                               int alias_idx,
@@ -625,8 +621,7 @@
                               BasicType bt,
                               DecoratorSet decorators);
 
-  Node* access_atomic_add_at(Node* ctl,
-                             Node* obj,
+  Node* access_atomic_add_at(Node* obj,
                              Node* adr,
                              const TypePtr* adr_type,
                              int alias_idx,
@@ -635,7 +630,7 @@
                              BasicType bt,
                              DecoratorSet decorators);
 
-  void access_clone(Node* ctl, Node* src, Node* dst, Node* size, bool is_array);
+  void access_clone(Node* src, Node* dst, Node* size, bool is_array);
 
   Node* access_resolve(Node* n, DecoratorSet decorators);
 
@@ -849,11 +844,11 @@
                   bool deoptimize_on_exception = false);
 
   // java.lang.String helpers
-  Node* load_String_length(Node* ctrl, Node* str);
-  Node* load_String_value(Node* ctrl, Node* str);
-  Node* load_String_coder(Node* ctrl, Node* str);
-  void store_String_value(Node* ctrl, Node* str, Node* value);
-  void store_String_coder(Node* ctrl, Node* str, Node* value);
+  Node* load_String_length(Node* str, bool set_ctrl);
+  Node* load_String_value(Node* str, bool set_ctrl);
+  Node* load_String_coder(Node* str, bool set_ctrl);
+  void store_String_value(Node* str, Node* value);
+  void store_String_coder(Node* str, Node* value);
   Node* capture_memory(const TypePtr* src_type, const TypePtr* dst_type);
   Node* compress_string(Node* src, const TypeAryPtr* src_type, Node* dst, Node* count);
   void inflate_string(Node* src, Node* dst, const TypeAryPtr* dst_type, Node* count);
--- a/src/hotspot/share/opto/library_call.cpp	Wed Oct 03 15:54:35 2018 +0200
+++ b/src/hotspot/share/opto/library_call.cpp	Wed Oct 03 16:02:24 2018 +0200
@@ -1758,11 +1758,9 @@
     return false;
   }
   if (is_store) {
-    (void) store_to_memory(control(), adr, ch, T_CHAR, TypeAryPtr::BYTES, MemNode::unordered,
-                           false, false, true /* mismatched */);
+    access_store_at(value, adr, TypeAryPtr::BYTES, ch, TypeInt::CHAR, T_CHAR, IN_HEAP | MO_UNORDERED | C2_MISMATCHED);
   } else {
-    ch = make_load(control(), adr, TypeInt::CHAR, T_CHAR, TypeAryPtr::BYTES, MemNode::unordered,
-                   LoadNode::DependsOnlyOnTest, false, false, true /* mismatched */);
+    ch = access_load_at(value, adr, TypeAryPtr::BYTES, TypeInt::CHAR, T_CHAR, IN_HEAP | MO_UNORDERED | C2_MISMATCHED | C2_CONTROL_DEPENDENT_LOAD);
     set_result(ch);
   }
   return true;
@@ -2512,7 +2510,7 @@
       val = ConvL2X(val);
       val = gvn().transform(new CastX2PNode(val));
     }
-    access_store_at(control(), heap_base_oop, adr, adr_type, val, value_type, type, decorators);
+    access_store_at(heap_base_oop, adr, adr_type, val, value_type, type, decorators);
   }
 
   return true;
@@ -2731,24 +2729,24 @@
   Node* result = NULL;
   switch (kind) {
     case LS_cmp_exchange: {
-      result = access_atomic_cmpxchg_val_at(control(), base, adr, adr_type, alias_idx,
+      result = access_atomic_cmpxchg_val_at(base, adr, adr_type, alias_idx,
                                             oldval, newval, value_type, type, decorators);
       break;
     }
     case LS_cmp_swap_weak:
       decorators |= C2_WEAK_CMPXCHG;
     case LS_cmp_swap: {
-      result = access_atomic_cmpxchg_bool_at(control(), base, adr, adr_type, alias_idx,
+      result = access_atomic_cmpxchg_bool_at(base, adr, adr_type, alias_idx,
                                              oldval, newval, value_type, type, decorators);
       break;
     }
     case LS_get_set: {
-      result = access_atomic_xchg_at(control(), base, adr, adr_type, alias_idx,
+      result = access_atomic_xchg_at(base, adr, adr_type, alias_idx,
                                      newval, value_type, type, decorators);
       break;
     }
     case LS_get_add: {
-      result = access_atomic_add_at(control(), base, adr, adr_type, alias_idx,
+      result = access_atomic_add_at(base, adr, adr_type, alias_idx,
                                     newval, value_type, type, decorators);
       break;
     }
@@ -4232,7 +4230,7 @@
   // TODO: generate fields copies for small objects instead.
   Node* size = _gvn.transform(obj_size);
 
-  access_clone(control(), obj, alloc_obj, size, is_array);
+  access_clone(obj, alloc_obj, size, is_array);
 
   // Do not let reads from the cloned object float above the arraycopy.
   if (alloc != NULL) {
@@ -4332,7 +4330,7 @@
       Node* alloc_obj = new_array(obj_klass, obj_length, 0, &obj_size);  // no arguments to push
 
       BarrierSetC2* bs = BarrierSet::barrier_set()->barrier_set_c2();
-      if (bs->array_copy_requires_gc_barriers(T_OBJECT)) {
+      if (bs->array_copy_requires_gc_barriers(true, T_OBJECT, true, BarrierSetC2::Parsing)) {
         // If it is an oop array, it requires very special treatment,
         // because gc barriers are required when accessing the array.
         Node* is_obja = generate_objArray_guard(obj_klass, (RegionNode*)NULL);
--- a/src/hotspot/share/opto/macroArrayCopy.cpp	Wed Oct 03 15:54:35 2018 +0200
+++ b/src/hotspot/share/opto/macroArrayCopy.cpp	Wed Oct 03 16:02:24 2018 +0200
@@ -552,7 +552,7 @@
     // At this point we know we do not need type checks on oop stores.
 
     BarrierSetC2* bs = BarrierSet::barrier_set()->barrier_set_c2();
-    if (alloc != NULL && !bs->array_copy_requires_gc_barriers(copy_type)) {
+    if (!bs->array_copy_requires_gc_barriers(alloc != NULL, copy_type, false, BarrierSetC2::Expansion)) {
       // If we do not need gc barriers, copy using the jint or jlong stub.
       copy_type = LP64_ONLY(UseCompressedOops ? T_INT : T_LONG) NOT_LP64(T_INT);
       assert(type2aelembytes(basic_elem_type) == type2aelembytes(copy_type),
@@ -1127,9 +1127,6 @@
     if (ac->_dest_type != TypeOopPtr::BOTTOM) {
       adr_type = ac->_dest_type->add_offset(Type::OffsetBot)->is_ptr();
     }
-    if (ac->_src_type != ac->_dest_type) {
-      adr_type = TypeRawPtr::BOTTOM;
-    }
     generate_arraycopy(ac, alloc, &ctrl, merge_mem, &io,
                        adr_type, T_OBJECT,
                        src, src_offset, dest, dest_offset, length,
--- a/src/hotspot/share/opto/parse2.cpp	Wed Oct 03 15:54:35 2018 +0200
+++ b/src/hotspot/share/opto/parse2.cpp	Wed Oct 03 16:02:24 2018 +0200
@@ -104,7 +104,7 @@
 
   const TypeAryPtr* adr_type = TypeAryPtr::get_array_body_type(bt);
 
-  access_store_at(control(), array, adr, adr_type, val, elemtype, bt, MO_UNORDERED | IN_HEAP | IS_ARRAY);
+  access_store_at(array, adr, adr_type, val, elemtype, bt, MO_UNORDERED | IN_HEAP | IS_ARRAY);
 }
 
 
--- a/src/hotspot/share/opto/parse3.cpp	Wed Oct 03 15:54:35 2018 +0200
+++ b/src/hotspot/share/opto/parse3.cpp	Wed Oct 03 16:02:24 2018 +0200
@@ -264,7 +264,7 @@
       field_type = Type::BOTTOM;
     }
   }
-  access_store_at(control(), obj, adr, adr_type, val, field_type, bt, decorators);
+  access_store_at(obj, adr, adr_type, val, field_type, bt, decorators);
 
   if (is_field) {
     // Remember we wrote a volatile field.
@@ -351,7 +351,7 @@
       Node*    elem   = expand_multianewarray(array_klass_1, &lengths[1], ndimensions-1, nargs);
       intptr_t offset = header + ((intptr_t)i << LogBytesPerHeapOop);
       Node*    eaddr  = basic_plus_adr(array, offset);
-      access_store_at(control(), array, eaddr, adr_type, elem, elemtype, T_OBJECT, IN_HEAP | IS_ARRAY);
+      access_store_at(array, eaddr, adr_type, elem, elemtype, T_OBJECT, IN_HEAP | IS_ARRAY);
     }
   }
   return array;
--- a/src/hotspot/share/opto/parseHelper.cpp	Wed Oct 03 15:54:35 2018 +0200
+++ b/src/hotspot/share/opto/parseHelper.cpp	Wed Oct 03 16:02:24 2018 +0200
@@ -437,9 +437,9 @@
   Node* adr_node = method_data_addressing(md, data, DataLayout::flags_offset());
 
   const TypePtr* adr_type = _gvn.type(adr_node)->is_ptr();
-  Node* flags = make_load(NULL, adr_node, TypeInt::BYTE, T_BYTE, adr_type, MemNode::unordered);
+  Node* flags = make_load(NULL, adr_node, TypeInt::INT, T_INT, adr_type, MemNode::unordered);
   Node* incr = _gvn.transform(new OrINode(flags, _gvn.intcon(flag_constant)));
-  store_to_memory(NULL, adr_node, incr, T_BYTE, adr_type, MemNode::unordered);
+  store_to_memory(NULL, adr_node, incr, T_INT, adr_type, MemNode::unordered);
 }
 
 //----------------------------profile_taken_branch-----------------------------
--- a/src/hotspot/share/opto/stringopts.cpp	Wed Oct 03 15:54:35 2018 +0200
+++ b/src/hotspot/share/opto/stringopts.cpp	Wed Oct 03 16:02:24 2018 +0200
@@ -1547,7 +1547,7 @@
 
 // Compress copy contents of the byte/char String str into dst_array starting at index start.
 Node* PhaseStringOpts::copy_string(GraphKit& kit, Node* str, Node* dst_array, Node* dst_coder, Node* start) {
-  Node* src_array = kit.load_String_value(kit.control(), str);
+  Node* src_array = kit.load_String_value(str, true);
   src_array = kit.access_resolve(src_array, ACCESS_READ);
 
   IdealKit ideal(&kit, true, true);
@@ -1580,7 +1580,7 @@
     // Non-constant source string
     if (CompactStrings) {
       // Emit runtime check for coder
-      Node* coder = kit.load_String_coder(__ ctrl(), str);
+      Node* coder = kit.load_String_coder(str, true);
       __ if_then(coder, BoolTest::eq, __ ConI(java_lang_String::CODER_LATIN1)); {
         // Source is Latin1
         copy_latin1_string(kit, ideal, src_array, count, dst_array, dst_coder, start);
@@ -1796,8 +1796,8 @@
           // replace the argument with the null checked version
           arg = null_string;
           sc->set_argument(argi, arg);
-          count = kit.load_String_length(kit.control(), arg);
-          arg_coder = kit.load_String_coder(kit.control(), arg);
+          count = kit.load_String_length(arg, true);
+          arg_coder = kit.load_String_coder(arg, true);
         } else if (!type->higher_equal(TypeInstPtr::NOTNULL)) {
           // s = s != null ? s : "null";
           // length = length + (s.count - s.offset);
@@ -1820,14 +1820,14 @@
           // replace the argument with the null checked version
           arg = phi;
           sc->set_argument(argi, arg);
-          count = kit.load_String_length(kit.control(), arg);
-          arg_coder = kit.load_String_coder(kit.control(), arg);
+          count = kit.load_String_length(arg, true);
+          arg_coder = kit.load_String_coder(arg, true);
         } else {
           // A corresponding nullcheck will be connected during IGVN MemNode::Ideal_common_DU_postCCP
           // kit.control might be a different test, that can be hoisted above the actual nullcheck
           // in case, that the control input is not null, Ideal_common_DU_postCCP will not look for a nullcheck.
-          count = kit.load_String_length(NULL, arg);
-          arg_coder = kit.load_String_coder(NULL, arg);
+          count = kit.load_String_length(arg, false);
+          arg_coder = kit.load_String_coder(arg, false);
         }
         if (arg->is_Con()) {
           // Constant string. Get constant coder and length.
@@ -1918,7 +1918,7 @@
          sc->mode(0) == StringConcat::StringNullCheckMode)) {
       // Handle the case when there is only a single String argument.
       // In this case, we can just pull the value from the String itself.
-      dst_array = kit.load_String_value(kit.control(), sc->argument(0));
+      dst_array = kit.load_String_value(sc->argument(0), true);
     } else {
       // Allocate destination byte array according to coder
       dst_array = allocate_byte_array(kit, NULL, __ LShiftI(length, coder));
@@ -1959,8 +1959,8 @@
     }
 
     // Initialize the string
-    kit.store_String_value(kit.control(), result, dst_array);
-    kit.store_String_coder(kit.control(), result, coder);
+    kit.store_String_value(result, dst_array);
+    kit.store_String_coder(result, coder);
 
     // The value field is final. Emit a barrier here to ensure that the effect
     // of the initialization is committed to memory before any code publishes
--- a/src/hotspot/share/opto/subnode.cpp	Wed Oct 03 15:54:35 2018 +0200
+++ b/src/hotspot/share/opto/subnode.cpp	Wed Oct 03 16:02:24 2018 +0200
@@ -1522,6 +1522,37 @@
     return new BoolNode( ncmp, _test._test );
   }
 
+  // Change "bool eq/ne (cmp (phi (X -X) 0))" into "bool eq/ne (cmp X 0)"
+  // since zero check of conditional negation of an integer is equal to
+  // zero check of the integer directly.
+  if ((_test._test == BoolTest::eq || _test._test == BoolTest::ne) &&
+      (cop == Op_CmpI) &&
+      (cmp2_type == TypeInt::ZERO) &&
+      (cmp1_op == Op_Phi)) {
+    // There should be a diamond phi with true path at index 1 or 2
+    PhiNode *phi = cmp1->as_Phi();
+    int idx_true = phi->is_diamond_phi();
+    if (idx_true != 0) {
+      // True input is in(idx_true) while false input is in(3 - idx_true)
+      Node *tin = phi->in(idx_true);
+      Node *fin = phi->in(3 - idx_true);
+      if ((tin->Opcode() == Op_SubI) &&
+          (phase->type(tin->in(1)) == TypeInt::ZERO) &&
+          (tin->in(2) == fin)) {
+        // Found conditional negation at true path, create a new CmpINode without that
+        Node *ncmp = phase->transform(new CmpINode(fin, cmp2));
+        return new BoolNode(ncmp, _test._test);
+      }
+      if ((fin->Opcode() == Op_SubI) &&
+          (phase->type(fin->in(1)) == TypeInt::ZERO) &&
+          (fin->in(2) == tin)) {
+        // Found conditional negation at false path, create a new CmpINode without that
+        Node *ncmp = phase->transform(new CmpINode(tin, cmp2));
+        return new BoolNode(ncmp, _test._test);
+      }
+    }
+  }
+
   // Change (-A vs 0) into (A vs 0) by commuting the test.  Disallow in the
   // most general case because negating 0x80000000 does nothing.  Needed for
   // the CmpF3/SubI/CmpI idiom.
--- a/src/hotspot/share/prims/jni.cpp	Wed Oct 03 15:54:35 2018 +0200
+++ b/src/hotspot/share/prims/jni.cpp	Wed Oct 03 16:02:24 2018 +0200
@@ -3779,13 +3779,7 @@
 void quicken_jni_functions() {
   // Replace Get<Primitive>Field with fast versions
   if (UseFastJNIAccessors && !JvmtiExport::can_post_field_access()
-      && !VerifyJNIFields && !CountJNICalls && !CheckJNICalls
-#if defined(_WINDOWS) && defined(IA32) && defined(COMPILER2)
-      // windows x86 currently needs SEH wrapper and the gain of the fast
-      // versions currently isn't certain for server vm on uniprocessor.
-      && os::is_MP()
-#endif
-  ) {
+      && !VerifyJNIFields && !CountJNICalls && !CheckJNICalls) {
     address func;
     func = JNI_FastGetField::generate_fast_get_boolean_field();
     if (func != (address)-1) {
@@ -3918,9 +3912,7 @@
 
   // We use Atomic::xchg rather than Atomic::add/dec since on some platforms
   // the add/dec implementations are dependent on whether we are running
-  // on a multiprocessor, and at this stage of initialization the os::is_MP
-  // function used to determine this will always return false. Atomic::xchg
-  // does not have this problem.
+  // on a multiprocessor Atomic::xchg does not have this problem.
   if (Atomic::xchg(1, &vm_created) == 1) {
     return JNI_EEXIST;   // already created, or create attempt in progress
   }
--- a/src/hotspot/share/prims/jvmtiEnvBase.cpp	Wed Oct 03 15:54:35 2018 +0200
+++ b/src/hotspot/share/prims/jvmtiEnvBase.cpp	Wed Oct 03 16:02:24 2018 +0200
@@ -23,6 +23,7 @@
  */
 
 #include "precompiled.hpp"
+#include "classfile/classLoaderDataGraph.hpp"
 #include "classfile/systemDictionary.hpp"
 #include "jvmtifiles/jvmtiEnv.hpp"
 #include "memory/resourceArea.hpp"
--- a/src/hotspot/share/prims/jvmtiGetLoadedClasses.cpp	Wed Oct 03 15:54:35 2018 +0200
+++ b/src/hotspot/share/prims/jvmtiGetLoadedClasses.cpp	Wed Oct 03 16:02:24 2018 +0200
@@ -23,8 +23,8 @@
  */
 
 #include "precompiled.hpp"
+#include "classfile/classLoaderDataGraph.hpp"
 #include "classfile/dictionary.hpp"
-#include "classfile/classLoaderData.inline.hpp"
 #include "classfile/systemDictionary.hpp"
 #include "gc/shared/collectedHeap.hpp"
 #include "memory/universe.hpp"
--- a/src/hotspot/share/prims/jvmtiRedefineClasses.cpp	Wed Oct 03 15:54:35 2018 +0200
+++ b/src/hotspot/share/prims/jvmtiRedefineClasses.cpp	Wed Oct 03 16:02:24 2018 +0200
@@ -24,6 +24,7 @@
 
 #include "precompiled.hpp"
 #include "aot/aotLoader.hpp"
+#include "classfile/classLoaderDataGraph.hpp"
 #include "classfile/classFileStream.hpp"
 #include "classfile/metadataOnStackMark.hpp"
 #include "classfile/systemDictionary.hpp"
--- a/src/hotspot/share/prims/jvmtiTagMap.cpp	Wed Oct 03 15:54:35 2018 +0200
+++ b/src/hotspot/share/prims/jvmtiTagMap.cpp	Wed Oct 03 16:02:24 2018 +0200
@@ -23,6 +23,7 @@
  */
 
 #include "precompiled.hpp"
+#include "classfile/classLoaderDataGraph.hpp"
 #include "classfile/javaClasses.inline.hpp"
 #include "classfile/symbolTable.hpp"
 #include "classfile/systemDictionary.hpp"
@@ -852,7 +853,7 @@
     if (!fld.access_flags().is_static()) {
       continue;
     }
-    field_map->add(max_field_index - index, fld.signature()->byte_at(0), fld.offset());
+    field_map->add(max_field_index - index, fld.signature()->char_at(0), fld.offset());
   }
   return field_map;
 }
@@ -878,7 +879,7 @@
     if (fld.access_flags().is_static()) {
       continue;
     }
-    field_map->add(max_field_index - index, fld.signature()->byte_at(0), fld.offset());
+    field_map->add(max_field_index - index, fld.signature()->char_at(0), fld.offset());
   }
 
   return field_map;
--- a/src/hotspot/share/prims/methodHandles.cpp	Wed Oct 03 15:54:35 2018 +0200
+++ b/src/hotspot/share/prims/methodHandles.cpp	Wed Oct 03 16:02:24 2018 +0200
@@ -537,7 +537,7 @@
   assert(vmSymbols::object_signature()->equals(OBJ_SIG), "");
   const int len = sig->utf8_length();
   for (int i = 0; i < len; i++) {
-    switch (sig->byte_at(i)) {
+    switch (sig->char_at(i)) {
     case 'L':
       // only java/lang/Object is valid here
       if (sig->index_of_at(i, OBJ_SIG, OBJ_SIG_LEN) != i)
@@ -563,8 +563,8 @@
   } else if (is_basic_type_signature(sig)) {
     sig->increment_refcount();
     return sig;  // that was easy
-  } else if (sig->byte_at(0) != '(') {
-    BasicType bt = char2type(sig->byte_at(0));
+  } else if (sig->char_at(0) != '(') {
+    BasicType bt = char2type(sig->char_at(0));
     if (is_subword_type(bt)) {
       bsig = vmSymbols::int_signature();
     } else {
@@ -615,7 +615,7 @@
   int array = 0;
   bool prev_type = false;
   for (int i = 0; i < len; i++) {
-    char ch = sig->byte_at(i);
+    char ch = sig->char_at(i);
     switch (ch) {
     case '(': case ')':
       prev_type = false;
@@ -630,7 +630,7 @@
       {
         if (prev_type)  st->put(',');
         int start = i+1, slash = start;
-        while (++i < len && (ch = sig->byte_at(i)) != ';') {
+        while (++i < len && (ch = sig->char_at(i)) != ';') {
           if (ch == '/' || ch == '.' || ch == '$')  slash = i+1;
         }
         if (slash < i)  start = slash;
@@ -638,7 +638,7 @@
           st->put('L');
         } else {
           for (int j = start; j < i; j++)
-            st->put(sig->byte_at(j));
+            st->put(sig->char_at(j));
           prev_type = true;
         }
         break;
@@ -975,7 +975,7 @@
   }
   if (sig != NULL) {
     if (sig->utf8_length() == 0)  return 0; // a match is not possible
-    if (sig->byte_at(0) == '(')
+    if (sig->char_at(0) == '(')
       match_flags &= ~(IS_FIELD | IS_TYPE);
     else
       match_flags &= ~(IS_CONSTRUCTOR | IS_METHOD);
@@ -1456,7 +1456,7 @@
           {
             Symbol* type = caller->constants()->signature_ref_at(bss_index_in_pool);
             Handle th;
-            if (type->byte_at(0) == '(') {
+            if (type->char_at(0) == '(') {
               th = SystemDictionary::find_method_handle_type(type, caller, CHECK);
             } else {
               th = SystemDictionary::find_java_mirror_for_type(type, caller, SignatureStream::NCDFError, CHECK);
--- a/src/hotspot/share/prims/nativeLookup.cpp	Wed Oct 03 15:54:35 2018 +0200
+++ b/src/hotspot/share/prims/nativeLookup.cpp	Wed Oct 03 16:02:24 2018 +0200
@@ -103,7 +103,7 @@
   st.print("__");
   // find ')'
   int end;
-  for (end = 0; end < signature->utf8_length() && signature->byte_at(end) != ')'; end++);
+  for (end = 0; end < signature->utf8_length() && signature->char_at(end) != ')'; end++);
   // skip first '('
   mangle_name_on(&st, signature, 1, end);
   return st.as_string();
@@ -288,7 +288,7 @@
 
   Symbol* signature = method->signature();
   for (int end = 0; end < signature->utf8_length(); end++) {
-    if (signature->byte_at(end) == 'L') {
+    if (signature->char_at(end) == 'L') {
       // Don't allow object types
       return NULL;
     }
--- a/src/hotspot/share/prims/whitebox.cpp	Wed Oct 03 15:54:35 2018 +0200
+++ b/src/hotspot/share/prims/whitebox.cpp	Wed Oct 03 16:02:24 2018 +0200
@@ -26,7 +26,7 @@
 
 #include <new>
 
-#include "classfile/classLoaderData.hpp"
+#include "classfile/classLoaderDataGraph.hpp"
 #include "classfile/modules.hpp"
 #include "classfile/protectionDomainCache.hpp"
 #include "classfile/stringTable.hpp"
--- a/src/hotspot/share/runtime/arguments.cpp	Wed Oct 03 15:54:35 2018 +0200
+++ b/src/hotspot/share/runtime/arguments.cpp	Wed Oct 03 16:02:24 2018 +0200
@@ -526,7 +526,6 @@
   // --- Non-alias flags - sorted by obsolete_in then expired_in:
   { "MaxGCMinorPauseMillis",        JDK_Version::jdk(8), JDK_Version::undefined(), JDK_Version::undefined() },
   { "UseConcMarkSweepGC",           JDK_Version::jdk(9), JDK_Version::undefined(), JDK_Version::undefined() },
-  { "AssumeMP",                     JDK_Version::jdk(10),JDK_Version::undefined(), JDK_Version::undefined() },
   { "MonitorInUseLists",            JDK_Version::jdk(10),JDK_Version::undefined(), JDK_Version::undefined() },
   { "MaxRAMFraction",               JDK_Version::jdk(10),  JDK_Version::undefined(), JDK_Version::undefined() },
   { "MinRAMFraction",               JDK_Version::jdk(10),  JDK_Version::undefined(), JDK_Version::undefined() },
@@ -540,33 +539,16 @@
   // --- Deprecated alias flags (see also aliased_jvm_flags) - sorted by obsolete_in then expired_in:
   { "DefaultMaxRAMFraction",        JDK_Version::jdk(8),  JDK_Version::undefined(), JDK_Version::undefined() },
   { "CreateMinidumpOnCrash",        JDK_Version::jdk(9),  JDK_Version::undefined(), JDK_Version::undefined() },
-  { "MustCallLoadClassInternal",    JDK_Version::jdk(10), JDK_Version::jdk(11), JDK_Version::jdk(12) },
-  { "UnsyncloadClass",              JDK_Version::jdk(10), JDK_Version::jdk(11), JDK_Version::jdk(12) },
+  { "TLABStats",                    JDK_Version::jdk(12), JDK_Version::undefined(), JDK_Version::undefined() },
 
   // -------------- Obsolete Flags - sorted by expired_in --------------
-  { "CheckAssertionStatusDirectives",JDK_Version::undefined(), JDK_Version::jdk(11), JDK_Version::jdk(12) },
-  { "PrintMallocFree",               JDK_Version::undefined(), JDK_Version::jdk(11), JDK_Version::jdk(12) },
-  { "PrintMalloc",                   JDK_Version::undefined(), JDK_Version::jdk(11), JDK_Version::jdk(12) },
-  { "ShowSafepointMsgs",             JDK_Version::undefined(), JDK_Version::jdk(11), JDK_Version::jdk(12) },
-  { "FastTLABRefill",                JDK_Version::jdk(10),     JDK_Version::jdk(11), JDK_Version::jdk(12) },
-  { "SafepointSpinBeforeYield",      JDK_Version::jdk(10),     JDK_Version::jdk(11), JDK_Version::jdk(12) },
-  { "CheckEndorsedAndExtDirs",       JDK_Version::jdk(10),     JDK_Version::jdk(11), JDK_Version::jdk(12) },
-  { "DeferThrSuspendLoopCount",      JDK_Version::jdk(10),     JDK_Version::jdk(11), JDK_Version::jdk(12) },
-  { "DeferPollingPageLoopCount",     JDK_Version::jdk(10),     JDK_Version::jdk(11), JDK_Version::jdk(12) },
-  { "TraceScavenge",                 JDK_Version::undefined(), JDK_Version::jdk(11), JDK_Version::jdk(12) },
   { "PermSize",                      JDK_Version::undefined(), JDK_Version::jdk(8),  JDK_Version::undefined() },
   { "MaxPermSize",                   JDK_Version::undefined(), JDK_Version::jdk(8),  JDK_Version::undefined() },
   { "SharedReadWriteSize",           JDK_Version::undefined(), JDK_Version::jdk(10), JDK_Version::undefined() },
   { "SharedReadOnlySize",            JDK_Version::undefined(), JDK_Version::jdk(10), JDK_Version::undefined() },
   { "SharedMiscDataSize",            JDK_Version::undefined(), JDK_Version::jdk(10), JDK_Version::undefined() },
   { "SharedMiscCodeSize",            JDK_Version::undefined(), JDK_Version::jdk(10), JDK_Version::undefined() },
-  { "UseUTCFileTimestamp",           JDK_Version::undefined(), JDK_Version::jdk(11), JDK_Version::jdk(12) },
-  { "InlineNotify",                  JDK_Version::undefined(), JDK_Version::jdk(11), JDK_Version::jdk(12) },
-  { "EnableTracing",                 JDK_Version::undefined(), JDK_Version::jdk(11), JDK_Version::jdk(12) },
-  { "UseLockedTracing",              JDK_Version::undefined(), JDK_Version::jdk(11), JDK_Version::jdk(12) },
-  { "NativeMonitorTimeout",          JDK_Version::undefined(), JDK_Version::jdk(11), JDK_Version::jdk(12) },
-  { "NativeMonitorSpinLimit",        JDK_Version::undefined(), JDK_Version::jdk(11), JDK_Version::jdk(12) },
-  { "NativeMonitorFlags",            JDK_Version::undefined(), JDK_Version::jdk(11), JDK_Version::jdk(12) },
+  { "AssumeMP",                      JDK_Version::jdk(10),     JDK_Version::jdk(12), JDK_Version::jdk(13) },
   { "UnlinkSymbolsALot",             JDK_Version::jdk(11),     JDK_Version::jdk(12), JDK_Version::jdk(13) },
   { "AllowNonVirtualCalls",          JDK_Version::jdk(11),     JDK_Version::jdk(12), JDK_Version::jdk(13) },
   { "PrintSafepointStatistics",      JDK_Version::jdk(11),     JDK_Version::jdk(12), JDK_Version::jdk(13) },
@@ -3850,6 +3832,10 @@
   UNSUPPORTED_OPTION(UseLargePages);
 #endif
 
+#if defined(AIX)
+  UNSUPPORTED_OPTION(AllocateHeapAt);
+#endif
+
   ArgumentsExt::report_unsupported_options();
 
 #ifndef PRODUCT
--- a/src/hotspot/share/runtime/biasedLocking.cpp	Wed Oct 03 15:54:35 2018 +0200
+++ b/src/hotspot/share/runtime/biasedLocking.cpp	Wed Oct 03 16:02:24 2018 +0200
@@ -23,6 +23,7 @@
  */
 
 #include "precompiled.hpp"
+#include "classfile/classLoaderDataGraph.hpp"
 #include "jfr/jfrEvents.hpp"
 #include "jfr/support/jfrThreadId.hpp"
 #include "logging/log.hpp"
--- a/src/hotspot/share/runtime/compilationPolicy.cpp	Wed Oct 03 15:54:35 2018 +0200
+++ b/src/hotspot/share/runtime/compilationPolicy.cpp	Wed Oct 03 16:02:24 2018 +0200
@@ -23,7 +23,7 @@
  */
 
 #include "precompiled.hpp"
-#include "classfile/classLoaderData.inline.hpp"
+#include "classfile/classLoaderDataGraph.inline.hpp"
 #include "code/compiledIC.hpp"
 #include "code/nmethod.hpp"
 #include "code/scopeDesc.hpp"
--- a/src/hotspot/share/runtime/deoptimization.cpp	Wed Oct 03 15:54:35 2018 +0200
+++ b/src/hotspot/share/runtime/deoptimization.cpp	Wed Oct 03 16:02:24 2018 +0200
@@ -1451,7 +1451,7 @@
   Symbol*  symbol  = constant_pool->symbol_at(index);
 
   // class name?
-  if (symbol->byte_at(0) != '(') {
+  if (symbol->char_at(0) != '(') {
     Handle protection_domain (THREAD, constant_pool->pool_holder()->protection_domain());
     SystemDictionary::resolve_or_null(symbol, class_loader, protection_domain, CHECK);
     return;
--- a/src/hotspot/share/runtime/fieldType.cpp	Wed Oct 03 15:54:35 2018 +0200
+++ b/src/hotspot/share/runtime/fieldType.cpp	Wed Oct 03 16:02:24 2018 +0200
@@ -32,21 +32,21 @@
 #include "runtime/signature.hpp"
 
 BasicType FieldType::basic_type(Symbol* signature) {
-  return char2type(signature->byte_at(0));
+  return char2type(signature->char_at(0));
 }
 
 // Check if it is a valid array signature
 bool FieldType::is_valid_array_signature(Symbol* sig) {
   assert(sig->utf8_length() > 1, "this should already have been checked");
-  assert(sig->byte_at(0) == '[', "this should already have been checked");
+  assert(sig->char_at(0) == '[', "this should already have been checked");
   // The first character is already checked
   int i = 1;
   int len = sig->utf8_length();
   // First skip all '['s
-  while(i < len - 1 && sig->byte_at(i) == '[') i++;
+  while(i < len - 1 && sig->char_at(i) == '[') i++;
 
   // Check type
-  switch(sig->byte_at(i)) {
+  switch(sig->char_at(i)) {
     case 'B': // T_BYTE
     case 'C': // T_CHAR
     case 'D': // T_DOUBLE
@@ -59,7 +59,7 @@
       return (i + 1 == len);
     case 'L':
       // If it is an object, the last character must be a ';'
-      return sig->byte_at(len - 1) == ';';
+      return sig->char_at(len - 1) == ';';
   }
 
   return false;
@@ -70,7 +70,7 @@
   assert(basic_type(signature) == T_ARRAY, "must be array");
   int index = 1;
   int dim   = 1;
-  while (signature->byte_at(index) == '[') {
+  while (signature->char_at(index) == '[') {
     index++;
     dim++;
   }
--- a/src/hotspot/share/runtime/fieldType.hpp	Wed Oct 03 15:54:35 2018 +0200
+++ b/src/hotspot/share/runtime/fieldType.hpp	Wed Oct 03 16:02:24 2018 +0200
@@ -58,14 +58,14 @@
   static BasicType basic_type(Symbol* signature);
 
   // Testing
-  static bool is_array(Symbol* signature) { return signature->utf8_length() > 1 && signature->byte_at(0) == '[' && is_valid_array_signature(signature); }
+  static bool is_array(Symbol* signature) { return signature->utf8_length() > 1 && signature->char_at(0) == '[' && is_valid_array_signature(signature); }
 
   static bool is_obj(Symbol* signature) {
      int sig_length = signature->utf8_length();
      // Must start with 'L' and end with ';'
      return (sig_length >= 2 &&
-             (signature->byte_at(0) == 'L') &&
-             (signature->byte_at(sig_length - 1) == ';'));
+             (signature->char_at(0) == 'L') &&
+             (signature->char_at(sig_length - 1) == ';'));
   }
 
   // Parse field and extract array information. Works for T_ARRAY only.
--- a/src/hotspot/share/runtime/globals.hpp	Wed Oct 03 15:54:35 2018 +0200
+++ b/src/hotspot/share/runtime/globals.hpp	Wed Oct 03 16:02:24 2018 +0200
@@ -247,9 +247,6 @@
           range(8, 256)                                                     \
           constraint(ObjectAlignmentInBytesConstraintFunc,AtParse)          \
                                                                             \
-  product(bool, AssumeMP, true,                                             \
-          "(Deprecated) Instruct the VM to assume multiple processors are available")\
-                                                                            \
   /* UseMembar is theoretically a temp flag used for memory barrier      */ \
   /* removal testing.  It was supposed to be removed before FCS but has  */ \
   /* been re-added (see 6401008)                                         */ \
--- a/src/hotspot/share/runtime/interfaceSupport.inline.hpp	Wed Oct 03 15:54:35 2018 +0200
+++ b/src/hotspot/share/runtime/interfaceSupport.inline.hpp	Wed Oct 03 16:02:24 2018 +0200
@@ -79,17 +79,15 @@
  private:
   static void serialize_thread_state_internal(JavaThread* thread, bool needs_exception_handler) {
     // Make sure new state is seen by VM thread
-    if (os::is_MP()) {
-      if (UseMembar) {
-        // Force a fence between the write above and read below
-        OrderAccess::fence();
+    if (UseMembar) {
+      // Force a fence between the write above and read below
+      OrderAccess::fence();
+    } else {
+      // store to serialize page so VM thread can do pseudo remote membar
+      if (needs_exception_handler) {
+        os::write_memory_serialize_page_with_handler(thread);
       } else {
-        // store to serialize page so VM thread can do pseudo remote membar
-        if (needs_exception_handler) {
-          os::write_memory_serialize_page_with_handler(thread);
-        } else {
-          os::write_memory_serialize_page(thread);
-        }
+        os::write_memory_serialize_page(thread);
       }
     }
   }
--- a/src/hotspot/share/runtime/java.cpp	Wed Oct 03 15:54:35 2018 +0200
+++ b/src/hotspot/share/runtime/java.cpp	Wed Oct 03 16:02:24 2018 +0200
@@ -26,6 +26,7 @@
 #include "jvm.h"
 #include "aot/aotLoader.hpp"
 #include "classfile/classLoader.hpp"
+#include "classfile/classLoaderDataGraph.hpp"
 #include "classfile/stringTable.hpp"
 #include "classfile/systemDictionary.hpp"
 #include "code/codeCache.hpp"
--- a/src/hotspot/share/runtime/memprofiler.cpp	Wed Oct 03 15:54:35 2018 +0200
+++ b/src/hotspot/share/runtime/memprofiler.cpp	Wed Oct 03 16:02:24 2018 +0200
@@ -23,7 +23,7 @@
  */
 
 #include "precompiled.hpp"
-#include "classfile/classLoaderData.inline.hpp"
+#include "classfile/classLoaderDataGraph.inline.hpp"
 #include "classfile/systemDictionary.hpp"
 #include "code/codeCache.hpp"
 #include "gc/shared/collectedHeap.inline.hpp"
--- a/src/hotspot/share/runtime/objectMonitor.cpp	Wed Oct 03 15:54:35 2018 +0200
+++ b/src/hotspot/share/runtime/objectMonitor.cpp	Wed Oct 03 16:02:24 2018 +0200
@@ -110,7 +110,7 @@
 static int Knob_FixedSpin           = 0;
 static int Knob_PreSpin             = 10;      // 20-100 likely better
 
-static volatile int InitDone        = 0;
+DEBUG_ONLY(static volatile bool InitDone = false;)
 
 // -----------------------------------------------------------------------------
 // Theory of operations -- Monitors lists, thread residency, etc:
@@ -428,7 +428,7 @@
     return;
   }
 
-  DeferredInitialize();
+  assert(InitDone, "Unexpectedly not initialized");
 
   // We try one round of spinning *before* enqueueing Self.
   //
@@ -1102,7 +1102,7 @@
   assert(Self->is_Java_thread(), "Must be Java thread!");
   JavaThread *jt = (JavaThread *)THREAD;
 
-  DeferredInitialize();
+  assert(InitDone, "Unexpectedly not initialized");
 
   if (THREAD != _owner) {
     if (THREAD->is_lock_owned ((address)_owner)) {
@@ -1186,7 +1186,7 @@
   assert(Self->is_Java_thread(), "Must be Java thread!");
   JavaThread *jt = (JavaThread *)THREAD;
 
-  DeferredInitialize();
+  assert(InitDone, "Unexpectedly not initialized");
 
   // Throw IMSX or IEX.
   CHECK_OWNER();
@@ -1888,9 +1888,14 @@
 // be protected - like so many things - by the MonitorCache_lock.
 
 void ObjectMonitor::Initialize() {
-  static int InitializationCompleted = 0;
-  assert(InitializationCompleted == 0, "invariant");
-  InitializationCompleted = 1;
+  assert(!InitDone, "invariant");
+
+  if (!os::is_MP()) {
+    Knob_SpinLimit = 0;
+    Knob_PreSpin   = 0;
+    Knob_FixedSpin = -1;
+  }
+
   if (UsePerfData) {
     EXCEPTION_MARK;
 #define NEWPERFCOUNTER(n)                                                \
@@ -1913,26 +1918,6 @@
 #undef NEWPERFCOUNTER
 #undef NEWPERFVARIABLE
   }
+
+  DEBUG_ONLY(InitDone = true;)
 }
-
-void ObjectMonitor::DeferredInitialize() {
-  if (InitDone > 0) return;
-  if (Atomic::cmpxchg (-1, &InitDone, 0) != 0) {
-    while (InitDone != 1) /* empty */;
-    return;
-  }
-
-  // One-shot global initialization ...
-  // The initialization is idempotent, so we don't need locks.
-  // In the future consider doing this via os::init_2().
-
-  if (!os::is_MP()) {
-    Knob_SpinLimit = 0;
-    Knob_PreSpin   = 0;
-    Knob_FixedSpin = -1;
-  }
-
-  OrderAccess::fence();
-  InitDone = 1;
-}
-
--- a/src/hotspot/share/runtime/objectMonitor.hpp	Wed Oct 03 15:54:35 2018 +0200
+++ b/src/hotspot/share/runtime/objectMonitor.hpp	Wed Oct 03 16:02:24 2018 +0200
@@ -302,7 +302,6 @@
 
  private:
   void      AddWaiter(ObjectWaiter * waiter);
-  static    void DeferredInitialize();
   void      INotify(Thread * Self);
   ObjectWaiter * DequeueWaiter();
   void      DequeueSpecificWaiter(ObjectWaiter * waiter);
--- a/src/hotspot/share/runtime/os.hpp	Wed Oct 03 15:54:35 2018 +0200
+++ b/src/hotspot/share/runtime/os.hpp	Wed Oct 03 16:02:24 2018 +0200
@@ -226,8 +226,9 @@
     // the bootstrap routine for the stub generator needs to check
     // the processor count directly and leave the bootstrap routine
     // in place until called after initialization has ocurred.
-    return AssumeMP || (_processor_count != 1);
+    return (_processor_count != 1);
   }
+
   static julong available_memory();
   static julong physical_memory();
   static bool has_allocatable_memory_limit(julong* limit);
--- a/src/hotspot/share/runtime/safepoint.cpp	Wed Oct 03 15:54:35 2018 +0200
+++ b/src/hotspot/share/runtime/safepoint.cpp	Wed Oct 03 16:02:24 2018 +0200
@@ -23,7 +23,7 @@
  */
 
 #include "precompiled.hpp"
-#include "classfile/classLoaderData.inline.hpp"
+#include "classfile/classLoaderDataGraph.inline.hpp"
 #include "classfile/stringTable.hpp"
 #include "classfile/symbolTable.hpp"
 #include "classfile/systemDictionary.hpp"
@@ -598,7 +598,8 @@
 
 public:
   ParallelSPCleanupThreadClosure(DeflateMonitorCounters* counters) :
-    _nmethod_cl(NMethodSweeper::prepare_mark_active_nmethods()), _counters(counters) {}
+    _nmethod_cl(UseCodeAging ? NMethodSweeper::prepare_reset_hotness_counters() : NULL),
+    _counters(counters) {}
 
   void do_thread(Thread* thread) {
     ObjectSynchronizer::deflate_thread_local_monitors(thread, _counters);
--- a/src/hotspot/share/runtime/signature.cpp	Wed Oct 03 15:54:35 2018 +0200
+++ b/src/hotspot/share/runtime/signature.cpp	Wed Oct 03 16:02:24 2018 +0200
@@ -50,7 +50,7 @@
 }
 
 void SignatureIterator::expect(char c) {
-  if (_signature->byte_at(_index) != c) fatal("expecting %c", c);
+  if (_signature->char_at(_index) != c) fatal("expecting %c", c);
   _index++;
 }
 
@@ -61,7 +61,7 @@
   //       work (stack underflow for some tests) - this seems to be a VC++ 6.0
   //       compiler bug (was problem - gri 4/27/2000).
   int size = -1;
-  switch(_signature->byte_at(_index)) {
+  switch(_signature->char_at(_index)) {
     case 'B': do_byte  (); if (_parameter_index < 0 ) _return_type = T_BYTE;
               _index++; size = T_BYTE_size   ; break;
     case 'C': do_char  (); if (_parameter_index < 0 ) _return_type = T_CHAR;
@@ -83,7 +83,7 @@
     case 'L':
       { int begin = ++_index;
         Symbol* sig = _signature;
-        while (sig->byte_at(_index++) != ';') ;
+        while (sig->char_at(_index++) != ';') ;
         do_object(begin, _index);
       }
       if (_parameter_index < 0 ) _return_type = T_OBJECT;
@@ -92,11 +92,11 @@
     case '[':
       { int begin = ++_index;
         Symbol* sig = _signature;
-        while (sig->byte_at(_index) == '[') {
+        while (sig->char_at(_index) == '[') {
           _index++;
         }
-        if (sig->byte_at(_index) == 'L') {
-          while (sig->byte_at(_index++) != ';') ;
+        if (sig->char_at(_index) == 'L') {
+          while (sig->char_at(_index++) != ';') ;
         } else {
           _index++;
         }
@@ -137,7 +137,7 @@
   _index = 0;
   _parameter_index = 0;
   expect('(');
-  while (_signature->byte_at(_index) != ')') _parameter_index += parse_type();
+  while (_signature->char_at(_index) != ')') _parameter_index += parse_type();
   expect(')');
   _parameter_index = 0;
 }
@@ -217,8 +217,8 @@
   // Need to skip over each type in the signature's argument list until a
   // closing ')' is found., then get the return type.  We cannot just scan
   // for the first ')' because ')' is a legal character in a type name.
-  while (sig->byte_at(_index) != ')') {
-    switch(sig->byte_at(_index)) {
+  while (sig->char_at(_index) != ')') {
+    switch(sig->char_at(_index)) {
       case 'B':
       case 'C':
       case 'D':
@@ -234,17 +234,17 @@
         break;
       case 'L':
         {
-          while (sig->byte_at(_index++) != ';') ;
+          while (sig->char_at(_index++) != ';') ;
         }
         break;
       case '[':
         {
           int begin = ++_index;
-          while (sig->byte_at(_index) == '[') {
+          while (sig->char_at(_index) == '[') {
             _index++;
           }
-          if (sig->byte_at(_index) == 'L') {
-            while (sig->byte_at(_index++) != ';') ;
+          if (sig->char_at(_index) == 'L') {
+            while (sig->char_at(_index++) != ';') ;
           } else {
             _index++;
           }
@@ -269,7 +269,7 @@
   _parameter_index = 0;
   _index = 0;
   expect('(');
-  while (_signature->byte_at(_index) != ')') _parameter_index += parse_type();
+  while (_signature->char_at(_index) != ')') _parameter_index += parse_type();
   expect(')');
   // Parse return type
   _parameter_index = -1;
@@ -304,20 +304,20 @@
     case 'L': {
       _type = T_OBJECT;
       Symbol* sig = _signature;
-      while (sig->byte_at(_end++) != ';');
+      while (sig->char_at(_end++) != ';');
       break;
     }
     case '[': {
       _type = T_ARRAY;
       Symbol* sig = _signature;
-      char c = sig->byte_at(_end);
-      while ('0' <= c && c <= '9') c = sig->byte_at(_end++);
-      while (sig->byte_at(_end) == '[') {
+      char c = sig->char_at(_end);
+      while ('0' <= c && c <= '9') c = sig->char_at(_end++);
+      while (sig->char_at(_end) == '[') {
         _end++;
-        c = sig->byte_at(_end);
-        while ('0' <= c && c <= '9') c = sig->byte_at(_end++);
+        c = sig->char_at(_end);
+        while ('0' <= c && c <= '9') c = sig->char_at(_end++);
       }
-      switch(sig->byte_at(_end)) {
+      switch(sig->char_at(_end)) {
         case 'B':
         case 'C':
         case 'D':
@@ -327,7 +327,7 @@
         case 'S':
         case 'Z':_end++; break;
         default: {
-          while (sig->byte_at(_end++) != ';');
+          while (sig->char_at(_end++) != ';');
           break;
         }
       }
@@ -353,8 +353,8 @@
   int begin = _begin;
   int end   = _end;
 
-  if (   _signature->byte_at(_begin) == 'L'
-      && _signature->byte_at(_end-1) == ';') {
+  if (   _signature->char_at(_begin) == 'L'
+      && _signature->char_at(_end-1) == ';') {
     begin++;
     end--;
   }
@@ -394,15 +394,15 @@
   int begin = _begin;
   int end   = _end;
 
-  if (   _signature->byte_at(_begin) == 'L'
-      && _signature->byte_at(_end-1) == ';') {
+  if (   _signature->char_at(_begin) == 'L'
+      && _signature->char_at(_end-1) == ';') {
     begin++;
     end--;
   }
 
   char* buffer = NEW_RESOURCE_ARRAY(char, end - begin);
   for (int index = begin; index < end; index++) {
-    buffer[index - begin] = _signature->byte_at(index);
+    buffer[index - begin] = _signature->char_at(index);
   }
   Symbol* result = SymbolTable::probe(buffer, end - begin);
   return result;
--- a/src/hotspot/share/runtime/signature.hpp	Wed Oct 03 15:54:35 2018 +0200
+++ b/src/hotspot/share/runtime/signature.hpp	Wed Oct 03 16:02:24 2018 +0200
@@ -378,7 +378,7 @@
     }
 
     _begin = _end;
-    int t = sig->byte_at(_begin);
+    int t = sig->char_at(_begin);
     switch (t) {
       case 'B': _type = T_BYTE;    break;
       case 'C': _type = T_CHAR;    break;
@@ -405,8 +405,8 @@
   enum FailureMode { ReturnNull, CNFException, NCDFError };
   Klass* as_klass(Handle class_loader, Handle protection_domain, FailureMode failure_mode, TRAPS);
   oop as_java_mirror(Handle class_loader, Handle protection_domain, FailureMode failure_mode, TRAPS);
-  const jbyte* raw_bytes()  { return _signature->bytes() + _begin; }
-  int          raw_length() { return _end - _begin; }
+  const u1* raw_bytes()  { return _signature->bytes() + _begin; }
+  int       raw_length() { return _end - _begin; }
 
   // return same as_symbol except allocation of new symbols is avoided.
   Symbol* as_symbol_or_null();
--- a/src/hotspot/share/runtime/sweeper.cpp	Wed Oct 03 15:54:35 2018 +0200
+++ b/src/hotspot/share/runtime/sweeper.cpp	Wed Oct 03 16:02:24 2018 +0200
@@ -28,15 +28,19 @@
 #include "code/icBuffer.hpp"
 #include "code/nmethod.hpp"
 #include "compiler/compileBroker.hpp"
+#include "gc/shared/collectedHeap.hpp"
+#include "gc/shared/workgroup.hpp"
 #include "jfr/jfrEvents.hpp"
 #include "logging/log.hpp"
 #include "logging/logStream.hpp"
 #include "memory/allocation.inline.hpp"
 #include "memory/resourceArea.hpp"
+#include "memory/universe.hpp"
 #include "oops/method.hpp"
 #include "runtime/atomic.hpp"
 #include "runtime/compilationPolicy.hpp"
 #include "runtime/interfaceSupport.inline.hpp"
+#include "runtime/handshake.hpp"
 #include "runtime/mutexLocker.hpp"
 #include "runtime/orderAccess.hpp"
 #include "runtime/os.hpp"
@@ -197,6 +201,38 @@
   return _current.end();
 }
 
+class NMethodMarkingThreadClosure : public ThreadClosure {
+private:
+  CodeBlobClosure* _cl;
+public:
+  NMethodMarkingThreadClosure(CodeBlobClosure* cl) : _cl(cl) {}
+  void do_thread(Thread* thread) {
+    if (thread->is_Java_thread() && ! thread->is_Code_cache_sweeper_thread()) {
+      JavaThread* jt = (JavaThread*) thread;
+      jt->nmethods_do(_cl);
+    }
+  }
+};
+
+class NMethodMarkingTask : public AbstractGangTask {
+private:
+  NMethodMarkingThreadClosure* _cl;
+public:
+  NMethodMarkingTask(NMethodMarkingThreadClosure* cl) :
+    AbstractGangTask("Parallel NMethod Marking"),
+    _cl(cl) {
+    Threads::change_thread_claim_parity();
+  }
+
+  ~NMethodMarkingTask() {
+    Threads::assert_all_threads_claimed();
+  }
+
+  void work(uint worker_id) {
+    Threads::possibly_parallel_threads_do(true, _cl);
+  }
+};
+
 /**
   * Scans the stacks of all Java threads and marks activations of not-entrant methods.
   * No need to synchronize access, since 'mark_active_nmethods' is always executed at a
@@ -205,12 +241,56 @@
 void NMethodSweeper::mark_active_nmethods() {
   CodeBlobClosure* cl = prepare_mark_active_nmethods();
   if (cl != NULL) {
-    Threads::nmethods_do(cl);
+    WorkGang* workers = Universe::heap()->get_safepoint_workers();
+    if (workers != NULL) {
+      NMethodMarkingThreadClosure tcl(cl);
+      NMethodMarkingTask task(&tcl);
+      workers->run_task(&task);
+    } else {
+      Threads::nmethods_do(cl);
+    }
   }
 }
 
 CodeBlobClosure* NMethodSweeper::prepare_mark_active_nmethods() {
+#ifdef ASSERT
+  if (ThreadLocalHandshakes) {
+    assert(Thread::current()->is_Code_cache_sweeper_thread(), "must be executed under CodeCache_lock and in sweeper thread");
+    assert_lock_strong(CodeCache_lock);
+  } else {
+    assert(SafepointSynchronize::is_at_safepoint(), "must be executed at a safepoint");
+  }
+#endif
+
+  // If we do not want to reclaim not-entrant or zombie methods there is no need
+  // to scan stacks
+  if (!MethodFlushing) {
+    return NULL;
+  }
+
+  // Increase time so that we can estimate when to invoke the sweeper again.
+  _time_counter++;
+
+  // Check for restart
+  assert(_current.method() == NULL, "should only happen between sweeper cycles");
+  assert(wait_for_stack_scanning(), "should only happen between sweeper cycles");
+
+  _seen = 0;
+  _current = CompiledMethodIterator();
+  // Initialize to first nmethod
+  _current.next();
+  _traversals += 1;
+  _total_time_this_sweep = Tickspan();
+
+  if (PrintMethodFlushing) {
+    tty->print_cr("### Sweep: stack traversal %ld", _traversals);
+  }
+  return &mark_activation_closure;
+}
+
+CodeBlobClosure* NMethodSweeper::prepare_reset_hotness_counters() {
   assert(SafepointSynchronize::is_at_safepoint(), "must be executed at a safepoint");
+
   // If we do not want to reclaim not-entrant or zombie methods there is no need
   // to scan stacks
   if (!MethodFlushing) {
@@ -231,24 +311,7 @@
     }
   }
 
-  if (wait_for_stack_scanning()) {
-    _seen = 0;
-    _current = CompiledMethodIterator();
-    // Initialize to first nmethod
-    _current.next();
-    _traversals += 1;
-    _total_time_this_sweep = Tickspan();
-
-    if (PrintMethodFlushing) {
-      tty->print_cr("### Sweep: stack traversal %ld", _traversals);
-    }
-    return &mark_activation_closure;
-
-  } else {
-    // Only set hotness counter
-    return &set_hotness_closure;
-  }
-
+  return &set_hotness_closure;
 }
 
 /**
@@ -258,9 +321,20 @@
 void NMethodSweeper::do_stack_scanning() {
   assert(!CodeCache_lock->owned_by_self(), "just checking");
   if (wait_for_stack_scanning()) {
-    VM_MarkActiveNMethods op;
-    VMThread::execute(&op);
-    _should_sweep = true;
+    if (ThreadLocalHandshakes) {
+      CodeBlobClosure* code_cl;
+      {
+        MutexLockerEx ccl(CodeCache_lock, Mutex::_no_safepoint_check_flag);
+        code_cl = prepare_mark_active_nmethods();
+      }
+      if (code_cl != NULL) {
+        NMethodMarkingThreadClosure tcl(code_cl);
+        Handshake::execute(&tcl);
+      }
+    } else {
+      VM_MarkActiveNMethods op;
+      VMThread::execute(&op);
+    }
   }
 }
 
@@ -377,7 +451,7 @@
   // allocations go to the non-profiled heap and we must be make sure that there is
   // enough space.
   double free_percent = 1 / CodeCache::reverse_free_ratio(CodeBlobType::MethodNonProfiled) * 100;
-  if (free_percent <= StartAggressiveSweepingAt) {
+  if (free_percent <= StartAggressiveSweepingAt || forced || _should_sweep) {
     do_stack_scanning();
   }
 
--- a/src/hotspot/share/runtime/sweeper.hpp	Wed Oct 03 15:54:35 2018 +0200
+++ b/src/hotspot/share/runtime/sweeper.hpp	Wed Oct 03 16:02:24 2018 +0200
@@ -117,6 +117,7 @@
 
   static void mark_active_nmethods();      // Invoked at the end of each safepoint
   static CodeBlobClosure* prepare_mark_active_nmethods();
+  static CodeBlobClosure* prepare_reset_hotness_counters();
   static void sweeper_loop();
   static void notify(int code_blob_type);  // Possibly start the sweeper thread.
   static void force_sweep();
--- a/src/hotspot/share/runtime/vmStructs.cpp	Wed Oct 03 15:54:35 2018 +0200
+++ b/src/hotspot/share/runtime/vmStructs.cpp	Wed Oct 03 16:02:24 2018 +0200
@@ -29,6 +29,7 @@
 #include "ci/ciObjArrayKlass.hpp"
 #include "ci/ciSymbol.hpp"
 #include "classfile/compactHashtable.hpp"
+#include "classfile/classLoaderDataGraph.hpp"
 #include "classfile/dictionary.hpp"
 #include "classfile/javaClasses.hpp"
 #include "classfile/stringTable.hpp"
@@ -328,8 +329,8 @@
   nonstatic_field(ObjArrayKlass,               _bottom_klass,                                 Klass*)                                \
   volatile_nonstatic_field(Symbol,             _length_and_refcount,                          unsigned int)                          \
   nonstatic_field(Symbol,                      _identity_hash,                                short)                                 \
-  unchecked_nonstatic_field(Symbol,            _body,                                         sizeof(jbyte)) /* NOTE: no type */     \
-  nonstatic_field(Symbol,                      _body[0],                                      jbyte)                                 \
+  unchecked_nonstatic_field(Symbol,            _body,                                         sizeof(u1)) /* NOTE: no type */        \
+  nonstatic_field(Symbol,                      _body[0],                                      u1)                                    \
   nonstatic_field(TypeArrayKlass,              _max_length,                                   jint)                                  \
                                                                                                                                      \
   /***********************/                                                                                                          \
--- a/src/hotspot/share/runtime/vm_version.cpp	Wed Oct 03 15:54:35 2018 +0200
+++ b/src/hotspot/share/runtime/vm_version.cpp	Wed Oct 03 16:02:24 2018 +0200
@@ -220,6 +220,8 @@
         #define HOTSPOT_BUILD_COMPILER "MS VC++ 14.0 (VS2015)"
       #elif _MSC_VER == 1912
         #define HOTSPOT_BUILD_COMPILER "MS VC++ 15.5 (VS2017)"
+      #elif _MSC_VER == 1913
+        #define HOTSPOT_BUILD_COMPILER "MS VC++ 15.6 (VS2017)"
       #else
         #define HOTSPOT_BUILD_COMPILER "unknown MS VC++:" XSTR(_MSC_VER)
       #endif
--- a/src/hotspot/share/services/heapDumper.cpp	Wed Oct 03 15:54:35 2018 +0200
+++ b/src/hotspot/share/services/heapDumper.cpp	Wed Oct 03 16:02:24 2018 +0200
@@ -24,6 +24,8 @@
 
 #include "precompiled.hpp"
 #include "jvm.h"
+#include "classfile/classLoaderData.inline.hpp"
+#include "classfile/classLoaderDataGraph.hpp"
 #include "classfile/symbolTable.hpp"
 #include "classfile/systemDictionary.hpp"
 #include "classfile/vmSymbols.hpp"
@@ -694,7 +696,7 @@
 
 // returns hprof tag for the given type signature
 hprofTag DumperSupport::sig2tag(Symbol* sig) {
-  switch (sig->byte_at(0)) {
+  switch (sig->char_at(0)) {
     case JVM_SIGNATURE_CLASS    : return HPROF_NORMAL_OBJECT;
     case JVM_SIGNATURE_ARRAY    : return HPROF_NORMAL_OBJECT;
     case JVM_SIGNATURE_BYTE     : return HPROF_BYTE;
@@ -819,7 +821,7 @@
   for (FieldStream fld(ik, false, false); !fld.eos(); fld.next()) {
     if (!fld.access_flags().is_static()) {
       Symbol* sig = fld.signature();
-      switch (sig->byte_at(0)) {
+      switch (sig->char_at(0)) {
         case JVM_SIGNATURE_CLASS   :
         case JVM_SIGNATURE_ARRAY   : size += oopSize; break;
 
@@ -887,7 +889,7 @@
       writer->write_u1(sig2tag(sig));       // type
 
       // value
-      dump_field_value(writer, sig->byte_at(0), ik->java_mirror(), fld.offset());
+      dump_field_value(writer, sig->char_at(0), ik->java_mirror(), fld.offset());
     }
   }
 
@@ -923,7 +925,7 @@
   for (FieldStream fld(ik, false, false); !fld.eos(); fld.next()) {
     if (!fld.access_flags().is_static()) {
       Symbol* sig = fld.signature();
-      dump_field_value(writer, sig->byte_at(0), o, fld.offset());
+      dump_field_value(writer, sig->char_at(0), o, fld.offset());
     }
   }
 }
--- a/src/hotspot/share/services/memBaseline.cpp	Wed Oct 03 15:54:35 2018 +0200
+++ b/src/hotspot/share/services/memBaseline.cpp	Wed Oct 03 16:02:24 2018 +0200
@@ -23,7 +23,7 @@
  */
 #include "precompiled.hpp"
 
-#include "classfile/classLoaderData.inline.hpp"
+#include "classfile/classLoaderDataGraph.inline.hpp"
 #include "memory/allocation.hpp"
 #include "runtime/safepoint.hpp"
 #include "runtime/thread.inline.hpp"
--- a/src/java.base/share/classes/java/lang/invoke/Invokers.java	Wed Oct 03 15:54:35 2018 +0200
+++ b/src/java.base/share/classes/java/lang/invoke/Invokers.java	Wed Oct 03 16:02:24 2018 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2008, 2016, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2008, 2018, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -505,7 +505,7 @@
          *  => checkcast(A)* & MH.invokeBasic(a*) & checkcast(R)
          * if a big adapter BA can be pulled out of (MT0,MT1)
          *  => BA.invokeBasic(MT0,MH,a*)
-         * if a local adapter LA can cached on static CS0 = new GICS(MT0)
+         * if a local adapter LA can be cached on static CS0 = new GICS(MT0)
          *  => CS0.LA.invokeBasic(MH,a*)
          * else
          *  => MH.asType(MT0).invokeBasic(A*)
--- a/src/java.base/share/classes/java/lang/invoke/MethodHandle.java	Wed Oct 03 15:54:35 2018 +0200
+++ b/src/java.base/share/classes/java/lang/invoke/MethodHandle.java	Wed Oct 03 16:02:24 2018 +0200
@@ -384,7 +384,7 @@
  * A method handle can be obtained on a method, constructor, or field
  * which is declared with Java generic types.
  * As with the Core Reflection API, the type of the method handle
- * will constructed from the erasure of the source-level type.
+ * will be constructed from the erasure of the source-level type.
  * When a method handle is invoked, the types of its arguments
  * or the return value cast type may be generic types or type instances.
  * If this occurs, the compiler will replace those
--- a/src/java.base/share/classes/java/lang/invoke/MethodHandles.java	Wed Oct 03 15:54:35 2018 +0200
+++ b/src/java.base/share/classes/java/lang/invoke/MethodHandles.java	Wed Oct 03 16:02:24 2018 +0200
@@ -4629,7 +4629,7 @@
      * <li>Examine and collect the suffixes of the step, pred, and fini parameter lists, after removing the iteration variable types.
      * (They must have the form {@code (V... A*)}; collect the {@code (A*)} parts only.)
      * <li>Do not collect suffixes from step, pred, and fini parameter lists that do not begin with all the iteration variable types.
-     * (These types will checked in step 2, along with all the clause function types.)
+     * (These types will be checked in step 2, along with all the clause function types.)
      * <li>Omitted clause functions are ignored.  (Equivalently, they are deemed to have empty parameter lists.)
      * <li>All of the collected parameter lists must be effectively identical.
      * <li>The longest parameter list (which is necessarily unique) is called the "external parameter list" ({@code (A...)}).
--- a/src/java.base/share/classes/java/lang/invoke/VarHandle.java	Wed Oct 03 15:54:35 2018 +0200
+++ b/src/java.base/share/classes/java/lang/invoke/VarHandle.java	Wed Oct 03 16:02:24 2018 +0200
@@ -100,7 +100,7 @@
  * is {@code String}.  The access mode type for {@code compareAndSet} on this
  * VarHandle instance would be
  * {@code (String[] c1, int c2, String expectedValue, String newValue)boolean}.
- * Such a VarHandle instance may produced by the
+ * Such a VarHandle instance may be produced by the
  * {@link MethodHandles#arrayElementVarHandle(Class) array factory method} and
  * access array elements as follows:
  * <pre> {@code
--- a/src/java.base/share/classes/java/lang/reflect/ProxyGenerator.java	Wed Oct 03 15:54:35 2018 +0200
+++ b/src/java.base/share/classes/java/lang/reflect/ProxyGenerator.java	Wed Oct 03 16:02:24 2018 +0200
@@ -1414,7 +1414,7 @@
      * Generate code to invoke the Class.forName with the name of the given
      * class to get its Class object at runtime.  The code is written to
      * the supplied stream.  Note that the code generated by this method
-     * may caused the checked ClassNotFoundException to be thrown.
+     * may cause the checked ClassNotFoundException to be thrown.
      */
     private void codeClassForName(Class<?> cl, DataOutputStream out)
         throws IOException
--- a/src/java.base/share/classes/java/nio/channels/Selector.java	Wed Oct 03 15:54:35 2018 +0200
+++ b/src/java.base/share/classes/java/nio/channels/Selector.java	Wed Oct 03 16:02:24 2018 +0200
@@ -80,8 +80,8 @@
  * <p> A key is added to its selector's cancelled-key set when it is cancelled,
  * whether by closing its channel or by invoking its {@link SelectionKey#cancel
  * cancel} method.  Cancelling a key will cause its channel to be deregistered
- * during the next selection operation, at which time the key will removed from
- * all of the selector's key sets.
+ * during the next selection operation, at which time the key will be removed
+ * from all of the selector's key sets.
  *
  * <a id="sks"></a><p> Keys are added to the selected-key set by selection
  * operations.  A key may be removed directly from the selected-key set by
--- a/src/java.base/share/classes/java/time/format/DateTimeFormatterBuilder.java	Wed Oct 03 15:54:35 2018 +0200
+++ b/src/java.base/share/classes/java/time/format/DateTimeFormatterBuilder.java	Wed Oct 03 16:02:24 2018 +0200
@@ -802,7 +802,13 @@
                 return store.getText(value, style);
             }
             @Override
-            public Iterator<Entry<String, Long>> getTextIterator(TemporalField field, TextStyle style, Locale locale) {
+            public Iterator<Entry<String, Long>> getTextIterator(Chronology chrono,
+                    TemporalField field, TextStyle style, Locale locale) {
+                return store.getTextIterator(style);
+            }
+            @Override
+            public Iterator<Entry<String, Long>> getTextIterator(TemporalField field,
+                    TextStyle style, Locale locale) {
                 return store.getTextIterator(style);
             }
         };
--- a/src/java.base/share/classes/java/util/Arrays.java	Wed Oct 03 15:54:35 2018 +0200
+++ b/src/java.base/share/classes/java/util/Arrays.java	Wed Oct 03 16:02:24 2018 +0200
@@ -28,6 +28,7 @@
 import jdk.internal.HotSpotIntrinsicCandidate;
 import jdk.internal.util.ArraysSupport;
 
+import java.io.Serializable;
 import java.lang.reflect.Array;
 import java.util.concurrent.ForkJoinPool;
 import java.util.function.BinaryOperator;
@@ -4288,21 +4289,41 @@
     // Misc
 
     /**
-     * Returns a fixed-size list backed by the specified array.  (Changes to
-     * the returned list "write through" to the array.)  This method acts
-     * as bridge between array-based and collection-based APIs, in
-     * combination with {@link Collection#toArray}.  The returned list is
-     * serializable and implements {@link RandomAccess}.
+     * Returns a fixed-size list backed by the specified array. Changes made to
+     * the array will be visible in the returned list, and changes made to the
+     * list will be visible in the array. The returned list is
+     * {@link Serializable} and implements {@link RandomAccess}.
+     *
+     * <p>The returned list implements the optional {@code Collection} methods, except
+     * those that would change the size of the returned list. Those methods leave
+     * the list unchanged and throw {@link UnsupportedOperationException}.
+     *
+     * @apiNote
+     * This method acts as bridge between array-based and collection-based
+     * APIs, in combination with {@link Collection#toArray}.
+     *
+     * <p>This method provides a way to wrap an existing array:
+     * <pre>{@code
+     *     Integer[] numbers = ...
+     *     ...
+     *     List<Integer> values = Arrays.asList(numbers);
+     * }</pre>
      *
      * <p>This method also provides a convenient way to create a fixed-size
      * list initialized to contain several elements:
-     * <pre>
-     *     List&lt;String&gt; stooges = Arrays.asList("Larry", "Moe", "Curly");
-     * </pre>
+     * <pre>{@code
+     *     List<String> stooges = Arrays.asList("Larry", "Moe", "Curly");
+     * }</pre>
+     *
+     * <p><em>The list returned by this method is modifiable.</em>
+     * To create an unmodifiable list, use
+     * {@link Collections#unmodifiableList Collections.unmodifiableList}
+     * or <a href="List.html#unmodifiable">Unmodifiable Lists</a>.
      *
      * @param <T> the class of the objects in the array
      * @param a the array by which the list will be backed
      * @return a list view of the specified array
+     * @throws NullPointerException if the specified array is {@code null}
      */
     @SafeVarargs
     @SuppressWarnings("varargs")
--- a/src/java.base/share/classes/java/util/concurrent/CompletableFuture.java	Wed Oct 03 15:54:35 2018 +0200
+++ b/src/java.base/share/classes/java/util/concurrent/CompletableFuture.java	Wed Oct 03 16:02:24 2018 +0200
@@ -957,17 +957,17 @@
     @SuppressWarnings("serial")
     static final class UniExceptionally<T> extends UniCompletion<T,T> {
         Function<? super Throwable, ? extends T> fn;
-        UniExceptionally(CompletableFuture<T> dep, CompletableFuture<T> src,
+        UniExceptionally(Executor executor,
+                         CompletableFuture<T> dep, CompletableFuture<T> src,
                          Function<? super Throwable, ? extends T> fn) {
-            super(null, dep, src); this.fn = fn;
+            super(executor, dep, src); this.fn = fn;
         }
-        final CompletableFuture<T> tryFire(int mode) { // never ASYNC
-            // assert mode != ASYNC;
+        final CompletableFuture<T> tryFire(int mode) {
             CompletableFuture<T> d; CompletableFuture<T> a;
             Object r; Function<? super Throwable, ? extends T> f;
             if ((d = dep) == null || (f = fn) == null
                 || (a = src) == null || (r = a.result) == null
-                || !d.uniExceptionally(r, f, this))
+                || !d.uniExceptionally(r, f, mode > 0 ? null : this))
                 return null;
             dep = null; src = null; fn = null;
             return d.postFire(a, mode);
@@ -980,11 +980,11 @@
         Throwable x;
         if (result == null) {
             try {
-                if (r instanceof AltResult && (x = ((AltResult)r).ex) != null) {
-                    if (c != null && !c.claim())
-                        return false;
+                if (c != null && !c.claim())
+                    return false;
+                if (r instanceof AltResult && (x = ((AltResult)r).ex) != null)
                     completeValue(f.apply(x));
-                } else
+                else
                     internalComplete(r);
             } catch (Throwable ex) {
                 completeThrowable(ex);
@@ -994,14 +994,88 @@
     }
 
     private CompletableFuture<T> uniExceptionallyStage(
-        Function<Throwable, ? extends T> f) {
+        Executor e, Function<Throwable, ? extends T> f) {
         if (f == null) throw new NullPointerException();
         CompletableFuture<T> d = newIncompleteFuture();
         Object r;
         if ((r = result) == null)
-            unipush(new UniExceptionally<T>(d, this, f));
+            unipush(new UniExceptionally<T>(e, d, this, f));
+        else if (e == null)
+            d.uniExceptionally(r, f, null);
+        else {
+            try {
+                e.execute(new UniExceptionally<T>(null, d, this, f));
+            } catch (Throwable ex) {
+                d.result = encodeThrowable(ex);
+            }
+        }
+        return d;
+    }
+
+    @SuppressWarnings("serial")
+    static final class UniComposeExceptionally<T> extends UniCompletion<T,T> {
+        Function<Throwable, ? extends CompletionStage<T>> fn;
+        UniComposeExceptionally(Executor executor, CompletableFuture<T> dep,
+                                CompletableFuture<T> src,
+                                Function<Throwable, ? extends CompletionStage<T>> fn) {
+            super(executor, dep, src); this.fn = fn;
+        }
+        final CompletableFuture<T> tryFire(int mode) {
+            CompletableFuture<T> d; CompletableFuture<T> a;
+            Function<Throwable, ? extends CompletionStage<T>> f;
+            Object r; Throwable x;
+            if ((d = dep) == null || (f = fn) == null
+                || (a = src) == null || (r = a.result) == null)
+                return null;
+            if (d.result == null) {
+                if ((r instanceof AltResult) &&
+                    (x = ((AltResult)r).ex) != null) {
+                    try {
+                        if (mode <= 0 && !claim())
+                            return null;
+                        CompletableFuture<T> g = f.apply(x).toCompletableFuture();
+                        if ((r = g.result) != null)
+                            d.completeRelay(r);
+                        else {
+                            g.unipush(new UniRelay<T,T>(d, g));
+                            if (d.result == null)
+                                return null;
+                        }
+                    } catch (Throwable ex) {
+                        d.completeThrowable(ex);
+                    }
+                }
+                else
+                    d.internalComplete(r);
+            }
+            dep = null; src = null; fn = null;
+            return d.postFire(a, mode);
+        }
+    }
+
+    private CompletableFuture<T> uniComposeExceptionallyStage(
+        Executor e, Function<Throwable, ? extends CompletionStage<T>> f) {
+        if (f == null) throw new NullPointerException();
+        CompletableFuture<T> d = newIncompleteFuture();
+        Object r, s; Throwable x;
+        if ((r = result) == null)
+            unipush(new UniComposeExceptionally<T>(e, d, this, f));
+        else if (!(r instanceof AltResult) || (x = ((AltResult)r).ex) == null)
+            d.internalComplete(r);
         else
-            d.uniExceptionally(r, f, null);
+            try {
+                if (e != null)
+                    e.execute(new UniComposeExceptionally<T>(null, d, this, f));
+                else {
+                    CompletableFuture<T> g = f.apply(x).toCompletableFuture();
+                    if ((s = g.result) != null)
+                        d.result = encodeRelay(s);
+                    else
+                        g.unipush(new UniRelay<T,T>(d, g));
+                }
+            } catch (Throwable ex) {
+                d.result = encodeThrowable(ex);
+            }
         return d;
     }
 
@@ -1093,7 +1167,7 @@
         Object r, s; Throwable x;
         if ((r = result) == null)
             unipush(new UniCompose<T,V>(e, d, this, f));
-        else if (e == null) {
+        else {
             if (r instanceof AltResult) {
                 if ((x = ((AltResult)r).ex) != null) {
                     d.result = encodeThrowable(x, r);
@@ -1102,23 +1176,20 @@
                 r = null;
             }
             try {
-                @SuppressWarnings("unchecked") T t = (T) r;
-                CompletableFuture<V> g = f.apply(t).toCompletableFuture();
-                if ((s = g.result) != null)
-                    d.result = encodeRelay(s);
+                if (e != null)
+                    e.execute(new UniCompose<T,V>(null, d, this, f));
                 else {
-                    g.unipush(new UniRelay<V,V>(d, g));
+                    @SuppressWarnings("unchecked") T t = (T) r;
+                    CompletableFuture<V> g = f.apply(t).toCompletableFuture();
+                    if ((s = g.result) != null)
+                        d.result = encodeRelay(s);
+                    else
+                        g.unipush(new UniRelay<V,V>(d, g));
                 }
             } catch (Throwable ex) {
                 d.result = encodeThrowable(ex);
             }
         }
-        else
-            try {
-                e.execute(new UniCompose<T,V>(null, d, this, f));
-            } catch (Throwable ex) {
-                d.result = encodeThrowable(ex);
-            }
         return d;
     }
 
@@ -1898,7 +1969,7 @@
      * Creates a new complete CompletableFuture with given encoded result.
      */
     CompletableFuture(Object r) {
-        this.result = r;
+        RESULT.setRelease(this, r);
     }
 
     /**
@@ -2285,28 +2356,36 @@
         return this;
     }
 
-    // not in interface CompletionStage
-
-    /**
-     * Returns a new CompletableFuture that is completed when this
-     * CompletableFuture completes, with the result of the given
-     * function of the exception triggering this CompletableFuture's
-     * completion when it completes exceptionally; otherwise, if this
-     * CompletableFuture completes normally, then the returned
-     * CompletableFuture also completes normally with the same value.
-     * Note: More flexible versions of this functionality are
-     * available using methods {@code whenComplete} and {@code handle}.
-     *
-     * @param fn the function to use to compute the value of the
-     * returned CompletableFuture if this CompletableFuture completed
-     * exceptionally
-     * @return the new CompletableFuture
-     */
     public CompletableFuture<T> exceptionally(
         Function<Throwable, ? extends T> fn) {
-        return uniExceptionallyStage(fn);
+        return uniExceptionallyStage(null, fn);
+    }
+
+    public CompletableFuture<T> exceptionallyAsync(
+        Function<Throwable, ? extends T> fn) {
+        return uniExceptionallyStage(defaultExecutor(), fn);
+    }
+
+    public CompletableFuture<T> exceptionallyAsync(
+        Function<Throwable, ? extends T> fn, Executor executor) {
+        return uniExceptionallyStage(screenExecutor(executor), fn);
     }
 
+    public CompletableFuture<T> exceptionallyCompose(
+        Function<Throwable, ? extends CompletionStage<T>> fn) {
+        return uniComposeExceptionallyStage(null, fn);
+    }
+
+    public CompletableFuture<T> exceptionallyComposeAsync(
+        Function<Throwable, ? extends CompletionStage<T>> fn) {
+        return uniComposeExceptionallyStage(defaultExecutor(), fn);
+    }
+
+    public CompletableFuture<T> exceptionallyComposeAsync(
+        Function<Throwable, ? extends CompletionStage<T>> fn,
+        Executor executor) {
+        return uniComposeExceptionallyStage(screenExecutor(executor), fn);
+    }
 
     /* ------------- Arbitrary-arity constructions -------------- */
 
--- a/src/java.base/share/classes/java/util/concurrent/CompletionStage.java	Wed Oct 03 15:54:35 2018 +0200
+++ b/src/java.base/share/classes/java/util/concurrent/CompletionStage.java	Wed Oct 03 16:02:24 2018 +0200
@@ -851,6 +851,130 @@
         (Function<Throwable, ? extends T> fn);
 
     /**
+     * Returns a new CompletionStage that, when this stage completes
+     * exceptionally, is executed with this stage's exception as the
+     * argument to the supplied function, using this stage's default
+     * asynchronous execution facility.  Otherwise, if this stage
+     * completes normally, then the returned stage also completes
+     * normally with the same value.
+     *
+     * @implSpec The default implementation invokes {@link #handle},
+     * relaying to {@link #handleAsync} on exception, then {@link
+     * #thenCompose} for result.
+     *
+     * @param fn the function to use to compute the value of the
+     * returned CompletionStage if this CompletionStage completed
+     * exceptionally
+     * @return the new CompletionStage
+     * @since 12
+     */
+    public default CompletionStage<T> exceptionallyAsync
+        (Function<Throwable, ? extends T> fn) {
+        return handle((r, ex) -> (ex == null)
+                      ? this
+                      : this.<T>handleAsync((r1, ex1) -> fn.apply(ex1)))
+            .thenCompose(Function.identity());
+    }
+
+    /**
+     * Returns a new CompletionStage that, when this stage completes
+     * exceptionally, is executed with this stage's exception as the
+     * argument to the supplied function, using the supplied Executor.
+     * Otherwise, if this stage completes normally, then the returned
+     * stage also completes normally with the same value.
+     *
+     * @implSpec The default implementation invokes {@link #handle},
+     * relaying to {@link #handleAsync} on exception, then {@link
+     * #thenCompose} for result.
+     *
+     * @param fn the function to use to compute the value of the
+     * returned CompletionStage if this CompletionStage completed
+     * exceptionally
+     * @param executor the executor to use for asynchronous execution
+     * @return the new CompletionStage
+     * @since 12
+     */
+    public default CompletionStage<T> exceptionallyAsync
+        (Function<Throwable, ? extends T> fn, Executor executor) {
+        return handle((r, ex) -> (ex == null)
+                      ? this
+                      : this.<T>handleAsync((r1, ex1) -> fn.apply(ex1), executor))
+            .thenCompose(Function.identity());
+    }
+
+    /**
+     * Returns a new CompletionStage that, when this stage completes
+     * exceptionally, is composed using the results of the supplied
+     * function applied to this stage's exception.
+     *
+     * @implSpec The default implementation invokes {@link #handle},
+     * invoking the given function on exception, then {@link
+     * #thenCompose} for result.
+     *
+     * @param fn the function to use to compute the returned
+     * CompletionStage if this CompletionStage completed exceptionally
+     * @return the new CompletionStage
+     * @since 12
+     */
+    public default CompletionStage<T> exceptionallyCompose
+        (Function<Throwable, ? extends CompletionStage<T>> fn) {
+        return handle((r, ex) -> (ex == null)
+                      ? this
+                      : fn.apply(ex))
+            .thenCompose(Function.identity());
+    }
+
+    /**
+     * Returns a new CompletionStage that, when this stage completes
+     * exceptionally, is composed using the results of the supplied
+     * function applied to this stage's exception, using this stage's
+     * default asynchronous execution facility.
+     *
+     * @implSpec The default implementation invokes {@link #handle},
+     * relaying to {@link #handleAsync} on exception, then {@link
+     * #thenCompose} for result.
+     *
+     * @param fn the function to use to compute the returned
+     * CompletionStage if this CompletionStage completed exceptionally
+     * @return the new CompletionStage
+     * @since 12
+     */
+    public default CompletionStage<T> exceptionallyComposeAsync
+        (Function<Throwable, ? extends CompletionStage<T>> fn) {
+        return handle((r, ex) -> (ex == null)
+                      ? this
+                      : this.handleAsync((r1, ex1) -> fn.apply(ex1))
+                        .thenCompose(Function.identity()))
+            .thenCompose(Function.identity());
+    }
+
+    /**
+     * Returns a new CompletionStage that, when this stage completes
+     * exceptionally, is composed using the results of the supplied
+     * function applied to this stage's exception, using the
+     * supplied Executor.
+     *
+     * @implSpec The default implementation invokes {@link #handle},
+     * relaying to {@link #handleAsync} on exception, then {@link
+     * #thenCompose} for result.
+     *
+     * @param fn the function to use to compute the returned
+     * CompletionStage if this CompletionStage completed exceptionally
+     * @param executor the executor to use for asynchronous execution
+     * @return the new CompletionStage
+     * @since 12
+     */
+    public default CompletionStage<T> exceptionallyComposeAsync
+        (Function<Throwable, ? extends CompletionStage<T>> fn,
+         Executor executor) {
+        return handle((r, ex) -> (ex == null)
+                      ? this
+                      : this.handleAsync((r1, ex1) -> fn.apply(ex1), executor)
+                        .thenCompose(Function.identity()))
+            .thenCompose(Function.identity());
+    }
+
+    /**
      * Returns a {@link CompletableFuture} maintaining the same
      * completion properties as this stage. If this stage is already a
      * CompletableFuture, this method may return this stage itself.
--- a/src/java.base/share/classes/java/util/jar/Attributes.java	Wed Oct 03 15:54:35 2018 +0200
+++ b/src/java.base/share/classes/java/util/jar/Attributes.java	Wed Oct 03 16:02:24 2018 +0200
@@ -369,8 +369,12 @@
      * Reads attributes from the specified input stream.
      * XXX Need to handle UTF8 values.
      */
+    void read(Manifest.FastInputStream is, byte[] lbuf) throws IOException {
+        read(is, lbuf, null, 0);
+    }
+
     @SuppressWarnings("deprecation")
-    void read(Manifest.FastInputStream is, byte[] lbuf) throws IOException {
+    int read(Manifest.FastInputStream is, byte[] lbuf, String filename, int lineNumber) throws IOException {
         String name = null, value;
         byte[] lastline = null;
 
@@ -378,8 +382,11 @@
         while ((len = is.readLine(lbuf)) != -1) {
             boolean lineContinued = false;
             byte c = lbuf[--len];
+            lineNumber++;
+
             if (c != '\n' && c != '\r') {
-                throw new IOException("line too long");
+                throw new IOException("line too long ("
+                            + Manifest.getErrorPosition(filename, lineNumber) + ")");
             }
             if (len > 0 && lbuf[len-1] == '\r') {
                 --len;
@@ -391,7 +398,8 @@
             if (lbuf[0] == ' ') {
                 // continuation of previous line
                 if (name == null) {
-                    throw new IOException("misplaced continuation line");
+                    throw new IOException("misplaced continuation line ("
+                                + Manifest.getErrorPosition(filename, lineNumber) + ")");
                 }
                 lineContinued = true;
                 byte[] buf = new byte[lastline.length + len - 1];
@@ -406,11 +414,13 @@
             } else {
                 while (lbuf[i++] != ':') {
                     if (i >= len) {
-                        throw new IOException("invalid header field");
+                        throw new IOException("invalid header field ("
+                                    + Manifest.getErrorPosition(filename, lineNumber) + ")");
                     }
                 }
                 if (lbuf[i++] != ' ') {
-                    throw new IOException("invalid header field");
+                    throw new IOException("invalid header field ("
+                                + Manifest.getErrorPosition(filename, lineNumber) + ")");
                 }
                 name = new String(lbuf, 0, 0, i - 2);
                 if (is.peek() == ' ') {
@@ -433,9 +443,11 @@
                                      + "entry in the jar file.");
                 }
             } catch (IllegalArgumentException e) {
-                throw new IOException("invalid header field name: " + name);
+                throw new IOException("invalid header field name: " + name
+                            + " (" + Manifest.getErrorPosition(filename, lineNumber) + ")");
             }
         }
+        return lineNumber;
     }
 
     /**
--- a/src/java.base/share/classes/java/util/jar/JarFile.java	Wed Oct 03 15:54:35 2018 +0200
+++ b/src/java.base/share/classes/java/util/jar/JarFile.java	Wed Oct 03 16:02:24 2018 +0200
@@ -417,12 +417,12 @@
             if (manEntry != null) {
                 if (verify) {
                     byte[] b = getBytes(manEntry);
-                    man = new Manifest(new ByteArrayInputStream(b));
+                    man = new Manifest(new ByteArrayInputStream(b), getName());
                     if (!jvInitialized) {
                         jv = new JarVerifier(b);
                     }
                 } else {
-                    man = new Manifest(super.getInputStream(manEntry));
+                    man = new Manifest(super.getInputStream(manEntry), getName());
                 }
                 manRef = new SoftReference<>(man);
             }
--- a/src/java.base/share/classes/java/util/jar/Manifest.java	Wed Oct 03 15:54:35 2018 +0200
+++ b/src/java.base/share/classes/java/util/jar/Manifest.java	Wed Oct 03 16:02:24 2018 +0200
@@ -25,14 +25,15 @@
 
 package java.util.jar;
 
+import java.io.DataOutputStream;
 import java.io.FilterInputStream;
-import java.io.DataOutputStream;
+import java.io.IOException;
 import java.io.InputStream;
 import java.io.OutputStream;
-import java.io.IOException;
+import java.util.HashMap;
 import java.util.Map;
-import java.util.HashMap;
-import java.util.Iterator;
+
+import sun.security.util.SecurityProperties;
 
 /**
  * The Manifest class is used to maintain Manifest entry names and their
@@ -47,16 +48,24 @@
  * @since   1.2
  */
 public class Manifest implements Cloneable {
+
+    private static final boolean jarInfoInExceptionText =
+        SecurityProperties.includedInExceptions("jar");
+
     // manifest main attributes
     private Attributes attr = new Attributes();
 
     // manifest entries
     private Map<String, Attributes> entries = new HashMap<>();
 
+    // name of the corresponding jar archive if available.
+    private final String jarFilename;
+
     /**
      * Constructs a new, empty Manifest.
      */
     public Manifest() {
+        jarFilename = null;
     }
 
     /**
@@ -66,15 +75,29 @@
      * @throws IOException if an I/O error has occurred
      */
     public Manifest(InputStream is) throws IOException {
+        this();
         read(is);
     }
 
     /**
+     * Constructs a new Manifest from the specified input stream.
+     *
+     * @param is the input stream containing manifest data
+     * @param jarFilename the name of the corresponding jar archive if available
+     * @throws IOException if an I/O error has occured
+     */
+    Manifest(InputStream is, String jarFilename) throws IOException {
+        read(is);
+        this.jarFilename = jarFilename;
+    }
+
+    /**
      * Constructs a new Manifest that is a copy of the specified Manifest.
      *
      * @param man the Manifest to copy
      */
     public Manifest(Manifest man) {
+        this();
         attr.putAll(man.getMainAttributes());
         entries.putAll(man.getEntries());
     }
@@ -179,6 +202,14 @@
         return;
     }
 
+    static String getErrorPosition(String filename, final int lineNumber) {
+        if (filename == null || !jarInfoInExceptionText) {
+            return "line " + lineNumber;
+        }
+
+        return "manifest of " + filename + ":" + lineNumber;
+    }
+
     /**
      * Reads the Manifest from the specified InputStream. The entry
      * names and attributes read will be merged in with the current
@@ -193,7 +224,7 @@
         // Line buffer
         byte[] lbuf = new byte[512];
         // Read the main attributes for the manifest
-        attr.read(fis, lbuf);
+        int lineNumber = attr.read(fis, lbuf, jarFilename, 0);
         // Total number of entries, attributes read
         int ecount = 0, acount = 0;
         // Average size of entry attributes
@@ -206,8 +237,11 @@
 
         while ((len = fis.readLine(lbuf)) != -1) {
             byte c = lbuf[--len];
+            lineNumber++;
+
             if (c != '\n' && c != '\r') {
-                throw new IOException("manifest line too long");
+                throw new IOException("manifest line too long ("
+                           + getErrorPosition(jarFilename, lineNumber) + ")");
             }
             if (len > 0 && lbuf[len-1] == '\r') {
                 --len;
@@ -220,7 +254,8 @@
             if (name == null) {
                 name = parseName(lbuf, len);
                 if (name == null) {
-                    throw new IOException("invalid manifest format");
+                    throw new IOException("invalid manifest format"
+                              + getErrorPosition(jarFilename, lineNumber) + ")");
                 }
                 if (fis.peek() == ' ') {
                     // name is wrapped
@@ -246,7 +281,7 @@
                 attr = new Attributes(asize);
                 entries.put(name, attr);
             }
-            attr.read(fis, lbuf);
+            lineNumber = attr.read(fis, lbuf, jarFilename, lineNumber);
             ecount++;
             acount += attr.size();
             //XXX: Fix for when the average is 0. When it is 0,
--- a/src/java.base/share/classes/java/util/stream/Collectors.java	Wed Oct 03 15:54:35 2018 +0200
+++ b/src/java.base/share/classes/java/util/stream/Collectors.java	Wed Oct 03 16:02:24 2018 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2012, 2017, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2012, 2018, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -1885,6 +1885,102 @@
     }
 
     /**
+     * Returns a {@code Collector} that is a composite of two downstream collectors.
+     * Every element passed to the resulting collector is processed by both downstream
+     * collectors, then their results are merged using the specified merge function
+     * into the final result.
+     *
+     * <p>The resulting collector functions do the following:
+     *
+     * <ul>
+     * <li>supplier: creates a result container that contains result containers
+     * obtained by calling each collector's supplier
+     * <li>accumulator: calls each collector's accumulator with its result container
+     * and the input element
+     * <li>combiner: calls each collector's combiner with two result containers
+     * <li>finisher: calls each collector's finisher with its result container,
+     * then calls the supplied merger and returns its result.
+     * </ul>
+     *
+     * <p>The resulting collector is {@link Collector.Characteristics#UNORDERED} if both downstream
+     * collectors are unordered and {@link Collector.Characteristics#CONCURRENT} if both downstream
+     * collectors are concurrent.
+     *
+     * @param <T>         the type of the input elements
+     * @param <R1>        the result type of the first collector
+     * @param <R2>        the result type of the second collector
+     * @param <R>         the final result type
+     * @param downstream1 the first downstream collector
+     * @param downstream2 the second downstream collector
+     * @param merger      the function which merges two results into the single one
+     * @return a {@code Collector} which aggregates the results of two supplied collectors.
+     * @since 12
+     */
+    public static <T, R1, R2, R>
+    Collector<T, ?, R> teeing(Collector<? super T, ?, R1> downstream1,
+                              Collector<? super T, ?, R2> downstream2,
+                              BiFunction<? super R1, ? super R2, R> merger) {
+        return teeing0(downstream1, downstream2, merger);
+    }
+
+    private static <T, A1, A2, R1, R2, R>
+    Collector<T, ?, R> teeing0(Collector<? super T, A1, R1> downstream1,
+                               Collector<? super T, A2, R2> downstream2,
+                               BiFunction<? super R1, ? super R2, R> merger) {
+        Objects.requireNonNull(downstream1, "downstream1");
+        Objects.requireNonNull(downstream2, "downstream2");
+        Objects.requireNonNull(merger, "merger");
+
+        Supplier<A1> c1Supplier = Objects.requireNonNull(downstream1.supplier(), "downstream1 supplier");
+        Supplier<A2> c2Supplier = Objects.requireNonNull(downstream2.supplier(), "downstream2 supplier");
+        BiConsumer<A1, ? super T> c1Accumulator =
+                Objects.requireNonNull(downstream1.accumulator(), "downstream1 accumulator");
+        BiConsumer<A2, ? super T> c2Accumulator =
+                Objects.requireNonNull(downstream2.accumulator(), "downstream2 accumulator");
+        BinaryOperator<A1> c1Combiner = Objects.requireNonNull(downstream1.combiner(), "downstream1 combiner");
+        BinaryOperator<A2> c2Combiner = Objects.requireNonNull(downstream2.combiner(), "downstream2 combiner");
+        Function<A1, R1> c1Finisher = Objects.requireNonNull(downstream1.finisher(), "downstream1 finisher");
+        Function<A2, R2> c2Finisher = Objects.requireNonNull(downstream2.finisher(), "downstream2 finisher");
+
+        Set<Collector.Characteristics> characteristics;
+        Set<Collector.Characteristics> c1Characteristics = downstream1.characteristics();
+        Set<Collector.Characteristics> c2Characteristics = downstream2.characteristics();
+        if (CH_ID.containsAll(c1Characteristics) || CH_ID.containsAll(c2Characteristics)) {
+            characteristics = CH_NOID;
+        } else {
+            EnumSet<Collector.Characteristics> c = EnumSet.noneOf(Collector.Characteristics.class);
+            c.addAll(c1Characteristics);
+            c.retainAll(c2Characteristics);
+            c.remove(Collector.Characteristics.IDENTITY_FINISH);
+            characteristics = Collections.unmodifiableSet(c);
+        }
+
+        class PairBox {
+            A1 left = c1Supplier.get();
+            A2 right = c2Supplier.get();
+
+            void add(T t) {
+                c1Accumulator.accept(left, t);
+                c2Accumulator.accept(right, t);
+            }
+
+            PairBox combine(PairBox other) {
+                left = c1Combiner.apply(left, other.left);
+                right = c2Combiner.apply(right, other.right);
+                return this;
+            }
+
+            R get() {
+                R1 r1 = c1Finisher.apply(left);
+                R2 r2 = c2Finisher.apply(right);
+                return merger.apply(r1, r2);
+            }
+        }
+
+        return new CollectorImpl<>(PairBox::new, PairBox::add, PairBox::combine, PairBox::get, characteristics);
+    }
+
+    /**
      * Implementation class used by partitioningBy.
      */
     private static final class Partition<T>
--- a/src/java.base/share/classes/javax/net/ssl/SSLEngine.java	Wed Oct 03 15:54:35 2018 +0200
+++ b/src/java.base/share/classes/javax/net/ssl/SSLEngine.java	Wed Oct 03 16:02:24 2018 +0200
@@ -1013,7 +1013,7 @@
      * an instance of this class, but before the {@code SSLSession} has
      * been completely initialized and made available via {@code getSession}.
      * For example, the list of valid signature algorithms may restrict
-     * the type of certificates that can used during TrustManager
+     * the type of certificates that can be used during TrustManager
      * decisions, or the maximum TLS/DTLS fragment packet sizes can be
      * resized to better support the network environment.
      * <p>
--- a/src/java.base/share/classes/javax/net/ssl/SSLSocket.java	Wed Oct 03 15:54:35 2018 +0200
+++ b/src/java.base/share/classes/javax/net/ssl/SSLSocket.java	Wed Oct 03 16:02:24 2018 +0200
@@ -421,7 +421,7 @@
      * an instance of this class, but before the {@code SSLSession} has
      * been completely initialized and made available via {@code getSession}.
      * For example, the list of valid signature algorithms may restrict
-     * the type of certificates that can used during TrustManager
+     * the type of certificates that can be used during TrustManager
      * decisions, or the maximum TLS fragment packet sizes can be
      * resized to better support the network environment.
      * <p>
--- a/src/java.base/share/classes/module-info.java	Wed Oct 03 15:54:35 2018 +0200
+++ b/src/java.base/share/classes/module-info.java	Wed Oct 03 16:02:24 2018 +0200
@@ -234,7 +234,6 @@
         jdk.jconsole,
         java.net.http;
     exports sun.net.www to
-        java.desktop,
         java.net.http,
         jdk.jartool;
     exports sun.net.www.protocol.http to
--- a/src/java.base/share/classes/sun/net/util/SocketExceptions.java	Wed Oct 03 15:54:35 2018 +0200
+++ b/src/java.base/share/classes/sun/net/util/SocketExceptions.java	Wed Oct 03 16:02:24 2018 +0200
@@ -30,43 +30,14 @@
 import java.net.InetSocketAddress;
 import java.security.AccessController;
 import java.security.PrivilegedAction;
-import java.security.Security;
+
+import sun.security.util.SecurityProperties;
 
 public final class SocketExceptions {
     private SocketExceptions() {}
 
-    /**
-     * Security or system property which specifies categories of
-     * (potentially sensitive) information that may be included
-     * in exception text. This class only defines one category:
-     * "hostInfo" which represents the hostname and port number
-     * of the remote peer relating to a socket exception.
-     * The property value is a comma separated list of
-     * case insignificant category names.
-     */
-    private static final String enhancedTextPropname = "jdk.includeInExceptions";
-
-    private static final boolean enhancedExceptionText = initTextProp();
-
-    private static boolean initTextProp() {
-        return AccessController.doPrivileged(new PrivilegedAction<Boolean>() {
-            public Boolean run() {
-                String val = System.getProperty(enhancedTextPropname);
-                if (val == null) {
-                    val = Security.getProperty(enhancedTextPropname);
-                    if (val == null)
-                        return false;
-                }
-                String[] tokens = val.split(",");
-                for (String token : tokens) {
-                    if (token.equalsIgnoreCase("hostinfo"))
-                        return true;
-                }
-                return false;
-            }
-        });
-    }
-
+    private static final boolean enhancedExceptionText =
+        SecurityProperties.includedInExceptions("hostInfo");
 
     /**
      * Utility which takes an exception and returns either the same exception
@@ -74,8 +45,9 @@
      * and detail message enhanced with addressing information from the
      * given InetSocketAddress.
      *
-     * If the system/security property "jdk.net.enhanceExceptionText" is not
-     * set or is false, then the original exception is returned.
+     * If the system/security property "jdk.includeInExceptions" is not
+     * set or does not contain the category hostInfo,
+     * then the original exception is returned.
      *
      * Only specific IOException subtypes are supported.
      */
--- a/src/java.base/share/classes/sun/security/provider/DSA.java	Wed Oct 03 15:54:35 2018 +0200
+++ b/src/java.base/share/classes/sun/security/provider/DSA.java	Wed Oct 03 16:02:24 2018 +0200
@@ -105,7 +105,7 @@
      * Construct a blank DSA object that will use the specified
      * signature format. {@code p1363Format} should be {@code true} to
      * use the IEEE P1363 format. If {@code p1363Format} is {@code false},
-     * the DER-encoded ASN.1 format will used. The DSA object must be
+     * the DER-encoded ASN.1 format will be used. The DSA object must be
      * initialized before being usable for signing or verifying.
      */
     DSA(MessageDigest md, boolean p1363Format) {
--- a/src/java.base/share/classes/sun/security/provider/certpath/IndexedCollectionCertStore.java	Wed Oct 03 15:54:35 2018 +0200
+++ b/src/java.base/share/classes/sun/security/provider/certpath/IndexedCollectionCertStore.java	Wed Oct 03 16:02:24 2018 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2002, 2012, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2002, 2018, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -49,7 +49,7 @@
  * are as fast (or marginally faster) than for the standard
  * CollectionCertStore. Certificate subjects and CRL issuers
  * were found to be specified in most searches used internally by the
- * CertPath provider. Additional attributes could indexed if there are
+ * CertPath provider. Additional attributes could be indexed if there are
  * queries that justify the effort.
  *
  * <li>Changes to the specified Collection after construction time are
--- a/src/java.base/share/classes/sun/security/ssl/SSLSocketImpl.java	Wed Oct 03 15:54:35 2018 +0200
+++ b/src/java.base/share/classes/sun/security/ssl/SSLSocketImpl.java	Wed Oct 03 16:02:24 2018 +0200
@@ -849,8 +849,7 @@
          *
          * This implementation is somewhat less efficient than possible, but
          * not badly so (redundant copy).  We reuse the read() code to keep
-         * things simpler. Note that SKIP_ARRAY is static and may garbled by
-         * concurrent use, but we are not interested in the data anyway.
+         * things simpler.
          */
         @Override
         public synchronized long skip(long n) throws IOException {
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/src/java.base/share/classes/sun/security/util/SecurityProperties.java	Wed Oct 03 16:02:24 2018 +0200
@@ -0,0 +1,77 @@
+/*
+ * Copyright (c) 2018, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2018 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.  Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+package sun.security.util;
+
+import java.security.AccessController;
+import java.security.PrivilegedAction;
+import java.security.Security;
+
+public class SecurityProperties {
+
+    /**
+     * Returns the value of the security property propName, which can be overridden
+     * by a system property of the same name
+     *
+     * @param  propName the name of the system or security property
+     * @return the value of the system or security property
+     */
+    public static String privilegedGetOverridable(String propName) {
+        return AccessController.doPrivileged((PrivilegedAction<String>)
+            () -> {
+                String val = System.getProperty(propName);
+                if (val == null) {
+                    return Security.getProperty(propName);
+                } else {
+                    return val;
+                }
+            });
+    }
+
+    /**
+     * Returns true in case the system or security property "jdk.includeInExceptions"
+     * contains the category refName
+     *
+     * @param refName the category to check
+     * @return true in case the system or security property "jdk.includeInExceptions"
+     *         contains refName, false otherwise
+     */
+    public static boolean includedInExceptions(String refName) {
+        String val = privilegedGetOverridable("jdk.includeInExceptions");
+        if (val == null) {
+            return false;
+        }
+
+        String[] tokens = val.split(",");
+        for (String token : tokens) {
+            token = token.trim();
+            if (token.equalsIgnoreCase(refName)) {
+                return true;
+            }
+        }
+        return false;
+    }
+}
--- a/src/java.base/share/classes/sun/security/x509/OCSPNoCheckExtension.java	Wed Oct 03 15:54:35 2018 +0200
+++ b/src/java.base/share/classes/sun/security/x509/OCSPNoCheckExtension.java	Wed Oct 03 16:02:24 2018 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2009, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2009, 2018, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -38,8 +38,8 @@
  * lifetime of the responder's certificate. The CA does so by including
  * the extension id-pkix-ocsp-nocheck. This SHOULD be a non-critical
  * extension. The value of the extension should be NULL. CAs issuing
- * such a certificate should realized that a compromise of the
- * responder's key, is as serious as the compromise of a CA key used to
+ * such a certificate should realize that a compromise of the
+ * responder's key is as serious as the compromise of a CA key used to
  * sign CRLs, at least for the validity period of this certificate. CA's
  * may choose to issue this type of certificate with a very short
  * lifetime and renew it frequently.
--- a/src/java.base/share/conf/security/java.security	Wed Oct 03 15:54:35 2018 +0200
+++ b/src/java.base/share/conf/security/java.security	Wed Oct 03 16:02:24 2018 +0200
@@ -1081,7 +1081,10 @@
 #             java.nio.channels package will contain enhanced exception
 #             message information
 #
+#  jar      - enables more detailed information in the IOExceptions thrown
+#             by classes in the java.util.jar package
+#
 # The property setting in this file can be overridden by a system property of
 # the same name, with the same syntax and possible values.
 #
-#jdk.includeInExceptions=hostInfo
+#jdk.includeInExceptions=hostInfo,jar
--- a/src/java.base/share/lib/security/default.policy	Wed Oct 03 15:54:35 2018 +0200
+++ b/src/java.base/share/lib/security/default.policy	Wed Oct 03 16:02:24 2018 +0200
@@ -140,10 +140,6 @@
     permission java.io.FilePermission "<<ALL FILES>>", "read";
 };
 
-grant codeBase "jrt:/jdk.desktop" {
-    permission java.lang.RuntimePermission "accessClassInPackage.com.sun.awt";
-};
-
 grant codeBase "jrt:/jdk.dynalink" {
     permission java.security.AllPermission;
 };
--- a/src/java.base/share/native/libjli/args.c	Wed Oct 03 15:54:35 2018 +0200
+++ b/src/java.base/share/native/libjli/args.c	Wed Oct 03 16:02:24 2018 +0200
@@ -263,6 +263,8 @@
                 }
                 JLI_List_addSubstring(pctx->parts, anchor, nextc - anchor);
                 pctx->state = IN_ESCAPE;
+                // anchor after backslash character
+                anchor = nextc + 1;
                 break;
             case '\'':
             case '"':
--- a/src/java.base/unix/native/libnet/net_util_md.h	Wed Oct 03 15:54:35 2018 +0200
+++ b/src/java.base/unix/native/libnet/net_util_md.h	Wed Oct 03 16:02:24 2018 +0200
@@ -47,7 +47,7 @@
 #ifndef SO_REUSEPORT
 #ifdef __linux__
 #define SO_REUSEPORT 15
-#elif __solaris__
+#elif defined(__solaris__)
 #define SO_REUSEPORT 0x100e
 #elif defined(AIX) || defined(MACOSX)
 #define SO_REUSEPORT 0x0200
--- a/src/java.base/unix/native/libnio/ch/NativeThread.c	Wed Oct 03 15:54:35 2018 +0200
+++ b/src/java.base/unix/native/libnio/ch/NativeThread.c	Wed Oct 03 16:02:24 2018 +0200
@@ -37,14 +37,14 @@
   #include <pthread.h>
   /* Also defined in net/linux_close.c */
   #define INTERRUPT_SIGNAL (__SIGRTMAX - 2)
-#elif _AIX
+#elif defined(_AIX)
   #include <pthread.h>
   /* Also defined in net/aix_close.c */
   #define INTERRUPT_SIGNAL (SIGRTMAX - 1)
-#elif __solaris__
+#elif defined(__solaris__)
   #include <thread.h>
   #define INTERRUPT_SIGNAL (SIGRTMAX - 2)
-#elif _ALLBSD_SOURCE
+#elif defined(_ALLBSD_SOURCE)
   #include <pthread.h>
   /* Also defined in net/bsd_close.c */
   #define INTERRUPT_SIGNAL SIGIO
--- a/src/java.base/unix/native/libnio/ch/nio_util.h	Wed Oct 03 15:54:35 2018 +0200
+++ b/src/java.base/unix/native/libnio/ch/nio_util.h	Wed Oct 03 16:02:24 2018 +0200
@@ -40,7 +40,7 @@
 #ifndef SO_REUSEPORT
 #ifdef __linux__
 #define SO_REUSEPORT 15
-#elif __solaris__
+#elif defined(__solaris__)
 #define SO_REUSEPORT 0x100e
 #elif defined(AIX) || defined(MACOSX)
 #define SO_REUSEPORT 0x0200
--- a/src/java.base/windows/native/libjava/java_props_md.c	Wed Oct 03 15:54:35 2018 +0200
+++ b/src/java.base/windows/native/libjava/java_props_md.c	Wed Oct 03 16:02:24 2018 +0200
@@ -170,6 +170,10 @@
         return NULL;
     }
 
+    for (index = 0; index < 5; index++) {
+        elems[index] = NULL;
+    }
+
     if (SetupI18nProps(MAKELCID(langID, SORT_DEFAULT),
                    &(elems[0]), &(elems[1]), &(elems[2]), &(elems[3]), &(elems[4]))) {
 
@@ -183,15 +187,17 @@
                 strcat(ret, elems[index]);
             }
         }
-
-        for (index = 0; index < 5; index++) {
-            free(elems[index]);
-        }
     } else {
         free(ret);
         ret = NULL;
     }
 
+    for (index = 0; index < 5; index++) {
+        if (elems[index] != NULL) {
+            free(elems[index]);
+        }
+    }
+
     return ret;
 }
 
--- a/src/java.desktop/macosx/classes/com/apple/eawt/_AppMenuBarHandler.java	Wed Oct 03 15:54:35 2018 +0200
+++ b/src/java.desktop/macosx/classes/com/apple/eawt/_AppMenuBarHandler.java	Wed Oct 03 16:02:24 2018 +0200
@@ -46,6 +46,7 @@
 
     private static native void nativeSetMenuState(final int menu, final boolean visible, final boolean enabled);
     private static native void nativeSetDefaultMenuBar(final long menuBarPeer);
+    private static native void nativeActivateDefaultMenuBar(final long menuBarPeer);
 
     static final _AppMenuBarHandler instance = new _AppMenuBarHandler();
     static _AppMenuBarHandler getInstance() {
@@ -78,26 +79,18 @@
 
     void setDefaultMenuBar(final JMenuBar menuBar) {
         installDefaultMenuBar(menuBar);
-        if (menuBar == null) {
-            return;
-        }
+    }
 
+    static boolean isMenuBarActivationNeeded() {
         // scan the current frames, and see if any are foreground
         final Frame[] frames = Frame.getFrames();
         for (final Frame frame : frames) {
             if (frame.isVisible() && !isFrameMinimized(frame)) {
-                return;
+                return false;
             }
         }
 
-        // if we have no foreground frames, then we have to "kick" the menubar
-        final JFrame pingFrame = new JFrame();
-        pingFrame.getRootPane().putClientProperty("Window.alpha", Float.valueOf(0.0f));
-        pingFrame.setUndecorated(true);
-        pingFrame.setVisible(true);
-        pingFrame.toFront();
-        pingFrame.setVisible(false);
-        pingFrame.dispose();
+        return true;
     }
 
     static boolean isFrameMinimized(final Frame frame) {
@@ -150,6 +143,11 @@
 
         // grab the pointer to the CMenuBar, and retain it in native
         ((CMenuBar) peer).execute(_AppMenuBarHandler::nativeSetDefaultMenuBar);
+
+        // if there is no currently active frame, install the default menu bar in the application main menu
+        if (isMenuBarActivationNeeded()) {
+            ((CMenuBar) peer).execute(_AppMenuBarHandler::nativeActivateDefaultMenuBar);
+        }
     }
 
     void setAboutMenuItemVisible(final boolean present) {
--- a/src/java.desktop/macosx/classes/sun/font/CStrike.java	Wed Oct 03 15:54:35 2018 +0200
+++ b/src/java.desktop/macosx/classes/sun/font/CStrike.java	Wed Oct 03 16:02:24 2018 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2011, 2017, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2011, 2018, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -506,12 +506,6 @@
         private SparseBitShiftingTwoLayerArray secondLayerCache;
         private HashMap<Integer, Float> generalCache;
 
-        // Empty non private constructor was added because access to this
-        // class shouldn't be emulated by a synthetic accessor method.
-        GlyphAdvanceCache() {
-            super();
-        }
-
         public synchronized float get(final int index) {
             if (index < 0) {
                 if (-index < SECOND_LAYER_SIZE) {
--- a/src/java.desktop/macosx/classes/sun/lwawt/LWButtonPeer.java	Wed Oct 03 15:54:35 2018 +0200
+++ b/src/java.desktop/macosx/classes/sun/lwawt/LWButtonPeer.java	Wed Oct 03 16:02:24 2018 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2011, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2011, 2018, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -81,12 +81,6 @@
     @SuppressWarnings("serial")// Safe: outer class is non-serializable.
     private final class JButtonDelegate extends JButton {
 
-        // Empty non private constructor was added because access to this
-        // class shouldn't be emulated by a synthetic accessor method.
-        JButtonDelegate() {
-            super();
-        }
-
         @Override
         public boolean hasFocus() {
             return getTarget().hasFocus();
--- a/src/java.desktop/macosx/classes/sun/lwawt/LWChoicePeer.java	Wed Oct 03 15:54:35 2018 +0200
+++ b/src/java.desktop/macosx/classes/sun/lwawt/LWChoicePeer.java	Wed Oct 03 16:02:24 2018 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2011, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2011, 2018, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -135,12 +135,6 @@
     @SuppressWarnings("serial")// Safe: outer class is non-serializable.
     private final class JComboBoxDelegate extends JComboBox<String> {
 
-        // Empty non private constructor was added because access to this
-        // class shouldn't be emulated by a synthetic accessor method.
-        JComboBoxDelegate() {
-            super();
-        }
-
         @Override
         public boolean hasFocus() {
             return getTarget().hasFocus();
--- a/src/java.desktop/macosx/classes/sun/lwawt/LWComponentPeer.java	Wed Oct 03 15:54:35 2018 +0200
+++ b/src/java.desktop/macosx/classes/sun/lwawt/LWComponentPeer.java	Wed Oct 03 16:02:24 2018 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2011, 2017, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2011, 2018, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -159,12 +159,6 @@
             enableEvents(0xFFFFFFFF);
         }
 
-        // Empty non private constructor was added because access to this
-        // class shouldn't be emulated by a synthetic accessor method.
-        DelegateContainer() {
-            super();
-        }
-
         @Override
         public boolean isLightweight() {
             return false;
--- a/src/java.desktop/macosx/classes/sun/lwawt/LWTextAreaPeer.java	Wed Oct 03 15:54:35 2018 +0200
+++ b/src/java.desktop/macosx/classes/sun/lwawt/LWTextAreaPeer.java	Wed Oct 03 16:02:24 2018 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2011, 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2011, 2018, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -219,12 +219,6 @@
 
         private final class JTextAreaDelegate extends JTextArea {
 
-            // Empty non private constructor was added because access to this
-            // class shouldn't be emulated by a synthetic accessor method.
-            JTextAreaDelegate() {
-                super();
-            }
-
             @Override
             public void replaceSelection(String content) {
                 getDocument().removeDocumentListener(LWTextAreaPeer.this);
--- a/src/java.desktop/macosx/classes/sun/lwawt/LWTextFieldPeer.java	Wed Oct 03 15:54:35 2018 +0200
+++ b/src/java.desktop/macosx/classes/sun/lwawt/LWTextFieldPeer.java	Wed Oct 03 16:02:24 2018 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2011, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2011, 2018, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -122,12 +122,6 @@
     @SuppressWarnings("serial")// Safe: outer class is non-serializable.
     private final class JPasswordFieldDelegate extends JPasswordField {
 
-        // Empty non private constructor was added because access to this
-        // class shouldn't be emulated by a synthetic accessor method.
-        JPasswordFieldDelegate() {
-            super();
-        }
-
         @Override
         public void replaceSelection(String content) {
             getDocument().removeDocumentListener(LWTextFieldPeer.this);
--- a/src/java.desktop/macosx/classes/sun/lwawt/macosx/CEmbeddedFrame.java	Wed Oct 03 15:54:35 2018 +0200
+++ b/src/java.desktop/macosx/classes/sun/lwawt/macosx/CEmbeddedFrame.java	Wed Oct 03 16:02:24 2018 +0200
@@ -165,8 +165,6 @@
                         : this;
             }
         }
-        // ignore focus "lost" native request as it may mistakenly
-        // deactivate active window (see 8001161)
         if (globalFocusedWindow == this) {
             responder.handleWindowFocusEvent(parentWindowActive, null);
         }
@@ -181,4 +179,19 @@
         // another window.
         return globalFocusedWindow != null ? !globalFocusedWindow.isParentWindowActive() : true;
     }
+
+    @Override
+    public void synthesizeWindowActivation(boolean doActivate) {
+        if (isParentWindowActive() != doActivate) {
+            handleWindowFocusEvent(doActivate);
+        }
+    }
+
+    public static void updateGlobalFocusedWindow(CEmbeddedFrame newGlobalFocusedWindow) {
+        synchronized (classLock) {
+            if (newGlobalFocusedWindow.isParentWindowActive()) {
+                globalFocusedWindow = newGlobalFocusedWindow;
+            }
+        }
+    }
 }
--- a/src/java.desktop/macosx/classes/sun/lwawt/macosx/CPlatformEmbeddedFrame.java	Wed Oct 03 15:54:35 2018 +0200
+++ b/src/java.desktop/macosx/classes/sun/lwawt/macosx/CPlatformEmbeddedFrame.java	Wed Oct 03 16:02:24 2018 +0200
@@ -147,6 +147,8 @@
 
     @Override
     public boolean requestWindowFocus() {
+        CEmbeddedFrame.updateGlobalFocusedWindow(target);
+        target.synthesizeWindowActivation(true);
         return true;
     }
 
--- a/src/java.desktop/macosx/classes/sun/lwawt/macosx/CPlatformWindow.java	Wed Oct 03 15:54:35 2018 +0200
+++ b/src/java.desktop/macosx/classes/sun/lwawt/macosx/CPlatformWindow.java	Wed Oct 03 16:02:24 2018 +0200
@@ -1205,17 +1205,27 @@
     }
 
     private void orderAboveSiblings() {
-        // Recursively pop up the windows from the very bottom, (i.e. root owner) so that
-        // the windows are ordered above their nearest owner; ancestors of the window,
-        // which is going to become 'main window', are placed above their siblings.
         CPlatformWindow rootOwner = getRootOwner();
-        if (rootOwner.isVisible() && !rootOwner.isIconified()) {
-            rootOwner.execute(CWrapper.NSWindow::orderFront);
-        }
+
         // Do not order child windows of iconified owner.
         if (!rootOwner.isIconified()) {
             final WindowAccessor windowAccessor = AWTAccessor.getWindowAccessor();
-            orderAboveSiblingsImpl(windowAccessor.getOwnedWindows(rootOwner.target));
+            Window[] windows = windowAccessor.getOwnedWindows(rootOwner.target);
+
+            // No need to order windows if it doesn't own other windows and hence return
+            if (windows.length == 0) {
+                return;
+            }
+
+            // Recursively pop up the windows from the very bottom, (i.e. root owner) so that
+            // the windows are ordered above their nearest owner; ancestors of the window,
+            // which is going to become 'main window', are placed above their siblings.
+            if (rootOwner.isVisible()) {
+                rootOwner.execute(CWrapper.NSWindow::orderFront);
+            }
+
+            // Order child windows.
+            orderAboveSiblingsImpl(windows);
         }
     }
 
@@ -1276,6 +1286,21 @@
         }
     }
 
+    private Window getOwnerFrameOrDialog(Window window) {
+        Window owner = window.getOwner();
+        while (owner != null && !(owner instanceof Frame || owner instanceof Dialog)) {
+            owner = owner.getOwner();
+        }
+        return owner;
+    }
+
+    private boolean isSimpleWindowOwnedByEmbeddedFrame() {
+        if (peer != null && peer.isSimpleWindow()) {
+            return (getOwnerFrameOrDialog(target) instanceof CEmbeddedFrame);
+        }
+        return false;
+    }
+
     // ----------------------------------------------------------------------
     //                          NATIVE CALLBACKS
     // ----------------------------------------------------------------------
--- a/src/java.desktop/macosx/native/libawt_lwawt/awt/AWTView.m	Wed Oct 03 15:54:35 2018 +0200
+++ b/src/java.desktop/macosx/native/libawt_lwawt/awt/AWTView.m	Wed Oct 03 16:02:24 2018 +0200
@@ -537,10 +537,14 @@
 }
 
 -(BOOL) isCodePointInUnicodeBlockNeedingIMEvent: (unichar) codePoint {
-    if (((codePoint >= 0x3000) && (codePoint <= 0x303F)) ||
+    if ((codePoint == 0x0024) || (codePoint == 0x00A3) ||
+        (codePoint == 0x00A5) ||
+        ((codePoint >= 0x20A3) && (codePoint <= 0x20BF)) ||
+	((codePoint >= 0x3000) && (codePoint <= 0x303F)) ||
         ((codePoint >= 0xFF00) && (codePoint <= 0xFFEF))) {
         // Code point is in 'CJK Symbols and Punctuation' or
-        // 'Halfwidth and Fullwidth Forms' Unicode block.
+        // 'Halfwidth and Fullwidth Forms' Unicode block or
+	// currency symbols unicode
         return YES;
     }
     return NO;
--- a/src/java.desktop/macosx/native/libawt_lwawt/awt/AWTWindow.m	Wed Oct 03 15:54:35 2018 +0200
+++ b/src/java.desktop/macosx/native/libawt_lwawt/awt/AWTWindow.m	Wed Oct 03 16:02:24 2018 +0200
@@ -477,6 +477,21 @@
     return isBlocked;
 }
 
+// Test whether window is simple window and owned by embedded frame
+- (BOOL) isSimpleWindowOwnedByEmbeddedFrame {
+    BOOL isSimpleWindowOwnedByEmbeddedFrame = NO;
+
+    JNIEnv *env = [ThreadUtilities getJNIEnv];
+    jobject platformWindow = [self.javaPlatformWindow jObjectWithEnv:env];
+    if (platformWindow != NULL) {
+        static JNF_MEMBER_CACHE(jm_isBlocked, jc_CPlatformWindow, "isSimpleWindowOwnedByEmbeddedFrame", "()Z");
+        isSimpleWindowOwnedByEmbeddedFrame = JNFCallBooleanMethod(env, platformWindow, jm_isBlocked) == JNI_TRUE ? YES : NO;
+        (*env)->DeleteLocalRef(env, platformWindow);
+    }
+
+    return isSimpleWindowOwnedByEmbeddedFrame;
+}
+
 // Tests whether the corresponding Java platform window is visible or not
 + (BOOL) isJavaPlatformWindowVisible:(NSWindow *)window {
     BOOL isVisible = NO;
@@ -543,7 +558,7 @@
 // NSWindow overrides
 - (BOOL) canBecomeKeyWindow {
 AWT_ASSERT_APPKIT_THREAD;
-    return self.isEnabled && IS(self.styleBits, SHOULD_BECOME_KEY);
+    return self.isEnabled && (IS(self.styleBits, SHOULD_BECOME_KEY) || [self isSimpleWindowOwnedByEmbeddedFrame]);
 }
 
 - (BOOL) canBecomeMainWindow {
--- a/src/java.desktop/macosx/native/libawt_lwawt/awt/ApplicationDelegate.m	Wed Oct 03 15:54:35 2018 +0200
+++ b/src/java.desktop/macosx/native/libawt_lwawt/awt/ApplicationDelegate.m	Wed Oct 03 16:02:24 2018 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2011, 2016, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2011, 2018, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -35,10 +35,10 @@
 #import <JavaNativeFoundation/JavaNativeFoundation.h>
 
 #import "CPopupMenu.h"
+#import "CMenuBar.h"
 #import "ThreadUtilities.h"
 #import "NSApplicationAWT.h"
 
-
 #pragma mark App Menu helpers
 
 // The following is a AWT convention?
@@ -201,11 +201,11 @@
 
     self.fPreferencesMenu = (NSMenuItem*)[appMenu itemWithTag:PREFERENCES_TAG];
     self.fAboutMenu = (NSMenuItem*)[appMenu itemAtIndex:0];
-    
+
     NSDockTile *dockTile = [NSApp dockTile];
     self.fProgressIndicator = [[NSProgressIndicator alloc]
                                 initWithFrame:NSMakeRect(3.f, 0.f, dockTile.size.width - 6.f, 20.f)];
-    
+
     [fProgressIndicator setStyle:NSProgressIndicatorBarStyle];
     [fProgressIndicator setIndeterminate:NO];
     [[dockTile contentView] addSubview:fProgressIndicator];
@@ -824,3 +824,23 @@
 
 JNF_COCOA_EXIT(env);
 }
+
+/*
+ * Class:     com_apple_eawt__AppMenuBarHandler
+ * Method:    nativeActivateDefaultMenuBar
+ * Signature: (J)V
+ */
+JNIEXPORT void JNICALL Java_com_apple_eawt__1AppMenuBarHandler_nativeActivateDefaultMenuBar
+(JNIEnv *env, jclass clz, jlong cMenuBarPtr)
+{
+JNF_COCOA_ENTER(env);
+
+    CMenuBar *menu = (CMenuBar *)jlong_to_ptr(cMenuBarPtr);
+    [ThreadUtilities performOnMainThreadWaiting:NO block:^(){
+        if (menu) {
+            [CMenuBar activate:menu modallyDisabled:NO];
+        }
+    }];
+
+JNF_COCOA_EXIT(env);
+}
--- a/src/java.desktop/share/classes/com/sun/awt/SecurityWarning.java	Wed Oct 03 15:54:35 2018 +0200
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,172 +0,0 @@
-/*
- * Copyright (c) 2008, 2018, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * 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 com.sun.awt;
-
-import java.awt.*;
-import java.awt.geom.*;
-
-import sun.awt.AWTAccessor;
-
-
-/**
- * Security Warning control interface.
- *
- * This class provides a couple of methods that help a developer relocate
- * the AWT security warning to an appropriate position relative to the current
- * window size. A "top-level window" is an instance of the {@code Window}
- * class (or its descendant, such as {@code JFrame}). The security warning
- * is applied to all windows created by an untrusted code. All such windows
- * have a non-null "warning string" (see {@link Window#getWarningString()}).
- * <p>
- * <b>WARNING</b>: This class is an implementation detail and only meant
- * for limited use outside of the core platform. This API may change
- * drastically between update release, and it may even be
- * removed or be moved to some other packages or classes.
- *
- * @deprecated This class is deprecated, no replacement.
- */
-@Deprecated(since = "11", forRemoval = true)
-public final class SecurityWarning {
-
-    /**
-     * The SecurityWarning class should not be instantiated
-     */
-    private SecurityWarning() {
-    }
-
-    /**
-     * Gets the size of the security warning.
-     *
-     * The returned value is not valid until the peer has been created. Before
-     * invoking this method a developer must call the {@link Window#pack()},
-     * {@link Window#setVisible}, or some other method that creates the peer.
-     *
-     * @param window the window to get the security warning size for
-     *
-     * @throws NullPointerException if the window argument is null
-     * @throws IllegalArgumentException if the window is trusted (i.e.
-     * the {@code getWarningString()} returns null)
-     */
-    public static Dimension getSize(Window window) {
-        if (window == null) {
-            throw new NullPointerException(
-                    "The window argument should not be null.");
-        }
-        if (window.getWarningString() == null) {
-            throw new IllegalArgumentException(
-                    "The window must have a non-null warning string.");
-        }
-        // We don't check for a non-null peer since it may be destroyed
-        // after assigning a valid value to the security warning size.
-
-        return AWTAccessor.getWindowAccessor().getSecurityWarningSize(window);
-    }
-
-    /**
-     * Sets the position of the security warning.
-     * <p>
-     * The {@code alignmentX} and {@code alignmentY} arguments specify the
-     * origin of the coordinate system used to calculate the position of the
-     * security warning. The values must be in the range [0.0f...1.0f].  The
-     * {@code 0.0f} value represents the left (top) edge of the rectangular
-     * bounds of the window. The {@code 1.0f} value represents the right
-     * (bottom) edge of the bounds. Whenever the size of the window changes,
-     * the origin of the coordinate system gets relocated accordingly. For
-     * convenience a developer may use the {@code Component.*_ALIGNMENT}
-     * constants to pass predefined values for these arguments.
-     * <p>
-     * The {@code point} argument specifies the location of the security
-     * warning in the coordinate system described above. If both {@code x} and
-     * {@code y} coordinates of the point are equal to zero, the warning will
-     * be located right in the origin of the coordinate system. On the other
-     * hand, if both {@code alignmentX} and {@code alignmentY} are equal to
-     * zero (i.e. the origin of the coordinate system is placed at the top-left
-     * corner of the window), then the {@code point} argument represents the
-     * absolute location of the security warning relative to the location of
-     * the window. The "absolute" in this case means that the position of the
-     * security warning is not effected by resizing of the window.
-     * <p>
-     * Note that the security warning management code guarantees that:
-     * <ul>
-     * <li>The security warning cannot be located farther than two pixels from
-     * the rectangular bounds of the window (see {@link Window#getBounds}), and
-     * <li>The security warning is always visible on the screen.
-     * </ul>
-     * If either of the conditions is violated, the calculated position of the
-     * security warning is adjusted by the system to meet both these
-     * conditions.
-     * <p>
-     * The default position of the security warning is in the upper-right
-     * corner of the window, two pixels to the right from the right edge. This
-     * corresponds to the following arguments passed to this method:
-     * <ul>
-     * <li>{@code alignmentX = Component.RIGHT_ALIGNMENT}
-     * <li>{@code alignmentY = Component.TOP_ALIGNMENT}
-     * <li>{@code point = (2, 0)}
-     * </ul>
-     *
-     * @param window the window to set the position of the security warning for
-     * @param alignmentX the horizontal origin of the coordinate system
-     * @param alignmentY the vertical origin of the coordinate system
-     * @param point the position of the security warning in the specified
-     * coordinate system
-     *
-     * @throws NullPointerException if the window argument is null
-     * @throws NullPointerException if the point argument is null
-     * @throws IllegalArgumentException if the window is trusted (i.e.
-     * the {@code getWarningString()} returns null
-     * @throws IllegalArgumentException if the alignmentX or alignmentY
-     * arguments are not within the range [0.0f ... 1.0f]
-     */
-    public static void setPosition(Window window, Point2D point,
-            float alignmentX, float alignmentY)
-    {
-        if (window == null) {
-            throw new NullPointerException(
-                    "The window argument should not be null.");
-        }
-        if (window.getWarningString() == null) {
-            throw new IllegalArgumentException(
-                    "The window must have a non-null warning string.");
-        }
-        if (point == null) {
-            throw new NullPointerException(
-                    "The point argument must not be null");
-        }
-        if (alignmentX < 0.0f || alignmentX > 1.0f) {
-            throw new IllegalArgumentException(
-                    "alignmentX must be in the range [0.0f ... 1.0f].");
-        }
-        if (alignmentY < 0.0f || alignmentY > 1.0f) {
-            throw new IllegalArgumentException(
-                    "alignmentY must be in the range [0.0f ... 1.0f].");
-        }
-
-        AWTAccessor.getWindowAccessor().setSecurityWarningPosition(window,
-                point, alignmentX, alignmentY);
-    }
-}
-
--- a/src/java.desktop/share/classes/com/sun/media/sound/DirectAudioDevice.java	Wed Oct 03 15:54:35 2018 +0200
+++ b/src/java.desktop/share/classes/com/sun/media/sound/DirectAudioDevice.java	Wed Oct 03 16:02:24 2018 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2002, 2017, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2002, 2018, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -547,14 +547,15 @@
                 getEventDispatcher().addLineMonitor(this);
             }
 
-            doIO = true;
-
-            // need to set Active and Started
-            // note: the current API always requires that
-            //       Started and Active are set at the same time...
-            if (isSource && stoppedWritten) {
-                setStarted(true);
-                setActive(true);
+            synchronized(lock) {
+                doIO = true;
+                // need to set Active and Started
+                // note: the current API always requires that
+                //       Started and Active are set at the same time...
+                if (isSource && stoppedWritten) {
+                    setStarted(true);
+                    setActive(true);
+                }
             }
 
             if (Printer.trace) Printer.trace("<< DirectDL: implStart() succeeded");
@@ -582,10 +583,10 @@
                 // read/write thread, that's why isStartedRunning()
                 // cannot be used
                 doIO = false;
+                setActive(false);
+                setStarted(false);
                 lock.notifyAll();
             }
-            setActive(false);
-            setStarted(false);
             stoppedWritten = false;
 
             if (Printer.trace) Printer.trace(" << DirectDL: implStop() succeeded");
@@ -731,12 +732,14 @@
             if ((long)off + (long)len > (long)b.length) {
                 throw new ArrayIndexOutOfBoundsException(b.length);
             }
-
-            if (!isActive() && doIO) {
-                // this is not exactly correct... would be nicer
-                // if the native sub system sent a callback when IO really starts
-                setActive(true);
-                setStarted(true);
+            synchronized(lock) {
+                if (!isActive() && doIO) {
+                    // this is not exactly correct... would be nicer
+                    // if the native sub system sent a callback when IO really
+                    // starts
+                    setActive(true);
+                    setStarted(true);
+                }
             }
             int written = 0;
             while (!flushing) {
@@ -957,11 +960,14 @@
             if ((long)off + (long)len > (long)b.length) {
                 throw new ArrayIndexOutOfBoundsException(b.length);
             }
-            if (!isActive() && doIO) {
-                // this is not exactly correct... would be nicer
-                // if the native sub system sent a callback when IO really starts
-                setActive(true);
-                setStarted(true);
+            synchronized(lock) {
+                if (!isActive() && doIO) {
+                    // this is not exactly correct... would be nicer
+                    // if the native sub system sent a callback when IO really
+                    // starts
+                    setActive(true);
+                    setStarted(true);
+                }
             }
             int read = 0;
             while (doIO && !flushing) {
--- a/src/java.desktop/share/classes/java/awt/GraphicsEnvironment.java	Wed Oct 03 15:54:35 2018 +0200
+++ b/src/java.desktop/share/classes/java/awt/GraphicsEnvironment.java	Wed Oct 03 16:02:24 2018 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1997, 2017, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1997, 2018, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -169,18 +169,9 @@
                 String nm = System.getProperty("java.awt.headless");
 
                 if (nm == null) {
-                    /* No need to ask for DISPLAY when run in a browser */
-                    if (System.getProperty("javaplugin.version") != null) {
-                        headless = defaultHeadless = Boolean.FALSE;
-                    } else {
-                        String osName = System.getProperty("os.name");
-                        if (osName.contains("OS X") && "sun.awt.HToolkit".equals(
-                                System.getProperty("awt.toolkit")))
-                        {
-                            headless = defaultHeadless = Boolean.TRUE;
-                        } else {
-                            final String display = System.getenv("DISPLAY");
-                            headless = defaultHeadless =
+                    final String osName = System.getProperty("os.name");
+                    final String display = System.getenv("DISPLAY");
+                    headless = defaultHeadless =
                                 ("Linux".equals(osName) ||
                                  "SunOS".equals(osName) ||
                                  "FreeBSD".equals(osName) ||
@@ -188,8 +179,6 @@
                                  "OpenBSD".equals(osName) ||
                                  "AIX".equals(osName)) &&
                                  (display == null || display.trim().isEmpty());
-                        }
-                    }
                 } else {
                     headless = Boolean.valueOf(nm);
                 }
--- a/src/java.desktop/share/classes/java/awt/Window.java	Wed Oct 03 15:54:35 2018 +0200
+++ b/src/java.desktop/share/classes/java/awt/Window.java	Wed Oct 03 16:02:24 2018 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1995, 2017, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1995, 2018, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -394,16 +394,6 @@
     private transient volatile int securityWarningWidth = 0;
     private transient volatile int securityWarningHeight = 0;
 
-    /**
-     * These fields represent the desired location for the security
-     * warning if this window is untrusted.
-     * See com.sun.awt.SecurityWarning for more details.
-     */
-    private transient double securityWarningPointX = 2.0;
-    private transient double securityWarningPointY = 0.0;
-    private transient float securityWarningAlignmentX = RIGHT_ALIGNMENT;
-    private transient float securityWarningAlignmentY = TOP_ALIGNMENT;
-
     static {
         /* ensure that the necessary native libraries are loaded */
         Toolkit.loadLibraries();
@@ -3127,10 +3117,6 @@
 
          this.securityWarningWidth = 0;
          this.securityWarningHeight = 0;
-         this.securityWarningPointX = 2.0;
-         this.securityWarningPointY = 0.0;
-         this.securityWarningAlignmentX = RIGHT_ALIGNMENT;
-         this.securityWarningAlignmentY = TOP_ALIGNMENT;
 
          deserializeResources(s);
     }
@@ -4031,9 +4017,9 @@
     private Point2D calculateSecurityWarningPosition(double x, double y,
             double w, double h)
     {
-        // The position according to the spec of SecurityWarning.setPosition()
-        double wx = x + w * securityWarningAlignmentX + securityWarningPointX;
-        double wy = y + h * securityWarningAlignmentY + securityWarningPointY;
+         // The desired location for the security warning
+        double wx = x + w * RIGHT_ALIGNMENT + 2.0;
+        double wy = y + h * TOP_ALIGNMENT + 0.0;
 
         // First, make sure the warning is not too far from the window bounds
         wx = Window.limit(wx,
@@ -4068,33 +4054,12 @@
                 window.updateWindow();
             }
 
-            public Dimension getSecurityWarningSize(Window window) {
-                return new Dimension(window.securityWarningWidth,
-                        window.securityWarningHeight);
-            }
-
             public void setSecurityWarningSize(Window window, int width, int height)
             {
                 window.securityWarningWidth = width;
                 window.securityWarningHeight = height;
             }
 
-            public void setSecurityWarningPosition(Window window,
-                    Point2D point, float alignmentX, float alignmentY)
-            {
-                window.securityWarningPointX = point.getX();
-                window.securityWarningPointY = point.getY();
-                window.securityWarningAlignmentX = alignmentX;
-                window.securityWarningAlignmentY = alignmentY;
-
-                synchronized (window.getTreeLock()) {
-                    WindowPeer peer = (WindowPeer) window.peer;
-                    if (peer != null) {
-                        peer.repositionSecurityWarning();
-                    }
-                }
-            }
-
             public Point2D calculateSecurityWarningPosition(Window window,
                     double x, double y, double w, double h)
             {
--- a/src/java.desktop/share/classes/javax/swing/RepaintManager.java	Wed Oct 03 15:54:35 2018 +0200
+++ b/src/java.desktop/share/classes/javax/swing/RepaintManager.java	Wed Oct 03 16:02:24 2018 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1997, 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1997, 2018, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -1814,12 +1814,6 @@
      */
     private static final class DisplayChangedHandler implements
                                              DisplayChangedListener {
-        // Empty non private constructor was added because access to this
-        // class shouldn't be generated by the compiler using synthetic
-        // accessor method
-        DisplayChangedHandler() {
-        }
-
         public void displayChanged() {
             scheduleDisplayChanges();
         }
--- a/src/java.desktop/share/classes/javax/swing/border/TitledBorder.java	Wed Oct 03 15:54:35 2018 +0200
+++ b/src/java.desktop/share/classes/javax/swing/border/TitledBorder.java	Wed Oct 03 16:02:24 2018 +0200
@@ -42,6 +42,8 @@
 import javax.swing.UIManager;
 import javax.swing.plaf.basic.BasicHTML;
 
+import jdk.internal.ref.CleanerFactory;
+
 /**
  * A class which implements an arbitrary border
  * with the addition of a String title in a
@@ -759,22 +761,19 @@
 
     private void installPropertyChangeListeners() {
         final WeakReference<TitledBorder> weakReference = new WeakReference<TitledBorder>(this);
-        final PropertyChangeListener listener = new PropertyChangeListener() {
-            @Override
-            public void propertyChange(PropertyChangeEvent evt) {
-                if (weakReference.get() == null) {
-                    UIManager.removePropertyChangeListener(this);
-                    UIManager.getDefaults().removePropertyChangeListener(this);
-                } else {
-                    String prop = evt.getPropertyName();
-                    if ("lookAndFeel".equals(prop) || "LabelUI".equals(prop)) {
-                        label.updateUI();
-                    }
-                }
+        final PropertyChangeListener listener = evt -> {
+            TitledBorder tb = weakReference.get();
+            String prop = evt.getPropertyName();
+            if (tb != null && ("lookAndFeel".equals(prop) || "LabelUI".equals(prop))) {
+                tb.label.updateUI();
             }
         };
 
         UIManager.addPropertyChangeListener(listener);
         UIManager.getDefaults().addPropertyChangeListener(listener);
+        CleanerFactory.cleaner().register(this, () -> {
+            UIManager.removePropertyChangeListener(listener);
+            UIManager.getDefaults().removePropertyChangeListener(listener);
+        });
     }
 }
--- a/src/java.desktop/share/classes/javax/swing/plaf/basic/BasicProgressBarUI.java	Wed Oct 03 15:54:35 2018 +0200
+++ b/src/java.desktop/share/classes/javax/swing/plaf/basic/BasicProgressBarUI.java	Wed Oct 03 16:02:24 2018 +0200
@@ -874,7 +874,7 @@
                                                       progressString);
 
         if (progressBar.getOrientation() == JProgressBar.HORIZONTAL) {
-            return new Point(x + Math.round(width/2 - stringWidth/2),
+            return new Point(x + (int)Math.round(width/2.0 - stringWidth/2.0),
                              y + ((height +
                                  fontSizer.getAscent() -
                                  fontSizer.getLeading() -
@@ -882,7 +882,7 @@
         } else { // VERTICAL
             return new Point(x + ((width - fontSizer.getAscent() +
                     fontSizer.getLeading() + fontSizer.getDescent()) / 2),
-                    y + Math.round(height/2 - stringWidth/2));
+                    y + (int)Math.round(height/2.0 - stringWidth/2.0));
         }
     }
 
--- a/src/java.desktop/share/classes/javax/swing/plaf/basic/BasicTableUI.java	Wed Oct 03 15:54:35 2018 +0200
+++ b/src/java.desktop/share/classes/javax/swing/plaf/basic/BasicTableUI.java	Wed Oct 03 16:02:24 2018 +0200
@@ -1872,7 +1872,12 @@
             // and if there is any selected rows
             if (rMax != (table.getRowCount() - 1) &&
                     (table.getSelectedRow() == -1)) {
-                rMax = rMax - 1;
+                // Do not decrement rMax if rMax becomes
+                // less than or equal to rMin
+                // else cells will not be painted
+                if (rMax - rMin > 1) {
+                    rMax = rMax - 1;
+                }
             }
         }
 
--- a/src/java.desktop/share/classes/javax/swing/text/html/StyleSheet.java	Wed Oct 03 15:54:35 2018 +0200
+++ b/src/java.desktop/share/classes/javax/swing/text/html/StyleSheet.java	Wed Oct 03 16:02:24 2018 +0200
@@ -2339,18 +2339,26 @@
          */
         void drawShape(Graphics g, CSS.Value type, int ax, int ay, int aw,
                        int ah, float align) {
-            // Align to bottom of shape.
-            int gap = isLeftToRight ? - (bulletgap + 8) : (aw + bulletgap);
+            final Object origAA = ((Graphics2D) g).getRenderingHint(
+                                             RenderingHints.KEY_ANTIALIASING);
+            ((Graphics2D) g).setRenderingHint(RenderingHints.KEY_ANTIALIASING,
+                                            RenderingHints.VALUE_ANTIALIAS_ON);
+            int size = g.getFont().getSize();
+
+            // Position shape to the middle of the html text.
+            int gap = isLeftToRight ? - (bulletgap + size/3) : (aw + bulletgap);
             int x = ax + gap;
-            int y = Math.max(ay, ay + (int)(align * ah) - 8);
+            int y = Math.max(ay, ay + (int)Math.ceil(ah/2));
 
             if (type == CSS.Value.SQUARE) {
-                g.drawRect(x, y, 8, 8);
+                g.drawRect(x, y, size/3, size/3);
             } else if (type == CSS.Value.CIRCLE) {
-                g.drawOval(x, y, 8, 8);
+                g.drawOval(x, y, size/3, size/3);
             } else {
-                g.fillOval(x, y, 8, 8);
+                g.fillOval(x, y, size/3, size/3);
             }
+            ((Graphics2D) g).setRenderingHint(RenderingHints.KEY_ANTIALIASING,
+                                              origAA);
         }
 
         /**
--- a/src/java.desktop/share/classes/sun/applet/AppletClassLoader.java	Wed Oct 03 15:54:35 2018 +0200
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,854 +0,0 @@
-/*
- * Copyright (c) 1995, 2018, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation.  Oracle designates this
- * particular file as subject to the "Classpath" exception as provided
- * by Oracle in the LICENSE file that accompanied this code.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-
-package sun.applet;
-
-import java.io.BufferedInputStream;
-import java.io.EOFException;
-import java.io.File;
-import java.io.FilePermission;
-import java.io.IOException;
-import java.io.InputStream;
-import java.net.MalformedURLException;
-import java.net.URL;
-import java.net.URLClassLoader;
-import java.net.URLConnection;
-import java.security.AccessControlContext;
-import java.security.AccessController;
-import java.security.CodeSource;
-import java.security.Permission;
-import java.security.PermissionCollection;
-import java.security.PrivilegedAction;
-import java.security.PrivilegedActionException;
-import java.security.PrivilegedExceptionAction;
-import java.util.Enumeration;
-import java.util.HashMap;
-import java.util.NoSuchElementException;
-
-import sun.awt.AppContext;
-import sun.awt.SunToolkit;
-import sun.net.www.ParseUtil;
-import sun.security.util.SecurityConstants;
-
-/**
- * This class defines the class loader for loading applet classes and
- * resources. It extends URLClassLoader to search the applet code base
- * for the class or resource after checking any loaded JAR files.
- */
-public class AppletClassLoader extends URLClassLoader {
-    private URL base;   /* applet code base URL */
-    private CodeSource codesource; /* codesource for the base URL */
-    private AccessControlContext acc;
-    private boolean exceptionStatus = false;
-
-    private final Object threadGroupSynchronizer = new Object();
-    private final Object grabReleaseSynchronizer = new Object();
-
-    private boolean codebaseLookup = true;
-    private volatile boolean allowRecursiveDirectoryRead = true;
-
-    /*
-     * Creates a new AppletClassLoader for the specified base URL.
-     */
-    protected AppletClassLoader(URL base) {
-        super(new URL[0]);
-        this.base = base;
-        this.codesource =
-            new CodeSource(base, (java.security.cert.Certificate[]) null);
-        acc = AccessController.getContext();
-    }
-
-    public void disableRecursiveDirectoryRead() {
-        allowRecursiveDirectoryRead = false;
-    }
-
-
-    /**
-     * Set the codebase lookup flag.
-     */
-    void setCodebaseLookup(boolean codebaseLookup)  {
-        this.codebaseLookup = codebaseLookup;
-    }
-
-    /*
-     * Returns the applet code base URL.
-     */
-    URL getBaseURL() {
-        return base;
-    }
-
-    /*
-     * Returns the URLs used for loading classes and resources.
-     */
-    public URL[] getURLs() {
-        URL[] jars = super.getURLs();
-        URL[] urls = new URL[jars.length + 1];
-        System.arraycopy(jars, 0, urls, 0, jars.length);
-        urls[urls.length - 1] = base;
-        return urls;
-    }
-
-    /*
-     * Adds the specified JAR file to the search path of loaded JAR files.
-     * Changed modifier to protected in order to be able to overwrite addJar()
-     * in PluginClassLoader.java
-     */
-    protected void addJar(String name) throws IOException {
-        URL url;
-        try {
-            url = new URL(base, name);
-        } catch (MalformedURLException e) {
-            throw new IllegalArgumentException("name");
-        }
-        addURL(url);
-        // DEBUG
-        //URL[] urls = getURLs();
-        //for (int i = 0; i < urls.length; i++) {
-        //    System.out.println("url[" + i + "] = " + urls[i]);
-        //}
-    }
-
-    /*
-     * Override loadClass so that class loading errors can be caught in
-     * order to print better error messages.
-     */
-    public synchronized Class<?> loadClass(String name, boolean resolve)
-        throws ClassNotFoundException
-    {
-        // First check if we have permission to access the package. This
-        // should go away once we've added support for exported packages.
-        int i = name.lastIndexOf('.');
-        if (i != -1) {
-            SecurityManager sm = System.getSecurityManager();
-            if (sm != null)
-                sm.checkPackageAccess(name.substring(0, i));
-        }
-        try {
-            return super.loadClass(name, resolve);
-        } catch (ClassNotFoundException e) {
-            throw e;
-        } catch (RuntimeException e) {
-            throw e;
-        } catch (Error e) {
-            throw e;
-        }
-    }
-
-    /*
-     * Finds the applet class with the specified name. First searches
-     * loaded JAR files then the applet code base for the class.
-     */
-    protected Class<?> findClass(String name) throws ClassNotFoundException {
-
-        int index = name.indexOf(';');
-        String cookie = "";
-        if(index != -1) {
-                cookie = name.substring(index, name.length());
-                name = name.substring(0, index);
-        }
-
-        // check loaded JAR files
-        try {
-            return super.findClass(name);
-        } catch (ClassNotFoundException e) {
-        }
-
-        // Otherwise, try loading the class from the code base URL
-
-        // 4668479: Option to turn off codebase lookup in AppletClassLoader
-        // during resource requests. [stanley.ho]
-        if (codebaseLookup == false)
-            throw new ClassNotFoundException(name);
-
-//      final String path = name.replace('.', '/').concat(".class").concat(cookie);
-        String encodedName = ParseUtil.encodePath(name.replace('.', '/'), false);
-        final String path = (new StringBuffer(encodedName)).append(".class").append(cookie).toString();
-        try {
-            byte[] b = AccessController.doPrivileged(
-                               new PrivilegedExceptionAction<byte[]>() {
-                public byte[] run() throws IOException {
-                   try {
-                        URL finalURL = new URL(base, path);
-
-                        // Make sure the codebase won't be modified
-                        if (base.getProtocol().equals(finalURL.getProtocol()) &&
-                            base.getHost().equals(finalURL.getHost()) &&
-                            base.getPort() == finalURL.getPort()) {
-                            return getBytes(finalURL);
-                        }
-                        else {
-                            return null;
-                        }
-                    } catch (Exception e) {
-                        return null;
-                    }
-                }
-            }, acc);
-
-            if (b != null) {
-                return defineClass(name, b, 0, b.length, codesource);
-            } else {
-                throw new ClassNotFoundException(name);
-            }
-        } catch (PrivilegedActionException e) {
-            throw new ClassNotFoundException(name, e.getException());
-        }
-    }
-
-    /**
-     * Returns the permissions for the given codesource object.
-     * The implementation of this method first calls super.getPermissions,
-     * to get the permissions
-     * granted by the super class, and then adds additional permissions
-     * based on the URL of the codesource.
-     * <p>
-     * If the protocol is "file"
-     * and the path specifies a file, permission is granted to read all files
-     * and (recursively) all files and subdirectories contained in
-     * that directory. This is so applets with a codebase of
-     * file:/blah/some.jar can read in file:/blah/, which is needed to
-     * be backward compatible. We also add permission to connect back to
-     * the "localhost".
-     *
-     * @param codesource the codesource
-     * @throws NullPointerException if {@code codesource} is {@code null}.
-     * @return the permissions granted to the codesource
-     */
-    protected PermissionCollection getPermissions(CodeSource codesource)
-    {
-        final PermissionCollection perms = super.getPermissions(codesource);
-
-        URL url = codesource.getLocation();
-
-        String path = null;
-        Permission p;
-
-        try {
-            p = url.openConnection().getPermission();
-        } catch (java.io.IOException ioe) {
-            p = null;
-        }
-
-        if (p instanceof FilePermission) {
-            path = p.getName();
-        } else if ((p == null) && (url.getProtocol().equals("file"))) {
-            path = url.getFile().replace('/', File.separatorChar);
-            path = ParseUtil.decode(path);
-        }
-
-        if (path != null) {
-            final String rawPath = path;
-            if (!path.endsWith(File.separator)) {
-                int endIndex = path.lastIndexOf(File.separatorChar);
-                if (endIndex != -1) {
-                        path = path.substring(0, endIndex + 1) + "-";
-                        perms.add(new FilePermission(path,
-                            SecurityConstants.FILE_READ_ACTION));
-                }
-            }
-            final File f = new File(rawPath);
-            final boolean isDirectory = f.isDirectory();
-            // grant codebase recursive read permission
-            // this should only be granted to non-UNC file URL codebase and
-            // the codesource path must either be a directory, or a file
-            // that ends with .jar or .zip
-            if (allowRecursiveDirectoryRead && (isDirectory ||
-                    rawPath.toLowerCase().endsWith(".jar") ||
-                    rawPath.toLowerCase().endsWith(".zip"))) {
-
-            Permission bperm;
-                try {
-                    bperm = base.openConnection().getPermission();
-                } catch (java.io.IOException ioe) {
-                    bperm = null;
-                }
-                if (bperm instanceof FilePermission) {
-                    String bpath = bperm.getName();
-                    if (bpath.endsWith(File.separator)) {
-                        bpath += "-";
-                    }
-                    perms.add(new FilePermission(bpath,
-                        SecurityConstants.FILE_READ_ACTION));
-                } else if ((bperm == null) && (base.getProtocol().equals("file"))) {
-                    String bpath = base.getFile().replace('/', File.separatorChar);
-                    bpath = ParseUtil.decode(bpath);
-                    if (bpath.endsWith(File.separator)) {
-                        bpath += "-";
-                    }
-                    perms.add(new FilePermission(bpath, SecurityConstants.FILE_READ_ACTION));
-                }
-
-            }
-        }
-        return perms;
-    }
-
-    /*
-     * Returns the contents of the specified URL as an array of bytes.
-     */
-    private static byte[] getBytes(URL url) throws IOException {
-        URLConnection uc = url.openConnection();
-        if (uc instanceof java.net.HttpURLConnection) {
-            java.net.HttpURLConnection huc = (java.net.HttpURLConnection) uc;
-            int code = huc.getResponseCode();
-            if (code >= java.net.HttpURLConnection.HTTP_BAD_REQUEST) {
-                throw new IOException("open HTTP connection failed.");
-            }
-        }
-        int len = uc.getContentLength();
-
-        // Fixed #4507227: Slow performance to load
-        // class and resources. [stanleyh]
-        //
-        // Use buffered input stream [stanleyh]
-        InputStream in = new BufferedInputStream(uc.getInputStream());
-
-        byte[] b;
-        try {
-            b = in.readAllBytes();
-            if (len != -1 && b.length != len)
-                throw new EOFException("Expected:" + len + ", read:" + b.length);
-        } finally {
-            in.close();
-        }
-        return b;
-    }
-
-    // Object for synchronization around getResourceAsStream()
-    private Object syncResourceAsStream = new Object();
-    private Object syncResourceAsStreamFromJar = new Object();
-
-    // Flag to indicate getResourceAsStream() is in call
-    private boolean resourceAsStreamInCall = false;
-    private boolean resourceAsStreamFromJarInCall = false;
-
-    /**
-     * Returns an input stream for reading the specified resource.
-     *
-     * The search order is described in the documentation for {@link
-     * #getResource(String)}.<p>
-     *
-     * @param  name the resource name
-     * @return an input stream for reading the resource, or {@code null}
-     *         if the resource could not be found
-     * @since  1.1
-     */
-    public InputStream getResourceAsStream(String name)
-    {
-
-        if (name == null) {
-            throw new NullPointerException("name");
-        }
-
-        try
-        {
-            InputStream is = null;
-
-            // Fixed #4507227: Slow performance to load
-            // class and resources. [stanleyh]
-            //
-            // The following is used to avoid calling
-            // AppletClassLoader.findResource() in
-            // super.getResourceAsStream(). Otherwise,
-            // unnecessary connection will be made.
-            //
-            synchronized(syncResourceAsStream)
-            {
-                resourceAsStreamInCall = true;
-
-                // Call super class
-                is = super.getResourceAsStream(name);
-
-                resourceAsStreamInCall = false;
-            }
-
-            // 4668479: Option to turn off codebase lookup in AppletClassLoader
-            // during resource requests. [stanley.ho]
-            if (codebaseLookup == true && is == null)
-            {
-                // If resource cannot be obtained,
-                // try to download it from codebase
-                URL url = new URL(base, ParseUtil.encodePath(name, false));
-                is = url.openStream();
-            }
-
-            return is;
-        }
-        catch (Exception e)
-        {
-            return null;
-        }
-    }
-
-
-    /**
-     * Returns an input stream for reading the specified resource from the
-     * the loaded jar files.
-     *
-     * The search order is described in the documentation for {@link
-     * #getResource(String)}.<p>
-     *
-     * @param  name the resource name
-     * @return an input stream for reading the resource, or {@code null}
-     *         if the resource could not be found
-     * @since  1.1
-     */
-    public InputStream getResourceAsStreamFromJar(String name) {
-
-        if (name == null) {
-            throw new NullPointerException("name");
-        }
-
-        try {
-            InputStream is = null;
-            synchronized(syncResourceAsStreamFromJar) {
-                resourceAsStreamFromJarInCall = true;
-                // Call super class
-                is = super.getResourceAsStream(name);
-                resourceAsStreamFromJarInCall = false;
-            }
-
-            return is;
-        } catch (Exception e) {
-            return null;
-        }
-    }
-
-
-    /*
-     * Finds the applet resource with the specified name. First checks
-     * loaded JAR files then the applet code base for the resource.
-     */
-    public URL findResource(String name) {
-        // check loaded JAR files
-        URL url = super.findResource(name);
-
-        // 6215746:  Disable META-INF/* lookup from codebase in
-        // applet/plugin classloader. [stanley.ho]
-        if (name.startsWith("META-INF/"))
-            return url;
-
-        // 4668479: Option to turn off codebase lookup in AppletClassLoader
-        // during resource requests. [stanley.ho]
-        if (codebaseLookup == false)
-            return url;
-
-        if (url == null)
-        {
-            //#4805170, if it is a call from Applet.getImage()
-            //we should check for the image only in the archives
-            boolean insideGetResourceAsStreamFromJar = false;
-                synchronized(syncResourceAsStreamFromJar) {
-                insideGetResourceAsStreamFromJar = resourceAsStreamFromJarInCall;
-            }
-
-            if (insideGetResourceAsStreamFromJar) {
-                return null;
-            }
-
-            // Fixed #4507227: Slow performance to load
-            // class and resources. [stanleyh]
-            //
-            // Check if getResourceAsStream is called.
-            //
-            boolean insideGetResourceAsStream = false;
-
-            synchronized(syncResourceAsStream)
-            {
-                insideGetResourceAsStream = resourceAsStreamInCall;
-            }
-
-            // If getResourceAsStream is called, don't
-            // trigger the following code. Otherwise,
-            // unnecessary connection will be made.
-            //
-            if (insideGetResourceAsStream == false)
-            {
-                // otherwise, try the code base
-                try {
-                    url = new URL(base, ParseUtil.encodePath(name, false));
-                    // check if resource exists
-                    if(!resourceExists(url))
-                        url = null;
-                } catch (Exception e) {
-                    // all exceptions, including security exceptions, are caught
-                    url = null;
-                }
-            }
-        }
-        return url;
-    }
-
-
-    private boolean resourceExists(URL url) {
-        // Check if the resource exists.
-        // It almost works to just try to do an openConnection() but
-        // HttpURLConnection will return true on HTTP_BAD_REQUEST
-        // when the requested name ends in ".html", ".htm", and ".txt"
-        // and we want to be able to handle these
-        //
-        // Also, cannot just open a connection for things like FileURLConnection,
-        // because they succeed when connecting to a nonexistent file.
-        // So, in those cases we open and close an input stream.
-        boolean ok = true;
-        try {
-            URLConnection conn = url.openConnection();
-            if (conn instanceof java.net.HttpURLConnection) {
-                java.net.HttpURLConnection hconn =
-                    (java.net.HttpURLConnection) conn;
-
-                // To reduce overhead, using http HEAD method instead of GET method
-                hconn.setRequestMethod("HEAD");
-
-                int code = hconn.getResponseCode();
-                if (code == java.net.HttpURLConnection.HTTP_OK) {
-                    return true;
-                }
-                if (code >= java.net.HttpURLConnection.HTTP_BAD_REQUEST) {
-                    return false;
-                }
-            } else {
-                /**
-                 * Fix for #4182052 - stanleyh
-                 *
-                 * The same connection should be reused to avoid multiple
-                 * HTTP connections
-                 */
-
-                // our best guess for the other cases
-                InputStream is = conn.getInputStream();
-                is.close();
-            }
-        } catch (Exception ex) {
-            ok = false;
-        }
-        return ok;
-    }
-
-    /*
-     * Returns an enumeration of all the applet resources with the specified
-     * name. First checks loaded JAR files then the applet code base for all
-     * available resources.
-     */
-    @Override
-    public Enumeration<URL> findResources(String name) throws IOException {
-
-        final Enumeration<URL> e = super.findResources(name);
-
-        // 6215746:  Disable META-INF/* lookup from codebase in
-        // applet/plugin classloader. [stanley.ho]
-        if (name.startsWith("META-INF/"))
-            return e;
-
-        // 4668479: Option to turn off codebase lookup in AppletClassLoader
-        // during resource requests. [stanley.ho]
-        if (codebaseLookup == false)
-            return e;
-
-        URL u = new URL(base, ParseUtil.encodePath(name, false));
-        if (!resourceExists(u)) {
-            u = null;
-        }
-
-        final URL url = u;
-        return new Enumeration<URL>() {
-            private boolean done;
-            public URL nextElement() {
-                if (!done) {
-                    if (e.hasMoreElements()) {
-                        return e.nextElement();
-                    }
-                    done = true;
-                    if (url != null) {
-                        return url;
-                    }
-                }
-                throw new NoSuchElementException();
-            }
-            public boolean hasMoreElements() {
-                return !done && (e.hasMoreElements() || url != null);
-            }
-        };
-    }
-
-    /*
-     * Load and resolve the file specified by the applet tag CODE
-     * attribute. The argument can either be the relative path
-     * of the class file itself or just the name of the class.
-     */
-    Class<?> loadCode(String name) throws ClassNotFoundException {
-        // first convert any '/' or native file separator to .
-        name = name.replace('/', '.');
-        name = name.replace(File.separatorChar, '.');
-
-        // deal with URL rewriting
-        String cookie = null;
-        int index = name.indexOf(';');
-        if(index != -1) {
-                cookie = name.substring(index, name.length());
-                name = name.substring(0, index);
-        }
-
-        // save that name for later
-        String fullName = name;
-        // then strip off any suffixes
-        if (name.endsWith(".class") || name.endsWith(".java")) {
-            name = name.substring(0, name.lastIndexOf('.'));
-        }
-        try {
-                if(cookie != null)
-                        name = (new StringBuffer(name)).append(cookie).toString();
-            return loadClass(name);
-        } catch (ClassNotFoundException e) {
-        }
-        // then if it didn't end with .java or .class, or in the
-        // really pathological case of a class named class or java
-        if(cookie != null)
-                fullName = (new StringBuffer(fullName)).append(cookie).toString();
-
-        return loadClass(fullName);
-    }
-
-    /*
-     * The threadgroup that the applets loaded by this classloader live
-     * in. In the sun.* implementation of applets, the security manager's
-     * (AppletSecurity) getThreadGroup returns the thread group of the
-     * first applet on the stack, which is the applet's thread group.
-     */
-    private AppletThreadGroup threadGroup;
-    private AppContext appContext;
-
-    public ThreadGroup getThreadGroup() {
-      synchronized (threadGroupSynchronizer) {
-        if (threadGroup == null || threadGroup.isDestroyed()) {
-            AccessController.doPrivileged(new PrivilegedAction<Object>() {
-                public Object run() {
-                    threadGroup = new AppletThreadGroup(base + "-threadGroup");
-                    // threadGroup.setDaemon(true);
-                    // threadGroup is now destroyed by AppContext.dispose()
-
-                    // Create the new AppContext from within a Thread belonging
-                    // to the newly created ThreadGroup, and wait for the
-                    // creation to complete before returning from this method.
-                    AppContextCreator creatorThread = new AppContextCreator(threadGroup);
-
-                    // Since this thread will later be used to launch the
-                    // applet's AWT-event dispatch thread and we want the applet
-                    // code executing the AWT callbacks to use their own class
-                    // loader rather than the system class loader, explicitly
-                    // set the context class loader to the AppletClassLoader.
-                    creatorThread.setContextClassLoader(AppletClassLoader.this);
-
-                    creatorThread.start();
-                    try {
-                        synchronized(creatorThread.syncObject) {
-                            while (!creatorThread.created) {
-                                creatorThread.syncObject.wait();
-                            }
-                        }
-                    } catch (InterruptedException e) { }
-                    appContext = creatorThread.appContext;
-                    return null;
-                }
-            });
-        }
-        return threadGroup;
-      }
-    }
-
-    /*
-     * Get the AppContext, if any, corresponding to this AppletClassLoader.
-     */
-    public AppContext getAppContext()  {
-        return appContext;
-    }
-
-    int usageCount = 0;
-
-    /**
-     * Grab this AppletClassLoader and its ThreadGroup/AppContext, so they
-     * won't be destroyed.
-     */
-public     void grab() {
-        synchronized(grabReleaseSynchronizer) {
-            usageCount++;
-        }
-        getThreadGroup(); // Make sure ThreadGroup/AppContext exist
-    }
-
-    protected void setExceptionStatus()
-    {
-        exceptionStatus = true;
-    }
-
-    public boolean getExceptionStatus()
-    {
-        return exceptionStatus;
-    }
-
-    /**
-     * Release this AppletClassLoader and its ThreadGroup/AppContext.
-     * If nothing else has grabbed this AppletClassLoader, its ThreadGroup
-     * and AppContext will be destroyed.
-     *
-     * Because this method may destroy the AppletClassLoader's ThreadGroup,
-     * this method should NOT be called from within the AppletClassLoader's
-     * ThreadGroup.
-     *
-     * Changed modifier to protected in order to be able to overwrite this
-     * function in PluginClassLoader.java
-     */
-    protected void release() {
-
-        AppContext tempAppContext = null;
-
-        synchronized(grabReleaseSynchronizer) {
-            if (usageCount > 1)  {
-                --usageCount;
-            } else {
-                synchronized(threadGroupSynchronizer) {
-                    tempAppContext = resetAppContext();
-                }
-            }
-        }
-
-        // Dispose appContext outside any sync block to
-        // prevent potential deadlock.
-        if (tempAppContext != null)  {
-            try {
-                tempAppContext.dispose(); // nuke the world!
-            } catch (IllegalThreadStateException e) { }
-        }
-    }
-
-    /*
-     * reset classloader's AppContext and ThreadGroup
-     * This method is for subclass PluginClassLoader to
-     * reset superclass's AppContext and ThreadGroup but do
-     * not dispose the AppContext. PluginClassLoader does not
-     * use UsageCount to decide whether to dispose AppContext
-     *
-     * @return previous AppContext
-     */
-    protected AppContext resetAppContext() {
-        AppContext tempAppContext = null;
-
-        synchronized(threadGroupSynchronizer) {
-            // Store app context in temp variable
-            tempAppContext = appContext;
-            usageCount = 0;
-            appContext = null;
-            threadGroup = null;
-        }
-        return tempAppContext;
-    }
-
-
-    // Hash map to store applet compatibility info
-    private HashMap<String, Boolean> jdk11AppletInfo = new HashMap<>();
-    private HashMap<String, Boolean> jdk12AppletInfo = new HashMap<>();
-
-    /**
-     * Set applet target level as JDK 1.1.
-     *
-     * @param clazz Applet class.
-     * @param bool true if JDK is targeted for JDK 1.1;
-     *             false otherwise.
-     */
-    void setJDK11Target(Class<?> clazz, boolean bool)
-    {
-         jdk11AppletInfo.put(clazz.toString(), Boolean.valueOf(bool));
-    }
-
-    /**
-     * Set applet target level as JDK 1.2.
-     *
-     * @param clazz Applet class.
-     * @param bool true if JDK is targeted for JDK 1.2;
-     *             false otherwise.
-     */
-    void setJDK12Target(Class<?> clazz, boolean bool)
-    {
-        jdk12AppletInfo.put(clazz.toString(), Boolean.valueOf(bool));
-    }
-
-    /**
-     * Determine if applet is targeted for JDK 1.1.
-     *
-     * @param  clazz Applet class.
-     * @return TRUE if applet is targeted for JDK 1.1;
-     *         FALSE if applet is not;
-     *         null if applet is unknown.
-     */
-    Boolean isJDK11Target(Class<?> clazz)
-    {
-        return jdk11AppletInfo.get(clazz.toString());
-    }
-
-    /**
-     * Determine if applet is targeted for JDK 1.2.
-     *
-     * @param  clazz Applet class.
-     * @return TRUE if applet is targeted for JDK 1.2;
-     *         FALSE if applet is not;
-     *         null if applet is unknown.
-     */
-    Boolean isJDK12Target(Class<?> clazz)
-    {
-        return jdk12AppletInfo.get(clazz.toString());
-    }
-}
-
-/*
- * The AppContextCreator class is used to create an AppContext from within
- * a Thread belonging to the new AppContext's ThreadGroup.  To wait for
- * this operation to complete before continuing, wait for the notifyAll()
- * operation on the syncObject to occur.
- */
-class AppContextCreator extends Thread {
-    Object syncObject = new Object();
-    AppContext appContext = null;
-    volatile boolean created = false;
-
-    /**
-     * Must call the 5-args super-class constructor to erase locals.
-     */
-    private AppContextCreator() {
-        throw new UnsupportedOperationException("Must erase locals");
-    }
-
-    AppContextCreator(ThreadGroup group)  {
-        super(group, null, "AppContextCreator", 0, false);
-    }
-
-    public void run()  {
-        appContext = SunToolkit.createNewAppContext();
-        created = true;
-        synchronized(syncObject) {
-            syncObject.notifyAll();
-        }
-    } // run()
-
-} // class AppContextCreator
--- a/src/java.desktop/share/classes/sun/applet/AppletSecurity.java	Wed Oct 03 15:54:35 2018 +0200
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,421 +0,0 @@
-/*
- * Copyright (c) 1995, 2018, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation.  Oracle designates this
- * particular file as subject to the "Classpath" exception as provided
- * by Oracle in the LICENSE file that accompanied this code.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-
-package sun.applet;
-
-import java.io.File;
-import java.io.FilePermission;
-import java.io.IOException;
-import java.io.FileDescriptor;
-import java.net.URL;
-import java.net.URLClassLoader;
-import java.net.InetAddress;
-import java.net.UnknownHostException;
-import java.net.SocketPermission;
-import java.util.Enumeration;
-import java.util.Iterator;
-import java.util.HashSet;
-import java.util.StringTokenizer;
-import java.security.*;
-import java.lang.reflect.*;
-import jdk.internal.misc.JavaNetURLClassLoaderAccess;
-import jdk.internal.misc.JavaSecurityAccess;
-import jdk.internal.misc.SharedSecrets;
-import sun.awt.AWTSecurityManager;
-import sun.awt.AppContext;
-import sun.awt.AWTPermissions;
-import sun.security.util.SecurityConstants;
-
-import static java.lang.StackWalker.*;
-import static java.lang.StackWalker.Option.*;
-
-
-/**
- * This class defines an applet security policy
- *
- */
-public
-class AppletSecurity extends AWTSecurityManager {
-    private static final JavaNetURLClassLoaderAccess JNUCLA
-            = SharedSecrets.getJavaNetURLClassLoaderAccess();
-    private static final JavaSecurityAccess JSA = SharedSecrets.getJavaSecurityAccess();
-
-    /**
-     * Construct and initialize.
-     */
-    public AppletSecurity() {
-        reset();
-    }
-
-    // Cache to store known restricted packages
-    private HashSet<String> restrictedPackages = new HashSet<>();
-
-    /**
-     * Reset from Properties
-     */
-    public void reset()
-    {
-        // Clear cache
-        restrictedPackages.clear();
-
-        AccessController.doPrivileged(new PrivilegedAction<Object>() {
-            public Object run()
-            {
-                // Enumerate system properties
-                Enumeration<?> e = System.getProperties().propertyNames();
-
-                while (e.hasMoreElements())
-                {
-                    String name = (String) e.nextElement();
-
-                    if (name != null && name.startsWith("package.restrict.access."))
-                    {
-                        String value = System.getProperty(name);
-
-                        if (value != null && value.equalsIgnoreCase("true"))
-                        {
-                            String pkg = name.substring(24);
-
-                            // Cache restricted packages
-                            restrictedPackages.add(pkg);
-                        }
-                    }
-                }
-                return null;
-            }
-        });
-    }
-
-    private static final StackWalker walker =
-        AccessController.doPrivileged(
-            (PrivilegedAction<StackWalker>) () ->
-                StackWalker.getInstance(RETAIN_CLASS_REFERENCE));
-    /**
-     * Returns the class loader of the most recently executing method from
-     * a class defined using a non-system class loader. A non-system
-     * class loader is defined as being a class loader that is not equal to
-     * the system class loader (as returned
-     * by {@link ClassLoader#getSystemClassLoader}) or one of its ancestors.
-     * <p>
-     * This method will return
-     * <code>null</code> in the following three cases:
-     * <ol>
-     *   <li>All methods on the execution stack are from classes
-     *   defined using the system class loader or one of its ancestors.
-     *
-     *   <li>All methods on the execution stack up to the first
-     *   "privileged" caller
-     *   (see {@link java.security.AccessController#doPrivileged})
-     *   are from classes
-     *   defined using the system class loader or one of its ancestors.
-     *
-     *   <li> A call to <code>checkPermission</code> with
-     *   <code>java.security.AllPermission</code> does not
-     *   result in a SecurityException.
-     * </ol>
-     *
-     * NOTE: This is an implementation of the SecurityManager.currentClassLoader
-     * method that uses StackWalker. SecurityManager.currentClassLoader
-     * has been removed from SE. This is a temporary workaround which is
-     * only needed while applets are still supported.
-     *
-     * @return  the class loader of the most recent occurrence on the stack
-     *          of a method from a class defined using a non-system class
-     *          loader.
-     */
-    private static ClassLoader currentClassLoader() {
-        StackFrame f =
-            walker.walk(s -> s.takeWhile(AppletSecurity::isNonPrivileged)
-                              .filter(AppletSecurity::isNonSystemFrame)
-                              .findFirst())
-                  .orElse(null);
-
-        SecurityManager sm = System.getSecurityManager();
-        if (f != null && sm != null) {
-            try {
-                sm.checkPermission(new AllPermission());
-            } catch (SecurityException se) {
-                return f.getDeclaringClass().getClassLoader();
-            }
-        }
-        return null;
-    }
-
-    /**
-     * Returns true if the StackFrame is not AccessController.doPrivileged.
-     */
-    private static boolean isNonPrivileged(StackFrame f) {
-        // possibly other doPrivileged variants
-        Class<?> c = f.getDeclaringClass();
-        return c == AccessController.class &&
-               f.getMethodName().equals("doPrivileged");
-    }
-
-    /**
-     * Returns true if the StackFrame is not from a class defined by the
-     * system class loader or one of its ancestors.
-     */
-    private static boolean isNonSystemFrame(StackFrame f) {
-        ClassLoader loader = ClassLoader.getSystemClassLoader();
-        ClassLoader ld = f.getDeclaringClass().getClassLoader();
-        if (ld == null || ld == loader) return false;
-
-        while ((loader = loader.getParent()) != null) {
-            if (ld == loader)
-                return false;
-        }
-        return true;
-    }
-
-    /**
-     * get the current (first) instance of an AppletClassLoader on the stack.
-     */
-    private AppletClassLoader currentAppletClassLoader()
-    {
-        // try currentClassLoader first
-        ClassLoader loader = currentClassLoader();
-
-        if ((loader == null) || (loader instanceof AppletClassLoader))
-            return (AppletClassLoader)loader;
-
-        // if that fails, get all the classes on the stack and check them.
-        Class<?>[] context = getClassContext();
-        for (int i = 0; i < context.length; i++) {
-            loader = context[i].getClassLoader();
-            if (loader instanceof AppletClassLoader)
-                return (AppletClassLoader)loader;
-        }
-
-        /*
-         * fix bug # 6433620 the logic here is : try to find URLClassLoader from
-         * class context, check its AccessControlContext to see if
-         * AppletClassLoader is in stack when it's created. for this kind of
-         * URLClassLoader, return the AppContext associated with the
-         * AppletClassLoader.
-         */
-        for (int i = 0; i < context.length; i++) {
-            final ClassLoader currentLoader = context[i].getClassLoader();
-
-            if (currentLoader instanceof URLClassLoader) {
-                URLClassLoader ld = (URLClassLoader)currentLoader;
-                loader = AccessController.doPrivileged(
-                    new PrivilegedAction<ClassLoader>() {
-                        public ClassLoader run() {
-
-                            AccessControlContext acc = null;
-                            ProtectionDomain[] pds = null;
-
-                            try {
-                                acc = JNUCLA.getAccessControlContext(ld);
-                                if (acc == null) {
-                                    return null;
-                                }
-
-                                pds = JSA.getProtectDomains(acc);
-                                if (pds == null) {
-                                    return null;
-                                }
-                            } catch (Exception e) {
-                                throw new UnsupportedOperationException(e);
-                            }
-
-                            for (int i=0; i<pds.length; i++) {
-                                ClassLoader cl = pds[i].getClassLoader();
-
-                                if (cl instanceof AppletClassLoader) {
-                                        return cl;
-                                }
-                            }
-
-                            return null;
-                        }
-                    });
-
-                if (loader != null) {
-                    return (AppletClassLoader) loader;
-                }
-            }
-        }
-
-        // if that fails, try the context class loader
-        loader = Thread.currentThread().getContextClassLoader();
-        if (loader instanceof AppletClassLoader)
-            return (AppletClassLoader)loader;
-
-        // no AppletClassLoaders on the stack
-        return (AppletClassLoader)null;
-    }
-
-    /**
-     * Returns true if this threadgroup is in the applet's own thread
-     * group. This will return false if there is no current class
-     * loader.
-     */
-    protected boolean inThreadGroup(ThreadGroup g) {
-        if (currentAppletClassLoader() == null)
-            return false;
-        else
-            return getThreadGroup().parentOf(g);
-    }
-
-    /**
-     * Returns true of the threadgroup of thread is in the applet's
-     * own threadgroup.
-     */
-    protected boolean inThreadGroup(Thread thread) {
-        return inThreadGroup(thread.getThreadGroup());
-    }
-
-    /**
-     * Applets are not allowed to manipulate threads outside
-     * applet thread groups. However a terminated thread no longer belongs
-     * to any group.
-     */
-    public void checkAccess(Thread t) {
-        /* When multiple applets is reloaded simultaneously, there will be
-         * multiple invocations to this method from plugin's SecurityManager.
-         * This method should not be synchronized to avoid deadlock when
-         * a page with multiple applets is reloaded
-         */
-        if ((t.getState() != Thread.State.TERMINATED) && !inThreadGroup(t)) {
-            checkPermission(SecurityConstants.MODIFY_THREAD_PERMISSION);
-        }
-    }
-
-    private boolean inThreadGroupCheck = false;
-
-    /**
-     * Applets are not allowed to manipulate thread groups outside
-     * applet thread groups.
-     */
-    public synchronized void checkAccess(ThreadGroup g) {
-        if (inThreadGroupCheck) {
-            // if we are in a recursive check, it is because
-            // inThreadGroup is calling appletLoader.getThreadGroup
-            // in that case, only do the super check, as appletLoader
-            // has a begin/endPrivileged
-            checkPermission(SecurityConstants.MODIFY_THREADGROUP_PERMISSION);
-        } else {
-            try {
-                inThreadGroupCheck = true;
-                if (!inThreadGroup(g)) {
-                    checkPermission(SecurityConstants.MODIFY_THREADGROUP_PERMISSION);
-                }
-            } finally {
-                inThreadGroupCheck = false;
-            }
-        }
-    }
-
-
-    /**
-     * Throws a {@code SecurityException} if the
-     * calling thread is not allowed to access the package specified by
-     * the argument.
-     * <p>
-     * This method is used by the {@code loadClass} method of class
-     * loaders.
-     * <p>
-     * The {@code checkPackageAccess} method for class
-     * {@code SecurityManager}  calls
-     * {@code checkPermission} with the
-     * {@code RuntimePermission("accessClassInPackage."+ pkgname)}
-     * permission.
-     *
-     * @param      pkgname   the package name.
-     * @exception  SecurityException  if the caller does not have
-     *             permission to access the specified package.
-     * @see        java.lang.ClassLoader#loadClass(java.lang.String, boolean)
-     */
-    public void checkPackageAccess(final String pkgname) {
-
-        // first see if the VM-wide policy allows access to this package
-        super.checkPackageAccess(pkgname);
-
-        // now check the list of restricted packages
-        for (Iterator<String> iter = restrictedPackages.iterator(); iter.hasNext();)
-        {
-            String pkg = iter.next();
-
-            // Prevent matching "sun" and "sunir" even if they
-            // starts with similar beginning characters
-            //
-            if (pkgname.equals(pkg) || pkgname.startsWith(pkg + "."))
-            {
-                checkPermission(new java.lang.RuntimePermission
-                            ("accessClassInPackage." + pkgname));
-            }
-        }
-    }
-
-    /**
-     * Returns the thread group of the applet. We consult the classloader
-     * if there is one.
-     */
-    public ThreadGroup getThreadGroup() {
-        /* If any applet code is on the execution stack, we return
-           that applet's ThreadGroup.  Otherwise, we use the default
-           behavior. */
-        AppletClassLoader appletLoader = currentAppletClassLoader();
-        ThreadGroup loaderGroup = (appletLoader == null) ? null
-                                          : appletLoader.getThreadGroup();
-        if (loaderGroup != null) {
-            return loaderGroup;
-        } else {
-            return super.getThreadGroup();
-        }
-    } // getThreadGroup()
-
-    /**
-      * Get the AppContext corresponding to the current context.
-      * The default implementation returns null, but this method
-      * may be overridden by various SecurityManagers
-      * (e.g. AppletSecurity) to index AppContext objects by the
-      * calling context.
-      *
-      * @return  the AppContext corresponding to the current context.
-      * @see     sun.awt.AppContext
-      * @see     java.lang.SecurityManager
-      * @since   1.2.1
-      */
-    public AppContext getAppContext() {
-        AppletClassLoader appletLoader = currentAppletClassLoader();
-
-        if (appletLoader == null) {
-            return null;
-        } else {
-            AppContext context =  appletLoader.getAppContext();
-
-            // context == null when some thread in applet thread group
-            // has not been destroyed in AppContext.dispose()
-            if (context == null) {
-                throw new SecurityException("Applet classloader has invalid AppContext");
-            }
-
-            return context;
-        }
-    }
-
-} // class AppletSecurity
--- a/src/java.desktop/share/classes/sun/applet/AppletThreadGroup.java	Wed Oct 03 15:54:35 2018 +0200
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,64 +0,0 @@
-/*
- * Copyright (c) 1995, 1997, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation.  Oracle designates this
- * particular file as subject to the "Classpath" exception as provided
- * by Oracle in the LICENSE file that accompanied this code.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-
-package sun.applet;
-
-/**
- * This class defines an applet thread group.
- *
- * @author      Arthur van Hoff
- */
-public class AppletThreadGroup extends ThreadGroup {
-
-    /**
-     * Constructs a new thread group for an applet.
-     * The parent of this new group is the thread
-     * group of the currently running thread.
-     *
-     * @param   name   the name of the new thread group.
-     */
-    public AppletThreadGroup(String name) {
-        this(Thread.currentThread().getThreadGroup(), name);
-    }
-
-    /**
-     * Creates a new thread group for an applet.
-     * The parent of this new group is the specified
-     * thread group.
-     *
-     * @param     parent   the parent thread group.
-     * @param     name     the name of the new thread group.
-     * @exception  NullPointerException  if the thread group argument is
-     *               {@code null}.
-     * @exception  SecurityException  if the current thread cannot create a
-     *               thread in the specified thread group.
-     * @see     java.lang.SecurityException
-     * @since   1.1.1
-     */
-    public AppletThreadGroup(ThreadGroup parent, String name) {
-        super(parent, name);
-        setMaxPriority(Thread.NORM_PRIORITY - 1);
-    }
-}
--- a/src/java.desktop/share/classes/sun/awt/AWTAccessor.java	Wed Oct 03 15:54:35 2018 +0200
+++ b/src/java.desktop/share/classes/sun/awt/AWTAccessor.java	Wed Oct 03 16:02:24 2018 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2008, 2017, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2008, 2018, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -295,20 +295,11 @@
          */
         void updateWindow(Window window);
 
-        /** Get the size of the security warning.
-         */
-        Dimension getSecurityWarningSize(Window w);
-
         /**
          * Set the size of the security warning.
          */
         void setSecurityWarningSize(Window w, int width, int height);
 
-        /** Set the position of the security warning.
-         */
-        void setSecurityWarningPosition(Window w, Point2D point,
-                float alignmentX, float alignmentY);
-
         /** Request to recalculate the new position of the security warning for
          * the given window size/location as reported by the native system.
          */
--- a/src/java.desktop/share/classes/sun/awt/HToolkit.java	Wed Oct 03 15:54:35 2018 +0200
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,317 +0,0 @@
-/*
- * Copyright (c) 2011, 2017, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation.  Oracle designates this
- * particular file as subject to the "Classpath" exception as provided
- * by Oracle in the LICENSE file that accompanied this code.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-
-package sun.awt;
-
-import java.awt.*;
-import java.awt.datatransfer.Clipboard;
-import java.awt.dnd.DragGestureListener;
-import java.awt.dnd.DragGestureRecognizer;
-import java.awt.dnd.DragSource;
-import java.awt.im.InputMethodHighlight;
-import java.awt.im.spi.InputMethodDescriptor;
-import java.awt.image.ColorModel;
-import java.awt.peer.FramePeer;
-import java.awt.peer.KeyboardFocusManagerPeer;
-import java.awt.peer.SystemTrayPeer;
-import java.awt.peer.TrayIconPeer;
-import java.util.Map;
-import java.util.Properties;
-
-/*
- * HToolkit is a platform independent Toolkit used
- * with the HeadlessToolkit.  It is primarily used
- * in embedded JRE's that do not have sun/awt/X11 classes.
- */
-public final class HToolkit extends SunToolkit implements ComponentFactory {
-
-    private static final KeyboardFocusManagerPeer kfmPeer = new KeyboardFocusManagerPeer() {
-        @Override
-        public void setCurrentFocusedWindow(Window win) {}
-        @Override
-        public Window getCurrentFocusedWindow() { return null; }
-        @Override
-        public void setCurrentFocusOwner(Component comp) {}
-        @Override
-        public Component getCurrentFocusOwner() { return null; }
-        @Override
-        public void clearGlobalFocusOwner(Window activeWindow) {}
-    };
-
-    public HToolkit() {
-    }
-
-    /*
-     * Component peer objects - unsupported.
-     */
-
-    @Override
-    public FramePeer createLightweightFrame(LightweightFrame target)
-        throws HeadlessException {
-        throw new HeadlessException();
-    }
-
-    @Override
-    public KeyboardFocusManagerPeer getKeyboardFocusManagerPeer() {
-        // See 6833019.
-        return kfmPeer;
-    }
-
-    @Override
-    public TrayIconPeer createTrayIcon(TrayIcon target)
-      throws HeadlessException {
-        throw new HeadlessException();
-    }
-
-    @Override
-    public SystemTrayPeer createSystemTray(SystemTray target)
-      throws HeadlessException {
-        throw new HeadlessException();
-    }
-
-    @Override
-    public boolean isTraySupported() {
-        return false;
-    }
-
-    public GlobalCursorManager getGlobalCursorManager()
-        throws HeadlessException {
-        throw new HeadlessException();
-    }
-
-    /*
-     * Headless toolkit - unsupported.
-     */
-    @Override
-    protected void loadSystemColors(int[] systemColors)
-        throws HeadlessException {
-        throw new HeadlessException();
-    }
-
-    @Override
-    public ColorModel getColorModel()
-        throws HeadlessException {
-        throw new HeadlessException();
-    }
-
-    @Override
-    public int getScreenResolution()
-        throws HeadlessException {
-        throw new HeadlessException();
-    }
-
-    @Override
-    public Map<java.awt.font.TextAttribute, ?> mapInputMethodHighlight(
-            InputMethodHighlight highlight)
-        throws HeadlessException {
-        throw new HeadlessException();
-    }
-
-    @Override
-    @Deprecated(since = "10")
-    public int getMenuShortcutKeyMask()
-        throws HeadlessException {
-        throw new HeadlessException();
-    }
-
-    @Override
-    public int getMenuShortcutKeyMaskEx()
-        throws HeadlessException {
-        throw new HeadlessException();
-    }
-
-    @Override
-    public boolean getLockingKeyState(int keyCode)
-        throws UnsupportedOperationException {
-        throw new HeadlessException();
-    }
-
-    @Override
-    public void setLockingKeyState(int keyCode, boolean on)
-        throws UnsupportedOperationException {
-        throw new HeadlessException();
-    }
-
-    @Override
-    public Cursor createCustomCursor(Image cursor, Point hotSpot, String name)
-        throws IndexOutOfBoundsException, HeadlessException {
-        throw new HeadlessException();
-    }
-
-    @Override
-    public Dimension getBestCursorSize(int preferredWidth, int preferredHeight)
-        throws HeadlessException {
-        throw new HeadlessException();
-    }
-
-    @Override
-    public int getMaximumCursorColors()
-        throws HeadlessException {
-        throw new HeadlessException();
-    }
-
-    @Override
-    public <T extends DragGestureRecognizer> T
-        createDragGestureRecognizer(Class<T> abstractRecognizerClass,
-                                    DragSource ds, Component c,
-                                    int srcActions, DragGestureListener dgl)
-    {
-        return null;
-    }
-
-    @Override
-    public Dimension getScreenSize()
-        throws HeadlessException {
-        throw new HeadlessException();
-    }
-
-    @Override
-    public Insets getScreenInsets(GraphicsConfiguration gc)
-        throws HeadlessException {
-        throw new HeadlessException();
-    }
-
-    @Override
-    public void setDynamicLayout(boolean dynamic)
-        throws HeadlessException {
-        throw new HeadlessException();
-    }
-
-    @Override
-    protected boolean isDynamicLayoutSet()
-        throws HeadlessException {
-        throw new HeadlessException();
-    }
-
-    @Override
-    public boolean isDynamicLayoutActive()
-        throws HeadlessException {
-        throw new HeadlessException();
-    }
-
-    @Override
-    public Clipboard getSystemClipboard()
-        throws HeadlessException {
-        throw new HeadlessException();
-    }
-
-    /*
-     * Printing
-     */
-    @Override
-    public PrintJob getPrintJob(Frame frame, String jobtitle,
-        JobAttributes jobAttributes,
-        PageAttributes pageAttributes) {
-        if (frame != null) {
-            // Should never happen
-            throw new HeadlessException();
-        }
-        throw new IllegalArgumentException(
-                "PrintJob not supported in a headless environment");
-    }
-
-    @Override
-    public PrintJob getPrintJob(Frame frame, String doctitle, Properties props)
-    {
-        if (frame != null) {
-            // Should never happen
-            throw new HeadlessException();
-        }
-        throw new IllegalArgumentException(
-                "PrintJob not supported in a headless environment");
-    }
-
-    /*
-     * Headless toolkit - supported.
-     */
-
-    @Override
-    public void sync() {
-        // Do nothing
-    }
-
-    @Override
-    protected boolean syncNativeQueue(final long timeout) {
-        return false;
-    }
-
-    @Override
-    public void beep() {
-        // Send alert character
-        System.out.write(0x07);
-    }
-
-    /*
-     * Modality
-     */
-    @Override
-    public boolean isModalityTypeSupported(Dialog.ModalityType modalityType) {
-        return false;
-    }
-
-    @Override
-    public boolean isModalExclusionTypeSupported(Dialog.ModalExclusionType exclusionType) {
-        return false;
-    }
-
-    @Override
-    public boolean isDesktopSupported() {
-        return false;
-    }
-
-    @Override
-    public boolean isTaskbarSupported() {
-        return false;
-    }
-
-    public boolean isWindowOpacityControlSupported() {
-        return false;
-    }
-
-    @Override
-    public boolean isWindowShapingSupported() {
-        return false;
-    }
-
-    @Override
-    public boolean isWindowTranslucencySupported() {
-        return false;
-    }
-
-    @Override
-    public  void grab(Window w) { }
-
-    @Override
-    public void ungrab(Window w) { }
-
-    protected boolean syncNativeQueue() { return false; }
-
-    @Override
-    public InputMethodDescriptor getInputMethodAdapterDescriptor()
-        throws AWTException
-    {
-        return (InputMethodDescriptor)null;
-    }
-}
--- a/src/java.desktop/share/classes/sun/font/CMap.java	Wed Oct 03 15:54:35 2018 +0200
+++ b/src/java.desktop/share/classes/sun/font/CMap.java	Wed Oct 03 16:02:24 2018 +0200
@@ -566,6 +566,7 @@
 
         char getGlyph(int charCode) {
 
+            final int origCharCode = charCode;
             int index = 0;
             char glyphCode = 0;
 
@@ -637,8 +638,8 @@
                     }
                 }
             }
-            if (glyphCode != 0) {
-            //System.err.println("cc="+Integer.toHexString((int)charCode) + " gc="+(int)glyphCode);
+            if (glyphCode == 0) {
+              glyphCode = getFormatCharGlyph(origCharCode);
             }
             return glyphCode;
         }
@@ -804,6 +805,7 @@
         }
 
         char getGlyph(int charCode) {
+            final int origCharCode = charCode;
             int controlGlyph = getControlCodeGlyph(charCode, true);
             if (controlGlyph >= 0) {
                 return (char)controlGlyph;
@@ -859,7 +861,7 @@
                     return glyphCode;
                 }
             }
-            return 0;
+            return getFormatCharGlyph(origCharCode);
         }
     }
 
@@ -883,6 +885,7 @@
          }
 
          char getGlyph(int charCode) {
+            final int origCharCode = charCode;
             int controlGlyph = getControlCodeGlyph(charCode, true);
             if (controlGlyph >= 0) {
                 return (char)controlGlyph;
@@ -894,7 +897,7 @@
 
              charCode -= firstCode;
              if (charCode < 0 || charCode >= entryCount) {
-                  return 0;
+                  return getFormatCharGlyph(origCharCode);
              } else {
                   return glyphIdArray[charCode];
              }
@@ -1032,6 +1035,7 @@
         }
 
         char getGlyph(int charCode) {
+            final int origCharCode = charCode;
             int controlGlyph = getControlCodeGlyph(charCode, false);
             if (controlGlyph >= 0) {
                 return (char)controlGlyph;
@@ -1057,7 +1061,7 @@
                     (startGlyphID[range] + (charCode - startCharCode[range]));
             }
 
-            return 0;
+            return getFormatCharGlyph(origCharCode);
         }
 
     }
@@ -1079,16 +1083,21 @@
             case 0x000a:
             case 0x000d: return CharToGlyphMapper.INVISIBLE_GLYPH_ID;
             }
-        } else if (charCode >= 0x200c) {
+         } else if (noSurrogates && charCode >= 0xFFFF) {
+            return 0;
+        }
+        return -1;
+    }
+
+    final char getFormatCharGlyph(int charCode) {
+        if (charCode >= 0x200c) {
             if ((charCode <= 0x200f) ||
                 (charCode >= 0x2028 && charCode <= 0x202e) ||
                 (charCode >= 0x206a && charCode <= 0x206f)) {
-                return CharToGlyphMapper.INVISIBLE_GLYPH_ID;
-            } else if (noSurrogates && charCode >= 0xFFFF) {
-                return 0;
+                return (char)CharToGlyphMapper.INVISIBLE_GLYPH_ID;
             }
         }
-        return -1;
+        return 0;
     }
 
     static class UVS {
--- a/src/java.desktop/share/classes/sun/font/SunFontManager.java	Wed Oct 03 15:54:35 2018 +0200
+++ b/src/java.desktop/share/classes/sun/font/SunFontManager.java	Wed Oct 03 16:02:24 2018 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2008, 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2008, 2018, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -2740,7 +2740,7 @@
                 new java.security.PrivilegedAction<Object>() {
                         public Object run() {
                             SecurityManager sm = System.getSecurityManager();
-                            return sm instanceof sun.applet.AppletSecurity;
+                            return sm instanceof sun.awt.AWTSecurityManager;
                         }
                     });
         return appletSM.booleanValue();
--- a/src/java.desktop/share/classes/sun/font/SunLayoutEngine.java	Wed Oct 03 15:54:35 2018 +0200
+++ b/src/java.desktop/share/classes/sun/font/SunLayoutEngine.java	Wed Oct 03 16:02:24 2018 +0200
@@ -35,6 +35,7 @@
 import java.lang.ref.SoftReference;
 import java.util.concurrent.ConcurrentHashMap;
 import java.util.Locale;
+import java.util.WeakHashMap;
 
 /*
  * different ways to do this
@@ -148,17 +149,30 @@
         this.key = key;
     }
 
+    static WeakHashMap<Font2D, Boolean> aatInfo = new WeakHashMap<>();
+
     private boolean isAAT(Font2D font) {
+       Boolean aatObj;
+       synchronized (aatInfo) {
+           aatObj = aatInfo.get(font);
+       }
+       if (aatObj != null) {
+          return aatObj.booleanValue();
+       }
+       boolean aat = false;
        if (font instanceof TrueTypeFont) {
            TrueTypeFont ttf = (TrueTypeFont)font;
-           return ttf.getDirectoryEntry(TrueTypeFont.morxTag) != null ||
+           aat =  ttf.getDirectoryEntry(TrueTypeFont.morxTag) != null ||
                   ttf.getDirectoryEntry(TrueTypeFont.mortTag) != null;
        } else if (font instanceof PhysicalFont) {
            PhysicalFont pf = (PhysicalFont)font;
-           return pf.getTableBytes(TrueTypeFont.morxTag) != null ||
+           aat =  pf.getTableBytes(TrueTypeFont.morxTag) != null ||
                   pf.getTableBytes(TrueTypeFont.mortTag) != null;
        }
-       return false;
+       synchronized (aatInfo) {
+           aatInfo.put(font, Boolean.valueOf(aat));
+       }
+       return aat;
     }
 
     public void layout(FontStrikeDesc desc, float[] mat, float ptSize, int gmask,
--- a/src/java.desktop/share/classes/sun/java2d/marlin/DMarlinRenderingEngine.java	Wed Oct 03 15:54:35 2018 +0200
+++ b/src/java.desktop/share/classes/sun/java2d/marlin/DMarlinRenderingEngine.java	Wed Oct 03 16:02:24 2018 +0200
@@ -31,6 +31,7 @@
 import java.awt.geom.Path2D;
 import java.awt.geom.PathIterator;
 import java.security.AccessController;
+import java.util.Arrays;
 import sun.awt.geom.PathConsumer2D;
 import static sun.java2d.marlin.MarlinUtils.logInfo;
 import sun.java2d.ReentrantContextProvider;
@@ -334,7 +335,6 @@
 
         int dashLen = -1;
         boolean recycleDashes = false;
-        double scale = 1.0d;
         double[] dashesD = null;
 
         // Ensure converting dashes to double precision:
@@ -375,7 +375,7 @@
             // a*b == -c*d && a*a+c*c == b*b+d*d. In the actual check below, we
             // leave a bit of room for error.
             if (nearZero(a*b + c*d) && nearZero(a*a + c*c - (b*b + d*d))) {
-                scale =  Math.sqrt(a*a + c*c);
+                final double scale = Math.sqrt(a*a + c*c);
 
                 if (dashesD != null) {
                     for (int i = 0; i < dashLen; i++) {
@@ -427,7 +427,7 @@
         pc2d = transformerPC2D.deltaTransformConsumer(pc2d, strokerat);
 
         // stroker will adjust the clip rectangle (width / miter limit):
-        pc2d = rdrCtx.stroker.init(pc2d, width, caps, join, miterlimit, scale,
+        pc2d = rdrCtx.stroker.init(pc2d, width, caps, join, miterlimit,
                 (dashesD == null));
 
         // Curve Monotizer:
@@ -834,10 +834,26 @@
                 // Define the initial clip bounds:
                 final double[] clipRect = rdrCtx.clipRect;
 
-                clipRect[0] = clip.getLoY();
-                clipRect[1] = clip.getLoY() + clip.getHeight();
-                clipRect[2] = clip.getLoX();
-                clipRect[3] = clip.getLoX() + clip.getWidth();
+                // Adjust the clipping rectangle with the renderer offsets
+                final double rdrOffX = DRenderer.RDR_OFFSET_X;
+                final double rdrOffY = DRenderer.RDR_OFFSET_Y;
+
+                // add a small rounding error:
+                final double margin = 1e-3d;
+
+                clipRect[0] = clip.getLoY()
+                                - margin + rdrOffY;
+                clipRect[1] = clip.getLoY() + clip.getHeight()
+                                + margin + rdrOffY;
+                clipRect[2] = clip.getLoX()
+                                - margin + rdrOffX;
+                clipRect[3] = clip.getLoX() + clip.getWidth()
+                                + margin + rdrOffX;
+
+                if (MarlinConst.DO_LOG_CLIP) {
+                    MarlinUtils.logInfo("clipRect (clip): "
+                                        + Arrays.toString(rdrCtx.clipRect));
+                }
 
                 // Enable clipping:
                 rdrCtx.doClip = true;
--- a/src/java.desktop/share/classes/sun/java2d/marlin/DRendererContext.java	Wed Oct 03 15:54:35 2018 +0200
+++ b/src/java.desktop/share/classes/sun/java2d/marlin/DRendererContext.java	Wed Oct 03 16:02:24 2018 +0200
@@ -85,6 +85,8 @@
     boolean closedPath = false;
     // clip rectangle (ymin, ymax, xmin, xmax):
     final double[] clipRect = new double[4];
+    // clip inverse scale (mean) to adjust length checks
+    double clipInvScale = 0.0d;
     // CurveBasicMonotonizer instance
     final CurveBasicMonotonizer monotonizer;
     // CurveClipSplitter instance
@@ -105,7 +107,6 @@
 
     final PathConsumer2DAdapter p2dAdapter = new PathConsumer2DAdapter();
 
-
     /**
      * Constructor
      *
@@ -162,6 +163,7 @@
         stroking   = 0;
         doClip     = false;
         closedPath = false;
+        clipInvScale = 0.0d;
 
         // if context is maked as DIRTY:
         if (dirty) {
--- a/src/java.desktop/share/classes/sun/java2d/marlin/DStroker.java	Wed Oct 03 15:54:35 2018 +0200
+++ b/src/java.desktop/share/classes/sun/java2d/marlin/DStroker.java	Wed Oct 03 16:02:24 2018 +0200
@@ -139,7 +139,6 @@
      * <code>JOIN_MITER</code>, <code>JOIN_ROUND</code> or
      * <code>JOIN_BEVEL</code>.
      * @param miterLimit the desired miter limit
-     * @param scale scaling factor applied to clip boundaries
      * @param subdivideCurves true to indicate to subdivide curves, false if dasher does
      * @return this instance
      */
@@ -148,7 +147,6 @@
                   final int capStyle,
                   final int joinStyle,
                   final double miterLimit,
-                  final double scale,
                   final boolean subdivideCurves)
     {
         this.out = pc2d;
@@ -169,7 +167,6 @@
 
         if (rdrCtx.doClip) {
             // Adjust the clipping rectangle with the stroker margin (miter limit, width)
-            double rdrOffX = 0.0d, rdrOffY = 0.0d;
             double margin = lineWidth2;
 
             if (capStyle == CAP_SQUARE) {
@@ -178,23 +175,21 @@
             if ((joinStyle == JOIN_MITER) && (margin < limit)) {
                 margin = limit;
             }
-            if (scale != 1.0d) {
-                margin *= scale;
-                rdrOffX = scale * DRenderer.RDR_OFFSET_X;
-                rdrOffY = scale * DRenderer.RDR_OFFSET_Y;
-            }
-            // add a small rounding error:
-            margin += 1e-3d;
 
             // bounds as half-open intervals: minX <= x < maxX and minY <= y < maxY
             // adjust clip rectangle (ymin, ymax, xmin, xmax):
             final double[] _clipRect = rdrCtx.clipRect;
-            _clipRect[0] -= margin - rdrOffY;
-            _clipRect[1] += margin + rdrOffY;
-            _clipRect[2] -= margin - rdrOffX;
-            _clipRect[3] += margin + rdrOffX;
+            _clipRect[0] -= margin;
+            _clipRect[1] += margin;
+            _clipRect[2] -= margin;
+            _clipRect[3] += margin;
             this.clipRect = _clipRect;
 
+            if (MarlinConst.DO_LOG_CLIP) {
+                MarlinUtils.logInfo("clipRect (stroker): "
+                                    + Arrays.toString(rdrCtx.clipRect));
+            }
+
             // initialize curve splitter here for stroker & dasher:
             if (DO_CLIP_SUBDIVIDER) {
                 subdivide = subdivideCurves;
@@ -304,13 +299,9 @@
         // If it is >=0, we know that abs(ext) is <= 90 degrees, so we only
         // need 1 curve to approximate the circle section that joins omx,omy
         // and mx,my.
-        final int numCurves = (cosext >= 0.0d) ? 1 : 2;
-
-        switch (numCurves) {
-        case 1:
+        if (cosext >= 0.0d) {
             drawBezApproxForArc(cx, cy, omx, omy, mx, my, rev);
-            break;
-        case 2:
+        } else {
             // we need to split the arc into 2 arcs spanning the same angle.
             // The point we want will be one of the 2 intersections of the
             // perpendicular bisector of the chord (omx,omy)->(mx,my) and the
@@ -339,8 +330,6 @@
             }
             drawBezApproxForArc(cx, cy, omx, omy, mmx, mmy, rev);
             drawBezApproxForArc(cx, cy, mmx, mmy, mx, my, rev);
-            break;
-        default:
         }
     }
 
--- a/src/java.desktop/share/classes/sun/java2d/marlin/DTransformingPathConsumer2D.java	Wed Oct 03 15:54:35 2018 +0200
+++ b/src/java.desktop/share/classes/sun/java2d/marlin/DTransformingPathConsumer2D.java	Wed Oct 03 16:02:24 2018 +0200
@@ -119,44 +119,56 @@
                 // Scale only
                 if (rdrCtx.doClip) {
                     // adjust clip rectangle (ymin, ymax, xmin, xmax):
-                    adjustClipScale(rdrCtx.clipRect, mxx, myy);
+                    rdrCtx.clipInvScale = adjustClipScale(rdrCtx.clipRect,
+                        mxx, myy);
                 }
                 return dt_DeltaScaleFilter.init(out, mxx, myy);
             }
         } else {
             if (rdrCtx.doClip) {
                 // adjust clip rectangle (ymin, ymax, xmin, xmax):
-                adjustClipInverseDelta(rdrCtx.clipRect, mxx, mxy, myx, myy);
+                rdrCtx.clipInvScale = adjustClipInverseDelta(rdrCtx.clipRect,
+                    mxx, mxy, myx, myy);
             }
             return dt_DeltaTransformFilter.init(out, mxx, mxy, myx, myy);
         }
     }
 
-    private static void adjustClipOffset(final double[] clipRect) {
-        clipRect[0] += Renderer.RDR_OFFSET_Y;
-        clipRect[1] += Renderer.RDR_OFFSET_Y;
-        clipRect[2] += Renderer.RDR_OFFSET_X;
-        clipRect[3] += Renderer.RDR_OFFSET_X;
+    private static double adjustClipScale(final double[] clipRect,
+                                          final double mxx, final double myy)
+    {
+        // Adjust the clipping rectangle (iv_DeltaScaleFilter):
+        final double scaleY = 1.0d / myy;
+        clipRect[0] *= scaleY;
+        clipRect[1] *= scaleY;
+
+        if (clipRect[1] < clipRect[0]) {
+            double tmp = clipRect[0];
+            clipRect[0] = clipRect[1];
+            clipRect[1] = tmp;
+        }
+
+        final double scaleX = 1.0d / mxx;
+        clipRect[2] *= scaleX;
+        clipRect[3] *= scaleX;
+
+        if (clipRect[3] < clipRect[2]) {
+            double tmp = clipRect[2];
+            clipRect[2] = clipRect[3];
+            clipRect[3] = tmp;
+        }
+
+        if (MarlinConst.DO_LOG_CLIP) {
+                MarlinUtils.logInfo("clipRect (ClipScale): "
+                                    + Arrays.toString(clipRect));
+        }
+        return 0.5d * (Math.abs(scaleX) + Math.abs(scaleY));
     }
 
-    private static void adjustClipScale(final double[] clipRect,
-                                        final double mxx, final double myy)
+    private static double adjustClipInverseDelta(final double[] clipRect,
+                                                 final double mxx, final double mxy,
+                                                 final double myx, final double myy)
     {
-        adjustClipOffset(clipRect);
-
-        // Adjust the clipping rectangle (iv_DeltaScaleFilter):
-        clipRect[0] /= myy;
-        clipRect[1] /= myy;
-        clipRect[2] /= mxx;
-        clipRect[3] /= mxx;
-    }
-
-    private static void adjustClipInverseDelta(final double[] clipRect,
-                                               final double mxx, final double mxy,
-                                               final double myx, final double myy)
-    {
-        adjustClipOffset(clipRect);
-
         // Adjust the clipping rectangle (iv_DeltaTransformFilter):
         final double det = mxx * myy - mxy * myx;
         final double imxx =  myy / det;
@@ -198,6 +210,16 @@
         clipRect[1] = ymax;
         clipRect[2] = xmin;
         clipRect[3] = xmax;
+
+        if (MarlinConst.DO_LOG_CLIP) {
+                MarlinUtils.logInfo("clipRect (ClipInverseDelta): "
+                                    + Arrays.toString(clipRect));
+        }
+
+        final double scaleX = Math.sqrt(imxx * imxx + imxy * imxy);
+        final double scaleY = Math.sqrt(imyx * imyx + imyy * imyy);
+
+        return 0.5d * (scaleX + scaleY);
     }
 
     DPathConsumer2D inverseDeltaTransformConsumer(DPathConsumer2D out,
@@ -215,7 +237,7 @@
             if (mxx == 1.0d && myy == 1.0d) {
                 return out;
             } else {
-                return iv_DeltaScaleFilter.init(out, 1.0d/mxx, 1.0d/myy);
+                return iv_DeltaScaleFilter.init(out, 1.0d / mxx, 1.0d / myy);
             }
         } else {
             final double det = mxx * myy - mxy * myx;
@@ -532,19 +554,6 @@
         PathClipFilter init(final DPathConsumer2D out) {
             this.out = out;
 
-            // Adjust the clipping rectangle with the renderer offsets
-            final double rdrOffX = DRenderer.RDR_OFFSET_X;
-            final double rdrOffY = DRenderer.RDR_OFFSET_Y;
-
-            // add a small rounding error:
-            final double margin = 1e-3d;
-
-            final double[] _clipRect = this.clipRect;
-            _clipRect[0] -= margin - rdrOffY;
-            _clipRect[1] += margin + rdrOffY;
-            _clipRect[2] -= margin - rdrOffX;
-            _clipRect[3] += margin + rdrOffX;
-
             if (MarlinConst.DO_CLIP_SUBDIVIDER) {
                 // adjust padded clip rectangle:
                 curveSplitter.init();
@@ -867,6 +876,11 @@
 
         private static final int MAX_N_CURVES = 3 * 4;
 
+        private final DRendererContext rdrCtx;
+
+        // scaled length threshold:
+        private double minLength;
+
         // clip rectangle (ymin, ymax, xmin, xmax):
         final double[] clipRect;
 
@@ -884,12 +898,23 @@
         private final DCurve curve;
 
         CurveClipSplitter(final DRendererContext rdrCtx) {
+            this.rdrCtx = rdrCtx;
             this.clipRect = rdrCtx.clipRect;
             this.curve = rdrCtx.curve;
         }
 
         void init() {
             this.init_clipRectPad = true;
+
+            if (DO_CHECK_LENGTH) {
+                this.minLength = (this.rdrCtx.clipInvScale == 0.0d) ? LEN_TH
+                                    : (LEN_TH * this.rdrCtx.clipInvScale);
+
+                if (MarlinConst.DO_LOG_CLIP) {
+                    MarlinUtils.logInfo("CurveClipSplitter.minLength = "
+                                            + minLength);
+                }
+            }
         }
 
         private void initPaddedClip() {
@@ -906,7 +931,7 @@
 
             if (TRACE) {
                 MarlinUtils.logInfo("clip: X [" + _clipRectPad[2] + " .. " + _clipRectPad[3] +"] "
-                                        + "Y ["+ _clipRectPad[0] + " .. " + _clipRectPad[1] +"]");
+                                        + "Y [" + _clipRectPad[0] + " .. " + _clipRectPad[1] +"]");
             }
         }
 
@@ -919,7 +944,7 @@
                 MarlinUtils.logInfo("divLine P0(" + x0 + ", " + y0 + ") P1(" + x1 + ", " + y1 + ")");
             }
 
-            if (DO_CHECK_LENGTH && DHelpers.fastLineLen(x0, y0, x1, y1) <= LEN_TH) {
+            if (DO_CHECK_LENGTH && DHelpers.fastLineLen(x0, y0, x1, y1) <= minLength) {
                 return false;
             }
 
@@ -940,7 +965,7 @@
                 MarlinUtils.logInfo("divQuad P0(" + x0 + ", " + y0 + ") P1(" + x1 + ", " + y1 + ") P2(" + x2 + ", " + y2 + ")");
             }
 
-            if (DO_CHECK_LENGTH && DHelpers.fastQuadLen(x0, y0, x1, y1, x2, y2) <= LEN_TH) {
+            if (DO_CHECK_LENGTH && DHelpers.fastQuadLen(x0, y0, x1, y1, x2, y2) <= minLength) {
                 return false;
             }
 
@@ -963,7 +988,7 @@
                 MarlinUtils.logInfo("divCurve P0(" + x0 + ", " + y0 + ") P1(" + x1 + ", " + y1 + ") P2(" + x2 + ", " + y2 + ") P3(" + x3 + ", " + y3 + ")");
             }
 
-            if (DO_CHECK_LENGTH && DHelpers.fastCurvelen(x0, y0, x1, y1, x2, y2, x3, y3) <= LEN_TH) {
+            if (DO_CHECK_LENGTH && DHelpers.fastCurvelen(x0, y0, x1, y1, x2, y2, x3, y3) <= minLength) {
                 return false;
             }
 
@@ -991,8 +1016,8 @@
                                                         outCodeOR, clipRectPad);
 
             if (TRACE) {
-                MarlinUtils.logInfo("nSplits: "+ nSplits);
-                MarlinUtils.logInfo("subTs: "+Arrays.toString(Arrays.copyOfRange(subTs, 0, nSplits)));
+                MarlinUtils.logInfo("nSplits: " + nSplits);
+                MarlinUtils.logInfo("subTs: " + Arrays.toString(Arrays.copyOfRange(subTs, 0, nSplits)));
             }
             if (nSplits == 0) {
                 // only curve support shortcut
@@ -1010,7 +1035,7 @@
 
             for (int i = 0, off = 0; i <= nSplits; i++, off += type) {
                 if (TRACE) {
-                    MarlinUtils.logInfo("Part Curve "+Arrays.toString(Arrays.copyOfRange(mid, off, off + type)));
+                    MarlinUtils.logInfo("Part Curve " + Arrays.toString(Arrays.copyOfRange(mid, off, off + type)));
                 }
                 emitCurrent(type, mid, off, out);
             }
--- a/src/java.desktop/share/classes/sun/java2d/marlin/MarlinConst.java	Wed Oct 03 15:54:35 2018 +0200
+++ b/src/java.desktop/share/classes/sun/java2d/marlin/MarlinConst.java	Wed Oct 03 16:02:24 2018 +0200
@@ -82,11 +82,11 @@
 
     static final boolean DO_CLIP_SUBDIVIDER = MarlinProperties.isDoClipSubdivider();
 
-    // flag to enable logs related bounds checks
+    // flag to enable logs related to bounds checks
     static final boolean DO_LOG_BOUNDS = ENABLE_LOGS && false;
 
-    // flag to enable float precision correction
-    static final boolean DO_FIX_FLOAT_PREC = true;
+    // flag to enable logs related to clip rect
+    static final boolean DO_LOG_CLIP = ENABLE_LOGS && false;
 
     // Initial Array sizing (initial context capacity) ~ 450K
 
--- a/src/java.desktop/share/classes/sun/java2d/marlin/MarlinRenderingEngine.java	Wed Oct 03 15:54:35 2018 +0200
+++ b/src/java.desktop/share/classes/sun/java2d/marlin/MarlinRenderingEngine.java	Wed Oct 03 16:02:24 2018 +0200
@@ -31,6 +31,7 @@
 import java.awt.geom.Path2D;
 import java.awt.geom.PathIterator;
 import java.security.AccessController;
+import java.util.Arrays;
 import static sun.java2d.marlin.MarlinUtils.logInfo;
 import sun.awt.geom.PathConsumer2D;
 import sun.java2d.ReentrantContextProvider;
@@ -333,7 +334,6 @@
 
         int dashLen = -1;
         boolean recycleDashes = false;
-        float scale = 1.0f;
 
         if (at != null && !at.isIdentity()) {
             final double a = at.getScaleX();
@@ -366,7 +366,7 @@
             // a*b == -c*d && a*a+c*c == b*b+d*d. In the actual check below, we
             // leave a bit of room for error.
             if (nearZero(a*b + c*d) && nearZero(a*a + c*c - (b*b + d*d))) {
-                scale = (float) Math.sqrt(a*a + c*c);
+                final float scale = (float) Math.sqrt(a*a + c*c);
 
                 if (dashes != null) {
                     recycleDashes = true;
@@ -421,7 +421,7 @@
         pc2d = transformerPC2D.deltaTransformConsumer(pc2d, strokerat);
 
         // stroker will adjust the clip rectangle (width / miter limit):
-        pc2d = rdrCtx.stroker.init(pc2d, width, caps, join, miterlimit, scale,
+        pc2d = rdrCtx.stroker.init(pc2d, width, caps, join, miterlimit,
                 (dashes == null));
 
         // Curve Monotizer:
@@ -831,10 +831,26 @@
                 // Define the initial clip bounds:
                 final float[] clipRect = rdrCtx.clipRect;
 
-                clipRect[0] = clip.getLoY();
-                clipRect[1] = clip.getLoY() + clip.getHeight();
-                clipRect[2] = clip.getLoX();
-                clipRect[3] = clip.getLoX() + clip.getWidth();
+                // Adjust the clipping rectangle with the renderer offsets
+                final float rdrOffX = Renderer.RDR_OFFSET_X;
+                final float rdrOffY = Renderer.RDR_OFFSET_Y;
+
+                // add a small rounding error:
+                final float margin = 1e-3f;
+
+                clipRect[0] = clip.getLoY()
+                                - margin + rdrOffY;
+                clipRect[1] = clip.getLoY() + clip.getHeight()
+                                + margin + rdrOffY;
+                clipRect[2] = clip.getLoX()
+                                - margin + rdrOffX;
+                clipRect[3] = clip.getLoX() + clip.getWidth()
+                                + margin + rdrOffX;
+
+                if (MarlinConst.DO_LOG_CLIP) {
+                    MarlinUtils.logInfo("clipRect (clip): "
+                                        + Arrays.toString(rdrCtx.clipRect));
+                }
 
                 // Enable clipping:
                 rdrCtx.doClip = true;
--- a/src/java.desktop/share/classes/sun/java2d/marlin/RendererContext.java	Wed Oct 03 15:54:35 2018 +0200
+++ b/src/java.desktop/share/classes/sun/java2d/marlin/RendererContext.java	Wed Oct 03 16:02:24 2018 +0200
@@ -85,6 +85,8 @@
     boolean closedPath = false;
     // clip rectangle (ymin, ymax, xmin, xmax):
     final float[] clipRect = new float[4];
+    // clip inverse scale (mean) to adjust length checks
+    float clipInvScale = 0.0f;
     // CurveBasicMonotonizer instance
     final CurveBasicMonotonizer monotonizer;
     // CurveClipSplitter instance
@@ -159,6 +161,7 @@
         stroking   = 0;
         doClip     = false;
         closedPath = false;
+        clipInvScale = 0.0f;
 
         // if context is maked as DIRTY:
         if (dirty) {
--- a/src/java.desktop/share/classes/sun/java2d/marlin/Stroker.java	Wed Oct 03 15:54:35 2018 +0200
+++ b/src/java.desktop/share/classes/sun/java2d/marlin/Stroker.java	Wed Oct 03 16:02:24 2018 +0200
@@ -141,7 +141,6 @@
      * <code>JOIN_MITER</code>, <code>JOIN_ROUND</code> or
      * <code>JOIN_BEVEL</code>.
      * @param miterLimit the desired miter limit
-     * @param scale scaling factor applied to clip boundaries
      * @param subdivideCurves true to indicate to subdivide curves, false if dasher does
      * @return this instance
      */
@@ -150,7 +149,6 @@
                  final int capStyle,
                  final int joinStyle,
                  final float miterLimit,
-                 final float scale,
                  final boolean subdivideCurves)
     {
         this.out = pc2d;
@@ -171,7 +169,6 @@
 
         if (rdrCtx.doClip) {
             // Adjust the clipping rectangle with the stroker margin (miter limit, width)
-            float rdrOffX = 0.0f, rdrOffY = 0.0f;
             float margin = lineWidth2;
 
             if (capStyle == CAP_SQUARE) {
@@ -180,23 +177,21 @@
             if ((joinStyle == JOIN_MITER) && (margin < limit)) {
                 margin = limit;
             }
-            if (scale != 1.0f) {
-                margin *= scale;
-                rdrOffX = scale * Renderer.RDR_OFFSET_X;
-                rdrOffY = scale * Renderer.RDR_OFFSET_Y;
-            }
-            // add a small rounding error:
-            margin += 1e-3f;
 
             // bounds as half-open intervals: minX <= x < maxX and minY <= y < maxY
             // adjust clip rectangle (ymin, ymax, xmin, xmax):
             final float[] _clipRect = rdrCtx.clipRect;
-            _clipRect[0] -= margin - rdrOffY;
-            _clipRect[1] += margin + rdrOffY;
-            _clipRect[2] -= margin - rdrOffX;
-            _clipRect[3] += margin + rdrOffX;
+            _clipRect[0] -= margin;
+            _clipRect[1] += margin;
+            _clipRect[2] -= margin;
+            _clipRect[3] += margin;
             this.clipRect = _clipRect;
 
+            if (MarlinConst.DO_LOG_CLIP) {
+                MarlinUtils.logInfo("clipRect (stroker): "
+                                    + Arrays.toString(rdrCtx.clipRect));
+            }
+
             // initialize curve splitter here for stroker & dasher:
             if (DO_CLIP_SUBDIVIDER) {
                 subdivide = subdivideCurves;
@@ -306,13 +301,9 @@
         // If it is >=0, we know that abs(ext) is <= 90 degrees, so we only
         // need 1 curve to approximate the circle section that joins omx,omy
         // and mx,my.
-        final int numCurves = (cosext >= 0.0f) ? 1 : 2;
-
-        switch (numCurves) {
-        case 1:
+        if (cosext >= 0.0f) {
             drawBezApproxForArc(cx, cy, omx, omy, mx, my, rev);
-            break;
-        case 2:
+        } else {
             // we need to split the arc into 2 arcs spanning the same angle.
             // The point we want will be one of the 2 intersections of the
             // perpendicular bisector of the chord (omx,omy)->(mx,my) and the
@@ -341,8 +332,6 @@
             }
             drawBezApproxForArc(cx, cy, omx, omy, mmx, mmy, rev);
             drawBezApproxForArc(cx, cy, mmx, mmy, mx, my, rev);
-            break;
-        default:
         }
     }
 
--- a/src/java.desktop/share/classes/sun/java2d/marlin/TransformingPathConsumer2D.java	Wed Oct 03 15:54:35 2018 +0200
+++ b/src/java.desktop/share/classes/sun/java2d/marlin/TransformingPathConsumer2D.java	Wed Oct 03 16:02:24 2018 +0200
@@ -120,44 +120,56 @@
                 // Scale only
                 if (rdrCtx.doClip) {
                     // adjust clip rectangle (ymin, ymax, xmin, xmax):
-                    adjustClipScale(rdrCtx.clipRect, mxx, myy);
+                    rdrCtx.clipInvScale = adjustClipScale(rdrCtx.clipRect,
+                        mxx, myy);
                 }
                 return dt_DeltaScaleFilter.init(out, mxx, myy);
             }
         } else {
             if (rdrCtx.doClip) {
                 // adjust clip rectangle (ymin, ymax, xmin, xmax):
-                adjustClipInverseDelta(rdrCtx.clipRect, mxx, mxy, myx, myy);
+                rdrCtx.clipInvScale = adjustClipInverseDelta(rdrCtx.clipRect,
+                    mxx, mxy, myx, myy);
             }
             return dt_DeltaTransformFilter.init(out, mxx, mxy, myx, myy);
         }
     }
 
-    private static void adjustClipOffset(final float[] clipRect) {
-        clipRect[0] += Renderer.RDR_OFFSET_Y;
-        clipRect[1] += Renderer.RDR_OFFSET_Y;
-        clipRect[2] += Renderer.RDR_OFFSET_X;
-        clipRect[3] += Renderer.RDR_OFFSET_X;
+    private static float adjustClipScale(final float[] clipRect,
+                                         final float mxx, final float myy)
+    {
+        // Adjust the clipping rectangle (iv_DeltaScaleFilter):
+        final float scaleY = 1.0f / myy;
+        clipRect[0] *= scaleY;
+        clipRect[1] *= scaleY;
+
+        if (clipRect[1] < clipRect[0]) {
+            float tmp = clipRect[0];
+            clipRect[0] = clipRect[1];
+            clipRect[1] = tmp;
+        }
+
+        final float scaleX = 1.0f / mxx;
+        clipRect[2] *= scaleX;
+        clipRect[3] *= scaleX;
+
+        if (clipRect[3] < clipRect[2]) {
+            float tmp = clipRect[2];
+            clipRect[2] = clipRect[3];
+            clipRect[3] = tmp;
+        }
+
+        if (MarlinConst.DO_LOG_CLIP) {
+                MarlinUtils.logInfo("clipRect (ClipScale): "
+                                    + Arrays.toString(clipRect));
+        }
+        return 0.5f * (Math.abs(scaleX) + Math.abs(scaleY));
     }
 
-    private static void adjustClipScale(final float[] clipRect,
-                                        final float mxx, final float myy)
+    private static float adjustClipInverseDelta(final float[] clipRect,
+                                                final float mxx, final float mxy,
+                                                final float myx, final float myy)
     {
-        adjustClipOffset(clipRect);
-
-        // Adjust the clipping rectangle (iv_DeltaScaleFilter):
-        clipRect[0] /= myy;
-        clipRect[1] /= myy;
-        clipRect[2] /= mxx;
-        clipRect[3] /= mxx;
-    }
-
-    private static void adjustClipInverseDelta(final float[] clipRect,
-                                               final float mxx, final float mxy,
-                                               final float myx, final float myy)
-    {
-        adjustClipOffset(clipRect);
-
         // Adjust the clipping rectangle (iv_DeltaTransformFilter):
         final float det = mxx * myy - mxy * myx;
         final float imxx =  myy / det;
@@ -199,6 +211,16 @@
         clipRect[1] = ymax;
         clipRect[2] = xmin;
         clipRect[3] = xmax;
+
+        if (MarlinConst.DO_LOG_CLIP) {
+                MarlinUtils.logInfo("clipRect (ClipInverseDelta): "
+                                    + Arrays.toString(clipRect));
+        }
+
+        final float scaleX = (float) Math.sqrt(imxx * imxx + imxy * imxy);
+        final float scaleY = (float) Math.sqrt(imyx * imyx + imyy * imyy);
+
+        return 0.5f * (scaleX + scaleY);
     }
 
     PathConsumer2D inverseDeltaTransformConsumer(PathConsumer2D out,
@@ -216,7 +238,7 @@
             if (mxx == 1.0f && myy == 1.0f) {
                 return out;
             } else {
-                return iv_DeltaScaleFilter.init(out, 1.0f/mxx, 1.0f/myy);
+                return iv_DeltaScaleFilter.init(out, 1.0f / mxx, 1.0f / myy);
             }
         } else {
             final float det = mxx * myy - mxy * myx;
@@ -533,19 +555,6 @@
         PathClipFilter init(final PathConsumer2D out) {
             this.out = out;
 
-            // Adjust the clipping rectangle with the renderer offsets
-            final float rdrOffX = Renderer.RDR_OFFSET_X;
-            final float rdrOffY = Renderer.RDR_OFFSET_Y;
-
-            // add a small rounding error:
-            final float margin = 1e-3f;
-
-            final float[] _clipRect = this.clipRect;
-            _clipRect[0] -= margin - rdrOffY;
-            _clipRect[1] += margin + rdrOffY;
-            _clipRect[2] -= margin - rdrOffX;
-            _clipRect[3] += margin + rdrOffX;
-
             if (MarlinConst.DO_CLIP_SUBDIVIDER) {
                 // adjust padded clip rectangle:
                 curveSplitter.init();
@@ -868,6 +877,11 @@
 
         private static final int MAX_N_CURVES = 3 * 4;
 
+        private final RendererContext rdrCtx;
+
+        // scaled length threshold:
+        private float minLength;
+
         // clip rectangle (ymin, ymax, xmin, xmax):
         final float[] clipRect;
 
@@ -885,12 +899,23 @@
         private final Curve curve;
 
         CurveClipSplitter(final RendererContext rdrCtx) {
+            this.rdrCtx = rdrCtx;
             this.clipRect = rdrCtx.clipRect;
             this.curve = rdrCtx.curve;
         }
 
         void init() {
             this.init_clipRectPad = true;
+
+            if (DO_CHECK_LENGTH) {
+                this.minLength = (this.rdrCtx.clipInvScale == 0.0f) ? LEN_TH
+                                    : (LEN_TH * this.rdrCtx.clipInvScale);
+
+                if (MarlinConst.DO_LOG_CLIP) {
+                    MarlinUtils.logInfo("CurveClipSplitter.minLength = "
+                                            + minLength);
+                }
+            }
         }
 
         private void initPaddedClip() {
@@ -907,7 +932,7 @@
 
             if (TRACE) {
                 MarlinUtils.logInfo("clip: X [" + _clipRectPad[2] + " .. " + _clipRectPad[3] +"] "
-                                        + "Y ["+ _clipRectPad[0] + " .. " + _clipRectPad[1] +"]");
+                                        + "Y [" + _clipRectPad[0] + " .. " + _clipRectPad[1] +"]");
             }
         }
 
@@ -920,7 +945,7 @@
                 MarlinUtils.logInfo("divLine P0(" + x0 + ", " + y0 + ") P1(" + x1 + ", " + y1 + ")");
             }
 
-            if (DO_CHECK_LENGTH && Helpers.fastLineLen(x0, y0, x1, y1) <= LEN_TH) {
+            if (DO_CHECK_LENGTH && Helpers.fastLineLen(x0, y0, x1, y1) <= minLength) {
                 return false;
             }
 
@@ -941,7 +966,7 @@
                 MarlinUtils.logInfo("divQuad P0(" + x0 + ", " + y0 + ") P1(" + x1 + ", " + y1 + ") P2(" + x2 + ", " + y2 + ")");
             }
 
-            if (DO_CHECK_LENGTH && Helpers.fastQuadLen(x0, y0, x1, y1, x2, y2) <= LEN_TH) {
+            if (DO_CHECK_LENGTH && Helpers.fastQuadLen(x0, y0, x1, y1, x2, y2) <= minLength) {
                 return false;
             }
 
@@ -964,7 +989,7 @@
                 MarlinUtils.logInfo("divCurve P0(" + x0 + ", " + y0 + ") P1(" + x1 + ", " + y1 + ") P2(" + x2 + ", " + y2 + ") P3(" + x3 + ", " + y3 + ")");
             }
 
-            if (DO_CHECK_LENGTH && Helpers.fastCurvelen(x0, y0, x1, y1, x2, y2, x3, y3) <= LEN_TH) {
+            if (DO_CHECK_LENGTH && Helpers.fastCurvelen(x0, y0, x1, y1, x2, y2, x3, y3) <= minLength) {
                 return false;
             }
 
@@ -992,8 +1017,8 @@
                                                         outCodeOR, clipRectPad);
 
             if (TRACE) {
-                MarlinUtils.logInfo("nSplits: "+ nSplits);
-                MarlinUtils.logInfo("subTs: "+Arrays.toString(Arrays.copyOfRange(subTs, 0, nSplits)));
+                MarlinUtils.logInfo("nSplits: " + nSplits);
+                MarlinUtils.logInfo("subTs: " + Arrays.toString(Arrays.copyOfRange(subTs, 0, nSplits)));
             }
             if (nSplits == 0) {
                 // only curve support shortcut
@@ -1011,7 +1036,7 @@
 
             for (int i = 0, off = 0; i <= nSplits; i++, off += type) {
                 if (TRACE) {
-                    MarlinUtils.logInfo("Part Curve "+Arrays.toString(Arrays.copyOfRange(mid, off, off + type)));
+                    MarlinUtils.logInfo("Part Curve " + Arrays.toString(Arrays.copyOfRange(mid, off, off + type)));
                 }
                 emitCurrent(type, mid, off, out);
             }
--- a/src/java.desktop/share/classes/sun/java2d/marlin/Version.java	Wed Oct 03 15:54:35 2018 +0200
+++ b/src/java.desktop/share/classes/sun/java2d/marlin/Version.java	Wed Oct 03 16:02:24 2018 +0200
@@ -27,7 +27,7 @@
 
 public final class Version {
 
-    private static final String VERSION = "marlin-0.9.1-Unsafe-OpenJDK";
+    private static final String VERSION = "marlin-0.9.1.1-Unsafe-OpenJDK";
 
     public static String getVersion() {
         return VERSION;
--- a/src/java.desktop/share/classes/sun/print/RasterPrinterJob.java	Wed Oct 03 15:54:35 2018 +0200
+++ b/src/java.desktop/share/classes/sun/print/RasterPrinterJob.java	Wed Oct 03 16:02:24 2018 +0200
@@ -895,17 +895,16 @@
    }
 
     protected PageFormat getPageFormatFromAttributes() {
-        if (attributes == null || attributes.isEmpty()) {
+        Pageable pageable = null;
+        if (attributes == null || attributes.isEmpty() ||
+            !((pageable = getPageable()) instanceof OpenBook)) {
             return null;
         }
 
         PageFormat newPf = attributeToPageFormat(
             getPrintService(), attributes);
         PageFormat oldPf = null;
-        Pageable pageable = getPageable();
-        if ((pageable != null) &&
-            (pageable instanceof OpenBook) &&
-            ((oldPf = pageable.getPageFormat(0)) != null)) {
+        if ((oldPf = pageable.getPageFormat(0)) != null) {
             // If orientation, media, imageable area attributes are not in
             // "attributes" set, then use respective values of the existing
             // page format "oldPf".
--- a/src/java.desktop/share/native/libfontmanager/freetypeScaler.c	Wed Oct 03 15:54:35 2018 +0200
+++ b/src/java.desktop/share/native/libfontmanager/freetypeScaler.c	Wed Oct 03 16:02:24 2018 +0200
@@ -679,7 +679,6 @@
     int error, imageSize;
     UInt16 width, height;
     GlyphInfo *glyphInfo;
-    int glyph_index;
     int renderFlags = FT_LOAD_RENDER, target;
     FT_GlyphSlot ftglyph;
 
@@ -720,8 +719,6 @@
     }
     renderFlags |= target;
 
-    glyph_index = FT_Get_Char_Index(scalerInfo->face, glyphCode);
-
     error = FT_Load_Glyph(scalerInfo->face, glyphCode, renderFlags);
     if (error) {
         //do not destroy scaler yet.
@@ -958,7 +955,6 @@
         FTScalerContext *context, FTScalerInfo* scalerInfo,
         jint glyphCode, jfloat xpos, jfloat ypos) {
     int renderFlags;
-    int glyph_index;
     FT_Error error;
     FT_GlyphSlot ftglyph;
 
@@ -974,8 +970,6 @@
 
     renderFlags = FT_LOAD_NO_HINTING | FT_LOAD_NO_BITMAP;
 
-    glyph_index = FT_Get_Char_Index(scalerInfo->face, glyphCode);
-
     error = FT_Load_Glyph(scalerInfo->face, glyphCode, renderFlags);
     if (error) {
         return NULL;
--- a/src/java.desktop/unix/classes/sun/awt/X11/XIconWindow.java	Wed Oct 03 15:54:35 2018 +0200
+++ b/src/java.desktop/unix/classes/sun/awt/X11/XIconWindow.java	Wed Oct 03 16:02:24 2018 +0200
@@ -281,8 +281,9 @@
                 ColorData cdata = adata.get_color_data(0);
                 int num_colors = cdata.get_awt_numICMcolors();
                 for (int i = 0; i < buf.length; i++) {
-                    buf[i] = (buf[i] >= num_colors) ?
-                        0 : cdata.get_awt_icmLUT2Colors(buf[i]);
+                    int b = Byte.toUnsignedInt(buf[i]);
+                    buf[i] = (b >= num_colors) ?
+                        0 : cdata.get_awt_icmLUT2Colors(b);
                 }
                 bytes = Native.toData(buf);
             } else if (srcBuf instanceof DataBufferInt) {
--- a/src/java.desktop/unix/classes/sun/awt/X11/XToolkit.java	Wed Oct 03 15:54:35 2018 +0200
+++ b/src/java.desktop/unix/classes/sun/awt/X11/XToolkit.java	Wed Oct 03 16:02:24 2018 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2002, 2017, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2002, 2018, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -215,6 +215,12 @@
     static long awt_defaultFg; // Pixel
     private static XMouseInfoPeer xPeer;
 
+    /**
+     * Should we check "_NET_WM_STRUT/_NET_WM_STRUT_PARTIAL" during insets
+     * calculation.
+     */
+    private static Boolean checkSTRUT;
+
     static {
         initSecurityWarning();
         if (GraphicsEnvironment.isHeadless()) {
@@ -826,13 +832,26 @@
     }
 
     /*
-     * If we're running in non-Xinerama environment and the current
-     * window manager supports _NET protocol then the screen insets
-     * are calculated using _NET_WM_WORKAREA property of the root
-     * window.
-     * Otherwise, i. e. if Xinerama is on or _NET_WM_WORKAREA is
-     * not set, we try to calculate the insets ourselves using
-     * getScreenInsetsManually method.
+     * If the current window manager supports _NET protocol then the screen
+     * insets are calculated using _NET_WORKAREA property of the root window.
+     * <p>
+     * Note that _NET_WORKAREA is a rectangular area and it does not work
+     * well in the Xinerama mode.
+     * <p>
+     * We will trust the part of this rectangular area only if it starts at the
+     * requested graphics configuration. Below is an example when the
+     * _NET_WORKAREA intersects with the requested graphics configuration but
+     * produces wrong result.
+     *
+     *         //<-x1,y1///////
+     *         //            // ////////////////
+     *         //  SCREEN1   // // SCREEN2    //
+     *         // ********** // //     x2,y2->//
+     *         //////////////// //            //
+     *                          ////////////////
+     *
+     * When two screens overlap and the first contains a dock(*****), then
+     * _NET_WORKAREA may start at point x1,y1 and end at point x2,y2.
      */
     @Override
     public Insets getScreenInsets(GraphicsConfiguration gc)
@@ -846,30 +865,33 @@
         XToolkit.awtLock();
         try
         {
-            X11GraphicsConfig x11gc = (X11GraphicsConfig)gc;
-            X11GraphicsDevice x11gd = x11gc.getDevice();
-            long root = XlibUtil.getRootWindow(x11gd.getScreen());
+            X11GraphicsEnvironment x11ge = (X11GraphicsEnvironment)
+                    GraphicsEnvironment.getLocalGraphicsEnvironment();
+            X11GraphicsConfig x11gc = (X11GraphicsConfig) gc;
+            long root = XlibUtil.getRootWindow(x11gc.getDevice().getScreen());
             int scale = x11gc.getScale();
-            Rectangle rootBounds = XlibUtil.getWindowGeometry(root, scale);
-
-            X11GraphicsEnvironment x11ge = (X11GraphicsEnvironment)
-                GraphicsEnvironment.getLocalGraphicsEnvironment();
-            if (!x11ge.runningXinerama())
-            {
-                Insets screenInsets = getInsets(root, rootBounds, scale);
-                if (screenInsets != null) return screenInsets;
+            if (x11ge.runningXinerama() && checkSTRUT()) {
+                // implementation based on _NET_WM_STRUT/_NET_WM_STRUT_PARTIAL
+                Rectangle rootBounds = XlibUtil.getWindowGeometry(root, scale);
+                Insets insets = getScreenInsetsManually(root, rootBounds,
+                                                        gc.getBounds(), scale);
+                if ((insets.left | insets.top | insets.bottom | insets.right) != 0
+                        || rootBounds == null) {
+                    return insets;
+                }
             }
-
-            Insets insets = getScreenInsetsManually(root, rootBounds,
-                    gc.getBounds(), scale);
-            if ((insets.left | insets.top | insets.bottom | insets.right) == 0
-                    && rootBounds != null ) {
-                root = XlibWrapper.RootWindow(XToolkit.getDisplay(),
-                        x11gd.getScreen());
-                Insets screenInsets = getInsets(root, rootBounds, scale);
-                if (screenInsets != null) return screenInsets;
+            Rectangle workArea = XToolkit.getWorkArea(root, scale);
+            Rectangle screen = gc.getBounds();
+            if (workArea != null && screen.contains(workArea.getLocation())) {
+                workArea = workArea.intersection(screen);
+                int top = workArea.y - screen.y;
+                int left = workArea.x - screen.x;
+                int bottom = screen.height - workArea.height - top;
+                int right = screen.width - workArea.width - left;
+                return new Insets(top, left, bottom, right);
             }
-            return insets;
+            // Note that it is better to return zeros than inadequate values
+            return new Insets(0, 0, 0, 0);
         }
         finally
         {
@@ -877,14 +899,16 @@
         }
     }
 
-    private Insets getInsets(long root, Rectangle rootBounds, int scale) {
-        Rectangle workArea = XToolkit.getWorkArea(root, scale);
-        if (workArea == null) {
-            return null;
+    /**
+     * Returns the value of "sun.awt.X11.checkSTRUT" property. Default value is
+     * {@code false}.
+     */
+    private static boolean checkSTRUT() {
+        if (checkSTRUT == null) {
+            checkSTRUT = AccessController.doPrivileged(
+                    new GetBooleanAction("sun.awt.X11.checkSTRUT"));
         }
-        return new Insets(workArea.y, workArea.x,
-                rootBounds.height - workArea.height - workArea.y,
-                rootBounds.width - workArea.width - workArea.x);
+        return checkSTRUT;
     }
 
     /*
@@ -893,6 +917,14 @@
      * hints' values to screen insets.
      *
      * This method should be called under XToolkit.awtLock()
+     *
+     * This method is unused by default because of two reasons:
+     *  - Iteration over windows may be extremely slow, and execution of
+     *    getScreenInsets() can be x100 slower than in one monitor config.
+     *  - _NET_WM_STRUT/_NET_WM_STRUT_PARTIAL are hints for the applications.
+     *    WM should take into account these hints when "_NET_WORKAREA" is
+     *    calculated, but the system panels do not necessarily contain these
+     *    hints(Gnome 3 for example).
      */
     private Insets getScreenInsetsManually(long root, Rectangle rootBounds,
                                            Rectangle screenBounds, int scale)
--- a/src/java.desktop/unix/legal/xwindows.md	Wed Oct 03 15:54:35 2018 +0200
+++ b/src/java.desktop/unix/legal/xwindows.md	Wed Oct 03 16:02:24 2018 +0200
@@ -125,61 +125,6 @@
 
 _____________________________
 
-Copyright notice for HPkeysym.h:
-/*
-
-Copyright 1987, 1998 The Open Group
-
-All Rights Reserved.
-
-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 OPEN GROUP 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.
-
-Except as contained in this notice, the name of The Open Group shall
-not be used in advertising or otherwise to promote the sale, use or
-other dealings in this Software without prior written authorization
-from The Open Group.
-
-Copyright 1987 by Digital Equipment Corporation, Maynard, Massachusetts,
-
-All Rights Reserved
-
-Permission to use, copy, modify, and distribute this software and its
-documentation for any purpose and without fee is hereby granted,
-provided that the above copyright notice appear in all copies and that
-both that copyright notice and this permission notice appear in
-supporting documentation, and that the names of Hewlett Packard
-or Digital not be
-used in advertising or publicity pertaining to distribution of the
-software without specific, written prior permission.
-
-DIGITAL DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING
-ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL
-DIGITAL BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR
-ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
-WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION,
-ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
-SOFTWARE.
-
-HEWLETT-PACKARD MAKES NO WARRANTY OF ANY KIND WITH REGARD
-TO THIS SOFWARE, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
-WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
-PURPOSE. Hewlett-Packard shall not be liable for errors
-contained herein or direct, indirect, special, incidental or
-consequential damages in connection with the furnishing,
-performance, or use of this material.
-
-*/
-_____________________________________
-
 Copyright notice in keysym2ucs.h:
 
 Copyright 1987, 1994, 1998 The Open Group
--- a/src/java.desktop/unix/native/libawt_xawt/awt/HPkeysym.h	Wed Oct 03 15:54:35 2018 +0200
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,165 +0,0 @@
-/*
- * reserved comment block
- * DO NOT REMOVE OR ALTER!
- */
-/* $Xorg: HPkeysym.h,v 1.4 2000/08/18 04:05:43 coskrey Exp $ */
-/*
-
-Copyright 1987, 1998  The Open Group
-
-All Rights Reserved.
-
-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 OPEN GROUP 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.
-
-Except as contained in this notice, the name of The Open Group shall
-not be used in advertising or otherwise to promote the sale, use or
-other dealings in this Software without prior written authorization
-from The Open Group.
-
-Copyright 1987 by Digital Equipment Corporation, Maynard, Massachusetts,
-
-                        All Rights Reserved
-
-Permission to use, copy, modify, and distribute this software and its
-documentation for any purpose and without fee is hereby granted,
-provided that the above copyright notice appear in all copies and that
-both that copyright notice and this permission notice appear in
-supporting documentation, and that the names of Hewlett Packard
-or Digital not be
-used in advertising or publicity pertaining to distribution of the
-software without specific, written prior permission.
-
-DIGITAL DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING
-ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL
-DIGITAL BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR
-ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
-WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION,
-ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
-SOFTWARE.
-
-HEWLETT-PACKARD MAKES NO WARRANTY OF ANY KIND WITH REGARD
-TO THIS SOFWARE, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
-WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
-PURPOSE.  Hewlett-Packard shall not be liable for errors
-contained herein or direct, indirect, special, incidental or
-consequential damages in connection with the furnishing,
-performance, or use of this material.
-
-*/
-
-#ifndef _HPKEYSYM_H
-
-#define _HPKEYSYM_H
-
-#define hpXK_ClearLine          0x1000FF6F
-#define hpXK_InsertLine         0x1000FF70
-#define hpXK_DeleteLine         0x1000FF71
-#define hpXK_InsertChar         0x1000FF72
-#define hpXK_DeleteChar         0x1000FF73
-#define hpXK_BackTab            0x1000FF74
-#define hpXK_KP_BackTab         0x1000FF75
-#define hpXK_Modelock1          0x1000FF48
-#define hpXK_Modelock2          0x1000FF49
-#define hpXK_Reset              0x1000FF6C
-#define hpXK_System             0x1000FF6D
-#define hpXK_User               0x1000FF6E
-#define hpXK_mute_acute         0x100000A8
-#define hpXK_mute_grave         0x100000A9
-#define hpXK_mute_asciicircum   0x100000AA
-#define hpXK_mute_diaeresis     0x100000AB
-#define hpXK_mute_asciitilde    0x100000AC
-#define hpXK_lira               0x100000AF
-#define hpXK_guilder            0x100000BE
-#define hpXK_Ydiaeresis         0x100000EE
-#define hpXK_IO                 0x100000EE
-#define hpXK_longminus          0x100000F6
-#define hpXK_block              0x100000FC
-
-
-#ifndef _OSF_Keysyms
-#define _OSF_Keysyms
-
-#define osfXK_Copy              0x1004FF02
-#define osfXK_Cut               0x1004FF03
-#define osfXK_Paste             0x1004FF04
-#define osfXK_BackTab           0x1004FF07
-#define osfXK_BackSpace         0x1004FF08
-#define osfXK_Clear             0x1004FF0B
-#define osfXK_Escape            0x1004FF1B
-#define osfXK_AddMode           0x1004FF31
-#define osfXK_PrimaryPaste      0x1004FF32
-#define osfXK_QuickPaste        0x1004FF33
-#define osfXK_PageLeft          0x1004FF40
-#define osfXK_PageUp            0x1004FF41
-#define osfXK_PageDown          0x1004FF42
-#define osfXK_PageRight         0x1004FF43
-#define osfXK_Activate          0x1004FF44
-#define osfXK_MenuBar           0x1004FF45
-#define osfXK_Left              0x1004FF51
-#define osfXK_Up                0x1004FF52
-#define osfXK_Right             0x1004FF53
-#define osfXK_Down              0x1004FF54
-#define osfXK_EndLine           0x1004FF57
-#define osfXK_BeginLine         0x1004FF58
-#define osfXK_EndData           0x1004FF59
-#define osfXK_BeginData         0x1004FF5A
-#define osfXK_PrevMenu          0x1004FF5B
-#define osfXK_NextMenu          0x1004FF5C
-#define osfXK_PrevField         0x1004FF5D
-#define osfXK_NextField         0x1004FF5E
-#define osfXK_Select            0x1004FF60
-#define osfXK_Insert            0x1004FF63
-#define osfXK_Undo              0x1004FF65
-#define osfXK_Menu              0x1004FF67
-#define osfXK_Cancel            0x1004FF69
-#define osfXK_Help              0x1004FF6A
-#define osfXK_SelectAll         0x1004FF71
-#define osfXK_DeselectAll       0x1004FF72
-#define osfXK_Reselect          0x1004FF73
-#define osfXK_Extend            0x1004FF74
-#define osfXK_Restore           0x1004FF78
-#define osfXK_Delete            0x1004FFFF
-
-#endif /* _OSF_Keysyms */
-
-
-/**************************************************************
- * The use of the following macros is deprecated.
- * They are listed below only for backwards compatibility.
- */
-#define XK_Reset                0x1000FF6C
-#define XK_System               0x1000FF6D
-#define XK_User                 0x1000FF6E
-#define XK_ClearLine            0x1000FF6F
-#define XK_InsertLine           0x1000FF70
-#define XK_DeleteLine           0x1000FF71
-#define XK_InsertChar           0x1000FF72
-#define XK_DeleteChar           0x1000FF73
-#define XK_BackTab              0x1000FF74
-#define XK_KP_BackTab           0x1000FF75
-#define XK_Ext16bit_L           0x1000FF76
-#define XK_Ext16bit_R           0x1000FF77
-#define XK_mute_acute           0x100000a8
-#define XK_mute_grave           0x100000a9
-#define XK_mute_asciicircum     0x100000aa
-#define XK_mute_diaeresis       0x100000ab
-#define XK_mute_asciitilde      0x100000ac
-#define XK_lira                 0x100000af
-#define XK_guilder              0x100000be
-#ifndef XK_Ydiaeresis
-#define XK_Ydiaeresis           0x100000ee
-#endif
-#define XK_IO                   0x100000ee
-#define XK_longminus            0x100000f6
-#define XK_block                0x100000fc
-
-#endif /* _HPKEYSYM_H */
--- a/src/java.desktop/unix/native/libawt_xawt/xawt/XWindow.c	Wed Oct 03 15:54:35 2018 +0200
+++ b/src/java.desktop/unix/native/libawt_xawt/xawt/XWindow.c	Wed Oct 03 16:02:24 2018 +0200
@@ -54,17 +54,12 @@
 #include <X11/Sunkeysym.h>  /* Sun vendor-specific */
 #include <X11/ap_keysym.h>  /* Apollo (HP) vendor-specific */
 /*
- * #include <X11/HPkeysym.h>    HP vendor-specific
- * I checked HPkeysym.h into the workspace because although
- * I think it will ship with X11R6.4.2 (and later) on Linux,
- * it doesn't seem to be in Solaris 9 Update 2.
- *
- * This is done not only for the hp keysyms, but also to
+ * HPKeysym.h is used not only for the hp keysyms, but also to
  * give us the osf keysyms that are also defined in HPkeysym.h.
  * However, HPkeysym.h is missing a couple of osf keysyms,
  * so I have #defined them below.
  */
-#include "HPkeysym.h"   /* HP vendor-specific */
+#include <X11/HPkeysym.h>   /* HP vendor-specific */
 
 #include "java_awt_event_KeyEvent.h"
 #include "java_awt_event_InputEvent.h"
--- a/src/java.naming/share/classes/com/sun/jndi/ldap/Connection.java	Wed Oct 03 15:54:35 2018 +0200
+++ b/src/java.naming/share/classes/com/sun/jndi/ldap/Connection.java	Wed Oct 03 16:02:24 2018 +0200
@@ -337,17 +337,17 @@
         // then reset the timeout.
         if (socket instanceof SSLSocket) {
             SSLSocket sslSocket = (SSLSocket) socket;
-            int socketTimeout = sslSocket.getSoTimeout();
             if (!IS_HOSTNAME_VERIFICATION_DISABLED) {
                 SSLParameters param = sslSocket.getSSLParameters();
                 param.setEndpointIdentificationAlgorithm("LDAPS");
                 sslSocket.setSSLParameters(param);
             }
             if (connectTimeout > 0) {
+                int socketTimeout = sslSocket.getSoTimeout();
                 sslSocket.setSoTimeout(connectTimeout); // reuse full timeout value
+                sslSocket.startHandshake();
+                sslSocket.setSoTimeout(socketTimeout);
             }
-            sslSocket.startHandshake();
-            sslSocket.setSoTimeout(socketTimeout);
         }
         return socket;
     }
--- a/src/java.net.http/share/classes/java/net/http/HttpResponse.java	Wed Oct 03 15:54:35 2018 +0200
+++ b/src/java.net.http/share/classes/java/net/http/HttpResponse.java	Wed Oct 03 16:02:24 2018 +0200
@@ -515,7 +515,7 @@
          * @throws IllegalArgumentException if an invalid set of open options
          *          are specified
          * @throws SecurityException If a security manager has been installed
-         *          and it denies {@link SecurityManager#checkWrite(String)
+         *          and it denies {@linkplain SecurityManager#checkWrite(String)
          *          write access} to the file.
          */
         public static BodyHandler<Path> ofFile(Path file, OpenOption... openOptions) {
@@ -541,7 +541,7 @@
          * @param file the file to store the body in
          * @return a response body handler
          * @throws SecurityException If a security manager has been installed
-         *          and it denies {@link SecurityManager#checkWrite(String)
+         *          and it denies {@linkplain SecurityManager#checkWrite(String)
          *          write access} to the file.
          */
         public static BodyHandler<Path> ofFile(Path file) {
@@ -656,7 +656,7 @@
 
         /**
          * Returns a {@code BodyHandler<byte[]>} that returns a
-         * {@link BodySubscriber BodySubscriber}&lt;{@code byte[]}&gt; obtained
+         * {@link BodySubscriber BodySubscriber}{@code <byte[]>} obtained
          * from {@link BodySubscribers#ofByteArray() BodySubscribers.ofByteArray()}.
          *
          * <p> When the {@code HttpResponse} object is returned, the body has
@@ -695,7 +695,7 @@
          * <p> When the {@code HttpResponse} object is returned, the response
          * headers will have been completely read, but the body may not have
          * been fully received yet. The {@link #body()} method returns a
-         * {@link Publisher Publisher<List<ByteBuffer>>} from which the body
+         * {@link Publisher Publisher}{@code <List<ByteBuffer>>} from which the body
          * response bytes can be obtained as they are received. The publisher
          * can and must be subscribed to only once.
          *
@@ -794,7 +794,7 @@
          * {@code CompletableFuture} that completes with the response
          * corresponding to the key's push request. A push request is rejected /
          * cancelled if there is already an entry in the map whose key is
-         * {@link HttpRequest#equals equal} to it. A push request is
+         * {@linkplain HttpRequest#equals equal} to it. A push request is
          * rejected / cancelled if it  does not have the same origin as its
          * initiating request.
          *
@@ -839,7 +839,7 @@
      * Java type {@code T}.
      *
      * <p> The {@link #getBody()} method returns a
-     * {@link CompletionStage}&lt;{@code T}&gt; that provides the response body
+     * {@link CompletionStage}{@code <T>} that provides the response body
      * object. The {@code CompletionStage} must be obtainable at any time. When
      * it completes depends on the nature of type {@code T}. In many cases,
      * when {@code T} represents the entire body after being consumed then
@@ -850,7 +850,7 @@
      *
      * @apiNote To ensure that all resources associated with the corresponding
      * HTTP exchange are properly released, an implementation of {@code
-     * BodySubscriber} should ensure to {@link Flow.Subscription#request
+     * BodySubscriber} should ensure to {@linkplain Flow.Subscription#request
      * request} more data until one of {@link #onComplete() onComplete} or
      * {@link #onError(Throwable) onError} are signalled, or {@link
      * Flow.Subscription#request cancel} its {@linkplain
@@ -1077,7 +1077,7 @@
          * @throws IllegalArgumentException if an invalid set of open options
          *          are specified
          * @throws SecurityException if a security manager has been installed
-         *          and it denies {@link SecurityManager#checkWrite(String)
+         *          and it denies {@linkplain SecurityManager#checkWrite(String)
          *          write access} to the file
          */
         public static BodySubscriber<Path> ofFile(Path file, OpenOption... openOptions) {
@@ -1103,7 +1103,7 @@
          * @param file the file to store the body in
          * @return a body subscriber
          * @throws SecurityException if a security manager has been installed
-         *          and it denies {@link SecurityManager#checkWrite(String)
+         *          and it denies {@linkplain SecurityManager#checkWrite(String)
          *          write access} to the file
          */
         public static BodySubscriber<Path> ofFile(Path file) {
@@ -1160,7 +1160,7 @@
 
         /**
          * Returns a {@code BodySubscriber} which streams the response body as
-         * a {@link Stream Stream<String>}, where each string in the stream
+         * a {@link Stream Stream}{@code <String>}, where each string in the stream
          * corresponds to a line as defined by {@link BufferedReader#lines()}.
          *
          * <p> The {@link HttpResponse} using this subscriber is available
@@ -1178,7 +1178,7 @@
          *
          * @param charset the character set to use when converting bytes to characters
          * @return a body subscriber that streams the response body as a
-         *         {@link Stream Stream<String>}.
+         *         {@link Stream Stream}{@code <String>}.
          *
          * @see BufferedReader#lines()
          */
--- a/src/java.security.jgss/share/classes/sun/security/krb5/PrincipalName.java	Wed Oct 03 15:54:35 2018 +0200
+++ b/src/java.security.jgss/share/classes/sun/security/krb5/PrincipalName.java	Wed Oct 03 16:02:24 2018 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2000, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2000, 2018, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -406,26 +406,37 @@
         case KRB_NT_SRV_HST:
             if (nameParts.length >= 2) {
                 String hostName = nameParts[1];
+                Boolean option;
                 try {
-                    // RFC4120 does not recommend canonicalizing a hostname.
-                    // However, for compatibility reason, we will try
-                    // canonicalize it and see if the output looks better.
-
-                    String canonicalized = (InetAddress.getByName(hostName)).
-                            getCanonicalHostName();
+                    // If true, try canonicalizing and accept it if it starts
+                    // with the short name. Otherwise, never. Default true.
+                    option = Config.getInstance().getBooleanObject(
+                            "libdefaults", "dns_canonicalize_hostname");
+                } catch (KrbException e) {
+                    option = null;
+                }
+                if (option != Boolean.FALSE) {
+                    try {
+                        // RFC4120 does not recommend canonicalizing a hostname.
+                        // However, for compatibility reason, we will try
+                        // canonicalizing it and see if the output looks better.
 
-                    // Looks if canonicalized is a longer format of hostName,
-                    // we accept cases like
-                    //     bunny -> bunny.rabbit.hole
-                    if (canonicalized.toLowerCase(Locale.ENGLISH).startsWith(
-                                hostName.toLowerCase(Locale.ENGLISH)+".")) {
-                        hostName = canonicalized;
+                        String canonicalized = (InetAddress.getByName(hostName)).
+                                getCanonicalHostName();
+
+                        // Looks if canonicalized is a longer format of hostName,
+                        // we accept cases like
+                        //     bunny -> bunny.rabbit.hole
+                        if (canonicalized.toLowerCase(Locale.ENGLISH).startsWith(
+                                hostName.toLowerCase(Locale.ENGLISH) + ".")) {
+                            hostName = canonicalized;
+                        }
+                    } catch (UnknownHostException | SecurityException e) {
+                        // not canonicalized or no permission to do so, use old
                     }
-                } catch (UnknownHostException | SecurityException e) {
-                    // not canonicalized or no permission to do so, use old
-                }
-                if (hostName.endsWith(".")) {
-                    hostName = hostName.substring(0, hostName.length() - 1);
+                    if (hostName.endsWith(".")) {
+                        hostName = hostName.substring(0, hostName.length() - 1);
+                    }
                 }
                 nameParts[1] = hostName.toLowerCase(Locale.ENGLISH);
             }
--- a/src/java.sql/share/classes/java/sql/DriverManager.java	Wed Oct 03 15:54:35 2018 +0200
+++ b/src/java.sql/share/classes/java/sql/DriverManager.java	Wed Oct 03 16:02:24 2018 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1996, 2017, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1996, 2018, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -652,7 +652,7 @@
          * can be loaded from here.
          */
         ClassLoader callerCL = caller != null ? caller.getClassLoader() : null;
-        if (callerCL == null) {
+        if (callerCL == null || callerCL == ClassLoader.getPlatformClassLoader()) {
             callerCL = Thread.currentThread().getContextClassLoader();
         }
 
--- a/src/jdk.compiler/share/classes/com/sun/tools/javac/code/Flags.java	Wed Oct 03 15:54:35 2018 +0200
+++ b/src/jdk.compiler/share/classes/com/sun/tools/javac/code/Flags.java	Wed Oct 03 16:02:24 2018 +0200
@@ -433,7 +433,9 @@
         SYSTEM_MODULE(Flags.SYSTEM_MODULE),
         DEPRECATED_ANNOTATION(Flags.DEPRECATED_ANNOTATION),
         DEPRECATED_REMOVAL(Flags.DEPRECATED_REMOVAL),
-        HAS_RESOURCE(Flags.HAS_RESOURCE);
+        HAS_RESOURCE(Flags.HAS_RESOURCE),
+        POTENTIALLY_AMBIGUOUS(Flags.POTENTIALLY_AMBIGUOUS),
+        ANONCONSTR_BASED(Flags.ANONCONSTR_BASED);
 
         Flag(long flag) {
             this.value = flag;
--- a/src/jdk.compiler/share/classes/com/sun/tools/javac/comp/Analyzer.java	Wed Oct 03 15:54:35 2018 +0200
+++ b/src/jdk.compiler/share/classes/com/sun/tools/javac/comp/Analyzer.java	Wed Oct 03 16:02:24 2018 +0200
@@ -166,10 +166,10 @@
                 res = EnumSet.allOf(AnalyzerMode.class);
             }
             for (AnalyzerMode mode : values()) {
-                if (modes.contains(mode.opt)) {
+                if (modes.contains("-" + mode.opt) || !mode.feature.allowedInSource(source)) {
+                    res.remove(mode);
+                } else if (modes.contains(mode.opt)) {
                     res.add(mode);
-                } else if (modes.contains("-" + mode.opt) || !mode.feature.allowedInSource(source)) {
-                    res.remove(mode);
                 }
             }
             return res;
--- a/src/jdk.compiler/share/classes/com/sun/tools/javac/comp/Attr.java	Wed Oct 03 15:54:35 2018 +0200
+++ b/src/jdk.compiler/share/classes/com/sun/tools/javac/comp/Attr.java	Wed Oct 03 16:02:24 2018 +0200
@@ -2689,12 +2689,14 @@
      */
     @Override
     public void visitLambda(final JCLambda that) {
+        boolean wrongContext = false;
         if (pt().isErroneous() || (pt().hasTag(NONE) && pt() != Type.recoveryType)) {
             if (pt().hasTag(NONE) && (env.info.enclVar == null || !env.info.enclVar.type.isErroneous())) {
                 //lambda only allowed in assignment or method invocation/cast context
                 log.error(that.pos(), Errors.UnexpectedLambda);
             }
             resultInfo = recoveryInfo;
+            wrongContext = true;
         }
         //create an environment for attribution of the lambda expression
         final Env<AttrContext> localEnv = lambdaEnv(that, env);
@@ -2811,7 +2813,8 @@
 
                 checkAccessibleTypes(that, localEnv, resultInfo.checkContext.inferenceContext(), lambdaType, currentTarget);
             }
-            result = check(that, currentTarget, KindSelector.VAL, resultInfo);
+            result = wrongContext ? that.type = types.createErrorType(pt())
+                                  : check(that, currentTarget, KindSelector.VAL, resultInfo);
         } catch (Types.FunctionDescriptorLookupError ex) {
             JCDiagnostic cause = ex.getDiagnostic();
             resultInfo.checkContext.report(that, cause);
@@ -5343,23 +5346,12 @@
         }
 
         @Override
-        public void visitLambda(JCLambda that) {
-            super.visitLambda(that);
-            if (that.target == null) {
-                that.target = syms.unknownType;
-            }
-        }
-
-        @Override
         public void visitReference(JCMemberReference that) {
             super.visitReference(that);
             if (that.sym == null) {
                 that.sym = new MethodSymbol(0, names.empty, dummyMethodType(),
                         syms.noSymbol);
             }
-            if (that.target == null) {
-                that.target = syms.unknownType;
-            }
         }
     }
     // </editor-fold>
--- a/src/jdk.compiler/share/classes/com/sun/tools/javac/launcher/Main.java	Wed Oct 03 15:54:35 2018 +0200
+++ b/src/jdk.compiler/share/classes/com/sun/tools/javac/launcher/Main.java	Wed Oct 03 16:02:24 2018 +0200
@@ -50,8 +50,9 @@
 import java.nio.file.InvalidPathException;
 import java.nio.file.Path;
 import java.nio.file.Paths;
-import java.security.AccessController;
-import java.security.PrivilegedAction;
+import java.security.CodeSigner;
+import java.security.CodeSource;
+import java.security.ProtectionDomain;
 import java.text.MessageFormat;
 import java.util.ArrayList;
 import java.util.Arrays;
@@ -63,6 +64,8 @@
 import java.util.MissingResourceException;
 import java.util.NoSuchElementException;
 import java.util.ResourceBundle;
+import java.util.stream.Collectors;
+import java.util.stream.Stream;
 
 import javax.lang.model.SourceVersion;
 import javax.lang.model.element.NestingKind;
@@ -182,7 +185,7 @@
     public void run(String[] runtimeArgs, String[] args) throws Fault, InvocationTargetException {
         Path file = getFile(args);
 
-        Context context = new Context();
+        Context context = new Context(file.toAbsolutePath());
         String mainClassName = compile(file, getJavacOpts(runtimeArgs), context);
 
         String[] appArgs = Arrays.copyOfRange(args, 1, args.length);
@@ -193,7 +196,7 @@
      * Returns the path for the filename found in the first of an array of arguments.
      *
      * @param args the array
-     * @return the path
+     * @return the path, as given in the array of args
      * @throws Fault if there is a problem determining the path, or if the file does not exist
      */
     private Path getFile(String[] args) throws Fault {
@@ -396,12 +399,10 @@
      */
     private void execute(String mainClassName, String[] appArgs, Context context)
             throws Fault, InvocationTargetException {
+        System.setProperty("jdk.launcher.sourcefile", context.file.toString());
         ClassLoader cl = context.getClassLoader(ClassLoader.getSystemClassLoader());
         try {
             Class<?> appClass = Class.forName(mainClassName, true, cl);
-            if (appClass.getClassLoader() != cl) {
-                throw new Fault(Errors.UnexpectedClass(mainClassName));
-            }
             Method main = appClass.getDeclaredMethod("main", String[].class);
             int PUBLIC_STATIC = Modifier.PUBLIC | Modifier.STATIC;
             if ((main.getModifiers() & PUBLIC_STATIC) != PUBLIC_STATIC) {
@@ -481,14 +482,19 @@
      * a class loader.
      */
     private static class Context {
-        private Map<String, byte[]> inMemoryClasses = new HashMap<>();
+        private final Path file;
+        private final Map<String, byte[]> inMemoryClasses = new HashMap<>();
+
+        Context(Path file) {
+            this.file = file;
+        }
 
         JavaFileManager getFileManager(StandardJavaFileManager delegate) {
             return new MemoryFileManager(inMemoryClasses, delegate);
         }
 
         ClassLoader getClassLoader(ClassLoader parent) {
-            return new MemoryClassLoader(inMemoryClasses, parent);
+            return new MemoryClassLoader(inMemoryClasses, parent, file);
         }
     }
 
@@ -535,36 +541,126 @@
     }
 
     /**
-     * An in-memory classloader, that uses an in-memory cache written by {@link MemoryFileManager}.
+     * An in-memory classloader, that uses an in-memory cache of classes written by
+     * {@link MemoryFileManager}.
      *
-     * <p>The classloader uses the standard parent-delegation model, just providing
-     * {@code findClass} to find classes in the in-memory cache.
+     * <p>The classloader inverts the standard parent-delegation model, giving preference
+     * to classes defined in the source file before classes known to the parent (such
+     * as any like-named classes that might be found on the application class path.)
      */
     private static class MemoryClassLoader extends ClassLoader {
         /**
-         * The map of classes known to this class loader, indexed by
+         * The map of all classes found in the source file, indexed by
          * {@link ClassLoader#name binary name}.
          */
-        private final Map<String, byte[]> map;
+        private final Map<String, byte[]> sourceFileClasses;
+
+        /**
+         * A minimal protection domain, specifying a code source of the source file itself,
+         * used for classes found in the source file and defined by this loader.
+         */
+        private final ProtectionDomain domain;
+
+        MemoryClassLoader(Map<String, byte[]> sourceFileClasses, ClassLoader parent, Path file) {
+            super(parent);
+            this.sourceFileClasses = sourceFileClasses;
+            CodeSource codeSource;
+            try {
+                codeSource = new CodeSource(file.toUri().toURL(), (CodeSigner[]) null);
+            } catch (MalformedURLException e) {
+                codeSource = null;
+            }
+            domain = new ProtectionDomain(codeSource, null, this, null);
+        }
 
-        MemoryClassLoader(Map<String, byte[]> map, ClassLoader parent) {
-            super(parent);
-            this.map = map;
+        /**
+         * Override loadClass to check for classes defined in the source file
+         * before checking for classes in the parent class loader,
+         * including those on the classpath.
+         *
+         * {@code loadClass(String name)} calls this method, and so will have the same behavior.
+         *
+         * @param name the name of the class to load
+         * @param resolve whether or not to resolve the class
+         * @return the class
+         * @throws ClassNotFoundException if the class is not found
+         */
+        @Override
+        protected Class<?> loadClass(String name, boolean resolve) throws ClassNotFoundException {
+            synchronized (getClassLoadingLock(name)) {
+                Class<?> c = findLoadedClass(name);
+                if (c == null) {
+                    if (sourceFileClasses.containsKey(name)) {
+                        c = findClass(name);
+                    } else {
+                        c = getParent().loadClass(name);
+                    }
+                    if (resolve) {
+                        resolveClass(c);
+                    }
+                }
+                return c;
+            }
+        }
+
+
+        /**
+         * Override getResource to check for resources (i.e. class files) defined in the
+         * source file before checking resources in the parent class loader,
+         * including those on the class path.
+         *
+         * {@code getResourceAsStream(String name)} calls this method,
+         * and so will have the same behavior.
+         *
+         * @param name the name of the resource
+         * @return a URL for the resource, or null if not found
+         */
+        @Override
+        public URL getResource(String name) {
+            if (sourceFileClasses.containsKey(toBinaryName(name))) {
+                return findResource(name);
+            } else {
+                return getParent().getResource(name);
+            }
+        }
+
+        /**
+         * Override getResources to check for resources (i.e. class files) defined in the
+         * source file before checking resources in the parent class loader,
+         * including those on the class path.
+         *
+         * @param name the name of the resource
+         * @return an enumeration of the resources in this loader and in the application class loader
+         */
+        @Override
+        public Enumeration<URL> getResources(String name) throws IOException {
+            URL u = findResource(name);
+            Enumeration<URL> e = getParent().getResources(name);
+            if (u == null) {
+                return e;
+            } else {
+                List<URL> list = new ArrayList<>();
+                list.add(u);
+                while (e.hasMoreElements()) {
+                    list.add(e.nextElement());
+                }
+                return Collections.enumeration(list);
+            }
         }
 
         @Override
         protected Class<?> findClass(String name) throws ClassNotFoundException {
-            byte[] bytes = map.get(name);
+            byte[] bytes = sourceFileClasses.get(name);
             if (bytes == null) {
                 throw new ClassNotFoundException(name);
             }
-            return defineClass(name, bytes, 0, bytes.length);
+            return defineClass(name, bytes, 0, bytes.length, domain);
         }
 
         @Override
         public URL findResource(String name) {
             String binaryName = toBinaryName(name);
-            if (binaryName == null || map.get(binaryName) == null) {
+            if (binaryName == null || sourceFileClasses.get(binaryName) == null) {
                 return null;
             }
 
@@ -628,7 +724,7 @@
                 if (!u.getProtocol().equalsIgnoreCase(PROTOCOL)) {
                     throw new IllegalArgumentException(u.toString());
                 }
-                return new MemoryURLConnection(u, map.get(toBinaryName(u.getPath())));
+                return new MemoryURLConnection(u, sourceFileClasses.get(toBinaryName(u.getPath())));
             }
 
         }
--- a/src/jdk.compiler/share/classes/com/sun/tools/javac/main/Option.java	Wed Oct 03 15:54:35 2018 +0200
+++ b/src/jdk.compiler/share/classes/com/sun/tools/javac/main/Option.java	Wed Oct 03 16:02:24 2018 +0200
@@ -328,7 +328,7 @@
 
     ENCODING("-encoding", "opt.arg.encoding", "opt.encoding", STANDARD, FILEMANAGER),
 
-    SOURCE("-source", "opt.arg.release", "opt.source", STANDARD, BASIC) {
+    SOURCE("--source -source", "opt.arg.release", "opt.source", STANDARD, BASIC) {
         @Override
         public void process(OptionHelper helper, String option, String operand) throws InvalidValueException {
             Source source = Source.lookup(operand);
@@ -349,7 +349,7 @@
         }
     },
 
-    TARGET("-target", "opt.arg.release", "opt.target", STANDARD, BASIC) {
+    TARGET("--target -target", "opt.arg.release", "opt.target", STANDARD, BASIC) {
         @Override
         public void process(OptionHelper helper, String option, String operand) throws InvalidValueException {
             Target target = Target.lookup(operand);
--- a/src/jdk.compiler/share/classes/com/sun/tools/javac/resources/launcher.properties	Wed Oct 03 15:54:35 2018 +0200
+++ b/src/jdk.compiler/share/classes/com/sun/tools/javac/resources/launcher.properties	Wed Oct 03 16:02:24 2018 +0200
@@ -109,10 +109,6 @@
     can''t find class: {0}
 
 # 0: string
-launcher.err.unexpected.class=\
-    class found on application class path: {0}
-
-# 0: string
 launcher.err.cant.find.main.method=\
     can''t find main(String[]) method in class: {0}
 
--- a/src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/types/Field.java	Wed Oct 03 15:54:35 2018 +0200
+++ b/src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/types/Field.java	Wed Oct 03 16:02:24 2018 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2000, 2011, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2000, 2018, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -57,7 +57,7 @@
 
     FIXME: among other things, this interface is not sufficient to
     describe fields which are themselves arrays (like Symbol's
-    jbyte _body[1]).  */
+    u1 _body[1]).  */
 public interface Field {
   /** Get the name of this field */
   public String getName();
--- a/src/jdk.javadoc/share/classes/com/sun/tools/javadoc/main/Start.java	Wed Oct 03 15:54:35 2018 +0200
+++ b/src/jdk.javadoc/share/classes/com/sun/tools/javadoc/main/Start.java	Wed Oct 03 16:02:24 2018 +0200
@@ -380,8 +380,8 @@
         String platformString = compOpts.get("--release");
 
         if (platformString != null) {
-            if (compOpts.isSet("-source")) {
-                usageError("main.release.bootclasspath.conflict", "-source");
+            if (compOpts.isSet(Option.SOURCE.primaryName)) {
+                usageError("main.release.bootclasspath.conflict", Option.SOURCE.primaryName);
             }
             if (fileManagerOpts.containsKey(Option.BOOT_CLASS_PATH)) {
                 usageError("main.release.bootclasspath.conflict", Option.BOOT_CLASS_PATH.getPrimaryName());
--- a/src/jdk.javadoc/share/classes/com/sun/tools/javadoc/main/ToolOption.java	Wed Oct 03 15:54:35 2018 +0200
+++ b/src/jdk.javadoc/share/classes/com/sun/tools/javadoc/main/ToolOption.java	Wed Oct 03 16:02:24 2018 +0200
@@ -174,6 +174,13 @@
     SOURCE("-source", true) {
         @Override
         public void process(Helper helper, String arg) {
+            helper.setCompilerOpt("--source", arg);
+        }
+    },
+
+    SOURCE2("--source", true) {
+        @Override
+        public void process(Helper helper, String arg) {
             helper.setCompilerOpt(opt, arg);
         }
     },
--- a/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/toolkit/BaseConfiguration.java	Wed Oct 03 15:54:35 2018 +0200
+++ b/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/toolkit/BaseConfiguration.java	Wed Oct 03 16:02:24 2018 +0200
@@ -399,6 +399,10 @@
         // Utils needs docEnv, safe to init now.
         utils = new Utils(this);
 
+        if (!javafx) {
+            javafx = isJavaFXMode();
+        }
+
         // Once docEnv and Utils have been initialized, others should be safe.
         cmtUtils = new CommentUtils(this);
         workArounds = new WorkArounds(this);
@@ -1347,4 +1351,19 @@
     public synchronized VisibleMemberTable getVisibleMemberTable(TypeElement te) {
         return visibleMemberCache.getVisibleMemberTable(te);
     }
+
+    /**
+     * Determines if JavaFX is available in the compilation environment.
+     * @return true if JavaFX is available
+     */
+    public boolean isJavaFXMode() {
+        TypeElement observable = utils.elementUtils.getTypeElement("javafx.beans.Observable");
+        if (observable != null) {
+            ModuleElement javafxModule = utils.elementUtils.getModuleOf(observable);
+            if (javafxModule == null || javafxModule.isUnnamed() || javafxModule.getQualifiedName().contentEquals("javafx.base")) {
+                return true;
+            }
+        }
+        return false;
+    }
 }
--- a/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/toolkit/resources/doclets.properties	Wed Oct 03 15:54:35 2018 +0200
+++ b/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/toolkit/resources/doclets.properties	Wed Oct 03 16:02:24 2018 +0200
@@ -234,12 +234,7 @@
 #Documentation for Enums
 doclet.enum_values_doc.fullbody=\
  Returns an array containing the constants of this enum type, in\n\
- the order they are declared. This method may be used to iterate\n\
- over the constants as follows:\n\
- <pre>\n\
- for ({0} c : {0}.values())\n\
- &nbsp;   System.out.println(c);\n\
- </pre>
+ the order they are declared.
 
 doclet.enum_values_doc.return=\
 an array containing the constants of this enum type, in the order they are declared
--- a/src/jdk.javadoc/share/classes/jdk/javadoc/internal/tool/ToolOption.java	Wed Oct 03 15:54:35 2018 +0200
+++ b/src/jdk.javadoc/share/classes/jdk/javadoc/internal/tool/ToolOption.java	Wed Oct 03 16:02:24 2018 +0200
@@ -146,7 +146,7 @@
         }
     },
 
-    SOURCE("-source", STANDARD, true) {
+    SOURCE("--source -source", STANDARD, true) {
         @Override
         public void process(Helper helper, String arg) throws InvalidValueException {
             Option.SOURCE.process(helper.getOptionHelper(), primaryName, arg);
--- a/src/jdk.jdi/share/classes/com/sun/jdi/connect/ListeningConnector.java	Wed Oct 03 15:54:35 2018 +0200
+++ b/src/jdk.jdi/share/classes/com/sun/jdi/connect/ListeningConnector.java	Wed Oct 03 16:02:24 2018 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1998, 2017, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1998, 2018, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -44,8 +44,8 @@
      * {@link #startListening} may allow
      * multiple target VM to become connected.
      *
-     * @return <code>true</code> if multiple connections are supported;
-     * <code>false</code> otherwise.
+     * @return {@code true} if multiple connections are supported;
+     * {@code false} otherwise.
      */
     boolean supportsMultipleConnections();
 
@@ -70,7 +70,7 @@
      * {@link #accept} (using the same argument map as is passed to this
      * method).
      * <p>
-     * If <code>arguments</code> contains addressing information. and
+     * If {@code arguments} contains addressing information and
      * only one connection will be accepted, the {@link #accept accept} method
      * can be called immediately without calling this method.
      *
--- a/src/jdk.jdi/share/classes/com/sun/tools/jdi/GenericListeningConnector.java	Wed Oct 03 15:54:35 2018 +0200
+++ b/src/jdk.jdi/share/classes/com/sun/tools/jdi/GenericListeningConnector.java	Wed Oct 03 16:02:24 2018 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2003, 2017, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2003, 2018, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -113,8 +113,8 @@
            throw new IllegalConnectorArgumentsException("Already listening",
                new ArrayList<>(args.keySet()));
         }
-
         listener = transportService.startListening(address);
+        updateArgumentMapIfRequired(args, listener);
         listenMap.put(args, listener);
         return listener.address();
     }
@@ -183,4 +183,9 @@
     public Transport transport() {
         return transport;
     }
+
+    protected void updateArgumentMapIfRequired(
+        Map<String, ? extends Connector.Argument> args, TransportService.ListenKey listener) {
+    }
+
 }
--- a/src/jdk.jdi/share/classes/com/sun/tools/jdi/SocketListeningConnector.java	Wed Oct 03 15:54:35 2018 +0200
+++ b/src/jdk.jdi/share/classes/com/sun/tools/jdi/SocketListeningConnector.java	Wed Oct 03 16:02:24 2018 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1998, 2017, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1998, 2018, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -30,6 +30,7 @@
 import com.sun.jdi.connect.Connector;
 import com.sun.jdi.connect.IllegalConnectorArgumentsException;
 import com.sun.jdi.connect.Transport;
+import com.sun.jdi.connect.spi.TransportService;
 
 /*
  * A ListeningConnector that uses the SocketTransportService
@@ -92,4 +93,21 @@
     public String description() {
         return getString("socket_listening.description");
     }
+
+    // If the port is auto detected update the argument map with the bound port number.
+    @Override
+    protected void updateArgumentMapIfRequired(
+        Map<String, ? extends Connector.Argument> args, TransportService.ListenKey listener) {
+        if (isWildcardPort(args)) {
+            String[] address = listener.address().split(":");
+            if (address.length > 1) {
+                args.get(ARG_PORT).setValue(address[1]);
+            }
+        }
+    }
+
+    private boolean isWildcardPort(Map<String, ? extends Connector.Argument> args) {
+        String port = args.get(ARG_PORT).value();
+        return port.isEmpty() || Integer.valueOf(port) == 0;
+    }
 }
--- a/src/jdk.jdwp.agent/unix/native/libjdwp/util_md.h	Wed Oct 03 15:54:35 2018 +0200
+++ b/src/jdk.jdwp.agent/unix/native/libjdwp/util_md.h	Wed Oct 03 16:02:24 2018 +0200
@@ -33,7 +33,7 @@
 #include <sys/types.h>
 #ifdef _ALLBSD_SOURCE
 #include <machine/endian.h>
-#elif __linux__
+#elif defined(__linux__)
 #include <endian.h>
 #endif
 
--- a/src/jdk.jfr/share/conf/jfr/default.jfc	Wed Oct 03 15:54:35 2018 +0200
+++ b/src/jdk.jfr/share/conf/jfr/default.jfc	Wed Oct 03 16:02:24 2018 +0200
@@ -382,6 +382,11 @@
       <setting name="enabled" control="gc-enabled-normal">true</setting>
     </event>
 
+    <event name="jdk.GCPhaseParallel">
+      <setting name="enabled" control="gc-enabled-normal">true</setting>
+      <setting name="threshold">0 ms</setting>
+    </event>
+ 
     <event name="jdk.G1BasicIHOP">
       <setting name="enabled" control="gc-enabled-normal">true</setting>
     </event>
--- a/src/jdk.jfr/share/conf/jfr/profile.jfc	Wed Oct 03 15:54:35 2018 +0200
+++ b/src/jdk.jfr/share/conf/jfr/profile.jfc	Wed Oct 03 16:02:24 2018 +0200
@@ -382,6 +382,11 @@
       <setting name="enabled" control="gc-enabled-normal">true</setting>
     </event>
 
+    <event name="jdk.GCPhaseParallel">
+      <setting name="enabled" control="gc-enabled-normal">true</setting>
+      <setting name="threshold">0 ms</setting>
+    </event>
+    
     <event name="jdk.G1BasicIHOP">
       <setting name="enabled" control="gc-enabled-normal">true</setting>
     </event>
--- a/src/jdk.net/share/classes/jdk/net/ExtendedSocketOptions.java	Wed Oct 03 15:54:35 2018 +0200
+++ b/src/jdk.net/share/classes/jdk/net/ExtendedSocketOptions.java	Wed Oct 03 16:02:24 2018 +0200
@@ -206,7 +206,7 @@
 
                 if (option == SO_FLOW_SLA) {
                     assert flowSupported;
-                    SocketFlow flow = checkValueType(value, option.type());
+                    SocketFlow flow = checkValueType(value, SocketFlow.class);
                     setFlowOption(fd, flow);
                 } else if (option == TCP_QUICKACK) {
                     setQuickAckOption(fd, (boolean) value);
@@ -254,7 +254,7 @@
     }
 
     @SuppressWarnings("unchecked")
-    private static <T> T checkValueType(Object value, Class<?> type) {
+    private static <T> T checkValueType(Object value, Class<T> type) {
         if (!type.isAssignableFrom(value.getClass())) {
             String s = "Found: " + value.getClass() + ", Expected: " + type;
             throw new IllegalArgumentException(s);
--- a/src/jdk.pack/share/native/common-unpack/unpack.cpp	Wed Oct 03 15:54:35 2018 +0200
+++ b/src/jdk.pack/share/native/common-unpack/unpack.cpp	Wed Oct 03 16:02:24 2018 +0200
@@ -70,6 +70,7 @@
 
 #include "unpack.h"
 
+#define STATIC_ASSERT(COND) typedef char static_assertion[(COND)?1:-1]
 
 // tags, in canonical order:
 static const byte TAGS_IN_ORDER[] = {
@@ -564,14 +565,14 @@
     FIRST_READ  = MAGIC_BYTES + AH_LENGTH_MIN
   };
 
-  assert(AH_LENGTH_MIN    == 15); // # of UNSIGNED5 fields required after archive_magic
+  STATIC_ASSERT(AH_LENGTH_MIN    == 15); // # of UNSIGNED5 fields required after archive_magic
   // An absolute minimum null archive is magic[4], {minver,majver,options}[3],
   // archive_size[0], cp_counts[8], class_counts[4], for a total of 19 bytes.
   // (Note that archive_size is optional; it may be 0..10 bytes in length.)
   // The first read must capture everything up through the options field.
   // This happens to work even if {minver,majver,options} is a pathological
   // 15 bytes long.  Legal pack files limit those three fields to 1+1+2 bytes.
-  assert(FIRST_READ >= MAGIC_BYTES + AH_LENGTH_0 * B_MAX);
+  STATIC_ASSERT(FIRST_READ >= MAGIC_BYTES + AH_LENGTH_0 * B_MAX);
 
   // Up through archive_size, the largest possible archive header is
   // magic[4], {minver,majver,options}[4], archive_size[10].
@@ -581,7 +582,7 @@
   // a byte, we probably will fail to allocate the buffer, since it
   // will be many gigabytes long.  This is a practical, not an
   // architectural limit to Pack200 archive sizes.
-  assert(FIRST_READ >= MAGIC_BYTES + AH_LENGTH_0_MAX + 2*B_MAX);
+  STATIC_ASSERT(FIRST_READ >= MAGIC_BYTES + AH_LENGTH_0_MAX + 2*B_MAX);
 
   bool foreign_buf = (read_input_fn == null);
   byte initbuf[(int)FIRST_READ + (int)C_SLOP + 200];  // 200 is for JAR I/O
--- a/src/jdk.unsupported/share/classes/sun/reflect/ReflectionFactory.java	Wed Oct 03 15:54:35 2018 +0200
+++ b/src/jdk.unsupported/share/classes/sun/reflect/ReflectionFactory.java	Wed Oct 03 16:02:24 2018 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2001, 2016, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2001, 2018, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -29,14 +29,9 @@
 import java.lang.invoke.MethodHandle;
 import java.lang.reflect.Constructor;
 import java.lang.reflect.InvocationTargetException;
-import java.lang.reflect.UndeclaredThrowableException;
-import java.security.AccessControlContext;
 import java.security.AccessController;
 import java.security.Permission;
-import java.security.ProtectionDomain;
 import java.security.PrivilegedAction;
-import jdk.internal.misc.SharedSecrets;
-import jdk.internal.misc.JavaSecurityAccess;
 
 /**
  * ReflectionFactory supports custom serialization.
@@ -145,66 +140,6 @@
     }
 
     /**
-     * Invokes the supplied constructor, adding the provided protection domains
-     * to the invocation stack before invoking {@code Constructor::newInstance}.
-     * If no {@linkplain System#getSecurityManager() security manager} is present,
-     * or no domains are provided, then this method simply calls
-     * {@code cons.newInstance()}. Otherwise, it invokes the provided constructor
-     * with privileges at the intersection of the current context and the provided
-     * protection domains.
-     *
-     * @param cons A constructor obtained from {@code
-     *        newConstructorForSerialization} or {@code
-     *        newConstructorForExternalization}.
-     * @param domains An array of protection domains that limit the privileges
-     *        with which the constructor is invoked. Can be {@code null}
-     *        or empty, in which case privileges are only limited by the
-     *        {@linkplain AccessController#getContext() current context}.
-     *
-     * @return A new object built from the provided constructor.
-     *
-     * @throws NullPointerException if {@code cons} is {@code null}.
-     * @throws InstantiationException if thrown by {@code cons.newInstance()}.
-     * @throws InvocationTargetException if thrown by {@code cons.newInstance()}.
-     * @throws IllegalAccessException if thrown by {@code cons.newInstance()}.
-     */
-    public final Object newInstanceForSerialization(Constructor<?> cons,
-                                                    ProtectionDomain[] domains)
-        throws InstantiationException, InvocationTargetException, IllegalAccessException
-    {
-        SecurityManager sm = System.getSecurityManager();
-        if (sm == null || domains == null || domains.length == 0) {
-            return cons.newInstance();
-        } else {
-            JavaSecurityAccess jsa = SharedSecrets.getJavaSecurityAccess();
-            PrivilegedAction<?> pea = () -> {
-                try {
-                    return cons.newInstance();
-                } catch (InstantiationException
-                         | InvocationTargetException
-                         | IllegalAccessException x) {
-                    throw new UndeclaredThrowableException(x);
-                }
-            }; // Can't use PrivilegedExceptionAction with jsa
-            try {
-                return jsa.doIntersectionPrivilege(pea,
-                           AccessController.getContext(),
-                           new AccessControlContext(domains));
-            } catch (UndeclaredThrowableException x) {
-                Throwable cause = x.getCause();
-                 if (cause instanceof InstantiationException)
-                    throw (InstantiationException) cause;
-                if (cause instanceof InvocationTargetException)
-                    throw (InvocationTargetException) cause;
-                if (cause instanceof IllegalAccessException)
-                    throw (IllegalAccessException) cause;
-                // not supposed to happen
-                throw x;
-            }
-        }
-    }
-
-    /**
      * Returns a direct MethodHandle for the {@code readObjectNoData} method on
      * a Serializable class.
      * The first argument of {@link MethodHandle#invoke} is the serializable
--- a/test/TestCommon.gmk	Wed Oct 03 15:54:35 2018 +0200
+++ b/test/TestCommon.gmk	Wed Oct 03 16:02:24 2018 +0200
@@ -118,7 +118,7 @@
   ABS_TEST_OUTPUT_DIR := $(ABS_PLATFORM_BUILD_ROOT)/testoutput/$(UNIQUE_DIR)
 endif
 
-# Expect JPRT to set PRODUCT_HOME (the product or jdk in this case to test)
+# If unset, set up the PRODUCT_HOME variable to the jdk to test
 ifndef PRODUCT_HOME
   # Try to use images/jdk if it exists
   ABS_JDK_IMAGE = $(ABS_PLATFORM_BUILD_ROOT)/images/jdk
@@ -145,28 +145,12 @@
   JTREG_BASIC_OPTIONS += -e:_NT_SYMBOL_PATH='$(_NT_SYMBOL_PATH)'
 endif
 
-# Expect JPRT to set JPRT_PRODUCT_ARGS (e.g. -server etc.)
-#   Should be passed into 'java' only.
-#   Could include: -d64 -server -client OR any java option
-ifdef JPRT_PRODUCT_ARGS
-  JAVA_ARGS = $(JPRT_PRODUCT_ARGS)
-endif
-
-# Expect JPRT to set JPRT_PRODUCT_VM_ARGS (e.g. -Xcomp etc.)
-#   Should be passed into anything running the vm (java, javac, javadoc, ...).
-ifdef JPRT_PRODUCT_VM_ARGS
-  JAVA_VM_ARGS = $(JPRT_PRODUCT_VM_ARGS)
-endif
-
 ifneq ($(NATIVE_TEST_PATH), )
   # jtreg -nativepath <dir>
   #
-  # Local make tests will be TEST_IMAGE_DIR and JPRT with jprt.use.reg.test.bundle=true
-  # should be JPRT_TESTNATIVE_PATH
+  # Local make tests will be TEST_IMAGE_DIR
   ifdef TEST_IMAGE_DIR
     TESTNATIVE_DIR = $(TEST_IMAGE_DIR)
-  else ifdef JPRT_TESTNATIVE_PATH
-    TESTNATIVE_DIR = $(JPRT_TESTNATIVE_PATH)
   endif
   ifdef TESTNATIVE_DIR
     JTREG_NATIVE_PATH = -nativepath:$(shell $(GETMIXEDPATH) "$(TESTNATIVE_DIR)/$(NATIVE_TEST_PATH)")
@@ -208,11 +192,6 @@
   TEST_PREREQS += $(CDS_ARCHIVE_FILE)
 endif
 
-# Expect JPRT to set JPRT_ARCHIVE_BUNDLE (path to zip bundle for results)
-ifdef JPRT_ARCHIVE_BUNDLE
-  ARCHIVE_BUNDLE = $(JPRT_ARCHIVE_BUNDLE)
-endif
-
 # How to create the test bundle (pass or fail, we want to create this)
 #   Follow command with ";$(BUNDLE_UP_AND_EXIT)", so it always gets executed.
 ifneq ($(ARCHIVE_BUNDLE), )
@@ -340,9 +319,6 @@
 # Expect JT_HOME to be set for jtreg tests. (home for jtreg)
 ifndef JT_HOME
   JT_HOME = $(SLASH_JAVA)/re/jtreg/$(USE_JTREG_VERSION)/promoted/latest/binaries/jtreg
-  ifdef JPRT_JTREG_HOME
-    JT_HOME = $(JPRT_JTREG_HOME)
-  endif
 endif
 
 # Problematic tests to be excluded
@@ -358,7 +334,7 @@
 
 # ------------------------------------------------------------------
 
-# When called from JPRT the TESTDIRS variable is set to the jtreg tests to run
+# The TESTDIRS variable can be used to select the jtreg tests to run
 ifdef TESTDIRS
   TEST_SELECTION = $(TESTDIRS)
 endif
--- a/test/hotspot/gtest/code/test_dependencyContext.cpp	Wed Oct 03 15:54:35 2018 +0200
+++ b/test/hotspot/gtest/code/test_dependencyContext.cpp	Wed Oct 03 16:02:24 2018 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2016, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2016, 2018, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -50,7 +50,7 @@
   }
 
   ~TestDependencyContext() {
-    dependencies().wipe();
+    wipe();
     CodeCache_lock->unlock();
   }
 
@@ -63,6 +63,18 @@
     return ctx.find_stale_entries();
   }
 #endif
+
+  void wipe() {
+    DependencyContext ctx(&_dependency_context);
+    nmethodBucket* b = ctx.dependencies();
+    ctx.set_dependencies(NULL);
+    ctx.set_has_stale_entries(false);
+    while (b != NULL) {
+      nmethodBucket* next = b->next();
+      delete b;
+      b = next;
+    }
+  }
 };
 
 static void test_remove_dependent_nmethod(int id, bool delete_immediately) {
--- a/test/hotspot/jtreg/ProblemList-graal.txt	Wed Oct 03 15:54:35 2018 +0200
+++ b/test/hotspot/jtreg/ProblemList-graal.txt	Wed Oct 03 16:02:24 2018 +0200
@@ -175,7 +175,7 @@
 org.graalvm.compiler.replacements.test.classfile.RedefineIntrinsicTest           8205081
 
 org.graalvm.compiler.core.test.deopt.CompiledMethodTest          8202955
-org.graalvm.compiler.core.test.CountedLoopTest                   8199885
+org.graalvm.compiler.core.test.CountedLoopTest                   8211179
 org.graalvm.compiler.debug.test.DebugContextTest                 8203504
 
 org.graalvm.compiler.hotspot.test.GraalOSRTest                   8206947
--- a/test/hotspot/jtreg/ProblemList.txt	Wed Oct 03 15:54:35 2018 +0200
+++ b/test/hotspot/jtreg/ProblemList.txt	Wed Oct 03 16:02:24 2018 +0200
@@ -84,6 +84,7 @@
 runtime/CompressedOops/UseCompressedOops.java 8079353 generic-all
 runtime/RedefineTests/RedefineRunningMethods.java 8208778 macosx-x64
 runtime/SharedArchiveFile/SASymbolTableTest.java 8193639 solaris-all
+runtime/XCheckJniJsig/XCheckJSig.java 8211084 macosx-x64
 
 #############################################################################
 
--- a/test/hotspot/jtreg/TEST.groups	Wed Oct 03 15:54:35 2018 +0200
+++ b/test/hotspot/jtreg/TEST.groups	Wed Oct 03 16:02:24 2018 +0200
@@ -258,7 +258,7 @@
 hotspot_appcds = \
   runtime/appcds/
 
-# A subset of AppCDS tests to be run in JPRT push
+# A subset of AppCDS tests to be run in tier1
 tier1_runtime_appcds = \
   runtime/appcds/HelloTest.java \
   runtime/appcds/sharedStrings/SharedStringsBasic.java \
--- a/test/hotspot/jtreg/compiler/graalunit/CoreTest.java	Wed Oct 03 15:54:35 2018 +0200
+++ b/test/hotspot/jtreg/compiler/graalunit/CoreTest.java	Wed Oct 03 16:02:24 2018 +0200
@@ -25,7 +25,7 @@
  * @test
  * @summary
  * @requires vm.opt.final.EnableJVMCI == true
- *
+ * @requires !vm.graal.enabled
  * @modules jdk.internal.vm.compiler
  *
  * @library /test/lib /compiler/graalunit /
--- a/test/hotspot/jtreg/compiler/graalunit/TestPackages.txt	Wed Oct 03 15:54:35 2018 +0200
+++ b/test/hotspot/jtreg/compiler/graalunit/TestPackages.txt	Wed Oct 03 16:02:24 2018 +0200
@@ -6,7 +6,7 @@
 AsmSparc      org.graalvm.compiler.asm.sparc.test
 CoreAmd64     org.graalvm.compiler.core.amd64.test
 CoreSparc     org.graalvm.compiler.core.sparc.test @requires vm.simpleArch == "sparcv9"
-Core          org.graalvm.compiler.core.test
+Core          org.graalvm.compiler.core.test       @requires !vm.graal.enabled
 Debug         org.graalvm.compiler.debug.test
 Graph         org.graalvm.compiler.graph.test      @requires vm.graal.enabled
 HotspotAmd64  org.graalvm.compiler.hotspot.amd64.test
--- a/test/hotspot/jtreg/gc/TestAllocateHeapAt.java	Wed Oct 03 15:54:35 2018 +0200
+++ b/test/hotspot/jtreg/gc/TestAllocateHeapAt.java	Wed Oct 03 16:02:24 2018 +0200
@@ -24,7 +24,7 @@
 /* @test TestAllocateHeapAt.java
  * @key gc
  * @summary Test to check allocation of Java Heap with AllocateHeapAt option
- * @requires vm.gc != "Z"
+ * @requires vm.gc != "Z" & os.family != "aix"
  * @library /test/lib
  * @modules java.base/jdk.internal.misc
  */
--- a/test/hotspot/jtreg/gc/TestAllocateHeapAtError.java	Wed Oct 03 15:54:35 2018 +0200
+++ b/test/hotspot/jtreg/gc/TestAllocateHeapAtError.java	Wed Oct 03 16:02:24 2018 +0200
@@ -24,7 +24,7 @@
 /* @test TestAllocateHeapAtError.java
  * @key gc
  * @summary Test to check correct handling of non-existent directory passed to AllocateHeapAt option
- * @requires vm.gc != "Z"
+ * @requires vm.gc != "Z" & os.family != "aix"
  * @library /test/lib
  * @modules java.base/jdk.internal.misc
  */
--- a/test/hotspot/jtreg/gc/TestAllocateHeapAtMultiple.java	Wed Oct 03 15:54:35 2018 +0200
+++ b/test/hotspot/jtreg/gc/TestAllocateHeapAtMultiple.java	Wed Oct 03 16:02:24 2018 +0200
@@ -26,7 +26,7 @@
  * @summary Test to check allocation of Java Heap with AllocateHeapAt option. Has multiple sub-tests to cover different code paths.
  * @library /test/lib
  * @modules java.base/jdk.internal.misc
- * @requires vm.bits == "64" & vm.gc != "Z"
+ * @requires vm.bits == "64" & vm.gc != "Z" & os.family != "aix"
  */
 
 import jdk.test.lib.JDKToolFinder;
--- a/test/hotspot/jtreg/gc/stress/gcbasher/TestGCBasherWithAllocateHeapAt.java	Wed Oct 03 15:54:35 2018 +0200
+++ b/test/hotspot/jtreg/gc/stress/gcbasher/TestGCBasherWithAllocateHeapAt.java	Wed Oct 03 16:02:24 2018 +0200
@@ -28,7 +28,7 @@
  * @test TestGCBasherWithAllocateHeapAt
  * @key gc stress
  * @requires vm.gc.G1
- * @requires vm.flavor == "server" & !vm.emulatedClient
+ * @requires vm.flavor == "server" & !vm.emulatedClient & os.family != "aix"
  * @summary Stress Java heap allocation with AllocateHeapAt flag using GC basher.
  * @run main/othervm/timeout=500 -Xlog:gc*=info -Xmx256m -server -XX:+UseG1GC -XX:AllocateHeapAt=. TestGCBasherWithAllocateHeapAt 120000
  */
--- a/test/hotspot/jtreg/jprt.config	Wed Oct 03 15:54:35 2018 +0200
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,185 +0,0 @@
-#!echo "This is not a shell script"
-#############################################################################
-# 
-# Copyright (c) 2006, 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.
-# 
-#############################################################################
-
-#############################################################################
-#
-# JPRT shell configuration for testing.
-#
-# Input environment variables:
-#    Windows Only:
-#      PATH
-#      ROOTDIR
-#
-# Output variable settings:
-#    make    Full path to GNU make
-#
-# Output environment variables:
-#    PATH
-#
-#############################################################################
-
-#############################################################################
-# Error
-error() # message
-{
-  echo "ERROR: $1"
-  exit 6
-}
-# Directory must exist
-dirMustExist() # dir name
-{
-  if [ ! -d "$1" ] ; then
-    error "Directory for $2 does not exist: $1"
-  fi
-}
-# File must exist
-fileMustExist() # dir name
-{
-  if [ ! -f "$1" ] ; then
-    error "File for $2 does not exist: $1"
-  fi
-}
-#############################################################################
-
-# Should be set by JPRT as the 3 basic inputs
-slashjava="${ALT_SLASH_JAVA}"
-if [ "${slashjava}" = "" ] ; then
-  slashjava=/java
-fi
-
-# Check input
-dirMustExist "${slashjava}"  ALT_SLASH_JAVA
-
-# Uses 'uname -s', but only expect SunOS or Linux, assume Windows otherwise.
-osname=`uname -s`
-case "${osname}" in
-  SunOS )
-    # SOLARIS: Sparc or X86
-    osarch=`uname -p`
-    if [ "${osarch}" = sparc ] ; then
-	solaris_arch=sparc
-    else
-	solaris_arch=i386
-    fi
-
-    # Add basic solaris system paths
-    path4sdk=/usr/bin
-
-    # Find GNU make
-    make=/usr/bin/gmake
-    if [ ! -f ${make} ] ; then
-	make=/usr/gnu/bin/make
-	if [ ! -f ${make} ] ; then
-	    make=${slashjava}/devtools/${solaris_arch}/bin/gnumake
-        fi 
-    fi
-    fileMustExist "${make}" make
-
-    # File creation mask
-    umask 002
-    ;;
-
-  Linux | Darwin )
-    # Add basic paths
-    path4sdk=/usr/bin:/bin:/usr/sbin:/sbin
-
-    # Find GNU make
-    make=/usr/bin/make
-    fileMustExist "${make}" make
-
-    umask 002
-    ;;
-
-  FreeBSD | OpenBSD )
-    # Add basic paths
-    path4sdk=/usr/bin:/bin:/usr/sbin:/sbin
-
-    # Find GNU make
-    make=/usr/local/bin/gmake
-    fileMustExist "${make}" make
-
-    umask 002
-    ;;
-
-  NetBSD )
-    # Add basic paths
-    path4sdk=/usr/bin:/bin:/usr/sbin:/sbin
-
-    # Find GNU make
-    make=/usr/pkg/bin/gmake
-    fileMustExist "${make}" make
-
-    umask 002
-    ;;
-
-  * )
-    # Windows: Differs on CYGWIN vs. MKS.
-   
-    # We need to determine if we are running a CYGWIN shell or an MKS shell
-    #    (if uname isn't available, then it will be unix_toolset=unknown)
-    unix_toolset=unknown
-    if [ "`uname -a | fgrep Cygwin`" = "" -a -d "${ROOTDIR}" ] ; then
-        # We kind of assume ROOTDIR is where MKS is and it's ok
-        unix_toolset=MKS
-        mkshome=`dosname -s "${ROOTDIR}"`
-        # Most unix utilities are in the mksnt directory of ROOTDIR
-        unixcommand_path="${mkshome}/mksnt"
-        path4sdk="${unixcommand_path}"
-	devtools_path="${slashjava}/devtools/win32/bin"
-	path4sdk="${devtools_path};${path4sdk}"
-        # Find GNU make
-        make="${devtools_path}/gnumake.exe"
-        fileMustExist "${make}" make
-    elif [ "`uname -a | fgrep Cygwin`" != "" -a -f /bin/cygpath ] ; then
-        # For CYGWIN, uname will have "Cygwin" in it, and /bin/cygpath should exist
-        unix_toolset=CYGWIN
-        # Most unix utilities are in the /usr/bin
-        unixcommand_path="/usr/bin"
-        path4sdk="${unixcommand_path}"
-        # Find GNU make
-        make="${unixcommand_path}/make.exe"
-        fileMustExist "${make}" make
-    else
-      echo "WARNING: Cannot figure out if this is MKS or CYGWIN"
-    fi
-
-    
-    # For windows, it's hard to know where the system is, so we just add this
-    #    to PATH.
-    slash_path="`echo ${path4sdk} | sed -e 's@\\\\@/@g' -e 's@//@/@g' -e 's@/$@@' -e 's@/;@;@g'`"
-    path4sdk="${slash_path};${PATH}"
-    
-    # Convert path4sdk to cygwin style
-    if [ "${unix_toolset}" = CYGWIN ] ; then
-	path4sdk="`/usr/bin/cygpath -p ${path4sdk}`"
-    fi
-    ;;
-esac
-
-# Export PATH setting
-PATH="${path4sdk}"
-export PATH
-
--- a/test/hotspot/jtreg/runtime/CommandLine/ObsoleteFlagErrorMessage.java	Wed Oct 03 15:54:35 2018 +0200
+++ b/test/hotspot/jtreg/runtime/CommandLine/ObsoleteFlagErrorMessage.java	Wed Oct 03 16:02:24 2018 +0200
@@ -45,10 +45,10 @@
 
     // Case 2: Newly obsolete flags should be recognized as newly obsolete (8073989)
     ProcessBuilder pb2 = ProcessTools.createJavaProcessBuilder(
-        "-XX:+SafepointSpinBeforeYield", "-version");
+        "-XX:+EmitSync", "-version");
 
     OutputAnalyzer output2 = new OutputAnalyzer(pb2.start());
     output2.shouldContain("Ignoring option").shouldContain("support was removed");
-    output2.shouldContain("SafepointSpinBeforeYield");
+    output2.shouldContain("EmitSync");
   }
 }
--- a/test/hotspot/jtreg/runtime/CommandLine/VMDeprecatedOptions.java	Wed Oct 03 15:54:35 2018 +0200
+++ b/test/hotspot/jtreg/runtime/CommandLine/VMDeprecatedOptions.java	Wed Oct 03 16:02:24 2018 +0200
@@ -44,8 +44,8 @@
         {"MaxRAMFraction",            "8"},
         {"MinRAMFraction",            "2"},
         {"InitialRAMFraction",        "64"},
-        {"AssumeMP",                  "false"},
         {"UseMembar",                 "true"},
+        {"TLABStats",                 "false"},
 
         // deprecated alias flags (see also aliased_jvm_flags):
         {"DefaultMaxRAMFraction", "4"},
--- a/test/hotspot/jtreg/runtime/Dictionary/ProtectionDomainCacheTest.java	Wed Oct 03 15:54:35 2018 +0200
+++ b/test/hotspot/jtreg/runtime/Dictionary/ProtectionDomainCacheTest.java	Wed Oct 03 16:02:24 2018 +0200
@@ -26,9 +26,9 @@
  * @bug 8151486
  * @summary Call Class.forName() on the system classloader from a class loaded
  *          from a custom classloader, using the current class's protection domain.
- * @library /test/jdk/lib/testlibrary
  * @library /test/lib
- * @build jdk.test.lib.Utils JarUtils
+ * @build jdk.test.lib.Utils
+ *        jdk.test.lib.util.JarUtils
  * @build ClassForName ProtectionDomainCacheTest
  * @run main/othervm/policy=test.policy -XX:+UnlockDiagnosticVMOptions -XX:VerifySubSet=dictionary -XX:+VerifyAfterGC -Xlog:gc+verify=debug,protectiondomain=trace,class+unload:gc.log -Djava.security.manager ProtectionDomainCacheTest
  */
@@ -41,6 +41,7 @@
 import java.nio.file.Paths;
 import java.util.List;
 import jdk.test.lib.Utils;
+import jdk.test.lib.util.JarUtils;
 
 /*
  * Create .jar, load ClassForName from .jar using a URLClassLoader
--- a/test/hotspot/jtreg/runtime/SharedArchiveFile/ArchiveDoesNotExist.java	Wed Oct 03 15:54:35 2018 +0200
+++ b/test/hotspot/jtreg/runtime/SharedArchiveFile/ArchiveDoesNotExist.java	Wed Oct 03 16:02:24 2018 +0200
@@ -31,7 +31,7 @@
  * @library /test/lib
  * @modules java.base/jdk.internal.misc
  *          java.management
- * @run main ArchiveDoesNotExist
+ * @run driver ArchiveDoesNotExist
  */
 
 import jdk.test.lib.cds.CDSOptions;
--- a/test/hotspot/jtreg/runtime/SharedArchiveFile/CdsDifferentObjectAlignment.java	Wed Oct 03 15:54:35 2018 +0200
+++ b/test/hotspot/jtreg/runtime/SharedArchiveFile/CdsDifferentObjectAlignment.java	Wed Oct 03 16:02:24 2018 +0200
@@ -34,7 +34,7 @@
  * @bug 8025642
  * @modules java.base/jdk.internal.misc
  *          java.management
- * @run main CdsDifferentObjectAlignment
+ * @run driver CdsDifferentObjectAlignment
  */
 
 import jdk.test.lib.cds.CDSTestUtils;
--- a/test/hotspot/jtreg/runtime/SharedArchiveFile/CdsSameObjectAlignment.java	Wed Oct 03 15:54:35 2018 +0200
+++ b/test/hotspot/jtreg/runtime/SharedArchiveFile/CdsSameObjectAlignment.java	Wed Oct 03 16:02:24 2018 +0200
@@ -30,7 +30,7 @@
  * @library /test/lib
  * @modules java.base/jdk.internal.misc
  *          java.management
- * @run main CdsSameObjectAlignment
+ * @run driver CdsSameObjectAlignment
  */
 
 import jdk.test.lib.Platform;
--- a/test/hotspot/jtreg/runtime/SharedArchiveFile/DumpSharedDictionary.java	Wed Oct 03 15:54:35 2018 +0200
+++ b/test/hotspot/jtreg/runtime/SharedArchiveFile/DumpSharedDictionary.java	Wed Oct 03 16:02:24 2018 +0200
@@ -28,7 +28,7 @@
  * @requires vm.cds
  * @library /test/lib
  * @modules java.base/jdk.internal.misc
- * @run main DumpSharedDictionary
+ * @run driver DumpSharedDictionary
  */
 
 import jdk.test.lib.cds.CDSTestUtils;
--- a/test/hotspot/jtreg/runtime/SharedArchiveFile/NonBootLoaderClasses.java	Wed Oct 03 15:54:35 2018 +0200
+++ b/test/hotspot/jtreg/runtime/SharedArchiveFile/NonBootLoaderClasses.java	Wed Oct 03 16:02:24 2018 +0200
@@ -28,7 +28,7 @@
  * @library /test/lib
  * @modules java.base/jdk.internal.misc
  *          java.management
- * @run main NonBootLoaderClasses
+ * @run driver NonBootLoaderClasses
  */
 
 import jdk.test.lib.cds.CDSOptions;
--- a/test/hotspot/jtreg/runtime/SharedArchiveFile/SharedBaseAddress.java	Wed Oct 03 15:54:35 2018 +0200
+++ b/test/hotspot/jtreg/runtime/SharedArchiveFile/SharedBaseAddress.java	Wed Oct 03 16:02:24 2018 +0200
@@ -29,7 +29,7 @@
  * @library /test/lib
  * @modules java.base/jdk.internal.misc
  *          java.management
- * @run main SharedBaseAddress
+ * @run driver SharedBaseAddress
  */
 
 import jdk.test.lib.cds.CDSTestUtils;
--- a/test/hotspot/jtreg/runtime/SharedArchiveFile/SharedStrings.java	Wed Oct 03 15:54:35 2018 +0200
+++ b/test/hotspot/jtreg/runtime/SharedArchiveFile/SharedStrings.java	Wed Oct 03 16:02:24 2018 +0200
@@ -31,7 +31,7 @@
  *          java.management
  * @build SharedStringsWb sun.hotspot.WhiteBox
  * @run driver ClassFileInstaller -jar whitebox.jar sun.hotspot.WhiteBox
- * @run main SharedStrings
+ * @run driver SharedStrings
  */
 
 import jdk.test.lib.cds.CDSTestUtils;
--- a/test/hotspot/jtreg/runtime/SharedArchiveFile/SharedStringsDedup.java	Wed Oct 03 15:54:35 2018 +0200
+++ b/test/hotspot/jtreg/runtime/SharedArchiveFile/SharedStringsDedup.java	Wed Oct 03 16:02:24 2018 +0200
@@ -28,7 +28,7 @@
  * @library /test/lib
  * @modules java.base/jdk.internal.misc
  *          java.management
- * @run main SharedStringsDedup
+ * @run driver SharedStringsDedup
  */
 
 import jdk.test.lib.cds.CDSTestUtils;
--- a/test/hotspot/jtreg/runtime/SharedArchiveFile/SharedStringsRunAuto.java	Wed Oct 03 15:54:35 2018 +0200
+++ b/test/hotspot/jtreg/runtime/SharedArchiveFile/SharedStringsRunAuto.java	Wed Oct 03 16:02:24 2018 +0200
@@ -28,7 +28,7 @@
  * @library /test/lib
  * @modules java.base/jdk.internal.misc
  *          java.management
- * @run main SharedStringsRunAuto
+ * @run driver SharedStringsRunAuto
  */
 
 import jdk.test.lib.cds.CDSTestUtils;
--- a/test/hotspot/jtreg/runtime/SharedArchiveFile/TestInterpreterMethodEntries.java	Wed Oct 03 15:54:35 2018 +0200
+++ b/test/hotspot/jtreg/runtime/SharedArchiveFile/TestInterpreterMethodEntries.java	Wed Oct 03 16:02:24 2018 +0200
@@ -30,7 +30,7 @@
  * @library /test/lib
  * @modules java.base/jdk.internal.misc
  *          java.management
- * @run main TestInterpreterMethodEntries
+ * @run driver TestInterpreterMethodEntries
  */
 
 import java.lang.Math;
--- a/test/hotspot/jtreg/runtime/appcds/AppendClasspath.java	Wed Oct 03 15:54:35 2018 +0200
+++ b/test/hotspot/jtreg/runtime/appcds/AppendClasspath.java	Wed Oct 03 16:02:24 2018 +0200
@@ -32,7 +32,7 @@
  *          jdk.jartool/sun.tools.jar
  * @compile test-classes/Hello.java
  * @compile test-classes/HelloMore.java
- * @run main AppendClasspath
+ * @run driver AppendClasspath
  */
 
 import java.io.File;
--- a/test/hotspot/jtreg/runtime/appcds/BootClassPathMismatch.java	Wed Oct 03 15:54:35 2018 +0200
+++ b/test/hotspot/jtreg/runtime/appcds/BootClassPathMismatch.java	Wed Oct 03 16:02:24 2018 +0200
@@ -31,7 +31,7 @@
  *          java.management
  *          jdk.jartool/sun.tools.jar
  * @compile test-classes/Hello.java
- * @run main BootClassPathMismatch
+ * @run driver BootClassPathMismatch
  */
 
 import jdk.test.lib.cds.CDSOptions;
--- a/test/hotspot/jtreg/runtime/appcds/CDSandJFR.java	Wed Oct 03 15:54:35 2018 +0200
+++ b/test/hotspot/jtreg/runtime/appcds/CDSandJFR.java	Wed Oct 03 16:02:24 2018 +0200
@@ -30,7 +30,7 @@
  * @modules jdk.jfr
  * @build Hello GetFlightRecorder
  * @run driver ClassFileInstaller -jar CDSandJFR.jar Hello GetFlightRecorder GetFlightRecorder$TestEvent GetFlightRecorder$SimpleEvent
- * @run main CDSandJFR
+ * @run driver CDSandJFR
  */
 
 import jdk.test.lib.BuildHelper;
--- a/test/hotspot/jtreg/runtime/appcds/CaseSensitiveClassPath.java	Wed Oct 03 15:54:35 2018 +0200
+++ b/test/hotspot/jtreg/runtime/appcds/CaseSensitiveClassPath.java	Wed Oct 03 16:02:24 2018 +0200
@@ -34,7 +34,7 @@
  *          jdk.jartool/sun.tools.jar
  * @requires os.family != "mac"
  * @compile test-classes/Hello.java
- * @run main CaseSensitiveClassPath
+ * @run driver CaseSensitiveClassPath
  */
 
 import java.nio.file.FileAlreadyExistsException;
--- a/test/hotspot/jtreg/runtime/appcds/ClassLoaderTest.java	Wed Oct 03 15:54:35 2018 +0200
+++ b/test/hotspot/jtreg/runtime/appcds/ClassLoaderTest.java	Wed Oct 03 16:02:24 2018 +0200
@@ -36,7 +36,7 @@
  * @compile test-classes/BootClassPathAppendHelper.java
  * @build sun.hotspot.WhiteBox
  * @run driver ClassFileInstaller sun.hotspot.WhiteBox
- * @run main ClassLoaderTest
+ * @run driver ClassLoaderTest
  */
 
 import java.io.File;
--- a/test/hotspot/jtreg/runtime/appcds/ClassPathAttr.java	Wed Oct 03 15:54:35 2018 +0200
+++ b/test/hotspot/jtreg/runtime/appcds/ClassPathAttr.java	Wed Oct 03 16:02:24 2018 +0200
@@ -30,7 +30,7 @@
  * @modules java.base/jdk.internal.misc
  *          java.management
  *          jdk.jartool/sun.tools.jar
- * @run main ClassPathAttr
+ * @run driver ClassPathAttr
  */
 
 import jdk.test.lib.process.OutputAnalyzer;
--- a/test/hotspot/jtreg/runtime/appcds/CommandLineFlagComboNegative.java	Wed Oct 03 15:54:35 2018 +0200
+++ b/test/hotspot/jtreg/runtime/appcds/CommandLineFlagComboNegative.java	Wed Oct 03 16:02:24 2018 +0200
@@ -34,7 +34,7 @@
  *          java.management
  *          jdk.jartool/sun.tools.jar
  * @compile test-classes/Hello.java
- * @run main CommandLineFlagComboNegative
+ * @run driver CommandLineFlagComboNegative
  */
 
 import java.util.ArrayList;
--- a/test/hotspot/jtreg/runtime/appcds/DirClasspathTest.java	Wed Oct 03 15:54:35 2018 +0200
+++ b/test/hotspot/jtreg/runtime/appcds/DirClasspathTest.java	Wed Oct 03 16:02:24 2018 +0200
@@ -28,7 +28,7 @@
  * @requires vm.cds
  * @library /test/lib
  * @compile test-classes/Hello.java
- * @run main DirClasspathTest
+ * @run driver DirClasspathTest
  */
 
 import jdk.test.lib.Platform;
--- a/test/hotspot/jtreg/runtime/appcds/DumpClassList.java	Wed Oct 03 15:54:35 2018 +0200
+++ b/test/hotspot/jtreg/runtime/appcds/DumpClassList.java	Wed Oct 03 16:02:24 2018 +0200
@@ -31,7 +31,7 @@
  * @modules java.base/jdk.internal.misc
  *          jdk.jartool/sun.tools.jar
  * @compile test-classes/ArrayListTest.java
- * @run main DumpClassList
+ * @run driver DumpClassList
  */
 
 import jdk.test.lib.compiler.InMemoryJavaCompiler;
--- a/test/hotspot/jtreg/runtime/appcds/ExtraSymbols.java	Wed Oct 03 15:54:35 2018 +0200
+++ b/test/hotspot/jtreg/runtime/appcds/ExtraSymbols.java	Wed Oct 03 16:02:24 2018 +0200
@@ -31,7 +31,7 @@
  *          java.management
  *          jdk.jartool/sun.tools.jar
  * @compile test-classes/Hello.java
- * @run main ExtraSymbols
+ * @run driver ExtraSymbols
  */
 
 import java.io.*;
--- a/test/hotspot/jtreg/runtime/appcds/FieldAnnotationsTest.java	Wed Oct 03 15:54:35 2018 +0200
+++ b/test/hotspot/jtreg/runtime/appcds/FieldAnnotationsTest.java	Wed Oct 03 16:02:24 2018 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2017, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2017, 2018, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -31,7 +31,7 @@
  *          java.management
  *          jdk.jartool/sun.tools.jar
  * @compile test-classes/FieldAnnotationsApp.java test-classes/MyAnnotation.java
- * @run main FieldAnnotationsTest
+ * @run driver FieldAnnotationsTest
  */
 
 import jdk.test.lib.process.OutputAnalyzer;
--- a/test/hotspot/jtreg/runtime/appcds/FreeUnusedMetadata.java	Wed Oct 03 15:54:35 2018 +0200
+++ b/test/hotspot/jtreg/runtime/appcds/FreeUnusedMetadata.java	Wed Oct 03 16:02:24 2018 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2017, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2017, 2018, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -29,7 +29,7 @@
  * @library /test/lib
  * @modules jdk.jartool/sun.tools.jar
  * @compile test-classes/MethodNoReturn.jasm test-classes/Hello.java
- * @run main FreeUnusedMetadata
+ * @run driver FreeUnusedMetadata
  */
 
 import java.nio.file.Files;
--- a/test/hotspot/jtreg/runtime/appcds/GraalWithLimitedMetaspace.java	Wed Oct 03 15:54:35 2018 +0200
+++ b/test/hotspot/jtreg/runtime/appcds/GraalWithLimitedMetaspace.java	Wed Oct 03 16:02:24 2018 +0200
@@ -87,7 +87,6 @@
 
     static void dumpLoadedClasses(String[] expectedClasses) throws Exception {
         ProcessBuilder pb = ProcessTools.createJavaProcessBuilder(true,
-          TestCommon.makeCommandLineForAppCDS(
             "-XX:DumpLoadedClassList=" + CLASSLIST_FILE,
             // trigger JVMCI runtime init so that JVMCI classes will be
             // included in the classlist
@@ -95,7 +94,7 @@
             "-cp",
             TESTJAR,
             TESTNAME,
-            TEST_OUT));
+            TEST_OUT);
 
         OutputAnalyzer output = TestCommon.executeAndLog(pb, "dump-loaded-classes")
             .shouldHaveExitValue(0)
@@ -113,7 +112,6 @@
 
     static void dumpArchive() throws Exception {
         ProcessBuilder pb = ProcessTools.createJavaProcessBuilder(true,
-          TestCommon.makeCommandLineForAppCDS(
             "-cp",
             TESTJAR,
             "-XX:SharedClassListFile=" + CLASSLIST_FILE,
@@ -121,7 +119,7 @@
             "-Xlog:cds",
             "-Xshare:dump",
             "-XX:MetaspaceSize=12M",
-            "-XX:MaxMetaspaceSize=12M"));
+            "-XX:MaxMetaspaceSize=12M");
 
         OutputAnalyzer output = TestCommon.executeAndLog(pb, "dump-archive");
         int exitValue = output.getExitValue();
--- a/test/hotspot/jtreg/runtime/appcds/HelloExtTest.java	Wed Oct 03 15:54:35 2018 +0200
+++ b/test/hotspot/jtreg/runtime/appcds/HelloExtTest.java	Wed Oct 03 16:02:24 2018 +0200
@@ -35,7 +35,7 @@
  * @compile test-classes/HelloExt.java
  * @build sun.hotspot.WhiteBox
  * @run driver ClassFileInstaller sun.hotspot.WhiteBox
- * @run main HelloExtTest
+ * @run driver HelloExtTest
  */
 
 import jdk.test.lib.process.OutputAnalyzer;
--- a/test/hotspot/jtreg/runtime/appcds/HelloTest.java	Wed Oct 03 15:54:35 2018 +0200
+++ b/test/hotspot/jtreg/runtime/appcds/HelloTest.java	Wed Oct 03 16:02:24 2018 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2015, 2017, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2015, 2018, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -31,7 +31,7 @@
  *          java.management
  *          jdk.jartool/sun.tools.jar
  * @compile test-classes/Hello.java
- * @run main HelloTest
+ * @run driver HelloTest
  */
 
 public class HelloTest {
--- a/test/hotspot/jtreg/runtime/appcds/IgnoreEmptyClassPaths.java	Wed Oct 03 15:54:35 2018 +0200
+++ b/test/hotspot/jtreg/runtime/appcds/IgnoreEmptyClassPaths.java	Wed Oct 03 16:02:24 2018 +0200
@@ -32,7 +32,7 @@
  *          jdk.jartool/sun.tools.jar
  * @compile test-classes/Hello.java
  * @compile test-classes/HelloMore.java
- * @run main IgnoreEmptyClassPaths
+ * @run driver IgnoreEmptyClassPaths
  */
 
 import java.io.File;
--- a/test/hotspot/jtreg/runtime/appcds/JvmtiAddPath.java	Wed Oct 03 15:54:35 2018 +0200
+++ b/test/hotspot/jtreg/runtime/appcds/JvmtiAddPath.java	Wed Oct 03 16:02:24 2018 +0200
@@ -35,7 +35,7 @@
  * @run driver ClassFileInstaller sun.hotspot.WhiteBox
  * @compile test-classes/Hello.java
  * @compile test-classes/JvmtiApp.java
- * @run main JvmtiAddPath
+ * @run driver JvmtiAddPath
  */
 
 import java.io.File;
--- a/test/hotspot/jtreg/runtime/appcds/MissingSuperTest.java	Wed Oct 03 15:54:35 2018 +0200
+++ b/test/hotspot/jtreg/runtime/appcds/MissingSuperTest.java	Wed Oct 03 16:02:24 2018 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2014, 2017, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2014, 2018, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -32,7 +32,7 @@
  *          java.management
  *          jdk.jartool/sun.tools.jar
  * @compile test-classes/MissingSuper.java
- * @run main MissingSuperTest
+ * @run driver MissingSuperTest
  */
 
 public class MissingSuperTest {
--- a/test/hotspot/jtreg/runtime/appcds/MoveJDKTest.java	Wed Oct 03 15:54:35 2018 +0200
+++ b/test/hotspot/jtreg/runtime/appcds/MoveJDKTest.java	Wed Oct 03 16:02:24 2018 +0200
@@ -32,7 +32,7 @@
  *          java.management
  *          jdk.jartool/sun.tools.jar
  * @compile test-classes/Hello.java
- * @run main MoveJDKTest
+ * @run driver MoveJDKTest
  */
 
 // This test works only on Linux because it depends on symlinks and the name of the hotspot DLL (libjvm.so).
--- a/test/hotspot/jtreg/runtime/appcds/MultiProcessSharing.java	Wed Oct 03 15:54:35 2018 +0200
+++ b/test/hotspot/jtreg/runtime/appcds/MultiProcessSharing.java	Wed Oct 03 16:02:24 2018 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2015, 2017, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2015, 2018, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -34,7 +34,7 @@
  * @build sun.hotspot.WhiteBox
  * @run driver ClassFileInstaller sun.hotspot.WhiteBox
  * @compile test-classes/MultiProcClass.java
- * @run main MultiProcessSharing
+ * @run driver MultiProcessSharing
  */
 
 import java.io.File;
--- a/test/hotspot/jtreg/runtime/appcds/OldClassTest.java	Wed Oct 03 15:54:35 2018 +0200
+++ b/test/hotspot/jtreg/runtime/appcds/OldClassTest.java	Wed Oct 03 16:02:24 2018 +0200
@@ -33,7 +33,7 @@
  *          jdk.jartool/sun.tools.jar
  * @compile test-classes/Hello.java
  * @run build TestCommon JarBuilder
- * @run main OldClassTest
+ * @run driver OldClassTest
  */
 
 import java.io.File;
--- a/test/hotspot/jtreg/runtime/appcds/PackageSealing.java	Wed Oct 03 15:54:35 2018 +0200
+++ b/test/hotspot/jtreg/runtime/appcds/PackageSealing.java	Wed Oct 03 16:02:24 2018 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2014, 2017, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2014, 2018, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -32,7 +32,7 @@
  * @compile test-classes/C1.java
  * @compile test-classes/C2.java
  * @compile test-classes/PackageSealingTest.java
- * @run main PackageSealing
+ * @run driver PackageSealing
  */
 
 import jdk.test.lib.process.OutputAnalyzer;
--- a/test/hotspot/jtreg/runtime/appcds/ParallelLoad2.java	Wed Oct 03 15:54:35 2018 +0200
+++ b/test/hotspot/jtreg/runtime/appcds/ParallelLoad2.java	Wed Oct 03 16:02:24 2018 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2014, 2017, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2014, 2018, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -32,7 +32,7 @@
  *          jdk.jartool/sun.tools.jar
  * @compile test-classes/ParallelLoad.java
  * @compile test-classes/ParallelClasses.java
- * @run main ParallelLoad2
+ * @run driver ParallelLoad2
  */
 
 import java.io.File;
--- a/test/hotspot/jtreg/runtime/appcds/ParallelLoadTest.java	Wed Oct 03 15:54:35 2018 +0200
+++ b/test/hotspot/jtreg/runtime/appcds/ParallelLoadTest.java	Wed Oct 03 16:02:24 2018 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2014, 2017, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2014, 2018, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -32,7 +32,7 @@
  *          jdk.jartool/sun.tools.jar
  * @compile test-classes/ParallelLoad.java
  * @compile test-classes/ParallelClasses.java
- * @run main ParallelLoadTest
+ * @run driver ParallelLoadTest
  */
 
 public class ParallelLoadTest {
--- a/test/hotspot/jtreg/runtime/appcds/ProhibitedPackage.java	Wed Oct 03 15:54:35 2018 +0200
+++ b/test/hotspot/jtreg/runtime/appcds/ProhibitedPackage.java	Wed Oct 03 16:02:24 2018 +0200
@@ -31,7 +31,7 @@
  *          java.management
  *          jdk.jartool/sun.tools.jar
  * @compile test-classes/ProhibitedHelper.java test-classes/Prohibited.jasm
- * @run main ProhibitedPackage
+ * @run driver ProhibitedPackage
  */
 
 import jdk.test.lib.cds.CDSOptions;
--- a/test/hotspot/jtreg/runtime/appcds/ProtectionDomain.java	Wed Oct 03 15:54:35 2018 +0200
+++ b/test/hotspot/jtreg/runtime/appcds/ProtectionDomain.java	Wed Oct 03 16:02:24 2018 +0200
@@ -33,7 +33,7 @@
  * @compile test-classes/ProtDomain.java
  * @compile test-classes/ProtDomainB.java
  * @compile test-classes/JimageClassProtDomain.java
- * @run main ProtectionDomain
+ * @run driver ProtectionDomain
  */
 
 import jdk.test.lib.process.OutputAnalyzer;
--- a/test/hotspot/jtreg/runtime/appcds/RewriteBytecodesTest.java	Wed Oct 03 15:54:35 2018 +0200
+++ b/test/hotspot/jtreg/runtime/appcds/RewriteBytecodesTest.java	Wed Oct 03 16:02:24 2018 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2015, 2017, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2015, 2018, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -34,7 +34,7 @@
  * @compile test-classes/RewriteBytecodes.java test-classes/Util.java test-classes/Super.java test-classes/Child.java
  * @build sun.hotspot.WhiteBox
  * @run driver ClassFileInstaller sun.hotspot.WhiteBox
- * @run main RewriteBytecodesTest
+ * @run driver RewriteBytecodesTest
  */
 
 import java.io.File;
--- a/test/hotspot/jtreg/runtime/appcds/SharedPackages.java	Wed Oct 03 15:54:35 2018 +0200
+++ b/test/hotspot/jtreg/runtime/appcds/SharedPackages.java	Wed Oct 03 16:02:24 2018 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2014, 2017, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2014, 2018, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -32,7 +32,7 @@
  *          jdk.jartool/sun.tools.jar
  * @compile test-classes/PackageTest.java
  * @compile test-classes/JimageClassPackage.java
- * @run main SharedPackages
+ * @run driver SharedPackages
  */
 
 import jdk.test.lib.process.OutputAnalyzer;
--- a/test/hotspot/jtreg/runtime/appcds/SignedJar.java	Wed Oct 03 15:54:35 2018 +0200
+++ b/test/hotspot/jtreg/runtime/appcds/SignedJar.java	Wed Oct 03 16:02:24 2018 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2014, 2017, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2014, 2018, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -31,7 +31,7 @@
  *          java.management
  *          jdk.jartool/sun.tools.jar
  * @compile test-classes/Hello.java
- * @run main SignedJar
+ * @run driver SignedJar
  */
 
 import jdk.test.lib.process.OutputAnalyzer;
--- a/test/hotspot/jtreg/runtime/appcds/SpecifySysLoaderProp.java	Wed Oct 03 15:54:35 2018 +0200
+++ b/test/hotspot/jtreg/runtime/appcds/SpecifySysLoaderProp.java	Wed Oct 03 16:02:24 2018 +0200
@@ -32,7 +32,7 @@
  * @compile test-classes/TestClassLoader.java
  * @compile test-classes/ReportMyLoader.java
  * @compile test-classes/TrySwitchMyLoader.java
- * @run main SpecifySysLoaderProp
+ * @run driver SpecifySysLoaderProp
  */
 
 import java.io.*;
--- a/test/hotspot/jtreg/runtime/appcds/TestCommon.java	Wed Oct 03 15:54:35 2018 +0200
+++ b/test/hotspot/jtreg/runtime/appcds/TestCommon.java	Wed Oct 03 16:02:24 2018 +0200
@@ -110,10 +110,6 @@
         return createArchive(opts);
     }
 
-    public static String[] makeCommandLineForAppCDS(String... args) throws Exception {
-        return args;
-    }
-
     // Create AppCDS archive using appcds options
     public static OutputAnalyzer createArchive(AppCDSOptions opts)
         throws Exception {
@@ -143,7 +139,7 @@
         for (String s : opts.suffix) cmd.add(s);
 
         String[] cmdLine = cmd.toArray(new String[cmd.size()]);
-        ProcessBuilder pb = ProcessTools.createJavaProcessBuilder(true, makeCommandLineForAppCDS(cmdLine));
+        ProcessBuilder pb = ProcessTools.createJavaProcessBuilder(true, cmdLine);
         return executeAndLog(pb, "dump");
     }
 
@@ -169,7 +165,7 @@
         for (String s : opts.suffix) cmd.add(s);
 
         String[] cmdLine = cmd.toArray(new String[cmd.size()]);
-        ProcessBuilder pb = ProcessTools.createJavaProcessBuilder(true, makeCommandLineForAppCDS(cmdLine));
+        ProcessBuilder pb = ProcessTools.createJavaProcessBuilder(true, cmdLine);
         return executeAndLog(pb, "exec");
     }
 
--- a/test/hotspot/jtreg/runtime/appcds/TestWithProfiler.java	Wed Oct 03 15:54:35 2018 +0200
+++ b/test/hotspot/jtreg/runtime/appcds/TestWithProfiler.java	Wed Oct 03 16:02:24 2018 +0200
@@ -36,7 +36,7 @@
  *          jdk.jartool/sun.tools.jar
  * @compile test-classes/MyThread.java
  * @compile test-classes/TestWithProfilerHelper.java
- * @run main TestWithProfiler
+ * @run driver TestWithProfiler
  */
 
 import jdk.test.lib.BuildHelper;
--- a/test/hotspot/jtreg/runtime/appcds/TraceLongClasspath.java	Wed Oct 03 15:54:35 2018 +0200
+++ b/test/hotspot/jtreg/runtime/appcds/TraceLongClasspath.java	Wed Oct 03 16:02:24 2018 +0200
@@ -31,7 +31,7 @@
  *          java.management
  *          jdk.jartool/sun.tools.jar
  * @compile test-classes/Hello.java
- * @run main TraceLongClasspath
+ * @run driver TraceLongClasspath
  */
 
 import java.io.File;
--- a/test/hotspot/jtreg/runtime/appcds/WideIloadTest.java	Wed Oct 03 15:54:35 2018 +0200
+++ b/test/hotspot/jtreg/runtime/appcds/WideIloadTest.java	Wed Oct 03 16:02:24 2018 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2016, 2017, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2016, 2018, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -32,7 +32,7 @@
  *          jdk.jartool/sun.tools.jar
  * @compile test-classes/Iloadw.jasm
  * @compile test-classes/IloadwMain.java
- * @run main WideIloadTest
+ * @run driver WideIloadTest
  */
 
 import jdk.test.lib.process.OutputAnalyzer;
--- a/test/hotspot/jtreg/runtime/appcds/WrongClasspath.java	Wed Oct 03 15:54:35 2018 +0200
+++ b/test/hotspot/jtreg/runtime/appcds/WrongClasspath.java	Wed Oct 03 16:02:24 2018 +0200
@@ -31,7 +31,7 @@
  *          java.management
  *          jdk.jartool/sun.tools.jar
  * @compile test-classes/Hello.java
- * @run main WrongClasspath
+ * @run driver WrongClasspath
  */
 
 import jdk.test.lib.process.OutputAnalyzer;
--- a/test/hotspot/jtreg/runtime/appcds/XShareAutoWithChangedJar.java	Wed Oct 03 15:54:35 2018 +0200
+++ b/test/hotspot/jtreg/runtime/appcds/XShareAutoWithChangedJar.java	Wed Oct 03 16:02:24 2018 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2015, 2017, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2015, 2018, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -31,7 +31,7 @@
  *          java.management
  *          jdk.jartool/sun.tools.jar
  * @compile test-classes/Hello.java
- * @run main XShareAutoWithChangedJar
+ * @run driver XShareAutoWithChangedJar
  */
 
 import jdk.test.lib.process.OutputAnalyzer;
--- a/test/hotspot/jtreg/runtime/appcds/cacheObject/ArchivedIntegerCacheTest.java	Wed Oct 03 15:54:35 2018 +0200
+++ b/test/hotspot/jtreg/runtime/appcds/cacheObject/ArchivedIntegerCacheTest.java	Wed Oct 03 16:02:24 2018 +0200
@@ -34,7 +34,7 @@
  * @compile CheckIntegerCacheApp.java
  * @run driver ClassFileInstaller -jar integer.jar CheckIntegerCacheApp
  * @run driver ClassFileInstaller -jar WhiteBox.jar sun.hotspot.WhiteBox
- * @run main ArchivedIntegerCacheTest
+ * @run driver ArchivedIntegerCacheTest
  */
 
 import java.nio.file.Files;
--- a/test/hotspot/jtreg/runtime/appcds/cacheObject/ArchivedModuleComboTest.java	Wed Oct 03 15:54:35 2018 +0200
+++ b/test/hotspot/jtreg/runtime/appcds/cacheObject/ArchivedModuleComboTest.java	Wed Oct 03 16:02:24 2018 +0200
@@ -34,7 +34,7 @@
  * @compile CheckArchivedModuleApp.java
  * @run driver ClassFileInstaller -jar app.jar CheckArchivedModuleApp
  * @run driver ClassFileInstaller -jar WhiteBox.jar sun.hotspot.WhiteBox
- * @run main ArchivedModuleComboTest
+ * @run driver ArchivedModuleComboTest
  */
 
 import java.io.File;
--- a/test/hotspot/jtreg/runtime/appcds/cacheObject/ArchivedModuleCompareTest.java	Wed Oct 03 15:54:35 2018 +0200
+++ b/test/hotspot/jtreg/runtime/appcds/cacheObject/ArchivedModuleCompareTest.java	Wed Oct 03 16:02:24 2018 +0200
@@ -32,7 +32,7 @@
  *          jdk.jartool/sun.tools.jar
  * @compile PrintSystemModulesApp.java
  * @run driver ClassFileInstaller -jar app.jar PrintSystemModulesApp
- * @run main ArchivedModuleCompareTest
+ * @run driver ArchivedModuleCompareTest
  */
 
 import jdk.test.lib.process.OutputAnalyzer;
--- a/test/hotspot/jtreg/runtime/appcds/cacheObject/ArchivedModuleWithCustomImageTest.java	Wed Oct 03 15:54:35 2018 +0200
+++ b/test/hotspot/jtreg/runtime/appcds/cacheObject/ArchivedModuleWithCustomImageTest.java	Wed Oct 03 16:02:24 2018 +0200
@@ -34,7 +34,7 @@
  * @compile CheckArchivedModuleApp.java
  * @run driver ClassFileInstaller -jar app.jar CheckArchivedModuleApp
  * @run driver ClassFileInstaller -jar WhiteBox.jar sun.hotspot.WhiteBox
- * @run main ArchivedModuleWithCustomImageTest
+ * @run driver ArchivedModuleWithCustomImageTest
  */
 
 import java.io.File;
--- a/test/hotspot/jtreg/runtime/appcds/cacheObject/CheckCachedMirrorTest.java	Wed Oct 03 15:54:35 2018 +0200
+++ b/test/hotspot/jtreg/runtime/appcds/cacheObject/CheckCachedMirrorTest.java	Wed Oct 03 16:02:24 2018 +0200
@@ -37,7 +37,7 @@
  * @run driver ClassFileInstaller -jar app.jar CheckCachedMirrorApp
  * @run driver ClassFileInstaller -jar hello.jar Hello
  * @run driver ClassFileInstaller -jar WhiteBox.jar sun.hotspot.WhiteBox
- * @run main CheckCachedMirrorTest
+ * @run driver CheckCachedMirrorTest
  */
 
 import jdk.test.lib.process.OutputAnalyzer;
--- a/test/hotspot/jtreg/runtime/appcds/cacheObject/CheckCachedResolvedReferences.java	Wed Oct 03 15:54:35 2018 +0200
+++ b/test/hotspot/jtreg/runtime/appcds/cacheObject/CheckCachedResolvedReferences.java	Wed Oct 03 16:02:24 2018 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2017, 2018 Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2017, 2018, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -37,7 +37,7 @@
  * @run driver ClassFileInstaller -jar app.jar CheckCachedResolvedReferencesApp
  * @run driver ClassFileInstaller -jar hello.jar Hello
  * @run driver ClassFileInstaller -jar WhiteBox.jar sun.hotspot.WhiteBox
- * @run main CheckCachedResolvedReferences
+ * @run driver CheckCachedResolvedReferences
  */
 
 import jdk.test.lib.process.OutputAnalyzer;
--- a/test/hotspot/jtreg/runtime/appcds/cacheObject/DifferentHeapSizes.java	Wed Oct 03 15:54:35 2018 +0200
+++ b/test/hotspot/jtreg/runtime/appcds/cacheObject/DifferentHeapSizes.java	Wed Oct 03 16:02:24 2018 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2018 Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2018, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
--- a/test/hotspot/jtreg/runtime/appcds/cacheObject/DumpTimeVerifyFailure.java	Wed Oct 03 15:54:35 2018 +0200
+++ b/test/hotspot/jtreg/runtime/appcds/cacheObject/DumpTimeVerifyFailure.java	Wed Oct 03 16:02:24 2018 +0200
@@ -32,7 +32,7 @@
  * @modules java.management
  *          jdk.jartool/sun.tools.jar
  * @compile MyOuter.java MyException.java
- * @run main DumpTimeVerifyFailure
+ * @run driver DumpTimeVerifyFailure
  */
 
 import jdk.test.lib.process.OutputAnalyzer;
--- a/test/hotspot/jtreg/runtime/appcds/cacheObject/GCStressTest.java	Wed Oct 03 15:54:35 2018 +0200
+++ b/test/hotspot/jtreg/runtime/appcds/cacheObject/GCStressTest.java	Wed Oct 03 16:02:24 2018 +0200
@@ -34,7 +34,7 @@
  * @compile GCStressApp.java
  * @run driver ClassFileInstaller -jar gcstress.jar GCStressApp
  * @run driver ClassFileInstaller -jar WhiteBox.jar sun.hotspot.WhiteBox
- * @run main GCStressTest
+ * @run driver GCStressTest
  */
 
 import jdk.test.lib.process.OutputAnalyzer;
--- a/test/hotspot/jtreg/runtime/appcds/cacheObject/MirrorWithReferenceFieldsTest.java	Wed Oct 03 15:54:35 2018 +0200
+++ b/test/hotspot/jtreg/runtime/appcds/cacheObject/MirrorWithReferenceFieldsTest.java	Wed Oct 03 16:02:24 2018 +0200
@@ -34,7 +34,7 @@
  * @compile MirrorWithReferenceFieldsApp.java
  * @run driver ClassFileInstaller -jar app.jar MirrorWithReferenceFieldsApp
  * @run driver ClassFileInstaller -jar WhiteBox.jar sun.hotspot.WhiteBox
- * @run main MirrorWithReferenceFieldsTest
+ * @run driver MirrorWithReferenceFieldsTest
  */
 
 import jdk.test.lib.process.OutputAnalyzer;
--- a/test/hotspot/jtreg/runtime/appcds/cacheObject/OpenArchiveRegion.java	Wed Oct 03 15:54:35 2018 +0200
+++ b/test/hotspot/jtreg/runtime/appcds/cacheObject/OpenArchiveRegion.java	Wed Oct 03 16:02:24 2018 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2017, 2018 Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2017, 2018, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -32,7 +32,7 @@
  * @modules java.management
  *          jdk.jartool/sun.tools.jar
  * @compile ../test-classes/Hello.java
- * @run main OpenArchiveRegion
+ * @run driver OpenArchiveRegion
  */
 
 import jdk.test.lib.process.OutputAnalyzer;
--- a/test/hotspot/jtreg/runtime/appcds/cacheObject/PrimitiveTypesTest.java	Wed Oct 03 15:54:35 2018 +0200
+++ b/test/hotspot/jtreg/runtime/appcds/cacheObject/PrimitiveTypesTest.java	Wed Oct 03 16:02:24 2018 +0200
@@ -34,7 +34,7 @@
  * @compile PrimitiveTypesApp.java
  * @run driver ClassFileInstaller -jar app.jar PrimitiveTypesApp FieldsTest
  * @run driver ClassFileInstaller -jar WhiteBox.jar sun.hotspot.WhiteBox
- * @run main PrimitiveTypesTest
+ * @run driver PrimitiveTypesTest
  */
 
 import jdk.test.lib.process.OutputAnalyzer;
--- a/test/hotspot/jtreg/runtime/appcds/cacheObject/RedefineClassTest.java	Wed Oct 03 15:54:35 2018 +0200
+++ b/test/hotspot/jtreg/runtime/appcds/cacheObject/RedefineClassTest.java	Wed Oct 03 16:02:24 2018 +0200
@@ -34,7 +34,7 @@
  *        RedefineClassApp
  *        InstrumentationClassFileTransformer
  *        InstrumentationRegisterClassFileTransformer
- * @run main RedefineClassTest
+ * @run driver RedefineClassTest
  */
 
 import com.sun.tools.attach.VirtualMachine;
--- a/test/hotspot/jtreg/runtime/appcds/condy/CondyHelloTest.java	Wed Oct 03 15:54:35 2018 +0200
+++ b/test/hotspot/jtreg/runtime/appcds/condy/CondyHelloTest.java	Wed Oct 03 16:02:24 2018 +0200
@@ -31,7 +31,7 @@
  * @build sun.hotspot.WhiteBox CondyHelloTest CondyHelloApp
  * @run driver ClassFileInstaller -jar condy_hello.jar CondyHello CondyHelloApp
  * @run driver ClassFileInstaller -jar WhiteBox.jar sun.hotspot.WhiteBox
- * @run main CondyHelloTest
+ * @run driver CondyHelloTest
  */
 
 import jdk.test.lib.process.OutputAnalyzer;
--- a/test/hotspot/jtreg/runtime/appcds/customLoader/ClassListFormatA.java	Wed Oct 03 15:54:35 2018 +0200
+++ b/test/hotspot/jtreg/runtime/appcds/customLoader/ClassListFormatA.java	Wed Oct 03 16:02:24 2018 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2015, 2017, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2015, 2018, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -34,7 +34,7 @@
  *          jdk.jartool/sun.tools.jar
  * @compile test-classes/Hello.java test-classes/CustomLoadee.java test-classes/CustomLoadee2.java
  *          test-classes/CustomInterface2_ia.java test-classes/CustomInterface2_ib.java
- * @run main ClassListFormatA
+ * @run driver ClassListFormatA
  */
 
 public class ClassListFormatA extends ClassListFormatBase {
--- a/test/hotspot/jtreg/runtime/appcds/customLoader/ClassListFormatB.java	Wed Oct 03 15:54:35 2018 +0200
+++ b/test/hotspot/jtreg/runtime/appcds/customLoader/ClassListFormatB.java	Wed Oct 03 16:02:24 2018 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2015, 2017, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2015, 2018, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -34,7 +34,7 @@
  *          jdk.jartool/sun.tools.jar
  * @compile test-classes/Hello.java test-classes/CustomLoadee.java test-classes/CustomLoadee2.java
  *          test-classes/CustomInterface2_ia.java test-classes/CustomInterface2_ib.java
- * @run main ClassListFormatB
+ * @run driver ClassListFormatB
  */
 
 public class ClassListFormatB extends ClassListFormatBase {
--- a/test/hotspot/jtreg/runtime/appcds/customLoader/ClassListFormatC.java	Wed Oct 03 15:54:35 2018 +0200
+++ b/test/hotspot/jtreg/runtime/appcds/customLoader/ClassListFormatC.java	Wed Oct 03 16:02:24 2018 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2015, 2017, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2015, 2018, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -34,7 +34,7 @@
  *          jdk.jartool/sun.tools.jar
  * @compile test-classes/Hello.java test-classes/CustomLoadee.java test-classes/CustomLoadee2.java
  *          test-classes/CustomInterface2_ia.java test-classes/CustomInterface2_ib.java
- * @run main ClassListFormatC
+ * @run driver ClassListFormatC
  */
 
 public class ClassListFormatC extends ClassListFormatBase {
--- a/test/hotspot/jtreg/runtime/appcds/customLoader/ClassListFormatD.java	Wed Oct 03 15:54:35 2018 +0200
+++ b/test/hotspot/jtreg/runtime/appcds/customLoader/ClassListFormatD.java	Wed Oct 03 16:02:24 2018 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2015, 2017, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2015, 2018, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -34,7 +34,7 @@
  *          jdk.jartool/sun.tools.jar
  * @compile test-classes/Hello.java test-classes/CustomLoadee.java test-classes/CustomLoadee2.java
  *          test-classes/CustomInterface2_ia.java test-classes/CustomInterface2_ib.java
- * @run main ClassListFormatD
+ * @run driver ClassListFormatD
  */
 
 public class ClassListFormatD extends ClassListFormatBase {
--- a/test/hotspot/jtreg/runtime/appcds/customLoader/ClassListFormatE.java	Wed Oct 03 15:54:35 2018 +0200
+++ b/test/hotspot/jtreg/runtime/appcds/customLoader/ClassListFormatE.java	Wed Oct 03 16:02:24 2018 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2015, 2017, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2015, 2018, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -34,7 +34,7 @@
  *          jdk.jartool/sun.tools.jar
  * @compile test-classes/Hello.java test-classes/CustomLoadee.java test-classes/CustomLoadee2.java
  *          test-classes/CustomInterface2_ia.java test-classes/CustomInterface2_ib.java
- * @run main ClassListFormatE
+ * @run driver ClassListFormatE
  */
 
 public class ClassListFormatE extends ClassListFormatBase {
--- a/test/hotspot/jtreg/runtime/appcds/customLoader/HelloCustom.java	Wed Oct 03 15:54:35 2018 +0200
+++ b/test/hotspot/jtreg/runtime/appcds/customLoader/HelloCustom.java	Wed Oct 03 16:02:24 2018 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2015, 2017, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2015, 2018, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -35,7 +35,7 @@
  * @run driver ClassFileInstaller -jar hello.jar Hello
  * @run driver ClassFileInstaller -jar hello_custom.jar CustomLoadee
  * @run driver ClassFileInstaller -jar WhiteBox.jar sun.hotspot.WhiteBox
- * @run main HelloCustom
+ * @run driver HelloCustom
  */
 
 import jdk.test.lib.process.OutputAnalyzer;
--- a/test/hotspot/jtreg/runtime/appcds/customLoader/LoaderSegregationTest.java	Wed Oct 03 15:54:35 2018 +0200
+++ b/test/hotspot/jtreg/runtime/appcds/customLoader/LoaderSegregationTest.java	Wed Oct 03 16:02:24 2018 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2015, 2017, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2015, 2018, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -41,7 +41,7 @@
  *          ../test-classes/Util.java
  * @build sun.hotspot.WhiteBox
  * @run driver ClassFileInstaller sun.hotspot.WhiteBox
- * @run main LoaderSegregationTest
+ * @run driver LoaderSegregationTest
  */
 
 import jdk.test.lib.process.OutputAnalyzer;
--- a/test/hotspot/jtreg/runtime/appcds/customLoader/ParallelTestMultiFP.java	Wed Oct 03 15:54:35 2018 +0200
+++ b/test/hotspot/jtreg/runtime/appcds/customLoader/ParallelTestMultiFP.java	Wed Oct 03 16:02:24 2018 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2015, 2017, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2015, 2018, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -32,7 +32,7 @@
  *          java.management
  *          jdk.jartool/sun.tools.jar
  * @compile ../test-classes/ParallelLoad.java ../test-classes/ParallelClasses.java
- * @run main ParallelTestMultiFP
+ * @run driver ParallelTestMultiFP
  */
 
 public class ParallelTestMultiFP extends ParallelTestBase {
--- a/test/hotspot/jtreg/runtime/appcds/customLoader/ParallelTestSingleFP.java	Wed Oct 03 15:54:35 2018 +0200
+++ b/test/hotspot/jtreg/runtime/appcds/customLoader/ParallelTestSingleFP.java	Wed Oct 03 16:02:24 2018 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2015, 2017, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2015, 2018, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -32,7 +32,7 @@
  *          java.management
  *          jdk.jartool/sun.tools.jar
  * @compile ../test-classes/ParallelLoad.java ../test-classes/ParallelClasses.java
- * @run main ParallelTestSingleFP
+ * @run driver ParallelTestSingleFP
  */
 
 public class ParallelTestSingleFP extends ParallelTestBase {
--- a/test/hotspot/jtreg/runtime/appcds/customLoader/ProhibitedPackageNamesTest.java	Wed Oct 03 15:54:35 2018 +0200
+++ b/test/hotspot/jtreg/runtime/appcds/customLoader/ProhibitedPackageNamesTest.java	Wed Oct 03 16:02:24 2018 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2015, 2017, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2015, 2018, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -32,7 +32,7 @@
  *          java.management
  *          jdk.jartool/sun.tools.jar
  * @compile ClassListFormatBase.java test-classes/Hello.java test-classes/InProhibitedPkg.java
- * @run main ProhibitedPackageNamesTest
+ * @run driver ProhibitedPackageNamesTest
  */
 
 public class ProhibitedPackageNamesTest extends ClassListFormatBase {
--- a/test/hotspot/jtreg/runtime/appcds/customLoader/ProtectionDomain.java	Wed Oct 03 15:54:35 2018 +0200
+++ b/test/hotspot/jtreg/runtime/appcds/customLoader/ProtectionDomain.java	Wed Oct 03 16:02:24 2018 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2016, 2017, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2016, 2018, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -34,7 +34,7 @@
  *          java.management
  *          jdk.jartool/sun.tools.jar
  * @compile test-classes/ProtDomain.java
- * @run main ProtectionDomain
+ * @run driver ProtectionDomain
  */
 
 public class ProtectionDomain {
--- a/test/hotspot/jtreg/runtime/appcds/customLoader/SameNameInTwoLoadersTest.java	Wed Oct 03 15:54:35 2018 +0200
+++ b/test/hotspot/jtreg/runtime/appcds/customLoader/SameNameInTwoLoadersTest.java	Wed Oct 03 16:02:24 2018 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2015, 2017, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2015, 2018, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -38,7 +38,7 @@
  *     test-classes/SameNameUnrelatedLoaders.java
  * @build sun.hotspot.WhiteBox
  * @run driver ClassFileInstaller sun.hotspot.WhiteBox
- * @run main SameNameInTwoLoadersTest
+ * @run driver SameNameInTwoLoadersTest
  */
 
 import jdk.test.lib.process.OutputAnalyzer;
--- a/test/hotspot/jtreg/runtime/appcds/customLoader/UnintendedLoadersTest.java	Wed Oct 03 15:54:35 2018 +0200
+++ b/test/hotspot/jtreg/runtime/appcds/customLoader/UnintendedLoadersTest.java	Wed Oct 03 16:02:24 2018 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2015, 2017, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2015, 2018, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -34,7 +34,7 @@
  * @compile test-classes/UnintendedLoaders.java test-classes/CustomLoadee.java
  * @build sun.hotspot.WhiteBox
  * @run driver ClassFileInstaller sun.hotspot.WhiteBox
- * @run main UnintendedLoadersTest
+ * @run driver UnintendedLoadersTest
  */
 
 import jdk.test.lib.process.OutputAnalyzer;
--- a/test/hotspot/jtreg/runtime/appcds/customLoader/UnloadUnregisteredLoaderTest.java	Wed Oct 03 15:54:35 2018 +0200
+++ b/test/hotspot/jtreg/runtime/appcds/customLoader/UnloadUnregisteredLoaderTest.java	Wed Oct 03 16:02:24 2018 +0200
@@ -39,7 +39,7 @@
  * @run driver ClassFileInstaller ClassUnloadCommon
  * @run driver ClassFileInstaller ClassUnloadCommon$1
  * @run driver ClassFileInstaller ClassUnloadCommon$TestFailure
- * @run main UnloadUnregisteredLoaderTest
+ * @run driver UnloadUnregisteredLoaderTest
  */
 
 import jdk.test.lib.process.OutputAnalyzer;
--- a/test/hotspot/jtreg/runtime/appcds/customLoader/UnsupportedPlatforms.java	Wed Oct 03 15:54:35 2018 +0200
+++ b/test/hotspot/jtreg/runtime/appcds/customLoader/UnsupportedPlatforms.java	Wed Oct 03 16:02:24 2018 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2015, 2017, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2015, 2018, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -31,7 +31,7 @@
  *          java.management
  *          jdk.jartool/sun.tools.jar
  * @compile test-classes/SimpleHello.java
- * @run main UnsupportedPlatforms
+ * @run driver UnsupportedPlatforms
  */
 
 import jdk.test.lib.Platform;
--- a/test/hotspot/jtreg/runtime/appcds/javaldr/ArrayTest.java	Wed Oct 03 15:54:35 2018 +0200
+++ b/test/hotspot/jtreg/runtime/appcds/javaldr/ArrayTest.java	Wed Oct 03 16:02:24 2018 +0200
@@ -31,7 +31,7 @@
  * @compile ArrayTestHelper.java
  * @build sun.hotspot.WhiteBox
  * @run driver ClassFileInstaller sun.hotspot.WhiteBox
- * @run main ArrayTest
+ * @run driver ArrayTest
  */
 
 import java.util.List;
--- a/test/hotspot/jtreg/runtime/appcds/jigsaw/CheckUnsupportedDumpingOptions.java	Wed Oct 03 15:54:35 2018 +0200
+++ b/test/hotspot/jtreg/runtime/appcds/jigsaw/CheckUnsupportedDumpingOptions.java	Wed Oct 03 16:02:24 2018 +0200
@@ -32,7 +32,7 @@
  *          jdk.jartool/sun.tools.jar
  *          jdk.internal.jvmstat/sun.jvmstat.monitor
  * @compile ../test-classes/Hello.java
- * @run main CheckUnsupportedDumpingOptions
+ * @run driver CheckUnsupportedDumpingOptions
  */
 
 import jdk.test.lib.compiler.InMemoryJavaCompiler;
--- a/test/hotspot/jtreg/runtime/appcds/jigsaw/JigsawOptionsCombo.java	Wed Oct 03 15:54:35 2018 +0200
+++ b/test/hotspot/jtreg/runtime/appcds/jigsaw/JigsawOptionsCombo.java	Wed Oct 03 16:02:24 2018 +0200
@@ -33,7 +33,7 @@
  *          jdk.jartool/sun.tools.jar
  *          jdk.internal.jvmstat/sun.jvmstat.monitor
  * @compile ../test-classes/Hello.java ../test-classes/HelloMore.java
- * @run main JigsawOptionsCombo
+ * @run driver JigsawOptionsCombo
  */
 import jdk.test.lib.compiler.InMemoryJavaCompiler;
 import jdk.test.lib.process.OutputAnalyzer;
--- a/test/hotspot/jtreg/runtime/appcds/jigsaw/PatchModule/AppClassInCP.java	Wed Oct 03 15:54:35 2018 +0200
+++ b/test/hotspot/jtreg/runtime/appcds/jigsaw/PatchModule/AppClassInCP.java	Wed Oct 03 16:02:24 2018 +0200
@@ -34,7 +34,7 @@
  * @modules java.base/jdk.internal.misc
  *          jdk.jartool/sun.tools.jar
  * @build PatchMain
- * @run main AppClassInCP
+ * @run driver AppClassInCP
  */
 
 import java.io.File;
--- a/test/hotspot/jtreg/runtime/appcds/jigsaw/PatchModule/CustomPackage.java	Wed Oct 03 15:54:35 2018 +0200
+++ b/test/hotspot/jtreg/runtime/appcds/jigsaw/PatchModule/CustomPackage.java	Wed Oct 03 16:02:24 2018 +0200
@@ -34,7 +34,7 @@
  * @modules java.base/jdk.internal.misc
  *          jdk.jartool/sun.tools.jar
  * @build PatchMain
- * @run main CustomPackage
+ * @run driver CustomPackage
  */
 
 import jdk.test.lib.compiler.InMemoryJavaCompiler;
--- a/test/hotspot/jtreg/runtime/appcds/jigsaw/PatchModule/MismatchedPatchModule.java	Wed Oct 03 15:54:35 2018 +0200
+++ b/test/hotspot/jtreg/runtime/appcds/jigsaw/PatchModule/MismatchedPatchModule.java	Wed Oct 03 16:02:24 2018 +0200
@@ -34,7 +34,7 @@
  * @modules java.base/jdk.internal.misc
  *          jdk.jartool/sun.tools.jar
  * @build PatchMain
- * @run main MismatchedPatchModule
+ * @run driver MismatchedPatchModule
  */
 
 import jdk.test.lib.compiler.InMemoryJavaCompiler;
--- a/test/hotspot/jtreg/runtime/appcds/jigsaw/PatchModule/PatchDir.java	Wed Oct 03 15:54:35 2018 +0200
+++ b/test/hotspot/jtreg/runtime/appcds/jigsaw/PatchModule/PatchDir.java	Wed Oct 03 16:02:24 2018 +0200
@@ -33,7 +33,7 @@
  * @modules java.base/jdk.internal.misc
  *          jdk.jartool/sun.tools.jar
  * @build PatchMain
- * @run main PatchDir
+ * @run driver PatchDir
  */
 
 import java.io.File;
--- a/test/hotspot/jtreg/runtime/appcds/jigsaw/PatchModule/PatchJavaBase.java	Wed Oct 03 15:54:35 2018 +0200
+++ b/test/hotspot/jtreg/runtime/appcds/jigsaw/PatchModule/PatchJavaBase.java	Wed Oct 03 16:02:24 2018 +0200
@@ -32,7 +32,7 @@
  * @modules java.base/jdk.internal.misc
  *          jdk.jartool/sun.tools.jar
  * @build PatchMain
- * @run main PatchJavaBase
+ * @run driver PatchJavaBase
  */
 
 import jdk.test.lib.compiler.InMemoryJavaCompiler;
--- a/test/hotspot/jtreg/runtime/appcds/jigsaw/PatchModule/Simple.java	Wed Oct 03 15:54:35 2018 +0200
+++ b/test/hotspot/jtreg/runtime/appcds/jigsaw/PatchModule/Simple.java	Wed Oct 03 16:02:24 2018 +0200
@@ -32,7 +32,7 @@
  * @modules java.base/jdk.internal.misc
  *          jdk.jartool/sun.tools.jar
  * @build PatchMain
- * @run main Simple
+ * @run driver Simple
  */
 
 import jdk.test.lib.compiler.InMemoryJavaCompiler;
--- a/test/hotspot/jtreg/runtime/appcds/jigsaw/PatchModule/SubClassOfPatchedClass.java	Wed Oct 03 15:54:35 2018 +0200
+++ b/test/hotspot/jtreg/runtime/appcds/jigsaw/PatchModule/SubClassOfPatchedClass.java	Wed Oct 03 16:02:24 2018 +0200
@@ -33,7 +33,7 @@
  * @modules java.base/jdk.internal.misc
  *          jdk.jartool/sun.tools.jar
  * @build PatchMain
- * @run main SubClassOfPatchedClass
+ * @run driver SubClassOfPatchedClass
  */
 
 import java.io.File;
--- a/test/hotspot/jtreg/runtime/appcds/jigsaw/PatchModule/TwoJars.java	Wed Oct 03 15:54:35 2018 +0200
+++ b/test/hotspot/jtreg/runtime/appcds/jigsaw/PatchModule/TwoJars.java	Wed Oct 03 16:02:24 2018 +0200
@@ -32,7 +32,7 @@
  * @modules java.base/jdk.internal.misc
  *          jdk.jartool/sun.tools.jar
  * @build PatchMain
- * @run main TwoJars
+ * @run driver TwoJars
  */
 
 import java.io.File;
--- a/test/hotspot/jtreg/runtime/appcds/jigsaw/classpathtests/BootAppendTests.java	Wed Oct 03 15:54:35 2018 +0200
+++ b/test/hotspot/jtreg/runtime/appcds/jigsaw/classpathtests/BootAppendTests.java	Wed Oct 03 16:02:24 2018 +0200
@@ -35,7 +35,7 @@
  * @compile src/com/sun/tools/javac/MyMain.jasm
  * @compile src/sun/nio/cs/ext/MyClass.java
  * @compile src/sun/nio/cs/ext1/MyClass.java
- * @run main BootAppendTests
+ * @run driver BootAppendTests
  */
 
 import java.io.File;
--- a/test/hotspot/jtreg/runtime/appcds/jigsaw/classpathtests/ClassPathTests.java	Wed Oct 03 15:54:35 2018 +0200
+++ b/test/hotspot/jtreg/runtime/appcds/jigsaw/classpathtests/ClassPathTests.java	Wed Oct 03 16:02:24 2018 +0200
@@ -34,7 +34,7 @@
  * @compile src/com/sun/tools/javac/Main.jasm
  * @compile src/com/sun/tools/javac/MyMain.jasm
  * @compile ../../../SharedArchiveFile/javax/annotation/processing/FilerException.jasm
- * @run main ClassPathTests
+ * @run driver ClassPathTests
  * @summary AppCDS tests for testing classpath/package conflicts
  */
 
@@ -52,6 +52,7 @@
  * same name and package.
  */
 
+import java.lang.reflect.InvocationTargetException;
 import java.lang.reflect.Method;
 import java.nio.file.Path;
 import java.nio.file.Paths;
@@ -62,6 +63,8 @@
 import jdk.test.lib.process.ProcessTools;
 import jdk.test.lib.process.OutputAnalyzer;
 
+import jtreg.SkippedException;
+
 
 public class ClassPathTests {
     private static final String TEST_SRC = System.getProperty("test.src");
@@ -83,7 +86,7 @@
     private static String testArchiveName;
 
 
-    public static void main(String[] args) throws Exception {
+    public static void main(String[] args) throws Throwable {
         ClassPathTests tests = new ClassPathTests();
         tests.dumpArchive();
 
@@ -92,7 +95,16 @@
         for (Method m : methods) {
             if (m.getName().startsWith("test")) {
                 System.out.println("About to run test method: " + m.getName());
-                m.invoke(tests);
+                try {
+                    m.invoke(tests);
+                } catch (InvocationTargetException ite) {
+                    Throwable throwable = ite.getCause();
+                    if (throwable instanceof SkippedException) {
+                        throw throwable;
+                    } else {
+                        throw ite;
+                    }
+                }
                 numOfTestMethodsRun++;
             }
         }
--- a/test/hotspot/jtreg/runtime/appcds/jigsaw/classpathtests/DummyClassesInBootClassPath.java	Wed Oct 03 15:54:35 2018 +0200
+++ b/test/hotspot/jtreg/runtime/appcds/jigsaw/classpathtests/DummyClassesInBootClassPath.java	Wed Oct 03 16:02:24 2018 +0200
@@ -34,7 +34,7 @@
  * @compile ../../../SharedArchiveFile/javax/annotation/processing/FilerException.jasm
  * @build sun.hotspot.WhiteBox
  * @run driver ClassFileInstaller sun.hotspot.WhiteBox
- * @run main DummyClassesInBootClassPath
+ * @run driver DummyClassesInBootClassPath
  */
 
 import java.io.File;
--- a/test/hotspot/jtreg/runtime/appcds/jigsaw/classpathtests/EmptyClassInBootClassPath.java	Wed Oct 03 15:54:35 2018 +0200
+++ b/test/hotspot/jtreg/runtime/appcds/jigsaw/classpathtests/EmptyClassInBootClassPath.java	Wed Oct 03 16:02:24 2018 +0200
@@ -37,7 +37,7 @@
  *          jdk.internal.jvmstat/sun.jvmstat.monitor
  * @compile ../../test-classes/EmptyClassHelper.java
  * @compile ../../test-classes/com/sun/tools/javac/Main.jasm
- * @run main EmptyClassInBootClassPath
+ * @run driver EmptyClassInBootClassPath
  */
 
 import java.io.File;
--- a/test/hotspot/jtreg/runtime/appcds/jigsaw/modulepath/AddModules.java	Wed Oct 03 15:54:35 2018 +0200
+++ b/test/hotspot/jtreg/runtime/appcds/jigsaw/modulepath/AddModules.java	Wed Oct 03 16:02:24 2018 +0200
@@ -29,7 +29,7 @@
  * @modules jdk.compiler
  *          jdk.jartool/sun.tools.jar
  *          jdk.jlink
- * @run main AddModules
+ * @run driver AddModules
  * @summary sanity test the --add-modules option
  */
 
--- a/test/hotspot/jtreg/runtime/appcds/jigsaw/modulepath/AddOpens.java	Wed Oct 03 15:54:35 2018 +0200
+++ b/test/hotspot/jtreg/runtime/appcds/jigsaw/modulepath/AddOpens.java	Wed Oct 03 16:02:24 2018 +0200
@@ -29,7 +29,7 @@
  * @modules jdk.compiler
  *          jdk.jartool/sun.tools.jar
  *          jdk.jlink
- * @run main AddOpens
+ * @run driver AddOpens
  * @summary sanity test the --add-opens option
  */
 
--- a/test/hotspot/jtreg/runtime/appcds/jigsaw/modulepath/AddReads.java	Wed Oct 03 15:54:35 2018 +0200
+++ b/test/hotspot/jtreg/runtime/appcds/jigsaw/modulepath/AddReads.java	Wed Oct 03 16:02:24 2018 +0200
@@ -29,7 +29,7 @@
  * @modules jdk.compiler
  *          jdk.jartool/sun.tools.jar
  *          jdk.jlink
- * @run main AddReads
+ * @run driver AddReads
  * @summary sanity test the --add-reads option
  */
 
--- a/test/hotspot/jtreg/runtime/appcds/jigsaw/modulepath/ExportModule.java	Wed Oct 03 15:54:35 2018 +0200
+++ b/test/hotspot/jtreg/runtime/appcds/jigsaw/modulepath/ExportModule.java	Wed Oct 03 16:02:24 2018 +0200
@@ -29,7 +29,7 @@
  * @modules jdk.compiler
  *          jdk.jartool/sun.tools.jar
  *          jdk.jlink
- * @run main ExportModule
+ * @run driver ExportModule
  * @summary Tests involve exporting a module from the module path to a jar in the -cp.
  */
 
--- a/test/hotspot/jtreg/runtime/appcds/jigsaw/modulepath/JvmtiAddPath.java	Wed Oct 03 15:54:35 2018 +0200
+++ b/test/hotspot/jtreg/runtime/appcds/jigsaw/modulepath/JvmtiAddPath.java	Wed Oct 03 16:02:24 2018 +0200
@@ -33,7 +33,7 @@
  * @build sun.hotspot.WhiteBox
  * @run driver ClassFileInstaller sun.hotspot.WhiteBox
  * @compile ../../test-classes/JvmtiApp.java
- * @run main JvmtiAddPath
+ * @run driver JvmtiAddPath
  */
 
 import java.io.File;
--- a/test/hotspot/jtreg/runtime/appcds/jigsaw/modulepath/MainModuleOnly.java	Wed Oct 03 15:54:35 2018 +0200
+++ b/test/hotspot/jtreg/runtime/appcds/jigsaw/modulepath/MainModuleOnly.java	Wed Oct 03 16:02:24 2018 +0200
@@ -29,7 +29,7 @@
  * @modules jdk.compiler
  *          jdk.jartool/sun.tools.jar
  *          jdk.jlink
- * @run main MainModuleOnly
+ * @run driver MainModuleOnly
  * @summary Test some scenarios with a main modular jar specified in the --module-path and -cp options in the command line.
  */
 
--- a/test/hotspot/jtreg/runtime/appcds/jigsaw/modulepath/ModulePathAndCP.java	Wed Oct 03 15:54:35 2018 +0200
+++ b/test/hotspot/jtreg/runtime/appcds/jigsaw/modulepath/ModulePathAndCP.java	Wed Oct 03 16:02:24 2018 +0200
@@ -29,7 +29,7 @@
  * @modules jdk.compiler
  *          jdk.jartool/sun.tools.jar
  *          jdk.jlink
- * @run main ModulePathAndCP
+ * @run driver ModulePathAndCP
  * @summary 2 sets of tests: one with only --module-path in the command line;
  *          another with both -cp and --module-path in the command line.
  */
--- a/test/hotspot/jtreg/runtime/appcds/jigsaw/overridetests/OverrideTests.java	Wed Oct 03 15:54:35 2018 +0200
+++ b/test/hotspot/jtreg/runtime/appcds/jigsaw/overridetests/OverrideTests.java	Wed Oct 03 16:02:24 2018 +0200
@@ -28,7 +28,7 @@
  * @modules java.base/jdk.internal.misc
  * @library ../..
  * @library /test/lib
- * @run main OverrideTests
+ * @run driver OverrideTests
  * @summary AppCDS tests for overriding archived classes with -p and --upgrade-module-path
  */
 
--- a/test/hotspot/jtreg/runtime/appcds/jvmti/parallelLoad/ParallelLoadAndTransformTest.java	Wed Oct 03 15:54:35 2018 +0200
+++ b/test/hotspot/jtreg/runtime/appcds/jvmti/parallelLoad/ParallelLoadAndTransformTest.java	Wed Oct 03 16:02:24 2018 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2016, 2017, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2016, 2018, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -36,7 +36,7 @@
  *          jdk.jartool/sun.tools.jar
  *          java.instrument
  * @build TransformUtil TransformerAgent ParallelLoad
- * @run main ParallelLoadAndTransformTest
+ * @run driver ParallelLoadAndTransformTest
  */
 import java.util.List;
 import java.util.stream.Collectors;
--- a/test/hotspot/jtreg/runtime/appcds/redefineClass/RedefineBasicTest.java	Wed Oct 03 15:54:35 2018 +0200
+++ b/test/hotspot/jtreg/runtime/appcds/redefineClass/RedefineBasicTest.java	Wed Oct 03 16:02:24 2018 +0200
@@ -33,9 +33,9 @@
  *          jdk.jartool/sun.tools.jar
  *          java.base/jdk.internal.misc
  *          java.management
- * @run main RedefineClassHelper
+ * @run driver RedefineClassHelper
  * @build sun.hotspot.WhiteBox RedefineBasic
- * @run main RedefineBasicTest
+ * @run driver RedefineBasicTest
  */
 
 import jdk.test.lib.process.OutputAnalyzer;
@@ -63,7 +63,7 @@
         OutputAnalyzer output;
         TestCommon.testDump(appJar, sharedClasses, useWb);
 
-        // redefineagent.jar is created by executing "@run main RedefineClassHelper"
+        // redefineagent.jar is created by executing "@run driver RedefineClassHelper"
         // which should be called before executing RedefineBasicTest
         output = TestCommon.exec(appJar, useWb,
                                  "-XX:+UnlockDiagnosticVMOptions",
--- a/test/hotspot/jtreg/runtime/appcds/redefineClass/RedefineRunningMethods_Shared.java	Wed Oct 03 15:54:35 2018 +0200
+++ b/test/hotspot/jtreg/runtime/appcds/redefineClass/RedefineRunningMethods_Shared.java	Wed Oct 03 16:02:24 2018 +0200
@@ -32,9 +32,9 @@
  * @modules java.compiler
  *          java.instrument
  *          jdk.jartool/sun.tools.jar
- * @run main RedefineClassHelper
+ * @run driver RedefineClassHelper
  * @build sun.hotspot.WhiteBox RedefineRunningMethods_SharedHelper
- * @run main RedefineRunningMethods_Shared
+ * @run driver RedefineRunningMethods_Shared
  */
 
 import jdk.test.lib.process.OutputAnalyzer;
--- a/test/hotspot/jtreg/runtime/appcds/sharedStrings/ExerciseGC.java	Wed Oct 03 15:54:35 2018 +0200
+++ b/test/hotspot/jtreg/runtime/appcds/sharedStrings/ExerciseGC.java	Wed Oct 03 16:02:24 2018 +0200
@@ -32,7 +32,7 @@
  *          jdk.jartool/sun.tools.jar
  * @build HelloStringGC sun.hotspot.WhiteBox
  * @run driver ClassFileInstaller sun.hotspot.WhiteBox
- * @run main ExerciseGC
+ * @run driver ExerciseGC
  * @run main/othervm -XX:+UseStringDeduplication ExerciseGC
  * @run main/othervm -XX:-CompactStrings ExerciseGC
  */
--- a/test/hotspot/jtreg/runtime/appcds/sharedStrings/FlagCombo.java	Wed Oct 03 15:54:35 2018 +0200
+++ b/test/hotspot/jtreg/runtime/appcds/sharedStrings/FlagCombo.java	Wed Oct 03 16:02:24 2018 +0200
@@ -31,7 +31,7 @@
  * @modules java.management
  *          jdk.jartool/sun.tools.jar
  * @build HelloString
- * @run main FlagCombo
+ * @run driver FlagCombo
  */
 
 /**
@@ -44,7 +44,7 @@
  * @modules java.management
  *          jdk.jartool/sun.tools.jar
  * @build HelloString
- * @run main FlagCombo noJfr
+ * @run driver FlagCombo noJfr
  */
 
 import jdk.test.lib.BuildHelper;
--- a/test/hotspot/jtreg/runtime/appcds/sharedStrings/InternSharedString.java	Wed Oct 03 15:54:35 2018 +0200
+++ b/test/hotspot/jtreg/runtime/appcds/sharedStrings/InternSharedString.java	Wed Oct 03 16:02:24 2018 +0200
@@ -33,7 +33,7 @@
  * @compile InternStringTest.java
  * @build sun.hotspot.WhiteBox
  * @run driver ClassFileInstaller sun.hotspot.WhiteBox
- * @run main InternSharedString
+ * @run driver InternSharedString
  * @run main/othervm -XX:+UseStringDeduplication InternSharedString
  * @run main/othervm -XX:-CompactStrings InternSharedString
  */
--- a/test/hotspot/jtreg/runtime/appcds/sharedStrings/InvalidFileFormat.java	Wed Oct 03 15:54:35 2018 +0200
+++ b/test/hotspot/jtreg/runtime/appcds/sharedStrings/InvalidFileFormat.java	Wed Oct 03 16:02:24 2018 +0200
@@ -31,7 +31,7 @@
  * @modules java.management
  *          jdk.jartool/sun.tools.jar
  * @build HelloString
- * @run main InvalidFileFormat
+ * @run driver InvalidFileFormat
  * @run main/othervm -XX:+UseStringDeduplication InvalidFileFormat
  * @run main/othervm -XX:-CompactStrings InvalidFileFormat
  */
--- a/test/hotspot/jtreg/runtime/appcds/sharedStrings/LargePages.java	Wed Oct 03 15:54:35 2018 +0200
+++ b/test/hotspot/jtreg/runtime/appcds/sharedStrings/LargePages.java	Wed Oct 03 16:02:24 2018 +0200
@@ -31,7 +31,7 @@
  * @modules java.management
  *          jdk.jartool/sun.tools.jar
  * @build HelloString
- * @run main LargePages
+ * @run driver LargePages
  * @run main/othervm -XX:+UseStringDeduplication LargePages
  * @run main/othervm -XX:-CompactStrings LargePages
  */
--- a/test/hotspot/jtreg/runtime/appcds/sharedStrings/LockSharedStrings.java	Wed Oct 03 15:54:35 2018 +0200
+++ b/test/hotspot/jtreg/runtime/appcds/sharedStrings/LockSharedStrings.java	Wed Oct 03 16:02:24 2018 +0200
@@ -33,7 +33,7 @@
  * @compile LockStringTest.java LockStringValueTest.java
  * @build sun.hotspot.WhiteBox
  * @run driver ClassFileInstaller sun.hotspot.WhiteBox
- * @run main LockSharedStrings
+ * @run driver LockSharedStrings
  * @run main/othervm -XX:+UseStringDeduplication LockSharedStrings
  * @run main/othervm -XX:-CompactStrings LockSharedStrings
  */
--- a/test/hotspot/jtreg/runtime/appcds/sharedStrings/SharedStringsBasic.java	Wed Oct 03 15:54:35 2018 +0200
+++ b/test/hotspot/jtreg/runtime/appcds/sharedStrings/SharedStringsBasic.java	Wed Oct 03 16:02:24 2018 +0200
@@ -31,7 +31,7 @@
  * @modules java.management
  *          jdk.jartool/sun.tools.jar
  * @build HelloString
- * @run main SharedStringsBasic
+ * @run driver SharedStringsBasic
  * @run main/othervm -XX:+UseStringDeduplication SharedStringsBasic
  * @run main/othervm -XX:-CompactStrings SharedStringsBasic
  */
@@ -49,24 +49,22 @@
             TestCommon.getSourceFile("SharedStringsBasic.txt").toString();
 
         ProcessBuilder dumpPb = ProcessTools.createJavaProcessBuilder(true,
-          TestCommon.makeCommandLineForAppCDS(
             "-cp", appJar,
             "-XX:SharedArchiveConfigFile=" + sharedArchiveConfigFile,
             "-XX:SharedArchiveFile=./SharedStringsBasic.jsa",
             "-Xshare:dump",
-            "-Xlog:cds,cds+hashtables"));
+            "-Xlog:cds,cds+hashtables");
 
         TestCommon.executeAndLog(dumpPb, "dump")
             .shouldContain("Shared string table stats")
             .shouldHaveExitValue(0);
 
         ProcessBuilder runPb = ProcessTools.createJavaProcessBuilder(true,
-          TestCommon.makeCommandLineForAppCDS(
             "-cp", appJar,
             "-XX:SharedArchiveFile=./SharedStringsBasic.jsa",
             "-Xshare:auto",
             "-showversion",
-            "HelloString"));
+            "HelloString");
 
         TestCommon.executeAndLog(runPb, "run").shouldHaveExitValue(0);
     }
--- a/test/hotspot/jtreg/runtime/appcds/sharedStrings/SharedStringsBasicPlus.java	Wed Oct 03 15:54:35 2018 +0200
+++ b/test/hotspot/jtreg/runtime/appcds/sharedStrings/SharedStringsBasicPlus.java	Wed Oct 03 16:02:24 2018 +0200
@@ -32,7 +32,7 @@
  *          jdk.jartool/sun.tools.jar
  * @build HelloStringPlus sun.hotspot.WhiteBox
  * @run driver ClassFileInstaller sun.hotspot.WhiteBox
- * @run main SharedStringsBasicPlus
+ * @run driver SharedStringsBasicPlus
  * @run main/othervm -XX:+UseStringDeduplication SharedStringsBasicPlus
  * @run main/othervm -XX:-CompactStrings SharedStringsBasicPlus
  */
--- a/test/hotspot/jtreg/runtime/appcds/sharedStrings/SharedStringsStress.java	Wed Oct 03 15:54:35 2018 +0200
+++ b/test/hotspot/jtreg/runtime/appcds/sharedStrings/SharedStringsStress.java	Wed Oct 03 16:02:24 2018 +0200
@@ -29,7 +29,7 @@
  * @library /test/hotspot/jtreg/runtime/appcds /test/lib
  * @modules jdk.jartool/sun.tools.jar
  * @build HelloString
- * @run main SharedStringsStress
+ * @run driver SharedStringsStress
  * @run main/othervm -XX:+UseStringDeduplication SharedStringsStress
  * @run main/othervm -XX:-CompactStrings SharedStringsStress
  */
--- a/test/hotspot/jtreg/runtime/appcds/sharedStrings/SharedStringsWbTest.java	Wed Oct 03 15:54:35 2018 +0200
+++ b/test/hotspot/jtreg/runtime/appcds/sharedStrings/SharedStringsWbTest.java	Wed Oct 03 16:02:24 2018 +0200
@@ -32,7 +32,7 @@
  *          jdk.jartool/sun.tools.jar
  * @build sun.hotspot.WhiteBox SharedStringsWb
  * @run driver ClassFileInstaller sun.hotspot.WhiteBox
- * @run main SharedStringsWbTest
+ * @run driver SharedStringsWbTest
  * @run main/othervm -XX:+UseStringDeduplication SharedStringsWbTest
  * @run main/othervm -XX:-CompactStrings SharedStringsWbTest
  */
--- a/test/hotspot/jtreg/runtime/appcds/sharedStrings/SysDictCrash.java	Wed Oct 03 15:54:35 2018 +0200
+++ b/test/hotspot/jtreg/runtime/appcds/sharedStrings/SysDictCrash.java	Wed Oct 03 16:02:24 2018 +0200
@@ -31,7 +31,7 @@
  * @library /test/lib /test/hotspot/jtreg/runtime/appcds
  * @modules java.base/jdk.internal.misc
  * @modules java.management
- * @run main SysDictCrash
+ * @run driver SysDictCrash
  * @run main/othervm -XX:+UseStringDeduplication SysDictCrash
  * @run main/othervm -XX:-CompactStrings SysDictCrash
  */
@@ -44,21 +44,19 @@
         // SharedBaseAddress=0 puts the archive at a very high address on solaris,
         // which provokes the crash.
         ProcessBuilder dumpPb = ProcessTools.createJavaProcessBuilder(true,
-          TestCommon.makeCommandLineForAppCDS(
             "-XX:+UseG1GC", "-XX:MaxRAMPercentage=12.5",
             "-cp", ".",
             "-XX:SharedBaseAddress=0", "-XX:SharedArchiveFile=./SysDictCrash.jsa",
             "-Xshare:dump",
-            "-showversion", "-Xlog:cds,cds+hashtables"));
+            "-showversion", "-Xlog:cds,cds+hashtables");
 
         TestCommon.checkDump(TestCommon.executeAndLog(dumpPb, "dump"));
 
         ProcessBuilder runPb = ProcessTools.createJavaProcessBuilder(true,
-          TestCommon.makeCommandLineForAppCDS(
             "-XX:+UseG1GC", "-XX:MaxRAMPercentage=12.5",
             "-XX:SharedArchiveFile=./SysDictCrash.jsa",
             "-Xshare:on",
-            "-version"));
+            "-version");
 
         TestCommon.checkExec(TestCommon.executeAndLog(runPb, "exec"));
     }
--- a/test/hotspot/jtreg/serviceability/sa/ClhsdbCDSCore.java	Wed Oct 03 15:54:35 2018 +0200
+++ b/test/hotspot/jtreg/serviceability/sa/ClhsdbCDSCore.java	Wed Oct 03 16:02:24 2018 +0200
@@ -79,6 +79,7 @@
             CDSTestUtils.createArchiveAndCheck(opts);
 
             String[] jArgs = {
+                "-Xmx512m",
                 "-XX:+UnlockDiagnosticVMOptions",
                 "-XX:SharedArchiveFile=" + SHARED_ARCHIVE_NAME,
                 "-XX:+CreateCoredumpOnCrash",
--- a/test/hotspot/jtreg/serviceability/sa/TestHeapDumpForInvokeDynamic.java	Wed Oct 03 15:54:35 2018 +0200
+++ b/test/hotspot/jtreg/serviceability/sa/TestHeapDumpForInvokeDynamic.java	Wed Oct 03 16:02:24 2018 +0200
@@ -123,6 +123,7 @@
         try {
             List<String> vmArgs = new ArrayList<String>();
             vmArgs.add("-XX:+UsePerfData");
+            vmArgs.add("-Xmx512m");
             vmArgs.addAll(Utils.getVmOptions());
 
             theApp = new LingeredAppWithInvokeDynamic();
--- a/test/hotspot/jtreg/serviceability/sa/TestJmapCore.java	Wed Oct 03 15:54:35 2018 +0200
+++ b/test/hotspot/jtreg/serviceability/sa/TestJmapCore.java	Wed Oct 03 16:02:24 2018 +0200
@@ -87,7 +87,7 @@
 
     static void test(String type) throws Throwable {
         ProcessBuilder pb = ProcessTools.createJavaProcessBuilder(true, "-XX:+CreateCoredumpOnCrash",
-                "-XX:MaxMetaspaceSize=64m", "-XX:+CrashOnOutOfMemoryError",
+                "-Xmx512m", "-XX:MaxMetaspaceSize=64m", "-XX:+CrashOnOutOfMemoryError",
                 TestJmapCore.class.getName(), type);
 
         boolean useDefaultUlimit = useDefaultUlimit();
--- a/test/hotspot/jtreg/vmTestbase/nsk/jdb/exclude/exclude001/exclude001.java	Wed Oct 03 15:54:35 2018 +0200
+++ b/test/hotspot/jtreg/vmTestbase/nsk/jdb/exclude/exclude001/exclude001.java	Wed Oct 03 16:02:24 2018 +0200
@@ -61,9 +61,9 @@
  * @run driver jdk.test.lib.FileInstaller . .
  * @build nsk.jdb.exclude.exclude001.exclude001
  *        nsk.jdb.exclude.exclude001.exclude001a
- * @run main/othervm/timeout=420 PropertyResolvingWrapper nsk.jdb.exclude.exclude001.exclude001
+ * @run main/othervm/timeout=600 PropertyResolvingWrapper nsk.jdb.exclude.exclude001.exclude001
  *      -arch=${os.family}-${os.simpleArch}
- *      -waittime=7
+ *      -waittime=10
  *      -debugee.vmkind=java
  *      -transport.address=dynamic
  *      -jdb=${test.jdk}/bin/jdb
@@ -129,7 +129,7 @@
             oldExclude = reply[0];
 
             for (int testCase = 0; testCase < exclude001a.numThreads; testCase++) {
-
+                String expectedPrompt = MYTHREAD + "-" + testCase + "[1]";
                 reply = jdb.receiveReplyFor(JdbCommand.cont);
 
                 if (jdb.isAtBreakpoint(reply, LAST_BREAK)) {
@@ -153,14 +153,14 @@
                                 reply = jdb.receiveReplyFor(JdbCommand.exclude + "javax.*,sun.*,com.sun.*,jdk.*");
                                 break;
                         case 2: // allow sun.*
-                                reply = jdb.receiveReplyFor(JdbCommand.exclude + "java.*,javax.*,com.sun.*,jdk.");
+                                reply = jdb.receiveReplyFor(JdbCommand.exclude + "java.*,javax.*,com.sun.*,jdk.*");
                                 break;
                         }
 
                         reply = jdb.receiveReplyFor(JdbCommand.trace + "methods " + threads[0]);
 
                         while (true) {
-                            reply = jdb.receiveReplyFor(JdbCommand.cont);
+                            reply = jdb.receiveReplyForWithMessageWait(JdbCommand.cont, expectedPrompt);
 
                             grep = new Paragrep(reply);
                             count = grep.find(JAVA_CORE_METHOD);
--- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/Breakpoint/breakpoint001/breakpoint001.cpp	Wed Oct 03 15:54:35 2018 +0200
+++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/Breakpoint/breakpoint001/breakpoint001.cpp	Wed Oct 03 16:02:24 2018 +0200
@@ -94,9 +94,10 @@
                           "failed to obtain a class signature\n");
 
         if (sig != NULL && (strcmp(sig, CLASS_SIG) == 0)) {
-            NSK_DISPLAY1("ClassLoad event received for the class \"%s\"\n\
-\tsetting breakpoints ...\n",
-                         sig);
+            NSK_DISPLAY1(
+                "ClassLoad event received for the class \"%s\"\n"
+                "\tsetting breakpoints ...\n",
+                sig);
             setBP(jvmti_env, env, klass);
         }
     }
@@ -126,8 +127,9 @@
             strcmp(thr_info.name,THREAD_NAME) != 0 ||
             thr_info.is_daemon==JNI_TRUE) {
         result = checkStatus = STATUS_FAILED;
-        NSK_COMPLAIN2("TEST FAILED: Breakpoint event with unexpected thread info:\n\
-\tname: \"%s\"\ttype: %s thread\n\n",
+        NSK_COMPLAIN2(
+            "TEST FAILED: Breakpoint event with unexpected thread info:\n"
+            "\tname: \"%s\"\ttype: %s thread\n\n",
             (thr_info.name == NULL)?"NULL":thr_info.name,
             (thr_info.is_daemon==JNI_TRUE)?"deamon":"user");
     }
@@ -161,9 +163,10 @@
     if (clsSig == NULL ||
             strcmp(clsSig,CLASS_SIG) != 0) {
         result = checkStatus = STATUS_FAILED;
-        NSK_COMPLAIN1("TEST FAILED: Breakpoint event with unexpected class signature:\n\
-\t\"%s\"\n\n",
-            (clsSig == NULL)?"NULL":clsSig);
+        NSK_COMPLAIN1(
+            "TEST FAILED: Breakpoint event with unexpected class signature:\n"
+            "\t\"%s\"\n\n",
+            (clsSig == NULL) ? "NULL" : clsSig);
     }
     else
         NSK_DISPLAY1("CHECK PASSED: class signature: \"%s\"\n",
@@ -220,8 +223,10 @@
     for (i=0; i<METH_NUM; i++) {
         if (bpEvents[i] != 1) {
             result = STATUS_FAILED;
-            NSK_COMPLAIN3("TEST FAILED: wrong number of Breakpoint events\n\
-\tfor the method \"%s %s\":\n\t\tgot: %d\texpected: 1\n",
+            NSK_COMPLAIN3(
+                "TEST FAILED: wrong number of Breakpoint events\n"
+                "\tfor the method \"%s %s\":\n"
+                "\t\tgot: %d\texpected: 1\n",
                 METHODS[i][0], METHODS[i][1], bpEvents[i]);
         }
         else
--- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/ClassLoad/classload001/classload001.cpp	Wed Oct 03 15:54:35 2018 +0200
+++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/ClassLoad/classload001/classload001.cpp	Wed Oct 03 16:02:24 2018 +0200
@@ -133,8 +133,9 @@
     else if ((i = findSig(sig, 0)) != -1) {
         result = STATUS_FAILED;
         primClsEvents[i]++;
-        NSK_COMPLAIN1("TEST FAILED: JVMTI_EVENT_CLASS_LOAD event received for\n\
-\t a primitive class/array of primitive types with the signature \"%s\"\n",
+        NSK_COMPLAIN1(
+            "TEST FAILED: JVMTI_EVENT_CLASS_LOAD event received for\n"
+            "\t a primitive class/array of primitive types with the signature \"%s\"\n",
             sig);
     }
 
--- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/GarbageCollectionStart/gcstart001/gcstart001.cpp	Wed Oct 03 15:54:35 2018 +0200
+++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/GarbageCollectionStart/gcstart001/gcstart001.cpp	Wed Oct 03 16:02:24 2018 +0200
@@ -52,8 +52,9 @@
 
     if (gcstart != (gcfinish+1)) {
         result = STATUS_FAILED;
-        NSK_COMPLAIN2("TEST FAILED: GarbageCollectionStart event has no a matched pair GarbageCollectionFinish:\n\
-\t%d GarbageCollectionStart events\t%d GarbageCollectionFinish events\n\n",
+        NSK_COMPLAIN2(
+            "TEST FAILED: GarbageCollectionStart event has no a matched pair GarbageCollectionFinish:\n"
+            "\t%d GarbageCollectionStart events\t%d GarbageCollectionFinish events\n\n",
             gcstart, gcfinish);
     }
     else
@@ -68,8 +69,9 @@
 
     if (gcstart != gcfinish) {
         result = STATUS_FAILED;
-        NSK_COMPLAIN2("TEST FAILED: GarbageCollectionFinish event has no a matched pair GarbageCollectionStart:\n\
-\t%d GarbageCollectionStart events\t%d GarbageCollectionFinish events\n\n",
+        NSK_COMPLAIN2(
+            "TEST FAILED: GarbageCollectionFinish event has no a matched pair GarbageCollectionStart:\n"
+            "\t%d GarbageCollectionStart events\t%d GarbageCollectionFinish events\n\n",
             gcstart, gcfinish);
     }
     else
@@ -81,8 +83,9 @@
     NSK_DISPLAY0("VMDeath event received\n");
 
     if (gcstart != gcfinish || result == STATUS_FAILED) {
-        NSK_COMPLAIN2("TEST FAILED: some GarbageCollectionFinish events have no a matched pair GarbageCollectionStart:\n\
-\t%d GarbageCollectionStart events\t%d GarbageCollectionFinish events\n\n",
+        NSK_COMPLAIN2(
+            "TEST FAILED: some GarbageCollectionFinish events have no a matched pair GarbageCollectionStart:\n"
+            "\t%d GarbageCollectionStart events\t%d GarbageCollectionFinish events\n\n",
             gcstart, gcfinish);
 
         exit(95 + STATUS_FAILED);
--- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/GetClassSignature/getclsig006/getclsig006.cpp	Wed Oct 03 15:54:35 2018 +0200
+++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/GetClassSignature/getclsig006/getclsig006.cpp	Wed Oct 03 16:02:24 2018 +0200
@@ -69,8 +69,12 @@
 
         if (strcmp(class_sig[idx][1], sign) != 0 ||
                 strcmp(class_sig[idx][2], (gen_sign==NULL)?"NULL":gen_sign) != 0) {
-            NSK_COMPLAIN5("TEST FAILED: class: \"%s\" \
-has\n\tsignature: \"%s\"\n\tgeneric signature: \"%s\"\n\n\tExpected: \"%s\"\n\t\"%s\"\n\n",
+            NSK_COMPLAIN5(
+                "TEST FAILED: class: \"%s\" has\n"
+                "\tsignature: \"%s\"\n"
+                "\tgeneric signature: \"%s\"\n\n"
+                "\tExpected: \"%s\"\n"
+                "\t\"%s\"\n\n",
                 class_sig[idx][0],
                 sign, (gen_sign==NULL)?"NULL":gen_sign,
                 class_sig[idx][1], class_sig[idx][2]);
--- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/GetFieldName/getfldnm005/getfldnm005.cpp	Wed Oct 03 15:54:35 2018 +0200
+++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/GetFieldName/getfldnm005/getfldnm005.cpp	Wed Oct 03 16:02:24 2018 +0200
@@ -103,8 +103,12 @@
 
         if (strcmp(fld_sig[idx][2], sign) != 0 ||
                 strcmp(fld_sig[idx][3], (gen_sign==NULL)?"NULL":gen_sign) != 0) {
-            NSK_COMPLAIN6("TEST FAILED: %s field \"%s\" \
-has\n\tsignature: \"%s\"\n\tgeneric signature: \"%s\"\n\n\tExpected: \"%s\"\n\t\t\"%s\"\n\n",
+            NSK_COMPLAIN6(
+                "TEST FAILED: %s field \"%s\" has\n"
+                "\tsignature: \"%s\"\n"
+                "\tgeneric signature: \"%s\"\n\n"
+                "\tExpected: \"%s\"\n"
+                "\t\t\"%s\"\n\n",
                (instance==0)?"instance":"static",
                 fld_sig[idx][0],
                 sign, (gen_sign==NULL)?"NULL":gen_sign,
--- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/GetJNIFunctionTable/getjniftab002/getjniftab002.cpp	Wed Oct 03 15:54:35 2018 +0200
+++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/GetJNIFunctionTable/getjniftab002/getjniftab002.cpp	Wed Oct 03 16:02:24 2018 +0200
@@ -80,11 +80,12 @@
        only since JDK 1.2 */
     if (verbose)
         printf("\nb) Checking the function with the detached thread ...\n\ndetaching the main thread ...\n");
-    if ((err = vm->DetachCurrentThread()) != 0)
-        printf("(%s,%d): Warning: DetachCurrentThread() returns: %d\n\
-\tcheck with the detached main thread skipped\n",
+    if ((err = vm->DetachCurrentThread()) != 0) {
+        printf(
+            "(%s,%d): Warning: DetachCurrentThread() returns: %d\n"
+            "\tcheck with the detached main thread skipped\n",
             __FILE__, __LINE__, err);
-    else {
+    } else {
         redirect(env, JVMTI_ERROR_UNATTACHED_THREAD);
 
         if (verbose)
--- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/GetLocalVariableTable/localtab004/localtab004.cpp	Wed Oct 03 15:54:35 2018 +0200
+++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/GetLocalVariableTable/localtab004/localtab004.cpp	Wed Oct 03 16:02:24 2018 +0200
@@ -107,8 +107,7 @@
                 jni_env, testedCls,
                 methInfo[i].m_name, methInfo[i].m_sign);
         if (methInfo[i].mid == NULL) {
-            NSK_COMPLAIN3("TEST FAILURE: unable to get the method ID for the %s method\
- \"%s\", signature \"%s\"\n\n",
+            NSK_COMPLAIN3("TEST FAILURE: unable to get the method ID for the %s method \"%s\", signature \"%s\"\n\n",
                 methInfo[i].inst?"instance":"static",
                 methInfo[i].m_name, methInfo[i].m_sign);
             return STATUS_FAILED;
@@ -124,8 +123,9 @@
         } else {
             if (count != methInfo[i].vcount) {
                 totRes = STATUS_FAILED;
-                NSK_COMPLAIN5("TEST FAILED: %s method \"%s\", signature \"%s\":\
- found %d vars in the LocalVariableTable, expected %d\n\tHere are the found vars:\n",
+                NSK_COMPLAIN5(
+                    "TEST FAILED: %s method \"%s\", signature \"%s\": found %d vars in the LocalVariableTable, expected %d\n"
+                    "\tHere are the found vars:\n",
                     methInfo[i].inst?"instance":"static",
                     methInfo[i].m_name, methInfo[i].m_sign,
                     count, methInfo[i].vcount);
@@ -136,18 +136,21 @@
 
                 continue;
             }
-            else
-                NSK_DISPLAY4("Checking vars in the LocalVariableTable of the %s method \"%s\",\
- signature \"%s\" ...\n\tfound %d local vars as expected\n",
+            else {
+                NSK_DISPLAY4(
+                    "Checking vars in the LocalVariableTable of the %s method \"%s\", signature \"%s\" ...\n"
+                    "\tfound %d local vars as expected\n",
                     methInfo[i].inst?"instance":"static",
                     methInfo[i].m_name, methInfo[i].m_sign, count);
+            }
 
             for (j=0; j<count; j++) {
                 for (k=0; k<count; k++) {
                     if (strcmp(lv_table[j].name, methInfo[i].vars[k].v_name) == 0) {
                         if (strcmp(lv_table[j].signature, methInfo[i].vars[k].v_sign) != 0) {
-                            NSK_COMPLAIN6("TEST FAILED: %s method: \"%s\", signature: \"%s\": var \"%s\"\
- has signature \"%s\" in the LocalVariableTable, expected \"%s\"\n\n",
+                            NSK_COMPLAIN6(
+                                "TEST FAILED: %s method: \"%s\", signature: \"%s\": var \"%s\" "
+                                "has signature \"%s\" in the LocalVariableTable, expected \"%s\"\n\n",
                                 methInfo[i].inst?"instance":"static",
                                 methInfo[i].m_name, methInfo[i].m_sign,
                                 lv_table[j].name, lv_table[j].signature,
--- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/GetLocalVariableTable/localtab005/localtab005.cpp	Wed Oct 03 15:54:35 2018 +0200
+++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/GetLocalVariableTable/localtab005/localtab005.cpp	Wed Oct 03 16:02:24 2018 +0200
@@ -115,8 +115,7 @@
                 jni_env, testedCls,
                 methInfo[i].m_name, methInfo[i].m_sign);
         if (methInfo[i].mid == NULL) {
-            NSK_COMPLAIN3("TEST FAILURE: unable to get the method ID for the %s method\
- \"%s\", signature \"%s\"\n\n",
+            NSK_COMPLAIN3("TEST FAILURE: unable to get the method ID for the %s method \"%s\", signature \"%s\"\n\n",
                 methInfo[i].inst?"instance":"static",
                 methInfo[i].m_name, methInfo[i].m_sign);
             return STATUS_FAILED;
@@ -132,8 +131,10 @@
         } else {
             if (count != methInfo[i].vcount) {
                 totRes = STATUS_FAILED;
-                NSK_COMPLAIN5("TEST FAILED: %s method \"%s\", signature \"%s\":\
- found %d vars in the LocalVariableTable, expected %d\n\tHere are the found vars:\n",
+                NSK_COMPLAIN5(
+                    "TEST FAILED: %s method \"%s\", signature \"%s\":"
+                    "found %d vars in the LocalVariableTable, expected %d\n"
+                    "\tHere are the found vars:\n",
                     methInfo[i].inst?"instance":"static",
                     methInfo[i].m_name, methInfo[i].m_sign,
                     count, methInfo[i].vcount);
@@ -146,11 +147,14 @@
 
                 continue;
             }
-            else
-                NSK_DISPLAY4(">>> Checking vars in the LocalVariableTable of the %s method \"%s\",\
- signature \"%s\" ...\n\t%d local vars as expected\n",
+            else {
+                NSK_DISPLAY4(
+                    ">>> Checking vars in the LocalVariableTable of the %s method \"%s\","
+                    "signature \"%s\" ...\n"
+                    "\t%d local vars as expected\n",
                     methInfo[i].inst?"instance":"static",
                     methInfo[i].m_name, methInfo[i].m_sign, count);
+            }
 
             for (j=0; j<count; j++) {
                 for (k=0; k<count; k++) {
@@ -158,8 +162,11 @@
                         if ((strcmp(lv_table[j].signature, methInfo[i].vars[k].v_sign) != 0) ||
                             (strcmp((lv_table[j].generic_signature==NULL)?"NULL":lv_table[j].generic_signature,
                                 methInfo[i].vars[k].v_gen_sign) != 0)) {
-                            NSK_COMPLAIN8("TEST FAILED: %s method: \"%s\" \"%s\":\n\tvar \"%s\"\
- has signature \"%s\",\n\tgeneric signature \"%s\"\n\n\tExpected: \"%s\"\n\t\t\"%s\"\n\n",
+                            NSK_COMPLAIN8(
+                                "TEST FAILED: %s method: \"%s\" \"%s\":\n"
+                                "\tvar \"%s\" has signature \"%s\",\n"
+                                "\tgeneric signature \"%s\"\n\n"
+                                "\tExpected: \"%s\"\n\t\t\"%s\"\n\n",
                                 methInfo[i].inst?"instance":"static",
                                 methInfo[i].m_name, methInfo[i].m_sign,
                                 lv_table[j].name, lv_table[j].signature,
--- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/NativeMethodBind/nativemethbind001/nativemethbind001.cpp	Wed Oct 03 15:54:35 2018 +0200
+++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/NativeMethodBind/nativemethbind001/nativemethbind001.cpp	Wed Oct 03 16:02:24 2018 +0200
@@ -110,8 +110,9 @@
                 (strcmp(methSig,METHODS[i][1]) == 0)) {
             bindEv[i][0]++;
 
-            NSK_DISPLAY1("CHECK PASSED: NativeMethodBind event received for the method:\n\
-\t\"%s\" as expected\n",
+            NSK_DISPLAY1(
+                "CHECK PASSED: NativeMethodBind event received for the method:\n"
+                "\t\"%s\" as expected\n",
                 methNam);
             break;
         }
@@ -163,8 +164,8 @@
         meth.signature = (char *) METHODS[1][1];
         meth.fnPtr = (void *) &anotherNativeMethod;
 
-        NSK_DISPLAY3("Calling RegisterNatives() with \"%s %s\"\n\
-\tfor class \"%s\" ...\n",
+        NSK_DISPLAY3("Calling RegisterNatives() with \"%s %s\"\n"
+                     "\tfor class \"%s\" ...\n",
             METHODS[1][0], METHODS[1][1], CLASS_SIG);
         if (!NSK_JNI_VERIFY_VOID(env, (NSK_CPP_STUB4(RegisterNatives,
                 env, testedCls, &meth, 1)) != 0)) {
@@ -187,8 +188,9 @@
         }
         else {
             result = STATUS_FAILED;
-            NSK_COMPLAIN3("TEST FAILED: wrong number of NativeMethodBind events for the method \"%s\":\n\
-got: %d\texpected: %d\n\n",
+            NSK_COMPLAIN3(
+                "TEST FAILED: wrong number of NativeMethodBind events for the method \"%s\":\n"
+                "got: %d\texpected: %d\n\n",
                 METHODS[i][0], bindEv[i][0], bindEv[i][1]);
         }
 
--- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/NativeMethodBind/nativemethbind002/nativemethbind002.cpp	Wed Oct 03 15:54:35 2018 +0200
+++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/NativeMethodBind/nativemethbind002/nativemethbind002.cpp	Wed Oct 03 16:02:24 2018 +0200
@@ -67,8 +67,9 @@
     if (!NSK_JVMTI_VERIFY(NSK_CPP_STUB2(GetPhase,
             jvmti_env, &phase))) {
         result = STATUS_FAILED;
-        NSK_COMPLAIN0("TEST FAILED: unable to obtain phase of the VM execution\n\
-\tduring NativeMethodBind callback\n\n");
+        NSK_COMPLAIN0(
+            "TEST FAILED: unable to obtain phase of the VM execution\n"
+            "\tduring NativeMethodBind callback\n\n");
         unlock(jvmti_env, jni_env);
         return;
     }
@@ -103,10 +104,12 @@
 VMDeath(jvmtiEnv *jvmti_env, JNIEnv *env) {
     NSK_DISPLAY0("VMDeath event received\n");
 
-    if (wrongBindEv != 0)
-        NSK_COMPLAIN1("TEST FAILED: there are %d NativeMethodBind events\n\
-sent during non-start or non-live phase of the VM execution\n",
+    if (wrongBindEv != 0) {
+        NSK_COMPLAIN1(
+            "TEST FAILED: there are %d NativeMethodBind events\n"
+            "sent during non-start or non-live phase of the VM execution\n",
             wrongBindEv);
+    }
 
     if (result == STATUS_FAILED)
         exit(95 + STATUS_FAILED);
--- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/NativeMethodBind/nativemethbind003/nativemethbind003.cpp	Wed Oct 03 15:54:35 2018 +0200
+++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/NativeMethodBind/nativemethbind003/nativemethbind003.cpp	Wed Oct 03 16:02:24 2018 +0200
@@ -124,14 +124,18 @@
 
     if (bindEv[0] != bindEv[1]) {
         result = STATUS_FAILED;
-        NSK_COMPLAIN5("TEST FAILED: wrong NativeMethodBind events\n\
-\tfor tested method \"%s %s\" bound with \"%s\":\n\
-\tgot: %d\texpected: %d\n\n",
+        NSK_COMPLAIN5(
+            "TEST FAILED: wrong NativeMethodBind events\n"
+            "\tfor tested method \"%s %s\" bound with \"%s\":\n"
+            "\tgot: %d\texpected: %d\n\n",
             METHODS[0], METHODS[1], CLASS_SIG, bindEv[0], bindEv[1]);
-    } else
-        NSK_DISPLAY4("CHECK PASSED: %d NativeMethodBind event(s)\n\
-\tfor tested method \"%s %s\" bound with \"%s\"\n\tas expected\n",
+    } else {
+        NSK_DISPLAY4(
+            "CHECK PASSED: %d NativeMethodBind event(s)\n"
+            "\tfor tested method \"%s %s\" bound with \"%s\"\n"
+            "\tas expected\n",
             bindEv[0], METHODS[0], METHODS[1], CLASS_SIG);
+    }
 
     if (result == STATUS_FAILED)
         exit(95 + STATUS_FAILED);
@@ -151,8 +155,9 @@
     jclass testedCls = NULL;
     JNINativeMethod meth;
 
-    NSK_DISPLAY1("Inside the registerNative()\n\
-Finding class \"%s\" ...\n", CLASS_SIG);
+    NSK_DISPLAY1("Inside the registerNative()\n"
+                 "Finding class \"%s\" ...\n",
+                 CLASS_SIG);
     if (!NSK_JNI_VERIFY(env, (testedCls =
             NSK_CPP_STUB2(FindClass, env, CLASS_SIG)) != NULL)) {
         result = STATUS_FAILED;
@@ -165,8 +170,9 @@
     meth.signature = (char*) METHODS[1];
     meth.fnPtr = (void*) nativeMethod;
 
-    NSK_DISPLAY3("Calling RegisterNatives() with \"%s %s\"\n\
-\tfor class \"%s\" ...\n",
+    NSK_DISPLAY3(
+        "Calling RegisterNatives() with \"%s %s\"\n"
+        "\tfor class \"%s\" ...\n",
         METHODS[0], METHODS[1], CLASS_SIG);
     if (!NSK_JNI_VERIFY_VOID(env, (NSK_CPP_STUB4(RegisterNatives,
             env, testedCls, &meth, 1)) != 0)) {
--- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/NativeMethodBind/nativemethbind004/nativemethbind004.cpp	Wed Oct 03 15:54:35 2018 +0200
+++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/NativeMethodBind/nativemethbind004/nativemethbind004.cpp	Wed Oct 03 16:02:24 2018 +0200
@@ -138,22 +138,29 @@
 Java_nsk_jvmti_NativeMethodBind_nativemethbind004_check(
         JNIEnv *env, jobject obj) {
 
-    if (origCalls == 0)
-        NSK_DISPLAY0("CHECK PASSED: original nativeMethod() to be redirected\n\
-\thas not been invoked as expected\n");
-    else {
+    if (origCalls == 0) {
+        NSK_DISPLAY0(
+            "CHECK PASSED: original nativeMethod() to be redirected\n"
+            "\thas not been invoked as expected\n");
+    } else {
         result = STATUS_FAILED;
-        NSK_COMPLAIN1("TEST FAILED: nativeMethod() has not been redirected by the NativeMethodBind:\n\
-\t%d calls\texpected: 0\n\n", origCalls);
+        NSK_COMPLAIN1(
+            "TEST FAILED: nativeMethod() has not been redirected by the NativeMethodBind:\n"
+            "\t%d calls\texpected: 0\n\n",
+            origCalls);
     }
 
-    if (redirCalls == 1)
-        NSK_DISPLAY1("CHECK PASSED: nativeMethod() has been redirected by the NativeMethodBind:\n\
-\t%d calls of redirected method as expected\n", redirCalls);
-    else {
+    if (redirCalls == 1) {
+        NSK_DISPLAY1(
+            "CHECK PASSED: nativeMethod() has been redirected by the NativeMethodBind:\n"
+            "\t%d calls of redirected method as expected\n",
+            redirCalls);
+    } else {
         result = STATUS_FAILED;
-        NSK_COMPLAIN1("TEST FAILED: nativeMethod() has not been redirected by the NativeMethodBind:\n\
-\t%d calls of redirected method\texpected: 1\n\n", redirCalls);
+        NSK_COMPLAIN1(
+            "TEST FAILED: nativeMethod() has not been redirected by the NativeMethodBind:\n"
+            "\t%d calls of redirected method\texpected: 1\n\n",
+            redirCalls);
     }
 
     return result;
--- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/ObjectFree/objfree001/objfree001.cpp	Wed Oct 03 15:54:35 2018 +0200
+++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/ObjectFree/objfree001/objfree001.cpp	Wed Oct 03 16:02:24 2018 +0200
@@ -165,8 +165,9 @@
     else {
         if (obtainedData != storedData) {
             result = STATUS_FAILED;
-            NSK_COMPLAIN3("TEST FAILED: %s: obtained an environment local storage has unexpected pointer:\n\
-got: 0x%p\texpected: 0x%p\n\n",
+            NSK_COMPLAIN3(
+                "TEST FAILED: %s: obtained an environment local storage has unexpected pointer:\n"
+                "got: 0x%p\texpected: 0x%p\n\n",
                 msg, (void*) obtainedData, (void*) storedData);
         }
         else
@@ -203,18 +204,23 @@
     NSK_DISPLAY0("VMDeath event received\n");
 
     if (clsUnloaded == JNI_TRUE) {
-        if (objfree == 0)
-            NSK_DISPLAY1("Warning: no ObjectFree events for a tagged object\n\
-\twhich class \"%s\" has been detected for unloading\n\n",
+        if (objfree == 0) {
+            NSK_DISPLAY1(
+                "Warning: no ObjectFree events for a tagged object\n"
+                "\twhich class \"%s\" has been detected for unloading\n\n",
                 CLASS_SIG);
-        else
-            NSK_DISPLAY2("CHECK PASSED: %d ObjectFree event(s) received for a tagged object\n\
-\twhich class \"%s\" has been detected for unloading\n\n",
+        } else {
+            NSK_DISPLAY2(
+                "CHECK PASSED: %d ObjectFree event(s) received for a tagged object\n"
+                "\twhich class \"%s\" has been detected for unloading\n\n",
                 objfree, CLASS_SIG);
-    } else
-        NSK_DISPLAY1("Warning: unloading of the tested class \"%s\" has not been detected,\n\
-\tso the test has no results\n",
-            CLASS_SIG);
+        }
+    } else {
+         NSK_DISPLAY1(
+             "Warning: unloading of the tested class \"%s\" has not been detected,\n"
+             "\tso the test has no results\n",
+             CLASS_SIG);
+    }
 
     if (result == STATUS_FAILED)
         exit(95 + STATUS_FAILED);
--- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/ObjectFree/objfree002/objfree002.cpp	Wed Oct 03 15:54:35 2018 +0200
+++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/ObjectFree/objfree002/objfree002.cpp	Wed Oct 03 16:02:24 2018 +0200
@@ -198,8 +198,9 @@
     else {
         if (obtainedData != storedData) {
             result = STATUS_FAILED;
-            NSK_COMPLAIN3("TEST FAILED: %s: obtained an environment local storage has unexpected pointer:\n\
-got: 0x%p\texpected: 0x%p\n\n",
+            NSK_COMPLAIN3(
+                "TEST FAILED: %s: obtained an environment local storage has unexpected pointer:\n"
+                "got: 0x%p\texpected: 0x%p\n\n",
                 msg, (void*) obtainedData, (void*) storedData);
         }
         else
--- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/RedefineClasses/redefclass003/redefclass003.cpp	Wed Oct 03 15:54:35 2018 +0200
+++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/RedefineClasses/redefclass003/redefclass003.cpp	Wed Oct 03 16:02:24 2018 +0200
@@ -112,8 +112,8 @@
             classDef.class_byte_count);
     if ((err = (jvmti->RedefineClasses(1, &classDef))) != JVMTI_ERROR_NONE) {
         if (err == JVMTI_ERROR_UNSUPPORTED_REDEFINITION_SCHEMA_CHANGED) {
-            printf("Warning: unrestrictedly redefinition of classes is not implemented,\n\
-\tso the test has no results.\n");
+            printf("Warning: unrestrictedly redefinition of classes is not implemented,\n"
+                   "\tso the test has no results.\n");
             no_results = 1;
         }
         else {
@@ -157,9 +157,13 @@
         printf("\tlongComplNewFld = %" LL "d, expected 44\n", longFld);
         return STATUS_FAILED;
     } else {
-        if (vrb == 1)
-            printf("Completely new static variables:\n\
-\tintComplNewFld = %d\n\tlongComplNewFld = %" LL "d\n", intFld, longFld);
+        if (vrb == 1) {
+            printf(
+                "Completely new static variables:\n"
+                "\tintComplNewFld = %d\n"
+                "\tlongComplNewFld = %" LL "d\n",
+                intFld, longFld);
+        }
         return PASSED;
     }
 }
--- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/RedefineClasses/redefclass004/redefclass004.cpp	Wed Oct 03 15:54:35 2018 +0200
+++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/RedefineClasses/redefclass004/redefclass004.cpp	Wed Oct 03 16:02:24 2018 +0200
@@ -117,8 +117,9 @@
             classDef.class_byte_count);
     if ((err = (jvmti->RedefineClasses(1, &classDef))) != JVMTI_ERROR_NONE) {
         if (err == JVMTI_ERROR_UNSUPPORTED_REDEFINITION_SCHEMA_CHANGED) {
-            printf("Warning: unrestrictedly redefinition of classes is not implemented,\n\
-\tso the test has no results.\n");
+            printf(
+                "Warning: unrestrictedly redefinition of classes is not implemented,\n"
+                "\tso the test has no results.\n");
             no_results = 1;
         }
         else {
@@ -182,11 +183,14 @@
         env->ReleaseStringUTFChars(stringObj, strFld);
         return STATUS_FAILED;
     } else {
-        if (vrb == 1)
-            printf("Completely new fields:\n\
-\tstringComplNewFld = \"%s\"\n\tintComplNewFld = %d\n\
-\tlongComplNewFld = %" LL "d\n",
+        if (vrb == 1) {
+            printf(
+                "Completely new fields:\n"
+                "\tstringComplNewFld = \"%s\"\n"
+                "\tintComplNewFld = %d\n"
+                "\tlongComplNewFld = %" LL "d\n",
                 strFld, intFld, longFld);
+        }
         env->ReleaseStringUTFChars(stringObj, strFld);
         return PASSED;
     }
--- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/RedefineClasses/redefclass008/redefclass008.cpp	Wed Oct 03 15:54:35 2018 +0200
+++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/RedefineClasses/redefclass008/redefclass008.cpp	Wed Oct 03 16:02:24 2018 +0200
@@ -141,8 +141,8 @@
             breakpoints[i].mid = env->GetMethodID(
                 redefCls, breakpoints[i].m_name, breakpoints[i].m_sign);
             if (breakpoints[i].mid == NULL) {
-                printf("%s: Failed to get the method ID for the instance method\
- \"%s\" with signature \"%s\"\n",
+                printf(
+                    "%s: Failed to get the method ID for the instance method \"%s\" with signature \"%s\"\n",
                     __FILE__, breakpoints[i].m_name, breakpoints[i].m_sign);
                 return STATUS_FAILED;
             }
@@ -150,18 +150,22 @@
             breakpoints[i].mid = env->GetStaticMethodID(
                 redefCls, breakpoints[i].m_name, breakpoints[i].m_sign);
             if (breakpoints[i].mid == NULL) {
-                printf("%s: Failed to get the method ID for the static method\
- \"%s\" with signature \"%s\"\n",
+                printf(
+                    "%s: Failed to get the method ID for the static method \"%s\" with signature \"%s\"\n",
                     __FILE__, breakpoints[i].m_name, breakpoints[i].m_sign);
                 return STATUS_FAILED;
             }
         }
 
-        if (vrb == 1)
-            printf(">>>>>>>> #%d Invoke SetBreakpoint():\n\tbreakpoint in the %s\
- method: name=\"%s\"; signature=\"%s\"; location=%d\n",
+        if (vrb == 1) {
+            printf(
+                ">>>>>>>> #%d Invoke SetBreakpoint():\n"
+                "\tbreakpoint in the %s method: name=\"%s\"; "
+                "signature=\"%s\"; location=%d\n",
                 i, breakpoints[i].inst?"instance":"static",
                 breakpoints[i].m_name, breakpoints[i].m_sign, breakpoints[i].loc);
+        }
+
         if ((err = (jvmti->SetBreakpoint(breakpoints[i].mid,
                 breakpoints[i].loc))) != JVMTI_ERROR_NONE) {
             printf("%s: Failed to call SetBreakpoint(): error=%d: %s\n",
@@ -239,8 +243,9 @@
             breakpoints[i].mid = env->GetMethodID(
                 redefCls, breakpoints[i].m_name, breakpoints[i].m_sign);
             if (breakpoints[i].mid == NULL) {
-                printf("%s: getResult: Failed to get the method ID for the instance method\
- \"%s\" with signature \"%s\"\n",
+                printf(
+                    "%s: getResult: Failed to get the method ID for the instance method"
+                    "\"%s\" with signature \"%s\"\n",
                     __FILE__, breakpoints[i].m_name, breakpoints[i].m_sign);
                 return STATUS_FAILED;
             }
@@ -248,8 +253,9 @@
             breakpoints[i].mid = env->GetStaticMethodID(
                 redefCls, breakpoints[i].m_name, breakpoints[i].m_sign);
             if (breakpoints[i].mid == NULL) {
-                printf("%s: getResult: Failed to get the method ID for the static method\
- \"%s\" with signature \"%s\"\n",
+                printf(
+                    "%s: getResult: Failed to get the method ID for the static method"
+                    "\"%s\" with signature \"%s\"\n",
                     __FILE__, breakpoints[i].m_name, breakpoints[i].m_sign);
                 return STATUS_FAILED;
             }
@@ -257,25 +263,30 @@
 
         if ((err = (jvmti->ClearBreakpoint(breakpoints[i].mid,
                 breakpoints[i].loc))) != JVMTI_ERROR_NOT_FOUND) {
-            printf("TEST FAILED: Breakpoint #%d in the %s method:\n\
-\tname=\"%s\"; signature=\"%s\"; location=%d was not cleared:\n\
-\tClearBreakpoint() returned the error %d: %s\n\n",
+            printf(
+                "TEST FAILED: Breakpoint #%d in the %s method:\n"
+                "\tname=\"%s\"; signature=\"%s\"; location=%d was not cleared:\n"
+                "\tClearBreakpoint() returned the error %d: %s\n\n",
                 i, breakpoints[i].inst?"instance":"static",
                 breakpoints[i].m_name, breakpoints[i].m_sign,
                 breakpoints[i].loc, err, TranslateError(err));
             totRes = STATUS_FAILED;
         } else {
-            if (vrb == 1)
-                printf("Check #%d PASSED: Breakpoint in the %s method:\n\
-\tname=\"%s\"; signature=\"%s\"; location=%d was cleared:\n\
-\tClearBreakpoint() returned the error %d: %s\n\n",
+            if (vrb == 1) {
+                printf(
+                    "Check #%d PASSED: Breakpoint in the %s method:\n"
+                    "\tname=\"%s\"; signature=\"%s\"; location=%d was cleared:\n"
+                    "\tClearBreakpoint() returned the error %d: %s\n\n",
                     i, breakpoints[i].inst?"instance":"static",
                     breakpoints[i].m_name, breakpoints[i].m_sign,
                     breakpoints[i].loc, err, TranslateError(err));
+            }
+
             if ((err = (jvmti->SetBreakpoint(breakpoints[i].mid,
                     breakpoints[i].loc))) == JVMTI_ERROR_DUPLICATE) {
-                printf("TEST FAILED: the function SetBreakpoint() returned the error %d: %s\n\
-\ti.e. the breakpoint #%d has not been really cleared.\n\n",
+                printf(
+                    "TEST FAILED: the function SetBreakpoint() returned the error %d: %s\n"
+                    "\ti.e. the breakpoint #%d has not been really cleared.\n\n",
                     err, TranslateError(err), i);
                 totRes = STATUS_FAILED;
             }
--- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/RedefineClasses/redefclass009/redefclass009.cpp	Wed Oct 03 15:54:35 2018 +0200
+++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/RedefineClasses/redefclass009/redefclass009.cpp	Wed Oct 03 16:02:24 2018 +0200
@@ -174,8 +174,7 @@
                 methodsInfo[i].m_name, methodsInfo[i].m_sign);
         }
         if (methodsInfo[i].mid == NULL) {
-            printf("%s: Failed to get the method ID for the%s%s method\
- \"%s\", signature \"%s\"\n",
+            printf("%s: Failed to get the method ID for the%s%s method \"%s\", signature \"%s\"\n",
                 __FILE__, full?" ":" original ", methodsInfo[i].inst?"instance":"static",
                 methodsInfo[i].m_name, methodsInfo[i].m_sign);
             return STATUS_FAILED;
@@ -192,8 +191,9 @@
             return STATUS_FAILED;
         } else {
             if (count != methodsInfo[i].vcount) {
-                printf("TEST FAILED: %s%s method \"%s\", signature \"%s\":\
- found %d vars in the LocalVariableTable, expected %d\n",
+                printf(
+                    "TEST FAILED: %s%s method \"%s\", signature \"%s\": "
+                    "found %d vars in the LocalVariableTable, expected %d\n",
                     full?" ":" original ", methodsInfo[i].inst?"instance":"static",
                     methodsInfo[i].m_name, methodsInfo[i].m_sign,
                     count, methodsInfo[i].vcount);
@@ -201,8 +201,10 @@
                 continue;
             }
             else if (vrb)
-                printf("\nChecking vars in the LocalVariableTable of the %s method \"%s\",\
- signature \"%s\" ...\n\tfound %d local vars as expected\n",
+                printf(
+                    "\nChecking vars in the LocalVariableTable of the %s method \"%s\", "
+                    "signature \"%s\" ...\n"
+                    "\tfound %d local vars as expected\n",
                     methodsInfo[i].inst?"instance":"static",
                     methodsInfo[i].m_name, methodsInfo[i].m_sign, count);
 
@@ -211,8 +213,9 @@
                     for (k=0; k<count; k++) {
                         if (strcmp(lv_table[j].name, methodsInfo[i].vars[k].v_name) == 0) {
                             if (strcmp(lv_table[j].signature, methodsInfo[i].vars[k].v_sign) != 0) {
-                                printf("TEST FAILED: %s method \"%s\", signature \"%s\": var \"%s\"\
- has signature \"%s\" in the LocalVariableTable, expected \"%s\"\n",
+                                printf(
+                                    "TEST FAILED: %s method \"%s\", signature \"%s\": var \"%s\" "
+                                    "has signature \"%s\" in the LocalVariableTable, expected \"%s\"\n",
                                     methodsInfo[i].inst?"instance":"static",
                                     methodsInfo[i].m_name, methodsInfo[i].m_sign,
                                     lv_table[j].name, lv_table[j].signature,
--- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/RedefineClasses/redefclass010/redefclass010.cpp	Wed Oct 03 15:54:35 2018 +0200
+++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/RedefineClasses/redefclass010/redefclass010.cpp	Wed Oct 03 16:02:24 2018 +0200
@@ -152,8 +152,7 @@
                     methodsInfo[i].m_name, methodsInfo[i].m_sign);
         }
         if (methodsInfo[i].mid == NULL) {
-            printf("%s: Failed to get the method ID for the%s%s method\
- \"%s\", signature \"%s\"\n",
+            printf("%s: Failed to get the method ID for the%s%s method \"%s\", signature \"%s\"\n",
                 __FILE__, (vrb==2)?" original ":" ", methodsInfo[i].inst?"instance":"static",
                 methodsInfo[i].m_name, methodsInfo[i].m_sign);
             return STATUS_FAILED;
@@ -170,8 +169,8 @@
             return STATUS_FAILED;
         } else {
             if (count != methodsInfo[i].lcount) {
-                printf("TEST %s %s method \"%s\", signature \"%s\":\
- found %d lines in the LineNumberTable, expected %d\n",
+                printf(
+                    "TEST %s %s method \"%s\", signature \"%s\": found %d lines in the LineNumberTable, expected %d\n",
                     (vrb==2)?"BUG: original ":"FAILED:",
                     methodsInfo[i].inst?"instance":"static",
                     methodsInfo[i].m_name, methodsInfo[i].m_sign,
@@ -180,8 +179,9 @@
                 continue;
             }
             else if (vrb == 1)
-                printf("\nChecking line numbers in the LineNumberTable of the %s method\
- \"%s\", signature \"%s\" ...\n\toverall number of lines: %d as expected\n",
+                printf(
+                    "\nChecking line numbers in the LineNumberTable of the %s method \"%s\", signature \"%s\" ...\n"
+                    "\toverall number of lines: %d as expected\n",
                     methodsInfo[i].inst?"instance":"static",
                     methodsInfo[i].m_name, methodsInfo[i].m_sign, count);
 
@@ -192,8 +192,9 @@
                     chkval = redf_ln[i][j];
 
                 if (ln_table[j].line_number != chkval) {
-                    printf("TEST %s %s method \"%s\", signature \"%s\": entry #%d\
- has value %d in the LineNumberTable, expected %d\n",
+                    printf(
+                        "TEST %s %s method \"%s\", signature \"%s\": "
+                        "entry #%d has value %d in the LineNumberTable, expected %d\n",
                         (vrb==2)?"BUG: original":"FAILED:",
                         methodsInfo[i].inst?"instance":"static",
                         methodsInfo[i].m_name, methodsInfo[i].m_sign,
--- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/SetJNIFunctionTable/setjniftab001/setjniftab001.cpp	Wed Oct 03 15:54:35 2018 +0200
+++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/SetJNIFunctionTable/setjniftab001/setjniftab001.cpp	Wed Oct 03 16:02:24 2018 +0200
@@ -351,11 +351,12 @@
     if (verbose)
         printf("\nb) Checking the assertion inside main thread detached and attached again ...\n\ndetaching the main thread ...\n");
 
-    if ((res = vm->DetachCurrentThread()) != 0)
-        printf("(%s,%d): Warning: DetachCurrentThread() returns: %d\n\
-\tcheck with the detached main thread skipped\n",
+    if ((res = vm->DetachCurrentThread()) != 0) {
+        printf(
+            "(%s,%d): Warning: DetachCurrentThread() returns: %d\n"
+            "\tcheck with the detached main thread skipped\n",
             __FILE__, __LINE__, res);
-    else {
+    } else {
         if (verbose)
             printf("\nattaching the main thread again ...\n");
         if ((res = vm->AttachCurrentThread((void **) &nextEnv, (void *) 0)) != 0) {
--- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/SetJNIFunctionTable/setjniftab002/setjniftab002.cpp	Wed Oct 03 15:54:35 2018 +0200
+++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/SetJNIFunctionTable/setjniftab002/setjniftab002.cpp	Wed Oct 03 16:02:24 2018 +0200
@@ -78,11 +78,12 @@
        only since JDK 1.2 */
     if (verbose)
         printf("\nb) Checking the function with the detached thread ...\n\ndetaching the main thread ...\n");
-    if ((res = vm->DetachCurrentThread()) != JNI_OK)
-        printf("(%s,%d): Warning: DetachCurrentThread() returns: %d\n\
-\tcheck with the detached main thread skipped\n",
+    if ((res = vm->DetachCurrentThread()) != JNI_OK) {
+        printf(
+            "(%s,%d): Warning: DetachCurrentThread() returns: %d\n"
+            "\tcheck with the detached main thread skipped\n",
             __FILE__, __LINE__, res);
-    else {
+    } else {
         redirect(env, JVMTI_ERROR_UNATTACHED_THREAD);
 
         if (verbose)
--- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/SingleStep/singlestep001/singlestep001.cpp	Wed Oct 03 15:54:35 2018 +0200
+++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/SingleStep/singlestep001/singlestep001.cpp	Wed Oct 03 16:02:24 2018 +0200
@@ -88,9 +88,10 @@
                           "failed to obtain a class signature\n");
 
         if (sig != NULL && (strcmp(sig, CLASS_SIG) == 0)) {
-            NSK_DISPLAY1("ClassLoad event received for the class \"%s\"\n\
-\tsetting breakpoint ...\n",
-                         sig);
+            NSK_DISPLAY1(
+                "ClassLoad event received for the class \"%s\"\n"
+                "\tsetting breakpoint ...\n",
+                sig);
             setBP(jvmti_env, env, klass);
         }
     }
@@ -161,9 +162,11 @@
     }
 
     if (sig != NULL) {
-        NSK_DISPLAY3("\tmethod name: \"%s\"\n\tsignature: \"%s\"\n\
-\tmethod declaring class: \"%s\"\n",
-                methNam, methSig, sig);
+        NSK_DISPLAY3(
+            "\tmethod name: \"%s\"\n"
+            "\tsignature: \"%s\"\n"
+            "\tmethod declaring class: \"%s\"\n",
+            methNam, methSig, sig);
 
         if (stepEv[1] == 1) {
             result = STATUS_FAILED;
@@ -180,8 +183,9 @@
                 (strcmp(methSig,METHOD_SIGS[1]) == 0) &&
                 (strcmp(sig,CLASS_SIG) == 0)) {
             stepEv[1]++;
-            NSK_DISPLAY1("CHECK PASSED: SingleStep event received for the method \"%s\" as expected\n\
-\tdisabling the event generation\n",
+            NSK_DISPLAY1(
+                "CHECK PASSED: SingleStep event received for the method \"%s\" as expected\n"
+                "\tdisabling the event generation\n",
                 methNam);
             if (!NSK_JVMTI_VERIFY(NSK_CPP_STUB4(SetEventNotificationMode,
                     jvmti_env, JVMTI_DISABLE, JVMTI_EVENT_SINGLE_STEP, thread))) {
--- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/SingleStep/singlestep002/singlestep002.cpp	Wed Oct 03 15:54:35 2018 +0200
+++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/SingleStep/singlestep002/singlestep002.cpp	Wed Oct 03 16:02:24 2018 +0200
@@ -69,10 +69,12 @@
 VMDeath(jvmtiEnv *jvmti_env, JNIEnv *env) {
     NSK_DISPLAY0("VMDeath event received\n");
 
-    if (wrongStepEv != 0)
-        NSK_COMPLAIN1("TEST FAILED: there are %d SingleStep events\n\
-sent during non-live phase of the VM execution\n",
+    if (wrongStepEv != 0) {
+        NSK_COMPLAIN1(
+            "TEST FAILED: there are %d SingleStep events\n"
+            "sent during non-live phase of the VM execution\n",
             wrongStepEv);
+    }
 
     if (result == STATUS_FAILED)
         exit(95 + STATUS_FAILED);
--- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/SingleStep/singlestep003/singlestep003.cpp	Wed Oct 03 15:54:35 2018 +0200
+++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/SingleStep/singlestep003/singlestep003.cpp	Wed Oct 03 16:02:24 2018 +0200
@@ -86,10 +86,11 @@
             "failed to obtain a class signature\n");
 
     if (sig != NULL && (strcmp(sig, CLASS_SIG) == 0)) {
-            NSK_DISPLAY1("ClassLoad event received for the class \"%s\"\n\
-\tsetting breakpoint ...\n",
-                sig);
-            setBP(jvmti_env, env, klass);
+        NSK_DISPLAY1(
+            "ClassLoad event received for the class \"%s\"\n"
+            "\tsetting breakpoint ...\n",
+            sig);
+        setBP(jvmti_env, env, klass);
     }
 }
 
@@ -169,15 +170,18 @@
                     (strcmp(sig,CLASS_SIG) == 0)) {
                 stepEv[i][0]++;
 
-                if (stepEv[i][1] == 1)
-                    NSK_DISPLAY3("CHECK PASSED: SingleStep event received for the method:\n\
-\t \"%s %s\" of class \"%s\"\n\tas expected\n",
+                if (stepEv[i][1] == 1) {
+                    NSK_DISPLAY3(
+                        "CHECK PASSED: SingleStep event received for the method:\n"
+                        "\t \"%s %s\" of class \"%s\"\n"
+                        "\tas expected\n",
                         methNam, methSig, sig);
-                else {
+                } else {
                     result = STATUS_FAILED;
-                    NSK_COMPLAIN3("TEST FAILED: SingleStep event received for the method:\n\
-\t \"%s %s\" of class \"%s\"\n",
-                    methNam, methSig, sig);
+                    NSK_COMPLAIN3(
+                        "TEST FAILED: SingleStep event received for the method:\n"
+                        "\t \"%s %s\" of class \"%s\"\n",
+                        methNam, methSig, sig);
                 }
 
                 if (i == (METH_NUM-1)) {
--- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/allocation/AP01/ap01t001/ap01t001.cpp	Wed Oct 03 15:54:35 2018 +0200
+++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/allocation/AP01/ap01t001/ap01t001.cpp	Wed Oct 03 16:02:24 2018 +0200
@@ -64,8 +64,10 @@
     NSK_DISPLAY0("VMDeath event received\n");
 
     if (obj_free != (EXP_OBJ_NUMBER - 1) ) {
-        NSK_COMPLAIN2("Received unexpected number of ObjectFree events: %d\n\t\
-expected number: %d", obj_free, (EXP_OBJ_NUMBER - 1));
+        NSK_COMPLAIN2(
+            "Received unexpected number of ObjectFree events: %d\n"
+            "\texpected number: %d\n",
+            obj_free, (EXP_OBJ_NUMBER - 1));
         exit(95 + STATUS_FAILED);
     }
 
@@ -247,8 +249,11 @@
 
     if (obj_count != EXP_OBJ_NUMBER) {
         nsk_jvmti_setFailStatus();
-        NSK_COMPLAIN2("IterateOverInstancesOfClass found unexpected number of objects: %d\n\t\
-expected number: %d\n\n",  obj_count, EXP_OBJ_NUMBER);
+        NSK_COMPLAIN2(
+            "IterateOverInstancesOfClass found unexpected number of objects: %d\n"
+            "\texpected number: %d\n\n",
+            obj_count, EXP_OBJ_NUMBER);
+
     } else {
         NSK_DISPLAY1("Number of objects IterateOverInstancesOfClass has found: %d\n\n", obj_count);
     }
@@ -267,8 +272,10 @@
 
     if (obj_count != EXP_OBJ_NUMBER) {
         nsk_jvmti_setFailStatus();
-        NSK_COMPLAIN2("IterateOverHeap found unexpected number of objects: %d\n\t\
-expected number: %d\n\n",  obj_count, EXP_OBJ_NUMBER);
+        NSK_COMPLAIN2(
+            "IterateOverHeap found unexpected number of objects: %d\n"
+            "\texpected number: %d\n\n",
+            obj_count, EXP_OBJ_NUMBER);
     } else {
         NSK_DISPLAY1("Number of objects IterateOverHeap has found: %d\n\n", obj_count);
     }
@@ -287,8 +294,10 @@
 
     if (obj_count != EXP_OBJ_NUMBER) {
         nsk_jvmti_setFailStatus();
-        NSK_COMPLAIN2("IterateOverReachableObjects found unexpected number of objects: %d\n\t\
-expected number: %d\n\n",  obj_count, EXP_OBJ_NUMBER);
+        NSK_COMPLAIN2(
+            "IterateOverReachableObjects found unexpected number of objects: %d\n"
+            "\texpected number: %d\n\n",
+            obj_count, EXP_OBJ_NUMBER);
     } else {
         NSK_DISPLAY1("Number of objects IterateOverReachableObjects has found: %d\n\n", obj_count);
     }
--- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/allocation/AP02/ap02t001/ap02t001.cpp	Wed Oct 03 15:54:35 2018 +0200
+++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/allocation/AP02/ap02t001/ap02t001.cpp	Wed Oct 03 16:02:24 2018 +0200
@@ -118,8 +118,10 @@
 
     if (obj_count != exp_count) {
         nsk_jvmti_setFailStatus();
-        NSK_COMPLAIN3("IterateOverInstancesOfClass found unexpected number of %s objects: %d\n\t\
-expected number: %d\n\n", TESTED_CLASS, obj_count, exp_count);
+        NSK_COMPLAIN3(
+            "IterateOverInstancesOfClass found unexpected number of %s objects: %d\n"
+            "\texpected number: %d\n\n",
+            TESTED_CLASS, obj_count, exp_count);
     } else {
         NSK_DISPLAY2("Number of %s objects IterateOverInstancesOfClass has found: %d\n\n", TESTED_CLASS,
             obj_count);
@@ -139,8 +141,10 @@
 
     if (obj_count != exp_count) {
         nsk_jvmti_setFailStatus();
-        NSK_COMPLAIN3("IterateOverHeap found unexpected number of %s objects: %d\n\t\
-expected number: %d\n\n", TESTED_CLASS, obj_count, exp_count);
+        NSK_COMPLAIN3(
+            "IterateOverHeap found unexpected number of %s objects: %d\n"
+            "\texpected number: %d\n\n",
+            TESTED_CLASS, obj_count, exp_count);
     } else {
         NSK_DISPLAY2("Number of %s objects IterateOverHeap has found: %d\n\n", TESTED_CLASS, obj_count);
     }
@@ -159,8 +163,10 @@
 
     if (obj_count != exp_count) {
         nsk_jvmti_setFailStatus();
-        NSK_COMPLAIN3("IterateOverReachableObjects found unexpected number of %s objects: %d\n\t\
-expected number: %d\n\n", TESTED_CLASS, obj_count, exp_count);
+        NSK_COMPLAIN3(
+            "IterateOverReachableObjects found unexpected number of %s objects: %d\n"
+            "\texpected number: %d\n\n",
+            TESTED_CLASS, obj_count, exp_count);
     } else {
         NSK_DISPLAY2("Number of %s objects IterateOverReachableObjects has found: %d\n\n", TESTED_CLASS,
             obj_count);
--- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/allocation/AP03/ap03t001/ap03t001.cpp	Wed Oct 03 15:54:35 2018 +0200
+++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/allocation/AP03/ap03t001/ap03t001.cpp	Wed Oct 03 16:02:24 2018 +0200
@@ -140,8 +140,10 @@
 
         if (obj_count != EXP_OBJ_NUMBER) {
             nsk_jvmti_setFailStatus();
-            NSK_COMPLAIN2("IterateOverInstancesOfClass found unexpected number of objects: %d\n\t\
-expected number: %d\n\n",  obj_count, EXP_OBJ_NUMBER);
+            NSK_COMPLAIN2(
+                "IterateOverInstancesOfClass found unexpected number of objects: %d\n"
+                "\texpected number: %d\n\n",
+                obj_count, EXP_OBJ_NUMBER);
         } else {
             NSK_DISPLAY1("Number of objects IterateOverInstancesOfClass has found: %d\n\n", obj_count);
         }
@@ -160,8 +162,10 @@
 
         if (obj_count != EXP_OBJ_NUMBER) {
             nsk_jvmti_setFailStatus();
-            NSK_COMPLAIN2("IterateOverHeap found unexpected number of objects: %d\n\t\
-expected number: %d\n\n",  obj_count, EXP_OBJ_NUMBER);
+            NSK_COMPLAIN2(
+                "IterateOverHeap found unexpected number of objects: %d\n"
+                "\texpected number: %d\n\n",
+                obj_count, EXP_OBJ_NUMBER);
         } else {
             NSK_DISPLAY1("Number of objects IterateOverHeap has found: %d\n\n", obj_count);
         }
@@ -197,8 +201,10 @@
 
         if (obj_count != EXP_OBJ_NUMBER) {
             nsk_jvmti_setFailStatus();
-            NSK_COMPLAIN2("IterateOverObjectsReachableFromObject found unexpected number of objects: %d\n\t\
-expected number: %d\n\n",  obj_count, EXP_OBJ_NUMBER);
+            NSK_COMPLAIN2(
+                "IterateOverObjectsReachableFromObject found unexpected number of objects: %d\n"
+                "\texpected number: %d\n\n",
+                obj_count, EXP_OBJ_NUMBER);
         } else {
             NSK_DISPLAY1("Number of objects IterateOverObjectsReachableFromObject has found: %d\n\n", obj_count);
         }
--- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/allocation/AP10/ap10t001/ap10t001.cpp	Wed Oct 03 15:54:35 2018 +0200
+++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/allocation/AP10/ap10t001/ap10t001.cpp	Wed Oct 03 16:02:24 2018 +0200
@@ -81,8 +81,9 @@
     else {
         if (obtainedData != storedData) {
             nsk_jvmti_setFailStatus();
-            NSK_COMPLAIN3("%s: obtained an environment local storage has unexpected pointer:\n\
-got: 0x%p\texpected: 0x%p\n\n",
+            NSK_COMPLAIN3(
+                "%s: obtained an environment local storage has unexpected pointer:\n"
+                "got: 0x%p\texpected: 0x%p\n\n",
                 msg, (void*) obtainedData, (void*) storedData);
         }
     }
--- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/allocation/AP12/ap12t001/ap12t001.cpp	Wed Oct 03 15:54:35 2018 +0200
+++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/allocation/AP12/ap12t001/ap12t001.cpp	Wed Oct 03 16:02:24 2018 +0200
@@ -64,8 +64,10 @@
     NSK_DISPLAY0("VMDeath event received\n");
 
     if (obj_free != EXP_OBJ_FREE) {
-        NSK_COMPLAIN2("Received unexpected number of ObjectFree events: %d\n\t\
-expected number: %d", obj_free, EXP_OBJ_FREE);
+        NSK_COMPLAIN2(
+            "Received unexpected number of ObjectFree events: %d\n"
+            "\texpected number: %d\n",
+            obj_free, EXP_OBJ_FREE);
         exit(95 + STATUS_FAILED);
     }
 
--- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/hotswap/HS201/hs201t003/hs201t003.cpp	Wed Oct 03 15:54:35 2018 +0200
+++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/hotswap/HS201/hs201t003/hs201t003.cpp	Wed Oct 03 16:02:24 2018 +0200
@@ -80,12 +80,12 @@
         return 0;
     }
 
-    if ((strcmp(name, expMeth) == 0) &&
-            (strcmp(sig, expSig) == 0)) {
-        NSK_DISPLAY4("===== %s event received for the tested method:\n\
-\tID=0x%p name=\"%s\" signature=\"%s\"\n",
+    if ((strcmp(name, expMeth) == 0) && (strcmp(sig, expSig) == 0)) {
+        NSK_DISPLAY4(
+            "===== %s event received for the tested method:\n"
+            "\tID=0x%p name=\"%s\" signature=\"%s\"\n",
             event, (void*) method, name, sig);
-         methFound = 1;
+        methFound = 1;
     }
     else
         methFound = 0;
@@ -129,8 +129,9 @@
     classDef.class_byte_count = bytesCount;
     classDef.class_bytes = (unsigned char*) clsBytes;
 
-    NSK_DISPLAY2("[%s] >>>>> Invoke RedefineClasses():\n\
-\tnew class byte count=%d\n",
+    NSK_DISPLAY2(
+        "[%s] >>>>> Invoke RedefineClasses():\n"
+        "\tnew class byte count=%d\n",
         event, classDef.class_byte_count);
     if (!NSK_JVMTI_VERIFY(NSK_CPP_STUB3(RedefineClasses,
             jvmti, 1, &classDef))) {
@@ -162,8 +163,9 @@
         nsk_jvmti_setFailStatus();
         return;
     }
-    NSK_DISPLAY3("[%s] method bytes count=%d\n\
-\tbytes count of the redefined method=%d\n",
+    NSK_DISPLAY3(
+        "[%s] method bytes count=%d\n"
+        "\tbytes count of the redefined method=%d\n",
         event, methBytesCount, redefMethBytesCount);
     if (!NSK_JVMTI_VERIFY(NSK_CPP_STUB2(Deallocate,
            jvmti_env, (unsigned char*) methBytes)))
--- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/hotswap/HS203/hs203t003/hs203t003.cpp	Wed Oct 03 15:54:35 2018 +0200
+++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/hotswap/HS203/hs203t003/hs203t003.cpp	Wed Oct 03 16:02:24 2018 +0200
@@ -174,6 +174,23 @@
     return JNI_OK;
 }
 
+JNIEXPORT jboolean JNICALL
+Java_nsk_jvmti_scenarios_hotswap_HS203_hs203t003_hs203t003_isSuspended(JNIEnv * jni,
+        jclass clas,
+        jthread thread) {
+    jboolean retvalue;
+    jint state;
+    retvalue = JNI_FALSE;
+    if ( ! NSK_JVMTI_VERIFY( NSK_CPP_STUB3(GetThreadState, jvmti, thread, &state) )  ) {
+        nsk_printf(" Agent :: Error while getting thread state.\n");
+        nsk_jvmti_agentFailed();
+    } else {
+        if ( state & JVMTI_THREAD_STATE_SUSPENDED) {
+          retvalue = JNI_TRUE;
+        }
+    }
+    return retvalue;
+}
 
 JNIEXPORT jboolean JNICALL
 Java_nsk_jvmti_scenarios_hotswap_HS203_hs203t003_hs203t003_popThreadFrame(JNIEnv * jni,
--- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/hotswap/HS203/hs203t003/hs203t003.java	Wed Oct 03 15:54:35 2018 +0200
+++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/hotswap/HS203/hs203t003/hs203t003.java	Wed Oct 03 16:02:24 2018 +0200
@@ -62,7 +62,8 @@
 public class hs203t003 extends RedefineAgent {
 
     public native boolean popThreadFrame(Thread thread);
-        public native boolean resumeThread(Thread thread);
+    public native boolean isSuspended(Thread thread);
+    public native boolean resumeThread(Thread thread);
 
 
     public hs203t003(String[] arg) {
@@ -82,10 +83,10 @@
         MyThread mt = new MyThread();
         try {
             mt.start();
-            // check if we can can pop the thread.
-            // we can not do redefine/pop frame on run method.
+            // Check if we can can pop the thread.
+            // We can not do redefine/pop frame on run method.
             while (!MyThread.resume.get());
-            // sleep for some few secs to get redefined.
+            // Sleep for some few secs to get redefined.
             while (!isRedefined()) {
                 if (!agentStatus()) {
                     System.out.println("Failed to redefine class");
@@ -93,10 +94,26 @@
                 }
                 Thread.sleep(100);
             }
-            popThreadFrame(mt); // pop the frame.
-            resumeThread(mt);   // resume the thread.
+            // Wait for the thread to be suspended.
+            while (!isSuspended(mt)) {
+                if (!agentStatus()) {
+                    System.out.println("Failed to suspend thread");
+                    return passed;
+                }
+                Thread.sleep(100);
+            }
+            // Pop the frame.
+            if (!popThreadFrame(mt)) {
+                System.out.println("Failed to pop a frame = "
+                                   + mt.threadState);
+            }
+            // Resume the thread.
+            if(!resumeThread(mt)) {
+                System.out.println("Failed to resume the thread = "
+                                   + mt.threadState);
+            }
+            // Wait till the other thread completes its execution.
             mt.join();
-            // wait till the other thread completes its execution.
             System.out.println("Thread state after popping/redefining = "
                                + mt.threadState);
         } catch(Exception ie) {
--- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/jni_interception/JI05/ji05t001/ji05t001.cpp	Wed Oct 03 15:54:35 2018 +0200
+++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/jni_interception/JI05/ji05t001/ji05t001.cpp	Wed Oct 03 16:02:24 2018 +0200
@@ -112,9 +112,10 @@
         env->FatalError("failed to get redirected JNI function table");
     }
 
-    NSK_DISPLAY1("%s JVMTI env: doRedirect: the JNI function table obtained successfully\n\
-\toverwriting the function GetVersion() ...\n",
-        (indx==0)?"first":"second");
+    NSK_DISPLAY1(
+        "%s JVMTI env: doRedirect: the JNI function table obtained successfully\n"
+        "\toverwriting the function GetVersion() ...\n",
+        (indx == 0) ? "first" : "second");
     redir_jni_functions[indx]->GetVersion =
         (indx==0)?MyGetVersionA:MyGetVersionB;
 
@@ -139,8 +140,9 @@
 
 static int checkIntercept(int indx, int env_num, int exCalls) {
     if (redir_calls[indx] == exCalls) {
-        NSK_DISPLAY5("\nCHECK PASSED: GetVersion() interception set in the %s JVMTI env %s properly:\n\
-\t%d interception(s) with the%s%s JVMTI env as expected\n",
+        NSK_DISPLAY5(
+            "\nCHECK PASSED: GetVersion() interception set in the %s JVMTI env %s properly:\n"
+            "\t%d interception(s) with the%s%s JVMTI env as expected\n",
             (indx==0)?"first":"second",
             (exCalls==0)?"overwritten by another environment":"works",
             redir_calls[indx],
@@ -149,8 +151,9 @@
     }
     else {
         result = STATUS_FAILED;
-        NSK_COMPLAIN6("\nTEST FAILED: GetVersion() interception set in the %s JVMTI env doesn't %s properly:\n\
-\t%d interception(s) with the%s%s JVMTI env instead of %d as expected\n",
+        NSK_COMPLAIN6(
+            "\nTEST FAILED: GetVersion() interception set in the %s JVMTI env doesn't %s properly:\n"
+            "\t%d interception(s) with the%s%s JVMTI env instead of %d as expected\n",
             (indx==0)?"first":"second",
             (exCalls==0)?"overwritten by another environment":"work",
             redir_calls[indx],
@@ -259,8 +262,9 @@
 
     /* intercept the JNI function table */
     /* check the interception set in another JVMTI env */
-    NSK_DISPLAY0("\n>>> TEST CASE #1) First JVMTI env: checking the redirection set in the same env ...\n\
-\nagent A (first JVMTI env): redirecting the function table ...\n");
+    NSK_DISPLAY0(
+        "\n>>> TEST CASE #1) First JVMTI env: checking the redirection set in the same env ...\n"
+        "\nagent A (first JVMTI env): redirecting the function table ...\n");
     doRedirect(env, jvmti[0], 0);
 
     /* check that the interception has been set properly */
@@ -343,8 +347,9 @@
     NSK_DISPLAY0("\n<<< TEST CASE #2) done\n");
 
     /* intercept the JNI function table */
-    NSK_DISPLAY0("\n>>> TEST CASE #3) Second JVMTI env: checking the redirection set in the same env ...\n\
-\nagent B (second JVMTI env): redirecting the function table ...\n");
+    NSK_DISPLAY0(
+        "\n>>> TEST CASE #3) Second JVMTI env: checking the redirection set in the same env ...\n"
+        "\nagent B (second JVMTI env): redirecting the function table ...\n");
     doRedirect(env, jvmti[1], 1);
 
     for (i=0; i<AGENTS; i++) {
--- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/jni_interception/JI06/ji06t001/ji06t001.cpp	Wed Oct 03 15:54:35 2018 +0200
+++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/jni_interception/JI06/ji06t001/ji06t001.cpp	Wed Oct 03 16:02:24 2018 +0200
@@ -155,8 +155,8 @@
         env->FatalError("failed to get redirected JNI function table");
     }
 
-    NSK_DISPLAY0("doRedirect: the JNI function table obtained successfully\n\
-\toverwriting the function MonitorEnter ...\n");
+    NSK_DISPLAY0("doRedirect: the JNI function table obtained successfully\n"
+                 "\toverwriting the function MonitorEnter ...\n");
 
     redir_jni_functions->MonitorEnter = MyMonitorEnter;
 
@@ -173,14 +173,16 @@
 
 static void checkCall(int exMonEntCalls) {
     if (monent_calls >= exMonEntCalls) {
-        NSK_DISPLAY1("CHECK PASSED: the tested JNI function MonitorEnter() has been redirected:\n\
-\tat least %d intercepted call(s) as expected",
+        NSK_DISPLAY1(
+            "CHECK PASSED: the tested JNI function MonitorEnter() has been redirected:\n"
+            "\tat least %d intercepted call(s) as expected",
             monent_calls);
     }
     else {
         result = STATUS_FAILED;
-        NSK_COMPLAIN2("TEST FAILED: the tested JNI function MonitorEnter() has not been redirected properly:\n\
-\tonly %d intercepted call(s) instead of at least %d as expected\n",
+        NSK_COMPLAIN2(
+            "TEST FAILED: the tested JNI function MonitorEnter() has not been redirected properly:\n"
+            "\tonly %d intercepted call(s) instead of at least %d as expected\n",
             monent_calls, exMonEntCalls);
     }
 }
@@ -194,8 +196,9 @@
     /* 4932877 fix in accordance with ANSI C: thread context of type void* -> int* -> int */
     int indx = *((int *) context);
 
-    NSK_DISPLAY1("waitingThread: thread #%d started\n\
-\tattaching the thread to the VM ...\n",
+    NSK_DISPLAY1(
+        "waitingThread: thread #%d started\n"
+        "\tattaching the thread to the VM ...\n",
         indx);
     if ((res = vm->AttachCurrentThread((void **) &env, (void *) 0)) != 0) {
         NSK_COMPLAIN1("TEST FAILURE: waitingThread: AttachCurrentThread() returns: %d\n",
@@ -239,8 +242,9 @@
         THREAD_return(STATUS_FAILED);
 
     monEntered = 1; /* the monitor has been entered */
-    NSK_DISPLAY1("ownerThread: entered the monitor: monEntered=%d\n\
-\twaiting ...\n",
+    NSK_DISPLAY1(
+        "ownerThread: entered the monitor: monEntered=%d\n"
+        "\twaiting ...\n",
         monEntered);
     do {
         THREAD_sleep(1);
@@ -372,8 +376,8 @@
     }
 
 /* begin the testing */
-    NSK_DISPLAY0(">>> TEST CASE a) Trying to redirect the JNI function ...\n\
-\nstarting redirector thread ...\n");
+    NSK_DISPLAY0(">>> TEST CASE a) Trying to redirect the JNI function ...\n\n"
+                 "starting redirector thread ...\n");
     redirThr = THREAD_new(redirectorThread, redirContext);
     if (THREAD_start(redirThr) == NULL) {
         NSK_COMPLAIN0("TEST FAILURE: cannot start redirector thread\n");
@@ -408,8 +412,8 @@
     NSK_DISPLAY0("<<<\n\n");
 
 /*  verification of the interception */
-    NSK_DISPLAY0(">>> TEST CASE b) Exercising the interception ...\n\
-\nmain thread: trying to enter the monitor ...\n");
+    NSK_DISPLAY0(">>> TEST CASE b) Exercising the interception ...\n\n"
+                 "main thread: trying to enter the monitor ...\n");
     if (enterMonitor(env, "mainThread") == STATUS_FAILED)
         exitCode = STATUS_FAILED;
     NSK_DISPLAY0("main thread: entered the monitor\n");
--- a/test/hotspot/jtreg/vmTestbase/nsk/monitoring/share/StackTraceController.cpp	Wed Oct 03 15:54:35 2018 +0200
+++ b/test/hotspot/jtreg/vmTestbase/nsk/monitoring/share/StackTraceController.cpp	Wed Oct 03 16:02:24 2018 +0200
@@ -29,31 +29,27 @@
 
 #define GET_OBJECT_CLASS(_class, _obj)\
     if (!NSK_JNI_VERIFY(env, (_class = \
-            NSK_CPP_STUB2(GetObjectClass, env, _obj)) != NULL))\
+            env->GetObjectClass(_obj)) != NULL))\
         return 2
 
 #define CALL_STATIC_VOID_NOPARAM(_class, _methodName)\
     GET_STATIC_METHOD_ID(method, _class, _methodName, "()V");\
-    if (!NSK_JNI_VERIFY_VOID(env, NSK_CPP_STUB3(CallStaticVoidMethod, env,\
-                            _class, method)))\
+    if (!NSK_JNI_VERIFY_VOID(env, env->CallStaticVoidMethod(_class, method)))\
         return 2
 
 #define GET_STATIC_METHOD_ID(_methodID, _class, _methodName, _sig)\
     if (!NSK_JNI_VERIFY(env, (_methodID = \
-            NSK_CPP_STUB4(GetStaticMethodID, env, _class,\
-                _methodName, _sig)) != NULL))\
+            env->GetStaticMethodID(_class, _methodName, _sig)) != NULL))\
         return 2
 
 #define GET_METHOD_ID(_methodID, _class, _methodName, _sig)\
     if (!NSK_JNI_VERIFY(env, (_methodID = \
-            NSK_CPP_STUB4(GetMethodID, env, _class,\
-                _methodName, _sig)) != NULL))\
+            env->GetMethodID(_class, _methodName, _sig)) != NULL))\
         return 2
 
 #define CALL_VOID_NOPARAM(_obj, _class, _methodName)\
     GET_METHOD_ID(method, _class, _methodName, "()V");\
-    if (!NSK_JNI_VERIFY_VOID(env, NSK_CPP_STUB3(CallVoidMethod, env, _obj,\
-                                                    method)))\
+    if (!NSK_JNI_VERIFY_VOID(env, env->CallVoidMethod(_obj, method)))\
         return 2
 
 JNIEXPORT jint JNICALL
@@ -71,18 +67,13 @@
         if (returnToJava) {
             GET_METHOD_ID(method, threadClass, "recursionJava", "(II)V");
             if (!NSK_JNI_VERIFY_VOID(env,
-                                     NSK_CPP_STUB5(CallIntMethod, env, obj,
-                                                   method, maxDepth,
-                                                   currentDepth))) {
+                                     env->CallIntMethod(obj, method, maxDepth, currentDepth))) {
                 return 1;
             }
         } else {
             GET_METHOD_ID(method, threadClass, "recursionNative", "(IIZ)I");
             if (!NSK_JNI_VERIFY_VOID(env,
-                                     NSK_CPP_STUB6(CallIntMethod, env, obj,
-                                                   method, maxDepth,
-                                                   currentDepth,
-                                                   returnToJava))) {
+                                     env->CallIntMethod(obj, method, maxDepth, currentDepth, returnToJava))) {
                 return 1;
             }
         }
--- a/test/hotspot/jtreg/vmTestbase/nsk/monitoring/share/ThreadController.cpp	Wed Oct 03 15:54:35 2018 +0200
+++ b/test/hotspot/jtreg/vmTestbase/nsk/monitoring/share/ThreadController.cpp	Wed Oct 03 16:02:24 2018 +0200
@@ -31,131 +31,121 @@
 
 #define FIND_CLASS(_class, _className)\
     if (!NSK_JNI_VERIFY(env, (_class = \
-            NSK_CPP_STUB2(FindClass, env, _className)) != NULL))\
+            env->FindClass(_className)) != NULL))\
         return
 
 #define GET_OBJECT_CLASS(_class, _obj)\
     if (!NSK_JNI_VERIFY(env, (_class = \
-            NSK_CPP_STUB2(GetObjectClass, env, _obj)) != NULL))\
+            env->GetObjectClass(_obj)) != NULL))\
         return
 
 #define GET_STATIC_FIELD_ID(_fieldID, _class, _fieldName, _fieldSig)\
     if (!NSK_JNI_VERIFY(env, (_fieldID = \
-            NSK_CPP_STUB4(GetStaticFieldID, env, _class,\
-                _fieldName, _fieldSig)) != NULL))\
+            env->GetStaticFieldID(_class, _fieldName, _fieldSig)) != NULL))\
         return
 
 #define GET_STATIC_OBJ_FIELD(_value, _class, _fieldName, _fieldSig)\
     GET_STATIC_FIELD_ID(field, _class, _fieldName, _fieldSig);\
-    _value = NSK_CPP_STUB3(GetStaticObjectField, env, _class, \
-                                field)
+    _value = env->GetStaticObjectField(_class, field)
 
 #define GET_STATIC_BOOL_FIELD(_value, _class, _fieldName)\
     GET_STATIC_FIELD_ID(field, _class, _fieldName, "Z");\
-    _value = NSK_CPP_STUB3(GetStaticBooleanField, env, _class, field)
+    _value = env->GetStaticBooleanField(_class, field)
 
 #define GET_FIELD_ID(_fieldID, _class, _fieldName, _fieldSig)\
     if (!NSK_JNI_VERIFY(env, (_fieldID = \
-            NSK_CPP_STUB4(GetFieldID, env, _class,\
-                _fieldName, _fieldSig)) != NULL))\
+            env->GetFieldID(_class, _fieldName, _fieldSig)) != NULL))\
         return
 
 #define GET_INT_FIELD(_value, _obj, _class, _fieldName)\
     GET_FIELD_ID(field, _class, _fieldName, "I");\
-    _value = NSK_CPP_STUB3(GetIntField, env, _obj, field)
+    _value = env->GetIntField(_obj, field)
 
 #define GET_BOOL_FIELD(_value, _obj, _class, _fieldName)\
     GET_FIELD_ID(field, _class, _fieldName, "Z");\
-    _value = NSK_CPP_STUB3(GetBooleanField, env, _obj, field)
+    _value = env->GetBooleanField(_obj, field)
 
 #define GET_LONG_FIELD(_value, _obj, _class, _fieldName)\
     GET_FIELD_ID(field, _class, _fieldName, "J");\
-    _value = NSK_CPP_STUB3(GetLongField, env, _obj, field)
+    _value = env->GetLongField(_obj, field)
 
 #define GET_STATIC_INT_FIELD(_value, _class, _fieldName)\
     GET_STATIC_FIELD_ID(field, _class, _fieldName, "I");\
-    _value = NSK_CPP_STUB3(GetStaticIntField, env, _class, field)
+    _value = env->GetStaticIntField(_class, field)
 
 #define SET_INT_FIELD(_obj, _class, _fieldName, _newValue)\
     GET_FIELD_ID(field, _class, _fieldName, "I");\
-    NSK_CPP_STUB4(SetIntField, env, _obj, field, _newValue)
+    env->SetIntField(_obj, field, _newValue)
 
 #define GET_OBJ_FIELD(_value, _obj, _class, _fieldName, _fieldSig)\
     GET_FIELD_ID(field, _class, _fieldName, _fieldSig);\
-    _value = NSK_CPP_STUB3(GetObjectField, env, _obj, field)
+    _value = env->GetObjectField(_obj, field)
 
 
 #define GET_ARR_ELEMENT(_arr, _index)\
-    NSK_CPP_STUB3(GetObjectArrayElement, env, _arr, _index)
+    env->GetObjectArrayElement(_arr, _index)
 
 #define SET_ARR_ELEMENT(_arr, _index, _newValue)\
-    NSK_CPP_STUB4(SetObjectArrayElement, env, _arr, _index, _newValue)
+    env->SetObjectArrayElement(_arr, _index, _newValue)
 
 #define GET_STATIC_METHOD_ID(_methodID, _class, _methodName, _sig)\
     if (!NSK_JNI_VERIFY(env, (_methodID = \
-            NSK_CPP_STUB4(GetStaticMethodID, env, _class,\
-                _methodName, _sig)) != NULL))\
+            env->GetStaticMethodID(_class, _methodName, _sig)) != NULL))\
         return
 
 #define GET_METHOD_ID(_methodID, _class, _methodName, _sig)\
     if (!NSK_JNI_VERIFY(env, (_methodID = \
-            NSK_CPP_STUB4(GetMethodID, env, _class,\
-                _methodName, _sig)) != NULL))\
+            env->GetMethodID(_class, _methodName, _sig)) != NULL))\
         return
 
 #define CALL_STATIC_VOID_NOPARAM(_class, _methodName)\
     GET_STATIC_METHOD_ID(method, _class, _methodName, "()V");\
-    if (!NSK_JNI_VERIFY_VOID(env, NSK_CPP_STUB3(CallStaticVoidMethod, env,\
-                            _class, method)))\
+    if (!NSK_JNI_VERIFY_VOID(env, env->CallStaticVoidMethod(_class, method)))\
         return
 
 #define CALL_STATIC_VOID(_class, _methodName, _sig, _param)\
     GET_STATIC_METHOD_ID(method, _class, _methodName, _sig);\
-    if (!NSK_JNI_VERIFY_VOID(env, NSK_CPP_STUB4(CallStaticVoidMethod, env,\
-                                                    _class, method, _param)))\
+    if (!NSK_JNI_VERIFY_VOID(env, env->CallStaticVoidMethod(_class, method, _param)))\
         return
 
 #define CALL_STATIC_OBJ(_value, _class, _methodName, _sig, _param)\
     GET_STATIC_METHOD_ID(method, _class, _methodName, _sig);\
-    _value = NSK_CPP_STUB4(CallStaticObjectMethod, env, _class, method, _param)
+    _value = env->CallStaticObjectMethod(_class, method, _param)
 
 #define CALL_VOID_NOPARAM(_obj, _class, _methodName)\
     GET_METHOD_ID(method, _class, _methodName, "()V");\
-    if (!NSK_JNI_VERIFY_VOID(env, NSK_CPP_STUB3(CallVoidMethod, env, _obj,\
-                                                    method)))\
+    if (!NSK_JNI_VERIFY_VOID(env, env->CallVoidMethod(_obj, method)))\
         return
 
 #define CALL_VOID(_obj, _class, _methodName, _sig, _param)\
     GET_METHOD_ID(method, _class, _methodName, "()V");\
-    if (!NSK_JNI_VERIFY_VOID(env, NSK_CPP_STUB4(CallVoidMethod, env, _obj,\
-                                                    method, _param)))\
+    if (!NSK_JNI_VERIFY_VOID(env, env->CallVoidMethod(_obj, method, _param)))\
         return
 
 #define CALL_VOID2(_obj, _class, _methodName, _sig, _param1, _param2)\
     GET_METHOD_ID(method, _class, _methodName, _sig);\
-    if (!NSK_JNI_VERIFY_VOID(env, NSK_CPP_STUB5(CallVoidMethod, env, _obj, \
-                                                    method, _param1, _param2)))\
+    if (!NSK_JNI_VERIFY_VOID(env, env->CallVoidMethod(_obj, method, _param1, _param2)))\
         return
 
 #define CALL_INT_NOPARAM(_value, _obj, _class, _methodName)\
     GET_METHOD_ID(method, _class, _methodName, "()I");\
-    _value = NSK_CPP_STUB3(CallIntMethod, env, _obj, method)
+    _value = env->CallIntMethod(_obj, method)
 
 #define NEW_OBJ(_obj, _class, _constructorName, _sig, _params)\
     GET_METHOD_ID(method, _class, _constructorName, _sig);\
     if (!NSK_JNI_VERIFY(env, (_obj = \
-            NSK_CPP_STUB4(NewObject, env, _class, method, _params)) != NULL))\
+            env->NewObject(_class, method, _params)) != NULL))\
         return
 
 #define MONITOR_ENTER(x) \
-    NSK_JNI_VERIFY(env, NSK_CPP_STUB2(MonitorEnter, env, x) == 0)
+    NSK_JNI_VERIFY(env, env->MonitorEnter(x) == 0)
 
 #define MONITOR_EXIT(x) \
-    NSK_JNI_VERIFY(env, NSK_CPP_STUB2(MonitorExit, env, x) == 0)
+    NSK_JNI_VERIFY(env, env->MonitorExit(x) == 0)
 
 #define TRACE(msg)\
    GET_OBJ_FIELD(logger, obj, threadClass, "logger", "Lnsk/share/Log$Logger;");\
-   jmsg = NSK_CPP_STUB2(NewStringUTF, env, msg);\
+   jmsg = env->NewStringUTF(msg);\
    CALL_VOID2(logger, loggerClass, "trace",\
                            "(ILjava/lang/String;)V", 50, jmsg)
 
@@ -497,29 +487,29 @@
         jint state;
 
         if(!NSK_VERIFY(
-             NSK_CPP_STUB2(GetJavaVM, env, &vm) == 0)) {
+             env->GetJavaVM(&vm) == 0)) {
             return NULL;
         }
 
         if(!NSK_VERIFY(
-             NSK_CPP_STUB3(GetEnv, vm, (void **)&jvmti, JVMTI_VERSION_1)
+             vm->GetEnv((void **)&jvmti, JVMTI_VERSION_1)
                     == JNI_OK)) {
             return NULL;
         }
 
         if(!NSK_VERIFY(
-             NSK_CPP_STUB3(GetThreadState, jvmti, (jthread)thread, &state)
+             jvmti->GetThreadState((jthread)thread, &state)
              == JVMTI_ERROR_NONE)) {
             return NULL;
         }
 
         stateName = getStateName(env, state);
-        if (!NSK_JNI_VERIFY(env, (ThreadState = NSK_CPP_STUB2(FindClass, env, "java/lang/Thread$State")) != NULL))
+        if (!NSK_JNI_VERIFY(env, (ThreadState = env->FindClass("java/lang/Thread$State")) != NULL))
             return NULL;
 
-        if (!NSK_JNI_VERIFY(env, (method = NSK_CPP_STUB4(GetStaticMethodID, env, ThreadState, "valueOf", "(Ljava/lang/String;)Ljava/lang/Thread$State;")) != NULL))
+        if (!NSK_JNI_VERIFY(env, (method = env->GetStaticMethodID(ThreadState, "valueOf", "(Ljava/lang/String;)Ljava/lang/Thread$State;")) != NULL))
             return NULL;
-        threadState = NSK_CPP_STUB4(CallStaticObjectMethod, env, ThreadState, method, stateName);
+        threadState = env->CallStaticObjectMethod(ThreadState, method, stateName);
 
         return threadState;
     }
--- a/test/hotspot/jtreg/vmTestbase/nsk/monitoring/share/thread/Deadlock.cpp	Wed Oct 03 15:54:35 2018 +0200
+++ b/test/hotspot/jtreg/vmTestbase/nsk/monitoring/share/thread/Deadlock.cpp	Wed Oct 03 16:02:24 2018 +0200
@@ -27,34 +27,31 @@
 
 #define FIND_CLASS(_class, _className)\
         if (!NSK_JNI_VERIFY(env, (_class = \
-             NSK_CPP_STUB2(FindClass, env, _className)) != NULL))\
+             env->FindClass(_className)) != NULL))\
                 return
 
 #define GET_OBJECT_CLASS(_class, _obj)\
         if (!NSK_JNI_VERIFY(env, (_class = \
-             NSK_CPP_STUB2(GetObjectClass, env, _obj)) != NULL))\
+             env->GetObjectClass(_obj)) != NULL))\
                 return
 
 #define GET_OBJ_FIELD(_value, _obj, _class, _fieldName, _fieldSig)\
         GET_FIELD_ID(field, _class, _fieldName, _fieldSig);\
-        _value = NSK_CPP_STUB3(GetObjectField, env, _obj, field)
+        _value = env->GetObjectField(_obj, field)
 
 #define GET_FIELD_ID(_fieldID, _class, _fieldName, _fieldSig)\
         if (!NSK_JNI_VERIFY(env, (_fieldID = \
-             NSK_CPP_STUB4(GetFieldID, env, _class,\
-             _fieldName, _fieldSig)) != NULL))\
+             env->GetFieldID(_class, _fieldName, _fieldSig)) != NULL))\
                 return
 
 #define GET_METHOD_ID(_methodID, _class, _methodName, _sig)\
         if (!NSK_JNI_VERIFY(env, (_methodID = \
-             NSK_CPP_STUB4(GetMethodID, env, _class,\
-             _methodName, _sig)) != NULL)) \
+             env->GetMethodID(_class, _methodName, _sig)) != NULL)) \
                 return
 
 #define CALL_VOID_NOPARAM(_obj, _class, _methodName)\
             GET_METHOD_ID(method, _class, _methodName, "()V");\
-        if (!NSK_JNI_VERIFY_VOID(env, NSK_CPP_STUB3(CallVoidMethod, env, _obj,\
-             method))) \
+        if (!NSK_JNI_VERIFY_VOID(env, env->CallVoidMethod(_obj, method))) \
                 return
 
 /*
--- a/test/hotspot/jtreg/vmTestbase/nsk/monitoring/share/thread/LockingThreads.cpp	Wed Oct 03 15:54:35 2018 +0200
+++ b/test/hotspot/jtreg/vmTestbase/nsk/monitoring/share/thread/LockingThreads.cpp	Wed Oct 03 16:02:24 2018 +0200
@@ -27,34 +27,31 @@
 
 #define FIND_CLASS(_class, _className)\
         if (!NSK_JNI_VERIFY(env, (_class = \
-             NSK_CPP_STUB2(FindClass, env, _className)) != NULL))\
+             env->FindClass(_className)) != NULL))\
                 return
 
 #define GET_OBJECT_CLASS(_class, _obj)\
         if (!NSK_JNI_VERIFY(env, (_class = \
-             NSK_CPP_STUB2(GetObjectClass, env, _obj)) != NULL))\
+             env->GetObjectClass(_obj)) != NULL))\
                 return
 
 #define GET_OBJ_FIELD(_value, _obj, _class, _fieldName, _fieldSig)\
         GET_FIELD_ID(field, _class, _fieldName, _fieldSig);\
-        _value = NSK_CPP_STUB3(GetObjectField, env, _obj, field)
+        _value = env->GetObjectField(_obj, field)
 
 #define GET_FIELD_ID(_fieldID, _class, _fieldName, _fieldSig)\
         if (!NSK_JNI_VERIFY(env, (_fieldID = \
-             NSK_CPP_STUB4(GetFieldID, env, _class,\
-             _fieldName, _fieldSig)) != NULL))\
+             env->GetFieldID(_class, _fieldName, _fieldSig)) != NULL))\
                 return
 
 #define GET_METHOD_ID(_methodID, _class, _methodName, _sig)\
         if (!NSK_JNI_VERIFY(env, (_methodID = \
-             NSK_CPP_STUB4(GetMethodID, env, _class,\
-             _methodName, _sig)) != NULL))\
+             env->GetMethodID(_class, _methodName, _sig)) != NULL))\
                 return
 
 #define CALL_VOID_NOPARAM(_obj, _class, _methodName)\
             GET_METHOD_ID(method, _class, _methodName, "()V");\
-        if (!NSK_JNI_VERIFY_VOID(env, NSK_CPP_STUB3(CallVoidMethod, env, _obj,\
-             method)))\
+        if (!NSK_JNI_VERIFY_VOID(env, env->CallVoidMethod(_obj, method)))\
                 return
 /*
  * Class:     nsk_monitoring_share_thread_LockingThreads_Thread1
--- a/test/hotspot/jtreg/vmTestbase/nsk/monitoring/share/thread/RecursiveMonitoringThread.cpp	Wed Oct 03 15:54:35 2018 +0200
+++ b/test/hotspot/jtreg/vmTestbase/nsk/monitoring/share/thread/RecursiveMonitoringThread.cpp	Wed Oct 03 16:02:24 2018 +0200
@@ -29,123 +29,113 @@
 
 #define FIND_CLASS(_class, _className)\
     if (!NSK_JNI_VERIFY(env, (_class = \
-            NSK_CPP_STUB2(FindClass, env, _className)) != NULL))\
+            env->FindClass(_className)) != NULL))\
         return
 
 #define GET_OBJECT_CLASS(_class, _obj)\
     if (!NSK_JNI_VERIFY(env, (_class = \
-            NSK_CPP_STUB2(GetObjectClass, env, _obj)) != NULL))\
+            env->GetObjectClass(_obj)) != NULL))\
         return
 
 #define GET_STATIC_FIELD_ID(_fieldID, _class, _fieldName, _fieldSig)\
     if (!NSK_JNI_VERIFY(env, (_fieldID = \
-            NSK_CPP_STUB4(GetStaticFieldID, env, _class,\
-                _fieldName, _fieldSig)) != NULL))\
+            env->GetStaticFieldID(_class, _fieldName, _fieldSig)) != NULL))\
         return
 
 #define GET_STATIC_OBJ_FIELD(_value, _class, _fieldName, _fieldSig)\
     GET_STATIC_FIELD_ID(field, _class, _fieldName, _fieldSig);\
-    _value = NSK_CPP_STUB3(GetStaticObjectField, env, _class, \
-                                field)
+    _value = env->GetStaticObjectField(_class, field)
 
 #define GET_STATIC_BOOL_FIELD(_value, _class, _fieldName)\
     GET_STATIC_FIELD_ID(field, _class, _fieldName, "Z");\
-    _value = NSK_CPP_STUB3(GetStaticBooleanField, env, _class, field)
+    _value = env->GetStaticBooleanField(_class, field)
 
 #define GET_FIELD_ID(_fieldID, _class, _fieldName, _fieldSig)\
     if (!NSK_JNI_VERIFY(env, (_fieldID = \
-            NSK_CPP_STUB4(GetFieldID, env, _class,\
-                _fieldName, _fieldSig)) != NULL))\
+            env->GetFieldID(_class, _fieldName, _fieldSig)) != NULL))\
         return
 
 #define GET_INT_FIELD(_value, _obj, _class, _fieldName)\
     GET_FIELD_ID(field, _class, _fieldName, "I");\
-    _value = NSK_CPP_STUB3(GetIntField, env, _obj, field)
+    _value = env->GetIntField(_obj, field)
 
 #define GET_LONG_FIELD(_value, _obj, _class, _fieldName)\
     GET_FIELD_ID(field, _class, _fieldName, "J");\
-    _value = NSK_CPP_STUB3(GetLongField, env, _obj, field)
+    _value = env->GetLongField(_obj, field)
 
 #define GET_STATIC_INT_FIELD(_value, _class, _fieldName)\
     GET_STATIC_FIELD_ID(field, _class, _fieldName, "I");\
-    _value = NSK_CPP_STUB3(GetStaticIntField, env, _class, field)
+    _value = env->GetStaticIntField(_class, field)
 
 #define SET_INT_FIELD(_obj, _class, _fieldName, _newValue)\
     GET_FIELD_ID(field, _class, _fieldName, "I");\
-    NSK_CPP_STUB4(SetIntField, env, _obj, field, _newValue)
+    env->SetIntField(_obj, field, _newValue)
 
 #define GET_OBJ_FIELD(_value, _obj, _class, _fieldName, _fieldSig)\
     GET_FIELD_ID(field, _class, _fieldName, _fieldSig);\
-    _value = NSK_CPP_STUB3(GetObjectField, env, _obj, field)
+    _value = env->GetObjectField(_obj, field)
 
 
 #define GET_ARR_ELEMENT(_arr, _index)\
-    NSK_CPP_STUB3(GetObjectArrayElement, env, _arr, _index)
+    env->GetObjectArrayElement(_arr, _index)
 
 #define SET_ARR_ELEMENT(_arr, _index, _newValue)\
-    NSK_CPP_STUB4(SetObjectArrayElement, env, _arr, _index, _newValue)
+    env->SetObjectArrayElement(_arr, _index, _newValue)
 
 #define GET_STATIC_METHOD_ID(_methodID, _class, _methodName, _sig)\
     if (!NSK_JNI_VERIFY(env, (_methodID = \
-            NSK_CPP_STUB4(GetStaticMethodID, env, _class,\
-                _methodName, _sig)) != NULL))\
+            env->GetStaticMethodID(_class, _methodName, _sig)) != NULL))\
         return
 
 #define GET_METHOD_ID(_methodID, _class, _methodName, _sig)\
     if (!NSK_JNI_VERIFY(env, (_methodID = \
-            NSK_CPP_STUB4(GetMethodID, env, _class,\
-                _methodName, _sig)) != NULL))\
+            env->GetMethodID(_class, _methodName, _sig)) != NULL))\
         return
 
 #define CALL_STATIC_VOID_NOPARAM(_class, _methodName)\
     GET_STATIC_METHOD_ID(method, _class, _methodName, "()V");\
-    if (!NSK_JNI_VERIFY_VOID(env, NSK_CPP_STUB3(CallStaticVoidMethod, env,\
-                            _class, method)))\
+    if (!NSK_JNI_VERIFY_VOID(env, env->CallStaticVoidMethod(_class, method)))\
         return
 
 #define CALL_STATIC_VOID(_class, _methodName, _sig, _param)\
     GET_STATIC_METHOD_ID(method, _class, _methodName, _sig);\
-    if (!NSK_JNI_VERIFY_VOID(env, NSK_CPP_STUB4(CallStaticVoidMethod, env,\
-                                                    _class, method, _param)))\
+    if (!NSK_JNI_VERIFY_VOID(env, env->CallStaticVoidMethod(_class, method, _param)))\
         return
 
 #define CALL_VOID_NOPARAM(_obj, _class, _methodName)\
     GET_METHOD_ID(method, _class, _methodName, "()V");\
-    if (!NSK_JNI_VERIFY_VOID(env, NSK_CPP_STUB3(CallVoidMethod, env, _obj,\
-                                                    method)))\
+    if (!NSK_JNI_VERIFY_VOID(env, env->CallVoidMethod(_obj, method)))\
         return
 
 #define CALL_VOID(_obj, _class, _methodName, _sig, _param)\
     GET_METHOD_ID(method, _class, _methodName, _sig);\
-    if (!NSK_JNI_VERIFY_VOID(env, NSK_CPP_STUB4(CallVoidMethod, env, _obj,\
-                                                    method, _param)))\
+    if (!NSK_JNI_VERIFY_VOID(env, env->CallVoidMethod(_obj, method, _param)))\
         return
 
 #define CALL_VOID2(_obj, _class, _methodName, _sig, _param1, _param2)\
     GET_METHOD_ID(method, _class, _methodName, _sig);\
-    if (!NSK_JNI_VERIFY_VOID(env, NSK_CPP_STUB5(CallVoidMethod, env, _obj, \
-                                                    method, _param1, _param2)))\
+    if (!NSK_JNI_VERIFY_VOID(env, env->CallVoidMethod(_obj, method, _param1, _param2)))\
         return
 
 #define CALL_INT_NOPARAM(_value, _obj, _class, _methodName)\
     GET_METHOD_ID(method, _class, _methodName, "()I");\
-    _value = NSK_CPP_STUB3(CallIntMethod, env, _obj, method)
+    _value = env->CallIntMethod(_obj, method)
 
 #define NEW_OBJ(_obj, _class, _constructorName, _sig, _params)\
     GET_METHOD_ID(method, _class, _constructorName, _sig);\
     if (!NSK_JNI_VERIFY(env, (_obj = \
-            NSK_CPP_STUB4(NewObject, env, _class, method, _params)) != NULL))\
+            env->NewObject(_class, method, _params)) != NULL))\
         return
 
 #define MONITOR_ENTER(x) \
-    NSK_JNI_VERIFY(env, NSK_CPP_STUB2(MonitorEnter, env, x) == 0)
+    NSK_JNI_VERIFY(env, env->MonitorEnter(x) == 0)
 
 #define MONITOR_EXIT(x) \
-    NSK_JNI_VERIFY(env, NSK_CPP_STUB2(MonitorExit, env, x) == 0)
+    NSK_JNI_VERIFY(env, env->MonitorExit(x) == 0)
 
 #define TRACE(msg)\
    GET_OBJ_FIELD(logger, obj, threadClass, "logger", "Lnsk/share/Log$Logger;");\
-   jmsg = NSK_CPP_STUB2(NewStringUTF, env, msg);\
+   jmsg = env->NewStringUTF(msg);\
    CALL_VOID2(logger, loggerClass, "trace",\
                            "(ILjava/lang/String;)V", 50, jmsg)
 
--- a/test/hotspot/jtreg/vmTestbase/nsk/share/JVMTIagent.cpp	Wed Oct 03 15:54:35 2018 +0200
+++ b/test/hotspot/jtreg/vmTestbase/nsk/share/JVMTIagent.cpp	Wed Oct 03 16:02:24 2018 +0200
@@ -160,19 +160,18 @@
         lock(jni_env);
         display(0, "#### JVMTIagent: ClassLoad: >>>>>>>> entered the raw monitor \"eventLock\" ####\n");
 
-        if (!NSK_JVMTI_VERIFY(NSK_CPP_STUB4(GetClassSignature,
-                jvmti_env, klass, &cls_sig, /*&generic*/NULL)))
-            NSK_CPP_STUB2(FatalError, jni_env,
-                "JVMTIagent: failed to get class signature\n");
+        if (!NSK_JVMTI_VERIFY(jvmti_env->GetClassSignature(klass, &cls_sig, /*&generic*/NULL)))
+            jni_env->FatalError("JVMTIagent: failed to get class signature\n");
         else {
             if (shortTestName != NULL) {
                 if (strstr((const char*) cls_sig, shortTestName) != NULL) {
-                    display(0, "#### JVMTIagent: found test class matched with \"%s\"\n\
-<JVMTIagent>\tsignature=%s\n",
-                        shortTestName, cls_sig);
+                    display(0,
+                            "#### JVMTIagent: found test class matched with \"%s\"\n"
+                            "<JVMTIagent>\tsignature=%s\n",
+                            shortTestName, cls_sig);
                     clsByteCount = allocClsInfo(jni_env, cls_sig, klass);
                     display(0, "#### JVMTIagent: %d bytes defining the class have been successfully loaded\n",
-                        clsByteCount);
+                            clsByteCount);
                 }
             }
         }
@@ -244,14 +243,11 @@
 
     if (hotswap == HOTSWAP_EVERY_EXCEPTION ||
             hotswap == HOTSWAP_EVERY_EXCEPTION_FOR_EVERY_CLASS) {
-        if (!NSK_JVMTI_VERIFY(NSK_CPP_STUB3(GetMethodDeclaringClass,
-                jvmti_env, method, &decl_clazz)))
-            NSK_CPP_STUB2(FatalError, jni_env,
-                "JVMTIagent: failed to get method declaring class\n");
+        if (!NSK_JVMTI_VERIFY(jvmti_env->GetMethodDeclaringClass(method, &decl_clazz)))
+            jni_env->FatalError("JVMTIagent: failed to get method declaring class\n");
 
         if (findAndHotSwap(jni_env, decl_clazz) != 0)
-            NSK_CPP_STUB2(FatalError, jni_env,
-                "JVMTIagent: failed to hotswap class\n");
+            jni_env->FatalError("JVMTIagent: failed to hotswap class\n");
     }
 }
 
@@ -418,14 +414,11 @@
     getVerdict(jni_env, "SingleStep");
 
     if (hotswap == HOTSWAP_EVERY_SINGLE_STEP) {
-        if (!NSK_JVMTI_VERIFY(NSK_CPP_STUB3(GetMethodDeclaringClass,
-                jvmti_env, method, &decl_clazz)))
-            NSK_CPP_STUB2(FatalError, jni_env,
-                "JVMTIagent: failed to get method declaring class\n");
+        if (!NSK_JVMTI_VERIFY(jvmti_env->GetMethodDeclaringClass(method, &decl_clazz)))
+            jni_env->FatalError("JVMTIagent: failed to get method declaring class\n");
 
         if (findAndHotSwap(jni_env, decl_clazz) != 0)
-            NSK_CPP_STUB2(FatalError, jni_env,
-                "JVMTIagent: failed to hotswap class\n");
+            jni_env->FatalError("JVMTIagent: failed to hotswap class\n");
     }
 }
 
@@ -442,14 +435,11 @@
 
     if (hotswap == HOTSWAP_EVERY_METHOD_ENTRY ||
             hotswap == HOTSWAP_EVERY_METHOD_ENTRY_FOR_EVERY_CLASS) {
-        if (!NSK_JVMTI_VERIFY(NSK_CPP_STUB3(GetMethodDeclaringClass,
-                jvmti_env, method, &decl_clazz)))
-            NSK_CPP_STUB2(FatalError, jni_env,
-                "JVMTIagent: failed to get method declaring class\n");
+        if (!NSK_JVMTI_VERIFY(jvmti_env->GetMethodDeclaringClass(method, &decl_clazz)))
+            jni_env->FatalError("JVMTIagent: failed to get method declaring class\n");
 
         if (findAndHotSwap(jni_env, decl_clazz) != 0)
-            NSK_CPP_STUB2(FatalError, jni_env,
-                "JVMTIagent: failed to hotswap class\n");
+            jni_env->FatalError("JVMTIagent: failed to hotswap class\n");
     }
 }
 
@@ -476,30 +466,23 @@
 
     if (hotswap == HOTSWAP_EVERY_EXCEPTION ||
             hotswap == HOTSWAP_EVERY_EXCEPTION_FOR_EVERY_CLASS) {
-        if (!NSK_JVMTI_VERIFY(NSK_CPP_STUB3(GetMethodDeclaringClass,
-                jvmti_env, method, &decl_clazz)))
-            NSK_CPP_STUB2(FatalError, jni_env,
-                "JVMTIagent: failed to get method declaring class\n");
+        if (!NSK_JVMTI_VERIFY(jvmti_env->GetMethodDeclaringClass(method, &decl_clazz)))
+            jni_env->FatalError("JVMTIagent: failed to get method declaring class\n");
 
         if (findAndHotSwap(jni_env, decl_clazz) != 0)
-            NSK_CPP_STUB2(FatalError, jni_env,
-                "JVMTIagent: failed to hotswap class\n");
+            jni_env->FatalError("JVMTIagent: failed to hotswap class\n");
     }
 }
 /************************/
 
 static void lock(JNIEnv *jni_env) {
-    if (!NSK_JVMTI_VERIFY(NSK_CPP_STUB2(RawMonitorEnter,
-            jvmti, eventLock)))
-        NSK_CPP_STUB2(FatalError, jni_env,
-            "JVMTIagent: failed to enter a raw monitor\n");
+    if (!NSK_JVMTI_VERIFY(jvmti->RawMonitorEnter(eventLock)))
+        jni_env->FatalError("JVMTIagent: failed to enter a raw monitor\n");
 }
 
 static void unlock(JNIEnv *jni_env) {
-    if (!NSK_JVMTI_VERIFY(NSK_CPP_STUB2(RawMonitorExit,
-            jvmti, eventLock)))
-        NSK_CPP_STUB2(FatalError, jni_env,
-            "JVMTIagent: failed to exit a raw monitor\n");
+    if (!NSK_JVMTI_VERIFY(jvmti->RawMonitorExit(eventLock)))
+        jni_env->FatalError("JVMTIagent: failed to exit a raw monitor\n");
 }
 
 JNIEXPORT jint JNICALL
@@ -515,10 +498,8 @@
     }
 
     /* get supported JVMTI capabilities */
-    if (!NSK_JVMTI_VERIFY(NSK_CPP_STUB2(GetCapabilities,
-            jvmti, &capabil)))
-        NSK_CPP_STUB2(FatalError, jni_env,
-            "JVMTIagent: failed to get capabilities\n");
+    if (!NSK_JVMTI_VERIFY(jvmti->GetCapabilities(&capabil)))
+        jni_env->FatalError("JVMTIagent: failed to get capabilities\n");
     if (capabil.can_redefine_classes != 1) { /* ???????????? */
         printf("ERROR: JVMTIagent: Class File Redefinition (HotSwap) is not implemented in this VM\n");
         return 1;
@@ -534,33 +515,38 @@
             return 0;
         case HOTSWAP_EVERY_METHOD_ENTRY:
             stress_lev = 2;
-            display(0, "#### JVMTIagent: hotswapping class in every method entry event enabled ####\n\
-<JVMTIagent>\tHotSwap stress level: %d\n",
-                stress_lev);
+            display(0,
+                    "#### JVMTIagent: hotswapping class in every method entry event enabled ####\n"
+                    "<JVMTIagent>\tHotSwap stress level: %d\n",
+                    stress_lev);
             break;
         case HOTSWAP_EVERY_METHOD_ENTRY_FOR_EVERY_CLASS:
             stress_lev = 2;
-            display(0, "#### JVMTIagent: hotswapping class in every method entry event for every class enabled ####\n\
-<JVMTIagent>\tHotSwap stress level: %d\n",
-                stress_lev);
+            display(0,
+                    "#### JVMTIagent: hotswapping class in every method entry event for every class enabled ####\n"
+                    "<JVMTIagent>\tHotSwap stress level: %d\n",
+                    stress_lev);
             break;
         case HOTSWAP_EVERY_SINGLE_STEP:
             stress_lev = 3;
-            display(0, "#### JVMTIagent: hotswapping class in every single step event enabled ####\n\
-<JVMTIagent>\tHotSwap stress level: %d\n",
-                stress_lev);
+            display(0,
+                    "#### JVMTIagent: hotswapping class in every single step event enabled ####\n"
+                    "<JVMTIagent>\tHotSwap stress level: %d\n",
+                    stress_lev);
             break;
         case HOTSWAP_EVERY_EXCEPTION:
             stress_lev = 4;
-            display(0, "#### JVMTIagent: hotswapping class in every exception event enabled ####\n\
-<JVMTIagent>\tHotSwap stress level: %d\n",
-                stress_lev);
+            display(0,
+                    "#### JVMTIagent: hotswapping class in every exception event enabled ####\n"
+                    "<JVMTIagent>\tHotSwap stress level: %d\n",
+                    stress_lev);
             break;
         case HOTSWAP_EVERY_EXCEPTION_FOR_EVERY_CLASS:
             stress_lev = 40;
-            display(0, "#### JVMTIagent: hotswapping class in every exception event for every class enabled ####\n\
-<JVMTIagent>\tHotSwap stress level: %d\n",
-                stress_lev);
+            display(0,
+                    "#### JVMTIagent: hotswapping class in every exception event for every class enabled ####\n"
+                    "<JVMTIagent>\tHotSwap stress level: %d\n",
+                    stress_lev);
             break;
         default:
             printf("ERROR(%s,%d): JVMTIagent: unknown value of HotSwap stress level: \"%d\"\n",
@@ -568,16 +554,14 @@
             return 1;
     }
 
-    if (!NSK_JNI_VERIFY(jni_env, (shortTestName = NSK_CPP_STUB3(GetStringUTFChars,
-            jni_env, shortName, NULL)) != NULL)) {
+    if (!NSK_JNI_VERIFY(jni_env, (shortTestName = jni_env->GetStringUTFChars(shortName, NULL)) != NULL)) {
         printf("ERROR: JVMTIagent: unable to get UTF-8 characters of the string\n");
         return 1;
     }
     display(0, "#### JVMTIagent: short name of current test is \"%s\"\n",
         shortTestName);
 
-    if (!NSK_JNI_VERIFY(jni_env, (rasCls = NSK_CPP_STUB2(NewGlobalRef,
-            jni_env, cls)) != NULL)) {
+    if (!NSK_JNI_VERIFY(jni_env, (rasCls = jni_env->NewGlobalRef(cls)) != NULL)) {
         printf("ERROR JVMTIagent: unable to create a new global reference of the class \"RASagent\"\n");
         return 1;
     }
@@ -599,37 +583,31 @@
 
     if ((_clsInfo = (class_info*)
             malloc(sizeof(class_info))) == NULL)
-        NSK_CPP_STUB2(FatalError, jni_env,
-            "JVMTIagent: cannot allocate memory for class_info\n");
+        jni_env->FatalError("JVMTIagent: cannot allocate memory for class_info\n");
 
     /* fill the structure class_info */
     _clsInfo->clazzsig = cls_sig;
 
-    if (!NSK_JNI_VERIFY(jni_env, ((*_clsInfo).cls = NSK_CPP_STUB2(NewGlobalRef,
-            jni_env, clazz)) != NULL)) {
+    if (!NSK_JNI_VERIFY(jni_env, ((*_clsInfo).cls = jni_env->NewGlobalRef(clazz)) != NULL)) {
         printf("ERROR: JVMTIagent: unable to create a new global reference of class \"%s\"\n",
             _clsInfo->clazzsig);
         free(_clsInfo);
         deallocClsInfo(jni_env);
-        NSK_CPP_STUB2(FatalError, jni_env,
-            "JVMTIagent: unable to create a new global reference of class\n");
+        jni_env->FatalError("JVMTIagent: unable to create a new global reference of class\n");
     }
 
     if (!NSK_JNI_VERIFY(jni_env, (mid =
-        NSK_CPP_STUB4(GetStaticMethodID, jni_env, rasCls,
-            "loadFromClassFile", "(Ljava/lang/String;)[B")) != NULL))
-        NSK_CPP_STUB2(FatalError, jni_env,
-            "JVMTIagent: unable to get ID of the method \"loadFromClassFile\"\n");
+        jni_env->GetStaticMethodID(rasCls, "loadFromClassFile", "(Ljava/lang/String;)[B")) != NULL))
+        jni_env->FatalError("JVMTIagent: unable to get ID of the method \"loadFromClassFile\"\n");
 
-    classBytes = (jbyteArray) NSK_CPP_STUB4(CallStaticObjectMethod,
-        jni_env, rasCls, mid, NSK_CPP_STUB2(NewStringUTF, jni_env, cls_sig));
+    classBytes = (jbyteArray) jni_env->CallStaticObjectMethod(rasCls, mid, jni_env->NewStringUTF(cls_sig));
 
     clearJavaException(jni_env);
 
-    (*_clsInfo).bCount = NSK_CPP_STUB2(GetArrayLength, jni_env, classBytes);
+    (*_clsInfo).bCount = jni_env->GetArrayLength(classBytes);
 
     (*_clsInfo).clsBytes =
-        NSK_CPP_STUB3(GetByteArrayElements, jni_env, classBytes, &isCopy);
+        jni_env->GetByteArrayElements(classBytes, &isCopy);
 
     _clsInfo->next = NULL;
 
@@ -647,17 +625,15 @@
 static void deallocClsInfo(JNIEnv *jni_env) {
     class_info *clsInfoCurr = clsInfoFst;
 
-    NSK_TRACE(NSK_CPP_STUB2(DeleteGlobalRef, jni_env, rasCls));
+    NSK_TRACE(jni_env->DeleteGlobalRef(rasCls));
 
     while(clsInfoCurr != NULL) {
         class_info *_clsInfo = clsInfoCurr;
 
-        if (!NSK_JVMTI_VERIFY(NSK_CPP_STUB2(Deallocate,
-                jvmti, (unsigned char*) clsInfoCurr->clazzsig)))
-            NSK_CPP_STUB2(FatalError, jni_env,
-                "JVMTIagent: failed to deallocate memory for clazzsig\n");
+        if (!NSK_JVMTI_VERIFY(jvmti->Deallocate((unsigned char*) clsInfoCurr->clazzsig)))
+            jni_env->FatalError("JVMTIagent: failed to deallocate memory for clazzsig\n");
 
-        NSK_TRACE(NSK_CPP_STUB2(DeleteGlobalRef, jni_env, clsInfoCurr->cls));
+        NSK_TRACE(jni_env->DeleteGlobalRef(clsInfoCurr->cls));
 
         clsInfoCurr = (class_info*) clsInfoCurr->next;
 
@@ -673,10 +649,8 @@
     class_info *clsInfoCurr = clsInfoFst;
 
     display(1, "\n#### JVMTIagent: findAndHotSwap: obtaining class signature of class to be hotswap ...\n");
-    if (!NSK_JVMTI_VERIFY(NSK_CPP_STUB4(GetClassSignature,
-            jvmti, clazz, &clazzsig, /*&generic*/NULL)))
-        NSK_CPP_STUB2(FatalError, jni_env,
-            "JVMTIagent: findAndHotSwap: failed to get class signature\n");
+    if (!NSK_JVMTI_VERIFY(jvmti->GetClassSignature(clazz, &clazzsig, /*&generic*/NULL)))
+        jni_env->FatalError("JVMTIagent: findAndHotSwap: failed to get class signature\n");
     else {
         display(1, "#### JVMTIagent: findAndHotSwap: ... class signature obtained: \"%s\"\n",
             clazzsig);
@@ -690,10 +664,8 @@
                     hotswap == HOTSWAP_EVERY_EXCEPTION_FOR_EVERY_CLASS) {
                 display(1, "\n#### JVMTIagent: findAndHotSwap: going to hotswap tested class \"%s\" during execution of class \"%s\" ...\n",
                     clsInfoCurr->clazzsig, clazzsig);
-                if (!NSK_JVMTI_VERIFY(NSK_CPP_STUB2(Deallocate,
-                        jvmti, (unsigned char*) clazzsig)))
-                    NSK_CPP_STUB2(FatalError, jni_env,
-                        "JVMTIagent: findAndHotSwap: failed to deallocate memory for clazzsig\n");
+                if (!NSK_JVMTI_VERIFY(jvmti->Deallocate((unsigned char*) clazzsig)))
+                    jni_env->FatalError("JVMTIagent: findAndHotSwap: failed to deallocate memory for clazzsig\n");
 
                 if (doHotSwap(jni_env, clsInfoCurr->cls,
                         clsInfoCurr->bCount, clsInfoCurr->clsBytes) != 0) {
@@ -706,10 +678,8 @@
                     display(0, "\n#### JVMTIagent: findAndHotSwap: tested class found \"%s\" ...\n",
                         clazzsig);
 
-                    if (!NSK_JVMTI_VERIFY(NSK_CPP_STUB2(Deallocate,
-                            jvmti, (unsigned char*) clazzsig)))
-                        NSK_CPP_STUB2(FatalError, jni_env,
-                            "JVMTIagent: findAndHotSwap: failed to deallocate memory for clazzsig\n");
+                    if (!NSK_JVMTI_VERIFY(jvmti->Deallocate((unsigned char*) clazzsig)))
+                        jni_env->FatalError("JVMTIagent: findAndHotSwap: failed to deallocate memory for clazzsig\n");
 
                     display(0, "\n#### JVMTIagent: findAndHotSwap: going to hotswap tested class \"%s\" ...\n",
                         clsInfoCurr->clazzsig);
@@ -741,11 +711,11 @@
     classDef.class_byte_count = bCount;
     classDef.class_bytes = (unsigned char*) classBytes;
 
-    display(0, "#### JVMTIagent: >>>>>>>> Invoke RedefineClasses():\n\
-<JVMTIagent>\tnew class byte count=%d\n",
-        classDef.class_byte_count);
-    if (!NSK_JVMTI_VERIFY(NSK_CPP_STUB3(RedefineClasses,
-            jvmti, 1, &classDef)))
+    display(0,
+            "#### JVMTIagent: >>>>>>>> Invoke RedefineClasses():\n"
+            "<JVMTIagent>\tnew class byte count=%d\n",
+            classDef.class_byte_count);
+    if (!NSK_JVMTI_VERIFY(NSK_CPP_STUB3(jvmti->RedefineClasses(1, &classDef)))
         return 1;
 
     display(0, "#### JVMTIagent: <<<<<<<< RedefineClasses() is successfully done ####\n");
@@ -765,8 +735,7 @@
 
             callbacks.SingleStep = &SingleStep;
 
-            if (!NSK_JVMTI_VERIFY(NSK_CPP_STUB4(SetEventNotificationMode,
-                    jvmti, JVMTI_ENABLE, JVMTI_EVENT_SINGLE_STEP, NULL)))
+            if (!NSK_JVMTI_VERIFY(jvmti->SetEventNotificationMode(JVMTI_ENABLE, JVMTI_EVENT_SINGLE_STEP, NULL)))
                 return JNI_ERR;
 
             stepEventSet = JNI_TRUE;
@@ -782,8 +751,7 @@
 
             callbacks.MethodEntry = &MethodEntry;
 
-            if (!NSK_JVMTI_VERIFY(NSK_CPP_STUB4(SetEventNotificationMode,
-                    jvmti, JVMTI_ENABLE, JVMTI_EVENT_METHOD_ENTRY, NULL)))
+            if (!NSK_JVMTI_VERIFY(jvmti->SetEventNotificationMode(JVMTI_ENABLE, JVMTI_EVENT_METHOD_ENTRY, NULL)))
                 return JNI_ERR;
 
             display(0, "#### JVMTIagent: ... setting MethodEntry events done\n");
@@ -793,8 +761,7 @@
 
             callbacks.MethodExit = &MethodExit;
 
-            if (!NSK_JVMTI_VERIFY(NSK_CPP_STUB4(SetEventNotificationMode,
-                    jvmti, JVMTI_ENABLE, JVMTI_EVENT_METHOD_EXIT, NULL)))
+            if (!NSK_JVMTI_VERIFY(jvmti->SetEventNotificationMode(JVMTI_ENABLE, JVMTI_EVENT_METHOD_EXIT, NULL)))
                 return JNI_ERR;
 
             display(0, "#### JVMTIagent: ... setting MethodExit events done\n");
@@ -810,8 +777,7 @@
 
             callbacks.ExceptionCatch = &ExceptionCatch;
 
-            if (!NSK_JVMTI_VERIFY(NSK_CPP_STUB4(SetEventNotificationMode,
-                    jvmti, JVMTI_ENABLE, JVMTI_EVENT_EXCEPTION_CATCH, NULL)))
+            if (!NSK_JVMTI_VERIFY(jvmti->SetEventNotificationMode(JVMTI_ENABLE, JVMTI_EVENT_EXCEPTION_CATCH, NULL)))
                 return JNI_ERR;
 
             excCatchEventSet = JNI_TRUE;
@@ -820,8 +786,7 @@
         }
     }
 
-    if (!NSK_JVMTI_VERIFY(NSK_CPP_STUB3(SetEventCallbacks,
-            jvmti, &callbacks, sizeof(callbacks))))
+    if (!NSK_JVMTI_VERIFY(jvmti->SetEventCallbacks(&callbacks, sizeof(callbacks))))
         return JNI_ERR;
     else
         return 0;
@@ -849,8 +814,7 @@
     caps.can_generate_native_method_bind_events = 1;
     caps.can_generate_object_free_events = 1;
     caps.can_generate_vm_object_alloc_events = 1;
-    if (!NSK_JVMTI_VERIFY(NSK_CPP_STUB2(AddCapabilities,
-            jvmti, &caps)))
+    if (!NSK_JVMTI_VERIFY(jvmti->AddCapabilities(&caps)))
         return JNI_ERR;
 
     /* Breakpoint events */
@@ -858,8 +822,7 @@
 
     callbacks.Breakpoint = &Breakpoint;
 
-    if (!NSK_JVMTI_VERIFY(NSK_CPP_STUB4(SetEventNotificationMode,
-            jvmti, JVMTI_ENABLE, JVMTI_EVENT_BREAKPOINT, NULL)))
+    if (!NSK_JVMTI_VERIFY(jvmti->SetEventNotificationMode(JVMTI_ENABLE, JVMTI_EVENT_BREAKPOINT, NULL)))
         return JNI_ERR;
     display(0, "#### JVMTIagent: ... setting Breakpoint events done\n");
 
@@ -868,8 +831,7 @@
 
     callbacks.ClassFileLoadHook = &ClassFileLoadHook;
 
-    if (!NSK_JVMTI_VERIFY(NSK_CPP_STUB4(SetEventNotificationMode,
-            jvmti, JVMTI_ENABLE, JVMTI_EVENT_CLASS_FILE_LOAD_HOOK, NULL)))
+    if (!NSK_JVMTI_VERIFY(jvmti->SetEventNotificationMode(JVMTI_ENABLE, JVMTI_EVENT_CLASS_FILE_LOAD_HOOK, NULL)))
         return JNI_ERR;
     display(0, "#### JVMTIagent: ... setting ClassFileLoadHook events done\n");
 
@@ -878,8 +840,7 @@
 
     callbacks.ClassLoad = &ClassLoad;
 
-    if (!NSK_JVMTI_VERIFY(NSK_CPP_STUB4(SetEventNotificationMode,
-            jvmti, JVMTI_ENABLE, JVMTI_EVENT_CLASS_LOAD, NULL)))
+    if (!NSK_JVMTI_VERIFY(jvmti->SetEventNotificationMode(JVMTI_ENABLE, JVMTI_EVENT_CLASS_LOAD, NULL)))
         return JNI_ERR;
     display(0, "#### JVMTIagent: ... setting ClassLoad events done\n");
 
@@ -888,8 +849,7 @@
 
     callbacks.ClassPrepare = &ClassPrepare;
 
-    if (!NSK_JVMTI_VERIFY(NSK_CPP_STUB4(SetEventNotificationMode,
-            jvmti, JVMTI_ENABLE, JVMTI_EVENT_CLASS_PREPARE, NULL)))
+    if (!NSK_JVMTI_VERIFY(jvmti->SetEventNotificationMode(JVMTI_ENABLE, JVMTI_EVENT_CLASS_PREPARE, NULL)))
         return JNI_ERR;
     display(0, "#### JVMTIagent: ... setting ClassPrepare events done\n");
 
@@ -898,8 +858,7 @@
 
     callbacks.CompiledMethodLoad = &CompiledMethodLoad;
 
-    if (!NSK_JVMTI_VERIFY(NSK_CPP_STUB4(SetEventNotificationMode,
-            jvmti, JVMTI_ENABLE, JVMTI_EVENT_COMPILED_METHOD_LOAD, NULL)))
+    if (!NSK_JVMTI_VERIFY(jvmti->SetEventNotificationMode(JVMTI_ENABLE, JVMTI_EVENT_COMPILED_METHOD_LOAD, NULL)))
         return JNI_ERR;
     display(0, "#### JVMTIagent: ... setting CompiledMethodLoad events done\n");
 
@@ -908,8 +867,7 @@
 
     callbacks.CompiledMethodUnload = &CompiledMethodUnload;
 
-    if (!NSK_JVMTI_VERIFY(NSK_CPP_STUB4(SetEventNotificationMode,
-            jvmti, JVMTI_ENABLE, JVMTI_EVENT_COMPILED_METHOD_UNLOAD, NULL)))
+    if (!NSK_JVMTI_VERIFY(jvmti->SetEventNotificationMode(JVMTI_ENABLE, JVMTI_EVENT_COMPILED_METHOD_UNLOAD, NULL)))
         return JNI_ERR;
     display(0, "#### JVMTIagent: ... setting CompiledMethodUnload events done\n");
 
@@ -918,8 +876,7 @@
 
     callbacks.DataDumpRequest = &DataDumpRequest;
 
-    if (!NSK_JVMTI_VERIFY(NSK_CPP_STUB4(SetEventNotificationMode,
-            jvmti, JVMTI_ENABLE, JVMTI_EVENT_DATA_DUMP_REQUEST, NULL)))
+    if (!NSK_JVMTI_VERIFY(jvmti->SetEventNotificationMode(JVMTI_ENABLE, JVMTI_EVENT_DATA_DUMP_REQUEST, NULL)))
         return JNI_ERR;
     display(0, "#### JVMTIagent: ... setting DataDumpRequest events done\n");
 
@@ -928,8 +885,7 @@
 
     callbacks.DynamicCodeGenerated = &DynamicCodeGenerated;
 
-    if (!NSK_JVMTI_VERIFY(NSK_CPP_STUB4(SetEventNotificationMode,
-            jvmti, JVMTI_ENABLE, JVMTI_EVENT_DYNAMIC_CODE_GENERATED, NULL)))
+    if (!NSK_JVMTI_VERIFY(jvmti->SetEventNotificationMode(JVMTI_ENABLE, JVMTI_EVENT_DYNAMIC_CODE_GENERATED, NULL)))
         return JNI_ERR;
     display(0, "#### JVMTIagent: ... setting DynamicCodeGenerated events done\n");
 
@@ -938,8 +894,7 @@
 
     callbacks.Exception = &Exception;
 
-    if (!NSK_JVMTI_VERIFY(NSK_CPP_STUB4(SetEventNotificationMode,
-            jvmti, JVMTI_ENABLE, JVMTI_EVENT_EXCEPTION, NULL)))
+    if (!NSK_JVMTI_VERIFY(jvmti->SetEventNotificationMode(JVMTI_ENABLE, JVMTI_EVENT_EXCEPTION, NULL)))
         return JNI_ERR;
     display(0, "#### JVMTIagent: ... setting Exception events done\n");
 
@@ -948,8 +903,7 @@
 
     callbacks.FieldAccess = &FieldAccess;
 
-    if (!NSK_JVMTI_VERIFY(NSK_CPP_STUB4(SetEventNotificationMode,
-            jvmti, JVMTI_ENABLE, JVMTI_EVENT_FIELD_ACCESS, NULL)))
+    if (!NSK_JVMTI_VERIFY(jvmti->SetEventNotificationMode(JVMTI_ENABLE, JVMTI_EVENT_FIELD_ACCESS, NULL)))
         return JNI_ERR;
     display(0, "#### JVMTIagent: ... setting FieldAccess events done\n");
 
@@ -958,8 +912,7 @@
 
     callbacks.FieldModification = &FieldModification;
 
-    if (!NSK_JVMTI_VERIFY(NSK_CPP_STUB4(SetEventNotificationMode,
-            jvmti, JVMTI_ENABLE, JVMTI_EVENT_FIELD_MODIFICATION, NULL)))
+    if (!NSK_JVMTI_VERIFY(jvmti->SetEventNotificationMode(JVMTI_ENABLE, JVMTI_EVENT_FIELD_MODIFICATION, NULL)))
         return JNI_ERR;
     display(0, "#### JVMTIagent: ... setting FieldModification events done\n");
 
@@ -968,8 +921,7 @@
 
     callbacks.FramePop = &FramePop;
 
-    if (!NSK_JVMTI_VERIFY(NSK_CPP_STUB4(SetEventNotificationMode,
-            jvmti, JVMTI_ENABLE, JVMTI_EVENT_FRAME_POP, NULL)))
+    if (!NSK_JVMTI_VERIFY(jvmti->SetEventNotificationMode(JVMTI_ENABLE, JVMTI_EVENT_FRAME_POP, NULL)))
         return JNI_ERR;
     display(0, "#### JVMTIagent: ... setting FramePop events done\n");
 
@@ -978,8 +930,7 @@
 
     callbacks.GarbageCollectionFinish = &GarbageCollectionFinish;
 
-    if (!NSK_JVMTI_VERIFY(NSK_CPP_STUB4(SetEventNotificationMode,
-            jvmti, JVMTI_ENABLE, JVMTI_EVENT_GARBAGE_COLLECTION_FINISH, NULL)))
+    if (!NSK_JVMTI_VERIFY(jvmti->SetEventNotificationMode(JVMTI_ENABLE, JVMTI_EVENT_GARBAGE_COLLECTION_FINISH, NULL)))
         return JNI_ERR;
     display(0, "#### JVMTIagent: ... setting GarbageCollectionFinish events done\n");
 
@@ -988,8 +939,7 @@
 
     callbacks.GarbageCollectionStart = &GarbageCollectionStart;
 
-    if (!NSK_JVMTI_VERIFY(NSK_CPP_STUB4(SetEventNotificationMode,
-            jvmti, JVMTI_ENABLE, JVMTI_EVENT_GARBAGE_COLLECTION_START, NULL)))
+    if (!NSK_JVMTI_VERIFY(jvmti->SetEventNotificationMode(JVMTI_ENABLE, JVMTI_EVENT_GARBAGE_COLLECTION_START, NULL)))
         return JNI_ERR;
     display(0, "#### JVMTIagent: ... setting GarbageCollectionStart events done\n");
 
@@ -998,8 +948,7 @@
 
     callbacks.MonitorContendedEnter = &MonitorContendedEnter;
 
-    if (!NSK_JVMTI_VERIFY(NSK_CPP_STUB4(SetEventNotificationMode,
-            jvmti, JVMTI_ENABLE, JVMTI_EVENT_MONITOR_CONTENDED_ENTER, NULL)))
+    if (!NSK_JVMTI_VERIFY(jvmti->SetEventNotificationMode(JVMTI_ENABLE, JVMTI_EVENT_MONITOR_CONTENDED_ENTER, NULL)))
         return JNI_ERR;
     display(0, "#### JVMTIagent: ... setting MonitorContendedEnter events done\n");
 
@@ -1008,8 +957,7 @@
 
     callbacks.MonitorContendedEntered = &MonitorContendedEntered;
 
-    if (!NSK_JVMTI_VERIFY(NSK_CPP_STUB4(SetEventNotificationMode,
-            jvmti, JVMTI_ENABLE, JVMTI_EVENT_MONITOR_CONTENDED_ENTERED, NULL)))
+    if (!NSK_JVMTI_VERIFY(jvmti->SetEventNotificationMode(JVMTI_ENABLE, JVMTI_EVENT_MONITOR_CONTENDED_ENTERED, NULL)))
         return JNI_ERR;
     display(0, "#### JVMTIagent: ... setting MonitorContendedEntered events done\n");
 
@@ -1018,8 +966,7 @@
 
     callbacks.MonitorWait = &MonitorWait;
 
-    if (!NSK_JVMTI_VERIFY(NSK_CPP_STUB4(SetEventNotificationMode,
-            jvmti, JVMTI_ENABLE, JVMTI_EVENT_MONITOR_WAIT, NULL)))
+    if (!NSK_JVMTI_VERIFY(jvmti->SetEventNotificationMode(JVMTI_ENABLE, JVMTI_EVENT_MONITOR_WAIT, NULL)))
         return JNI_ERR;
     display(0, "#### JVMTIagent: ... setting MonitorWait events done\n");
 
@@ -1028,8 +975,7 @@
 
     callbacks.MonitorWaited = &MonitorWaited;
 
-    if (!NSK_JVMTI_VERIFY(NSK_CPP_STUB4(SetEventNotificationMode,
-            jvmti, JVMTI_ENABLE, JVMTI_EVENT_MONITOR_WAITED, NULL)))
+    if (!NSK_JVMTI_VERIFY(jvmti->SetEventNotificationMode(JVMTI_ENABLE, JVMTI_EVENT_MONITOR_WAITED, NULL)))
         return JNI_ERR;
     display(0, "#### JVMTIagent: ... setting MonitorWaited events done\n");
 
@@ -1038,8 +984,7 @@
 
     callbacks.NativeMethodBind = &NativeMethodBind;
 
-    if (!NSK_JVMTI_VERIFY(NSK_CPP_STUB4(SetEventNotificationMode,
-            jvmti, JVMTI_ENABLE, JVMTI_EVENT_NATIVE_METHOD_BIND, NULL)))
+    if (!NSK_JVMTI_VERIFY(jvmti->SetEventNotificationMode(JVMTI_ENABLE, JVMTI_EVENT_NATIVE_METHOD_BIND, NULL)))
         return JNI_ERR;
     display(0, "#### JVMTIagent: ... setting NativeMethodBind events done\n");
 
@@ -1048,8 +993,7 @@
 
     callbacks.ObjectFree = &ObjectFree;
 
-    if (!NSK_JVMTI_VERIFY(NSK_CPP_STUB4(SetEventNotificationMode,
-            jvmti, JVMTI_ENABLE, JVMTI_EVENT_OBJECT_FREE, NULL)))
+    if (!NSK_JVMTI_VERIFY(jvmti->SetEventNotificationMode(JVMTI_ENABLE, JVMTI_EVENT_OBJECT_FREE, NULL)))
         return JNI_ERR;
     display(0, "#### JVMTIagent: ... setting ObjectFree events done\n");
 
@@ -1058,8 +1002,7 @@
 
     callbacks.ThreadEnd = &ThreadEnd;
 
-    if (!NSK_JVMTI_VERIFY(NSK_CPP_STUB4(SetEventNotificationMode,
-            jvmti, JVMTI_ENABLE, JVMTI_EVENT_THREAD_END, NULL)))
+    if (!NSK_JVMTI_VERIFY(jvmti->SetEventNotificationMode(JVMTI_ENABLE, JVMTI_EVENT_THREAD_END, NULL)))
         return JNI_ERR;
     display(0, "#### JVMTIagent: ... setting ThreadEnd events done\n");
 
@@ -1068,8 +1011,7 @@
 
     callbacks.ThreadStart = &ThreadStart;
 
-    if (!NSK_JVMTI_VERIFY(NSK_CPP_STUB4(SetEventNotificationMode,
-            jvmti, JVMTI_ENABLE, JVMTI_EVENT_THREAD_START, NULL)))
+    if (!NSK_JVMTI_VERIFY(jvmti->SetEventNotificationMode(JVMTI_ENABLE, JVMTI_EVENT_THREAD_START, NULL)))
         return JNI_ERR;
     display(0, "#### JVMTIagent: ... setting ThreadStart events done\n");
 
@@ -1078,8 +1020,7 @@
 
     callbacks.VMDeath = &VMDeath;
 
-    if (!NSK_JVMTI_VERIFY(NSK_CPP_STUB4(SetEventNotificationMode,
-            jvmti, JVMTI_ENABLE, JVMTI_EVENT_VM_DEATH, NULL)))
+    if (!NSK_JVMTI_VERIFY(jvmti->SetEventNotificationMode(JVMTI_ENABLE, JVMTI_EVENT_VM_DEATH, NULL)))
         return JNI_ERR;
     display(0, "#### JVMTIagent: ... setting VMDeath events done\n");
 
@@ -1088,8 +1029,7 @@
 
     callbacks.VMInit = &VMInit;
 
-    if (!NSK_JVMTI_VERIFY(NSK_CPP_STUB4(SetEventNotificationMode,
-            jvmti, JVMTI_ENABLE, JVMTI_EVENT_VM_INIT, NULL)))
+    if (!NSK_JVMTI_VERIFY(jvmti->SetEventNotificationMode(JVMTI_ENABLE, JVMTI_EVENT_VM_INIT, NULL)))
         return JNI_ERR;
     display(0, "#### JVMTIagent: ... setting VMInit events done\n");
 
@@ -1098,8 +1038,7 @@
 
     callbacks.VMStart = &VMStart;
 
-    if (!NSK_JVMTI_VERIFY(NSK_CPP_STUB4(SetEventNotificationMode,
-            jvmti, JVMTI_ENABLE, JVMTI_EVENT_VM_START, NULL)))
+    if (!NSK_JVMTI_VERIFY(jvmti->SetEventNotificationMode(JVMTI_ENABLE, JVMTI_EVENT_VM_START, NULL)))
         return JNI_ERR;
     display(0, "#### JVMTIagent: ... setting VMStart events done\n");
 
@@ -1108,26 +1047,23 @@
 
     callbacks.VMObjectAlloc = &VMObjectAlloc;
 
-    if (!NSK_JVMTI_VERIFY(NSK_CPP_STUB4(SetEventNotificationMode,
-            jvmti, JVMTI_ENABLE, JVMTI_EVENT_VM_OBJECT_ALLOC, NULL)))
+    if (!NSK_JVMTI_VERIFY(jvmti->SetEventNotificationMode(JVMTI_ENABLE, JVMTI_EVENT_VM_OBJECT_ALLOC, NULL)))
         return JNI_ERR;
     display(0, "#### JVMTIagent: ... setting VMObjectAlloc events done\n");
 
-    if (!NSK_JVMTI_VERIFY(NSK_CPP_STUB3(SetEventCallbacks,
-            jvmti, &callbacks, sizeof(callbacks))))
+    if (!NSK_JVMTI_VERIFY(jvmti->SetEventCallbacks(&callbacks, sizeof(callbacks))))
         return JNI_ERR;
 
     return 0;
 }
 
 static void clearJavaException(JNIEnv* jni_env) {
-    if (NSK_CPP_STUB1(ExceptionOccurred, jni_env)) {
+    if (jni_env->ExceptionOccurred()) {
 
-        NSK_CPP_STUB1(ExceptionDescribe, jni_env);
-        NSK_CPP_STUB1(ExceptionClear, jni_env);
+        jni_env->ExceptionDescribe();
+        jni_env->ExceptionClear();
 
-        NSK_CPP_STUB2(FatalError, jni_env,
-            "JVMTIagent: exception occurred in java code, aborting\n");
+        jni_env->FatalError("JVMTIagent: exception occurred in java code, aborting\n");
     }
 }
 
@@ -1222,7 +1158,7 @@
             exit(97);
         }
         else
-            NSK_CPP_STUB2(FatalError, jni_env, error_msg);
+            jni_env->FatalError(error_msg);
     }
 }
 
@@ -1250,8 +1186,7 @@
 
     doSetup(options);
 
-    if (!NSK_JVMTI_VERIFY(NSK_CPP_STUB3(CreateRawMonitor,
-            jvmti, "_event_lock", &eventLock)))
+    if (!NSK_JVMTI_VERIFY(jvmti->CreateRawMonitor("_event_lock", &eventLock)))
         return JNI_ERR;
 
     if (enableEventsCaps() == 0 && addStressEvents() == 0) {
--- a/test/hotspot/jtreg/vmTestbase/nsk/share/aod/aod.cpp	Wed Oct 03 15:54:35 2018 +0200
+++ b/test/hotspot/jtreg/vmTestbase/nsk/share/aod/aod.cpp	Wed Oct 03 16:02:24 2018 +0200
@@ -205,28 +205,27 @@
          */
         jclass localTargetAppClass;
         if (!NSK_JNI_VERIFY(jni, (localTargetAppClass =
-            NSK_CPP_STUB2(FindClass, jni, TARGET_APP_CLASS_NAME)) != NULL)) {
+            jni->FindClass(TARGET_APP_CLASS_NAME)) != NULL)) {
             return NSK_FALSE;
         }
 
         if (!NSK_JNI_VERIFY(jni, (targetAppClass = (jclass)
-            NSK_CPP_STUB2(NewGlobalRef, jni, localTargetAppClass)) != NULL)) {
+            jni->NewGlobalRef(localTargetAppClass)) != NULL)) {
             return NSK_FALSE;
         }
     }
 
     if (agentLoadedMethod == NULL) {
         if (!NSK_JNI_VERIFY(jni, (agentLoadedMethod =
-            NSK_CPP_STUB4(GetStaticMethodID, jni, targetAppClass,
-                    AGENT_LOADED_METHOD_NAME, AGENT_LOADED_METHOD_SIGNATURE)) != NULL))
+            jni->GetStaticMethodID(targetAppClass, AGENT_LOADED_METHOD_NAME, AGENT_LOADED_METHOD_SIGNATURE)) != NULL))
             return NSK_FALSE;
     }
 
     if (!NSK_JNI_VERIFY(jni, (agentNameString =
-        NSK_CPP_STUB2(NewStringUTF, jni, agentName)) != NULL))
+        jni->NewStringUTF(agentName)) != NULL))
         return NSK_FALSE;
 
-    NSK_CPP_STUB4(CallStaticVoidMethod, jni, targetAppClass, agentLoadedMethod, agentNameString);
+    jni->CallStaticVoidMethod(targetAppClass, agentLoadedMethod, agentNameString);
 
     return NSK_TRUE;
 }
@@ -236,32 +235,33 @@
     jstring agentNameString;
 
     if (!targetAppClass) {
-        NSK_COMPLAIN1("%s: TEST LOGIC ERROR: method 'agentFinished' was called before "\
-                "targetAppClass was initialized\n", agentName);
+        NSK_COMPLAIN1(
+            "%s: TEST LOGIC ERROR: method 'agentFinished' was called before "
+            "targetAppClass was initialized\n",
+            agentName);
         return NSK_FALSE;
     }
 
     if (internalError && success) {
         success = 0;
-        NSK_COMPLAIN1("Status of agent '%s' is 'passed', but some error happened during test execution "\
-                "(see log for details), change agent status to 'failed'\n",
-                agentName);
+        NSK_COMPLAIN1(
+            "Status of agent '%s' is 'passed', but some error happened during test execution "
+            "(see log for details), change agent status to 'failed'\n",
+            agentName);
     }
 
     NSK_DISPLAY2("Agent %s finished (success: %d)\n", agentName, success);
 
     if (agentFinishedMethod == NULL) {
         if (!NSK_JNI_VERIFY(jni, (agentFinishedMethod =
-            NSK_CPP_STUB4(GetStaticMethodID, jni, targetAppClass,
-                    AGENT_FINISHED_METHOD_NAME, AGENT_FINISHED_METHOD_SIGNATURE)) != NULL))
+            jni->GetStaticMethodID(targetAppClass, AGENT_FINISHED_METHOD_NAME, AGENT_FINISHED_METHOD_SIGNATURE)) != NULL))
             return NSK_FALSE;
     }
 
-    if (!NSK_JNI_VERIFY(jni, (agentNameString = NSK_CPP_STUB2(NewStringUTF, jni, agentName)) != NULL))
+    if (!NSK_JNI_VERIFY(jni, (agentNameString = jni->NewStringUTF(agentName)) != NULL))
         return NSK_FALSE;
 
-    NSK_CPP_STUB5(CallStaticVoidMethod, jni, targetAppClass,
-            agentFinishedMethod, agentNameString, success ? JNI_TRUE : JNI_FALSE);
+    jni->CallStaticVoidMethod(targetAppClass, agentFinishedMethod, agentNameString, success ? JNI_TRUE : JNI_FALSE);
 
     return NSK_TRUE;
 }
@@ -274,7 +274,7 @@
 
 JNIEnv* nsk_aod_createJNIEnv(JavaVM* vm) {
     JNIEnv* jni;
-    NSK_CPP_STUB3(GetEnv, vm, (void**)&jni, JNI_VERSION_1_2);
+    vm->GetEnv((void**)&jni, JNI_VERSION_1_2);
 
     NSK_VERIFY(jni != NULL);
 
--- a/test/hotspot/jtreg/vmTestbase/nsk/share/jni/README	Wed Oct 03 15:54:35 2018 +0200
+++ b/test/hotspot/jtreg/vmTestbase/nsk/share/jni/README	Wed Oct 03 16:02:24 2018 +0200
@@ -46,7 +46,7 @@
 
     // jni->FindClass(jni, class_name)
     if (!NSK_JNI_VERIFY(jni,
-            NSK_CPP_STUB2(FindClass, jni, class_name) != NULL)) {
+            jni->FindClass(class_name) != NULL)) {
         return JNI_ERR;
     }
 
@@ -54,7 +54,7 @@
 
     // cls = jni->FindClass(jni, class_name)
     if (!NSK_JNI_VERIFY(jni, (cls =
-            NSK_CPP_STUB2(FindClass, jni, class_name)) != NULL)) {
+            jni->FindClass(class_name)) != NULL)) {
         return JNI_ERR;
     }
 
--- a/test/hotspot/jtreg/vmTestbase/nsk/share/jni/jni_tools.cpp	Wed Oct 03 15:54:35 2018 +0200
+++ b/test/hotspot/jtreg/vmTestbase/nsk/share/jni/jni_tools.cpp	Wed Oct 03 16:02:24 2018 +0200
@@ -53,11 +53,11 @@
 {
     jthrowable throwable;
 
-    NSK_TRACE(throwable = NSK_CPP_STUB1(ExceptionOccurred, jni));
+    NSK_TRACE(throwable = jni->ExceptionOccurred());
     if (throwable != NULL) {
         nsk_lcomplain(file, line, "Exception in JNI call (cleared):\n");
-        NSK_TRACE(NSK_CPP_STUB1(ExceptionDescribe, jni));
-        NSK_TRACE(NSK_CPP_STUB1(ExceptionClear, jni));
+        NSK_TRACE(jni->ExceptionDescribe());
+        NSK_TRACE(jni->ExceptionClear());
         return NSK_TRUE;
     }
     return NSK_FALSE;
--- a/test/hotspot/jtreg/vmTestbase/nsk/share/native/README	Wed Oct 03 15:54:35 2018 +0200
+++ b/test/hotspot/jtreg/vmTestbase/nsk/share/native/README	Wed Oct 03 16:02:24 2018 +0200
@@ -94,7 +94,7 @@
 
     // jvm->GetEnv(jvm, &env, version)
     if (!NSK_VERIFY(
-            NSK_CPP_STUB3(GetEnv, jvm, &env, JNI_VERSION_1_2) == JNI_OK)) {
+            jvm->GetEnv(&env, JNI_VERSION_1_2) == JNI_OK)) {
         return JNI_ERR;
     }
 
--- a/test/hotspot/jtreg/vmTestbase/nsk/stress/strace/nsk_strace.h	Wed Oct 03 15:54:35 2018 +0200
+++ b/test/hotspot/jtreg/vmTestbase/nsk/stress/strace/nsk_strace.h	Wed Oct 03 16:02:24 2018 +0200
@@ -29,16 +29,15 @@
 
 #define JNI_VERSION JNI_VERSION_1_1
 
-#define EXCEPTION_CLEAR NSK_CPP_STUB1(ExceptionClear, env)
-#define EXCEPTION_OCCURRED NSK_CPP_STUB1(ExceptionOccurred, env)
+#define EXCEPTION_CLEAR env->ExceptionClear()
+#define EXCEPTION_OCCURRED env->ExceptionOccurred()
 
 // Check for pending exception of the specified type
 // If it's present, then clear it
 #define EXCEPTION_CHECK(exceptionClass, recurDepth) \
         if (EXCEPTION_OCCURRED != NULL) { \
             jobject exception = EXCEPTION_OCCURRED; \
-            if (NSK_CPP_STUB3(IsInstanceOf, env, exception, \
-                        exceptionClass) == JNI_TRUE) { \
+            if (env->IsInstanceOf(exception, exceptionClass) == JNI_TRUE) { \
                 EXCEPTION_CLEAR; \
                 NSK_DISPLAY1("StackOverflowError occurred at depth %d\n", recurDepth); \
             } \
@@ -46,95 +45,86 @@
 
 #define FIND_CLASS(_class, _className)\
     if (!NSK_JNI_VERIFY(env, (_class = \
-            NSK_CPP_STUB2(FindClass, env, _className)) != NULL))\
+            env->FindClass(_className)) != NULL))\
         exit(1)
 
 #define GET_OBJECT_CLASS(_class, _obj)\
     if (!NSK_JNI_VERIFY(env, (_class = \
-            NSK_CPP_STUB2(GetObjectClass, env, _obj)) != NULL))\
+            env->GetObjectClass(_obj)) != NULL))\
         exit(1)
 
 #define GET_FIELD_ID(_fieldID, _class, _fieldName, _fieldSig)\
     if (!NSK_JNI_VERIFY(env, (_fieldID = \
-            NSK_CPP_STUB4(GetFieldID, env, _class,\
-                _fieldName, _fieldSig)) != NULL))\
+            env->GetFieldID(_class, _fieldName, _fieldSig)) != NULL))\
         exit(1)
 
 #define GET_STATIC_FIELD_ID(_fieldID, _class, _fieldName, _fieldSig)\
     if (!NSK_JNI_VERIFY(env, (_fieldID = \
-            NSK_CPP_STUB4(GetStaticFieldID, env, _class,\
-                _fieldName, _fieldSig)) != NULL))\
+            env->GetStaticFieldID(_class, _fieldName, _fieldSig)) != NULL))\
         exit(1)
 
 #define GET_STATIC_BOOL_FIELD(_value, _class, _fieldName)\
     GET_STATIC_FIELD_ID(field, _class, _fieldName, "Z");\
-    _value = NSK_CPP_STUB3(GetStaticBooleanField, env, _class, field)
+    _value = env->GetStaticBooleanField(_class, field)
 
 #define GET_STATIC_INT_FIELD(_value, _class, _fieldName)\
     GET_STATIC_FIELD_ID(field, _class, _fieldName, "I");\
-    _value = NSK_CPP_STUB3(GetStaticIntField, env, _class, field)
+    _value = env->GetStaticIntField(_class, field)
 
 #define GET_STATIC_OBJ_FIELD(_value, _class, _fieldName, _fieldSig)\
     GET_STATIC_FIELD_ID(field, _class, _fieldName, _fieldSig);\
-    _value = NSK_CPP_STUB3(GetStaticObjectField, env, _class, \
-                                field)
+    _value = env->GetStaticObjectField(_class, field)
 
 #define GET_INT_FIELD(_value, _obj, _class, _fieldName)\
     GET_FIELD_ID(field, _class, _fieldName, "I");\
-    _value = NSK_CPP_STUB3(GetIntField, env, _obj, field)
+    _value = env->GetIntField(_obj, field)
 
 #define SET_INT_FIELD(_obj, _class, _fieldName, _newValue)\
     GET_FIELD_ID(field, _class, _fieldName, "I");\
-    NSK_CPP_STUB4(SetIntField, env, _obj, field, _newValue)
+    env->SetIntField(_obj, field, _newValue)
 
 #define SET_STATIC_INT_FIELD(_class, _fieldName, _newValue)\
     GET_STATIC_FIELD_ID(field, _class, _fieldName, "I");\
-    NSK_CPP_STUB4(SetStaticIntField, env, _class, field, _newValue)
+    env->SetStaticIntField(_class, field, _newValue)
 
 #define GET_OBJ_FIELD(_value, _obj, _class, _fieldName, _fieldSig)\
     GET_FIELD_ID(field, _class, _fieldName, _fieldSig);\
-    _value = NSK_CPP_STUB3(GetObjectField, env, _obj, field)
+    _value = env->GetObjectField(_obj, field)
 
 #define GET_STATIC_METHOD_ID(_methodID, _class, _methodName, _sig)\
     if (!NSK_JNI_VERIFY(env, (_methodID = \
-            NSK_CPP_STUB4(GetStaticMethodID, env, _class,\
-                _methodName, _sig)) != NULL))\
+            env->GetStaticMethodID(_class, _methodName, _sig)) != NULL))\
         exit(1)
 
 #define GET_METHOD_ID(_methodID, _class, _methodName, _sig)\
     if (!NSK_JNI_VERIFY(env, (_methodID = \
-            NSK_CPP_STUB4(GetMethodID, env, _class,\
-                _methodName, _sig)) != NULL))\
+            env->GetMethodID(_class, _methodName, _sig)) != NULL))\
         exit(1)
 
 #define CALL_STATIC_VOID_NOPARAM(_class, _methodName)\
     GET_STATIC_METHOD_ID(method, _class, _methodName, "()V");\
-    if (!NSK_JNI_VERIFY_VOID(env, NSK_CPP_STUB3(CallStaticVoidMethod, env,\
-                            _class, method)))\
+    if (!NSK_JNI_VERIFY_VOID(env, env->CallStaticVoidMethod(_class, method)))\
         exit(1)
 
 #define CALL_STATIC_VOID(_class, _methodName, _sig, _param)\
     GET_STATIC_METHOD_ID(method, _class, _methodName, _sig);\
-    if (!NSK_JNI_VERIFY_VOID(env, NSK_CPP_STUB4(CallStaticVoidMethod, env,\
-                                                    _class, method, _param)))\
+    if (!NSK_JNI_VERIFY_VOID(env, env->CallStaticVoidMethod(_class, method, _param)))\
         exit(1)
 
 #define CALL_VOID_NOPARAM(_obj, _class, _methodName)\
     GET_METHOD_ID(method, _class, _methodName, "()V");\
-    if (!NSK_JNI_VERIFY_VOID(env, NSK_CPP_STUB3(CallVoidMethod, env, _obj,\
-                                                    method)))\
+    if (!NSK_JNI_VERIFY_VOID(env, env->CallVoidMethod(_obj, method)))\
         exit(1)
 
 #define CALL_VOID(_obj, _class, _methodName, _sig, _param)\
     GET_METHOD_ID(method, _class, _methodName, _sig);\
-    if (!NSK_JNI_VERIFY_VOID(env, NSK_CPP_STUB4(CallVoidMethod, env, _obj,\
-                                                    method, _param)))\
+    if (!NSK_JNI_VERIFY_VOID(env, env->CallVoidMethod(_obj, method, _param)))\
         exit(1)
 
 #define MONITOR_ENTER(x) \
-    NSK_JNI_VERIFY(env, NSK_CPP_STUB2(MonitorEnter, env, x) == 0)
+    NSK_JNI_VERIFY(env, env->MonitorEnter(x) == 0)
 
 #define MONITOR_EXIT(x) \
-    NSK_JNI_VERIFY(env, NSK_CPP_STUB2(MonitorExit, env, x) == 0)
+    NSK_JNI_VERIFY(env, env->MonitorExit(x) == 0)
 
 #endif /* _IS_NSK_STRACE_DEFINED_ */
--- a/test/hotspot/jtreg/vmTestbase/nsk/stress/strace/strace005.cpp	Wed Oct 03 15:54:35 2018 +0200
+++ b/test/hotspot/jtreg/vmTestbase/nsk/stress/strace/strace005.cpp	Wed Oct 03 16:02:24 2018 +0200
@@ -87,11 +87,11 @@
     if (maxDepth - currDepth > 0)
     {
         GET_STATIC_METHOD_ID(method, threadClass, "yield", "()V");
-        NSK_CPP_STUB3(CallStaticVoidMethod, env, threadClass, method);
+        env->CallStaticVoidMethod(threadClass, method);
         EXCEPTION_CHECK(stackOverflowErrorClass, currDepth);
 
         GET_METHOD_ID(method, threadClass, "recursiveMethod1", "()V");
-        NSK_CPP_STUB3(CallVoidMethod, env, obj, method);
+        env->CallVoidMethod(obj, method);
         EXCEPTION_CHECK(stackOverflowErrorClass, currDepth);
     }
 
--- a/test/hotspot/jtreg/vmTestbase/nsk/stress/strace/strace006.cpp	Wed Oct 03 15:54:35 2018 +0200
+++ b/test/hotspot/jtreg/vmTestbase/nsk/stress/strace/strace006.cpp	Wed Oct 03 16:02:24 2018 +0200
@@ -88,11 +88,11 @@
     if (maxDepth - currDepth > 0)
     {
         GET_STATIC_METHOD_ID(method, threadClass, "yield", "()V");
-        NSK_CPP_STUB3(CallStaticVoidMethod, env, threadClass, method);
+        env->CallStaticVoidMethod(threadClass, method);
         EXCEPTION_CHECK(stackOverflowErrorClass, currDepth);
 
         GET_METHOD_ID(method, threadClass, "recursiveMethod1", "()V");
-        NSK_CPP_STUB3(CallVoidMethod, env, obj, method);
+        env->CallVoidMethod(obj, method);
         EXCEPTION_CHECK(stackOverflowErrorClass, currDepth);
     }
 
--- a/test/hotspot/jtreg/vmTestbase/vm/mlvm/meth/stress/jni/nativeAndMH/nativeAndMH.cpp	Wed Oct 03 15:54:35 2018 +0200
+++ b/test/hotspot/jtreg/vmTestbase/vm/mlvm/meth/stress/jni/nativeAndMH/nativeAndMH.cpp	Wed Oct 03 16:02:24 2018 +0200
@@ -48,27 +48,25 @@
     jobjectArray arguments;
     jobject result;
 
-    if ( ! NSK_JNI_VERIFY(pEnv, (mhClass = NSK_CPP_STUB2(GetObjectClass, pEnv, mhToCall)) != NULL) )
+    if ( ! NSK_JNI_VERIFY(pEnv, (mhClass = pEnv->GetObjectClass(mhToCall)) != NULL) )
         return NULL;
 
-    if ( ! NSK_JNI_VERIFY(pEnv, NULL != (mid = NSK_CPP_STUB4(GetMethodID, pEnv, mhClass,
-            "invokeWithArguments",
-            "([Ljava/lang/Object;)Ljava/lang/Object;"))) )
+    if ( ! NSK_JNI_VERIFY(pEnv, NULL != (mid = pEnv->GetMethodID(mhClass, "invokeWithArguments", "([Ljava/lang/Object;)Ljava/lang/Object;"))) )
         return NULL;
 
-    NSK_JNI_VERIFY(pEnv, NULL != (objectClass = NSK_CPP_STUB2(FindClass, pEnv, "java/lang/Object")));
+    NSK_JNI_VERIFY(pEnv, NULL != (objectClass = pEnv->FindClass("java/lang/Object")));
 
-    NSK_JNI_VERIFY(pEnv, NULL != (arguments = NSK_CPP_STUB4(NewObjectArray, pEnv, ARGS_COUNT, objectClass, NULL)));
+    NSK_JNI_VERIFY(pEnv, NULL != (arguments = pEnv->NewObjectArray(ARGS_COUNT, objectClass, NULL)));
 
-    NSK_JNI_VERIFY_VOID(pEnv, NSK_CPP_STUB4(SetObjectArrayElement, pEnv, arguments, 0, a1));
-    NSK_JNI_VERIFY_VOID(pEnv, NSK_CPP_STUB4(SetObjectArrayElement, pEnv, arguments, 1, a2));
-    NSK_JNI_VERIFY_VOID(pEnv, NSK_CPP_STUB4(SetObjectArrayElement, pEnv, arguments, 2, a3));
-    NSK_JNI_VERIFY_VOID(pEnv, NSK_CPP_STUB4(SetObjectArrayElement, pEnv, arguments, 3, a4));
-    NSK_JNI_VERIFY_VOID(pEnv, NSK_CPP_STUB4(SetObjectArrayElement, pEnv, arguments, 4, a5));
-    NSK_JNI_VERIFY_VOID(pEnv, NSK_CPP_STUB4(SetObjectArrayElement, pEnv, arguments, 5, a6));
+    NSK_JNI_VERIFY_VOID(pEnv, pEnv->SetObjectArrayElement(arguments, 0, a1));
+    NSK_JNI_VERIFY_VOID(pEnv, pEnv->SetObjectArrayElement(arguments, 1, a2));
+    NSK_JNI_VERIFY_VOID(pEnv, pEnv->SetObjectArrayElement(arguments, 2, a3));
+    NSK_JNI_VERIFY_VOID(pEnv, pEnv->SetObjectArrayElement(arguments, 3, a4));
+    NSK_JNI_VERIFY_VOID(pEnv, pEnv->SetObjectArrayElement(arguments, 4, a5));
+    NSK_JNI_VERIFY_VOID(pEnv, pEnv->SetObjectArrayElement(arguments, 5, a6));
 
     // Swap arguments
-    NSK_JNI_VERIFY(pEnv, NULL != (result = NSK_CPP_STUB4(CallObjectMethod, pEnv, mhToCall, mid, arguments)));
+    NSK_JNI_VERIFY(pEnv, NULL != (result = pEnv->CallObjectMethod(mhToCall, mid, arguments)));
     return result;
 }
 
--- a/test/hotspot/jtreg/vmTestbase/vm/mlvm/share/mlvmJvmtiUtils.cpp	Wed Oct 03 15:54:35 2018 +0200
+++ b/test/hotspot/jtreg/vmTestbase/vm/mlvm/share/mlvmJvmtiUtils.cpp	Wed Oct 03 16:02:24 2018 +0200
@@ -36,15 +36,15 @@
     const char * pStr;
         jsize len;
 
-    if ( ! NSK_VERIFY((pStr = NSK_CPP_STUB3(GetStringUTFChars, pEnv, src, NULL)) != NULL) ) {
+    if ( ! NSK_VERIFY((pStr = pEnv->GetStringUTFChars(src, NULL)) != NULL) ) {
         return;
     }
 
-    len = NSK_CPP_STUB2(GetStringUTFLength, pEnv, src) + 1;
+    len = pEnv->GetStringUTFLength(src) + 1;
     *dst = (char*) malloc(len);
     strncpy(*dst, pStr, len);
 
-    NSK_CPP_STUB3(ReleaseStringUTFChars, pEnv, src, pStr);
+    pEnv->ReleaseStringUTFChars(src, pStr);
 }
 
 struct MethodName * getMethodName(jvmtiEnv * pJvmtiEnv, jmethodID method) {
@@ -53,17 +53,17 @@
     jclass clazz;
     struct MethodName * mn;
 
-    if ( ! NSK_JVMTI_VERIFY(NSK_CPP_STUB5(GetMethodName, pJvmtiEnv, method, &szName, NULL, NULL)) ) {
+    if ( ! NSK_JVMTI_VERIFY(pJvmtiEnv->GetMethodName(method, &szName, NULL, NULL)) ) {
         return NULL;
     }
 
-    if ( ! NSK_JVMTI_VERIFY(NSK_CPP_STUB3(GetMethodDeclaringClass, pJvmtiEnv, method, &clazz)) ) {
-        NSK_JVMTI_VERIFY(NSK_CPP_STUB2(Deallocate, pJvmtiEnv, (unsigned char*) szName));
+    if ( ! NSK_JVMTI_VERIFY(pJvmtiEnv->GetMethodDeclaringClass(method, &clazz)) ) {
+        NSK_JVMTI_VERIFY(pJvmtiEnv->Deallocate((unsigned char*) szName));
         return NULL;
     }
 
-    if ( ! NSK_JVMTI_VERIFY(NSK_CPP_STUB4(GetClassSignature, pJvmtiEnv, clazz, &szSignature, NULL)) ) {
-        NSK_JVMTI_VERIFY(NSK_CPP_STUB2(Deallocate, pJvmtiEnv, (unsigned char*) szName));
+    if ( ! NSK_JVMTI_VERIFY(pJvmtiEnv->GetClassSignature(clazz, &szSignature, NULL)) ) {
+        NSK_JVMTI_VERIFY(pJvmtiEnv->Deallocate((unsigned char*) szName));
         return NULL;
     }
 
@@ -71,8 +71,8 @@
     strncpy(mn->methodName, szName, sizeof(mn->methodName));
     strncpy(mn->classSig, szSignature, sizeof(mn->classSig));
 
-    NSK_JVMTI_VERIFY(NSK_CPP_STUB2(Deallocate, pJvmtiEnv, (unsigned char*) szName));
-    NSK_JVMTI_VERIFY(NSK_CPP_STUB2(Deallocate, pJvmtiEnv, (unsigned char*) szSignature));
+    NSK_JVMTI_VERIFY(pJvmtiEnv->Deallocate((unsigned char*) szName));
+    NSK_JVMTI_VERIFY(pJvmtiEnv->Deallocate((unsigned char*) szSignature));
     return mn;
 }
 
@@ -107,7 +107,7 @@
 
 void * getTLS(jvmtiEnv * pJvmtiEnv, jthread thread, jsize sizeToAllocate) {
     void * tls;
-    if ( ! NSK_JVMTI_VERIFY(NSK_CPP_STUB3(GetThreadLocalStorage, pJvmtiEnv, thread, &tls)) )
+    if ( ! NSK_JVMTI_VERIFY(pJvmtiEnv->GetThreadLocalStorage(thread, &tls)) )
         return NULL;
 
     if ( ! tls) {
@@ -116,7 +116,7 @@
 
         memset(tls, 0, sizeToAllocate);
 
-        if ( ! NSK_JVMTI_VERIFY(NSK_CPP_STUB3(SetThreadLocalStorage, pJvmtiEnv, thread, tls)) )
+        if ( ! NSK_JVMTI_VERIFY(pJvmtiEnv->SetThreadLocalStorage(thread, tls)) )
             return NULL;
     }
 
--- a/test/hotspot/jtreg/vmTestbase/vm/runtime/defmeth/shared/redefineClasses.cpp	Wed Oct 03 15:54:35 2018 +0200
+++ b/test/hotspot/jtreg/vmTestbase/vm/runtime/defmeth/shared/redefineClasses.cpp	Wed Oct 03 16:02:24 2018 +0200
@@ -56,23 +56,23 @@
 
     classDef.klass = clazzToRedefine;
     if (!NSK_JNI_VERIFY(env,
-            (classDef.class_byte_count = /* jsize */ NSK_CPP_STUB2(GetArrayLength, env, bytecodeArray)) > 0)) {
+            (classDef.class_byte_count = /* jsize */ env->GetArrayLength(bytecodeArray)) > 0)) {
         return JNI_FALSE;
     }
 
     if (!NSK_JNI_VERIFY(env,
-            (classDef.class_bytes = (const unsigned char *) /* jbyte* */ NSK_CPP_STUB3(GetByteArrayElements, env, bytecodeArray, NULL)) != NULL)) {
+            (classDef.class_bytes = (const unsigned char *) /* jbyte* */ env->GetByteArrayElements(bytecodeArray, NULL)) != NULL)) {
         return JNI_FALSE;
     }
 
     if (!NSK_JVMTI_VERIFY(
-            NSK_CPP_STUB3(RedefineClasses, test_jvmti, 1, &classDef))) {
+            test_jvmti->RedefineClasses(1, &classDef))) {
         result = JNI_FALSE;
     }
 
     // Need to cleanup reference to byte[] whether RedefineClasses succeeded or not
     if (!NSK_JNI_VERIFY_VOID(env,
-            NSK_CPP_STUB4(ReleaseByteArrayElements, env, bytecodeArray, (jbyte*)classDef.class_bytes, JNI_ABORT))) {
+            env->ReleaseByteArrayElements(bytecodeArray, (jbyte*)classDef.class_bytes, JNI_ABORT))) {
         return JNI_FALSE;
     }
 
@@ -91,12 +91,10 @@
 
     memset(&caps, 0, sizeof(jvmtiCapabilities));
     caps.can_redefine_classes = 1;
-    if (!NSK_JVMTI_VERIFY(NSK_CPP_STUB2(AddCapabilities,
-            test_jvmti, &caps)))
+    if (!NSK_JVMTI_VERIFY(test_jvmti->AddCapabilities(&caps)))
         return JNI_ERR;
 
-    if (!NSK_JVMTI_VERIFY(NSK_CPP_STUB2(GetCapabilities,
-            test_jvmti, &caps)))
+    if (!NSK_JVMTI_VERIFY(test_jvmti->GetCapabilities(&caps)))
         return JNI_ERR;
 
     if (!caps.can_redefine_classes)
--- a/test/jaxp/javax/xml/jaxp/libs/jaxp/library/JarUtils.java	Wed Oct 03 15:54:35 2018 +0200
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,141 +0,0 @@
-/*
- * Copyright (c) 2015, 2017, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation.
- *
- * 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.File;
-import java.io.IOException;
-import java.io.OutputStream;
-import java.nio.file.Files;
-import java.nio.file.Path;
-import java.nio.file.Paths;
-import java.nio.file.StandardCopyOption;
-import java.util.ArrayList;
-import java.util.Enumeration;
-import java.util.List;
-import java.util.Set;
-import java.util.jar.JarEntry;
-import java.util.jar.JarFile;
-import java.util.jar.JarOutputStream;
-import java.util.jar.Manifest;
-import java.util.stream.Collectors;
-import java.util.stream.Stream;
-
-/**
- * This class consists exclusively of static utility methods that are useful
- * for creating and manipulating JAR files.
- */
-
-public final class JarUtils {
-    private JarUtils() { }
-
-    /**
-     * Creates a JAR file.
-     *
-     * Equivalent to {@code jar cfm <jarfile> <manifest> -C <dir> file...}
-     *
-     * The input files are resolved against the given directory. Any input
-     * files that are directories are processed recursively.
-     */
-    public static void createJarFile(Path jarfile, Manifest man, Path dir, Path... file)
-        throws IOException
-    {
-        // create the target directory
-        Path parent = jarfile.getParent();
-        if (parent != null)
-            Files.createDirectories(parent);
-
-        List<Path> entries = new ArrayList<>();
-        for (Path entry : file) {
-            Files.find(dir.resolve(entry), Integer.MAX_VALUE,
-                        (p, attrs) -> attrs.isRegularFile())
-                    .map(e -> dir.relativize(e))
-                    .forEach(entries::add);
-        }
-
-        try (OutputStream out = Files.newOutputStream(jarfile);
-             JarOutputStream jos = new JarOutputStream(out))
-        {
-            if (man != null) {
-                JarEntry je = new JarEntry(JarFile.MANIFEST_NAME);
-                jos.putNextEntry(je);
-                man.write(jos);
-                jos.closeEntry();
-            }
-
-            for (Path entry : entries) {
-                String name = toJarEntryName(entry);
-                jos.putNextEntry(new JarEntry(name));
-                Files.copy(dir.resolve(entry), jos);
-                jos.closeEntry();
-            }
-        }
-    }
-
-    /**
-     * Creates a JAR file.
-     *
-     * Equivalent to {@code jar cf <jarfile>  -C <dir> file...}
-     *
-     * The input files are resolved against the given directory. Any input
-     * files that are directories are processed recursively.
-     */
-    public static void createJarFile(Path jarfile, Path dir, Path... file)
-        throws IOException
-    {
-        createJarFile(jarfile, null, dir, file);
-    }
-
-    /**
-     * Creates a JAR file.
-     *
-     * Equivalent to {@code jar cf <jarfile> -C <dir> file...}
-     *
-     * The input files are resolved against the given directory. Any input
-     * files that are directories are processed recursively.
-     */
-    public static void createJarFile(Path jarfile, Path dir, String... input)
-        throws IOException
-    {
-        Path[] paths = Stream.of(input).map(Paths::get).toArray(Path[]::new);
-        createJarFile(jarfile, dir, paths);
-    }
-
-    /**
-     * Creates a JAR file from the contents of a directory.
-     *
-     * Equivalent to {@code jar cf <jarfile> -C <dir> .}
-     */
-    public static void createJarFile(Path jarfile, Path dir) throws IOException {
-        createJarFile(jarfile, dir, Paths.get("."));
-    }
-
-    /**
-     * Map a file path to the equivalent name in a JAR file
-     */
-    private static String toJarEntryName(Path file) {
-        Path normalized = file.normalize();
-        return normalized.subpath(0, normalized.getNameCount())  // drop root
-                .toString()
-                .replace(File.separatorChar, '/');
-    }
-}
--- a/test/jaxp/javax/xml/jaxp/unittest/catalog/CatalogFileInputTest.java	Wed Oct 03 15:54:35 2018 +0200
+++ b/test/jaxp/javax/xml/jaxp/unittest/catalog/CatalogFileInputTest.java	Wed Oct 03 16:02:24 2018 +0200
@@ -42,9 +42,11 @@
 import javax.xml.catalog.CatalogFeatures;
 import javax.xml.catalog.CatalogManager;
 import javax.xml.catalog.CatalogResolver;
+
 import static jaxp.library.JAXPTestUtilities.getSystemProperty;
-import jaxp.library.JarUtils;
 import jaxp.library.SimpleHttpServer;
+import jdk.test.lib.util.JarUtils;
+
 import org.testng.Assert;
 import org.testng.annotations.AfterClass;
 import org.testng.annotations.BeforeClass;
@@ -56,10 +58,10 @@
 /*
  * @test
  * @bug 8151154 8171243
- * @library /javax/xml/jaxp/libs /javax/xml/jaxp/unittest
+ * @library /javax/xml/jaxp/libs /javax/xml/jaxp/unittest /test/lib
  * @run testng/othervm catalog.CatalogFileInputTest
  * @summary Verifies that the Catalog API accepts valid URIs only;
-            Verifies that the CatalogFeatures' builder throws
+ *          Verifies that the CatalogFeatures' builder throws
  *          IllegalArgumentException on invalid file inputs.
  *          This test was splitted from CatalogTest.java due to
  *          JDK-8168968, it has to only run without SecurityManager
--- a/test/jdk/ProblemList-Xcomp.txt	Wed Oct 03 15:54:35 2018 +0200
+++ b/test/jdk/ProblemList-Xcomp.txt	Wed Oct 03 16:02:24 2018 +0200
@@ -28,4 +28,4 @@
 #############################################################################
 
 java/lang/invoke/MethodHandles/CatchExceptionTest.java 8146623 generic-all
-java/lang/Class/forName/modules/TestDriver.java 8208212 solaris-all
+java/lang/Class/forName/modules/TestDriver.java 8205526 solaris-all
--- a/test/jdk/ProblemList.txt	Wed Oct 03 15:54:35 2018 +0200
+++ b/test/jdk/ProblemList.txt	Wed Oct 03 16:02:24 2018 +0200
@@ -102,7 +102,7 @@
 #  1. Make sure test passes on all platforms with samevm, or mark it othervm
 #  2. Make sure test passes on all platforms when run with it's entire group
 #  3. Make sure both VMs are tested, -server and -client, if possible
-#  4. Use a tool like JPRT or something to verify these results
+#  4. Use your favorite build and test system to verify these results
 #  5. Delete lines in this file, include the changes with your test changes
 #
 # You may need to repeat your testing 2 or even 3 times to verify good
@@ -128,7 +128,6 @@
 java/awt/FileDialog/8003399/bug8003399.java 8198334 windows-all
 java/awt/event/MouseWheelEvent/InfiniteRecursion/InfiniteRecursion.java 8060176 windows-all,macosx-all
 java/awt/event/MouseWheelEvent/InfiniteRecursion/InfiniteRecursion_1.java 8060176 windows-all,macosx-all
-java/awt/dnd/BadSerializaionTest/BadSerializationTest.java 8039082 generic-all
 java/awt/dnd/MissingEventsOnModalDialog/MissingEventsOnModalDialogTest.java 8164464 linux-all,macosx-all
 java/awt/dnd/URIListBetweenJVMsTest/URIListBetweenJVMsTest.html 8171510 macosx-all
 javax/swing/dnd/7171812/bug7171812.java 8041447 macosx-all
@@ -677,6 +676,7 @@
 sun/security/pkcs11/tls/TestMasterSecret.java                   8204203 windows-all
 sun/security/pkcs11/tls/TestPRF.java                            8204203 windows-all
 sun/security/pkcs11/tls/TestPremaster.java                      8204203 windows-all
+sun/security/tools/keytool/NssTest.java                         8204203 windows-all
 
 ############################################################################
 
@@ -684,7 +684,6 @@
 javax/sound/sampled/DirectAudio/bug6372428.java                      8055097 generic-all
 javax/sound/sampled/Clip/bug5070081.java                             8055097 generic-all
 javax/sound/sampled/DataLine/LongFramePosition.java                  8055097 generic-all
-javax/sound/sampled/Clip/AutoCloseTimeCheck.java                     8207150 generic-all
 
 javax/sound/sampled/Clip/Drain/ClipDrain.java          7062792 generic-all
 
--- a/test/jdk/TEST.ROOT	Wed Oct 03 15:54:35 2018 +0200
+++ b/test/jdk/TEST.ROOT	Wed Oct 03 16:02:24 2018 +0200
@@ -19,7 +19,7 @@
 # Tests that must run in othervm mode
 othervm.dirs=java/awt java/beans javax/accessibility javax/imageio javax/sound javax/swing javax/print \
 com/apple/laf com/sun/java/accessibility com/sun/java/swing sanity/client demo/jfc \
-javax/management com/sun/awt sun/awt sun/java2d javax/xml/jaxp/testng/validation java/lang/ProcessHandle
+javax/management sun/awt sun/java2d javax/xml/jaxp/testng/validation java/lang/ProcessHandle
 
 # Tests that cannot run concurrently
 exclusiveAccess.dirs=java/rmi/Naming java/util/prefs sun/management/jmxremote sun/tools/jstatd sun/security/mscapi java/util/stream java/util/Arrays/largeMemory java/util/BitSet/stream javax/rmi
--- a/test/jdk/TEST.groups	Wed Oct 03 15:54:35 2018 +0200
+++ b/test/jdk/TEST.groups	Wed Oct 03 16:02:24 2018 +0200
@@ -259,11 +259,7 @@
 jdk_native_sanity = \
     native_sanity
 
-# java launcher specific tests, Note: do not include this group into any groups
-# that potentially could be included into a jprt test rule, as the complementary
-# closed  group includes awt SplashScreen and these tests may not run
-# satisfactorily on all platforms and  profiles thus this group must always
-# be a stand-alone group
+# java launcher specific tests.
 jdk_launcher = \
     tools/launcher \
     sun/tools
@@ -351,7 +347,6 @@
 
 jdk_awt = \
     java/awt \
-    com/sun/awt \
     com/apple/eawt \
     com/apple/laf \
     sun/awt
@@ -408,9 +403,6 @@
 #
 # These groups specify a subset of Serviceability tests that are supposed to
 # guard against breakage of Serviceability features by other component teams.
-# They are added to the "hotspot" testset in JPRT so that they will run on all
-# full-forest pushes through JPRT.
-#
 
 jdk_svc_sanity = \
     :jdk_management_sanity \
@@ -489,8 +481,7 @@
     :jdk_sound \
     :jdk_sctp \
     javax/accessibility \
-    com/sun/java/swing \
-    com/sun/awt
+    com/sun/java/swing
 
 needs_g1gc = \
   jdk/jfr/event/gc/refstat/TestRefStatEventWithG1ConcurrentMark.java \
@@ -504,6 +495,7 @@
   jdk/jfr/event/gc/collection/TestYoungGarbageCollectionEventWithG1New.java \
   jdk/jfr/event/gc/collection/TestGCEventMixedWithG1FullCollection.java \
   jdk/jfr/event/gc/collection/TestGCEventMixedWithG1ConcurrentMark.java \
+  jdk/jfr/event/gc/collection/TestG1ParallelPhases.java \
   jdk/jfr/event/gc/objectcount/TestObjectCountAfterGCEventWithG1FullCollection.java \
   jdk/jfr/event/gc/objectcount/TestObjectCountAfterGCEventWithG1ConcurrentMark.java \
   jdk/jfr/event/gc/heapsummary/TestHeapSummaryEventG1.java
--- a/test/jdk/com/sun/awt/SecurityWarning/CustomSecurityManager.java	Wed Oct 03 15:54:35 2018 +0200
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,36 +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.  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 sun.awt.AWTPermissions;
-import java.security.Permission;
-
-public class CustomSecurityManager extends SecurityManager {
-    @Override
-    public void checkPermission(Permission perm) {
-        if (perm.implies(AWTPermissions.TOPLEVEL_WINDOW_PERMISSION)) {
-            throw new SecurityException();
-        }
-    }
-}
--- a/test/jdk/com/sun/awt/SecurityWarning/GetSizeShouldNotReturnZero.java	Wed Oct 03 15:54:35 2018 +0200
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,187 +0,0 @@
-/*
- * Copyright (c) 2009, 2018, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * 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 %W% %E%
-  @key headful
-  @bug 6818312
-  @summary The size returned by SecurityWarning.getSize() should not be zero
-  @author anthony.petrov@sun.com: area=awt.toplevel
-  @library ../../../../java/awt/regtesthelpers
-  @modules java.desktop/com.sun.awt
-           java.desktop/sun.awt
-  @build Util CustomSecurityManager CopyClassFile
-  @run main CopyClassFile CustomSecurityManager bootcp/
-  @run main/othervm/secure=CustomSecurityManager -Xbootclasspath/a:bootcp GetSizeShouldNotReturnZero
-*/
-
-/**
- * GetSizeShouldNotReturnZero.java
- *
- * summary: The size returned by SecurityWarning.getSize() should not be zero
- */
-
-import com.sun.awt.SecurityWarning;
-import test.java.awt.regtesthelpers.Util;
-
-import java.awt.*;
-
-public class GetSizeShouldNotReturnZero
-{
-    private static void init()
-    {
-        Frame f = new Frame();
-        f.setSize(100, 100);
-        f.setVisible(true);
-
-        Robot robot = Util.createRobot();
-        Util.waitForIdle(robot);
-
-        Dimension size = SecurityWarning.getSize(f);
-        if (size.width == 0 || size.height == 0) {
-            fail("Reported security warning size: " + size);
-            return;
-        }
-        pass();
-    }//End  init()
-
-
-    /*****************************************************
-     * Standard Test Machinery Section
-     * DO NOT modify anything in this section -- it's a
-     * standard chunk of code which has all of the
-     * synchronisation necessary for the test harness.
-     * By keeping it the same in all tests, it is easier
-     * to read and understand someone else's test, as
-     * well as insuring that all tests behave correctly
-     * with the test harness.
-     * There is a section following this for test-
-     * classes
-     ******************************************************/
-    private static boolean theTestPassed = false;
-    private static boolean testGeneratedInterrupt = false;
-    private static String failureMessage = "";
-
-    private static Thread mainThread = null;
-
-    private static int sleepTime = 300000;
-
-    // Not sure about what happens if multiple of this test are
-    //  instantiated in the same VM.  Being static (and using
-    //  static vars), it aint gonna work.  Not worrying about
-    //  it for now.
-    public static void main( String args[] ) throws InterruptedException
-    {
-        mainThread = Thread.currentThread();
-        try
-        {
-            init();
-        }
-        catch( TestPassedException e )
-        {
-            //The test passed, so just return from main and harness will
-            // interepret this return as a pass
-            return;
-        }
-        //At this point, neither test pass nor test fail has been
-        // called -- either would have thrown an exception and ended the
-        // test, so we know we have multiple threads.
-
-        //Test involves other threads, so sleep and wait for them to
-        // called pass() or fail()
-        try
-        {
-            Thread.sleep( sleepTime );
-            //Timed out, so fail the test
-            throw new RuntimeException( "Timed out after " + sleepTime/1000 + " seconds" );
-        }
-        catch (InterruptedException e)
-        {
-            //The test harness may have interrupted the test.  If so, rethrow the exception
-            // so that the harness gets it and deals with it.
-            if( ! testGeneratedInterrupt ) throw e;
-
-            //reset flag in case hit this code more than once for some reason (just safety)
-            testGeneratedInterrupt = false;
-
-            if ( theTestPassed == false )
-            {
-                throw new RuntimeException( failureMessage );
-            }
-        }
-
-    }//main
-
-    public static synchronized void setTimeoutTo( int seconds )
-    {
-        sleepTime = seconds * 1000;
-    }
-
-    public static synchronized void pass()
-    {
-        System.out.println( "The test passed." );
-        System.out.println( "The test is over, hit  Ctl-C to stop Java VM" );
-        //first check if this is executing in main thread
-        if ( mainThread == Thread.currentThread() )
-        {
-            //Still in the main thread, so set the flag just for kicks,
-            // and throw a test passed exception which will be caught
-            // and end the test.
-            theTestPassed = true;
-            throw new TestPassedException();
-        }
-        theTestPassed = true;
-        testGeneratedInterrupt = true;
-        mainThread.interrupt();
-    }//pass()
-
-    public static synchronized void fail()
-    {
-        //test writer didn't specify why test failed, so give generic
-        fail( "it just plain failed! :-)" );
-    }
-
-    public static synchronized void fail( String whyFailed )
-    {
-        System.out.println( "The test failed: " + whyFailed );
-        System.out.println( "The test is over, hit  Ctl-C to stop Java VM" );
-        //check if this called from main thread
-        if ( mainThread == Thread.currentThread() )
-        {
-            //If main thread, fail now 'cause not sleeping
-            throw new RuntimeException( whyFailed );
-        }
-        theTestPassed = false;
-        testGeneratedInterrupt = true;
-        failureMessage = whyFailed;
-        mainThread.interrupt();
-    }//fail()
-
-}// class GetSizeShouldNotReturnZero
-
-//This exception is used to exit from any level of call nesting
-// when it's determined that the test has passed, and immediately
-// end the test.
-class TestPassedException extends RuntimeException
-{
-}
--- a/test/jdk/com/sun/awt/TEST.properties	Wed Oct 03 15:54:35 2018 +0200
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,2 +0,0 @@
-modules=java.desktop
-
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/jdk/com/sun/jdi/CatchPatternTest.java	Wed Oct 03 16:02:24 2018 +0200
@@ -0,0 +1,126 @@
+/*
+ * Copyright (c) 2002, 2018, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * 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 4671838
+ * @summary TTY: surprising ExceptionSpec.resolveEventRequest() wildcard results
+ * @comment converted from test/jdk/com/sun/jdi/CatchPatternTest.sh
+ *
+ * @library /test/lib
+ * @build CatchPatternTest
+ * @run main/othervm CatchPatternTest
+ */
+
+import jdk.test.lib.process.OutputAnalyzer;
+import lib.jdb.JdbCommand;
+import lib.jdb.JdbTest;
+
+class CatchPatternTestTarg {
+    public void bark(int i) {
+        System.out.println(" bark: " + i);
+        switch (i) {
+        case 0:
+            throw new IllegalArgumentException("IllegalArgumentException");
+        case 1:
+            throw new ArithmeticException("ArithmeticException");
+        case 2:
+            throw new IllegalMonitorStateException("IllegalMonitorStateException");
+        case 3:
+            throw new IndexOutOfBoundsException("IndexOutOfBoundsException");
+        default:
+            throw new Error("should not happen");
+        }
+    }
+    public void loop(int max) {
+        for (int i = 0; i <= max; i++) {
+            try {
+                bark(i);
+            } catch(RuntimeException re) {
+                System.out.println(" loop: " + re.getMessage() +
+                       " caught and ignored.");
+            }
+        }
+    }
+    public void partOne() {
+        loop(2);
+        System.out.println("partOne completed");
+    }
+    public void partTwo() {
+        loop(3);
+        System.out.println("partTwo completed");
+    }
+    public static void main(String[] args) {
+        System.out.println("Howdy!");
+        CatchPatternTestTarg my = new CatchPatternTestTarg();
+        my.partOne();
+        my.partTwo();
+        System.out.println("Goodbye from CatchPatternTestTarg!");
+    }
+}
+
+public class CatchPatternTest extends JdbTest {
+    public static void main(String argv[]) {
+        new CatchPatternTest().run();
+    }
+
+    private CatchPatternTest() {
+        super(DEBUGGEE_CLASS);
+    }
+
+    private static final String DEBUGGEE_CLASS = CatchPatternTestTarg.class.getName();
+
+    @Override
+    protected void runCases() {
+        jdb.command(JdbCommand.stopIn(DEBUGGEE_CLASS, "main"));
+        jdb.command(JdbCommand.stopIn(DEBUGGEE_CLASS, "partTwo"));
+        jdb.command(JdbCommand.run());
+
+        jdb.command(JdbCommand.ignore(JdbCommand.ExType.uncaught, "java.lang.Throwable"));
+        // Instead of matching java.lang.I* we use two more specific
+        // patterns here. The reason is to avoid matching IncompatibleClassChangeError
+        // (or the subclass NoSuchMethodError) thrown by the
+        // java.lang.invoke infrastructure.
+        jdb.command(JdbCommand.catch_(JdbCommand.ExType.all, "java.lang.Il*"));
+        jdb.command(JdbCommand.catch_(JdbCommand.ExType.all, "java.lang.Ind*"));
+        jdb.command(JdbCommand.cont());
+        jdb.command(JdbCommand.cont());
+        jdb.command(JdbCommand.cont());
+        jdb.command(JdbCommand.ignore(JdbCommand.ExType.all, "java.lang.Ind*"));
+        jdb.command(JdbCommand.ignore(JdbCommand.ExType.all, "java.lang.Il*"));
+
+        jdb.contToExit(1);
+
+        new OutputAnalyzer(getJdbOutput())
+                .shouldContain("Exception occurred: java.lang.IllegalArgumentException")
+                .shouldContain("Exception occurred: java.lang.IllegalMonitorStateException")
+                .shouldNotContain("Exception occurred: ArithmeticException")
+                .shouldNotContain("Exception occurred: IndexOutOfBoundsException")
+                .shouldNotContain("Exception occurred: IllegalStateException")
+                .shouldNotContain("should not happen");
+        new OutputAnalyzer(getDebuggeeOutput())
+                .shouldContain("partOne completed")
+                .shouldContain("partTwo completed");
+    }
+
+}
--- a/test/jdk/com/sun/jdi/CatchPatternTest.sh	Wed Oct 03 15:54:35 2018 +0200
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,132 +0,0 @@
-#!/bin/sh
-
-#
-# Copyright (c) 2002, 2014, Oracle and/or its affiliates. All rights reserved.
-# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
-#
-# This code is free software; you can redistribute it and/or modify it
-# 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 4671838
-#  @summary TTY: surprising ExceptionSpec.resolveEventRequest() wildcard results
-#  @author Tim Bell
-#
-#  @key intermittent
-#  @run shell CatchPatternTest.sh
-classname=CatchPatternTestTarg
-createJavaFile()
-{
-    cat <<EOF > $classname.java.1
-public class $classname {
-    public void bark(int i) {
-        System.out.println(" bark: " + i);
-        switch (i) {
-        case 0:
-            throw new IllegalArgumentException("IllegalArgumentException");
-        case 1:
-            throw new ArithmeticException("ArithmeticException");
-        case 2:
-            throw new IllegalMonitorStateException("IllegalMonitorStateException");
-        case 3:
-            throw new IndexOutOfBoundsException("IndexOutOfBoundsException");
-        default:
-            throw new Error("should not happen");
-        }
-    }
-    public void loop(int max) {
-        for (int i = 0; i <= max; i++) {
-            try {
-                bark(i);
-            } catch(RuntimeException re) {
-                System.out.println(" loop: " + re.getMessage() +
-                       " caught and ignored.");
-            }
-        }
-    }
-    public void partOne() {
-        loop(2);
-        System.out.println("partOne completed");
-    }
-    public void partTwo() {
-        loop(3);
-        System.out.println("partTwo completed");
-    }
-    public static void main(String[] args) {
-        System.out.println("Howdy!");
-        $classname my = new $classname();
-        my.partOne();
-        my.partTwo();
-        System.out.println("Goodbye from $classname!");
-    }
-}
-EOF
-}
-
-# This is called to feed cmds to jdb.
-dojdbCmds()
-{
-   #set -x
-   cmd stop in ${classname}.main
-   cmd stop in ${classname}.partTwo
-   runToBkpt
-   cmd ignore uncaught java.lang.Throwable
-   # Instead of matching java.lang.I* we use two more specific
-   # patterns here. The reason is to avoid matching IncompatibleClassChangeError
-   # (or the subclass NoSuchMethodError) thrown by the
-   # java.lang.invoke infrastructure.
-   cmd catch all java.lang.Il*
-   cmd catch all java.lang.Ind*
-   cmd cont
-   cmd cont
-   cmd cont
-   cmd ignore all java.lang.I*
-   cmd allowExit cont
-}
-
-mysetup()
-{
-    if [ -z "$TESTSRC" ] ; then
-        TESTSRC=.
-    fi
-
-    for ii in . $TESTSRC $TESTSRC/.. ; do
-        if [ -r "$ii/ShellScaffold.sh" ] ; then
-            . $ii/ShellScaffold.sh
-            break
-        fi
-    done
-}
-
-# You could replace this next line with the contents
-# of ShellScaffold.sh and this script will run just the same.
-mysetup
-
-runit
-#
-jdbFailIfNotPresent "Exception occurred: java.lang.IllegalArgumentException"
-jdbFailIfNotPresent "Exception occurred: java.lang.IllegalMonitorStateException"
-jdbFailIfPresent "Exception occurred: ArithmeticException"
-jdbFailIfPresent "Exception occurred: IndexOutOfBoundsException"
-jdbFailIfPresent "Exception occurred: IllegalStateException"
-jdbFailIfPresent "should not happen"
-debuggeeFailIfNotPresent "partOne completed"
-debuggeeFailIfNotPresent "partTwo completed"
-#
-pass
--- a/test/jdk/com/sun/jdi/ImmutableResourceTest.java	Wed Oct 03 15:54:35 2018 +0200
+++ b/test/jdk/com/sun/jdi/ImmutableResourceTest.java	Wed Oct 03 16:02:24 2018 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2005, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2005, 2018, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -21,18 +21,18 @@
  * questions.
  */
 
-/**
- *
- *
- *  This isn't the test case: ImmutableResourceTest.sh is.
- *  Refer to ImmutableResourceTest.sh when running this test.
+/*
+ * @test
+ * @bug        6287579
+ * @summary    SubClasses of ListResourceBundle should fix getContents()
  *
- *  @bug        6287579
- *  @summary    SubClasses of ListResourceBundle should fix getContents()
+ * @modules jdk.jdi/com.sun.tools.example.debug.tty
+ *
+ * @compile --add-exports jdk.jdi/com.sun.tools.example.debug.tty=ALL-UNNAMED -g ImmutableResourceTest.java
  *
- *  @author Tim Bell
- *
+ * @run main/othervm --add-exports jdk.jdi/com.sun.tools.example.debug.tty=ALL-UNNAMED ImmutableResourceTest
  */
+
 import java.util.ResourceBundle;
 
 public class ImmutableResourceTest {
--- a/test/jdk/com/sun/jdi/ImmutableResourceTest.sh	Wed Oct 03 15:54:35 2018 +0200
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,116 +0,0 @@
-#
-# Copyright (c) 2005, 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        6287579
-# @summary    SubClasses of ListResourceBundle should fix getContents()
-# @author     Tim Bell
-#
-# @modules jdk.jdi/com.sun.tools.example.debug.tty
-#
-# @run shell ImmutableResourceTest.sh
-#
-
-# Beginning of subroutines:
-status=1
-
-#Call this from anywhere to fail the test with an error message
-# usage: fail "reason why the test failed"
-fail()
- { echo "The test failed :-("
-   echo "$*" 1>&2
-   echo "exit status was $status"
-   exit $status
- } #end of fail()
-
-#Call this from anywhere to pass the test with a message
-# usage: pass "reason why the test passed if applicable"
-pass()
- { echo "The test passed!!!"
-   echo "$*" 1>&2
-   exit 0
- } #end of pass()
-
-# end of subroutines
-
-# The beginning of the script proper
-
-OS=`uname -s`
-case "$OS" in
-   SunOS | Linux | Darwin | AIX )
-      PATHSEP=":"
-      ;;
-
-   Windows* | CYGWIN*)
-      PATHSEP=";"
-      ;;
-
-   # catch all other OSs
-   * )
-      echo "Unrecognized system!  $OS"
-      fail "Unrecognized system!  $OS"
-      ;;
-esac
-
-TARGETCLASS="ImmutableResourceTest"
-if [ -z "${TESTJAVA}" ] ; then
-   # TESTJAVA is not set, so the test is running stand-alone.
-   # TESTJAVA holds the path to the root directory of the build of the JDK
-   # to be tested.  That is, any java files run explicitly in this shell
-   # should use TESTJAVA in the path to the java interpreter.
-   # So, we'll set this to the JDK spec'd on the command line.  If none
-   # is given on the command line, tell the user that and use a default.
-   # THIS IS THE JDK BEING TESTED.
-   if [ -n "$1" ] ; then
-          TESTJAVA=$1
-      else
-          TESTJAVA=$JAVA_HOME
-   fi
-   TESTSRC=.
-   TESTCLASSES=.
-   #Deal with .class files:
-fi
-#
-echo "JDK under test is: $TESTJAVA"
-#
-CP="-classpath ${TESTCLASSES}"
-#
-env
-#
-set -vx
-#
-# Compile test class
-${TESTJAVA}/bin/javac --add-exports jdk.jdi/com.sun.tools.example.debug.tty=ALL-UNNAMED \
-   -d "${TESTCLASSES}" ${CP} -g "${TESTSRC}"/"${TARGETCLASS}".java
-#
-# Run the test class, again with the classpath we need:
-${TESTJAVA}/bin/java --add-exports jdk.jdi/com.sun.tools.example.debug.tty=ALL-UNNAMED \
-    ${CP} ${TARGETCLASS}
-status=$?
-echo "test status was: $status"
-if [ $status -eq "0" ];
-   then pass ""
-
-   else fail "unspecified test failure"
-fi
--- a/test/jdk/com/sun/jdi/JITDebug.java	Wed Oct 03 15:54:35 2018 +0200
+++ b/test/jdk/com/sun/jdi/JITDebug.java	Wed Oct 03 16:02:24 2018 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1999, 2006, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1999, 2018, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -22,37 +22,27 @@
  */
 
 /*
- *  Note 1: JITDebug.java is no longer a standalone regression test,
- *  due to chronic test failures on win32 platforms.  When testing,
- *  use the wrapper script (JITDebug.sh) instead, which will in turn
- *  invoke this program.
- *
- *  The problems are related to inconsistent use of "SystemRoot"
- *  versus "SYSTEMROOT" environment variables in different win32 O/S
- *  installations.  Refer to the Comments and Evaluation on bugs
- *  4522770 and 4461673 for more information.
+ * Note: What seems to be an excessive use of System.xxx.flush();
+ * is actually necessary to combat lost output on win32 systems.
  *
- *  Undefined SystemRoot in a win32 environment causes the O/S socket()
- *  layer to fail with WSAEPROVIDERFAILEDINIT.  The workaround used by
- *  JITDebug.sh and JITDebug.java is to select the dt_shmem transport
- *  on any win32 platform where SystemRoot is not found.
- *
- *  Note 2: What seems to be an excessive use of System.xxx.flush();
- *  is actually necessary to combat lost output on win32 systems.
+ * @test
+ * @bug 4291701 4376819 4422312 4522770
+ * @summary Test JIT debugging -
+ * assure that launching on uncaught exception works
  *
- *  @t e s t
- *  @bug 4291701 4376819 4422312 4522770
- *  @summary Test JIT debugging -
- *  assure that launching on uncaught exception works
+ * @library /test/lib
  *
- *  @author Robert Field
- *  @run driver JITDebug
+ * @author Robert Field
+ * @run main/othervm JITDebug
  */
 
 import com.sun.jdi.*;
 import com.sun.jdi.connect.*;
+import jdk.test.lib.JDKToolFinder;
+import jdk.test.lib.Utils;
+import jdk.test.lib.process.ProcessTools;
+
 import java.util.*;
-import java.io.*;
 
 /*
  * This class implements three separate small programs, each
@@ -97,7 +87,13 @@
             }
         case 3:
             if (args[0].equals("DEBUGGER")) {
-                trivialDebugger(args[2]);
+                // launched by using "-agentlib:" "launch" sub-option:
+                // The following strings are appended to the string given in this argument (space-delimited).
+                // They can aid the launched debugger in establishing a connection with this VM.
+                // The resulting string is executed.
+                // - The value of the transport sub-option.
+                // - The value of the address sub-option (or the generated address if one is not given)
+                trivialDebugger(args[1], args[2]);
                 return true;
             } else {
                 return false;
@@ -108,70 +104,24 @@
     }
 
     void testLaunch() {
-        class DisplayOutput extends Thread {
-            InputStream in;
-
-            DisplayOutput(InputStream in) {
-                this.in = in;
-            }
-
-            public void run() {
-                try {
-                    transfer();
-                } catch (IOException exc) {
-                    new RuntimeException("Unexpected exception: " + exc);
-                }
-            }
-
-            void transfer() throws IOException {
-                int ch;
-                while ((ch = in.read()) != -1) {
-                    System.out.print((char)ch);
-                }
-                in.close();
-            }
-        }
-        String transportMethod = System.getProperty("TRANSPORT_METHOD");
-        if (transportMethod == null) {
-            transportMethod = "dt_socket"; //Default to socket transport.
-        }
-        String javaExe = System.getProperty("java.home") +
-                         File.separator + "bin" + File.separator +"java";
-        List largs = new ArrayList();
-        largs.add(javaExe);
-        largs.add("-agentlib:jdwp=transport=" + transportMethod + ",server=y,onuncaught=y," +
-                  "launch=" +
-                  javaExe + " -DTRANSPORT_METHOD=" + transportMethod + " " +
-                  this.getClass().getName() + " DEBUGGER ");
-        largs.add("JITDebug");
+        ProcessBuilder pb = ProcessTools.createJavaProcessBuilder(true);
+        List largs = pb.command();
+        largs.add("-classpath");
+        largs.add(Utils.TEST_CLASSES);
+        String javaExe = JDKToolFinder.getJDKTool("java");
+        largs.add("-agentlib:jdwp=transport=dt_socket,server=y,onuncaught=y," +
+                  "launch=" + javaExe + " " + this.getClass().getName() + " DEBUGGER ");
+        largs.add(this.getClass().getName());
         largs.add("TARGET");
-        System.out.println("Launching: " + largs);
-        String[] sargs = (String[])largs.toArray(new String[largs.size()]);
-        Runtime rt = Runtime.getRuntime();
         try {
-            Process proc = rt.exec(VMConnection.insertDebuggeeVMOptions(sargs));
-            DisplayOutput inThread = new DisplayOutput(proc.getInputStream());
-            DisplayOutput erThread = new DisplayOutput(proc.getErrorStream());
-            inThread.start();  // transfer all in&err
-            erThread.start();
-            inThread.join();  // make sure they are done
-            erThread.join();
-            int exitValue = proc.waitFor();
-            if (exitValue != 0) {
-                throw new RuntimeException("Failure exit status: " +
-                                           exitValue);
-            }
-        } catch (Exception exc) {
+            ProcessTools.executeCommand(pb)
+                    .shouldHaveExitValue(0);
+        } catch (Throwable exc) {
             throw new RuntimeException("Unexpected exception: " + exc);
         }
         System.out.println("JIT Debugging test PASSED");
     }
 
-    void displayOutput(InputStream in) throws IOException {
-
-    }
-
-
     // Target VM code
     void debugTarget() {
         System.out.flush();
@@ -180,9 +130,8 @@
         throw new RuntimeException("Start-up onuncaught handling");
     }
 
-    void trivialDebugger(String transportAddress) {
+    void trivialDebugger(String transportMethod, String transportAddress) {
         System.out.println("trivial debugger started");
-        String transportMethod = System.getProperty("TRANSPORT_METHOD");
         String connectorName = null;
         if ("dt_shmem".equals(transportMethod)) {
             connectorName = "com.sun.jdi.SharedMemoryAttach";
@@ -209,7 +158,7 @@
     }
 
     void doAttach(String connectorName, AttachingConnector conn, String transportAddress) {
-        Map connArgs = conn.defaultArguments();
+        Map<String, Connector.Argument> connArgs = conn.defaultArguments();
         if ("com.sun.jdi.SharedMemoryAttach".equals(connectorName)) {
             Connector.Argument portArg = (Connector.Argument)connArgs.get("name");
             portArg.setValue(transportAddress);
@@ -234,7 +183,7 @@
     void hang() {
         try {
             // ten minute nap
-            Thread.currentThread().sleep(10 * 60 * 1000);
+            Thread.sleep(10 * 60 * 1000);
         } catch (InterruptedException exc) {
             // shouldn't happen
         }
--- a/test/jdk/com/sun/jdi/JITDebug.sh	Wed Oct 03 15:54:35 2018 +0200
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,142 +0,0 @@
-#!/bin/ksh -p
-
-#
-# Copyright (c) 2002, 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       JITDebug.sh 1.7 03/09/05
-# @bug        4291701 4376819 4422312 4522770 4913748
-# @summary    Test JIT debugging - assure that launching on
-#             uncaught exception works
-# @author     Tim Bell
-# Based on test/java/awt/TEMPLATE/AutomaticShellTest.sh
-#
-# @run build TestScaffold VMConnection TargetListener TargetAdapter
-# @run compile -g JITDebug.java
-# @run shell JITDebug.sh
-
-# Beginning of subroutines:
-status=1
-
-#Call this from anywhere to fail the test with an error message
-# usage: fail "reason why the test failed"
-fail()
- { echo "The test failed :-("
-   echo "$*" 1>&2
-   echo "exit status was $status"
-   exit $status
- } #end of fail()
-
-#Call this from anywhere to pass the test with a message
-# usage: pass "reason why the test passed if applicable"
-pass()
- { echo "The test passed!!!"
-   echo "$*" 1>&2
-   exit 0
- } #end of pass()
-
-# end of subroutines
-
-
-# The beginning of the script proper
-
-OS=`uname -s`
-export TRANSPORT_METHOD
-case "$OS" in
-   SunOS | Linux | Darwin | AIX )
-      PATHSEP=":"
-      TRANSPORT_METHOD=dt_socket
-      ;;
-
-   Windows* | CYGWIN*)
-      PATHSEP=";"
-      TRANSPORT_METHOD=dt_shmem
-      ;;
-
-   # catch all other OSs
-   * )
-      echo "Unrecognized system!  $OS"
-      fail "Unrecognized system!  $OS"
-      ;;
-esac
-#
-# Want this test to run standalone as well as in the harness, so do the
-#  following to copy the test's directory into the harness's scratch directory
-#  and set all appropriate variables:
-
-if [ -z "${TESTJAVA}" ] ; then
-   # TESTJAVA is not set, so the test is running stand-alone.
-   # TESTJAVA holds the path to the root directory of the build of the JDK
-   # to be tested.  That is, any java files run explicitly in this shell
-   # should use TESTJAVA in the path to the java interpreter.
-   # So, we'll set this to the JDK spec'd on the command line.  If none
-   # is given on the command line, tell the user that and use a default.
-   # THIS IS THE JDK BEING TESTED.
-   if [ -n "$1" ] ; then
-          TESTJAVA=$1
-      else
-          TESTJAVA=$JAVA_HOME
-   fi
-   TESTSRC=.
-   TESTCLASSES=.
-   #Deal with .class files:
-   #if running standalone (no test harness of any kind), compile the
-   #support files and the test case
-   ${TESTJAVA}/bin/javac -d ${TESTCLASSES} \
-            -classpath "${TESTSRC}" \
-            TestScaffold.java VMConnection.java TargetListener.java TargetAdapter.java
-   ${TESTJAVA}/bin/javac  -d ${TESTCLASSES} \
-            -classpath "${TESTSRC}" -g \
-            JITDebug.java
-fi
-echo "JDK under test is: $TESTJAVA"
-#
-CLASSPATH="${TESTCLASSES}"
-export CLASSPATH
-CP="-classpath \"${CLASSPATH}\""
-#
-TARGETCLASS=JITDebug
-RUNFLAGS='-showversion -DTRANSPORT_METHOD="${TRANSPORT_METHOD}"'
-RUNFLAGS="-Dtest.classes=${TESTCLASSES} ${RUNFLAGS}"
-#
-echo ""
-echo "Environment variable definitions are:"
-echo ""
-env | sort
-echo ""
-echo ""
-#
-echo "Starting test:"
-echo ${TESTJAVA}/bin/java -DHANGINGJAVA_DEB ${RUNFLAGS} ${CP} ${TARGETCLASS}
-eval ${TESTJAVA}/bin/java -DHANGINGJAVA_DEB ${RUNFLAGS} ${CP} ${TARGETCLASS}
-status=$?
-if [ $status -ne "0" ];
-then fail "test failed for class=$TARGETCLASS!"
-fi
-#
-# pass or fail the test based on status of the command
-if [ $status -eq "0" ];
-   then pass ""
-
-   else fail "unspecified test failure"
-fi
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/jdk/com/sun/jdi/PrivateTransportTest.java	Wed Oct 03 16:02:24 2018 +0200
@@ -0,0 +1,108 @@
+/*
+ * Copyright (c) 2005, 2018, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * 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 6225664 6220618
+ * @summary Test for when private transport library outside jdk
+ * @comment converted from test/jdk/com/sun/jdi/PrivateTransportTest.sh
+ *
+ * @library /test/lib
+ * @run compile -g HelloWorld.java
+ * @build PrivateTransportTest
+ * @run main/othervm PrivateTransportTest
+ */
+
+import jdk.test.lib.Utils;
+import jdk.test.lib.process.ProcessTools;
+
+import java.io.IOException;
+import java.nio.file.Files;
+import java.nio.file.Path;
+import java.nio.file.Paths;
+import java.util.Map;
+import java.util.Optional;
+import java.util.stream.Stream;
+
+public class PrivateTransportTest {
+
+    public static void main(String argv[]) throws Throwable {
+        new PrivateTransportTest()
+                .test();
+    }
+
+    private final Path transportLib;
+    private final String pathEnvVar;
+    private final String pathSep;
+
+    private static boolean isTransportLib(Path path) {
+        String fileName = path.getFileName().toString().toLowerCase();
+        return fileName.equals("dt_socket.dll")
+                || fileName.equals("libdt_socket.so")
+                || fileName.equals("libdt_socket.dylib");
+    }
+
+    private PrivateTransportTest() throws IOException {
+        Path jdkRoot = Paths.get(Utils.TEST_JDK);
+        try (Stream<Path> files = Files.find(jdkRoot, 5, (path, attr) -> isTransportLib(path.getFileName()))) {
+            Optional<Path> foundLib = files.findAny();
+            if (!foundLib.isPresent()) {
+                throw new RuntimeException("cannot find dt_socket lib");
+            }
+            transportLib = foundLib.get();
+        }
+        if (System.getProperty("os.name").startsWith("Windows")) {
+            pathSep = ";";
+            pathEnvVar = "PATH";
+        } else {
+            pathSep = ":";
+            if (System.getProperty("os.name").equals("AIX")) {
+                pathEnvVar = "LIBPATH";
+            } else {
+                pathEnvVar = "LD_LIBRARY_PATH";
+            }
+        }
+    }
+
+    private void test() throws Throwable {
+        // copy existing dt_socket lib to <CLASSES>/private_dt_socket
+        String libName = transportLib.getFileName().toString().replace("dt_socket", "private_dt_socket");
+        Files.copy(transportLib, Paths.get(Utils.TEST_CLASSES).resolve(libName));
+
+        ProcessBuilder pb = ProcessTools.createJavaProcessBuilder(true,
+                "-agentlib:jdwp=transport=private_dt_socket,server=y,suspend=n",
+                "-classpath", Utils.TEST_CLASSES,
+                "HelloWorld");
+        Map<String, String> env = pb.environment();
+        String pathValue = env.get(pathEnvVar);
+        if (pathValue == null) {
+            pathValue = Utils.TEST_CLASSES;
+        } else {
+            pathValue = pathValue + pathSep + Utils.TEST_CLASSES;
+        }
+        env.put(pathEnvVar, pathValue);
+
+        ProcessTools.executeCommand(pb)
+                .shouldHaveExitValue(0);
+    }
+}
--- a/test/jdk/com/sun/jdi/PrivateTransportTest.sh	Wed Oct 03 15:54:35 2018 +0200
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,208 +0,0 @@
-#!/bin/ksh -p
-
-#
-# Copyright (c) 2005, 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       PrivateTransportTest.sh
-#   @bug        6225664 6220618
-#   @summary    Test for when private transport library outside jdk
-#   @author     Kelly O'Hair
-#
-#   @run compile -g HelloWorld.java
-#   @run shell PrivateTransportTest.sh
-#
-
-# Beginning of subroutines:
-status=1
-
-#Call this from anywhere to fail the test with an error message
-# usage: fail "reason why the test failed"
-fail() 
- { echo "The test failed :-("
-   echo "$*" 1>&2
-   echo "exit status was $status"
-   exit $status
- } #end of fail()
-
-#Call this from anywhere to pass the test with a message
-# usage: pass "reason why the test passed if applicable"
-pass() 
- { echo "The test passed!!!"
-   echo "$*" 1>&2
-   exit 0
- } #end of pass()
-
-# end of subroutines
-
-# The beginning of the script proper
-
-TARGETCLASS="HelloWorld"
-if [ -z "${TESTJAVA}" ] ; then
-   # TESTJAVA is not set, so the test is running stand-alone.
-   # TESTJAVA holds the path to the root directory of the build of the JDK
-   # to be tested.  That is, any java files run explicitly in this shell
-   # should use TESTJAVA in the path to the java interpreter.
-   # So, we'll set this to the JDK spec'd on the command line.  If none
-   # is given on the command line, tell the user that and use a default.
-   # THIS IS THE JDK BEING TESTED.
-   if [ -n "$1" ] ; then
-         TESTJAVA=$1
-      else
-         TESTJAVA=$JAVA_HOME
-   fi
-   TESTSRC=.
-   TESTCLASSES=.
-   #Deal with .class files:
-   ${TESTJAVA}/bin/javac -d ${TESTCLASSES} \
-            -classpath "${TESTCLASSES}" -g \
-            ${TARGETCLASS}.java
-fi
-#
-echo "JDK under test is: $TESTJAVA"
-
-# Get flags being sent to debuggee
-DEBUGGEEFLAGS=$TESTVMOPTS $TESTJAVAOPTS
-
-# Figure out what the libarch path is
-os=`uname -s`
-
-jreloc=${TESTJAVA}/jre
-if [ ! -d ${jreloc} ] ; then
-    jreloc=${TESTJAVA}
-fi
-
-libdir=${TESTCLASSES}
-
-is_windows=false
-is_cygwin=false
-case `uname -s` in 
-  SunOS|Linux|AIX)
-    xx=`find ${jreloc}/lib -name libdt_socket.so`
-    libloc=`dirname ${xx}`
-    ;;
-  Darwin)
-    libloc=${jreloc}/lib
-    ;;
-  Windows*)
-    is_windows=true
-    libloc=${jreloc}/bin
-    sep=';'
-    ;;
-  CYGWIN*)
-    is_windows=true
-    is_cygwin=true
-    libloc=${jreloc}/bin
-    sep=':'
-
-    # This is going onto PATH and cygwin needs the form
-    # /cygdrive/j/x..... for that.
-    libdir=`cygpath -u "$TESTCLASSES"`
-    ;;
-  *)
-    echo "FAILURE:  Unknown uname -s: " `uname -s`
-    exit 1
-    ;;
-esac
-
-# Create private transport library
-echo "Setup private transport library by copying an existing one and renaming"
-private_transport=private_dt_socket
-if [ -f ${libloc}/dt_socket.dll ] ; then
-    fullpath=${libdir}/${private_transport}.dll
-    rm -f ${fullpath}
-    echo cp ${libloc}/dt_socket.dll ${fullpath}
-    cp ${libloc}/dt_socket.dll ${fullpath}
-    # make sure we can find libraries in current directory
-    PATH="${PATH}${sep}${libdir}"
-    export PATH
-    echo PATH=${PATH}
-elif [ -f ${libloc}/libdt_socket.dylib ]; then
-    fullpath=${libdir}/lib${private_transport}.dylib
-    rm -f ${fullpath}
-    echo cp ${libloc}/libdt_socket.dylib ${fullpath}
-    cp ${libloc}/libdt_socket.dylib ${fullpath}
-    # make sure we can find libraries in current directory
-    if [ "${LD_LIBRARY_PATH}" = "" ] ; then
-        LD_LIBRARY_PATH=${libdir}
-    else
-        LD_LIBRARY_PATH=${LD_LIBRARY_PATH}:${libdir}
-    fi
-    export LD_LIBRARY_PATH
-    echo LD_LIBRARY_PATH=${LD_LIBRARY_PATH}
-elif [ -f ${libloc}/libdt_socket.so ] ; then
-    fullpath=${libdir}/lib${private_transport}.so
-    rm -f ${fullpath}
-    echo cp ${libloc}/libdt_socket.so ${fullpath}
-    cp ${libloc}/libdt_socket.so ${fullpath}
-    # make sure we can find libraries in current directory
-    if [ "$os" = "AIX" ] ; then
-        if [ "${LIBPATH}" = "" ] ; then
-            LIBPATH=${libdir}
-        else
-            LIBPATH=${LIBPATH}:${libdir}
-        fi
-        export LIBPATH
-        echo LIBPATH=${LIBPATH}
-    else
-        if [ "${LD_LIBRARY_PATH}" = "" ] ; then
-            LD_LIBRARY_PATH=${libdir}
-        else
-            LD_LIBRARY_PATH=${LD_LIBRARY_PATH}:${libdir}
-        fi
-        export LD_LIBRARY_PATH
-        echo LD_LIBRARY_PATH=${LD_LIBRARY_PATH}
-    fi
-else 
-    echo "cannot find dt_socket in ${libloc} for ${private_transport}"
-    fail "cannot find dt_socket in ${libloc} for ${private_transport}"
-fi
-
-#
-CP="-classpath \"${TESTCLASSES}\""
-#
-if [ "$is_windows" = "true" ]; then
-    if [ "$is_cygwin" = "true" ]; then
-        win_fullpath=`cygpath -m "$fullpath" \
-            | sed -e 's#/#\\\\\\\\#g' -e 's/\.dll//'`
-    else
-        win_fullpath=`echo "$fullpath" \
-            | sed -e 's#/#\\\\\\\\#g' -e 's/\.dll//'`
-    fi
-    DEBUGGEEFLAGS="$DEBUGGEEFLAGS -agentlib:jdwp=transport=${win_fullpath},server=y,suspend=n"
-else
-    DEBUGGEEFLAGS="$DEBUGGEEFLAGS -agentlib:jdwp=transport=${private_transport},server=y,suspend=n"
-fi
-               
-echo ${TESTJAVA}/bin/java ${DEBUGGEEFLAGS} ${CP} ${TARGETCLASS}
-eval ${TESTJAVA}/bin/java ${DEBUGGEEFLAGS} ${CP} ${TARGETCLASS}
-status=$?
-echo "test status for ${DEBUGGERFLAGS} was: $status"
-if [ $status -ne 0 ] ; then 
-    fail "unspecified test failure"
-    exit 1
-fi
-
-pass "found private transport library"
-exit 0
-
--- a/test/jdk/com/sun/jdi/cds/CDSJDITest.java	Wed Oct 03 15:54:35 2018 +0200
+++ b/test/jdk/com/sun/jdi/cds/CDSJDITest.java	Wed Oct 03 16:02:24 2018 +0200
@@ -46,7 +46,7 @@
             // These first three properties are setup by jtreg, and must be passed
             // to the JDI test subprocess because it needs them in order to
             // pass them to the subprocess it will create for the debuggee. This
-            // is how the JPRT -javaopts are passed to the debggee. See
+            // is how the -javaopts are passed to the debuggee. See
             // VMConnection.getDebuggeeVMOptions().
             getPropOpt("test.classes"),
             getPropOpt("test.java.opts"),
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/jdk/com/sun/jdi/connect/WildcardPortSupport.java	Wed Oct 03 16:02:24 2018 +0200
@@ -0,0 +1,141 @@
+/*
+ * Copyright (c) 2018, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * 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 8163083
+ * @summary verifies that multiple listeners could be started using wildcard port number
+ */
+
+
+import com.sun.jdi.*;
+import com.sun.jdi.connect.*;
+
+import java.io.IOException;
+import java.io.PrintStream;
+
+import java.util.Map;
+
+public class WildcardPortSupport {
+
+    private static final String PORT_ARG = "port";
+
+    public static void main(String argv[]) throws Exception {
+        WildcardPortSupport test = new WildcardPortSupport();
+        test.runAllTests();
+    }
+
+    public void runAllTests() throws Exception {
+        ListeningConnector connector =
+                Bootstrap.virtualMachineManager().listeningConnectors().stream().
+                        filter(c -> c.name().equals("com.sun.jdi.SocketListen")).findFirst().get();
+
+        if (connector == null) {
+            throw new RuntimeException("FAILURE: no com.sun.jdi.SocketListen connectors found!");
+        }
+
+        testWithDefaultArgs1(connector);
+        testWithDefaultArgs2(connector);
+        testWithWildcardPort1(connector);
+        testWithWildcardPort2(connector);
+        testWithDefaultArgsNegative(connector);
+    }
+
+
+    // Start listeners with unspecified port number and use their bound port numbers to stop them
+    private void testWithDefaultArgs1(ListeningConnector connector) throws IOException,
+            IllegalConnectorArgumentsException {
+        int port1 = startListening(connector, connector.defaultArguments());
+        int port2 = startListening(connector, connector.defaultArguments());
+        connector.stopListening(getArgumentsMap(connector, port1));
+        connector.stopListening(getArgumentsMap(connector, port2));
+    }
+
+    // Start listeners with unspecified port number and use the original argument map instances to stop them
+    private void testWithDefaultArgs2(ListeningConnector connector) throws IOException,
+            IllegalConnectorArgumentsException {
+        Map<String, Connector.Argument> args1 = connector.defaultArguments();
+        startListening(connector, args1);
+        Map<String, Connector.Argument> args2 = connector.defaultArguments();
+        startListening(connector, args2);
+        connector.stopListening(args1);
+        connector.stopListening(args2);
+    }
+
+    // Start listeners with wildcard  port number ("0") and use their bound port numbers to stop them
+    private void testWithWildcardPort1(ListeningConnector connector) throws IOException,
+            IllegalConnectorArgumentsException {
+        int port1 = startListening(connector, getArgumentsMap(connector, 0));
+        int port2 = startListening(connector, getArgumentsMap(connector, 0));
+        connector.stopListening(getArgumentsMap(connector, port1));
+        connector.stopListening(getArgumentsMap(connector, port2));
+    }
+
+    // Start listeners with wildcard port number ("0") and use the original argument map instances to stop them
+    private void testWithWildcardPort2(ListeningConnector connector) throws IOException,
+            IllegalConnectorArgumentsException {
+        Map<String, Connector.Argument> args1 = getArgumentsMap(connector, 0);
+        startListening(connector, args1);
+        Map<String, Connector.Argument> args2 = getArgumentsMap(connector, 0);
+        startListening(connector, args2);
+        connector.stopListening(args1);
+        connector.stopListening(args2);
+    }
+
+    // Tries to start two listeners using the same instance of default argument map
+    private void testWithDefaultArgsNegative(ListeningConnector connector) throws IOException,
+            IllegalConnectorArgumentsException {
+        Map<String, Connector.Argument> args = connector.defaultArguments();
+        connector.startListening(args);
+        String port = args.get(PORT_ARG).value();
+        if (port.isEmpty() || "0".equals(port)) {
+            throw new RuntimeException("Test testWithDefaultArgsNegative failed." +
+                    " The argument map was not updated with the bound port number.");
+        }
+        try {
+            // This call should fail since the previous the argument map is
+            // already updated with the port number of the started listener
+            connector.startListening(args);
+        } catch (IllegalConnectorArgumentsException ex) {
+            System.out.println("Expected exception caught" + ex.getMessage());
+            return;
+        } finally {
+            connector.stopListening(args);
+        }
+        throw new RuntimeException("Test testWithDefaultArgsNegative failed. No expected " +
+                "com.sun.jdi.IllegalConnectorArgumentsException exception was thrown.");
+    }
+
+    private int startListening(ListeningConnector connector, Map<String, Connector.Argument> args)
+            throws IOException, IllegalConnectorArgumentsException {
+        String address = connector.startListening(args);
+        return Integer.valueOf(address.split(":")[1]);
+    }
+
+
+    private Map<String, Connector.Argument> getArgumentsMap(ListeningConnector connector, int port) {
+        Map<String, Connector.Argument> args = connector.defaultArguments();
+        Connector.Argument arg = args.get(PORT_ARG);
+        arg.setValue(String.valueOf(port));
+        return args;
+    }
+}
--- a/test/jdk/com/sun/jdi/connect/spi/JdiLoadedByCustomLoader.java	Wed Oct 03 15:54:35 2018 +0200
+++ b/test/jdk/com/sun/jdi/connect/spi/JdiLoadedByCustomLoader.java	Wed Oct 03 16:02:24 2018 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2004, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2004, 2018, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -22,22 +22,49 @@
  */
 
 /*
+ * @test
+ * @bug 5055681
+ * @summary Test loading JDI classes via custom class loader
+ *
+ * @library /test/lib
+ * @build JdiLoadedByCustomLoader
+ * @run main/othervm JdiLoadedByCustomLoader
+ */
+
+/*
  * Creates a URLClassLoader from a file URL. The file URL
  * is constructed from the given argument. Once created the test
  * attempts to load another test case (ListConnectors)
  * using the class loader and then it invokes the list()
  * method.
  */
+import jdk.test.lib.Utils;
+import jdk.test.lib.compiler.CompilerUtils;
+
 import java.net.URL;
 import java.net.URLClassLoader;
 import java.io.File;
 import java.lang.reflect.Method;
+import java.nio.file.Path;
+import java.nio.file.Paths;
 
 public class JdiLoadedByCustomLoader {
 
     public static void main(String args[]) throws Exception {
+        // Compile the list connectors class into a directory that isn't on
+        // any class path.
+        Path src = Paths.get(Utils.TEST_SRC).toAbsolutePath().resolve("ListConnectors.java");
+        Path newClassDir = Paths.get(Utils.TEST_CLASSES).toAbsolutePath().resolve("someotherdir");
+        if (!CompilerUtils.compile(src, newClassDir, false, "-classpath", Utils.TEST_CLASSES)) {
+            throw new RuntimeException("failed to compile " + src);
+        }
+
+        test(newClassDir.toString());
+    }
+
+    private static void test(String classPath) throws Exception {
         // create files from given arguments and tools.jar
-        File f1 = new File(args[0]);
+        File f1 = new File(classPath);
 
         // create class loader
         URL[] urls = { f1.toURL() };
--- a/test/jdk/com/sun/jdi/connect/spi/JdiLoadedByCustomLoader.sh	Wed Oct 03 15:54:35 2018 +0200
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,77 +0,0 @@
-#
-# Copyright (c) 2004, 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 5055681
-# @summary Test loading JDI classes via custom class loader
-
-if [ "${TESTJAVA}" = "" ]
-then
-  echo "TESTJAVA not set.  Test cannot execute.  Failed."
-  exit 1
-fi
-
-if [ "${TESTSRC}" = "" ]
-then
-  echo "TESTSRC not set.  Test cannot execute.  Failed."
-  exit 1
-fi
-
-if [ "${TESTCLASSES}" = "" ]
-then
-  echo "TESTCLASSES not set.  Test cannot execute.  Failed."
-  exit 1
-fi
-
-OS=`uname -s`
-case "$OS" in
-  SunOS | Linux | Darwin | AIX )
-    PS=":"
-    ;;
-  Windows* | CYGWIN*)
-    PS=";"
-    ;;
-  * )
-    echo "Unrecognized system!"
-    exit 1;
-    ;;
-esac
-
-JAVAC="${TESTJAVA}"/bin/javac
-JAVA="${TESTJAVA}"/bin/java
-SOMEOTHERDIR="${TESTCLASSES}"/someotherdir
-
-# Compile test into the classes directory
-# Compile the list connectors class into a directory that isn't on
-# any class path.
-
-$JAVAC -d "${TESTCLASSES}" "${TESTSRC}"/JdiLoadedByCustomLoader.java
-
-mkdir "${SOMEOTHERDIR}"
-$JAVAC -d "${SOMEOTHERDIR}" -classpath "${TESTSRC}" \
-    "${TESTSRC}"/ListConnectors.java
-
-# Run the test
-
-"${JAVA}" -classpath "${TESTCLASSES}" JdiLoadedByCustomLoader \
-    "${SOMEOTHERDIR}"
--- a/test/jdk/com/sun/jdi/redefine/RedefineSetUp.sh	Wed Oct 03 15:54:35 2018 +0200
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,68 +0,0 @@
-#!/bin/sh
-
-#
-# Copyright (c) 2001, 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.
-#
-
-
-#
-#
-#
-
-if [ "${TESTSRC}" = "" ]
-then
-  echo "TESTSRC not set.  Test cannot execute.  Failed."
-  exit 1
-fi
-echo "TESTSRC=${TESTSRC}"
-
-if [ "${TESTJAVA}" = "" ]
-then
-  echo "TESTJAVA not set.  Test cannot execute.  Failed."
-  exit 1
-fi
-echo "TESTJAVA=${TESTJAVA}"
-
-if [ "${TESTCLASSES}" = "" ]
-then
-  echo "TESTCLASSES not set.  Test cannot execute.  Failed."
-  exit 1
-fi
-
-echo "TESTCLASSES=${TESTCLASSES}"
-echo "CLASSPATH=${CLASSPATH}"
-
-JAVAC="${TESTJAVA}/bin/javac -g"
-
-cp ${TESTSRC}/Different_RedefineSubTarg.java RedefineSubTarg.java
-${JAVAC} RedefineSubTarg.java
-mv RedefineSubTarg.class Different_RedefineSubTarg.class
-rm -f RedefineSubTarg.java
-
-cp ${TESTSRC}/SchemaChange_RedefineSubTarg.java RedefineSubTarg.java
-${JAVAC} RedefineSubTarg.java
-mv RedefineSubTarg.class SchemaChange_RedefineSubTarg.class
-rm -f RedefineSubTarg.java
-
-cp ${TESTSRC}/RedefineSubTarg.java RedefineSubTarg.java
-${JAVAC} RedefineSubTarg.java
-rm -f RedefineSubTarg.java
--- a/test/jdk/com/sun/jdi/redefine/RedefineTest.java	Wed Oct 03 15:54:35 2018 +0200
+++ b/test/jdk/com/sun/jdi/redefine/RedefineTest.java	Wed Oct 03 16:02:24 2018 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2001, 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2001, 2018, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -31,15 +31,22 @@
  * @author Robert Field
  *
  * @library ..
+ * @library /test/lib
  *
  * @run build TestScaffold VMConnection TargetListener TargetAdapter
  * @run compile -g RedefineTest.java
- * @run shell RedefineSetUp.sh
  * @run driver RedefineTest
  */
 import com.sun.jdi.*;
 import com.sun.jdi.event.*;
 import com.sun.jdi.request.*;
+import jdk.test.lib.Utils;
+import jdk.test.lib.compiler.InMemoryJavaCompiler;
+
+import java.nio.charset.StandardCharsets;
+import java.nio.file.Files;
+import java.nio.file.Path;
+import java.nio.file.Paths;
 import java.util.*;
 import java.io.*;
 
@@ -268,9 +275,25 @@
         return;
     }
 
+    // prepares .class file for redefined RedefineSubTarg class:
+    // - compiles <fileName>.java from test source dir;
+    // - saves compiled class <fileName>.class.
+    protected void prepareRedefinedClass(String fileName) throws Exception {
+        Path srcJavaFile = Paths.get(Utils.TEST_SRC).resolve(fileName + ".java");
+        Path dstClassFile = Paths.get(".").resolve(fileName + ".class");
+        byte[] compiledData = InMemoryJavaCompiler.compile("RedefineSubTarg",
+                new String(Files.readAllBytes(srcJavaFile), StandardCharsets.UTF_8),
+                "-g");
+        Files.write(dstClassFile, compiledData);
+    }
+
     /********** test core **********/
 
     protected void runTests() throws Exception {
+        // prepare redefined .class files
+        prepareRedefinedClass("Different_RedefineSubTarg");
+        prepareRedefinedClass("SchemaChange_RedefineSubTarg");
+        prepareRedefinedClass("RedefineSubTarg");
 
         BreakpointEvent bpe = startToMain("RedefineTarg");
         targetClass = bpe.location().declaringType();
--- a/test/jdk/com/sun/jdi/redefineMethod/RedefineSetUp.sh	Wed Oct 03 15:54:35 2018 +0200
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,62 +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.
-#
-
-
-#
-#
-#
-
-if [ "${TESTSRC}" = "" ]
-then
-  echo "TESTSRC not set.  Test cannot execute.  Failed."
-  exit 1
-fi
-echo "TESTSRC=${TESTSRC}"
-
-if [ "${TESTJAVA}" = "" ]
-then
-  echo "TESTJAVA not set.  Test cannot execute.  Failed."
-  exit 1
-fi
-echo "TESTJAVA=${TESTJAVA}"
-
-if [ "${TESTCLASSES}" = "" ]
-then
-  echo "TESTCLASSES not set.  Test cannot execute.  Failed."
-  exit 1
-fi
-echo "TESTCLASSES=${TESTCLASSES}"
-echo "CLASSPATH=${CLASSPATH}"
-
-JAVAC="${TESTJAVA}/bin/javac"
-
-cp ${TESTSRC}/Different_RedefineSubTarg.java RedefineSubTarg.java
-${JAVAC} -g RedefineSubTarg.java
-mv RedefineSubTarg.class Different_RedefineSubTarg.class
-rm -f RedefineSubTarg.java
-
-cp ${TESTSRC}/RedefineSubTarg.java RedefineSubTarg.java
-${JAVAC} -g RedefineSubTarg.java
-rm -f RedefineSubTarg.java
--- a/test/jdk/com/sun/jdi/redefineMethod/RedefineTest.java	Wed Oct 03 15:54:35 2018 +0200
+++ b/test/jdk/com/sun/jdi/redefineMethod/RedefineTest.java	Wed Oct 03 16:02:24 2018 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2002, 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2002, 2018, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -28,16 +28,23 @@
  * @author Robert Field
  *
  * @library ..
+ * @library /test/lib
  *
  * @run build TestScaffold VMConnection TargetListener TargetAdapter
  * @run compile -g RedefineTest.java
- * @run shell RedefineSetUp.sh
  * @run driver RedefineTest -repeat 3
  * @run driver RedefineTest
  */
 import com.sun.jdi.*;
 import com.sun.jdi.event.*;
 import com.sun.jdi.request.*;
+import jdk.test.lib.Utils;
+import jdk.test.lib.compiler.InMemoryJavaCompiler;
+
+import java.nio.charset.StandardCharsets;
+import java.nio.file.Files;
+import java.nio.file.Path;
+import java.nio.file.Paths;
 import java.util.*;
 import java.io.*;
 
@@ -205,15 +212,9 @@
     }
 
 
-    void doRedefine(String fileName) throws Exception {
-        File phyl = new File(fileName);
-        byte[] bytes = new byte[(int)phyl.length()];
-        InputStream in = new FileInputStream(phyl);
-        in.read(bytes);
-        in.close();
-
+    void doRedefine(byte[] compiledClass) throws Exception {
         Map map = new HashMap();
-        map.put(findReferenceType("RedefineSubTarg"), bytes);
+        map.put(findReferenceType("RedefineSubTarg"), compiledClass);
 
         try {
             for (int i = 0; i < redefineRepeat; ++i) {
@@ -240,9 +241,18 @@
         }
     }
 
+    private byte[] compileRedefinedClass(String srcJavaFile) throws Exception {
+        Path src = Paths.get(Utils.TEST_SRC).resolve(srcJavaFile);
+        return InMemoryJavaCompiler.compile("RedefineSubTarg",
+                new String(Files.readAllBytes(src), StandardCharsets.UTF_8),
+                "-g", "-classpath", Utils.TEST_CLASSES);
+    }
+
     /********** test core **********/
 
     protected void runTests() throws Exception {
+        byte[] compiled_Different_RedefineSubTarg = compileRedefinedClass("Different_RedefineSubTarg.java");
+        byte[] compiled_RedefineSubTarg = compileRedefinedClass("RedefineSubTarg.java");
 
         startToMain("RedefineTarg");
 
@@ -252,7 +262,7 @@
         checkFrames(thread, before);
 
         println("------ After Redefine ------");
-        doRedefine("Different_RedefineSubTarg.class");
+        doRedefine(compiled_Different_RedefineSubTarg);
         checkFrames(thread, after);
 
         println("------ Static 2 ------");
@@ -268,7 +278,7 @@
         checkFrames(thread, refresh);
 
         println("------ Breakpoints ------");
-        doRedefine("RedefineSubTarg.class");
+        doRedefine(compiled_RedefineSubTarg);
         for (int i = 0; i < bps.length; ++i) {
             setBP(bps[i]);
         }
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/jdk/java/awt/Frame/CycleThroughFrameTest/CycleThroughFrameTest.java	Wed Oct 03 16:02:24 2018 +0200
@@ -0,0 +1,142 @@
+/*
+ * Copyright (c) 2018, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * 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
+  @key headful
+  @bug 8206392
+  @requires (os.family == "mac")
+  @summary Cycle through frames using keyboard shortcut doesn't work on Mac
+  @compile CycleThroughFrameTest.java
+  @run main/manual CycleThroughFrameTest
+*/
+
+import java.awt.Frame;
+import java.awt.Button;
+import java.awt.TextArea;
+import java.awt.FlowLayout;
+import javax.swing.JFrame;
+import javax.swing.SwingUtilities;
+
+public class CycleThroughFrameTest {
+
+    public static final int maxFrames = 5;
+    private static JFrame[] frame;
+    private static Frame instructionFrame;
+    private static volatile boolean testContinueFlag = true;
+
+    private static final String TEST_INSTRUCTIONS =
+        " This is a manual test\n\n" +
+        " 1) Configure Keyboard shortcut if not done in your system:\n" +
+        " 2) Open System Preferences, go to -> Keyboard -> Shortcuts -> Keyboard\n" +
+        " 3) Enable 'Move focus to next window' if disabled\n" +
+        " 4) Enable 'Move focus to next window drawer' if disabled\n" +
+        " 5) Close System Preferences\n" +
+        " 5) Press COMMAND + ` keys to cycle through frames in forward order\n" +
+        " 6) Press FAIL if focus doesn't move to next frame\n" +
+        " 7) Press COMMAND + SHIFT + ` to cycle through frames in reverse order\n" +
+        " 8) Press FAIL if focus doesn't move to next frame in reverse order\n" +
+        " 9) Press PASS otherwise";
+
+    private static final String FAIL_MESSAGE = "Focus doesn't move to next frame";
+
+    public void showJFrame(int frameNumber) {
+
+        String title = "Frame " + frameNumber;
+        frame[frameNumber] = new JFrame(title);
+        frame[frameNumber].setSize(300, 200);
+        frame[frameNumber].setLocation(50+(frameNumber*20), 50+(frameNumber*20));
+        frame[frameNumber].setVisible(true);
+    }
+
+    private void createAndShowFrame() throws Exception {
+        SwingUtilities.invokeAndWait(new Runnable() {
+            public void run() {
+                frame = new JFrame[maxFrames];
+                for (int i = 0; i < maxFrames; i++) {
+                    showJFrame(i);
+                }
+            }
+        });
+    }
+
+    public void createAndShowInstructionFrame() {
+        Button passButton = new Button("Pass");
+        passButton.setEnabled(true);
+
+        Button failButton = new Button("Fail");
+        failButton.setEnabled(true);
+
+        TextArea instructions = new TextArea(12, 70);
+        instructions.setText(TEST_INSTRUCTIONS);
+
+        instructionFrame = new Frame("Test Instructions");
+        instructionFrame.add(passButton);
+        instructionFrame.add(failButton);
+        instructionFrame.add(instructions);
+        instructionFrame.setSize(200,200);
+        instructionFrame.setLayout(new FlowLayout());
+        instructionFrame.pack();
+        instructionFrame.setVisible(true);
+
+        passButton.addActionListener(ae -> {
+            dispose();
+            testContinueFlag = false;
+        });
+
+        failButton.addActionListener(ae -> {
+            dispose();
+            testContinueFlag = false;
+            throw new RuntimeException(FAIL_MESSAGE);
+        });
+    }
+
+    private static void dispose() {
+        for (int i = 0; i < maxFrames; i++) {
+            frame[i].dispose();
+        }
+        instructionFrame.dispose();
+    }
+
+    public static void main(String[] args)  throws Exception {
+
+        CycleThroughFrameTest testObj = new CycleThroughFrameTest();
+        testObj.createAndShowFrame();
+        testObj.createAndShowInstructionFrame();
+
+        final int sleepTime = 300000;
+        final int sleepLoopTime = 1000;
+        int remainingSleepTime = sleepTime;
+        while(remainingSleepTime > 0 && testContinueFlag) {
+            Thread.sleep(sleepLoopTime);
+            remainingSleepTime -= sleepLoopTime;
+        }
+
+        if (testContinueFlag) {
+            dispose();
+            throw new RuntimeException("Timed out after " +
+                    (sleepTime - remainingSleepTime) / 1000 + " seconds");
+        }
+    }
+}
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/jdk/java/awt/MenuBar/TestNoScreenMenuBar.java	Wed Oct 03 16:02:24 2018 +0200
@@ -0,0 +1,185 @@
+/*
+ * Copyright (c) 2018, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * 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.
+ */
+
+/**
+ * @test
+ * @key headful
+ * @bug 8146310
+ * @summary [macosx] setDefaultMenuBar does not initialize screen menu bar
+ * @author Alan Snyder
+ * @run main/othervm TestNoScreenMenuBar
+ * @requires (os.family == "mac")
+ */
+
+import java.awt.AWTException;
+import java.awt.Desktop;
+import java.awt.Robot;
+import java.awt.event.InputEvent;
+import java.io.IOException;
+import java.lang.reflect.InvocationTargetException;
+import javax.swing.JMenu;
+import javax.swing.JMenuBar;
+import javax.swing.JMenuItem;
+import javax.swing.SwingUtilities;
+
+public class TestNoScreenMenuBar
+{
+    static TestNoScreenMenuBar theTest;
+    private Robot robot;
+    private boolean isApplicationOpened;
+    private boolean isActionPerformed;
+
+    public TestNoScreenMenuBar(String[] args)
+    {
+        try {
+            robot = new Robot();
+            robot.setAutoDelay(50);
+        } catch (AWTException ex) {
+            throw new RuntimeException(ex);
+        }
+
+        if (!(args.length > 0 && args[0].equals("baseline"))) {
+            // activate another application
+            openOtherApplication();
+            robot.delay(500);
+        }
+
+        // The failure mode is installing the default menu bar while the application is inactive
+        Desktop desktop = Desktop.getDesktop();
+        desktop.setDefaultMenuBar(createMenuBar());
+
+        robot.delay(500);
+        desktop.requestForeground(true);
+        robot.delay(500);
+    }
+
+    JMenuBar createMenuBar()
+    {
+        JMenuBar mb = new JMenuBar();
+        // A very long name makes it more likely that the robot will hit the menu
+        JMenu menu = new JMenu("TestTestTestTestTestTestTestTestTestTest");
+        mb.add(menu);
+        JMenuItem item = new JMenuItem("TestTestTestTestTestTestTestTestTestTest");
+        item.addActionListener(ev -> {
+            isActionPerformed = true;
+        });
+        menu.add(item);
+        return mb;
+    }
+
+    void dispose()
+    {
+        closeOtherApplication();
+        Desktop.getDesktop().setDefaultMenuBar(null);
+    }
+
+    private void performMenuItemTest()
+    {
+        // Find the menu on the screen menu bar
+        // The location depends upon the application name which is the name of the first menu.
+        // Unfortunately, the application name can vary based on how the application is run.
+        // The work around is to make the menu and the menu item names very long.
+
+        int menuBarX = 250;
+        int menuBarY = 11;
+        int menuItemX = menuBarX;
+        int menuItemY = 34;
+
+        robot.mouseMove(menuBarX, menuBarY);
+        robot.delay(100);
+        robot.mousePress(InputEvent.BUTTON1_DOWN_MASK);
+        robot.delay(100);
+        robot.mouseMove(menuItemX, menuItemY);
+        robot.delay(100);
+        robot.mouseRelease(InputEvent.BUTTON1_DOWN_MASK);
+        robot.waitForIdle();
+
+        waitForAction();
+    }
+
+    private synchronized void waitForAction()
+    {
+        try {
+            for (int i = 0; i < 10; i++) {
+                if (isActionPerformed) {
+                    return;
+                }
+                wait(100);
+            }
+        } catch (InterruptedException ex) {
+        }
+        throw new RuntimeException("Test failed: menu item action was not performed");
+    }
+
+    private void openOtherApplication() {
+        String[] cmd = { "/usr/bin/open", "/Applications/System Preferences.app" };
+        execute(cmd);
+        isApplicationOpened = true;
+    }
+
+    private void closeOtherApplication() {
+        if (isApplicationOpened) {
+            String[] cmd = { "/usr/bin/osascript", "-e", "tell application \"System Preferences\" to close window 1" };
+            execute(cmd);
+        }
+    }
+
+    private void execute(String[] cmd) {
+        try {
+            Process p = Runtime.getRuntime().exec(cmd);
+            p.waitFor();
+        } catch (IOException | InterruptedException ex) {
+            throw new RuntimeException("Unable to execute command");
+        }
+    }
+
+    private static void runSwing(Runnable r)
+    {
+        try {
+            SwingUtilities.invokeAndWait(r);
+        } catch (InterruptedException e) {
+        } catch (InvocationTargetException e) {
+            throw new RuntimeException(e);
+        }
+    }
+
+    public static void main(String[] args)
+    {
+        if (!System.getProperty("os.name").contains("OS X")) {
+            System.out.println("This test is for MacOS only. Automatically passed on other platforms.");
+            return;
+        }
+
+        System.setProperty("apple.laf.useScreenMenuBar", "true");
+        try {
+            runSwing(() -> theTest = new TestNoScreenMenuBar(args));
+            theTest.performMenuItemTest();
+        } finally {
+            if (theTest != null) {
+                runSwing(() -> theTest.dispose());
+            }
+        }
+    }
+}
--- a/test/jdk/java/awt/Mixing/AWT_Mixing/FrameBorderCounter.java	Wed Oct 03 15:54:35 2018 +0200
+++ b/test/jdk/java/awt/Mixing/AWT_Mixing/FrameBorderCounter.java	Wed Oct 03 16:02:24 2018 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2014, 2018, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -20,15 +20,14 @@
  * or visit www.oracle.com if you need additional information or have any
  * questions.
  */
+
 import java.awt.Dimension;
 import java.awt.EventQueue;
 import java.awt.Frame;
 import java.awt.Point;
 import java.awt.Robot;
+import java.awt.event.MouseAdapter;
 import java.awt.event.MouseEvent;
-import java.awt.event.MouseAdapter;
-import java.awt.event.WindowEvent;
-import java.awt.event.WindowAdapter;
 
 public class FrameBorderCounter {
 
@@ -59,6 +58,7 @@
                 background.setVisible(true);
             }
         });
+        robot.waitForIdle();
         EventQueue.invokeAndWait(new Runnable() {
             public void run() {
                 frame = new Frame("Frame");
--- a/test/jdk/java/awt/Mixing/AWT_Mixing/OpaqueOverlappingChoice.java	Wed Oct 03 15:54:35 2018 +0200
+++ b/test/jdk/java/awt/Mixing/AWT_Mixing/OpaqueOverlappingChoice.java	Wed Oct 03 16:02:24 2018 +0200
@@ -33,8 +33,7 @@
  * @bug 6994264
  * @summary Opaque overlapping test for Choice AWT component
  * @library /java/awt/patchlib  ../../regtesthelpers
- * @modules java.desktop/com.sun.awt
- *          java.desktop/java.awt.peer
+ * @modules java.desktop/java.awt.peer
  *          java.desktop/sun.awt
  * @build java.desktop/java.awt.Helper
  * @build Util
--- a/test/jdk/java/awt/Toolkit/ScreenInsetsTest/ScreenInsetsTest.java	Wed Oct 03 15:54:35 2018 +0200
+++ b/test/jdk/java/awt/Toolkit/ScreenInsetsTest/ScreenInsetsTest.java	Wed Oct 03 16:02:24 2018 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2006, 2016, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2006, 2018, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -32,8 +32,13 @@
   @run main ScreenInsetsTest
 */
 
-import java.awt.*;
-import java.awt.event.*;
+import java.awt.Frame;
+import java.awt.GraphicsConfiguration;
+import java.awt.GraphicsDevice;
+import java.awt.GraphicsEnvironment;
+import java.awt.Insets;
+import java.awt.Rectangle;
+import java.awt.Toolkit;
 
 import test.java.awt.regtesthelpers.Util;
 
@@ -41,21 +46,33 @@
 {
     public static void main(String[] args)
     {
-        if (!Toolkit.getDefaultToolkit().isFrameStateSupported(Frame.MAXIMIZED_BOTH))
-        {
-            // this state is used in the test - sorry
-            return;
-        }
-
         boolean passed = true;
 
         GraphicsEnvironment ge = GraphicsEnvironment.getLocalGraphicsEnvironment();
         GraphicsDevice[] gds = ge.getScreenDevices();
-        for (GraphicsDevice gd : gds)
-        {
+        for (GraphicsDevice gd : gds) {
+
             GraphicsConfiguration gc = gd.getDefaultConfiguration();
             Rectangle gcBounds = gc.getBounds();
             Insets gcInsets = Toolkit.getDefaultToolkit().getScreenInsets(gc);
+            int left = gcInsets.left;
+            int right = gcInsets.right;
+            int bottom = gcInsets.bottom;
+            int top = gcInsets.top;
+            if (left < 0 || right < 0 || bottom < 0 || top < 0) {
+                throw new RuntimeException("Negative value: " + gcInsets);
+            }
+            int maxW = gcBounds.width / 3;
+            int maxH = gcBounds.height / 3;
+            if (left > maxW || right > maxW || bottom > maxH || top > maxH) {
+                throw new RuntimeException("Big value: " + gcInsets);
+            }
+
+            if (!Toolkit.getDefaultToolkit().isFrameStateSupported(Frame.MAXIMIZED_BOTH))
+            {
+                // this state is used in the test - sorry
+                continue;
+            }
 
             Frame f = new Frame("Test", gc);
             f.setUndecorated(true);
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/jdk/java/awt/Window/WindowOwnedByEmbeddedFrameTest/WindowOwnedByEmbeddedFrameTest.java	Wed Oct 03 16:02:24 2018 +0200
@@ -0,0 +1,106 @@
+/*
+ * Copyright (c) 2018, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * 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
+ * @key headful
+ * @bug 8130655
+ * @summary Tests that window owned by EmbeddedFrame can receive keyboard input
+ * @requires (os.family == "mac")
+ * @modules java.desktop/sun.awt
+ * @library ../../regtesthelpers
+ * @build Util
+ * @run main WindowOwnedByEmbeddedFrameTest
+ */
+
+import sun.awt.EmbeddedFrame;
+
+import java.awt.Robot;
+import java.awt.TextField;
+import java.awt.Window;
+import java.awt.event.KeyEvent;
+
+import test.java.awt.regtesthelpers.Util;
+
+public class WindowOwnedByEmbeddedFrameTest {
+    private static TextField textField;
+    private static EmbeddedFrame embeddedFrame;
+    private static Window window;
+
+    public static void main(String[] args) {
+        try {
+            Robot robot = Util.createRobot();
+            robot.setAutoDelay(50);
+
+            embeddedFrame = createEmbeddedFrame();
+
+            textField = new TextField("");
+
+            window = new Window(embeddedFrame);
+            window.setSize(200, 200);
+            window.setLocationRelativeTo(null);
+            window.add(textField);
+            window.setVisible(true);
+
+            Util.waitForIdle(robot);
+
+            Util.clickOnComp(textField, robot);
+            Util.waitForIdle(robot);
+
+            robot.keyPress(KeyEvent.VK_T);
+            robot.keyRelease(KeyEvent.VK_T);
+            Util.waitForIdle(robot);
+
+            robot.keyPress(KeyEvent.VK_E);
+            robot.keyRelease(KeyEvent.VK_E);
+            Util.waitForIdle(robot);
+
+            robot.keyPress(KeyEvent.VK_S);
+            robot.keyRelease(KeyEvent.VK_S);
+            Util.waitForIdle(robot);
+
+            robot.keyPress(KeyEvent.VK_T);
+            robot.keyRelease(KeyEvent.VK_T);
+            Util.waitForIdle(robot);
+
+            if ("".equals(textField.getText())) {
+                throw new RuntimeException("Keyboard input in text field isn't possible");
+            }
+        } finally {
+            if (embeddedFrame != null) {
+                embeddedFrame.dispose();
+            }
+            if (window != null) {
+                window.dispose();
+            }
+        }
+    }
+
+    private static EmbeddedFrame createEmbeddedFrame() {
+        try {
+            return (EmbeddedFrame) Class.forName("sun.lwawt.macosx.CEmbeddedFrame").newInstance();
+        } catch (Exception e) {
+            throw new RuntimeException("Cannot create EmbeddedFrame", e);
+        }
+    }
+}
+
--- a/test/jdk/java/awt/dnd/BadSerializaionTest/BadSerializationTest.java	Wed Oct 03 15:54:35 2018 +0200
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,76 +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.
- */
-
-/**
- * @test
- * @key headful
- * @bug 8030050
- * @summary Validate fields on DnD class deserialization
- * @author petr.pchelko@oracle.com
- */
-
-import java.io.File;
-import java.io.FileInputStream;
-import java.io.IOException;
-import java.io.InvalidObjectException;
-import java.io.ObjectInputStream;
-import java.util.stream.Stream;
-
-public class BadSerializationTest {
-
-    private static final String[] badSerialized = new String[] {
-            "badAction",
-            "noEvents",
-            "nullComponent",
-            "nullDragSource",
-            "nullOrigin"
-    };
-
-    private static final String goodSerialized = "good";
-
-    public static void main(String[] args) throws Exception {
-        String testSrc = System.getProperty("test.src") + File.separator;
-        testReadObject(testSrc + goodSerialized, false);
-        Stream.of(badSerialized).forEach(file -> testReadObject(testSrc + file, true));
-    }
-
-    private static void testReadObject(String filename, boolean expectException) {
-        Exception exceptionCaught = null;
-        try (FileInputStream fileInputStream = new FileInputStream(filename);
-             ObjectInputStream ois = new ObjectInputStream(fileInputStream)) {
-            ois.readObject();
-        } catch (InvalidObjectException e) {
-            exceptionCaught = e;
-        } catch (IOException e) {
-            throw new RuntimeException("FAILED: IOException", e);
-        } catch (ClassNotFoundException e) {
-            throw new RuntimeException("FAILED: ClassNotFoundException", e);
-        }
-        if (exceptionCaught != null && !expectException) {
-            throw new RuntimeException("FAILED: UnexpectedException", exceptionCaught);
-        }
-        if (exceptionCaught == null && expectException) {
-            throw new RuntimeException("FAILED: Invalid object was created with no exception");
-        }
-    }
-}
Binary file test/jdk/java/awt/dnd/BadSerializaionTest/badAction has changed
Binary file test/jdk/java/awt/dnd/BadSerializaionTest/good has changed
Binary file test/jdk/java/awt/dnd/BadSerializaionTest/noEvents has changed
Binary file test/jdk/java/awt/dnd/BadSerializaionTest/nullComponent has changed
Binary file test/jdk/java/awt/dnd/BadSerializaionTest/nullDragSource has changed
Binary file test/jdk/java/awt/dnd/BadSerializaionTest/nullOrigin has changed
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/jdk/java/awt/dnd/BadSerializationTest/BadSerializationTest.java	Wed Oct 03 16:02:24 2018 +0200
@@ -0,0 +1,168 @@
+/*
+ * Copyright (c) 2014, 2018, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * 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
+ * @key headful
+ * @bug 8030050 8039082
+ * @summary Validate fields on DnD class deserialization
+ */
+
+import java.awt.Point;
+import java.awt.dnd.DragGestureEvent;
+import java.awt.dnd.DragGestureRecognizer;
+import java.awt.dnd.DragSource;
+import java.awt.event.InputEvent;
+import java.awt.event.KeyEvent;
+import java.io.File;
+import java.io.FileInputStream;
+import java.io.FileOutputStream;
+import java.io.IOException;
+import java.io.InvalidObjectException;
+import java.io.ObjectInputStream;
+import java.io.ObjectOutputStream;
+import java.util.ArrayList;
+import java.util.stream.Stream;
+
+import javax.swing.JPanel;
+
+import static java.awt.dnd.DnDConstants.ACTION_COPY;
+
+public class BadSerializationTest {
+
+    private static final String[] badSerialized = new String[] {
+            "badAction",
+            "noEvents",
+            "nullComponent",
+            "nullDragSource",
+            "nullOrigin"
+    };
+
+    private static final String goodSerialized = "good";
+
+    public static void main(String[] args) throws Exception {
+        if (args.length > 0 && args[0].equals("-write")) {
+            writeObjects(); //Creates the binary files for the test.
+        } else {
+            String testSrc = System.getProperty("test.src") + File.separator;
+            testReadObject(testSrc + goodSerialized, false);
+            Stream.of(badSerialized).forEach(
+                    file -> testReadObject(testSrc + file, true));
+        }
+    }
+
+    private static void testReadObject(String filename, boolean expectException) {
+        Exception exceptionCaught = null;
+        try (FileInputStream fileInputStream = new FileInputStream(filename);
+             ObjectInputStream ois = new ObjectInputStream(fileInputStream)) {
+            ois.readObject();
+        } catch (InvalidObjectException e) {
+            exceptionCaught = e;
+        } catch (IOException e) {
+            throw new RuntimeException("FAILED: IOException", e);
+        } catch (ClassNotFoundException e) {
+            throw new RuntimeException("FAILED: ClassNotFoundException", e);
+        }
+        if (exceptionCaught != null && !expectException) {
+            throw new RuntimeException("FAILED: UnexpectedException", exceptionCaught);
+        }
+        if (exceptionCaught == null && expectException) {
+            throw new RuntimeException("FAILED: Invalid object was created with no exception");
+        }
+    }
+
+    /**
+     * Creates the stubs for the test. It is necessary to disable all checks in
+     * the constructors of DragGestureEvent/DragGestureRecognizer before run.
+     */
+    private static void writeObjects() throws Exception {
+        ArrayList<InputEvent> evs = new ArrayList<>();
+        Point ori = new Point();
+
+        write(new DragGestureEvent(new NothingNull(), ACTION_COPY, ori, evs),
+              "noEvents");
+
+        evs.add(new KeyEvent(new JPanel(), 0, 0, 0, 0, 'a', 0));
+
+        write(new DragGestureEvent(new NullComponent(), ACTION_COPY, ori, evs),
+              "nullComponent");
+
+        write(new DragGestureEvent(new NothingNull(), 100, ori, evs),
+              "badAction");
+
+        write(new DragGestureEvent(new NullDragSource(), ACTION_COPY, ori, evs),
+              "nullDragSource");
+
+        write(new DragGestureEvent(new NothingNull(), ACTION_COPY, null, evs),
+              "nullOrigin");
+
+        write(new DragGestureEvent(new NothingNull(), ACTION_COPY, ori, evs),
+              "good");
+    }
+
+    private static void write(Object obj, String file) throws Exception {
+        try (FileOutputStream fis = new FileOutputStream(file);
+             ObjectOutputStream ois = new ObjectOutputStream(fis)) {
+            ois.writeObject(obj);
+        }
+    }
+
+    public static final class NullDragSource extends DragGestureRecognizer {
+
+        public NullDragSource() {
+            super(null, new JPanel());
+        }
+
+        protected void registerListeners() {
+        }
+
+        protected void unregisterListeners() {
+        }
+    }
+
+    public static final class NullComponent extends DragGestureRecognizer {
+
+        public NullComponent() {
+            super(new DragSource(), null);
+        }
+
+        protected void registerListeners() {
+        }
+
+        protected void unregisterListeners() {
+        }
+    }
+
+    public static final class NothingNull extends DragGestureRecognizer {
+
+        public NothingNull() {
+            super(new DragSource(), new JPanel());
+        }
+
+        protected void registerListeners() {
+        }
+
+        protected void unregisterListeners() {
+        }
+    }
+}
Binary file test/jdk/java/awt/dnd/BadSerializationTest/badAction has changed
Binary file test/jdk/java/awt/dnd/BadSerializationTest/good has changed
Binary file test/jdk/java/awt/dnd/BadSerializationTest/noEvents has changed
Binary file test/jdk/java/awt/dnd/BadSerializationTest/nullComponent has changed
Binary file test/jdk/java/awt/dnd/BadSerializationTest/nullDragSource has changed
Binary file test/jdk/java/awt/dnd/BadSerializationTest/nullOrigin has changed
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/jdk/java/awt/font/GlyphVector/ZWJLigatureTest.java	Wed Oct 03 16:02:24 2018 +0200
@@ -0,0 +1,128 @@
+/*
+ * Copyright (c) 2018, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * 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 7017058 8191130 8195836
+   @summary Test handling of ZWJ by layout.
+ */
+
+/*
+ * A forced mapping of ZWJ (u+200D) to a special invisible glyph ID
+ * was breaking many uses of ZWJ to form ligatures in fonts supporting
+ * Indic scripts (Malayalam, Bengali, Sinhala at least) and also Emoji.
+ * Without knowing the exact properties of a font under test, and also
+ * how a layout engine maps chars to glyphs, it is difficult to write
+ * a complete robust automated test.
+ * So whilst it tries to show rendering for any fonts that claims to
+ * support the target alphabet, it will fail only when specific known
+ * fonts fail.
+ * The test automatically passes or fails only if these fonts do
+ * not ligature away the ZWJ.
+ * Besides this the test renders the specific text from these fonts
+ * and any others that claim to fully support the text, so it can be
+ * manually examined if so desired.
+ */
+
+import java.awt.Font;
+import java.awt.Graphics2D;
+import java.awt.font.FontRenderContext;
+import java.awt.font.GlyphVector;
+import java.awt.geom.Point2D;
+import java.awt.image.BufferedImage;
+import java.util.Locale;
+
+public class ZWJLigatureTest {
+
+   // These are fonts and scripts on Windows that should support
+   // the behaviours enough to make reliable tests";
+
+   static final String malayalamName = "Malayalam";
+   static final String malayalamFont = "Kartika";
+   static final String malayalamText = "\u0D2C\u0D3E\u0D32\u0D28\u0D4D\u200D";
+
+   static final String bengaliName = "Bengali";
+   static final String bengaliFont = "Vrinda";
+   static final String bengaliText =
+       "\u09CE \u09A4\u09CD\u200D " +
+       "\u09A4\u09BE\u09CE \u09A4\u09BE\u09A4\u09CD\u200D";
+
+   static final String sinhalaName = "Sinhala";
+   static final String sinhalaFont = "Iskoola Pota";
+   static final String sinhalaText =
+       "\u0DC1\u0DCA\u200D\u0DBB\u0DD3" +
+       "\u0D9A\u0DCA\u200D\u0DBB\u0DD2" +
+       "\u0D9A\u0DCA\u200D\u0DBB\u0DD3" +
+       "\u0DA7\u0DCA\u200D\u0DBB\u0DDA" +
+       "\u0DB6\u0DCA\u200D\u0DBB\u0DD0" +
+       "\u0D9B\u0DCA\u200D\u0DBA\u0DCF";
+
+
+   static String[] scripts = { malayalamName, bengaliName, sinhalaName };
+   static String[] fontNames = { malayalamFont, bengaliFont, sinhalaFont };
+   static String[] text = { malayalamText, bengaliText, sinhalaText };
+
+
+   static void doTest() {
+       boolean testFailed = false;
+
+       BufferedImage bi = new BufferedImage(50, 50, BufferedImage.TYPE_INT_RGB);
+       Graphics2D g2d = (Graphics2D)bi.getGraphics();
+       FontRenderContext frc = g2d.getFontRenderContext();
+       for (int f=0; f < fontNames.length; f++) {
+           Font font = new Font(fontNames[f], Font.PLAIN, 30);
+           String family = font.getFamily(Locale.ENGLISH).toLowerCase();
+           if (!fontNames[f].toLowerCase().equals(family)) {
+               System.out.println(fontNames[f] + " not found, skipping.");
+               continue;
+           } else {
+               System.out.println("Testing " + fontNames[f] +
+                                  " for " + scripts[f]);
+           }
+           char[] chs = text[f].toCharArray();
+           GlyphVector gv = font.layoutGlyphVector(frc, chs, 0, chs.length, 0);
+           for (int g=0; g<gv.getNumGlyphs(); g++) {
+               int glyph = gv.getGlyphCode(g);
+               int charIdx = gv.getGlyphCharIndex(g);
+               int codePoint = text[f].codePointAt(charIdx);
+               Point2D pos = gv.getGlyphPosition(g);
+
+               if (codePoint == 0x200D) {
+                  testFailed = true;
+                  System.out.println("FAIL: GOT ZWJ\n");
+               }
+               System.out.println("["+g+"]: gid="+Integer.toHexString(glyph)
+                   +", charIdx="+Integer.toHexString(charIdx)
+                   +", codePoint="+Integer.toHexString(codePoint)
+                   +", pos=["+pos.getX()+","+pos.getY()+"]");
+               }
+           }
+           if (testFailed) {
+               throw new RuntimeException("TEST FAILED");
+           }
+    }
+
+    public static void main(String[] args) {
+        doTest();
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/jdk/java/awt/print/PageFormat/WrongPaperForBookPrintingTest.java	Wed Oct 03 16:02:24 2018 +0200
@@ -0,0 +1,244 @@
+/*
+ * Copyright (c) 2018, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * 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
+   @key headful
+   @bug 8201818
+   @summary Printing attributes break page size set via "java.awt.print.Book"
+            object
+   @run main/manual WrongPaperForBookPrintingTest
+ */
+
+import java.awt.BorderLayout;
+import java.awt.Color;
+import java.awt.FlowLayout;
+import java.awt.Graphics;
+import java.awt.event.WindowAdapter;
+import java.awt.event.WindowEvent;
+import java.awt.print.Book;
+import java.awt.print.PageFormat;
+import java.awt.print.Paper;
+import java.awt.print.Printable;
+import java.awt.print.PrinterException;
+import java.awt.print.PrinterJob;
+import java.util.concurrent.CountDownLatch;
+import java.util.concurrent.TimeUnit;
+import javax.print.attribute.HashPrintRequestAttributeSet;
+import javax.print.attribute.PrintRequestAttributeSet;
+import javax.print.attribute.Size2DSyntax;
+import javax.print.attribute.standard.Chromaticity;
+import javax.print.attribute.standard.MediaSize;
+import javax.print.attribute.standard.MediaSizeName;
+import javax.swing.JButton;
+import javax.swing.JDialog;
+import javax.swing.JLabel;
+import javax.swing.JPanel;
+import javax.swing.JTextArea;
+import javax.swing.SwingUtilities;
+import javax.swing.Timer;
+import javax.swing.WindowConstants;
+
+public class WrongPaperForBookPrintingTest implements Printable {
+    private static final CountDownLatch testEndedSignal = new CountDownLatch(1);
+    private static final int testTimeout = 300000;
+    private static volatile String testFailureMsg;
+    private static volatile boolean testPassed;
+    private static volatile boolean testFinished;
+
+    public static void main(String[] args) {
+        SwingUtilities.invokeLater(() -> createAndShowTestDialog());
+
+        try {
+            if (!testEndedSignal.await(testTimeout, TimeUnit.MILLISECONDS)) {
+                throw new RuntimeException(String.format(
+                    "Test timeout '%d ms' elapsed.", testTimeout));
+            }
+            if (!testPassed) {
+                String failureMsg = testFailureMsg;
+                if ((failureMsg != null) && (!failureMsg.trim().isEmpty())) {
+                    throw new RuntimeException(failureMsg);
+                } else {
+                    throw new RuntimeException("Test failed.");
+                }
+            }
+        } catch (InterruptedException ie) {
+            throw new RuntimeException(ie);
+        } finally {
+            testFinished = true;
+        }
+    }
+
+    private static void doTest() {
+        PrintRequestAttributeSet aset = new HashPrintRequestAttributeSet();
+        aset.add(Chromaticity.MONOCHROME);
+
+        MediaSize isoA5Size = MediaSize.getMediaSizeForName(MediaSizeName.ISO_A5);
+        float[] size = isoA5Size.getSize(Size2DSyntax.INCH);
+        Paper paper = new Paper();
+        paper.setSize(size[0] * 72.0, size[1] * 72.0);
+        paper.setImageableArea(0.0, 0.0, size[0] * 72.0, size[1] * 72.0);
+        PageFormat pf = new PageFormat();
+        pf.setPaper(paper);
+
+        Book pageable = new Book();
+        pageable.append(new WrongPaperForBookPrintingTest(), pf);
+
+        PrinterJob job = PrinterJob.getPrinterJob();
+        job.setPageable(pageable);
+        if (job.printDialog()) {
+            try {
+                job.print(aset);
+            } catch (PrinterException pe) {
+                throw new RuntimeException(pe);
+            }
+        }
+    }
+
+    private static void pass() {
+        testPassed = true;
+        testEndedSignal.countDown();
+    }
+
+    private static void fail(String failureMsg) {
+        testFailureMsg = failureMsg;
+        testPassed = false;
+        testEndedSignal.countDown();
+    }
+
+    private static String convertMillisToTimeStr(int millis) {
+        if (millis < 0) {
+            return "00:00:00";
+        }
+        int hours = millis / 3600000;
+        int minutes = (millis - hours * 3600000) / 60000;
+        int seconds = (millis - hours * 3600000 - minutes * 60000) / 1000;
+        return String.format("%02d:%02d:%02d", hours, minutes, seconds);
+    }
+
+    private static void createAndShowTestDialog() {
+        String description =
+            " To run this test it is required to have a virtual PDF\r\n" +
+            " printer or any other printer supporting A5 paper size.\r\n" +
+            "\r\n" +
+            " 1. Verify that NOT A5 paper size is set as default for the\r\n" +
+            " printer to be used.\r\n" +
+            " 2. Click on \"Start Test\" button.\r\n" +
+            " 3. In the shown print dialog select the printer and click\r\n" +
+            " on \"Print\" button.\r\n" +
+            " 4. Verify that a page with a drawn rectangle is printed on\r\n" +
+            " a paper of A5 size which is (5.8 x 8.3 in) or\r\n" +
+            " (148 x 210 mm).\r\n" +
+            "\r\n" +
+            " If the printed page size is correct, click on \"PASS\"\r\n" +
+            " button, otherwise click on \"FAIL\" button.";
+
+        final JDialog dialog = new JDialog();
+        dialog.setTitle("WrongPaperForBookPrintingTest");
+        dialog.setDefaultCloseOperation(WindowConstants.DISPOSE_ON_CLOSE);
+        dialog.addWindowListener(new WindowAdapter() {
+            @Override
+            public void windowClosing(WindowEvent e) {
+                dialog.dispose();
+                fail("Main dialog was closed.");
+            }
+        });
+
+        final JLabel testTimeoutLabel = new JLabel(String.format(
+            "Test timeout: %s", convertMillisToTimeStr(testTimeout)));
+        final long startTime = System.currentTimeMillis();
+        final Timer timer = new Timer(0, null);
+        timer.setDelay(1000);
+        timer.addActionListener((e) -> {
+            int leftTime = testTimeout - (int) (System.currentTimeMillis() - startTime);
+            if ((leftTime < 0) || testFinished) {
+                timer.stop();
+                dialog.dispose();
+            }
+            testTimeoutLabel.setText(String.format(
+                "Test timeout: %s", convertMillisToTimeStr(leftTime)));
+        });
+        timer.start();
+
+        JTextArea textArea = new JTextArea(description);
+        textArea.setEditable(false);
+
+        final JButton testButton = new JButton("Start Test");
+        final JButton passButton = new JButton("PASS");
+        final JButton failButton = new JButton("FAIL");
+        testButton.addActionListener((e) -> {
+            testButton.setEnabled(false);
+            new Thread(() -> {
+                try {
+                    doTest();
+
+                    SwingUtilities.invokeLater(() -> {
+                        passButton.setEnabled(true);
+                        failButton.setEnabled(true);
+                    });
+                } catch (Throwable t) {
+                    t.printStackTrace();
+                    dialog.dispose();
+                    fail("Exception occurred in a thread executing the test.");
+                }
+            }).start();
+        });
+        passButton.setEnabled(false);
+        passButton.addActionListener((e) -> {
+            dialog.dispose();
+            pass();
+        });
+        failButton.setEnabled(false);
+        failButton.addActionListener((e) -> {
+            dialog.dispose();
+            fail("Size of a printed page is wrong.");
+        });
+
+        JPanel mainPanel = new JPanel(new BorderLayout());
+        JPanel labelPanel = new JPanel(new FlowLayout());
+        labelPanel.add(testTimeoutLabel);
+        mainPanel.add(labelPanel, BorderLayout.NORTH);
+        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);
+    }
+
+    @Override
+    public int print(Graphics g, PageFormat pf, int pageIndex)
+        throws PrinterException {
+        if (pageIndex == 0) {
+            g.setColor(Color.RED);
+            g.drawRect((int) pf.getImageableX(), (int) pf.getImageableY(),
+                (int) pf.getImageableWidth() - 1, (int) pf.getImageableHeight() - 1);
+            return Printable.PAGE_EXISTS;
+        } else {
+            return Printable.NO_SUCH_PAGE;
+        }
+    }
+}
--- a/test/jdk/java/io/FilePermission/ReadFileOnPath.java	Wed Oct 03 15:54:35 2018 +0200
+++ b/test/jdk/java/io/FilePermission/ReadFileOnPath.java	Wed Oct 03 16:02:24 2018 +0200
@@ -24,7 +24,7 @@
 /*
  * @test
  * @bug 8164705
- * @library /lib/testlibrary /test/lib
+ * @library /test/lib
  * @modules java.base/jdk.internal.misc
  *          jdk.compiler
  * @build jdk.test.lib.compiler.CompilerUtils
@@ -34,12 +34,14 @@
  *        jdk.test.lib.JDKToolLauncher
  *        jdk.test.lib.Platform
  *        jdk.test.lib.process.*
+ *        jdk.test.lib.util.JarUtils
  * @run main ReadFileOnPath
  * @summary Still able to read file on the same path
  */
 
 import jdk.test.lib.process.ProcessTools;
 import jdk.test.lib.compiler.CompilerUtils;
+import jdk.test.lib.util.JarUtils;
 
 import java.nio.file.Files;
 import java.nio.file.Path;
--- a/test/jdk/java/io/Serializable/packageAccess/PackageAccessTest.java	Wed Oct 03 15:54:35 2018 +0200
+++ b/test/jdk/java/io/Serializable/packageAccess/PackageAccessTest.java	Wed Oct 03 16:02:24 2018 +0200
@@ -24,8 +24,8 @@
 /*
  * @test
  * @bug 4765255
- * @library /lib/testlibrary
- * @build JarUtils A B C D PackageAccessTest
+ * @library /test/lib
+ * @build jdk.test.lib.util.JarUtils A B C D PackageAccessTest
  * @run main PackageAccessTest
  * @summary Verify proper functioning of package equality checks used to
  *          determine accessibility of superclass constructor and inherited
@@ -46,6 +46,8 @@
 import java.nio.file.Path;
 import java.nio.file.Paths;
 
+import jdk.test.lib.util.JarUtils;
+
 public class PackageAccessTest {
 
     static Class bcl;
--- a/test/jdk/java/io/Serializable/resolveClass/consTest/ConsTest.java	Wed Oct 03 15:54:35 2018 +0200
+++ b/test/jdk/java/io/Serializable/resolveClass/consTest/ConsTest.java	Wed Oct 03 16:02:24 2018 +0200
@@ -24,8 +24,8 @@
 /*
  * @test
  * @bug 4413434
- * @library /lib/testlibrary
- * @build JarUtils SetupJar Boot
+ * @library /test/lib
+ * @build jdk.test.lib.util.JarUtils SetupJar Boot
  * @run driver SetupJar
  * @run main/othervm -Xbootclasspath/a:boot.jar ConsTest
  * @summary Verify that generated java.lang.reflect implementation classes do
@@ -39,6 +39,8 @@
 import java.io.Serializable;
 import java.lang.reflect.Constructor;
 
+import jdk.test.lib.util.JarUtils;
+
 public class ConsTest implements Serializable {
     public static void main(String[] args) throws Exception {
         Constructor cons = Boot.class.getConstructor(
--- a/test/jdk/java/io/Serializable/resolveClass/consTest/SetupJar.java	Wed Oct 03 15:54:35 2018 +0200
+++ b/test/jdk/java/io/Serializable/resolveClass/consTest/SetupJar.java	Wed Oct 03 16:02:24 2018 +0200
@@ -24,6 +24,8 @@
 import java.nio.file.Path;
 import java.nio.file.Paths;
 
+import jdk.test.lib.util.JarUtils;
+
 public class SetupJar {
 
     public static void main(String args[]) throws Exception {
--- a/test/jdk/java/io/Serializable/resolveClass/deserializeButton/DeserializeButtonTest.java	Wed Oct 03 15:54:35 2018 +0200
+++ b/test/jdk/java/io/Serializable/resolveClass/deserializeButton/DeserializeButtonTest.java	Wed Oct 03 16:02:24 2018 +0200
@@ -24,8 +24,8 @@
 /*
  * @test
  * @bug 4413434
- * @library /lib/testlibrary
- * @build JarUtils Foo
+ * @library /test/lib
+ * @build jdk.test.lib.util.JarUtils Foo
  * @run main DeserializeButtonTest
  * @summary Verify that class loaded outside of application class loader is
  *          correctly resolved during deserialization when read in by custom
@@ -38,6 +38,8 @@
 import java.nio.file.Path;
 import java.nio.file.Paths;
 
+import jdk.test.lib.util.JarUtils;
+
 public class DeserializeButtonTest {
     public static void main(String[] args) throws Exception {
         setup();
--- a/test/jdk/java/io/Serializable/superclassDataLoss/SuperclassDataLossTest.java	Wed Oct 03 15:54:35 2018 +0200
+++ b/test/jdk/java/io/Serializable/superclassDataLoss/SuperclassDataLossTest.java	Wed Oct 03 16:02:24 2018 +0200
@@ -24,8 +24,8 @@
 /*
  * @test
  * @bug 4325590
- * @library /lib/testlibrary
- * @build JarUtils A B
+ * @library /test/lib
+ * @build jdk.test.lib.util.JarUtils A B
  * @run main SuperclassDataLossTest
  * @summary Verify that superclass data is not lost when incoming superclass
  *          descriptor is matched with local class that is not a superclass of
@@ -47,6 +47,8 @@
 import java.nio.file.Paths;
 import java.nio.file.StandardCopyOption;
 
+import jdk.test.lib.util.JarUtils;
+
 class MixedSuperclassStream extends ObjectInputStream {
     private boolean ldr12A;
     private URLClassLoader ldr1;
--- a/test/jdk/java/lang/ClassLoader/forNameLeak/ClassForNameLeak.java	Wed Oct 03 15:54:35 2018 +0200
+++ b/test/jdk/java/lang/ClassLoader/forNameLeak/ClassForNameLeak.java	Wed Oct 03 16:02:24 2018 +0200
@@ -26,9 +26,9 @@
  * @bug 8151486
  * @summary Call Class.forName() on the system classloader from a class loaded
  *          from a custom classloader.
- * @library /lib/testlibrary
  * @library /test/lib
- * @build jdk.test.lib.Utils JarUtils
+ * @build jdk.test.lib.Utils
+ *        jdk.test.lib.util.JarUtils
  * @build ClassForName ClassForNameLeak
  * @run main/othervm/policy=test.policy -Djava.security.manager ClassForNameLeak
  */
@@ -49,7 +49,9 @@
 import java.util.concurrent.Future;
 import java.util.stream.Collectors;
 import java.util.stream.Stream;
+
 import jdk.test.lib.Utils;
+import jdk.test.lib.util.JarUtils;
 
 /*
  * Create .jar, load ClassForName from .jar using a URLClassLoader
--- a/test/jdk/java/lang/ClassLoader/getResource/automaticmodules/Driver.java	Wed Oct 03 15:54:35 2018 +0200
+++ b/test/jdk/java/lang/ClassLoader/getResource/automaticmodules/Driver.java	Wed Oct 03 16:02:24 2018 +0200
@@ -23,8 +23,9 @@
 
 /**
  * @test
- * @library /lib/testlibrary /test/lib
- * @build Driver Main JarUtils
+ * @library /test/lib
+ * @build Driver Main
+ *        jdk.test.lib.util.JarUtils
  * @run main Driver
  * @summary Test ClassLoader.getResourceXXX to locate resources in an automatic
  *          module
@@ -39,6 +40,7 @@
 import java.util.jar.Manifest;
 
 import jdk.test.lib.process.ProcessTools;
+import jdk.test.lib.util.JarUtils;
 
 /**
  * The driver creates a JAR file containing p/Foo.class, p/foo.properties,
--- a/test/jdk/java/lang/ClassLoader/securityManager/ClassLoaderTest.java	Wed Oct 03 15:54:35 2018 +0200
+++ b/test/jdk/java/lang/ClassLoader/securityManager/ClassLoaderTest.java	Wed Oct 03 16:02:24 2018 +0200
@@ -26,10 +26,9 @@
  * @bug 8168423
  * @summary Different types of ClassLoader running with(out) SecurityManager and
  *          (in)valid security policy file.
- * @library /lib/testlibrary
  * @library /test/lib
  * @modules java.base/jdk.internal.module
- * @build JarUtils
+ * @build jdk.test.lib.util.JarUtils
  * @build TestClassLoader TestClient
  * @run main ClassLoaderTest -noPolicy
  * @run main ClassLoaderTest -validPolicy
@@ -51,6 +50,7 @@
 import java.util.List;
 import jdk.internal.module.ModuleInfoWriter;
 import jdk.test.lib.process.ProcessTools;
+import jdk.test.lib.util.JarUtils;
 
 public class ClassLoaderTest {
 
--- a/test/jdk/java/lang/Package/IsCompatibleWithDriver.java	Wed Oct 03 15:54:35 2018 +0200
+++ b/test/jdk/java/lang/Package/IsCompatibleWithDriver.java	Wed Oct 03 16:02:24 2018 +0200
@@ -25,10 +25,9 @@
  * @test
  * @bug 4227825 4785473
  * @summary Test behaviour of Package.isCompatibleWith().
- * @library /lib/testlibrary
  * @library /test/lib
  * @build A IsCompatibleWith
- *        JarUtils
+ *        jdk.test.lib.util.JarUtils
  *        jdk.test.lib.process.*
  * @run main IsCompatibleWithDriver
  */
@@ -44,6 +43,7 @@
 
 import jdk.test.lib.process.ProcessTools;
 import jdk.test.lib.process.OutputAnalyzer;
+import jdk.test.lib.util.JarUtils;
 
 public class IsCompatibleWithDriver {
     public static void main(String args[]) throws Throwable {
--- a/test/jdk/java/lang/Package/PackageFromManifest.java	Wed Oct 03 15:54:35 2018 +0200
+++ b/test/jdk/java/lang/Package/PackageFromManifest.java	Wed Oct 03 16:02:24 2018 +0200
@@ -27,7 +27,6 @@
  * @summary The test will create JAR file(s) with the manifest file
  *          that customized package versioning information (different info for
  *          same package if multiple jars). Then verify package versioning info
- * @library /lib/testlibrary
  * @library /test/lib
  * @modules jdk.compiler
  * @run main PackageFromManifest setup test
@@ -42,6 +41,7 @@
 import jdk.test.lib.compiler.CompilerUtils;
 import jdk.test.lib.process.ProcessTools;
 import jdk.test.lib.util.FileUtils;
+import jdk.test.lib.util.JarUtils;
 
 import java.io.File;
 import java.io.IOException;
--- a/test/jdk/java/lang/SecurityManager/CheckPackageAccess.java	Wed Oct 03 15:54:35 2018 +0200
+++ b/test/jdk/java/lang/SecurityManager/CheckPackageAccess.java	Wed Oct 03 16:02:24 2018 +0200
@@ -143,7 +143,7 @@
                  "jdk.internal.loader", null, null),
         // java.desktop module loaded by boot loader and has an openQual pkg
         // that is exported
-        new Test("java.desktop", "java.applet", null, "sun.applet",
+        new Test("java.desktop", "java.applet", null, "sun.font",
                  "sun.awt", null, "javax.swing.plaf.basic"),
         // java.security.jgss module loaded by platform loader
         new Test("java.security.jgss", "org.ietf.jgss", null,
--- a/test/jdk/java/lang/String/CompactString/CompactString.java	Wed Oct 03 15:54:35 2018 +0200
+++ b/test/jdk/java/lang/String/CompactString/CompactString.java	Wed Oct 03 16:02:24 2018 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2015, 2018, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -275,8 +275,7 @@
     }
 
     /*
-     * Because right now system default charset in JPRT environment is only
-     * guaranteed to support ASCII characters in log, so we escape them.
+     * Escape non-ASCII characters since not all systems support them.
      */
     protected String escapeNonASCIIs(String str) {
         StringBuilder sb = new StringBuilder();
@@ -292,8 +291,7 @@
     }
 
     /*
-     * Because right now system default charset in JPRT environment is only
-     * guaranteed to support ASCII characters in log, so we escape them.
+     * Escape non-ASCII characters since not all systems support them.
      */
     protected String escapeNonASCII(char c) {
         StringBuilder sb = new StringBuilder();
--- a/test/jdk/java/lang/StringBuffer/CompactStringBuffer.java	Wed Oct 03 15:54:35 2018 +0200
+++ b/test/jdk/java/lang/StringBuffer/CompactStringBuffer.java	Wed Oct 03 16:02:24 2018 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2015, 2018, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -471,8 +471,7 @@
     }
 
     /*
-     * Because right now system default charset in JPRT environment is only
-     * guaranteed to support ASCII characters in log, so we escape them.
+     * Escape non-ASCII characters since not all systems support them.
      */
     private String escapeNonASCIIs(String str) {
         StringBuilder sb = new StringBuilder();
--- a/test/jdk/java/lang/StringBuilder/CompactStringBuilder.java	Wed Oct 03 15:54:35 2018 +0200
+++ b/test/jdk/java/lang/StringBuilder/CompactStringBuilder.java	Wed Oct 03 16:02:24 2018 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2015, 2018, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -396,8 +396,7 @@
     }
 
     /*
-     * Because right now system default charset in JPRT environment is only
-     * guaranteed to support ASCII characters in log, so we escape them.
+     * Escape non-ASCII characters since not all systems support them.
      */
     private String escapeNonASCIIs(String str) {
         StringBuilder sb = new StringBuilder();
--- a/test/jdk/java/lang/instrument/executableJAR/ExecJarWithAgent.java	Wed Oct 03 15:54:35 2018 +0200
+++ b/test/jdk/java/lang/instrument/executableJAR/ExecJarWithAgent.java	Wed Oct 03 16:02:24 2018 +0200
@@ -23,9 +23,9 @@
 
 /**
  * @test
- * @library /lib/testlibrary
  * @library /test/lib
- * @build ExecJarWithAgent Main Agent AgentHelper JarUtils jdk.testlibrary.*
+ * @build ExecJarWithAgent Main Agent AgentHelper
+ *        jdk.test.lib.util.JarUtils
  * @run testng ExecJarWithAgent
  * @summary Test starting agents in executable JAR files
  */
@@ -41,6 +41,7 @@
 
 import jdk.test.lib.process.ProcessTools;
 import jdk.test.lib.process.OutputAnalyzer;
+import jdk.test.lib.util.JarUtils;
 
 @Test
 public class ExecJarWithAgent {
--- a/test/jdk/java/lang/module/AutomaticModulesTest.java	Wed Oct 03 15:54:35 2018 +0200
+++ b/test/jdk/java/lang/module/AutomaticModulesTest.java	Wed Oct 03 16:02:24 2018 +0200
@@ -23,8 +23,9 @@
 
 /**
  * @test
- * @library /lib/testlibrary
- * @build AutomaticModulesTest ModuleUtils JarUtils
+ * @library /lib/testlibrary /test/lib
+ * @build AutomaticModulesTest ModuleUtils
+ *        jdk.test.lib.util.JarUtils
  * @run testng AutomaticModulesTest
  * @summary Basic tests for automatic modules
  */
@@ -48,6 +49,8 @@
 import java.util.stream.Collectors;
 import java.util.stream.Stream;
 
+import jdk.test.lib.util.JarUtils;
+
 import org.testng.annotations.DataProvider;
 import org.testng.annotations.Test;
 import static org.testng.Assert.*;
--- a/test/jdk/java/lang/module/ModuleReader/ModuleReaderTest.java	Wed Oct 03 15:54:35 2018 +0200
+++ b/test/jdk/java/lang/module/ModuleReader/ModuleReaderTest.java	Wed Oct 03 16:02:24 2018 +0200
@@ -23,11 +23,13 @@
 
 /**
  * @test
- * @library /lib/testlibrary /test/lib
+ * @library /test/lib
  * @modules java.base/jdk.internal.module
  *          jdk.compiler
  *          jdk.jlink
- * @build ModuleReaderTest jdk.test.lib.compiler.CompilerUtils JarUtils
+ * @build ModuleReaderTest
+ *        jdk.test.lib.compiler.CompilerUtils
+ *        jdk.test.lib.util.JarUtils
  * @run testng ModuleReaderTest
  * @summary Basic tests for java.lang.module.ModuleReader
  */
@@ -55,6 +57,7 @@
 
 import jdk.internal.module.ModulePath;
 import jdk.test.lib.compiler.CompilerUtils;
+import jdk.test.lib.util.JarUtils;
 
 import org.testng.annotations.BeforeTest;
 import org.testng.annotations.Test;
--- a/test/jdk/java/lang/module/MultiReleaseJarTest.java	Wed Oct 03 15:54:35 2018 +0200
+++ b/test/jdk/java/lang/module/MultiReleaseJarTest.java	Wed Oct 03 16:02:24 2018 +0200
@@ -23,9 +23,9 @@
 
 /**
  * @test
- * @library /lib/testlibrary
+ * @library /test/lib
  * @modules java.base/jdk.internal.module
- * @build MultiReleaseJarTest JarUtils
+ * @build MultiReleaseJarTest jdk.test.lib.util.JarUtils
  * @run testng MultiReleaseJarTest
  * @run testng/othervm -Djdk.util.jar.enableMultiRelease=false MultiReleaseJarTest
  * @summary Basic test of modular JARs as multi-release JARs
@@ -55,6 +55,7 @@
 import java.util.jar.Manifest;
 
 import jdk.internal.module.ModuleInfoWriter;
+import jdk.test.lib.util.JarUtils;
 
 import org.testng.annotations.Test;
 import static org.testng.Assert.*;
--- a/test/jdk/java/lang/module/customfs/ModulesInCustomFileSystem.java	Wed Oct 03 15:54:35 2018 +0200
+++ b/test/jdk/java/lang/module/customfs/ModulesInCustomFileSystem.java	Wed Oct 03 16:02:24 2018 +0200
@@ -24,8 +24,9 @@
 /**
  * @test
  * @modules jdk.zipfs
- * @library /lib/testlibrary
- * @build ModulesInCustomFileSystem JarUtils m1/* m2/*
+ * @library /test/lib
+ * @build ModulesInCustomFileSystem m1/* m2/*
+ *        jdk.test.lib.util.JarUtils
  * @run testng/othervm ModulesInCustomFileSystem
  * @summary Test ModuleFinder to find modules in a custom file system
  */
@@ -43,6 +44,8 @@
 import java.nio.file.Paths;
 import java.util.Set;
 
+import jdk.test.lib.util.JarUtils;
+
 import org.testng.annotations.Test;
 import static org.testng.Assert.*;
 
--- a/test/jdk/java/net/Socket/LingerTest.java	Wed Oct 03 15:54:35 2018 +0200
+++ b/test/jdk/java/net/Socket/LingerTest.java	Wed Oct 03 16:02:24 2018 +0200
@@ -109,38 +109,45 @@
         Socket s2 = ss.accept();
 
         // setup conditions for untransmitted data and lengthy
-            // linger interval
-            s1.setSendBufferSize(128*1024);
+        // linger interval
+        s1.setSendBufferSize(128*1024);
         s1.setSoLinger(true, 30);
         s2.setReceiveBufferSize(1*1024);
 
         // start sender
-            Thread thr = new Thread(new Sender(s1));
-        thr.start();
+        Thread senderThread = new Thread(new Sender(s1));
+        senderThread.start();
 
         // other thread that will connect after 5 seconds.
-            Other other = new Other(ss.getLocalPort(), 5000);
-        thr = new Thread(other);
-        thr.start();
+        Other other = new Other(ss.getLocalPort(), 5000);
+        Thread otherThread = new Thread(other);
+        otherThread.start();
 
         // give sender time to queue the data
-            System.out.println ("Main sleep 1000");
-            Thread.sleep(1000);
-            System.out.println ("Main continue");
+        System.out.println ("Main sleep 1000");
+        Thread.sleep(1000);
+        System.out.println ("Main continue");
 
         // close the socket asynchronously
-            (new Thread(new Closer(s1))).start();
+        Thread closerThread = new Thread(new Closer(s1));
+        closerThread.start();
 
-            System.out.println ("Main sleep 15000");
+        System.out.println ("Main sleep 15000");
         // give other time to run
-            Thread.sleep(15000);
-            System.out.println ("Main closing serversocket");
+        Thread.sleep(15000);
+        System.out.println ("Main closing serversocket");
 
         ss.close();
         // check that other is done
-            if (!other.connected()) {
+        if (!other.connected()) {
             throw new RuntimeException("Other thread is blocked");
         }
+
+        // await termination of all test related threads
+        senderThread.join(60_000);
+        otherThread.join(60_000);
+        closerThread.join(60_000);
+
         System.out.println ("Main ends");
     }
 }
--- a/test/jdk/java/net/URLClassLoader/closetest/CloseTest.java	Wed Oct 03 15:54:35 2018 +0200
+++ b/test/jdk/java/net/URLClassLoader/closetest/CloseTest.java	Wed Oct 03 16:02:24 2018 +0200
@@ -28,12 +28,12 @@
  *          jdk.httpserver
  *          jdk.compiler
  * @library ../../../../com/sun/net/httpserver
- *          /lib/testlibrary
  *          /test/lib
  * @build jdk.test.lib.compiler.CompilerUtils
  *        jdk.test.lib.util.FileUtils
+ *        jdk.test.lib.util.JarUtils
  *        jdk.test.lib.Platform
- *        FileServerHandler JarUtils
+ *        FileServerHandler
  * @run main/othervm CloseTest
  * @summary URL-downloaded jar files can consume all available file descriptors
  */
@@ -49,6 +49,7 @@
 import java.nio.file.Paths;
 
 import jdk.test.lib.compiler.CompilerUtils;
+import jdk.test.lib.util.JarUtils;
 
 import com.sun.net.httpserver.HttpContext;
 import com.sun.net.httpserver.HttpServer;
--- a/test/jdk/java/net/URLClassLoader/closetest/GetResourceAsStream.java	Wed Oct 03 15:54:35 2018 +0200
+++ b/test/jdk/java/net/URLClassLoader/closetest/GetResourceAsStream.java	Wed Oct 03 16:02:24 2018 +0200
@@ -24,12 +24,12 @@
 /**
  * @test
  * @bug 6899919
- * @library /lib/testlibrary /test/lib
+ * @library /test/lib
  * @modules jdk.compiler
  * @build jdk.test.lib.compiler.CompilerUtils
  *        jdk.test.lib.util.FileUtils
+ *        jdk.test.lib.util.JarUtils
  *        jdk.test.lib.Platform
- *        JarUtils
  * @run main/othervm GetResourceAsStream
  */
 
@@ -44,6 +44,7 @@
 import java.nio.file.StandardCopyOption;
 import java.nio.file.StandardOpenOption;
 import jdk.test.lib.compiler.CompilerUtils;
+import jdk.test.lib.util.JarUtils;
 
 public class GetResourceAsStream extends Common {
     private static  final String WORK_DIR = System.getProperty("user.dir");
--- a/test/jdk/java/nio/channels/AsynchronousChannelGroup/AsExecutor.java	Wed Oct 03 15:54:35 2018 +0200
+++ b/test/jdk/java/nio/channels/AsynchronousChannelGroup/AsExecutor.java	Wed Oct 03 16:02:24 2018 +0200
@@ -25,8 +25,9 @@
  * @test
  * @bug 4607272
  * @summary tests tasks can be submitted to a channel group's thread pool.
- * @library /lib/testlibrary bootlib
- * @build JarUtils PrivilegedThreadFactory Attack
+ * @library /test/lib bootlib
+ * @build PrivilegedThreadFactory Attack
+ *        jdk.test.lib.util.JarUtils
  * @run driver SetupJar
  * @run main/othervm -Xbootclasspath/a:privileged.jar AsExecutor
  */
--- a/test/jdk/java/nio/channels/AsynchronousChannelGroup/SetupJar.java	Wed Oct 03 15:54:35 2018 +0200
+++ b/test/jdk/java/nio/channels/AsynchronousChannelGroup/SetupJar.java	Wed Oct 03 16:02:24 2018 +0200
@@ -26,6 +26,8 @@
 import java.nio.file.Paths;
 import java.util.stream.Stream;
 
+import jdk.test.lib.util.JarUtils;
+
 public class SetupJar {
     public static void main(String args[]) throws Exception {
         String cp = System.getProperty("test.class.path");
--- a/test/jdk/java/nio/charset/spi/CharsetProviderBasicTest.java	Wed Oct 03 15:54:35 2018 +0200
+++ b/test/jdk/java/nio/charset/spi/CharsetProviderBasicTest.java	Wed Oct 03 16:02:24 2018 +0200
@@ -26,14 +26,13 @@
  * @bug 4429040 4591027 4814743
  * @summary Unit test for charset providers
  * @library /test/lib
- *          /lib/testlibrary
  * @build jdk.test.lib.Utils
  *        jdk.test.lib.Asserts
  *        jdk.test.lib.JDKToolFinder
  *        jdk.test.lib.JDKToolLauncher
  *        jdk.test.lib.Platform
  *        jdk.test.lib.process.*
- *        JarUtils
+ *        jdk.test.lib.util.JarUtils
  *        FooCharset FooProvider CharsetTest
  * @run driver SetupJar
  * @run testng CharsetProviderBasicTest
--- a/test/jdk/java/nio/charset/spi/SetupJar.java	Wed Oct 03 15:54:35 2018 +0200
+++ b/test/jdk/java/nio/charset/spi/SetupJar.java	Wed Oct 03 16:02:24 2018 +0200
@@ -28,6 +28,8 @@
 import static java.nio.file.StandardCopyOption.REPLACE_EXISTING;
 import static java.nio.file.StandardOpenOption.CREATE;
 
+import jdk.test.lib.util.JarUtils;
+
 public class SetupJar {
 
     private static final String PROVIDER
--- a/test/jdk/java/rmi/module/ModuleTest.java	Wed Oct 03 15:54:35 2018 +0200
+++ b/test/jdk/java/rmi/module/ModuleTest.java	Wed Oct 03 16:02:24 2018 +0200
@@ -23,9 +23,11 @@
 
 /**
  * @test
- * @library /lib/testlibrary /test/lib
+ * @library /test/lib
  * @build jdk.test.lib.process.ProcessTools
- *        ModuleTest jdk.test.lib.compiler.CompilerUtils JarUtils
+ *        jdk.test.lib.compiler.CompilerUtils
+ *        jdk.test.lib.util.JarUtils
+ *        ModuleTest
  * @run testng ModuleTest
  * @summary Basic tests for using rmi in module world
  */
@@ -37,6 +39,7 @@
 import java.io.File;
 import java.nio.file.Paths;
 import jdk.test.lib.compiler.CompilerUtils;
+import jdk.test.lib.util.JarUtils;
 
 import org.testng.annotations.BeforeTest;
 import org.testng.annotations.Test;
--- a/test/jdk/java/security/Provider/SecurityProviderModularTest.java	Wed Oct 03 15:54:35 2018 +0200
+++ b/test/jdk/java/security/Provider/SecurityProviderModularTest.java	Wed Oct 03 16:02:24 2018 +0200
@@ -40,6 +40,7 @@
 import java.lang.module.ModuleDescriptor.Builder;
 import jdk.internal.module.ModuleInfoWriter;
 import jdk.test.lib.process.ProcessTools;
+import jdk.test.lib.util.JarUtils;
 
 
 /*
@@ -47,9 +48,9 @@
  * @bug 8130360 8183310
  * @summary Test security provider in different combination of modular option
  *          defined with(out) service description.
- * @library /lib/testlibrary /test/lib
+ * @library /test/lib
  * @modules java.base/jdk.internal.module
- * @build JarUtils TestProvider TestClient
+ * @build jdk.test.lib.util.JarUtils TestProvider TestClient
  * @run main SecurityProviderModularTest CL true
  * @run main SecurityProviderModularTest CL false
  * @run main SecurityProviderModularTest SL true
--- a/test/jdk/java/sql/testng/util/StubConnection.java	Wed Oct 03 15:54:35 2018 +0200
+++ b/test/jdk/java/sql/testng/util/StubConnection.java	Wed Oct 03 16:02:24 2018 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2014, 2018, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -43,6 +43,8 @@
 
 public class StubConnection implements Connection {
 
+    private boolean autoCommit = false;
+
     @Override
     public Statement createStatement() throws SQLException {
         throw new UnsupportedOperationException("Not supported yet.");
@@ -65,12 +67,14 @@
 
     @Override
     public void setAutoCommit(boolean autoCommit) throws SQLException {
-        throw new UnsupportedOperationException("Not supported yet.");
+        System.out.println("**** in StubConnection.setAutoCommit");
+        this.autoCommit = autoCommit;
     }
 
     @Override
     public boolean getAutoCommit() throws SQLException {
-        throw new UnsupportedOperationException("Not supported yet.");
+        System.out.println("*** in StubConnection.getAutoCommit");
+        return autoCommit;
     }
 
     @Override
--- a/test/jdk/java/time/test/java/time/format/TestDateTimeFormatterBuilderWithLocale.java	Wed Oct 03 15:54:35 2018 +0200
+++ b/test/jdk/java/time/test/java/time/format/TestDateTimeFormatterBuilderWithLocale.java	Wed Oct 03 16:02:24 2018 +0200
@@ -74,9 +74,11 @@
 import java.time.format.DateTimeFormatter;
 import java.time.format.DateTimeFormatterBuilder;
 import java.time.format.FormatStyle;
+import java.time.format.ResolverStyle;
 import java.time.LocalDate;
 import java.time.temporal.ChronoField;
 import java.time.temporal.Temporal;
+import java.time.temporal.TemporalAccessor;
 
 import java.util.HashMap;
 import java.util.Locale;
@@ -133,13 +135,22 @@
 
     @Test(dataProvider="mapTextLookup")
     public void test_appendText_mapTextLookup(ChronoLocalDate date, Locale locale) {
-        final String new1st = "1st";
-        Map<Long, String> yearMap = new HashMap<>();
-        yearMap.put(1L, new1st);
-        builder.appendText(ChronoField.YEAR_OF_ERA, yearMap);
+        final String firstYear = "firstYear";
+        final String firstMonth = "firstMonth";
+        final String firstYearMonth = firstYear + firstMonth;
+        final long first = 1L;
 
-        String actual = date.format(builder.toFormatter(locale));
-        assertEquals(actual, new1st);
+        DateTimeFormatter formatter = builder
+            .appendText(ChronoField.YEAR_OF_ERA, Map.of(first, firstYear))
+            .appendText(ChronoField.MONTH_OF_YEAR, Map.of(first, firstMonth))
+            .toFormatter(locale)
+            .withResolverStyle(ResolverStyle.STRICT);
+
+        assertEquals(date.format(formatter), firstYearMonth);
+
+        TemporalAccessor ta = formatter.parse(firstYearMonth);
+        assertEquals(ta.getLong(ChronoField.YEAR_OF_ERA), first);
+        assertEquals(ta.getLong(ChronoField.MONTH_OF_YEAR), first);
     }
 
 
--- a/test/jdk/java/util/Collections/EmptyNavigableSet.java	Wed Oct 03 15:54:35 2018 +0200
+++ b/test/jdk/java/util/Collections/EmptyNavigableSet.java	Wed Oct 03 16:02:24 2018 +0200
@@ -45,6 +45,7 @@
 import java.util.TreeSet;
 
 import static org.testng.Assert.assertFalse;
+import static org.testng.Assert.assertNull;
 import static org.testng.Assert.assertSame;
 import static org.testng.Assert.assertTrue;
 
@@ -369,7 +370,7 @@
 
         assertSame(emptyNavigableSetArray, result);
 
-        assertTrue(result[0] == null);
+        assertNull(result[0]);
     }
 
     @DataProvider(name = "NavigableSet<?>", parallel = true)
--- a/test/jdk/java/util/PriorityQueue/AddNonComparable.java	Wed Oct 03 15:54:35 2018 +0200
+++ b/test/jdk/java/util/PriorityQueue/AddNonComparable.java	Wed Oct 03 16:02:24 2018 +0200
@@ -42,6 +42,7 @@
 import java.util.function.Supplier;
 
 import static org.testng.Assert.assertEquals;
+import static org.testng.Assert.assertNull;
 import static org.testng.Assert.assertTrue;
 
 public class AddNonComparable {
@@ -64,7 +65,7 @@
         test(new PriorityQueue<>(), AComparable::new,
              (q, e) -> {
                  assertEquals(q.size(), 1);
-                 assertTrue(e == null);
+                 assertNull(e);
              });
 
         test(new PriorityBlockingQueue<>(), NonComparable::new,
@@ -75,7 +76,7 @@
         test(new PriorityBlockingQueue<>(), AComparable::new,
              (q, e) -> {
                  assertEquals(q.size(), 1);
-                 assertTrue(e == null);
+                 assertNull(e);
              });
     }
 
@@ -98,7 +99,7 @@
         test(new TreeSet<>(), AComparable::new,
              (s, e) -> {
                  assertEquals(s.size(), 1);
-                 assertTrue(e == null);
+                 assertNull(e);
              });
 
         test(new ConcurrentSkipListSet<>(), NonComparable::new,
@@ -109,7 +110,7 @@
         test(new ConcurrentSkipListSet<>(), AComparable::new,
              (s, e) -> {
                  assertEquals(s.size(), 1);
-                 assertTrue(e == null);
+                 assertNull(e);
              });
     }
 
@@ -131,7 +132,7 @@
         test(new TreeMap<>(), AComparable::new,
              (m, e) -> {
                  assertEquals(m.size(), 1);
-                 assertTrue(e == null);
+                 assertNull(e);
              });
 
         test(new ConcurrentSkipListMap<>(), NonComparable::new,
@@ -142,7 +143,7 @@
         test(new ConcurrentSkipListMap<>(), AComparable::new,
              (s, e) -> {
                  assertEquals(s.size(), 1);
-                 assertTrue(e == null);
+                 assertNull(e);
              });
     }
 
--- a/test/jdk/java/util/ServiceLoader/ModulesTest.java	Wed Oct 03 15:54:35 2018 +0200
+++ b/test/jdk/java/util/ServiceLoader/ModulesTest.java	Wed Oct 03 16:02:24 2018 +0200
@@ -24,9 +24,9 @@
 /**
  * @test
  * @modules java.scripting
- * @library modules /lib/testlibrary
+ * @library modules /test/lib
  * @build bananascript/*
- * @build JarUtils
+ * @build jdk.test.lib.util.JarUtils
  * @compile classpath/pearscript/org/pear/PearScriptEngineFactory.java
  *          classpath/pearscript/org/pear/PearScript.java
  * @run testng/othervm ModulesTest
@@ -53,6 +53,8 @@
 import java.util.stream.Stream;
 import javax.script.ScriptEngineFactory;
 
+import jdk.test.lib.util.JarUtils;
+
 import org.testng.annotations.Test;
 import org.testng.annotations.BeforeTest;
 import static org.testng.Assert.*;
--- a/test/jdk/java/util/ServiceLoader/basic/ServiceLoaderBasicTest.java	Wed Oct 03 15:54:35 2018 +0200
+++ b/test/jdk/java/util/ServiceLoader/basic/ServiceLoaderBasicTest.java	Wed Oct 03 16:02:24 2018 +0200
@@ -25,8 +25,9 @@
  * @test
  * @bug 4640520 6354623 7198496
  * @summary Unit test for java.util.ServiceLoader
- * @library /lib/testlibrary /test/lib
- * @build JarUtils jdk.test.lib.process.*
+ * @library /test/lib
+ * @build jdk.test.lib.process.*
+ *        jdk.test.lib.util.JarUtils
  *        Basic Load FooService FooProvider1 FooProvider2 FooProvider3 BarProvider
  * @run testng ServiceLoaderBasicTest
  */
@@ -41,6 +42,7 @@
 import jdk.test.lib.JDKToolFinder;
 import jdk.test.lib.Utils;
 import jdk.test.lib.process.ProcessTools;
+import jdk.test.lib.util.JarUtils;
 
 import org.testng.annotations.BeforeClass;
 import org.testng.annotations.DataProvider;
--- a/test/jdk/java/util/concurrent/tck/AbstractQueuedSynchronizerTest.java	Wed Oct 03 15:54:35 2018 +0200
+++ b/test/jdk/java/util/concurrent/tck/AbstractQueuedSynchronizerTest.java	Wed Oct 03 16:02:24 2018 +0200
@@ -1310,7 +1310,7 @@
             try {
                 s.acquireInterruptibly(1);
                 shouldThrow();
-            } catch (InterruptedException expected) {}
+            } catch (InterruptedException success) {}
         };
         for (int i = 0; i < 2; i++) {
             Thread thread = new Thread(failedAcquire);
--- a/test/jdk/java/util/concurrent/tck/CompletableFutureTest.java	Wed Oct 03 15:54:35 2018 +0200
+++ b/test/jdk/java/util/concurrent/tck/CompletableFutureTest.java	Wed Oct 03 16:02:24 2018 +0200
@@ -86,9 +86,13 @@
         assertFalse(f.isDone());
         assertFalse(f.isCancelled());
         assertTrue(f.toString().matches(".*\\[.*Not completed.*\\]"));
+
+        Object result = null;
         try {
-            assertNull(f.getNow(null));
+            result = f.getNow(null);
         } catch (Throwable fail) { threadUnexpectedException(fail); }
+        assertNull(result);
+
         try {
             f.get(randomExpiredTimeout(), randomTimeUnit());
             shouldThrow();
@@ -97,14 +101,18 @@
         catch (Throwable fail) { threadUnexpectedException(fail); }
     }
 
-    <T> void checkCompletedNormally(CompletableFuture<T> f, T value) {
-        checkTimedGet(f, value);
-
+    <T> void checkCompletedNormally(CompletableFuture<T> f, T expectedValue) {
+        checkTimedGet(f, expectedValue);
+
+        assertEquals(expectedValue, f.join());
+        assertEquals(expectedValue, f.getNow(null));
+
+        T result = null;
         try {
-            assertEquals(value, f.join());
-            assertEquals(value, f.getNow(null));
-            assertEquals(value, f.get());
+            result = f.get();
         } catch (Throwable fail) { threadUnexpectedException(fail); }
+        assertEquals(expectedValue, result);
+
         assertTrue(f.isDone());
         assertFalse(f.isCancelled());
         assertFalse(f.isCompletedExceptionally());
@@ -570,9 +578,28 @@
         public CompletableFuture<Integer> apply(Integer x) {
             invoked();
             value = x;
-            CompletableFuture<Integer> f = new CompletableFuture<>();
-            assertTrue(f.complete(inc(x)));
-            return f;
+            return CompletableFuture.completedFuture(inc(x));
+        }
+    }
+
+    static class FailingExceptionalCompletableFutureFunction extends CheckedAction
+        implements Function<Throwable, CompletableFuture<Integer>>
+    {
+        final CFException ex;
+        FailingExceptionalCompletableFutureFunction(ExecutionMode m) { super(m); ex = new CFException(); }
+        public CompletableFuture<Integer> apply(Throwable x) {
+            invoked();
+            throw ex;
+        }
+    }
+
+    static class ExceptionalCompletableFutureFunction extends CheckedAction
+        implements Function<Throwable, CompletionStage<Integer>> {
+        final Integer value = 3;
+        ExceptionalCompletableFutureFunction(ExecutionMode m) { super(m); }
+        public CompletionStage<Integer> apply(Throwable x) {
+            invoked();
+            return CompletableFuture.completedFuture(value);
         }
     }
 
@@ -691,8 +718,16 @@
                  Function<? super T,U> a) {
                 return f.applyToEither(g, a);
             }
+            public <T> CompletableFuture<T> exceptionally
+                (CompletableFuture<T> f,
+                 Function<Throwable, ? extends T> fn) {
+                return f.exceptionally(fn);
+            }
+            public <T> CompletableFuture<T> exceptionallyCompose
+                (CompletableFuture<T> f, Function<Throwable, ? extends CompletionStage<T>> fn) {
+                return f.exceptionallyCompose(fn);
+            }
         },
-
         ASYNC {
             public void checkExecutionMode() {
                 assertEquals(defaultExecutorIsCommonPool,
@@ -765,6 +800,17 @@
                  Function<? super T,U> a) {
                 return f.applyToEitherAsync(g, a);
             }
+            public <T> CompletableFuture<T> exceptionally
+                (CompletableFuture<T> f,
+                 Function<Throwable, ? extends T> fn) {
+                return f.exceptionallyAsync(fn);
+            }
+
+            public <T> CompletableFuture<T> exceptionallyCompose
+                (CompletableFuture<T> f, Function<Throwable, ? extends CompletionStage<T>> fn) {
+                return f.exceptionallyComposeAsync(fn);
+            }
+
         },
 
         EXECUTOR {
@@ -838,6 +884,16 @@
                  Function<? super T,U> a) {
                 return f.applyToEitherAsync(g, a, new ThreadExecutor());
             }
+            public <T> CompletableFuture<T> exceptionally
+                (CompletableFuture<T> f,
+                 Function<Throwable, ? extends T> fn) {
+                return f.exceptionallyAsync(fn, new ThreadExecutor());
+            }
+            public <T> CompletableFuture<T> exceptionallyCompose
+                (CompletableFuture<T> f, Function<Throwable, ? extends CompletionStage<T>> fn) {
+                return f.exceptionallyComposeAsync(fn, new ThreadExecutor());
+            }
+
         };
 
         public abstract void checkExecutionMode();
@@ -880,6 +936,12 @@
             (CompletableFuture<T> f,
              CompletionStage<? extends T> g,
              Function<? super T,U> a);
+        public abstract <T> CompletableFuture<T> exceptionally
+            (CompletableFuture<T> f,
+             Function<Throwable, ? extends T> fn);
+        public abstract <T> CompletableFuture<T> exceptionallyCompose
+            (CompletableFuture<T> f,
+             Function<Throwable, ? extends CompletionStage<T>> fn);
     }
 
     /**
@@ -887,15 +949,14 @@
      * normally, and source result is propagated
      */
     public void testExceptionally_normalCompletion() {
+        for (ExecutionMode m : ExecutionMode.values())
         for (boolean createIncomplete : new boolean[] { true, false })
         for (Integer v1 : new Integer[] { 1, null })
     {
-        final AtomicInteger a = new AtomicInteger(0);
         final CompletableFuture<Integer> f = new CompletableFuture<>();
         if (!createIncomplete) assertTrue(f.complete(v1));
-        final CompletableFuture<Integer> g = f.exceptionally
-            ((Throwable t) -> {
-                a.getAndIncrement();
+        final CompletableFuture<Integer> g = m.exceptionally
+            (f, (Throwable t) -> {
                 threadFail("should not be called");
                 return null;            // unreached
             });
@@ -903,7 +964,6 @@
 
         checkCompletedNormally(g, v1);
         checkCompletedNormally(f, v1);
-        assertEquals(0, a.get());
     }}
 
     /**
@@ -911,6 +971,7 @@
      * exception
      */
     public void testExceptionally_exceptionalCompletion() {
+        for (ExecutionMode m : ExecutionMode.values())
         for (boolean createIncomplete : new boolean[] { true, false })
         for (Integer v1 : new Integer[] { 1, null })
     {
@@ -918,9 +979,9 @@
         final CFException ex = new CFException();
         final CompletableFuture<Integer> f = new CompletableFuture<>();
         if (!createIncomplete) f.completeExceptionally(ex);
-        final CompletableFuture<Integer> g = f.exceptionally
-            ((Throwable t) -> {
-                ExecutionMode.SYNC.checkExecutionMode();
+        final CompletableFuture<Integer> g = m.exceptionally
+            (f, (Throwable t) -> {
+                m.checkExecutionMode();
                 threadAssertSame(t, ex);
                 a.getAndIncrement();
                 return v1;
@@ -936,6 +997,7 @@
      * exceptionally with that exception
      */
     public void testExceptionally_exceptionalCompletionActionFailed() {
+        for (ExecutionMode m : ExecutionMode.values())
         for (boolean createIncomplete : new boolean[] { true, false })
     {
         final AtomicInteger a = new AtomicInteger(0);
@@ -943,9 +1005,9 @@
         final CFException ex2 = new CFException();
         final CompletableFuture<Integer> f = new CompletableFuture<>();
         if (!createIncomplete) f.completeExceptionally(ex1);
-        final CompletableFuture<Integer> g = f.exceptionally
-            ((Throwable t) -> {
-                ExecutionMode.SYNC.checkExecutionMode();
+        final CompletableFuture<Integer> g = m.exceptionally
+            (f, (Throwable t) -> {
+                m.checkExecutionMode();
                 threadAssertSame(t, ex1);
                 a.getAndIncrement();
                 throw ex2;
@@ -3116,6 +3178,121 @@
         checkCompletedNormally(f, v1);
     }}
 
+    /**
+     * exceptionallyCompose result completes normally after normal
+     * completion of source
+     */
+    public void testExceptionallyCompose_normalCompletion() {
+        for (ExecutionMode m : ExecutionMode.values())
+        for (boolean createIncomplete : new boolean[] { true, false })
+        for (Integer v1 : new Integer[] { 1, null })
+    {
+        final CompletableFuture<Integer> f = new CompletableFuture<>();
+        final ExceptionalCompletableFutureFunction r =
+            new ExceptionalCompletableFutureFunction(m);
+        if (!createIncomplete) assertTrue(f.complete(v1));
+        final CompletableFuture<Integer> g = m.exceptionallyCompose(f, r);
+        if (createIncomplete) assertTrue(f.complete(v1));
+
+        checkCompletedNormally(f, v1);
+        checkCompletedNormally(g, v1);
+        r.assertNotInvoked();
+    }}
+
+    /**
+     * exceptionallyCompose result completes normally after exceptional
+     * completion of source
+     */
+    public void testExceptionallyCompose_exceptionalCompletion() {
+        for (ExecutionMode m : ExecutionMode.values())
+        for (boolean createIncomplete : new boolean[] { true, false })
+    {
+        final CFException ex = new CFException();
+        final ExceptionalCompletableFutureFunction r =
+            new ExceptionalCompletableFutureFunction(m);
+        final CompletableFuture<Integer> f = new CompletableFuture<>();
+        if (!createIncomplete) f.completeExceptionally(ex);
+        final CompletableFuture<Integer> g = m.exceptionallyCompose(f, r);
+        if (createIncomplete) f.completeExceptionally(ex);
+
+        checkCompletedExceptionally(f, ex);
+        checkCompletedNormally(g, r.value);
+        r.assertInvoked();
+    }}
+
+    /**
+     * exceptionallyCompose completes exceptionally on exception if action does
+     */
+    public void testExceptionallyCompose_actionFailed() {
+        for (ExecutionMode m : ExecutionMode.values())
+        for (boolean createIncomplete : new boolean[] { true, false })
+    {
+        final CFException ex = new CFException();
+        final CompletableFuture<Integer> f = new CompletableFuture<>();
+        final FailingExceptionalCompletableFutureFunction r
+            = new FailingExceptionalCompletableFutureFunction(m);
+        if (!createIncomplete) f.completeExceptionally(ex);
+        final CompletableFuture<Integer> g = m.exceptionallyCompose(f, r);
+        if (createIncomplete) f.completeExceptionally(ex);
+
+        checkCompletedExceptionally(f, ex);
+        checkCompletedWithWrappedException(g, r.ex);
+        r.assertInvoked();
+    }}
+
+    /**
+     * exceptionallyCompose result completes exceptionally if the
+     * result of the action does
+     */
+    public void testExceptionallyCompose_actionReturnsFailingFuture() {
+        for (ExecutionMode m : ExecutionMode.values())
+        for (int order = 0; order < 6; order++)
+    {
+        final CFException ex0 = new CFException();
+        final CFException ex = new CFException();
+        final CompletableFuture<Integer> f = new CompletableFuture<>();
+        final CompletableFuture<Integer> g = new CompletableFuture<>();
+        final CompletableFuture<Integer> h;
+        // Test all permutations of orders
+        switch (order) {
+        case 0:
+            assertTrue(f.completeExceptionally(ex0));
+            assertTrue(g.completeExceptionally(ex));
+            h = m.exceptionallyCompose(f, (x -> g));
+            break;
+        case 1:
+            assertTrue(f.completeExceptionally(ex0));
+            h = m.exceptionallyCompose(f, (x -> g));
+            assertTrue(g.completeExceptionally(ex));
+            break;
+        case 2:
+            assertTrue(g.completeExceptionally(ex));
+            assertTrue(f.completeExceptionally(ex0));
+            h = m.exceptionallyCompose(f, (x -> g));
+            break;
+        case 3:
+            assertTrue(g.completeExceptionally(ex));
+            h = m.exceptionallyCompose(f, (x -> g));
+            assertTrue(f.completeExceptionally(ex0));
+            break;
+        case 4:
+            h = m.exceptionallyCompose(f, (x -> g));
+            assertTrue(f.completeExceptionally(ex0));
+            assertTrue(g.completeExceptionally(ex));
+            break;
+        case 5:
+            h = m.exceptionallyCompose(f, (x -> g));
+            assertTrue(f.completeExceptionally(ex0));
+            assertTrue(g.completeExceptionally(ex));
+            break;
+        default: throw new AssertionError();
+        }
+
+        checkCompletedExceptionally(g, ex);
+        checkCompletedWithWrappedException(h, ex);
+        checkCompletedExceptionally(f, ex0);
+    }}
+
     // other static methods
 
     /**
@@ -4527,4 +4704,429 @@
 //         return stage.toCompletableFuture().copy().isDone();
 //     }
 
+    // For testing default implementations
+    // Only non-default interface methods defined.
+    static final class DelegatedCompletionStage<T> implements CompletionStage<T> {
+        final CompletableFuture<T> cf;
+        DelegatedCompletionStage(CompletableFuture<T> cf) { this.cf = cf; }
+        public CompletableFuture<T> toCompletableFuture() {
+            return cf; }
+        public CompletionStage<Void> thenRun
+            (Runnable action) {
+            return cf.thenRun(action); }
+        public CompletionStage<Void> thenRunAsync
+            (Runnable action) {
+            return cf.thenRunAsync(action); }
+        public CompletionStage<Void> thenRunAsync
+            (Runnable action,
+             Executor executor) {
+            return cf.thenRunAsync(action, executor); }
+        public CompletionStage<Void> thenAccept
+            (Consumer<? super T> action) {
+            return cf.thenAccept(action); }
+        public CompletionStage<Void> thenAcceptAsync
+            (Consumer<? super T> action) {
+            return cf.thenAcceptAsync(action); }
+        public CompletionStage<Void> thenAcceptAsync
+            (Consumer<? super T> action,
+             Executor executor) {
+            return cf.thenAcceptAsync(action, executor); }
+        public <U> CompletionStage<U> thenApply
+            (Function<? super T,? extends U> a) {
+            return cf.thenApply(a); }
+        public <U> CompletionStage<U> thenApplyAsync
+            (Function<? super T,? extends U> fn) {
+            return cf.thenApplyAsync(fn); }
+        public <U> CompletionStage<U> thenApplyAsync
+            (Function<? super T,? extends U> fn,
+             Executor executor) {
+            return cf.thenApplyAsync(fn, executor); }
+        public <U,V> CompletionStage<V> thenCombine
+            (CompletionStage<? extends U> other,
+             BiFunction<? super T,? super U,? extends V> fn) {
+            return cf.thenCombine(other, fn); }
+        public <U,V> CompletionStage<V> thenCombineAsync
+            (CompletionStage<? extends U> other,
+             BiFunction<? super T,? super U,? extends V> fn) {
+            return cf.thenCombineAsync(other, fn); }
+        public <U,V> CompletionStage<V> thenCombineAsync
+            (CompletionStage<? extends U> other,
+             BiFunction<? super T,? super U,? extends V> fn,
+             Executor executor) {
+            return cf.thenCombineAsync(other, fn, executor); }
+        public <U> CompletionStage<Void> thenAcceptBoth
+            (CompletionStage<? extends U> other,
+             BiConsumer<? super T, ? super U> action) {
+            return cf.thenAcceptBoth(other, action); }
+        public <U> CompletionStage<Void> thenAcceptBothAsync
+            (CompletionStage<? extends U> other,
+             BiConsumer<? super T, ? super U> action) {
+            return cf.thenAcceptBothAsync(other, action); }
+        public <U> CompletionStage<Void> thenAcceptBothAsync
+            (CompletionStage<? extends U> other,
+             BiConsumer<? super T, ? super U> action,
+             Executor executor) {
+            return cf.thenAcceptBothAsync(other, action, executor); }
+        public CompletionStage<Void> runAfterBoth
+            (CompletionStage<?> other,
+             Runnable action) {
+            return cf.runAfterBoth(other, action); }
+        public CompletionStage<Void> runAfterBothAsync
+            (CompletionStage<?> other,
+             Runnable action) {
+            return cf.runAfterBothAsync(other, action); }
+        public CompletionStage<Void> runAfterBothAsync
+            (CompletionStage<?> other,
+             Runnable action,
+             Executor executor) {
+            return cf.runAfterBothAsync(other, action, executor); }
+        public <U> CompletionStage<U> applyToEither
+            (CompletionStage<? extends T> other,
+             Function<? super T, U> fn) {
+            return cf.applyToEither(other, fn); }
+        public <U> CompletionStage<U> applyToEitherAsync
+            (CompletionStage<? extends T> other,
+             Function<? super T, U> fn) {
+            return cf.applyToEitherAsync(other, fn); }
+        public <U> CompletionStage<U> applyToEitherAsync
+            (CompletionStage<? extends T> other,
+             Function<? super T, U> fn,
+             Executor executor) {
+            return cf.applyToEitherAsync(other, fn, executor); }
+        public CompletionStage<Void> acceptEither
+            (CompletionStage<? extends T> other,
+             Consumer<? super T> action) {
+            return cf.acceptEither(other, action); }
+        public CompletionStage<Void> acceptEitherAsync
+            (CompletionStage<? extends T> other,
+             Consumer<? super T> action) {
+            return cf.acceptEitherAsync(other, action); }
+        public CompletionStage<Void> acceptEitherAsync
+            (CompletionStage<? extends T> other,
+             Consumer<? super T> action,
+             Executor executor) {
+            return cf.acceptEitherAsync(other, action, executor); }
+        public CompletionStage<Void> runAfterEither
+            (CompletionStage<?> other,
+             Runnable action) {
+            return cf.runAfterEither(other, action); }
+        public CompletionStage<Void> runAfterEitherAsync
+            (CompletionStage<?> other,
+             Runnable action) {
+            return cf.runAfterEitherAsync(other, action); }
+        public CompletionStage<Void> runAfterEitherAsync
+            (CompletionStage<?> other,
+             Runnable action,
+             Executor executor) {
+            return cf.runAfterEitherAsync(other, action, executor); }
+        public <U> CompletionStage<U> thenCompose
+            (Function<? super T, ? extends CompletionStage<U>> fn) {
+            return cf.thenCompose(fn); }
+        public <U> CompletionStage<U> thenComposeAsync
+            (Function<? super T, ? extends CompletionStage<U>> fn) {
+            return cf.thenComposeAsync(fn); }
+        public <U> CompletionStage<U> thenComposeAsync
+            (Function<? super T, ? extends CompletionStage<U>> fn,
+             Executor executor) {
+            return cf.thenComposeAsync(fn, executor); }
+        public <U> CompletionStage<U> handle
+            (BiFunction<? super T, Throwable, ? extends U> fn) {
+            return cf.handle(fn); }
+        public <U> CompletionStage<U> handleAsync
+            (BiFunction<? super T, Throwable, ? extends U> fn) {
+            return cf.handleAsync(fn); }
+        public <U> CompletionStage<U> handleAsync
+            (BiFunction<? super T, Throwable, ? extends U> fn,
+             Executor executor) {
+            return cf.handleAsync(fn, executor); }
+        public CompletionStage<T> whenComplete
+            (BiConsumer<? super T, ? super Throwable> action) {
+            return cf.whenComplete(action); }
+        public CompletionStage<T> whenCompleteAsync
+            (BiConsumer<? super T, ? super Throwable> action) {
+            return cf.whenCompleteAsync(action); }
+        public CompletionStage<T> whenCompleteAsync
+            (BiConsumer<? super T, ? super Throwable> action,
+             Executor executor) {
+            return cf.whenCompleteAsync(action, executor); }
+        public CompletionStage<T> exceptionally
+            (Function<Throwable, ? extends T> fn) {
+            return cf.exceptionally(fn); }
+    }
+
+    /**
+     * default-implemented exceptionallyAsync action is not invoked when
+     * source completes normally, and source result is propagated
+     */
+    public void testDefaultExceptionallyAsync_normalCompletion() {
+        for (boolean createIncomplete : new boolean[] { true, false })
+        for (Integer v1 : new Integer[] { 1, null })
+    {
+        final CompletableFuture<Integer> f = new CompletableFuture<>();
+        final DelegatedCompletionStage<Integer> d =
+            new DelegatedCompletionStage<Integer>(f);
+        if (!createIncomplete) assertTrue(f.complete(v1));
+        final CompletionStage<Integer> g = d.exceptionallyAsync
+            ((Throwable t) -> {
+                threadFail("should not be called");
+                return null;            // unreached
+            });
+        if (createIncomplete) assertTrue(f.complete(v1));
+
+        checkCompletedNormally(g.toCompletableFuture(), v1);
+    }}
+
+    /**
+     * default-implemented exceptionallyAsync action completes with
+     * function value on source exception
+     */
+    public void testDefaultExceptionallyAsync_exceptionalCompletion() {
+        for (boolean createIncomplete : new boolean[] { true, false })
+        for (Integer v1 : new Integer[] { 1, null })
+    {
+        final AtomicInteger a = new AtomicInteger(0);
+        final CFException ex = new CFException();
+        final CompletableFuture<Integer> f = new CompletableFuture<>();
+        final DelegatedCompletionStage<Integer> d =
+            new DelegatedCompletionStage<Integer>(f);
+        if (!createIncomplete) f.completeExceptionally(ex);
+        final CompletionStage<Integer> g = d.exceptionallyAsync
+            ((Throwable t) -> {
+                threadAssertSame(t, ex);
+                a.getAndIncrement();
+                return v1;
+            });
+        if (createIncomplete) f.completeExceptionally(ex);
+
+        checkCompletedNormally(g.toCompletableFuture(), v1);
+        assertEquals(1, a.get());
+    }}
+
+    /**
+     * Under default implementation, if an "exceptionally action"
+     * throws an exception, it completes exceptionally with that
+     * exception
+     */
+    public void testDefaultExceptionallyAsync_exceptionalCompletionActionFailed() {
+        for (boolean createIncomplete : new boolean[] { true, false })
+    {
+        final AtomicInteger a = new AtomicInteger(0);
+        final CFException ex1 = new CFException();
+        final CFException ex2 = new CFException();
+        final CompletableFuture<Integer> f = new CompletableFuture<>();
+        final DelegatedCompletionStage<Integer> d =
+            new DelegatedCompletionStage<Integer>(f);
+        if (!createIncomplete) f.completeExceptionally(ex1);
+        final CompletionStage<Integer> g = d.exceptionallyAsync
+            ((Throwable t) -> {
+                threadAssertSame(t, ex1);
+                a.getAndIncrement();
+                throw ex2;
+            });
+        if (createIncomplete) f.completeExceptionally(ex1);
+
+        checkCompletedWithWrappedException(g.toCompletableFuture(), ex2);
+        checkCompletedExceptionally(f, ex1);
+        checkCompletedExceptionally(d.toCompletableFuture(), ex1);
+        assertEquals(1, a.get());
+    }}
+
+    /**
+     * default-implemented exceptionallyCompose result completes
+     * normally after normal completion of source
+     */
+    public void testDefaultExceptionallyCompose_normalCompletion() {
+        for (boolean createIncomplete : new boolean[] { true, false })
+        for (Integer v1 : new Integer[] { 1, null })
+    {
+        final CompletableFuture<Integer> f = new CompletableFuture<>();
+        final ExceptionalCompletableFutureFunction r =
+            new ExceptionalCompletableFutureFunction(ExecutionMode.SYNC);
+        final DelegatedCompletionStage<Integer> d =
+            new DelegatedCompletionStage<Integer>(f);
+        if (!createIncomplete) assertTrue(f.complete(v1));
+        final CompletionStage<Integer> g = d.exceptionallyCompose(r);
+        if (createIncomplete) assertTrue(f.complete(v1));
+
+        checkCompletedNormally(f, v1);
+        checkCompletedNormally(g.toCompletableFuture(), v1);
+        r.assertNotInvoked();
+    }}
+
+    /**
+     * default-implemented exceptionallyCompose result completes
+     * normally after exceptional completion of source
+     */
+    public void testDefaultExceptionallyCompose_exceptionalCompletion() {
+        for (boolean createIncomplete : new boolean[] { true, false })
+    {
+        final CFException ex = new CFException();
+        final ExceptionalCompletableFutureFunction r =
+            new ExceptionalCompletableFutureFunction(ExecutionMode.SYNC);
+        final CompletableFuture<Integer> f = new CompletableFuture<>();
+        final DelegatedCompletionStage<Integer> d =
+            new DelegatedCompletionStage<Integer>(f);
+        if (!createIncomplete) f.completeExceptionally(ex);
+        final CompletionStage<Integer> g = d.exceptionallyCompose(r);
+        if (createIncomplete) f.completeExceptionally(ex);
+
+        checkCompletedExceptionally(f, ex);
+        checkCompletedNormally(g.toCompletableFuture(), r.value);
+        r.assertInvoked();
+    }}
+
+    /**
+     * default-implemented exceptionallyCompose completes
+     * exceptionally on exception if action does
+     */
+    public void testDefaultExceptionallyCompose_actionFailed() {
+        for (boolean createIncomplete : new boolean[] { true, false })
+    {
+        final CFException ex = new CFException();
+        final CompletableFuture<Integer> f = new CompletableFuture<>();
+        final FailingExceptionalCompletableFutureFunction r
+            = new FailingExceptionalCompletableFutureFunction(ExecutionMode.SYNC);
+        final DelegatedCompletionStage<Integer> d =
+            new DelegatedCompletionStage<Integer>(f);
+        if (!createIncomplete) f.completeExceptionally(ex);
+        final CompletionStage<Integer> g = d.exceptionallyCompose(r);
+        if (createIncomplete) f.completeExceptionally(ex);
+
+        checkCompletedExceptionally(f, ex);
+        checkCompletedWithWrappedException(g.toCompletableFuture(), r.ex);
+        r.assertInvoked();
+    }}
+
+    /**
+     * default-implemented exceptionallyComposeAsync result completes
+     * normally after normal completion of source
+     */
+    public void testDefaultExceptionallyComposeAsync_normalCompletion() {
+        for (boolean createIncomplete : new boolean[] { true, false })
+        for (Integer v1 : new Integer[] { 1, null })
+    {
+        final CompletableFuture<Integer> f = new CompletableFuture<>();
+        final ExceptionalCompletableFutureFunction r =
+            new ExceptionalCompletableFutureFunction(ExecutionMode.ASYNC);
+        final DelegatedCompletionStage<Integer> d =
+            new DelegatedCompletionStage<Integer>(f);
+        if (!createIncomplete) assertTrue(f.complete(v1));
+        final CompletionStage<Integer> g = d.exceptionallyComposeAsync(r);
+        if (createIncomplete) assertTrue(f.complete(v1));
+
+        checkCompletedNormally(f, v1);
+        checkCompletedNormally(g.toCompletableFuture(), v1);
+        r.assertNotInvoked();
+    }}
+
+    /**
+     * default-implemented exceptionallyComposeAsync result completes
+     * normally after exceptional completion of source
+     */
+    public void testDefaultExceptionallyComposeAsync_exceptionalCompletion() {
+        for (boolean createIncomplete : new boolean[] { true, false })
+    {
+        final CFException ex = new CFException();
+        final ExceptionalCompletableFutureFunction r =
+            new ExceptionalCompletableFutureFunction(ExecutionMode.ASYNC);
+        final CompletableFuture<Integer> f = new CompletableFuture<>();
+        final DelegatedCompletionStage<Integer> d =
+            new DelegatedCompletionStage<Integer>(f);
+        if (!createIncomplete) f.completeExceptionally(ex);
+        final CompletionStage<Integer> g = d.exceptionallyComposeAsync(r);
+        if (createIncomplete) f.completeExceptionally(ex);
+
+        checkCompletedExceptionally(f, ex);
+        checkCompletedNormally(g.toCompletableFuture(), r.value);
+        r.assertInvoked();
+    }}
+
+    /**
+     * default-implemented exceptionallyComposeAsync completes
+     * exceptionally on exception if action does
+     */
+    public void testDefaultExceptionallyComposeAsync_actionFailed() {
+        for (boolean createIncomplete : new boolean[] { true, false })
+    {
+        final CFException ex = new CFException();
+        final CompletableFuture<Integer> f = new CompletableFuture<>();
+        final FailingExceptionalCompletableFutureFunction r
+            = new FailingExceptionalCompletableFutureFunction(ExecutionMode.ASYNC);
+        final DelegatedCompletionStage<Integer> d =
+            new DelegatedCompletionStage<Integer>(f);
+        if (!createIncomplete) f.completeExceptionally(ex);
+        final CompletionStage<Integer> g = d.exceptionallyComposeAsync(r);
+        if (createIncomplete) f.completeExceptionally(ex);
+
+        checkCompletedExceptionally(f, ex);
+        checkCompletedWithWrappedException(g.toCompletableFuture(), r.ex);
+        r.assertInvoked();
+    }}
+
+    /**
+     * default-implemented exceptionallyComposeAsync result completes
+     * normally after normal completion of source
+     */
+    public void testDefaultExceptionallyComposeAsyncExecutor_normalCompletion() {
+        for (boolean createIncomplete : new boolean[] { true, false })
+        for (Integer v1 : new Integer[] { 1, null })
+    {
+        final CompletableFuture<Integer> f = new CompletableFuture<>();
+        final ExceptionalCompletableFutureFunction r =
+            new ExceptionalCompletableFutureFunction(ExecutionMode.EXECUTOR);
+        final DelegatedCompletionStage<Integer> d =
+            new DelegatedCompletionStage<Integer>(f);
+        if (!createIncomplete) assertTrue(f.complete(v1));
+        final CompletionStage<Integer> g = d.exceptionallyComposeAsync(r, new ThreadExecutor());
+        if (createIncomplete) assertTrue(f.complete(v1));
+
+        checkCompletedNormally(f, v1);
+        checkCompletedNormally(g.toCompletableFuture(), v1);
+        r.assertNotInvoked();
+    }}
+
+    /**
+     * default-implemented exceptionallyComposeAsync result completes
+     * normally after exceptional completion of source
+     */
+    public void testDefaultExceptionallyComposeAsyncExecutor_exceptionalCompletion() {
+        for (boolean createIncomplete : new boolean[] { true, false })
+    {
+        final CFException ex = new CFException();
+        final ExceptionalCompletableFutureFunction r =
+            new ExceptionalCompletableFutureFunction(ExecutionMode.EXECUTOR);
+        final CompletableFuture<Integer> f = new CompletableFuture<>();
+        final DelegatedCompletionStage<Integer> d =
+            new DelegatedCompletionStage<Integer>(f);
+        if (!createIncomplete) f.completeExceptionally(ex);
+        final CompletionStage<Integer> g = d.exceptionallyComposeAsync(r, new ThreadExecutor());
+        if (createIncomplete) f.completeExceptionally(ex);
+
+        checkCompletedExceptionally(f, ex);
+        checkCompletedNormally(g.toCompletableFuture(), r.value);
+        r.assertInvoked();
+    }}
+
+    /**
+     * default-implemented exceptionallyComposeAsync completes
+     * exceptionally on exception if action does
+     */
+    public void testDefaultExceptionallyComposeAsyncExecutor_actionFailed() {
+        for (boolean createIncomplete : new boolean[] { true, false })
+    {
+        final CFException ex = new CFException();
+        final CompletableFuture<Integer> f = new CompletableFuture<>();
+        final FailingExceptionalCompletableFutureFunction r
+            = new FailingExceptionalCompletableFutureFunction(ExecutionMode.EXECUTOR);
+        final DelegatedCompletionStage<Integer> d =
+            new DelegatedCompletionStage<Integer>(f);
+        if (!createIncomplete) f.completeExceptionally(ex);
+        final CompletionStage<Integer> g = d.exceptionallyComposeAsync(r, new ThreadExecutor());
+        if (createIncomplete) f.completeExceptionally(ex);
+
+        checkCompletedExceptionally(f, ex);
+        checkCompletedWithWrappedException(g.toCompletableFuture(), r.ex);
+        r.assertInvoked();
+    }}
+
 }
--- a/test/jdk/java/util/concurrent/tck/CountedCompleterTest.java	Wed Oct 03 15:54:35 2018 +0200
+++ b/test/jdk/java/util/concurrent/tck/CountedCompleterTest.java	Wed Oct 03 16:02:24 2018 +0200
@@ -135,10 +135,14 @@
 
         assertFalse(a.cancel(false));
         assertFalse(a.cancel(true));
+
+        Object v1 = null, v2 = null;
         try {
-            assertNull(a.get());
-            assertNull(a.get(randomTimeout(), randomTimeUnit()));
+            v1 = a.get();
+            v2 = a.get(randomTimeout(), randomTimeUnit());
         } catch (Throwable fail) { threadUnexpectedException(fail); }
+        assertNull(v1);
+        assertNull(v2);
     }
 
     void checkCancelled(CountedCompleter a) {
--- a/test/jdk/java/util/concurrent/tck/DelayQueueTest.java	Wed Oct 03 15:54:35 2018 +0200
+++ b/test/jdk/java/util/concurrent/tck/DelayQueueTest.java	Wed Oct 03 16:02:24 2018 +0200
@@ -96,7 +96,7 @@
         // suppress [overrides] javac warning
         public int hashCode() { return pseudodelay; }
         public long getDelay(TimeUnit ignore) {
-            return Integer.MIN_VALUE + pseudodelay;
+            return (long) Integer.MIN_VALUE + pseudodelay;
         }
         public String toString() {
             return String.valueOf(pseudodelay);
--- a/test/jdk/java/util/concurrent/tck/ForkJoinPool8Test.java	Wed Oct 03 15:54:35 2018 +0200
+++ b/test/jdk/java/util/concurrent/tck/ForkJoinPool8Test.java	Wed Oct 03 16:02:24 2018 +0200
@@ -133,10 +133,14 @@
         assertNull(a.join());
         assertFalse(a.cancel(false));
         assertFalse(a.cancel(true));
+
+        Object v1 = null, v2 = null;
         try {
-            assertNull(a.get());
-            assertNull(a.get(randomTimeout(), randomTimeUnit()));
+            v1 = a.get();
+            v2 = a.get(randomTimeout(), randomTimeUnit());
         } catch (Throwable fail) { threadUnexpectedException(fail); }
+        assertNull(v1);
+        assertNull(v2);
     }
 
     void checkCancelled(ForkJoinTask a) {
--- a/test/jdk/java/util/concurrent/tck/ForkJoinTask8Test.java	Wed Oct 03 15:54:35 2018 +0200
+++ b/test/jdk/java/util/concurrent/tck/ForkJoinTask8Test.java	Wed Oct 03 16:02:24 2018 +0200
@@ -140,13 +140,13 @@
         checkCompletedNormally(a, null);
     }
 
-    <T> void checkCompletedNormally(ForkJoinTask<T> a, T expected) {
+    <T> void checkCompletedNormally(ForkJoinTask<T> a, T expectedValue) {
         assertTrue(a.isDone());
         assertFalse(a.isCancelled());
         assertTrue(a.isCompletedNormally());
         assertFalse(a.isCompletedAbnormally());
         assertNull(a.getException());
-        assertSame(expected, a.getRawResult());
+        assertSame(expectedValue, a.getRawResult());
         if (a instanceof BinaryAsyncAction)
             assertEquals(COMPLETE_STATE,
                          ((BinaryAsyncAction)a).getForkJoinTaskTag());
@@ -154,7 +154,7 @@
         {
             Thread.currentThread().interrupt();
             long startTime = System.nanoTime();
-            assertSame(expected, a.join());
+            assertSame(expectedValue, a.join());
             assertTrue(millisElapsedSince(startTime) < LONG_DELAY_MS);
             Thread.interrupted();
         }
@@ -169,10 +169,14 @@
 
         assertFalse(a.cancel(false));
         assertFalse(a.cancel(true));
+
+        T v1 = null, v2 = null;
         try {
-            assertSame(expected, a.get());
-            assertSame(expected, a.get(randomTimeout(), randomTimeUnit()));
+            v1 = a.get();
+            v2 = a.get(randomTimeout(), randomTimeUnit());
         } catch (Throwable fail) { threadUnexpectedException(fail); }
+        assertSame(expectedValue, v1);
+        assertSame(expectedValue, v2);
     }
 
     void checkCompletedAbnormally(ForkJoinTask a, Throwable t) {
--- a/test/jdk/java/util/concurrent/tck/ForkJoinTaskTest.java	Wed Oct 03 15:54:35 2018 +0200
+++ b/test/jdk/java/util/concurrent/tck/ForkJoinTaskTest.java	Wed Oct 03 16:02:24 2018 +0200
@@ -114,18 +114,18 @@
         checkCompletedNormally(a, null);
     }
 
-    <T> void checkCompletedNormally(ForkJoinTask<T> a, T expected) {
+    <T> void checkCompletedNormally(ForkJoinTask<T> a, T expectedValue) {
         assertTrue(a.isDone());
         assertFalse(a.isCancelled());
         assertTrue(a.isCompletedNormally());
         assertFalse(a.isCompletedAbnormally());
         assertNull(a.getException());
-        assertSame(expected, a.getRawResult());
+        assertSame(expectedValue, a.getRawResult());
 
         {
             Thread.currentThread().interrupt();
             long startTime = System.nanoTime();
-            assertSame(expected, a.join());
+            assertSame(expectedValue, a.join());
             assertTrue(millisElapsedSince(startTime) < LONG_DELAY_MS);
             Thread.interrupted();
         }
@@ -140,10 +140,14 @@
 
         assertFalse(a.cancel(false));
         assertFalse(a.cancel(true));
+
+        T v1 = null, v2 = null;
         try {
-            assertSame(expected, a.get());
-            assertSame(expected, a.get(randomTimeout(), randomTimeUnit()));
+            v1 = a.get();
+            v2 = a.get(randomTimeout(), randomTimeUnit());
         } catch (Throwable fail) { threadUnexpectedException(fail); }
+        assertSame(expectedValue, v1);
+        assertSame(expectedValue, v2);
     }
 
     void checkCancelled(ForkJoinTask a) {
--- a/test/jdk/java/util/concurrent/tck/FutureTaskTest.java	Wed Oct 03 15:54:35 2018 +0200
+++ b/test/jdk/java/util/concurrent/tck/FutureTaskTest.java	Wed Oct 03 16:02:24 2018 +0200
@@ -87,8 +87,9 @@
             pf.run();
             pf.runAndReset();
             assertEquals(savedRunCount, pf.runCount());
+            Object r2 = null;
             try {
-                assertSame(r, f.get());
+                r2 = f.get();
             } catch (CancellationException t) {
                 assertSame(exInfo, CancellationException.class);
             } catch (ExecutionException t) {
@@ -96,6 +97,8 @@
             } catch (Throwable t) {
                 threadUnexpectedException(t);
             }
+            if (exInfo == null)
+                assertSame(r, r2);
             assertTrue(f.isDone());
         }
     }
@@ -128,14 +131,17 @@
         }
     }
 
-    <T> void checkCompletedNormally(Future<T> f, T expected) {
+    <T> void checkCompletedNormally(Future<T> f, T expectedValue) {
         checkIsDone(f);
         assertFalse(f.isCancelled());
 
+        T v1 = null, v2 = null;
         try {
-            assertSame(expected, f.get());
-            assertSame(expected, f.get(randomTimeout(), randomTimeUnit()));
+            v1 = f.get();
+            v2 = f.get(randomTimeout(), randomTimeUnit());
         } catch (Throwable fail) { threadUnexpectedException(fail); }
+        assertSame(expectedValue, v1);
+        assertSame(expectedValue, v2);
     }
 
     void checkCancelled(Future<?> f) {
@@ -485,7 +491,7 @@
         try {
             task.cancel(true);
             shouldThrow();
-        } catch (SecurityException expected) {}
+        } catch (SecurityException success) {}
 
         // We failed to deliver the interrupt, but the world retains
         // its sanity, as if we had done task.cancel(false)
--- a/test/jdk/java/util/concurrent/tck/JSR166TestCase.java	Wed Oct 03 15:54:35 2018 +0200
+++ b/test/jdk/java/util/concurrent/tck/JSR166TestCase.java	Wed Oct 03 16:02:24 2018 +0200
@@ -1415,9 +1415,11 @@
      */
     <T> void checkTimedGet(Future<T> f, T expectedValue, long timeoutMillis) {
         long startTime = System.nanoTime();
+        T actual = null;
         try {
-            assertEquals(expectedValue, f.get(timeoutMillis, MILLISECONDS));
+            actual = f.get(timeoutMillis, MILLISECONDS);
         } catch (Throwable fail) { threadUnexpectedException(fail); }
+        assertEquals(expectedValue, actual);
         if (millisElapsedSince(startTime) > timeoutMillis/2)
             throw new AssertionError("timed get did not return promptly");
     }
@@ -1596,13 +1598,15 @@
     }
 
     public void await(CountDownLatch latch, long timeoutMillis) {
+        boolean timedOut = false;
         try {
-            if (!latch.await(timeoutMillis, MILLISECONDS))
-                fail("timed out waiting for CountDownLatch for "
-                     + (timeoutMillis/1000) + " sec");
+            timedOut = !latch.await(timeoutMillis, MILLISECONDS);
         } catch (Throwable fail) {
             threadUnexpectedException(fail);
         }
+        if (timedOut)
+            fail("timed out waiting for CountDownLatch for "
+                 + (timeoutMillis/1000) + " sec");
     }
 
     public void await(CountDownLatch latch) {
@@ -1610,13 +1614,15 @@
     }
 
     public void await(Semaphore semaphore) {
+        boolean timedOut = false;
         try {
-            if (!semaphore.tryAcquire(LONG_DELAY_MS, MILLISECONDS))
-                fail("timed out waiting for Semaphore for "
-                     + (LONG_DELAY_MS/1000) + " sec");
+            timedOut = !semaphore.tryAcquire(LONG_DELAY_MS, MILLISECONDS);
         } catch (Throwable fail) {
             threadUnexpectedException(fail);
         }
+        if (timedOut)
+            fail("timed out waiting for Semaphore for "
+                 + (LONG_DELAY_MS/1000) + " sec");
     }
 
     public void await(CyclicBarrier barrier) {
@@ -1802,17 +1808,17 @@
 
     @SuppressWarnings("unchecked")
     <T> T serialClone(T o) {
+        T clone = null;
         try {
             ObjectInputStream ois = new ObjectInputStream
                 (new ByteArrayInputStream(serialBytes(o)));
-            T clone = (T) ois.readObject();
-            if (o == clone) assertImmutable(o);
-            assertSame(o.getClass(), clone.getClass());
-            return clone;
+            clone = (T) ois.readObject();
         } catch (Throwable fail) {
             threadUnexpectedException(fail);
-            return null;
         }
+        if (o == clone) assertImmutable(o);
+        else assertSame(o.getClass(), clone.getClass());
+        return clone;
     }
 
     /**
@@ -1831,7 +1837,7 @@
             (new ByteArrayInputStream(bos.toByteArray()));
         T clone = (T) ois.readObject();
         if (o == clone) assertImmutable(o);
-        assertSame(o.getClass(), clone.getClass());
+        else assertSame(o.getClass(), clone.getClass());
         return clone;
     }
 
--- a/test/jdk/java/util/concurrent/tck/RecursiveActionTest.java	Wed Oct 03 15:54:35 2018 +0200
+++ b/test/jdk/java/util/concurrent/tck/RecursiveActionTest.java	Wed Oct 03 16:02:24 2018 +0200
@@ -123,10 +123,14 @@
         assertNull(a.join());
         assertFalse(a.cancel(false));
         assertFalse(a.cancel(true));
+
+        Object v1 = null, v2 = null;
         try {
-            assertNull(a.get());
-            assertNull(a.get(randomTimeout(), randomTimeUnit()));
+            v1 = a.get();
+            v2 = a.get(randomTimeout(), randomTimeUnit());
         } catch (Throwable fail) { threadUnexpectedException(fail); }
+        assertNull(v1);
+        assertNull(v2);
     }
 
     void checkCancelled(RecursiveAction a) {
--- a/test/jdk/java/util/concurrent/tck/RecursiveTaskTest.java	Wed Oct 03 15:54:35 2018 +0200
+++ b/test/jdk/java/util/concurrent/tck/RecursiveTaskTest.java	Wed Oct 03 16:02:24 2018 +0200
@@ -109,29 +109,33 @@
         } catch (Throwable fail) { threadUnexpectedException(fail); }
     }
 
-    <T> void checkCompletedNormally(RecursiveTask<T> a, T expected) {
+    <T> void checkCompletedNormally(RecursiveTask<T> a, T expectedValue) {
         assertTrue(a.isDone());
         assertFalse(a.isCancelled());
         assertTrue(a.isCompletedNormally());
         assertFalse(a.isCompletedAbnormally());
         assertNull(a.getException());
-        assertSame(expected, a.getRawResult());
-        assertSame(expected, a.join());
+        assertSame(expectedValue, a.getRawResult());
+        assertSame(expectedValue, a.join());
         assertFalse(a.cancel(false));
         assertFalse(a.cancel(true));
+
+        T v1 = null, v2 = null;
         try {
-            assertSame(expected, a.get());
-            assertSame(expected, a.get(randomTimeout(), randomTimeUnit()));
+            v1 = a.get();
+            v2 = a.get(randomTimeout(), randomTimeUnit());
         } catch (Throwable fail) { threadUnexpectedException(fail); }
+        assertSame(expectedValue, v1);
+        assertSame(expectedValue, v2);
     }
 
     /**
      * Waits for the task to complete, and checks that when it does,
      * it will have an Integer result equals to the given int.
      */
-    void checkCompletesNormally(RecursiveTask<Integer> a, int expected) {
+    void checkCompletesNormally(RecursiveTask<Integer> a, int expectedValue) {
         Integer r = a.join();
-        assertEquals(expected, (int) r);
+        assertEquals(expectedValue, (int) r);
         checkCompletedNormally(a, r);
     }
 
@@ -139,9 +143,9 @@
      * Like checkCompletesNormally, but verifies that the task has
      * already completed.
      */
-    void checkCompletedNormally(RecursiveTask<Integer> a, int expected) {
+    void checkCompletedNormally(RecursiveTask<Integer> a, int expectedValue) {
         Integer r = a.getRawResult();
-        assertEquals(expected, (int) r);
+        assertEquals(expectedValue, (int) r);
         checkCompletedNormally(a, r);
     }
 
--- a/test/jdk/java/util/concurrent/tck/ReentrantLockTest.java	Wed Oct 03 15:54:35 2018 +0200
+++ b/test/jdk/java/util/concurrent/tck/ReentrantLockTest.java	Wed Oct 03 16:02:24 2018 +0200
@@ -1187,7 +1187,7 @@
                     await(cond, awaitMethod);
                     throw new AssertionError("should throw");
                 }
-                catch (IllegalMonitorStateException expected) {}
+                catch (IllegalMonitorStateException success) {}
                 catch (Throwable fail) { threadUnexpectedException(fail); }}};
         Thread rogueThread = new Thread(rogue, "rogue");
         threads.add(rogueThread);
--- a/test/jdk/java/util/concurrent/tck/SubmissionPublisherTest.java	Wed Oct 03 15:54:35 2018 +0200
+++ b/test/jdk/java/util/concurrent/tck/SubmissionPublisherTest.java	Wed Oct 03 16:02:24 2018 +0200
@@ -1029,7 +1029,9 @@
             public void onComplete() {}
         }
         pub.subscribe(new Sub());
-        CompletableFuture.runAsync(() -> pub.submit(Boolean.TRUE));
+        checkTimedGet(
+            CompletableFuture.runAsync(() -> pub.submit(Boolean.TRUE)),
+            null);
         await(finished);
     }
 }
--- a/test/jdk/java/util/stream/test/org/openjdk/tests/java/util/stream/CollectorsTest.java	Wed Oct 03 15:54:35 2018 +0200
+++ b/test/jdk/java/util/stream/test/org/openjdk/tests/java/util/stream/CollectorsTest.java	Wed Oct 03 16:02:24 2018 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2012, 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2012, 2018, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -29,6 +29,7 @@
 import java.util.Comparator;
 import java.util.HashMap;
 import java.util.HashSet;
+import java.util.IntSummaryStatistics;
 import java.util.Iterator;
 import java.util.List;
 import java.util.Map;
@@ -39,6 +40,7 @@
 import java.util.concurrent.ConcurrentHashMap;
 import java.util.concurrent.ConcurrentSkipListMap;
 import java.util.concurrent.atomic.AtomicInteger;
+import java.util.function.BiFunction;
 import java.util.function.BinaryOperator;
 import java.util.function.Function;
 import java.util.function.Predicate;
@@ -96,7 +98,7 @@
         @Override
         void assertValue(R value, Supplier<Stream<T>> source, boolean ordered) throws ReflectiveOperationException {
             downstream.assertValue(value,
-                                   () -> source.get().map(mapper::apply),
+                                   () -> source.get().map(mapper),
                                    ordered);
         }
     }
@@ -114,7 +116,7 @@
         @Override
         void assertValue(R value, Supplier<Stream<T>> source, boolean ordered) throws ReflectiveOperationException {
             downstream.assertValue(value,
-                                   () -> source.get().flatMap(mapper::apply),
+                                   () -> source.get().flatMap(mapper),
                                    ordered);
         }
     }
@@ -287,6 +289,27 @@
         }
     }
 
+    static class TeeingAssertion<T, R1, R2, RR> extends CollectorAssertion<T, RR> {
+        private final Collector<T, ?, R1> c1;
+        private final Collector<T, ?, R2> c2;
+        private final BiFunction<? super R1, ? super R2, ? extends RR> finisher;
+
+        TeeingAssertion(Collector<T, ?, R1> c1, Collector<T, ?, R2> c2,
+                               BiFunction<? super R1, ? super R2, ? extends RR> finisher) {
+            this.c1 = c1;
+            this.c2 = c2;
+            this.finisher = finisher;
+        }
+
+        @Override
+        void assertValue(RR value, Supplier<Stream<T>> source, boolean ordered) {
+            R1 r1 = source.get().collect(c1);
+            R2 r2 = source.get().collect(c2);
+            RR expected = finisher.apply(r1, r2);
+            assertEquals(value, expected);
+        }
+    }
+
     private <T> ResultAsserter<T> mapTabulationAsserter(boolean ordered) {
         return (act, exp, ord, par) -> {
             if (par && (!ordered || !ord)) {
@@ -746,4 +769,42 @@
         catch (UnsupportedOperationException ignored) { }
     }
 
+    @Test(dataProvider = "StreamTestData<Integer>", dataProviderClass = StreamTestDataProvider.class)
+    public void testTeeing(String name, TestData.OfRef<Integer> data) throws ReflectiveOperationException {
+        Collector<Integer, ?, Long> summing = Collectors.summingLong(Integer::valueOf);
+        Collector<Integer, ?, Long> counting = Collectors.counting();
+        Collector<Integer, ?, Integer> min = collectingAndThen(Collectors.<Integer>minBy(Comparator.naturalOrder()),
+                opt -> opt.orElse(Integer.MAX_VALUE));
+        Collector<Integer, ?, Integer> max = collectingAndThen(Collectors.<Integer>maxBy(Comparator.naturalOrder()),
+                opt -> opt.orElse(Integer.MIN_VALUE));
+        Collector<Integer, ?, String> joining = mapping(String::valueOf, Collectors.joining(", ", "[", "]"));
+
+        Collector<Integer, ?, Map.Entry<Long, Long>> sumAndCount = Collectors.teeing(summing, counting, Map::entry);
+        Collector<Integer, ?, Map.Entry<Integer, Integer>> minAndMax = Collectors.teeing(min, max, Map::entry);
+        Collector<Integer, ?, Double> averaging = Collectors.teeing(summing, counting,
+                (sum, count) -> ((double)sum) / count);
+        Collector<Integer, ?, String> summaryStatistics = Collectors.teeing(sumAndCount, minAndMax,
+                (sumCountEntry, minMaxEntry) -> new IntSummaryStatistics(
+                        sumCountEntry.getValue(), minMaxEntry.getKey(),
+                        minMaxEntry.getValue(), sumCountEntry.getKey()).toString());
+        Collector<Integer, ?, String> countAndContent = Collectors.teeing(counting, joining,
+                (count, content) -> count+": "+content);
+
+        assertCollect(data, sumAndCount, stream -> {
+            List<Integer> list = stream.collect(toList());
+            return Map.entry(list.stream().mapToLong(Integer::intValue).sum(), (long) list.size());
+        });
+        assertCollect(data, averaging, stream -> stream.mapToInt(Integer::intValue).average().orElse(Double.NaN));
+        assertCollect(data, summaryStatistics,
+                stream -> stream.mapToInt(Integer::intValue).summaryStatistics().toString());
+        assertCollect(data, countAndContent, stream -> {
+            List<Integer> list = stream.collect(toList());
+            return list.size()+": "+list;
+        });
+
+        Function<Integer, Integer> classifier = i -> i % 3;
+        exerciseMapCollection(data, groupingBy(classifier, sumAndCount),
+                new GroupingByAssertion<>(classifier, Map.class,
+                        new TeeingAssertion<>(summing, counting, Map::entry)));
+    }
 }
--- a/test/jdk/javax/security/auth/login/modules/JaasModularClientTest.java	Wed Oct 03 15:54:35 2018 +0200
+++ b/test/jdk/javax/security/auth/login/modules/JaasModularClientTest.java	Wed Oct 03 16:02:24 2018 +0200
@@ -37,15 +37,15 @@
 import java.util.stream.Stream;
 import jdk.test.lib.process.ProcessTools;
 import jdk.test.lib.process.OutputAnalyzer;
-
+import jdk.test.lib.util.JarUtils;
 
 /*
  * @test
  * @bug 8078813 8183310
  * @summary Test custom JAAS login module with all possible modular option.
- * @library /lib/testlibrary /test/lib
+ * @library /test/lib
  * @modules java.base/jdk.internal.module
- * @build JarUtils
+ * @build jdk.test.lib.util.JarUtils
  * @build TestLoginModule JaasClient
  * @run main JaasModularClientTest false
  * @run main JaasModularClientTest true
--- a/test/jdk/javax/security/auth/login/modules/JaasModularDefaultHandlerTest.java	Wed Oct 03 15:54:35 2018 +0200
+++ b/test/jdk/javax/security/auth/login/modules/JaasModularDefaultHandlerTest.java	Wed Oct 03 16:02:24 2018 +0200
@@ -36,14 +36,15 @@
 import java.util.stream.Stream;
 import jdk.test.lib.process.ProcessTools;
 import jdk.test.lib.process.OutputAnalyzer;
+import jdk.test.lib.util.JarUtils;
 
 /*
  * @test
  * @bug 8151654 8183310
  * @summary Test default callback handler with all possible modular option.
- * @library /lib/testlibrary /test/lib
+ * @library /test/lib
  * @modules java.base/jdk.internal.module
- * @build JarUtils
+ * @build jdk.test.lib.util.JarUtils
  * @build TestCallbackHandler TestLoginModule JaasClientWithDefaultHandler
  * @run main JaasModularDefaultHandlerTest
  */
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/jdk/javax/sound/sampled/Clip/ClipIsRunningAfterStop.java	Wed Oct 03 16:02:24 2018 +0200
@@ -0,0 +1,96 @@
+/*
+ * Copyright (c) 2018, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * 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.concurrent.TimeUnit;
+
+import javax.sound.sampled.AudioFormat;
+import javax.sound.sampled.AudioSystem;
+import javax.sound.sampled.Clip;
+import javax.sound.sampled.DataLine;
+import javax.sound.sampled.LineUnavailableException;
+
+import static javax.sound.sampled.AudioFormat.Encoding.PCM_SIGNED;
+
+/**
+ * @test
+ * @bug 8207150
+ * @summary Clip.isRunning() may return true after Clip.stop() was called
+ */
+public final class ClipIsRunningAfterStop {
+
+    private static volatile Exception failed;
+
+    public static void main(final String[] args) throws Exception {
+        final Runnable r = () -> {
+            try {
+                test();
+            } catch (LineUnavailableException | IllegalArgumentException ignored) {
+                // the test is not applicable
+            } catch (Exception ex) {
+                failed = ex;
+            }
+        };
+        Thread t1 = new Thread(r);
+        Thread t2 = new Thread(r);
+        Thread t3 = new Thread(r);
+        t1.start();
+        t2.start();
+        t3.start();
+        t1.join();
+        t2.join();
+        t3.join();
+        if (failed != null) {
+            throw new RuntimeException(failed);
+        }
+    }
+
+    private static void test() throws Exception {
+        // Will run the test no more than 15 seconds
+        long endtime = System.nanoTime() + TimeUnit.SECONDS.toNanos(15);
+        while (failed == null && endtime - System.nanoTime() > 0) {
+            Clip clip = createClip();
+            clip.loop(Clip.LOOP_CONTINUOUSLY);
+            clip.stop();
+            if (clip.isRunning()) {
+                if (clip.isRunning()) {
+                    throw new RuntimeException("Clip is running");
+                }
+            }
+            if (clip.isActive()) {
+                if (clip.isActive()) {
+                    throw new RuntimeException("Clip is active");
+                }
+            }
+            clip.close();
+        }
+    }
+
+    private static Clip createClip() throws LineUnavailableException {
+        AudioFormat format =
+                new AudioFormat(PCM_SIGNED, 44100, 8, 1, 1, 44100, false);
+        DataLine.Info info = new DataLine.Info(Clip.class, format);
+        Clip clip = (Clip) AudioSystem.getLine(info);
+        clip.open(format, new byte[2], 0, 2);
+        return clip;
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/jdk/javax/sql/testng/test/rowset/jdbcrowset/JdbcRowSetDriverManagerTest.java	Wed Oct 03 16:02:24 2018 +0200
@@ -0,0 +1,76 @@
+/*
+ * Copyright (c) 2018, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * 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 test.rowset.jdbcrowset;
+
+import java.sql.Connection;
+import java.sql.DriverManager;
+import java.sql.SQLException;
+import javax.sql.rowset.JdbcRowSet;
+import javax.sql.rowset.RowSetFactory;
+import javax.sql.rowset.RowSetProvider;
+import org.testng.annotations.Test;
+import util.BaseTest;
+import util.StubDriver;
+
+public class JdbcRowSetDriverManagerTest extends BaseTest {
+
+    // URL that the StubDriver recognizes
+    private final static String StubDriverURL = "jdbc:tennis:boy";
+
+    /**
+     * Validate that JDBCRowSetImpl can connect to a JDBC driver that is
+     * register by DriverManager.
+     */
+    @Test(enabled = true)
+    public void test0000() throws SQLException {
+
+        DriverManager.registerDriver(new StubDriver());
+
+        // Show that the StubDriver is loaded and then call setAutoCommit on
+        // the returned Connection
+        dumpRegisteredDrivers();
+        Connection con = DriverManager.getConnection(StubDriverURL, "userid", "password");
+        con.setAutoCommit(true);
+
+        // Have com.sun.rowset.JdbcRowSetImpl create a Connection and
+        // then call setAutoCommit
+        RowSetFactory rsf = RowSetProvider.newFactory();
+        JdbcRowSet jrs = rsf.createJdbcRowSet();
+        jrs.setUrl(StubDriverURL);
+        jrs.setUsername("userid");
+        jrs.setPassword("password");
+
+        jrs.setAutoCommit(true);
+    }
+
+    private static void dumpRegisteredDrivers() {
+        System.out.println("+++ Loaded Drivers +++");
+        System.out.println("++++++++++++++++++++++++");
+        DriverManager.drivers()
+                .forEach(d
+                        -> System.out.println("+++ Driver:" + d + " "
+                        + d.getClass().getClassLoader()));
+        System.out.println("++++++++++++++++++++++++");
+
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/jdk/javax/swing/JEditorPane/TestHTMLBulletsSizeAndAliasing.java	Wed Oct 03 16:02:24 2018 +0200
@@ -0,0 +1,197 @@
+/*
+ * Copyright (c) 2018, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * 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 8201925 8202013
+ * @summary  Verifies if JEditorPane unordered list bullets look pixelated
+ *           and large  relative to text font size
+ * @run main/manual TestHTMLBulletsSizeAndAliasing
+ */
+import java.awt.Dimension;
+import java.awt.FlowLayout;
+import java.awt.BorderLayout;
+import java.awt.Component;
+import java.awt.Graphics;
+import java.awt.Graphics2D;
+import java.awt.RenderingHints;
+import java.awt.event.MouseAdapter;
+import java.awt.event.MouseEvent;
+import java.util.concurrent.CountDownLatch;
+import java.util.concurrent.TimeUnit;
+import javax.swing.JSplitPane;
+import javax.swing.SwingUtilities;
+import javax.swing.JDialog;
+import javax.swing.JPanel;
+import javax.swing.JButton;
+import javax.swing.JFrame;
+import javax.swing.JScrollPane;
+import javax.swing.JTextArea;
+import javax.swing.JEditorPane;
+
+public class TestHTMLBulletsSizeAndAliasing {
+
+    public static void main(String[] args) throws Exception {
+        final CountDownLatch latch = new CountDownLatch(1);
+
+        AliasingTest test = new AliasingTest(latch);
+        Thread T1 = new Thread(test);
+        T1.start();
+
+        // wait for latch to complete
+        boolean ret = false;
+        try {
+            ret = latch.await(60, TimeUnit.SECONDS);
+        } catch (InterruptedException ie) {
+            throw ie;
+        }
+        if (!ret) {
+            test.dispose();
+            throw new RuntimeException(" User has not executed the test");
+        }
+
+        if (test.testResult == false) {
+            throw new RuntimeException("JEditorPane unordered list bullets look pixelated");
+        }
+    }
+}
+
+class AliasingTest implements Runnable {
+    static JFrame f;
+    static JDialog dialog;
+    public boolean testResult = false;
+    private final CountDownLatch latch;
+
+    public AliasingTest(CountDownLatch latch) throws Exception {
+        this.latch = latch;
+    }
+
+    @Override
+    public void run() {
+        try {
+            SwingUtilities.invokeAndWait(() -> {
+                createUI();
+                aliasingTest();
+            });
+        } catch (Exception ex) {
+            if (f != null) {
+                f.dispose();
+            }
+            latch.countDown();
+            throw new RuntimeException("createUI Failed: " + ex.getMessage());
+        }
+
+    }
+
+    public void dispose() {
+        dialog.dispose();
+        f.dispose();
+    }
+
+
+    private static String getHtml() {
+        return "<html><body>" +
+               "<ul>" +
+               "<li>Text</li>" +
+               "<li>Document</li>" +
+               "</ul>" +
+               "</body></html>";
+    }
+
+    private static Component createSplitPane() {
+        JSplitPane splitPane = new JSplitPane(JSplitPane.VERTICAL_SPLIT,
+                createHtmlViewer(false), createHtmlViewer(true));
+        splitPane.setOneTouchExpandable(true);
+        splitPane.setResizeWeight(0.5);
+        splitPane.setPreferredSize(new Dimension(150, 150));
+        return splitPane;
+    }
+
+    private static Component createHtmlViewer(boolean antialiasing) {
+        JEditorPane editorPane;
+        if (antialiasing) {
+            editorPane = new JEditorPane() {
+                @Override
+                public void paint(Graphics g) {
+                    Graphics2D g2d = (Graphics2D) g.create();
+                    g2d.setRenderingHint(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_ON);
+                    super.paint(g2d);
+                    g2d.dispose();
+                }
+            };
+        }
+        else {
+            editorPane = new JEditorPane();
+        }
+        editorPane.setEditable(false);
+        editorPane.setContentType("text/html");
+        editorPane.setText(getHtml());
+        return new JScrollPane(editorPane);
+    }
+    private static void aliasingTest() {
+        f = new JFrame("List Bullets");
+        f.add(createSplitPane());
+        f.pack();
+        f.setLocationRelativeTo(null);
+        f.setVisible(true);
+    }
+
+
+    private final void createUI() {
+        String description
+                = " INSTRUCTIONS:\n"
+                + " A JEditorPane divided by SplitPane will be shown.\n"
+                + " The upper html is rendered in a default JEditorPane.\n "
+                + " The lower html is rendered in a JEditorPane using "
+                + " rendering hints to turn on antialiasing.\n"
+                + " If upper html bullets looks pixelated AND"
+                + " larger than needed relative to text font size\n"
+                + " and not as smooth as shown in lower html\n "
+                + " then press fail else press pass";
+
+        dialog = new JDialog();
+        dialog.setTitle("textselectionTest");
+        JTextArea textArea = new JTextArea(description);
+        textArea.setEditable(false);
+        final JButton passButton = new JButton("PASS");
+        passButton.addActionListener((e) -> {
+            testResult = true;
+            dispose();
+            latch.countDown();
+        });
+        final JButton failButton = new JButton("FAIL");
+        failButton.addActionListener((e) -> {
+            testResult = false;
+            dispose();
+            latch.countDown();
+        });
+        JPanel mainPanel = new JPanel(new BorderLayout());
+        mainPanel.add(textArea, BorderLayout.CENTER);
+        JPanel buttonPanel = new JPanel(new FlowLayout());
+        buttonPanel.add(passButton);
+        buttonPanel.add(failButton);
+        mainPanel.add(buttonPanel, BorderLayout.SOUTH);
+        dialog.add(mainPanel);
+        dialog.pack();
+        dialog.setVisible(true);
+    }
+}
--- a/test/jdk/javax/swing/JSplitPane/4816114/bug4816114.java	Wed Oct 03 15:54:35 2018 +0200
+++ b/test/jdk/javax/swing/JSplitPane/4816114/bug4816114.java	Wed Oct 03 16:02:24 2018 +0200
@@ -24,20 +24,26 @@
 /*
  * @test
  * @key headful
- * @bug 4816114
+ * @bug 4816114 8203904
  * @summary REGRESSION: Regression in divider location behavior when JSplitPane is resized
  * @author Andrey Pikalev
  * @run main bug4816114
  */
 
-import javax.swing.*;
-import java.awt.*;
-import java.lang.reflect.*;
-
+import java.awt.Robot;
+import java.awt.Dimension;
+import java.awt.AWTException;
+import java.awt.BorderLayout;
+import javax.swing.JFrame;
+import javax.swing.JButton;
+import javax.swing.SwingUtilities;
+import javax.swing.JSplitPane;
+import javax.swing.BorderFactory;
+import java.lang.reflect.InvocationTargetException;
 
 public class bug4816114 {
 
-    JFrame fr;
+    static JFrame fr;
     JSplitPane splitPane;
 
     boolean[] resized = new boolean[] { false, false, false,
@@ -49,43 +55,49 @@
     static bug4816114 test = new bug4816114();
 
     public static void main(String[] args) throws InterruptedException, InvocationTargetException, AWTException {
-        SwingUtilities.invokeAndWait(new Runnable() {
-            public void run() {
-                test.createAndShowGUI();
-            }
-        });
-        Robot robot = new Robot();
-        robot.waitForIdle();
-        Thread.sleep(1000);
-        Thread.sleep(2000);
+        try {
+            SwingUtilities.invokeAndWait(new Runnable() {
+                public void run() {
+                    test.createAndShowGUI();
+                }
+            });
+            Robot robot = new Robot();
+            robot.waitForIdle();
+            Thread.sleep(1000);
+            Thread.sleep(2000);
 
-        step++;
-        test.doTest(150, 300);
+            step++;
+            test.doTest(150, 300);
 
-        step++;
-        test.doTest(650, 300);
+            step++;
+            test.doTest(650, 300);
 
-        SwingUtilities.invokeAndWait(new Runnable() {
-            public void run() {
-                test.splitPane.setOrientation(JSplitPane.VERTICAL_SPLIT);
-            }
-        });
+            SwingUtilities.invokeAndWait(new Runnable() {
+                public void run() {
+                    test.splitPane.setOrientation(JSplitPane.VERTICAL_SPLIT);
+                }
+            });
 
-        step++;
-        test.doTest(300, 650);
+            step++;
+            test.doTest(300, 650);
 
-        step++;
-        test.doTest(300, 150);
+            step++;
+            test.doTest(300, 150);
+
+            step++;
+            test.doTest(300, 650);
 
-        step++;
-        test.doTest(300, 650);
-
-        if ( !test.isPassed() ) {
-            throw new Error("The divider location is wrong.");
+            if ( !test.isPassed() ) {
+                throw new Error("The divider location is wrong.");
+            }
+        } finally {
+            SwingUtilities.invokeAndWait(() -> fr.dispose());
         }
     }
+
     public void createAndShowGUI() {
         fr = new JFrame("Test");
+        fr.setUndecorated(true);
 
         splitPane = new TestSplitPane();
         splitPane.setOrientation(JSplitPane.HORIZONTAL_SPLIT);
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/jdk/javax/swing/JTable/TestClearSel.java	Wed Oct 03 16:02:24 2018 +0200
@@ -0,0 +1,194 @@
+/*
+ * Copyright (c) 2018, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * 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
+ * @key headful
+ * @bug 8202702
+ * @summary  Verifies if Jtable clear selction causes disappearance of a row.
+ * @run main/manual TestClearSel
+ */
+import java.awt.BorderLayout;
+import java.awt.Component;
+import java.awt.FlowLayout;
+import java.awt.event.MouseAdapter;
+import java.awt.event.MouseEvent;
+import java.util.concurrent.CountDownLatch;
+import java.util.concurrent.TimeUnit;
+import javax.swing.JButton;
+import javax.swing.JDialog;
+import javax.swing.JFrame;
+import javax.swing.JPanel;
+import javax.swing.JTable;
+import javax.swing.JTextArea;
+import javax.swing.SwingUtilities;
+import javax.swing.table.DefaultTableModel;
+import javax.swing.table.TableModel;
+
+public class TestClearSel {
+
+    static DefaultTableModel model;
+
+    public static void main(String[] args) throws Exception {
+        final CountDownLatch latch = new CountDownLatch(1);
+
+        ClearSelTest test = new ClearSelTest(latch);
+        Thread T1 = new Thread(test);
+        T1.start();
+
+        // wait for latch to complete
+        boolean ret = false;
+        try {
+            ret = latch.await(60, TimeUnit.SECONDS);
+        } catch (InterruptedException ie) {
+            throw ie;
+        }
+        if (!ret) {
+            test.dispose();
+            throw new RuntimeException(" User has not executed the test");
+        }
+
+        if (test.testResult == false) {
+            throw new RuntimeException("Some text were not rendered properly"
+                    + " during painting of Jtable rows ");
+        }
+    }
+}
+
+class ClearSelTest implements Runnable {
+    static JFrame f;
+    static JDialog dialog;
+    static DefaultTableModel model;
+    public boolean testResult = false;
+    private final CountDownLatch latch;
+    private static String[] rows = new String[]{
+            "Row1", "Row2", "Row3", "Row4", "Row5",
+            "Row6", "Row7", "Row8", "Row9", "Row10"};
+
+    public ClearSelTest(CountDownLatch latch) throws Exception {
+        this.latch = latch;
+    }
+
+    @Override
+    public void run() {
+        try {
+            SwingUtilities.invokeAndWait(() -> {
+                createUI();
+                clearSelTest();
+            });
+        } catch (Exception ex) {
+            if (f != null) {
+                f.dispose();
+            }
+            latch.countDown();
+            throw new RuntimeException("createUI Failed: " + ex.getMessage());
+        }
+
+    }
+
+    public void dispose() {
+        dialog.dispose();
+        f.dispose();
+    }
+
+    private static void clearSelTest() {
+        final DefaultTableModel model = new DefaultTableModel();
+        model.addColumn("Test", rows);
+        final JTable table = new JTable(model);
+        table.setRowHeight(25);
+
+        final MouseAdapter adapt = new MouseAdapter() {
+
+            @Override
+            public void mouseMoved(final MouseEvent pE) {
+                final int row = table.rowAtPoint(pE.getPoint());
+                if (row > -1) {
+                    table.setRowSelectionInterval(row, row);
+                } else {
+                    table.clearSelection();
+                }
+            }
+
+            @Override
+            public void mouseEntered(final MouseEvent pE) {
+                final int row = table.rowAtPoint(pE.getPoint());
+                if (row > -1) {
+                    table.setRowSelectionInterval(row, row);
+                } else {
+                    table.clearSelection();
+                }
+            }
+
+            @Override
+            public void mouseExited(final MouseEvent pE) {
+                table.clearSelection();
+            }
+        };
+        table.addMouseListener(adapt);
+        table.addMouseMotionListener(adapt);
+
+        f = new JFrame();
+        f.setSize(300, 300);
+        f.setLocationRelativeTo(null);
+        f.add(table);
+        f.setVisible(true);
+    }
+
+
+    private final void createUI() {
+        String description
+                = " INSTRUCTIONS:\n"
+                + " A JTable will be shown.\n"
+                + " Move mouse over different row to select the row.\n "
+                + " Please verify if row text disappear "
+                + " if mouse is moved out of table.\n"
+                + " If any moment any part of the rows will not be\n "
+                + " painted properly and if some text are missing in JTable,\n "
+                + " then press fail else press pass";
+
+        dialog = new JDialog();
+        dialog.setTitle("textselectionTest");
+        JTextArea textArea = new JTextArea(description);
+        textArea.setEditable(false);
+        final JButton passButton = new JButton("PASS");
+        passButton.addActionListener((e) -> {
+            testResult = true;
+            dispose();
+            latch.countDown();
+        });
+        final JButton failButton = new JButton("FAIL");
+        failButton.addActionListener((e) -> {
+            testResult = false;
+            dispose();
+            latch.countDown();
+        });
+        JPanel mainPanel = new JPanel(new BorderLayout());
+        mainPanel.add(textArea, BorderLayout.CENTER);
+        JPanel buttonPanel = new JPanel(new FlowLayout());
+        buttonPanel.add(passButton);
+        buttonPanel.add(failButton);
+        mainPanel.add(buttonPanel, BorderLayout.SOUTH);
+        dialog.add(mainPanel);
+        dialog.pack();
+        dialog.setVisible(true);
+    }
+}
--- a/test/jdk/javax/swing/UIDefaults/6795356/TableTest.java	Wed Oct 03 15:54:35 2018 +0200
+++ b/test/jdk/javax/swing/UIDefaults/6795356/TableTest.java	Wed Oct 03 16:02:24 2018 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2009, 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2009, 2018, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -24,14 +24,11 @@
 /*
  * @test
  * @bug 6795356
- * @summary Checks that SwingLazyValue class correclty works
+ * @summary Checks that SwingLazyValue class works correctly
  * @author Alexander Potochkin
- * @modules java.desktop/sun.applet
  * @run main/othervm TableTest
  */
 
-import sun.applet.AppletSecurity;
-
 import javax.swing.*;
 import javax.swing.table.TableCellEditor;
 import java.awt.*;
@@ -41,7 +38,7 @@
     public static void main(String[] args) throws Exception {
 
         KeyboardFocusManager.getCurrentKeyboardFocusManager();
-        System.setSecurityManager(new AppletSecurity());
+        System.setSecurityManager(new SecurityManager());
 
         JTable table = new JTable();
         TableCellEditor de = table.getDefaultEditor(Double.class);
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/jdk/javax/swing/border/TestTitledBorderLeak.java	Wed Oct 03 16:02:24 2018 +0200
@@ -0,0 +1,109 @@
+/*
+ * Copyright (c) 2018, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * 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.lang.ref.WeakReference;
+import java.util.ArrayList;
+import javax.swing.border.TitledBorder;
+import javax.swing.JFrame;
+import javax.swing.JPanel;
+import javax.swing.JLabel;
+import javax.swing.SwingUtilities;
+
+/**
+ * @test
+ * @key headful
+ * @bug 8204963
+ * @summary Verifies TitledBorder's memory leak
+ * @run main TestTitledBorderLeak
+ */
+
+public class TestTitledBorderLeak {
+
+    final static int TOTAL_TITLEDBORDER = 10;
+    final static int GC_ATTEMPTS = 10;
+    static ArrayList<WeakReference<TitledBorder>> weakRefArrTB =
+                                         new ArrayList(TOTAL_TITLEDBORDER);
+
+    public static void main(String[] args) throws Exception {
+
+        JFrame frame[] = new JFrame[TOTAL_TITLEDBORDER];
+
+        SwingUtilities.invokeAndWait(() -> {
+            for (int i = 0; i < TOTAL_TITLEDBORDER; i++) {
+                TitledBorder tb = new TitledBorder("");
+                weakRefArrTB.add(i, new WeakReference<TitledBorder>(tb));
+                JLabel label = new JLabel("TitledBorder");
+                label.setBorder(tb);
+                frame[i] = new JFrame("Borders");
+                JPanel panel = new JPanel();
+                panel.add(label);
+                frame[i].setContentPane(panel);
+                frame[i].setVisible(true);
+
+            }
+        });
+        if (TOTAL_TITLEDBORDER != weakRefArrTB.size()) {
+            System.err.println("TOTAL_TITLEDBORDER != weakRefArrTB.size()");
+        }
+        Thread.sleep(3000);
+        SwingUtilities.invokeAndWait(() -> {
+            for (int i = 0; i < TOTAL_TITLEDBORDER; i++) {
+                frame[i].dispose();
+                frame[i] = null;
+            }
+        });
+        Thread.sleep(3000);
+        attemptGCTitledBorder();
+        if (TOTAL_TITLEDBORDER != getCleanedUpTitledBorderCount()) {
+            throw new RuntimeException("Expected Total TitledBorder to be freed : " + TOTAL_TITLEDBORDER +
+                           " Freed " + getCleanedUpTitledBorderCount());
+        }
+        System.out.println("OK");
+    }
+
+    private static void attemptGCTitledBorder() {
+        // Attempt gc GC_ATTEMPTS times
+        for (int i = 0; i < GC_ATTEMPTS; i++) {
+            System.gc();
+            System.runFinalization();
+            if (getCleanedUpTitledBorderCount() == TOTAL_TITLEDBORDER) {
+                break;
+            }
+            try {
+                Thread.sleep(500);
+            } catch (InterruptedException e) {
+                System.err.println("InterruptedException occurred during Thread.sleep()");
+            }
+        }
+    }
+
+    private static int getCleanedUpTitledBorderCount() {
+        int count = 0;
+        for (WeakReference<TitledBorder> ref : weakRefArrTB) {
+            if (ref.get() == null) {
+                count++;
+            }
+        }
+        return count;
+    }
+}
--- a/test/jdk/jdk/jfr/event/compiler/TestAllocInNewTLAB.java	Wed Oct 03 15:54:35 2018 +0200
+++ b/test/jdk/jdk/jfr/event/compiler/TestAllocInNewTLAB.java	Wed Oct 03 16:02:24 2018 +0200
@@ -43,14 +43,12 @@
  * @requires vm.hasJFR
  * @library /test/lib
  * @run main/othervm -XX:+UseTLAB -XX:TLABSize=100k -XX:-ResizeTLAB -XX:TLABRefillWasteFraction=1 jdk.jfr.event.compiler.TestAllocInNewTLAB
- * @run main/othervm -XX:+UseTLAB -XX:TLABSize=100k -XX:-ResizeTLAB -XX:TLABRefillWasteFraction=1 -XX:-FastTLABRefill jdk.jfr.event.compiler.TestAllocInNewTLAB
  * @run main/othervm -XX:+UseTLAB -XX:TLABSize=100k -XX:-ResizeTLAB -XX:TLABRefillWasteFraction=1 -Xint jdk.jfr.event.compiler.TestAllocInNewTLAB
  */
 
 /**
  * Test that when an object is allocated in a new Thread Local Allocation Buffer (TLAB)
- * an event will be triggered. The test is done for C1-compiler,
- * C2-compiler (-XX:-FastTLABRefill) and interpreted mode (-Xint).
+ * an event will be triggered. The test is done for default and interpreted mode (-Xint).
  *
  * To force objects to be allocated in a new TLAB:
  *      the size of TLAB is set to 100k (-XX:TLABSize=100k);
--- a/test/jdk/jdk/jfr/event/compiler/TestAllocOutsideTLAB.java	Wed Oct 03 15:54:35 2018 +0200
+++ b/test/jdk/jdk/jfr/event/compiler/TestAllocOutsideTLAB.java	Wed Oct 03 16:02:24 2018 +0200
@@ -42,15 +42,13 @@
  * @key jfr
  * @requires vm.hasJFR
  * @library /test/lib
- * @run main/othervm -XX:+UseTLAB -XX:-FastTLABRefill -XX:TLABSize=90k -XX:-ResizeTLAB -XX:TLABRefillWasteFraction=256 jdk.jfr.event.compiler.TestAllocOutsideTLAB
- * @run main/othervm -XX:+UseTLAB -XX:-FastTLABRefill -XX:TLABSize=90k -XX:-ResizeTLAB -XX:TLABRefillWasteFraction=256 jdk.jfr.event.compiler.TestAllocOutsideTLAB
- * @run main/othervm -XX:+UseTLAB -XX:-FastTLABRefill -XX:TLABSize=90k -XX:-ResizeTLAB -XX:TLABRefillWasteFraction=256 -Xint jdk.jfr.event.compiler.TestAllocOutsideTLAB
+ * @run main/othervm -XX:+UseTLAB -XX:TLABSize=90k -XX:-ResizeTLAB -XX:TLABRefillWasteFraction=256 jdk.jfr.event.compiler.TestAllocOutsideTLAB
+ * @run main/othervm -XX:+UseTLAB -XX:TLABSize=90k -XX:-ResizeTLAB -XX:TLABRefillWasteFraction=256 -Xint jdk.jfr.event.compiler.TestAllocOutsideTLAB
  */
 
 /**
  * Test that an event is triggered when an object is allocated outside a
- * Thread Local Allocation Buffer (TLAB). The test is done for C1-compiler,
- * C2-compiler (-XX:-FastTLABRefill) and interpreted mode (-Xint).
+ * Thread Local Allocation Buffer (TLAB). The test is done for default interpreted mode (-Xint).
  *
  * To force objects to be allocated outside TLAB:
  *      the size of TLAB is set to 90k (-XX:TLABSize=90k);
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/jdk/jdk/jfr/event/gc/collection/TestG1ParallelPhases.java	Wed Oct 03 16:02:24 2018 +0200
@@ -0,0 +1,183 @@
+/*
+ * Copyright (c) 2018, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * 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.jfr.event.gc.collection;
+
+import static java.lang.System.gc;
+import static java.lang.Thread.sleep;
+import static java.util.Set.of;
+import static java.util.stream.Collectors.joining;
+import static java.util.stream.Collectors.toList;
+import static java.util.stream.Collectors.toSet;
+import static java.util.stream.IntStream.range;
+import static jdk.jfr.event.gc.collection.Provoker.provokeMixedGC;
+import static jdk.test.lib.Asserts.assertEquals;
+import static jdk.test.lib.Asserts.assertTrue;
+import static jdk.test.lib.jfr.Events.fromRecording;
+import static sun.hotspot.WhiteBox.getWhiteBox;
+
+import java.io.IOException;
+import java.lang.ref.WeakReference;
+import java.math.BigDecimal;
+import java.util.ArrayList;
+import java.util.Collection;
+import java.util.List;
+import java.util.Set;
+
+import jdk.jfr.Recording;
+import jdk.test.lib.Asserts;
+import jdk.test.lib.jfr.EventNames;
+import sun.hotspot.WhiteBox;
+
+/**
+ * @test
+ * @key jfr
+ * @requires vm.hasJFR
+ * @requires vm.gc == "G1" | vm.gc == null
+ * @library /test/lib /test/jdk
+ * @build sun.hotspot.WhiteBox
+ * @run main ClassFileInstaller sun.hotspot.WhiteBox
+ * @run main/othervm -XX:+UnlockExperimentalVMOptions -XX:MaxTenuringThreshold=1 -Xms20M -Xmx20M
+ *      -XX:G1MixedGCLiveThresholdPercent=100 -XX:G1HeapWastePercent=0 -XX:G1HeapRegionSize=1m
+ *      -XX:+UseG1GC -XX:+UseStringDeduplication
+ *      -Xbootclasspath/a:. -XX:+UnlockDiagnosticVMOptions -XX:+WhiteBoxAPI
+ *      jdk.jfr.event.gc.collection.TestG1ParallelPhases
+ */
+
+public class TestG1ParallelPhases {
+    public static List<WeakReference<byte[]>> weakRefs;
+
+    public static void main(String[] args) throws IOException {
+        Recording recording = new Recording();
+        recording.enable(EventNames.GCPhaseParallel);
+        recording.start();
+
+        // create more weak garbage than can fit in this heap (-Xmx20m), will force collection of weak references
+        weakRefs = range(1, 100)
+            .mapToObj(n -> new WeakReference<>(new byte[1_000_000]))
+            .collect(toList()); // force evaluation of lazy stream (all weak refs must be created)
+
+        final var MEG = 1024 * 1024;
+        provokeMixedGC(1 * MEG);
+        recording.stop();
+
+        Set<String> usedPhases = fromRecording(recording).stream()
+            .map(e -> e.getValue("name").toString())
+            .collect(toSet());
+
+        Set<String> allPhases = of(
+            "ExtRootScan",
+            "ThreadRoots",
+            "StringTableRoots",
+            "UniverseRoots",
+            "JNIRoots",
+            "ObjectSynchronizerRoots",
+            "ManagementRoots",
+            "SystemDictionaryRoots",
+            "CLDGRoots",
+            "JVMTIRoots",
+            "CMRefRoots",
+            "WaitForStrongCLD",
+            "WeakCLDRoots",
+            "SATBFiltering",
+            "UpdateRS",
+            "ScanHCC",
+            "ScanRS",
+            "CodeRoots",
+            "ObjCopy",
+            "Termination",
+            "StringDedupQueueFixup",
+            "StringDedupTableFixup",
+            "RedirtyCards",
+       //     "PreserveCMReferents",
+            "NonYoungFreeCSet",
+            "YoungFreeCSet"
+        );
+
+        assertTrue(usedPhases.equals(allPhases), "Compare events expected and received"
+            + ", Not found phases: " + allPhases.stream().filter(p -> !usedPhases.contains(p)).collect(joining(", "))
+            + ", Not expected phases: " + usedPhases.stream().filter(p -> !allPhases.contains(p)).collect(joining(", ")));
+    }
+}
+
+/**
+ * Utility class to guarantee a mixed GC. The class allocates several arrays and
+ * promotes them to the oldgen. After that it tries to provoke mixed GC by
+ * allocating new objects.
+ */
+class Provoker {
+    private static void allocateOldObjects(
+            List<byte[]> liveOldObjects,
+            int g1HeapRegionSize,
+            int arraySize) {
+
+        var toUnreachable = new ArrayList<byte[]>();
+
+        // Allocates buffer and promotes it to the old gen. Mix live and dead old objects.
+        // allocate about two regions of old memory. At least one full old region will guarantee
+        // mixed collection in the future
+        range(0, g1HeapRegionSize/arraySize).forEach(n -> {
+            liveOldObjects.add(new byte[arraySize]);
+            toUnreachable.add(new byte[arraySize]);
+        });
+
+        // Do two young collections, MaxTenuringThreshold=1 will force promotion.
+        getWhiteBox().youngGC();
+        getWhiteBox().youngGC();
+
+        // Check it is promoted & keep alive
+        Asserts.assertTrue(getWhiteBox().isObjectInOldGen(liveOldObjects), "List of the objects is suppose to be in OldGen");
+        Asserts.assertTrue(getWhiteBox().isObjectInOldGen(toUnreachable), "List of the objects is suppose to be in OldGen");
+    }
+
+    private static void waitTillCMCFinished(int sleepTime) {
+        while (getWhiteBox().g1InConcurrentMark()) {
+              try {sleep(sleepTime);} catch (Exception e) {}
+        }
+    }
+
+    /**
+    * The necessary condition for guaranteed mixed GC is running in VM with the following flags:
+    * -XX:+UnlockExperimentalVMOptions -XX:MaxTenuringThreshold=1 -Xms{HEAP_SIZE}M
+    * -Xmx{HEAP_SIZE}M -XX:G1MixedGCLiveThresholdPercent=100 -XX:G1HeapWastePercent=0
+    * -XX:G1HeapRegionSize={REGION_SIZE}m
+    *
+    * @param provokeSize The size to allocate to provoke the start of a mixed gc (half heap size?)
+    * @param g1HeapRegionSize The size of your regions in bytes
+    */
+    public static void provokeMixedGC(int g1HeapRegionSize) {
+        final var arraySize = 20_000;
+        var liveOldObjects = new ArrayList<byte[]>();
+        allocateOldObjects(liveOldObjects, g1HeapRegionSize, arraySize);
+        waitTillCMCFinished(10);
+        getWhiteBox().g1StartConcMarkCycle();
+        waitTillCMCFinished(10);
+        getWhiteBox().youngGC();
+        getWhiteBox().youngGC();
+
+        // check that liveOldObjects still alive
+        assertTrue(getWhiteBox().isObjectInOldGen(liveOldObjects), "List of the objects is suppose to be in OldGen");
+    }
+}
--- a/test/jdk/jdk/jfr/event/oldobject/TestAllocationTime.java	Wed Oct 03 15:54:35 2018 +0200
+++ b/test/jdk/jdk/jfr/event/oldobject/TestAllocationTime.java	Wed Oct 03 16:02:24 2018 +0200
@@ -44,7 +44,7 @@
  * @requires vm.gc == "null"
  * @library /test/lib /test/jdk
  * @modules jdk.jfr/jdk.jfr.internal.test
- * @run main/othervm  -XX:TLABSize=2k -XX:-FastTLABRefill jdk.jfr.event.oldobject.TestAllocationTime
+ * @run main/othervm  -XX:TLABSize=2k jdk.jfr.event.oldobject.TestAllocationTime
  */
 public class TestAllocationTime {
 
--- a/test/jdk/jdk/jfr/event/oldobject/TestLargeRootSet.java	Wed Oct 03 15:54:35 2018 +0200
+++ b/test/jdk/jdk/jfr/event/oldobject/TestLargeRootSet.java	Wed Oct 03 16:02:24 2018 +0200
@@ -45,7 +45,7 @@
  * @requires vm.gc == "null"
  * @library /test/lib /test/jdk
  * @modules jdk.jfr/jdk.jfr.internal.test
- * @run main/othervm -XX:TLABSize=2k -XX:-FastTLABRefill jdk.jfr.event.oldobject.TestLargeRootSet
+ * @run main/othervm -XX:TLABSize=2k jdk.jfr.event.oldobject.TestLargeRootSet
  */
 public class TestLargeRootSet {
 
--- a/test/jdk/jdk/jfr/event/oldobject/TestLastKnownHeapUsage.java	Wed Oct 03 15:54:35 2018 +0200
+++ b/test/jdk/jdk/jfr/event/oldobject/TestLastKnownHeapUsage.java	Wed Oct 03 16:02:24 2018 +0200
@@ -44,7 +44,7 @@
  * @requires vm.gc == "null"
  * @library /test/lib /test/jdk
  * @modules jdk.jfr/jdk.jfr.internal.test
- * @run main/othervm -XX:TLABSize=2k -XX:-FastTLABRefill jdk.jfr.event.oldobject.TestLastKnownHeapUsage
+ * @run main/othervm -XX:TLABSize=2k jdk.jfr.event.oldobject.TestLastKnownHeapUsage
  */
 public class TestLastKnownHeapUsage {
 
--- a/test/jdk/jdk/jfr/startupargs/TestOldObjectQueueSize.java	Wed Oct 03 15:54:35 2018 +0200
+++ b/test/jdk/jdk/jfr/startupargs/TestOldObjectQueueSize.java	Wed Oct 03 16:02:24 2018 +0200
@@ -42,9 +42,9 @@
  * @library /test/lib
  * @key jfr
  *
- * @run main/othervm -XX:TLABSize=2k -XX:-FastTLABRefill -XX:FlightRecorderOptions=old-object-queue-size=0 jdk.jfr.startupargs.TestOldObjectQueueSize off
- * @run main/othervm -XX:TLABSize=2k -Xlog:gc+tlab=trace -XX:-FastTLABRefill -XX:FlightRecorderOptions=old-object-queue-size=10000 jdk.jfr.startupargs.TestOldObjectQueueSize many
- * @run main/othervm -XX:TLABSize=2k -Xlog:gc+tlab=trace -XX:-FastTLABRefill -XX:FlightRecorderOptions=old-object-queue-size=1000000 jdk.jfr.startupargs.TestOldObjectQueueSize many
+ * @run main/othervm -XX:TLABSize=2k -XX:FlightRecorderOptions=old-object-queue-size=0 jdk.jfr.startupargs.TestOldObjectQueueSize off
+ * @run main/othervm -XX:TLABSize=2k -Xlog:gc+tlab=trace -XX:FlightRecorderOptions=old-object-queue-size=10000 jdk.jfr.startupargs.TestOldObjectQueueSize many
+ * @run main/othervm -XX:TLABSize=2k -Xlog:gc+tlab=trace -XX:FlightRecorderOptions=old-object-queue-size=1000000 jdk.jfr.startupargs.TestOldObjectQueueSize many
  */
 public class TestOldObjectQueueSize {
 
--- a/test/jdk/jdk/modules/scenarios/automaticmodules/RunWithAutomaticModules.java	Wed Oct 03 15:54:35 2018 +0200
+++ b/test/jdk/jdk/modules/scenarios/automaticmodules/RunWithAutomaticModules.java	Wed Oct 03 16:02:24 2018 +0200
@@ -23,11 +23,13 @@
 
 /**
  * @test
- * @library /lib/testlibrary /test/lib
+ * @library /test/lib
  * @modules jdk.compiler
  *          java.scripting
  *          jdk.zipfs
- * @build RunWithAutomaticModules jdk.test.lib.compiler.CompilerUtils JarUtils
+ * @build RunWithAutomaticModules
+ *        jdk.test.lib.compiler.CompilerUtils
+ *        jdk.test.lib.util.JarUtils
  *        jdk.test.lib.process.ProcessTools
  * @run testng RunWithAutomaticModules
  * @summary Runs tests that make use of automatic modules
@@ -38,6 +40,7 @@
 import java.nio.file.Paths;
 
 import jdk.test.lib.compiler.CompilerUtils;
+import jdk.test.lib.util.JarUtils;
 import static jdk.test.lib.process.ProcessTools.*;
 
 import org.testng.annotations.Test;
--- a/test/jdk/jprt.config	Wed Oct 03 15:54:35 2018 +0200
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,156 +0,0 @@
-#!echo "This is not a shell script"
-#############################################################################
-# Copyright (c) 2006, 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.
-#############################################################################
-#
-# JPRT shell configuration for testing.
-#
-# Input environment variables:
-#    Windows Only:
-#      PATH
-#      ROOTDIR
-#
-# Output variable settings:
-#    make    Full path to GNU make
-#
-# Output environment variables:
-#    PATH
-#
-#############################################################################
-
-#############################################################################
-# Error
-error() # message
-{
-  echo "ERROR: $1"
-  exit 6
-}
-# Directory must exist
-dirMustExist() # dir name
-{
-  if [ ! -d "$1" ] ; then
-    error "Directory for $2 does not exist: $1"
-  fi
-}
-# File must exist
-fileMustExist() # dir name
-{
-  if [ ! -f "$1" ] ; then
-    error "File for $2 does not exist: $1"
-  fi
-}
-#############################################################################
-
-# Should be set by JPRT as the 3 basic inputs
-slashjava="${ALT_SLASH_JAVA}"
-if [ "${slashjava}" = "" ] ; then
-  slashjava=/java
-fi
-
-# Check input
-dirMustExist "${slashjava}"  ALT_SLASH_JAVA
-
-# Uses 'uname -s', but only expect SunOS or Linux, assume Windows otherwise.
-osname=`uname -s`
-if [ "${osname}" = SunOS ] ; then
-   
-    # SOLARIS: Sparc or X86
-    osarch=`uname -p`
-    if [ "${osarch}" = sparc ] ; then
-	solaris_arch=sparc
-    else
-	solaris_arch=i386
-    fi
-
-    # Add basic solaris system paths
-    path4sdk=/usr/bin:/usr/gnu/bin
-
-    # Find GNU make
-    make=/usr/bin/gmake
-    if [ ! -f ${make} ] ; then
-	make=${slashjava}/devtools/${solaris_arch}/bin/gnumake
-    fi
-    fileMustExist "${make}" make
-
-    # File creation mask
-    umask 002
-
-elif [ "${osname}" = Linux ] ; then
-   
-    # Add basic paths
-    path4sdk=/usr/bin:/bin:/usr/sbin:/sbin
-
-    # Find GNU make
-    make=/usr/bin/make
-    fileMustExist "${make}" make
-
-    umask 002
-
-else
-
-    # Windows: Differs on CYGWIN vs. MKS.
-   
-    # We need to determine if we are running a CYGWIN shell or an MKS shell
-    #    (if uname isn't available, then it will be unix_toolset=unknown)
-    unix_toolset=unknown
-    if [ "`uname -a | fgrep Cygwin`" = "" -a -d "${ROOTDIR}" ] ; then
-        # We kind of assume ROOTDIR is where MKS is and it's ok
-        unix_toolset=MKS
-        mkshome=`dosname -s "${ROOTDIR}"`
-        # Most unix utilities are in the mksnt directory of ROOTDIR
-        unixcommand_path="${mkshome}/mksnt"
-        path4sdk="${unixcommand_path}"
-	devtools_path="${slashjava}/devtools/win32/bin"
-	path4sdk="${devtools_path};${path4sdk}"
-        # Find GNU make
-        make="${devtools_path}/gnumake.exe"
-        fileMustExist "${make}" make
-    elif [ "`uname -a | fgrep Cygwin`" != "" -a -f /bin/cygpath ] ; then
-        # For CYGWIN, uname will have "Cygwin" in it, and /bin/cygpath should exist
-        unix_toolset=CYGWIN
-        # Most unix utilities are in the /usr/bin
-        unixcommand_path="/usr/bin"
-        path4sdk="${unixcommand_path}"
-        # Find GNU make
-        make="${unixcommand_path}/make.exe"
-        fileMustExist "${make}" make
-    else
-      echo "WARNING: Cannot figure out if this is MKS or CYGWIN"
-    fi
-
-    
-    # For windows, it's hard to know where the system is, so we just add this
-    #    to PATH.
-    slash_path="`echo ${path4sdk} | sed -e 's@\\\\@/@g' -e 's@//@/@g' -e 's@/$@@' -e 's@/;@;@g'`"
-    path4sdk="${slash_path};${PATH}"
-    
-    # Convert path4sdk to cygwin style
-    if [ "${unix_toolset}" = CYGWIN ] ; then
-	path4sdk="`/usr/bin/cygpath -p ${path4sdk}`"
-    fi
-
-fi
-
-# Export PATH setting
-PATH="${path4sdk}"
-export PATH
-
--- a/test/jdk/lib/security/CheckBlacklistedCerts.java	Wed Oct 03 15:54:35 2018 +0200
+++ b/test/jdk/lib/security/CheckBlacklistedCerts.java	Wed Oct 03 16:02:24 2018 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2013, 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2013, 2018, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -59,8 +59,7 @@
         // All certs in the pem files
         Set<Certificate> blacklisted = new HashSet<>();
 
-        // Hopefully src comes with test, but it might be missing if doing
-        // a -testonly JPRT job.
+        // Assumes the full src is available
         File[] blacklists = {
             new File(System.getProperty("test.src"),
                 "../../../make/data/blacklistedcertsconverter/blacklisted.certs.pem"),
--- a/test/jdk/lib/testlibrary/JarUtils.java	Wed Oct 03 15:54:35 2018 +0200
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,202 +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.io.File;
-import java.io.IOException;
-import java.io.OutputStream;
-import java.nio.file.Files;
-import java.nio.file.Path;
-import java.nio.file.Paths;
-import java.nio.file.StandardCopyOption;
-import java.util.ArrayList;
-import java.util.Enumeration;
-import java.util.List;
-import java.util.Set;
-import java.util.jar.JarEntry;
-import java.util.jar.JarFile;
-import java.util.jar.JarOutputStream;
-import java.util.jar.Manifest;
-import java.util.stream.Collectors;
-import java.util.stream.Stream;
-
-/**
- * This class consists exclusively of static utility methods that are useful
- * for creating and manipulating JAR files.
- */
-
-public final class JarUtils {
-    private JarUtils() { }
-
-    /**
-     * Creates a JAR file.
-     *
-     * Equivalent to {@code jar cfm <jarfile> <manifest> -C <dir> file...}
-     *
-     * The input files are resolved against the given directory. Any input
-     * files that are directories are processed recursively.
-     */
-    public static void createJarFile(Path jarfile, Manifest man, Path dir, Path... file)
-        throws IOException
-    {
-        // create the target directory
-        Path parent = jarfile.getParent();
-        if (parent != null)
-            Files.createDirectories(parent);
-
-        List<Path> entries = new ArrayList<>();
-        for (Path entry : file) {
-            Files.find(dir.resolve(entry), Integer.MAX_VALUE,
-                        (p, attrs) -> attrs.isRegularFile())
-                    .map(e -> dir.relativize(e))
-                    .forEach(entries::add);
-        }
-
-        try (OutputStream out = Files.newOutputStream(jarfile);
-             JarOutputStream jos = new JarOutputStream(out))
-        {
-            if (man != null) {
-                JarEntry je = new JarEntry(JarFile.MANIFEST_NAME);
-                jos.putNextEntry(je);
-                man.write(jos);
-                jos.closeEntry();
-            }
-
-            for (Path entry : entries) {
-                String name = toJarEntryName(entry);
-                jos.putNextEntry(new JarEntry(name));
-                Files.copy(dir.resolve(entry), jos);
-                jos.closeEntry();
-            }
-        }
-    }
-
-    /**
-     * Creates a JAR file.
-     *
-     * Equivalent to {@code jar cf <jarfile>  -C <dir> file...}
-     *
-     * The input files are resolved against the given directory. Any input
-     * files that are directories are processed recursively.
-     */
-    public static void createJarFile(Path jarfile, Path dir, Path... file)
-        throws IOException
-    {
-        createJarFile(jarfile, null, dir, file);
-    }
-
-    /**
-     * Creates a JAR file.
-     *
-     * Equivalent to {@code jar cf <jarfile> -C <dir> file...}
-     *
-     * The input files are resolved against the given directory. Any input
-     * files that are directories are processed recursively.
-     */
-    public static void createJarFile(Path jarfile, Path dir, String... input)
-        throws IOException
-    {
-        Path[] paths = Stream.of(input).map(Paths::get).toArray(Path[]::new);
-        createJarFile(jarfile, dir, paths);
-    }
-
-    /**
-     * Creates a JAR file from the contents of a directory.
-     *
-     * Equivalent to {@code jar cf <jarfile> -C <dir> .}
-     */
-    public static void createJarFile(Path jarfile, Path dir) throws IOException {
-        createJarFile(jarfile, dir, Paths.get("."));
-    }
-
-    /**
-     * Update a JAR file.
-     *
-     * Equivalent to {@code jar uf <jarfile> -C <dir> file...}
-     *
-     * The input files are resolved against the given directory. Any input
-     * files that are directories are processed recursively.
-     */
-    public static void updateJarFile(Path jarfile, Path dir, Path... file)
-        throws IOException
-    {
-        List<Path> entries = new ArrayList<>();
-        for (Path entry : file) {
-            Files.find(dir.resolve(entry), Integer.MAX_VALUE,
-                    (p, attrs) -> attrs.isRegularFile())
-                    .map(e -> dir.relativize(e))
-                    .forEach(entries::add);
-        }
-
-        Set<String> names = entries.stream()
-                .map(JarUtils::toJarEntryName)
-                .collect(Collectors.toSet());
-
-        Path tmpfile = Files.createTempFile("jar", "jar");
-
-        try (OutputStream out = Files.newOutputStream(tmpfile);
-             JarOutputStream jos = new JarOutputStream(out))
-        {
-            // copy existing entries from the original JAR file
-            try (JarFile jf = new JarFile(jarfile.toString())) {
-                Enumeration<JarEntry> jentries = jf.entries();
-                while (jentries.hasMoreElements()) {
-                    JarEntry jentry = jentries.nextElement();
-                    if (!names.contains(jentry.getName())) {
-                        jos.putNextEntry(jentry);
-                        jf.getInputStream(jentry).transferTo(jos);
-                    }
-                }
-            }
-
-            // add the new entries
-            for (Path entry : entries) {
-                String name = toJarEntryName(entry);
-                jos.putNextEntry(new JarEntry(name));
-                Files.copy(dir.resolve(entry), jos);
-            }
-        }
-
-        // replace the original JAR file
-        Files.move(tmpfile, jarfile, StandardCopyOption.REPLACE_EXISTING);
-    }
-
-    /**
-     * Update a JAR file.
-     *
-     * Equivalent to {@code jar uf <jarfile> -C <dir> .}
-     */
-    public static void updateJarFile(Path jarfile, Path dir) throws IOException {
-        updateJarFile(jarfile, dir, Paths.get("."));
-    }
-
-
-    /**
-     * Map a file path to the equivalent name in a JAR file
-     */
-    private static String toJarEntryName(Path file) {
-        Path normalized = file.normalize();
-        return normalized.subpath(0, normalized.getNameCount())  // drop root
-                .toString()
-                .replace(File.separatorChar, '/');
-    }
-}
--- a/test/jdk/sanity/client/SwingSet/src/ButtonDemoScreenshotTest.java	Wed Oct 03 15:54:35 2018 +0200
+++ b/test/jdk/sanity/client/SwingSet/src/ButtonDemoScreenshotTest.java	Wed Oct 03 16:02:24 2018 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2011, 2016, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2011, 2018, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -36,6 +36,7 @@
 import java.awt.Robot;
 import java.awt.image.BufferedImage;
 
+import javax.swing.UIManager;
 import static com.sun.swingset3.demos.button.ButtonDemo.DEMO_TITLE;
 import static org.jemmy2ext.JemmyExt.*;
 
@@ -66,8 +67,9 @@
         sComparator = new StrictImageComparator();
     }
 
-    @Test
-    public void test() throws Exception {
+    @Test(dataProvider = "availableLookAndFeels", dataProviderClass = TestHelpers.class)
+    public void test(String lookAndFeel) throws Exception {
+        UIManager.setLookAndFeel(lookAndFeel);
         Robot rob = new Robot();
 
         new ClassReference(ButtonDemo.class.getCanonicalName()).startApplication();
@@ -112,19 +114,22 @@
                     assertNotBlack(pressedImage[0]);
                     return !sComparator.compare(initialButtonImage, pressedImage[0]);
                 }
+
                 public String getDescription() {
                     return "Button with new image";
                 }
             });
         } finally {
-            if(pressedImage[0] != null) save(pressedImage[0], "button" + i + "_pressed.png");
+            if (pressedImage[0] != null) {
+                save(pressedImage[0], "button" + i + "_pressed.png");
+            }
             button.releaseMouse();
             //additional instrumentation for JDK-8198920. To be removed after the bug is fixed
             button.getOutput().printTrace("JDK-8198920: Button released at " + System.currentTimeMillis());
             try {
                 button.waitState(comp -> actionListenerCalled.get());
                 button.getOutput().printTrace("JDK-8198920: Action listener was called by " + System.currentTimeMillis());
-            } catch(org.netbeans.jemmy.TimeoutExpiredException e) {
+            } catch (org.netbeans.jemmy.TimeoutExpiredException e) {
                 button.getOutput().printTrace("JDK-8198920: Action listener was not called by " + System.currentTimeMillis());
             }
             //end of instrumentation for JDK-8198920
--- a/test/jdk/sanity/client/SwingSet/src/ButtonDemoTest.java	Wed Oct 03 15:54:35 2018 +0200
+++ b/test/jdk/sanity/client/SwingSet/src/ButtonDemoTest.java	Wed Oct 03 16:02:24 2018 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2011, 2016, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2011, 2018, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -28,6 +28,7 @@
 import java.util.concurrent.BlockingQueue;
 import javax.swing.ButtonModel;
 import javax.swing.JButton;
+import javax.swing.UIManager;
 import javax.swing.event.ChangeEvent;
 import static org.testng.AssertJUnit.*;
 import org.testng.annotations.Test;
@@ -93,8 +94,9 @@
         "isArmed = false, isEnabled = true, isPressed = false, isSelected = false"
     };
 
-    @Test
-    public void test() throws Exception {
+    @Test(dataProvider = "availableLookAndFeels", dataProviderClass = TestHelpers.class)
+    public void test(String lookAndFeel) throws Exception {
+        UIManager.setLookAndFeel(lookAndFeel);
 
         new ClassReference(ButtonDemo.class.getCanonicalName()).startApplication();
 
--- a/test/jdk/sanity/client/SwingSet/src/ComboBoxDemoTest.java	Wed Oct 03 15:54:35 2018 +0200
+++ b/test/jdk/sanity/client/SwingSet/src/ComboBoxDemoTest.java	Wed Oct 03 16:02:24 2018 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2010, 2016, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2010, 2018, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -24,6 +24,7 @@
 import org.jtregext.GuiTestListener;
 import com.sun.swingset3.demos.combobox.ComboBoxDemo;
 import static org.testng.AssertJUnit.*;
+import javax.swing.UIManager;
 import org.testng.annotations.Test;
 import org.netbeans.jemmy.ClassReference;
 import org.netbeans.jemmy.operators.JComboBoxOperator;
@@ -50,6 +51,7 @@
 public class ComboBoxDemoTest {
 
     private static enum ComboBoxInfo {
+
         PRESETS("Presets:"),
         HAIR("Hair:"),
         EYES_N_NOSE("Eyes & Nose:"),
@@ -63,9 +65,9 @@
 
     }
 
-    @Test
-    public void test() throws Exception {
-
+    @Test(dataProvider = "availableLookAndFeels", dataProviderClass = TestHelpers.class)
+    public void test(String lookAndFeel) throws Exception {
+        UIManager.setLookAndFeel(lookAndFeel);
         new ClassReference(ComboBoxDemo.class.getCanonicalName()).startApplication();
 
         JFrameOperator frame = new JFrameOperator(DEMO_TITLE);
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/jdk/sanity/client/SwingSet/src/FrameDemoTest.java	Wed Oct 03 16:02:24 2018 +0200
@@ -0,0 +1,296 @@
+/*
+ * Copyright (c) 2018, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * 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 static com.sun.swingset3.demos.frame.FrameDemo.BUSY_CHECKBOX;
+import static com.sun.swingset3.demos.frame.FrameDemo.CONTENT_LABEL;
+import static com.sun.swingset3.demos.frame.FrameDemo.CONTENT_LABEL_COLOR;
+import static com.sun.swingset3.demos.frame.FrameDemo.CONTENT_LABEL_SIZE;
+import static com.sun.swingset3.demos.frame.FrameDemo.DEMO_TITLE;
+import static com.sun.swingset3.demos.frame.FrameDemo.INTERNAL_FRAME;
+import static com.sun.swingset3.demos.frame.FrameDemo.MENU;
+import static com.sun.swingset3.demos.frame.FrameDemo.MENU_ITEM1;
+import static com.sun.swingset3.demos.frame.FrameDemo.MENU_ITEM2;
+import static com.sun.swingset3.demos.frame.FrameDemo.SHOW_BUTTON;
+import static com.sun.swingset3.demos.frame.FrameDemo.STATUS_LABEL;
+import static com.sun.swingset3.demos.frame.FrameDemo.STATUS_LABEL_BORDER;
+import static com.sun.swingset3.demos.frame.FrameDemo.STATUS_LABEL_HOR_ALIGNMENT;
+import static com.sun.swingset3.demos.frame.FrameDemo.TOOLBAR_BUTTON;
+import static org.jemmy2ext.JemmyExt.EXACT_STRING_COMPARATOR;
+import static org.testng.AssertJUnit.assertEquals;
+
+import java.awt.Component;
+import java.awt.Cursor;
+import java.awt.Dimension;
+import java.awt.Frame;
+import java.awt.Point;
+import java.util.concurrent.atomic.AtomicBoolean;
+
+import javax.swing.JLabel;
+import javax.swing.JMenu;
+import javax.swing.JMenuBar;
+import javax.swing.JMenuItem;
+import javax.swing.UIManager;
+import javax.swing.event.MenuEvent;
+import javax.swing.event.MenuListener;
+
+import org.jtregext.GuiTestListener;
+import org.netbeans.jemmy.ClassReference;
+import org.netbeans.jemmy.ComponentChooser;
+import org.netbeans.jemmy.WindowWaiter;
+import org.netbeans.jemmy.operators.ComponentOperator;
+import org.netbeans.jemmy.operators.FrameOperator;
+import org.netbeans.jemmy.operators.JButtonOperator;
+import org.netbeans.jemmy.operators.JCheckBoxOperator;
+import org.netbeans.jemmy.operators.JFrameOperator;
+import org.netbeans.jemmy.operators.JLabelOperator;
+import org.netbeans.jemmy.operators.JMenuBarOperator;
+import org.netbeans.jemmy.operators.JMenuItemOperator;
+import org.netbeans.jemmy.operators.JMenuOperator;
+import org.testng.annotations.Listeners;
+import org.testng.annotations.Test;
+
+import com.sun.swingset3.demos.frame.FrameDemo;
+
+/*
+ * @test
+ * @key headful
+ * @summary Verifies SwingSet3 FrameDemo page by checking the different actions
+ *  on the frame, properties and different actions on subcomponents of frame
+ *  and control panel actions by checking and unchecking the busy check box and
+ *  pressing the show button.
+ *
+ * @library /sanity/client/lib/jemmy/src
+ * @library /sanity/client/lib/Extensions/src
+ * @library /sanity/client/lib/SwingSet3/src
+ * @modules java.desktop
+ *          java.logging
+ * @build org.jemmy2ext.JemmyExt
+ * @build com.sun.swingset3.demos.frame.FrameDemo
+ * @run testng FrameDemoTest
+ */
+@Listeners(GuiTestListener.class)
+public class FrameDemoTest {
+
+    private final static Dimension NEW_SIZE = new Dimension(500, 500);
+    private final static Point NEW_LOCATION = new Point(200, 200);
+    private final static int NUMBER_OF_MENUS = 1;
+    private final static int NUMBER_OF_MENU_ITEMS = 2;
+    private final static int MAX_NUMBER_OF_FRAMES = 1;
+    private final static int DELAY_AFTER_SHOW_BUTTON_PRESS = 500;
+
+    /**
+     * Testing the different actions on the frame, properties and different
+     * actions on subcomponents of the frame and control panel action by
+     * checking and unchecking the busy check box and pressing the show button.
+     *
+     * @throws Exception
+     */
+    @Test(dataProvider = "availableLookAndFeels", dataProviderClass = TestHelpers.class)
+    public void test(String lookAndFeel) throws Exception {
+        UIManager.setLookAndFeel(lookAndFeel);
+        new ClassReference(FrameDemo.class.getCanonicalName()).startApplication();
+
+        JFrameOperator masterFrameOperator = new JFrameOperator(DEMO_TITLE);
+        masterFrameOperator.setComparator(EXACT_STRING_COMPARATOR);
+
+        JFrameOperator internalFrameOperator = new JFrameOperator(INTERNAL_FRAME);
+        internalFrameOperator.setComparator(EXACT_STRING_COMPARATOR);
+        internalFrameOperator.setVerification(true);
+        internalFrameOperator.waitComponentVisible(true);
+
+        checkSubComponents(internalFrameOperator);
+        checkFrameActions(internalFrameOperator);
+        checkControlPanelActions(masterFrameOperator, internalFrameOperator);
+    }
+
+    /**
+     * Verifying the status of added components to the frame
+     * @param internalFrameOperator
+     */
+    private void checkSubComponents(JFrameOperator internalFrameOperator) {
+        // Verifying the properties of added button to the frame
+        JButtonOperator buttonOperator =
+                new JButtonOperator(internalFrameOperator, TOOLBAR_BUTTON);
+        AtomicBoolean buttonActionStatus = new AtomicBoolean(false);
+        buttonOperator.addActionListener(event -> buttonActionStatus.set(true));
+        buttonOperator.push();
+        buttonOperator.waitStateOnQueue(comp -> buttonActionStatus.get());
+
+        // Verifying the properties of added labels to the frame
+        JLabelOperator contentLabelOperator =
+                new JLabelOperator(internalFrameOperator, CONTENT_LABEL);
+        contentLabelOperator.waitStateOnQueue(comp
+                -> CONTENT_LABEL_SIZE.equals(comp.getSize()));
+        contentLabelOperator.waitStateOnQueue(comp
+                -> CONTENT_LABEL_COLOR.equals(comp.getBackground()));
+        JLabelOperator statusLabelOperator =
+                new JLabelOperator(internalFrameOperator, STATUS_LABEL);
+        statusLabelOperator.waitStateOnQueue(comp
+                -> STATUS_LABEL_BORDER.equals(((JLabel)comp).getBorder()));
+        statusLabelOperator.waitStateOnQueue((component) -> STATUS_LABEL_HOR_ALIGNMENT
+                == ((JLabel)component).getHorizontalAlignment());
+
+        // Verifying the properties of added menu to the frame
+        JMenuBarOperator menuBarOperator = new JMenuBarOperator(internalFrameOperator);
+        menuBarOperator.waitStateOnQueue(comp -> NUMBER_OF_MENUS
+                == ((JMenuBar)comp).getMenuCount());
+        JMenuOperator menuOperator = new JMenuOperator(internalFrameOperator, MENU);
+        menuOperator.waitStateOnQueue(comp -> NUMBER_OF_MENU_ITEMS
+                == ((JMenu)comp).getMenuComponentCount());
+        AtomicBoolean menuActionStatus = new AtomicBoolean(false);
+        addMenuListener(menuOperator, menuActionStatus);
+        menuOperator.push();
+        menuOperator.waitStateOnQueue(comp -> menuActionStatus.get());
+
+        // Verifying the properties of the menu items
+        checkMenuItem((JMenuItem) menuOperator.getMenuComponent(0), MENU_ITEM1);
+        checkMenuItem((JMenuItem) menuOperator.getMenuComponent(1), MENU_ITEM2);
+    }
+
+    /**
+     * Verifying different actions on the frame
+     * @param internalFrameOperator
+     */
+    private void checkFrameActions(JFrameOperator internalFrameOperator)
+            throws InterruptedException {
+        // Verifying the maximized status
+        internalFrameOperator.maximize();
+        // TODO This is a workaround for JDK-8210638, this delay has to remove
+        // after fixing this bug, this is an unstable code.
+        TestHelpers.delayBetweenFrameStateChange();
+        internalFrameOperator.demaximize();
+        // TODO This is a workaround for JDK-8210638, this delay has to remove
+        // after fixing this bug, this is an unstable code.
+        TestHelpers.delayBetweenFrameStateChange();
+
+        // Verifying the iconified status
+        internalFrameOperator.iconify();
+        // TODO This is a workaround for JDK-8210638, this delay has to remove
+        // after fixing this bug, this is an unstable code.
+        TestHelpers.delayBetweenFrameStateChange();
+        internalFrameOperator.deiconify();
+        // TODO This is a workaround for JDK-8210638, this delay has to remove
+        // after fixing this bug, this is an unstable code.
+        TestHelpers.delayBetweenFrameStateChange();
+
+        // Verifying the resize of the frame
+        TestHelpers.checkChangeSize(internalFrameOperator, NEW_SIZE);
+
+        // Verifying the change of location of the frame
+        TestHelpers.checkChangeLocation(internalFrameOperator, NEW_LOCATION);
+    }
+
+    /**
+     * Verifying control panel actions on the frame
+     * @param masterFrameOprator
+     * @param internalFrameOperator
+     * @throws InterruptedException
+     */
+    private void checkControlPanelActions(JFrameOperator masterFrameOprator,
+            JFrameOperator internalFrameOperator) throws InterruptedException {
+        // Verifying the visibility and number of frames after pressing Show Button
+        internalFrameOperator.requestClose();
+        internalFrameOperator.waitClosed();
+        JButtonOperator showButtonOperator = new JButtonOperator(masterFrameOprator, SHOW_BUTTON);
+        showButtonOperator.push();
+        internalFrameOperator.waitComponentVisible(true);
+        showButtonOperator.push();
+        showButtonOperator.push();
+        Thread.sleep(DELAY_AFTER_SHOW_BUTTON_PRESS);
+        int count = WindowWaiter.countWindows(masterFrameOprator.getOwner(),
+                new FrameOperator.FrameFinder(new ComponentChooser() {
+
+            @Override
+            public String getDescription() {
+                return "frames with name != " + DEMO_TITLE;
+            }
+
+            @Override
+            public boolean checkComponent(Component comp) {
+                return comp.isShowing()
+                        && ((Frame) comp).getTitle() != DEMO_TITLE;
+            }
+        }));
+        assertEquals("Number of frames after clicking Show Button two times"
+                + " validation failed,", MAX_NUMBER_OF_FRAMES, count);
+
+        // Verifying the visibility and cursor type after selecting busy check box
+        JCheckBoxOperator busyCheckBoxOperator =
+                new JCheckBoxOperator(masterFrameOprator, BUSY_CHECKBOX);
+        busyCheckBoxOperator.setVerification(true);
+        checkBusyCheckBox(internalFrameOperator, busyCheckBoxOperator, true);
+        internalFrameOperator.waitStateOnQueue(comp -> Cursor.WAIT_CURSOR
+                == internalFrameOperator.getGlassPane().getCursor().getType());
+
+        checkBusyCheckBox(internalFrameOperator, busyCheckBoxOperator, false);
+        internalFrameOperator.waitStateOnQueue(comp -> Cursor.DEFAULT_CURSOR
+                == internalFrameOperator.getCursor().getType());
+    }
+
+    private void checkBusyCheckBox(JFrameOperator internalFrameOperator,
+            JCheckBoxOperator busyCheckBoxOperator, boolean isSelect) {
+        busyCheckBoxOperator.changeSelection(isSelect);
+        new ComponentOperator(internalFrameOperator.
+                getGlassPane()).waitComponentVisible(isSelect);
+    }
+
+    /**
+     * Verifying the properties of the menu item
+     * @param menuItem : menu item component
+     * @param menuExpectedName : expected menu item name/text
+     */
+    private void checkMenuItem(JMenuItem menuItem, String menuExpectedName) {
+        JMenuItemOperator menuItemOperator = new JMenuItemOperator(menuItem);
+        AtomicBoolean menuItemActionStatus = new AtomicBoolean(false);
+        menuItemOperator.addActionListener(event -> menuItemActionStatus.set(true));
+        menuItemOperator.waitStateOnQueue((component)
+                -> menuExpectedName.equals(((JMenuItem)component).getText()));
+        menuItemOperator.push();
+        menuItemOperator.waitStateOnQueue(comp -> menuItemActionStatus.get());
+    }
+
+    /**
+     * Add menu listener to the operator
+     * @param menuOperator : JMenuOperator on which menu listener has to be added
+     * @param menuActionStatus : menu action status variable
+     */
+    private void addMenuListener(JMenuOperator menuOperator,
+            AtomicBoolean menuActionStatus) {
+        menuOperator.addMenuListener(new MenuListener() {
+
+            @Override
+            public void menuSelected(MenuEvent e) {
+                menuActionStatus.set(true);
+            }
+
+            @Override
+            public void menuDeselected(MenuEvent e) {
+            }
+
+            @Override
+            public void menuCanceled(MenuEvent e) {
+            }
+        });
+    }
+
+}
\ No newline at end of file
--- a/test/jdk/sanity/client/SwingSet/src/InternalFrameDemoTest.java	Wed Oct 03 15:54:35 2018 +0200
+++ b/test/jdk/sanity/client/SwingSet/src/InternalFrameDemoTest.java	Wed Oct 03 16:02:24 2018 +0200
@@ -138,6 +138,9 @@
                 orignalSize.height - PARENT_FRAME_NEW_SIZE_DELTA);
         parentFrameOperator.resize(newSize.width, newSize.height);
         parentFrameOperator.waitComponentSize(newSize);
+        // TODO This is a workaround for JDK-8210638, this delay has to remove
+        // after fixing this bug, this is an unstable code.
+        TestHelpers.delayBetweenFrameStateChange();
         // keeping some delay before checking the internal frame property
         // as it is a negative scenario
         Thread.sleep(DELAY);
@@ -145,26 +148,41 @@
         // Resizing parent frame back to original size
         parentFrameOperator.resize(orignalSize.width, orignalSize.height);
         parentFrameOperator.waitComponentSize(orignalSize);
+        // TODO This is a workaround for JDK-8210638, this delay has to remove
+        // after fixing this bug, this is an unstable code.
+        TestHelpers.delayBetweenFrameStateChange();
 
         // Iconifying the parent frame and verifying the iconified status of the internal
         // frame(it should not be iconified)
         parentFrameOperator.iconify();
+        // TODO This is a workaround for JDK-8210638, this delay has to remove
+        // after fixing this bug, this is an unstable code.
+        TestHelpers.delayBetweenFrameStateChange();
         // keeping some delay before checking the internal frame property
         // as it is a negative scenario
         Thread.sleep(DELAY);
         assertFalse("Internal Frame should not be iconified when parent frame"
                 + " alone is iconified.", internalFrameOperator.isIcon());
         parentFrameOperator.deiconify();
+        // TODO This is a workaround for JDK-8210638, this delay has to remove
+        // after fixing this bug, this is an unstable code.
+        TestHelpers.delayBetweenFrameStateChange();
 
         // Maximizing the parent frame and verifying the maximized status of the internal
         // frame(it should not be maximized)
         parentFrameOperator.maximize();
+        // TODO This is a workaround for JDK-8210638, this delay has to remove
+        // after fixing this bug, this is an unstable code.
+        TestHelpers.delayBetweenFrameStateChange();
         // keeping some delay before checking the internal frame property
         // as it is a negative scenario
         Thread.sleep(DELAY);
         assertFalse("Internal Frame should not be maximized when parent frame"
                 + " alone is maximized.", internalFrameOperator.isMaximum());
         parentFrameOperator.demaximize();
+        // TODO This is a workaround for JDK-8210638, this delay has to remove
+        // after fixing this bug, this is an unstable code.
+        TestHelpers.delayBetweenFrameStateChange();
 
         // Relocating the parent frame and verifying the location of the internal
         // frame(it should not be changed the location)
@@ -173,6 +191,9 @@
                 (orignalLocation.y + PARENT_FRAME_NEW_LOCATION_DELTA));
         parentFrameOperator.move(newLocation.x, newLocation.y);
         parentFrameOperator.waitComponentLocation(newLocation);
+        // TODO This is a workaround for JDK-8210638, this delay has to remove
+        // after fixing this bug, this is an unstable code.
+        TestHelpers.delayBetweenFrameStateChange();
         // keeping some delay before checking the internal frame property
         // as it is a negative scenario
         Thread.sleep(DELAY);
@@ -180,15 +201,19 @@
         // Moving back parent frame to original location
         parentFrameOperator.move(orignalLocation.x, orignalLocation.y);
         parentFrameOperator.waitComponentLocation(orignalLocation);
+        // TODO This is a workaround for JDK-8210638, this delay has to remove
+        // after fixing this bug, this is an unstable code.
+        TestHelpers.delayBetweenFrameStateChange();
     }
 
     /**
      * Verifying different actions on the internal frame.
      *
      * @param internalFrameOperator : internal fame operator
+     * @throws InterruptedException
      */
-    private void checkInternalFrameAction(
-            JInternalFrameOperator internalFrameOperator) {
+    private void checkInternalFrameAction(JInternalFrameOperator
+            internalFrameOperator) throws InterruptedException {
         // Verifying maximize and demaximize actions
         internalFrameOperator.waitStateOnQueue(comp
                 -> ((JInternalFrame)comp).isMaximizable());
--- a/test/jdk/sanity/client/SwingSet/src/ListDemoTest.java	Wed Oct 03 15:54:35 2018 +0200
+++ b/test/jdk/sanity/client/SwingSet/src/ListDemoTest.java	Wed Oct 03 16:02:24 2018 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2010, 2016, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2010, 2018, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -26,6 +26,7 @@
 
 import java.awt.Component;
 import javax.swing.JList;
+import javax.swing.UIManager;
 
 import org.netbeans.jemmy.ClassReference;
 import org.netbeans.jemmy.ComponentChooser;
@@ -67,14 +68,16 @@
             public boolean checkComponent(Component comp) {
                 return getUIValue(listOp, (JList list) -> list.getModel().getSize()) == size;
             }
+
             public String getDescription() {
                 return "Model size to be equal to " + size;
             }
         });
     }
 
-    @Test
-    public void test() throws Exception {
+    @Test(dataProvider = "availableLookAndFeels", dataProviderClass = TestHelpers.class)
+    public void test(String lookAndFeel) throws Exception {
+        UIManager.setLookAndFeel(lookAndFeel);
 
         new ClassReference(ListDemo.class.getCanonicalName()).startApplication();
 
--- a/test/jdk/sanity/client/SwingSet/src/OptionPaneDemoTest.java	Wed Oct 03 15:54:35 2018 +0200
+++ b/test/jdk/sanity/client/SwingSet/src/OptionPaneDemoTest.java	Wed Oct 03 16:02:24 2018 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2010, 2016, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2010, 2018, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -70,8 +70,9 @@
     public static final String YES = "Yes";
     public static final String SELECT_AN_OPTION = UIManager.getString("OptionPane.titleText");
 
-    @Test
-    public void test() throws Exception {
+    @Test(dataProvider = "availableLookAndFeels", dataProviderClass = TestHelpers.class)
+    public void test(String lookAndFeel) throws Exception {
+        UIManager.setLookAndFeel(lookAndFeel);
 
         new ClassReference(OptionPaneDemo.class.getCanonicalName()).startApplication();
 
@@ -94,7 +95,7 @@
     private void useInputDialog(JFrameOperator jfo, String textToType, String buttonToPush) {
         new JButtonOperator(jfo, INPUT_BUTTON).pushNoBlock();
         JDialogOperator jdo = new JDialogOperator(INPUT);
-        if(textToType != null) {
+        if (textToType != null) {
             JTextFieldOperator jto = new JTextFieldOperator(jdo);
             jto.typeText(textToType);
             jto.waitText(textToType);
@@ -146,7 +147,7 @@
     }
 
     private void callADialogAndClose(JFrameOperator jfo, String buttonToOpenDialog,
-                                     String dialogTitle, String buttonToPush) {
+            String dialogTitle, String buttonToPush) {
         new JButtonOperator(jfo, buttonToOpenDialog).pushNoBlock();
         JDialogOperator jdo = new JDialogOperator(dialogTitle);
         new JButtonOperator(jdo, buttonToPush).push();
--- a/test/jdk/sanity/client/SwingSet/src/ProgressBarDemoTest.java	Wed Oct 03 15:54:35 2018 +0200
+++ b/test/jdk/sanity/client/SwingSet/src/ProgressBarDemoTest.java	Wed Oct 03 16:02:24 2018 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2010, 2016, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2010, 2018, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -25,6 +25,7 @@
 import com.sun.swingset3.demos.progressbar.ProgressBarDemo;
 import static com.sun.swingset3.demos.progressbar.ProgressBarDemo.*;
 import java.awt.Component;
+import javax.swing.UIManager;
 import static org.testng.AssertJUnit.*;
 import org.testng.annotations.Test;
 import org.netbeans.jemmy.ClassReference;
@@ -55,9 +56,9 @@
 
     private final static long PROGRESS_BAR_TIMEOUT = 180000;
 
-    @Test
-    public void test() throws Exception {
-
+    @Test(dataProvider = "availableLookAndFeels", dataProviderClass = TestHelpers.class)
+    public void test(String lookAndFeel) throws Exception {
+        UIManager.setLookAndFeel(lookAndFeel);
         new ClassReference(ProgressBarDemo.class.getCanonicalName()).startApplication();
 
         JFrameOperator frame = new JFrameOperator(DEMO_TITLE);
--- a/test/jdk/sanity/client/SwingSet/src/ScrollPaneDemoTest.java	Wed Oct 03 15:54:35 2018 +0200
+++ b/test/jdk/sanity/client/SwingSet/src/ScrollPaneDemoTest.java	Wed Oct 03 16:02:24 2018 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2010, 2016, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2010, 2018, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -25,6 +25,7 @@
 import com.sun.swingset3.demos.scrollpane.ScrollPaneDemo;
 import static com.sun.swingset3.demos.scrollpane.ScrollPaneDemo.DEMO_TITLE;
 import static org.testng.AssertJUnit.*;
+import javax.swing.UIManager;
 import org.testng.annotations.Test;
 import org.netbeans.jemmy.ClassReference;
 import org.netbeans.jemmy.operators.JFrameOperator;
@@ -49,8 +50,9 @@
 @Listeners(GuiTestListener.class)
 public class ScrollPaneDemoTest {
 
-    @Test
-    public void test() throws Exception {
+    @Test(dataProvider = "availableLookAndFeels", dataProviderClass = TestHelpers.class)
+    public void test(String lookAndFeel) throws Exception {
+        UIManager.setLookAndFeel(lookAndFeel);
 
         new ClassReference(ScrollPaneDemo.class.getName()).startApplication();
 
--- a/test/jdk/sanity/client/SwingSet/src/SpinnerDemoTest.java	Wed Oct 03 15:54:35 2018 +0200
+++ b/test/jdk/sanity/client/SwingSet/src/SpinnerDemoTest.java	Wed Oct 03 16:02:24 2018 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2011, 2016, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2011, 2018, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -25,6 +25,7 @@
 import com.sun.swingset3.demos.spinner.SpinnerDemo;
 import static com.sun.swingset3.demos.spinner.SpinnerDemo.DEMO_TITLE;
 import java.text.DecimalFormat;
+import javax.swing.UIManager;
 import static org.testng.AssertJUnit.*;
 import org.testng.annotations.Test;
 import org.netbeans.jemmy.ClassReference;
@@ -54,8 +55,9 @@
     private static final int SPINNERS_COUNT = 9;
     private static final DecimalFormat decimalFormat = new DecimalFormat();
 
-    @Test
-    public void test() throws Exception {
+    @Test(dataProvider = "availableLookAndFeels", dataProviderClass = TestHelpers.class)
+    public void test(String lookAndFeel) throws Exception {
+        UIManager.setLookAndFeel(lookAndFeel);
         new ClassReference(SpinnerDemo.class.getCanonicalName()).startApplication();
 
         JFrameOperator frame = new JFrameOperator(DEMO_TITLE);
--- a/test/jdk/sanity/client/SwingSet/src/TabbedPaneDemoTest.java	Wed Oct 03 15:54:35 2018 +0200
+++ b/test/jdk/sanity/client/SwingSet/src/TabbedPaneDemoTest.java	Wed Oct 03 16:02:24 2018 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2011, 2016, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2011, 2018, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -26,6 +26,7 @@
 import static com.sun.swingset3.demos.tabbedpane.TabbedPaneDemo.*;
 import static org.jemmy2ext.JemmyExt.getLabeledContainerOperator;
 import static org.testng.AssertJUnit.*;
+import javax.swing.UIManager;
 import org.testng.annotations.Test;
 import org.netbeans.jemmy.ClassReference;
 import org.netbeans.jemmy.operators.ContainerOperator;
@@ -52,8 +53,9 @@
 @Listeners(GuiTestListener.class)
 public class TabbedPaneDemoTest {
 
-    @Test
-    public void test() throws Exception {
+    @Test(dataProvider = "availableLookAndFeels", dataProviderClass = TestHelpers.class)
+    public void test(String lookAndFeel) throws Exception {
+        UIManager.setLookAndFeel(lookAndFeel);
         new ClassReference(TabbedPaneDemo.class.getCanonicalName()).startApplication();
 
         JFrameOperator mainFrame = new JFrameOperator(DEMO_TITLE);
--- a/test/jdk/sanity/client/SwingSet/src/TableDemoTest.java	Wed Oct 03 15:54:35 2018 +0200
+++ b/test/jdk/sanity/client/SwingSet/src/TableDemoTest.java	Wed Oct 03 16:02:24 2018 +0200
@@ -33,6 +33,7 @@
 import java.util.List;
 
 import javax.swing.JTable;
+import javax.swing.UIManager;
 
 import org.jtregext.GuiTestListener;
 import org.netbeans.jemmy.ClassReference;
@@ -104,8 +105,9 @@
      *
      * @throws Exception
      */
-    @Test
-    public void test() throws Exception {
+    @Test(dataProvider = "availableLookAndFeels", dataProviderClass = TestHelpers.class)
+    public void test(String lookAndFeel) throws Exception {
+        UIManager.setLookAndFeel(lookAndFeel);
 
         new ClassReference(TableDemo.class.getCanonicalName()).startApplication();
 
--- a/test/jdk/sanity/client/SwingSet/src/TestHelpers.java	Wed Oct 03 15:54:35 2018 +0200
+++ b/test/jdk/sanity/client/SwingSet/src/TestHelpers.java	Wed Oct 03 16:02:24 2018 +0200
@@ -1,16 +1,38 @@
+/*
+ * Copyright (c) 2018, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * 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.Dimension;
 import java.awt.Point;
-import java.io.FileInputStream;
-import java.io.FileOutputStream;
-import java.io.IOException;
-import java.nio.channels.FileChannel;
-import java.nio.file.Path;
+
 import javax.swing.UIManager;
+
 import org.netbeans.jemmy.operators.ComponentOperator;
 import org.testng.annotations.DataProvider;
 
 public class TestHelpers {
 
+    public static final long DELAY_BTWN_FRAME_STATE_CHANGE = 2000;
+
     /**
      * A DataProvider having the class name of all the available look and feels
      *
@@ -29,21 +51,40 @@
     }
 
     public static void checkChangeLocation(ComponentOperator component,
-            Point finalLocation) {
+            Point finalLocation) throws InterruptedException {
         Point initialLocation = component.getLocation();
         component.setLocation(finalLocation);
         component.waitComponentLocation(finalLocation);
+        // TODO This is a workaround for JDK-8210638, this delay has to remove
+        // after fixing this bug, this is an unstable code.
+        delayBetweenFrameStateChange();
         component.setLocation(initialLocation);
         component.waitComponentLocation(initialLocation);
+        // TODO This is a workaround for JDK-8210638, this delay has to remove
+        // after fixing this bug, this is an unstable code.
+        delayBetweenFrameStateChange();
     }
 
     public static void checkChangeSize(ComponentOperator component,
-            Dimension dimensionFinal) {
+            Dimension dimensionFinal) throws InterruptedException {
         Dimension dimensionInitial = component.getSize();
         component.setSize(dimensionFinal);
         component.waitComponentSize(dimensionFinal);
+        // TODO This is a workaround for JDK-8210638, this delay has to remove
+        // after fixing this bug, this is an unstable code.
+        delayBetweenFrameStateChange();
         component.setSize(dimensionInitial);
         component.waitComponentSize(dimensionInitial);
+        // TODO This is a workaround for JDK-8210638, this delay has to remove
+        // after fixing this bug, this is an unstable code.
+        delayBetweenFrameStateChange();
     }
 
-}
+    // TODO This is a workaround for JDK-8210638, this delay has to remove
+    // after fixing this bug, this is an unstable code.
+    public static void delayBetweenFrameStateChange()
+            throws InterruptedException {
+        Thread.sleep(DELAY_BTWN_FRAME_STATE_CHANGE);
+    }
+
+}
\ No newline at end of file
--- a/test/jdk/sanity/client/SwingSet/src/ToggleButtonDemoTest.java	Wed Oct 03 15:54:35 2018 +0200
+++ b/test/jdk/sanity/client/SwingSet/src/ToggleButtonDemoTest.java	Wed Oct 03 16:02:24 2018 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2010, 2016, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2010, 2018, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -28,6 +28,7 @@
 import com.sun.swingset3.demos.togglebutton.ToggleButtonDemo;
 import static com.sun.swingset3.demos.togglebutton.ToggleButtonDemo.*;
 import java.util.function.BiFunction;
+import javax.swing.UIManager;
 import org.jemmy2ext.JemmyExt.ByClassChooser;
 import static org.jemmy2ext.JemmyExt.EXACT_STRING_COMPARATOR;
 import static org.jemmy2ext.JemmyExt.getBorderTitledJPanelOperator;
@@ -65,8 +66,9 @@
 @Listeners(GuiTestListener.class)
 public class ToggleButtonDemoTest {
 
-    @Test
-    public void test() throws Exception {
+    @Test(dataProvider = "availableLookAndFeels", dataProviderClass = TestHelpers.class)
+    public void test(String lookAndFeel) throws Exception {
+        UIManager.setLookAndFeel(lookAndFeel);
         new ClassReference(ToggleButtonDemo.class.getCanonicalName()).startApplication();
 
         JFrameOperator mainFrame = new JFrameOperator(ToggleButtonDemo.class.getAnnotation(DemoProperties.class).value());
--- a/test/jdk/sanity/client/SwingSet/src/TreeDemoTest.java	Wed Oct 03 15:54:35 2018 +0200
+++ b/test/jdk/sanity/client/SwingSet/src/TreeDemoTest.java	Wed Oct 03 16:02:24 2018 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2010, 2016, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2010, 2018, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -25,6 +25,7 @@
 import static com.sun.swingset3.demos.tree.TreeDemo.DEMO_TITLE;
 
 import java.awt.Component;
+import javax.swing.UIManager;
 import javax.swing.tree.TreePath;
 
 import org.jtregext.GuiTestListener;
@@ -68,14 +69,16 @@
             public boolean checkComponent(Component comp) {
                 return tree.getRowCount() == count;
             }
+
             public String getDescription() {
                 return "A tree to have " + count + " rows";
             }
         });
     }
 
-    @Test
-    public void test() throws Exception {
+    @Test(dataProvider = "availableLookAndFeels", dataProviderClass = TestHelpers.class)
+    public void test(String lookAndFeel) throws Exception {
+        UIManager.setLookAndFeel(lookAndFeel);
 
         new ClassReference(TreeDemo.class.getCanonicalName()).startApplication();
 
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/jdk/sanity/client/lib/SwingSet3/src/com/sun/swingset3/demos/frame/BusyGlass.java	Wed Oct 03 16:02:24 2018 +0200
@@ -0,0 +1,76 @@
+/*
+ * Copyright (c) 2018, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * 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 com.sun.swingset3.demos.frame;
+
+import java.awt.BorderLayout;
+import java.awt.Color;
+import java.awt.Cursor;
+import java.awt.Graphics;
+import javax.swing.JPanel;
+
+/**
+ * GlassPane component which can be set on toplevel
+ * containers to makes those containers "busy" be disabling input.
+ *
+ * Example usage:
+ * <pre><code>
+ *    // Install glasspane
+ *    frame.setGlassPane(new BusyGlass());
+ *
+ *    // Make frame busy
+ *    frame.getGlassPane().setVisible(true);
+ * </code></pre>
+ *
+ * Caution: A well-written client should rarely need to make
+ * a window "busy" because the app should be as responsive as possible;
+ * long-winded operations should be off-loaded to non-GUI threads
+ * whenever possible.
+ *
+ * @author aim
+ */
+//<snip>Make toplevel "busy"
+public class BusyGlass extends JPanel {
+
+    /**
+     * Create GlassPane component to block input on toplevel
+     */
+    public BusyGlass() {
+        setLayout(new BorderLayout());
+        setVisible(false); //initially invisible
+        setOpaque(false);
+        setCursor(Cursor.getPredefinedCursor(Cursor.WAIT_CURSOR));
+    }
+
+    protected void paintComponent(Graphics g) {
+        // Render partially opaque to 'veil' the frame's contents so
+        // that the user has visual feedback that the components
+        // arn't responsive.
+        Color bgColor = getBackground();
+        g.setColor(new Color(bgColor.getRed(),
+                bgColor.getGreen(),
+                bgColor.getBlue(), 150));
+        g.fillRect(0, 0, getWidth(), getHeight());
+    }
+}
+//</snip>
\ No newline at end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/jdk/sanity/client/lib/SwingSet3/src/com/sun/swingset3/demos/frame/FrameDemo.java	Wed Oct 03 16:02:24 2018 +0200
@@ -0,0 +1,272 @@
+/*
+* Copyright (c) 2018, Oracle and/or its affiliates. All rights reserved.
+* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+*
+* This code is free software; you can redistribute it and/or modify it
+* 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 com.sun.swingset3.demos.frame;
+
+import java.awt.BorderLayout;
+import java.awt.Color;
+import java.awt.Dimension;
+import java.awt.EventQueue;
+import java.awt.Image;
+import java.awt.event.ActionEvent;
+import java.awt.event.ActionListener;
+import java.net.URL;
+
+import javax.imageio.ImageIO;
+import javax.swing.Box;
+import javax.swing.JButton;
+import javax.swing.JCheckBox;
+import javax.swing.JComponent;
+import javax.swing.JFrame;
+import javax.swing.JLabel;
+import javax.swing.JMenu;
+import javax.swing.JMenuBar;
+import javax.swing.JPanel;
+import javax.swing.JToolBar;
+import javax.swing.SwingConstants;
+import javax.swing.border.EmptyBorder;
+import javax.swing.event.ChangeEvent;
+import javax.swing.event.ChangeListener;
+
+import com.sun.swingset3.DemoProperties;
+import com.sun.swingset3.demos.DemoUtilities;
+
+/**
+* Demo for Swing's JFrame toplevel component.
+*
+* @author aim
+*/
+@DemoProperties(
+value = "JFrame Demo",
+category = "Toplevel Containers",
+description = "Demonstrates JFrame, Swing's top-level primary window container.",
+sourceFiles = {
+"com/sun/swingset3/demos/frame/BusyGlass.java",
+"com/sun/swingset3/demos/frame/FrameDemo.java",
+"com/sun/swingset3/demos/DemoUtilities.java",
+"com/sun/swingset3/demos/frame/resources/FrameDemo.html",
+"com/sun/swingset3/demos/frame/resources/images/FrameDemo.gif"
+}
+)
+public class FrameDemo extends JPanel {
+
+public static final String DEMO_TITLE = FrameDemo.class.getAnnotation(DemoProperties.class).value();
+public static final String INTERNAL_FRAME = "Demo JFrame";
+public static final String MENU = "File";
+public static final String MENU_ITEM1 = "Open";
+public static final String MENU_ITEM2 = "Save";
+public static final String TOOLBAR = "Toolbar";
+public static final String TOOLBAR_BUTTON = "Toolbar Button";
+public static final String CONTENT_LABEL = "I'm content but a little blue.";
+public static final String STATUS_LABEL = "I show status.";
+public static final String SHOW_BUTTON = "Show JFrame...";
+public static final String BUSY_CHECKBOX = "Frame busy";
+public static final Dimension CONTENT_LABEL_SIZE = new Dimension(300, 160);
+public static final Color CONTENT_LABEL_COLOR = new Color(197, 216, 236);
+public static final int STATUS_LABEL_HOR_ALIGNMENT = JLabel.LEADING;
+public static final EmptyBorder STATUS_LABEL_BORDER = new EmptyBorder(4, 4, 4, 4);
+
+//<snip>Ensure system menubar is used on Mac OSX
+static {
+// Property must be set *early* due to Apple Bug#3909714
+// ignored on other platforms
+if (System.getProperty("os.name").equals("Mac OS X")) {
+System.setProperty("apple.laf.useScreenMenuBar", "true");
+}
+}
+//</snip>
+
+// Toplevel frame component
+private JFrame frame;
+
+private JComponent frameSpaceholder;
+
+public FrameDemo() {
+initComponents();
+}
+
+protected void initComponents() {
+frame = createFrame();
+
+setLayout(new BorderLayout());
+add(createControlPanel(), BorderLayout.WEST);
+frameSpaceholder = createFrameSpaceholder(frame);
+add(frameSpaceholder, BorderLayout.CENTER);
+}
+
+protected JComponent createControlPanel() {
+Box controlPanel = Box.createVerticalBox();
+controlPanel.setBorder(new EmptyBorder(8, 8, 8, 8));
+
+// Create button to control visibility of frame
+JButton showButton = new JButton(SHOW_BUTTON);
+showButton.addActionListener(new ShowActionListener());
+controlPanel.add(showButton);
+
+// Create checkbox to control busy state of frame
+JCheckBox busyCheckBox = new JCheckBox(BUSY_CHECKBOX);
+busyCheckBox.setSelected(false);
+busyCheckBox.addChangeListener(new BusyChangeListener());
+controlPanel.add(busyCheckBox);
+
+return controlPanel;
+}
+
+private static JComponent createFrameSpaceholder(JFrame frame) {
+JPanel framePlaceholder = new JPanel();
+Dimension prefSize = frame.getPreferredSize();
+prefSize.width += 12;
+prefSize.height += 12;
+framePlaceholder.setPreferredSize(prefSize);
+
+return framePlaceholder;
+}
+
+private static JFrame createFrame() {
+
+//<snip>Create frame and set simple properties
+JFrame frame = new JFrame(INTERNAL_FRAME);
+frame.setDefaultCloseOperation(JFrame.HIDE_ON_CLOSE);
+//</snip>
+
+//<snip>Set Minimized/titlebar icon Image
+//Note: How the image is used is platform-dependent
+Image iconImage = null;
+try {
+// todo: swingingduke.gif doesn't exist
+URL imageURL = FrameDemo.class.getResource("resources/images/swingingduke.gif");
+iconImage = ImageIO.read(imageURL);
+} catch (Exception e) {
+// handle image IO exception
+}
+frame.setIconImage(iconImage);
+//</snip>
+
+//<snip>Make toplevel "busy"
+// busy glasspane is initially invisible
+frame.setGlassPane(new BusyGlass());
+//</snip>
+
+//<snip>Add a menubar
+JMenuBar menubar = new JMenuBar();
+frame.setJMenuBar(menubar);
+JMenu menu = new JMenu(MENU);
+menubar.add(menu);
+menu.add(MENU_ITEM1);
+menu.add(MENU_ITEM2);
+//</snip>
+
+//<snip>Add a horizontal toolbar
+JToolBar toolbar = new JToolBar(TOOLBAR);
+frame.add(toolbar, BorderLayout.NORTH);
+toolbar.add(new JButton(TOOLBAR_BUTTON));
+//</snip>
+
+//<snip>Add the content area
+JLabel label = new JLabel(CONTENT_LABEL);
+label.setHorizontalAlignment(JLabel.CENTER);
+label.setPreferredSize(CONTENT_LABEL_SIZE);
+label.setBackground(CONTENT_LABEL_COLOR);
+label.setOpaque(true); // labels non-opaque by default
+frame.add(label);
+//snip
+
+//<snip>Add a statusbar
+JLabel statusLabel = new JLabel(STATUS_LABEL);
+statusLabel.setBorder(STATUS_LABEL_BORDER);
+statusLabel.setHorizontalAlignment(STATUS_LABEL_HOR_ALIGNMENT);
+frame.add(statusLabel, BorderLayout.SOUTH);
+//</snip>
+
+//<snip>Initialize frame's size to fit it's content
+frame.pack();
+//</snip>
+
+return frame;
+}
+
+public void start() {
+DemoUtilities.setToplevelLocation(frame, frameSpaceholder, SwingConstants.CENTER);
+showFrame();
+}
+
+public void stop() {
+//<snip>Hide frame
+frame.setVisible(false);
+//</snip>
+}
+
+public void showFrame() {
+//<snip>Show frame
+// if frame already visible, then bring to the front
+if (frame.isShowing()) {
+frame.toFront();
+} else {
+frame.setVisible(true);
+}
+//</snip>
+}
+
+//<snip>Make toplevel "busy"
+public void setFrameBusy(boolean busy) {
+frame.getGlassPane().setVisible(busy);
+// Must explicitly disable the menubar because on OSX it will be
+// in the system menubar and not covered by the glasspane
+frame.getJMenuBar().setEnabled(!busy);
+}
+
+public boolean isFrameBusy() {
+return frame.getGlassPane().isVisible();
+}
+//</snip
+
+// remind(aim): replace with Beans binding
+
+private class ShowActionListener implements ActionListener {
+public void actionPerformed(ActionEvent actionEvent) {
+showFrame();
+}
+}
+
+private class BusyChangeListener implements ChangeListener {
+public void stateChanged(ChangeEvent changeEvent) {
+JCheckBox busyCheckBox = (JCheckBox) changeEvent.getSource();
+setFrameBusy(busyCheckBox.isSelected());
+showFrame(); // bring frame back to front for demo purposes
+}
+}
+
+public static void main(String args[]) {
+EventQueue.invokeLater(new Runnable() {
+public void run() {
+JFrame frame = new JFrame(DEMO_TITLE);
+FrameDemo demo = new FrameDemo();
+frame.add(demo);
+frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
+frame.pack();
+frame.setVisible(true);
+demo.start();
+}
+});
+}
+}
Binary file test/jdk/sanity/client/lib/SwingSet3/src/com/sun/swingset3/demos/frame/resources/images/FrameDemo.gif has changed
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/jdk/sun/java2d/marlin/ScaleClipTest.java	Wed Oct 03 16:02:24 2018 +0200
@@ -0,0 +1,232 @@
+/*
+ * Copyright (c) 2018, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * 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.BasicStroke;
+import java.awt.Color;
+import java.awt.Graphics2D;
+import java.awt.RenderingHints;
+import java.awt.geom.AffineTransform;
+import java.awt.geom.Path2D;
+import java.awt.image.BufferedImage;
+import java.awt.image.Raster;
+import java.io.File;
+import java.io.IOException;
+import javax.imageio.ImageIO;
+
+/**
+ * Scaled Line Clipping rendering test
+ *
+ * @test
+ * @summary verify that scaled line is properly rendered
+ * @bug 8210335
+ */
+public class ScaleClipTest {
+
+    static final boolean SAVE_IMAGE = false;
+    static final int SIZE = 50;
+
+    enum SCALE_MODE {
+        ORTHO,
+        NON_ORTHO,
+        COMPLEX
+    };
+
+    public static void main(String[] args) {
+
+        // First display which renderer is tested:
+        // JDK9 only:
+        System.setProperty("sun.java2d.renderer.verbose", "true");
+
+        System.out.println("ScaleClipTest: size = " + SIZE);
+
+        final BufferedImage image = new BufferedImage(SIZE, SIZE, BufferedImage.TYPE_INT_ARGB);
+
+        boolean fail = false;
+
+        // testNegativeScale:
+        for (SCALE_MODE mode : SCALE_MODE.values()) {
+            try {
+                testNegativeScale(image, mode);
+            } catch (IllegalStateException ise) {
+                System.err.println("testNegativeScale[" + mode + "] failed:");
+                ise.printStackTrace();
+                fail = true;
+            }
+        }
+
+        // testMarginScale:
+        for (SCALE_MODE mode : SCALE_MODE.values()) {
+            try {
+                testMarginScale(image, mode);
+            } catch (IllegalStateException ise) {
+                System.err.println("testMarginScale[" + mode + "] failed:");
+                ise.printStackTrace();
+                fail = true;
+            }
+        }
+
+        // Fail at the end:
+        if (fail) {
+            throw new RuntimeException("ScaleClipTest has failures.");
+        }
+    }
+
+    private static void testNegativeScale(final BufferedImage image, final SCALE_MODE mode) {
+
+        final Graphics2D g2d = (Graphics2D) image.getGraphics();
+        try {
+            g2d.setRenderingHint(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_ON);
+            g2d.setRenderingHint(RenderingHints.KEY_RENDERING, RenderingHints.VALUE_RENDER_QUALITY);
+            g2d.setRenderingHint(RenderingHints.KEY_STROKE_CONTROL, RenderingHints.VALUE_STROKE_PURE);
+
+            g2d.setBackground(Color.WHITE);
+            g2d.clearRect(0, 0, SIZE, SIZE);
+
+            g2d.setColor(Color.BLACK);
+
+            // Bug in TransformingPathConsumer2D.adjustClipScale()
+            // non ortho scale only
+            final double scale = -1.0;
+
+            final AffineTransform at;
+            switch (mode) {
+                default:
+                case ORTHO:
+                    at = AffineTransform.getScaleInstance(scale, scale);
+                    break;
+                case NON_ORTHO:
+                    at = AffineTransform.getScaleInstance(scale, scale + 1e-5);
+                    break;
+                case COMPLEX:
+                    at = AffineTransform.getScaleInstance(scale, scale);
+                    at.concatenate(AffineTransform.getShearInstance(1e-4, 1e-4));
+                    break;
+            }
+            g2d.setTransform(at);
+
+            // Set cap/join to reduce clip margin:
+            g2d.setStroke(new BasicStroke(2f, BasicStroke.CAP_BUTT, BasicStroke.JOIN_BEVEL));
+
+            final Path2D p = new Path2D.Double();
+            p.moveTo(scale * 10, scale * 10);
+            p.lineTo(scale * (SIZE - 10), scale * (SIZE - 10));
+
+            g2d.draw(p);
+
+            if (SAVE_IMAGE) {
+                try {
+                    final File file = new File("ScaleClipTest-testNegativeScale-" + mode + ".png");
+
+                    System.out.println("Writing file: " + file.getAbsolutePath());
+                    ImageIO.write(image, "PNG", file);
+                } catch (IOException ioe) {
+                    ioe.printStackTrace();
+                }
+            }
+
+            // Check image:
+            // 25, 25 = black
+            checkPixel(image.getData(), 25, 25, Color.BLACK.getRGB());
+
+        } finally {
+            g2d.dispose();
+        }
+    }
+
+    private static void testMarginScale(final BufferedImage image, final SCALE_MODE mode) {
+
+        final Graphics2D g2d = (Graphics2D) image.getGraphics();
+        try {
+            g2d.setRenderingHint(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_ON);
+            g2d.setRenderingHint(RenderingHints.KEY_RENDERING, RenderingHints.VALUE_RENDER_QUALITY);
+            g2d.setRenderingHint(RenderingHints.KEY_STROKE_CONTROL, RenderingHints.VALUE_STROKE_PURE);
+
+            g2d.setBackground(Color.WHITE);
+            g2d.clearRect(0, 0, SIZE, SIZE);
+
+            g2d.setColor(Color.BLACK);
+
+            // Bug in Stroker.init()
+            // ortho scale only: scale used twice !
+            final double scale = 1e-2;
+
+            final AffineTransform at;
+            switch (mode) {
+                default:
+                case ORTHO:
+                    at = AffineTransform.getScaleInstance(scale, scale);
+                    break;
+                case NON_ORTHO:
+                    at = AffineTransform.getScaleInstance(scale, scale + 1e-5);
+                    break;
+                case COMPLEX:
+                    at = AffineTransform.getScaleInstance(scale, scale);
+                    at.concatenate(AffineTransform.getShearInstance(1e-4, 1e-4));
+                    break;
+            }
+            g2d.setTransform(at);
+
+            final double invScale = 1.0 / scale;
+
+            // Set cap/join to reduce clip margin:
+            final float w = (float) (3.0 * invScale);
+            g2d.setStroke(new BasicStroke(w, BasicStroke.CAP_BUTT, BasicStroke.JOIN_BEVEL));
+
+            final Path2D p = new Path2D.Double();
+            p.moveTo(invScale * -0.5, invScale * 10);
+            p.lineTo(invScale * -0.5, invScale * (SIZE - 10));
+
+            g2d.draw(p);
+
+            if (SAVE_IMAGE) {
+                try {
+                    final File file = new File("ScaleClipTest-testMarginScale-" + mode + ".png");
+
+                    System.out.println("Writing file: " + file.getAbsolutePath());
+                    ImageIO.write(image, "PNG", file);
+                } catch (IOException ioe) {
+                    ioe.printStackTrace();
+                }
+            }
+
+            // Check image:
+            // 0, 25 = black
+            checkPixel(image.getData(), 0, 25, Color.BLACK.getRGB());
+        } finally {
+            g2d.dispose();
+        }
+    }
+
+    private static void checkPixel(final Raster raster,
+                                   final int x, final int y,
+                                   final int expected) {
+
+        final int[] rgb = (int[]) raster.getDataElements(x, y, null);
+
+        if (rgb[0] != expected) {
+            throw new IllegalStateException("bad pixel at (" + x + ", " + y
+                    + ") = " + rgb[0] + " expected: " + expected);
+        }
+    }
+
+}
--- a/test/jdk/sun/misc/URLClassPath/ClassnameCharTest.java	Wed Oct 03 15:54:35 2018 +0200
+++ b/test/jdk/sun/misc/URLClassPath/ClassnameCharTest.java	Wed Oct 03 16:02:24 2018 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2012, 2016, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2012, 2018, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -25,7 +25,7 @@
  * @bug 4957669 5017871
  * @summary cannot load class names containing some JSR 202 characters;
  *          plugin does not escape unicode character in http request
- * @modules java.desktop/sun.applet
+ * @modules java.base/sun.net.www
  *          jdk.httpserver
  * @compile -XDignore.symbol.file=true ClassnameCharTest.java
  * @run main ClassnameCharTest
@@ -33,9 +33,14 @@
 
 import java.io.*;
 import java.net.*;
+import java.security.AccessControlContext;
+import java.security.AccessController;
+import java.security.CodeSource;
+import java.security.PrivilegedActionException;
+import java.security.PrivilegedExceptionAction;
 import java.util.jar.*;
 import com.sun.net.httpserver.*;
-import sun.applet.AppletClassLoader;
+import sun.net.www.ParseUtil;
 
 public class ClassnameCharTest {
     static String FNPrefix = System.getProperty("test.src", ".") + File.separator;
@@ -79,7 +84,7 @@
         try {
             URL base = new URL("http://localhost:" + server.getAddress().getPort());
             System.out.println ("Server: listening on " + base);
-            MyAppletClassLoader acl = new MyAppletClassLoader(base);
+            MyURLClassLoader acl = new MyURLClassLoader(base);
             Class<?> class1 = acl.findClass("fo o");
             System.out.println("class1 = " + class1);
             pass();
@@ -90,15 +95,95 @@
             server.stop(0);
         }
     }
-
-    static class MyAppletClassLoader extends AppletClassLoader {
-        MyAppletClassLoader(URL base) {
-            super(base);
+    // the class loader code was copied from the now deleted AppletClassLoader
+    static class MyURLClassLoader extends URLClassLoader {
+        private URL base;   /* applet code base URL */
+        private CodeSource codesource; /* codesource for the base URL */
+        private AccessControlContext acc;
+        MyURLClassLoader(URL base) {
+            super(new URL[0]);
+            this.base = base;
+            this.codesource =
+                    new CodeSource(base, (java.security.cert.Certificate[]) null);
+            acc = AccessController.getContext();
         }
 
         @Override
         public Class<?> findClass(String name) throws ClassNotFoundException {
-            return super.findClass(name);
+            int index = name.indexOf(';');
+            String cookie = "";
+            if(index != -1) {
+                cookie = name.substring(index, name.length());
+                name = name.substring(0, index);
+            }
+
+            // check loaded JAR files
+            try {
+                return super.findClass(name);
+            } catch (ClassNotFoundException e) {
+            }
+
+            // Otherwise, try loading the class from the code base URL
+            //      final String path = name.replace('.', '/').concat(".class").concat(cookie);
+            String encodedName = ParseUtil.encodePath(name.replace('.', '/'), false);
+            final String path = (new StringBuffer(encodedName)).append(".class").append(cookie).toString();
+            try {
+                byte[] b = AccessController.doPrivileged(
+                        new PrivilegedExceptionAction<byte[]>() {
+                            public byte[] run() throws IOException {
+                                try {
+                                    URL finalURL = new URL(base, path);
+
+                                    // Make sure the codebase won't be modified
+                                    if (base.getProtocol().equals(finalURL.getProtocol()) &&
+                                            base.getHost().equals(finalURL.getHost()) &&
+                                            base.getPort() == finalURL.getPort()) {
+                                        return getBytes(finalURL);
+                                    }
+                                    else {
+                                        return null;
+                                    }
+                                } catch (Exception e) {
+                                    return null;
+                                }
+                            }
+                        }, acc);
+
+                if (b != null) {
+                    return defineClass(name, b, 0, b.length, codesource);
+                } else {
+                    throw new ClassNotFoundException(name);
+                }
+            } catch (PrivilegedActionException e) {
+                throw new ClassNotFoundException(name, e.getException());
+            }
+        }
+
+        /*
+         * Returns the contents of the specified URL as an array of bytes.
+         */
+        private static byte[] getBytes(URL url) throws IOException {
+            URLConnection uc = url.openConnection();
+            if (uc instanceof java.net.HttpURLConnection) {
+                java.net.HttpURLConnection huc = (java.net.HttpURLConnection) uc;
+                int code = huc.getResponseCode();
+                if (code >= java.net.HttpURLConnection.HTTP_BAD_REQUEST) {
+                    throw new IOException("open HTTP connection failed.");
+                }
+            }
+            int len = uc.getContentLength();
+
+            InputStream in = new BufferedInputStream(uc.getInputStream());
+
+            byte[] b;
+            try {
+                b = in.readAllBytes();
+                if (len != -1 && b.length != len)
+                    throw new EOFException("Expected:" + len + ", read:" + b.length);
+            } finally {
+                in.close();
+            }
+            return b;
         }
     }
 
--- a/test/jdk/sun/net/www/http/HttpClient/MultiThreadTest.java	Wed Oct 03 15:54:35 2018 +0200
+++ b/test/jdk/sun/net/www/http/HttpClient/MultiThreadTest.java	Wed Oct 03 16:02:24 2018 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2002, 2010, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2002, 2018, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -39,13 +39,16 @@
 
 import java.net.*;
 import java.io.*;
+import java.time.Duration;
+import java.util.Queue;
+import java.util.concurrent.ConcurrentLinkedQueue;
 
 public class MultiThreadTest extends Thread {
 
     /*
      * Is debugging enabled - start with -d to enable.
      */
-    static boolean debug = false;
+    static boolean debug = true; // disable debug once stability proven
 
     static Object threadlock = new Object ();
     static int threadCounter = 0;
@@ -82,8 +85,7 @@
     int requests;
 
     MultiThreadTest(int port, int requests) throws Exception {
-        uri = "http://localhost:" +
-                     port + "/foo.html";
+        uri = "http://localhost:" + port + "/foo.html";
 
         b = new byte [256];
         this.requests = requests;
@@ -93,7 +95,9 @@
         }
     }
 
-    public void run () {
+    public void run() {
+        long start = System.nanoTime();
+
         try {
             for (int i=0; i<requests; i++) {
                 doRequest (uri);
@@ -108,11 +112,13 @@
                 }
             }
         }
+        debug("client: end - " + Duration.ofNanos(System.nanoTime() - start));
     }
 
     static int threads=5;
 
     public static void main(String args[]) throws Exception {
+        long start = System.nanoTime();
 
         int x = 0, arg_len = args.length;
         int requests = 20;
@@ -157,6 +163,11 @@
         if  (reqs != threads*requests) {
             throw new RuntimeException ("Expected "+ threads*requests+ " requests: got " +reqs);
         }
+        for (Thread worker : svr.workers()) {
+            worker.join(60_000);
+        }
+
+        debug("main thread end - " + Duration.ofNanos(System.nanoTime() - start));
     }
 }
 
@@ -168,11 +179,16 @@
         ServerSocket ss;
         int connectionCount;
         boolean shutdown = false;
+        private Queue<Worker> workers = new ConcurrentLinkedQueue<>();
 
         Server(ServerSocket ss) {
             this.ss = ss;
         }
 
+        public Queue<Worker> workers() {
+            return workers;
+        }
+
         public synchronized int connectionCount() {
             return connectionCount;
         }
@@ -203,11 +219,12 @@
                     }
 
                     int id;
+                    Worker w;
                     synchronized (this) {
                         id = connectionCount++;
+                        w = new Worker(s, id);
+                        workers.add(w);
                     }
-
-                    Worker w = new Worker(s, id);
                     w.start();
                     MultiThreadTest.debug("server: Started worker " + id);
                 }
@@ -236,7 +253,7 @@
         }
 
         static int requests = 0;
-        static Object rlock = new Object();
+        static final Object rlock = new Object();
 
         public static int getRequests () {
             synchronized (rlock) {
@@ -249,7 +266,7 @@
             }
         }
 
-        int readUntil (InputStream in, char[] seq) throws IOException {
+        int readUntil(InputStream in, char[] seq) throws IOException {
             int i=0, count=0;
             while (true) {
                 int c = in.read();
@@ -268,10 +285,12 @@
         }
 
         public void run() {
+            long start = System.nanoTime();
+
             try {
                 int max = 400;
                 byte b[] = new byte[1000];
-                InputStream in = new BufferedInputStream (s.getInputStream());
+                InputStream in = new BufferedInputStream(s.getInputStream());
                 // response to client
                 PrintStream out = new PrintStream(
                                     new BufferedOutputStream(
@@ -282,7 +301,7 @@
                     // read entire request from client
                     int n=0;
 
-                    n = readUntil (in, new char[] {'\r','\n', '\r','\n'});
+                    n = readUntil(in, new char[] {'\r','\n', '\r','\n'});
 
                     if (n <= 0) {
                         MultiThreadTest.debug("worker: " + id + ": Shutdown");
@@ -299,11 +318,11 @@
                     out.print("Transfer-Encoding: chunked\r\n");
                     out.print("Content-Type: text/html\r\n");
                     out.print("Connection: Keep-Alive\r\n");
-                    out.print ("Keep-Alive: timeout=15, max="+max+"\r\n");
+                    out.print("Keep-Alive: timeout=15, max="+max+"\r\n");
                     out.print("\r\n");
-                    out.print ("6\r\nHello \r\n");
-                    out.print ("5\r\nWorld\r\n");
-                    out.print ("0\r\n\r\n");
+                    out.print("6\r\nHello \r\n");
+                    out.print("5\r\nWorld\r\n");
+                    out.print("0\r\n\r\n");
                     out.flush();
 
                     if (--max == 0) {
@@ -318,6 +337,8 @@
                 try {
                     s.close();
                 } catch (Exception e) { }
+                MultiThreadTest.debug("worker: " + id  + " end - " +
+                            Duration.ofNanos(System.nanoTime() - start));
             }
         }
     }
--- a/test/jdk/sun/net/www/protocol/jar/jarbug/TestDriver.java	Wed Oct 03 15:54:35 2018 +0200
+++ b/test/jdk/sun/net/www/protocol/jar/jarbug/TestDriver.java	Wed Oct 03 16:02:24 2018 +0200
@@ -25,7 +25,6 @@
  * @test
  * @bug 4361044 4388202 4418643 4523159 4730642
  * @library /test/lib
- *          /lib/testlibrary
  * @modules jdk.compiler
  * @build jdk.test.lib.compiler.CompilerUtils
  *        jdk.test.lib.Utils
@@ -34,7 +33,8 @@
  *        jdk.test.lib.JDKToolLauncher
  *        jdk.test.lib.Platform
  *        jdk.test.lib.process.*
- *        src.test.src.TestDriver JarUtils
+ *        jdk.test.lib.util.JarUtils
+ *        src.test.src.TestDriver
  * @summary various resource and classloading bugs related to jar files
  * @run main/othervm TestDriver
  */
@@ -42,6 +42,7 @@
 import jdk.test.lib.JDKToolFinder;
 import jdk.test.lib.compiler.CompilerUtils;
 import jdk.test.lib.process.ProcessTools;
+import jdk.test.lib.util.JarUtils;
 
 import java.io.File;
 import java.nio.file.Files;
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/jdk/sun/security/krb5/auto/DnsCanonicalizeHostname.java	Wed Oct 03 16:02:24 2018 +0200
@@ -0,0 +1,81 @@
+/*
+ * Copyright (c) 2018, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * 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.Asserts;
+import sun.security.krb5.PrincipalName;
+
+import java.nio.file.Files;
+import java.nio.file.Path;
+import java.util.List;
+
+/*
+ * @test
+ * @bug 8210821
+ * @summary Support dns_canonicalize_hostname in krb5.conf
+ * @library /test/lib
+ * @compile -XDignore.symbol.file DnsCanonicalizeHostname.java
+ * @run main jdk.test.lib.FileInstaller dns_canonicalize_hostname.hosts hosts
+ * @run main/othervm -Djdk.net.hosts.file=hosts DnsCanonicalizeHostname none
+ * @run main/othervm -Djdk.net.hosts.file=hosts DnsCanonicalizeHostname true
+ * @run main/othervm -Djdk.net.hosts.file=hosts DnsCanonicalizeHostname false
+ */
+public class DnsCanonicalizeHostname {
+
+    // In dns_canonicalize_hostname.hosts, all "dummy.example.com", "dummy",
+    // and "bogus" are resolved to 127.0.0.1. Since "dummy.example.com" is on
+    // the first line, it is returned at the reverse lookup.
+
+    public static void main(String[] args) throws Exception {
+
+        Files.write(Path.of("krb5.conf"), List.of(
+                "[libdefaults]",
+                "default_realm = R",
+                args[0].equals("none")
+                        ? "# empty line"
+                        : "dns_canonicalize_hostname = " + args[0],
+                "",
+                "[realms]",
+                "R = {",
+                "    kdc = 127.0.0.1",
+                "}"
+        ));
+        System.setProperty("java.security.krb5.conf", "krb5.conf");
+
+        String n1 = new PrincipalName("host/dummy", PrincipalName.KRB_NT_SRV_HST)
+                .getNameStrings()[1];
+        String n2 = new PrincipalName("host/bogus", PrincipalName.KRB_NT_SRV_HST)
+                .getNameStrings()[1];
+
+        switch (args[0]) {
+            case "none":
+            case "true":
+                Asserts.assertEQ(n1, "dummy.example.com");
+                Asserts.assertEQ(n2, "bogus");
+                break;
+            case "false":
+                Asserts.assertEQ(n1, "dummy");
+                Asserts.assertEQ(n2, "bogus");
+                break;
+        }
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/jdk/sun/security/krb5/auto/dns_canonicalize_hostname.hosts	Wed Oct 03 16:02:24 2018 +0200
@@ -0,0 +1,8 @@
+# The preferred name at reverse lookup
+127.0.0.1 dummy.example.com
+
+# The short name
+127.0.0.1 dummy
+
+# The strange name
+127.0.0.1 bogus
--- a/test/jdk/sun/security/pkcs11/PKCS11Test.java	Wed Oct 03 15:54:35 2018 +0200
+++ b/test/jdk/sun/security/pkcs11/PKCS11Test.java	Wed Oct 03 16:02:24 2018 +0200
@@ -27,11 +27,14 @@
 import java.io.BufferedReader;
 import java.io.ByteArrayOutputStream;
 import java.io.File;
-import java.io.FileInputStream;
 import java.io.IOException;
+import java.io.InputStream;
 import java.io.InputStreamReader;
 import java.io.StringReader;
 import java.nio.charset.StandardCharsets;
+import java.nio.file.Files;
+import java.nio.file.Path;
+import java.nio.file.Paths;
 import java.security.AlgorithmParameters;
 import java.security.InvalidAlgorithmParameterException;
 import java.security.KeyPairGenerator;
@@ -304,6 +307,22 @@
     }
 
     static String getNSSLibDir(String library) throws Exception {
+        Path libPath = getNSSLibPath(library);
+        if (libPath == null) {
+            return null;
+        }
+
+        String libDir = String.valueOf(libPath.getParent()) + File.separatorChar;
+        System.out.println("nssLibDir: " + libDir);
+        System.setProperty("pkcs11test.nss.libdir", libDir);
+        return libDir;
+    }
+
+    private static Path getNSSLibPath() throws Exception {
+        return getNSSLibPath(nss_library);
+    }
+
+    static Path getNSSLibPath(String library) throws Exception {
         String osid = getOsId();
         String[] nssLibDirs = getNssLibPaths(osid);
         if (nssLibDirs == null) {
@@ -315,21 +334,20 @@
             System.out.println("Warning: NSS not supported on this platform, skipping test");
             return null;
         }
-        String nssLibDir = null;
+
+        Path nssLibPath = null;
         for (String dir : nssLibDirs) {
-            if (new File(dir).exists() &&
-                new File(dir + System.mapLibraryName(library)).exists()) {
-                nssLibDir = dir;
-                System.out.println("nssLibDir: " + nssLibDir);
-                System.setProperty("pkcs11test.nss.libdir", nssLibDir);
+            Path libPath = Paths.get(dir).resolve(System.mapLibraryName(library));
+            if (Files.exists(libPath)) {
+                nssLibPath = libPath;
                 break;
             }
         }
-        if (nssLibDir == null) {
+        if (nssLibPath == null) {
             System.out.println("Warning: can't find NSS librarys on this machine, skipping test");
             return null;
         }
-        return nssLibDir;
+        return nssLibPath;
     }
 
     private static String getOsId() {
@@ -420,7 +438,7 @@
         boolean found = false;
         String s = null;
         int i = 0;
-        String libfile = "";
+        Path libfile = null;
 
         if (library.compareTo("softokn3") == 0 && softoken3_version > -1)
             return softoken3_version;
@@ -428,12 +446,11 @@
             return nss3_version;
 
         try {
-            String libdir = getNSSLibDir();
-            if (libdir == null) {
+            libfile = getNSSLibPath();
+            if (libfile == null) {
                 return 0.0;
             }
-            libfile = libdir + System.mapLibraryName(library);
-            try (FileInputStream is = new FileInputStream(libfile)) {
+            try (InputStream is = Files.newInputStream(libfile)) {
                 byte[] data = new byte[1000];
                 int read = 0;
 
--- a/test/jdk/sun/security/tools/keytool/KeyToolTest.java	Wed Oct 03 15:54:35 2018 +0200
+++ b/test/jdk/sun/security/tools/keytool/KeyToolTest.java	Wed Oct 03 16:02:24 2018 +0200
@@ -22,10 +22,9 @@
  */
 
 /*
- *
- *
+ * @test
+ * @author weijun.wang
  * @summary Testing keytool
- * @author weijun.wang
  *
  * Run through autotest.sh and manualtest.sh
  *
@@ -54,6 +53,12 @@
  *
  * ATTENTION:
  * NSS PKCS11 config file are changed, DSA not supported now.
+ *
+ * @library /test/lib
+ * @modules java.base/sun.security.tools.keytool
+ *          java.base/sun.security.util
+ *          java.base/sun.security.x509
+ * @run main/othervm/timeout=600 -Dfile KeyToolTest
  */
 
 import java.nio.file.Files;
@@ -68,6 +73,7 @@
 import jdk.test.lib.util.FileUtils;
 import sun.security.util.ObjectIdentifier;
 
+
 public class KeyToolTest {
 
     // The stdout and stderr outputs after a keytool run
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/jdk/sun/security/tools/keytool/NssTest.java	Wed Oct 03 16:02:24 2018 +0200
@@ -0,0 +1,63 @@
+/*
+ * Copyright (c) 2018, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * 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.io.IOException;
+import java.nio.file.Files;
+import java.nio.file.Path;
+import java.nio.file.Paths;
+
+/*
+ * @test
+ * @summary It tests (almost) all keytool behaviors with NSS.
+ * @library /test/lib /test/jdk/sun/security/pkcs11
+ * @modules java.base/sun.security.tools.keytool
+ *          java.base/sun.security.util
+ *          java.base/sun.security.x509
+ * @run main/othervm/timeout=600 NssTest
+ */
+public class NssTest {
+
+    public static void main(String[] args) throws Exception {
+        Path libPath = PKCS11Test.getNSSLibPath("softokn3");
+        if (libPath == null) {
+            return;
+        }
+        System.out.println("Using NSS lib at " + libPath);
+
+        copyFiles();
+        System.setProperty("nss", "");
+        System.setProperty("nss.lib", String.valueOf(libPath));
+        KeyToolTest.main(args);
+    }
+
+    private static void copyFiles() throws IOException {
+        Path srcPath = Paths.get(System.getProperty("test.src"));
+        Files.copy(srcPath.resolve("p11-nss.txt"), Paths.get("p11-nss.txt"));
+
+        Path dbPath = srcPath.getParent().getParent()
+                .resolve("pkcs11").resolve("nss").resolve("db");
+        Files.copy(dbPath.resolve("cert8.db"), Paths.get("cert8.db"));
+        Files.copy(dbPath.resolve("key3.db"), Paths.get("key3.db"));
+        Files.copy(dbPath.resolve("secmod.db"), Paths.get("secmod.db"));
+    }
+}
--- a/test/jdk/sun/security/tools/keytool/autotest.sh	Wed Oct 03 15:54:35 2018 +0200
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,130 +0,0 @@
-#
-# Copyright (c) 2006, 2018, Oracle and/or its affiliates. All rights reserved.
-# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
-#
-# This code is free software; you can redistribute it and/or modify it
-# 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 (almost) all keytool behaviors
-# @author Weijun Wang
-# @library /test/lib
-# @build jdk.test.lib.util.FileUtils
-# @run shell/timeout=600 autotest.sh
-# This test is only executed on several platforms
-#
-# set a few environment variables so that the shell-script can run stand-alone
-# in the source directory
-if [ "${TESTSRC}" = "" ] ; then
-  TESTSRC="."
-fi
-if [ "${TESTCLASSES}" = "" ] ; then
-  TESTCLASSES="."
-fi
-if [ "${TESTJAVA}" = "" ] ; then
-  echo "TESTJAVA not set.  Test cannot execute."
-  echo "FAILED!!!"
-  exit 1
-fi
-if [ "${COMPILEJAVA}" = "" ]; then
-  COMPILEJAVA="${TESTJAVA}"
-fi
-
-find_one() {
-  for TARGET_FILE in $@; do
-    if [ -e "$TARGET_FILE" ]; then
-      echo $TARGET_FILE
-      return
-    fi
-  done
-}
-
-FS="/"
-${TESTJAVA}${FS}bin${FS}java -XshowSettings:properties -version 2> allprop
-cat allprop | grep sun.arch.data.model | grep 32
-if [ "$?" != "0" ]; then
-  B32=false
-else
-  B32=true
-fi
-
-# set platform-dependent variables
-OS=`uname -s`
-case "$OS" in
-  SunOS )
-    FS="/"
-    LIBNAME="/usr/lib/mps/`isainfo -n`/libsoftokn3.so"
-    ;;
-  Linux )
-    if [ $B32 = true ]; then
-        LIBNAME=`find_one \
-            "/usr/lib32/libsoftokn3.so" \
-            "/usr/lib32/nss/libsoftokn3.so" \
-            "/usr/lib/libsoftokn3.so" \
-            "/usr/lib/i386-linux-gnu/nss/libsoftokn3.so" \
-            "/usr/lib/nss/libsoftokn3.so"`
-    else
-        LIBNAME=`find_one \
-            "/usr/lib64/libsoftokn3.so" \
-            "/usr/lib/x86_64-linux-gnu/nss/libsoftokn3.so" \
-            "/usr/lib/nss/libsoftokn3.so"`
-    fi
-    ;;
-  * )
-    echo "Will not run test on: ${OS}"
-    exit 0;
-    ;;
-esac
-case "$OS" in
-  Windows_* | CYGWIN* )
-    PS=";"
-    ;;
-  * )
-    PS=":"
-    ;;
-esac
-
-if [ "$LIBNAME" = "" ]; then
-  echo "Cannot find libsoftokn3.so"
-  exit 0
-fi
-
-echo "Using NSS lib at $LIBNAME"
-
-EXTRAOPTS="--add-exports java.base/sun.security.tools.keytool=ALL-UNNAMED \
- --add-exports java.base/sun.security.util=ALL-UNNAMED \
- --add-exports java.base/sun.security.x509=ALL-UNNAMED"
-${COMPILEJAVA}${FS}bin${FS}javac -classpath ${TESTCLASSPATH} ${TESTJAVACOPTS} ${TESTTOOLVMOPTS} ${EXTRAOPTS} -d . -XDignore.symbol.file \
-        ${TESTSRC}${FS}KeyToolTest.java || exit 10
-
-NSS=${TESTSRC}${FS}..${FS}..${FS}pkcs11${FS}nss
-
-cp ${TESTSRC}${FS}p11-nss.txt .
-cp ${NSS}${FS}db${FS}cert8.db .
-cp ${NSS}${FS}db${FS}key3.db .
-cp ${NSS}${FS}db${FS}secmod.db .
-
-chmod u+w key3.db
-chmod u+w cert8.db
-echo | ${TESTJAVA}${FS}bin${FS}java -classpath .${PS}${TESTCLASSPATH} ${TESTVMOPTS} ${EXTRAOPTS} -Dnss \
-   -Dnss.lib=${LIBNAME} \
-   KeyToolTest
-status=$?
-
-exit $status
--- a/test/jdk/sun/security/tools/keytool/standard.sh	Wed Oct 03 15:54:35 2018 +0200
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,81 +0,0 @@
-#
-# Copyright (c) 2009, 2018, Oracle and/or its affiliates. All rights reserved.
-# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
-#
-# This code is free software; you can redistribute it and/or modify it
-# 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 (almost) all keytool behaviors
-# @author Weijun Wang
-# @library /test/lib
-# @build jdk.test.lib.util.FileUtils
-# @run shell/timeout=600 standard.sh
-# @key intermittent
-
-# This test is always excecuted.
-#
-# set a few environment variables so that the shell-script can run stand-alone
-# in the source directory
-if [ "${TESTSRC}" = "" ] ; then
-  TESTSRC="."
-fi
-if [ "${TESTCLASSES}" = "" ] ; then
-  TESTCLASSES="."
-fi
-if [ "${TESTJAVA}" = "" ] ; then
-  JAVAC_CMD=`which javac`
-  TESTJAVA=`dirname $JAVAC_CMD`/..
-  COMPILEJAVA="${TESTJAVA}"
-fi
-
-# set platform-dependent variables
-OS=`uname -s`
-case "$OS" in
-  SunOS | Linux | Darwin | AIX | CYGWIN* )
-    FS="/"
-    ;;
-  Windows_* )
-    FS="\\"
-    ;;
-  * )
-    echo "Unrecognized system!"
-    exit 1;
-    ;;
-esac
-case "$OS" in
-  Windows_* | CYGWIN* )
-    PS=";"
-    ;;
-  * )
-    PS=":"
-    ;;
-esac
-
-EXTRAOPTS="--add-exports java.base/sun.security.tools.keytool=ALL-UNNAMED \
- --add-exports java.base/sun.security.util=ALL-UNNAMED \
- --add-exports java.base/sun.security.x509=ALL-UNNAMED"
-
-${COMPILEJAVA}${FS}bin${FS}javac -classpath ${TESTCLASSPATH} ${TESTJAVACOPTS} ${TESTTOOLVMOPTS} ${EXTRAOPTS} -d . -XDignore.symbol.file ${TESTSRC}${FS}KeyToolTest.java || exit 10
-
-echo | ${TESTJAVA}${FS}bin${FS}java -classpath .${PS}${TESTCLASSPATH} ${TESTVMOPTS} ${EXTRAOPTS} -Dfile KeyToolTest
-status=$?
-
-exit $status
-
--- a/test/jdk/tools/jimage/JImageTest.java	Wed Oct 03 15:54:35 2018 +0200
+++ b/test/jdk/tools/jimage/JImageTest.java	Wed Oct 03 16:02:24 2018 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2015, 2018, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -93,9 +93,9 @@
         }
 
         File jdkHome = new File(System.getProperty("test.jdk"));
-        // JPRT not yet ready for jmods
         Helper helper = Helper.newHelper();
         if (helper == null) {
+            // Skip test if the jmods directory is missing (e.g. exploded image)
             System.err.println("Test not run, NO jmods directory");
             return;
         }
--- a/test/jdk/tools/jlink/basic/BasicTest.java	Wed Oct 03 15:54:35 2018 +0200
+++ b/test/jdk/tools/jlink/basic/BasicTest.java	Wed Oct 03 16:02:24 2018 +0200
@@ -25,13 +25,14 @@
  * @test
  * @summary Basic test of jlink to create jmods and images
  * @author Andrei Eremeev
- * @library /lib/testlibrary /test/lib
+ * @library /test/lib
  * @modules java.base/jdk.internal.module
  *          jdk.jlink
  *          jdk.compiler
  * @build jdk.test.lib.process.ProcessTools
  *        jdk.test.lib.process.OutputAnalyzer
- *        JarUtils jdk.test.lib.compiler.CompilerUtils
+ *        jdk.test.lib.compiler.CompilerUtils
+ *        jdk.test.lib.util.JarUtils
  * @run main BasicTest
  */
 
@@ -48,6 +49,7 @@
 import jdk.test.lib.compiler.CompilerUtils;
 import jdk.test.lib.process.OutputAnalyzer;
 import jdk.test.lib.process.ProcessTools;
+import jdk.test.lib.util.JarUtils;
 
 public class BasicTest {
     static final ToolProvider JMOD_TOOL = ToolProvider.findFirst("jmod")
--- a/test/jdk/tools/jlink/plugins/StringSharingPluginTest.java	Wed Oct 03 15:54:35 2018 +0200
+++ b/test/jdk/tools/jlink/plugins/StringSharingPluginTest.java	Wed Oct 03 16:02:24 2018 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2015, 2018, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -67,9 +67,9 @@
     private static int strID = 1;
 
     public static void main(String[] args) throws Exception {
-        // JPRT not yet ready for jmods
         Helper helper = Helper.newHelper();
         if (helper == null) {
+            // Skip test if the jmods directory is missing (e.g. exploded image)
             System.err.println("Test not run, NO jmods directory");
             return;
         }
--- a/test/jdk/tools/jlink/plugins/StripDebugPluginTest.java	Wed Oct 03 15:54:35 2018 +0200
+++ b/test/jdk/tools/jlink/plugins/StripDebugPluginTest.java	Wed Oct 03 16:02:24 2018 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2015, 2018, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -68,9 +68,9 @@
     }
 
     public void test() throws Exception {
-        // JPRT not yet ready for jmods
         Helper helper = Helper.newHelper();
         if (helper == null) {
+            // Skip test if the jmods directory is missing (e.g. exploded image)
             System.err.println("Test not run, NO jmods directory");
             return;
         }
--- a/test/jdk/tools/launcher/ArgFileSyntax.java	Wed Oct 03 15:54:35 2018 +0200
+++ b/test/jdk/tools/launcher/ArgFileSyntax.java	Wed Oct 03 16:02:24 2018 +0200
@@ -23,7 +23,7 @@
 
 /**
  * @test
- * @bug 8027634
+ * @bug 8027634 8210810
  * @summary Verify syntax of argument file
  * @build TestHelper
  * @run main ArgFileSyntax
@@ -40,6 +40,9 @@
 import java.util.regex.Pattern;
 
 public class ArgFileSyntax extends TestHelper {
+    // Buffer size in args.c readArgFile() method
+    private static final int ARG_FILE_PARSER_BUF_SIZE = 4096;
+
     private File createArgFile(List<String> lines) throws IOException {
         File argFile = new File("argfile");
         argFile.delete();
@@ -186,7 +189,7 @@
         String bag = "-Dgarbage=";
         String ver = "-version";
         // a token 8192 long
-        char[] data = new char[8192 - bag.length()];
+        char[] data = new char[2*ARG_FILE_PARSER_BUF_SIZE - bag.length()];
         Arrays.fill(data, 'O');
         List<String> scratch = new ArrayList<>();
         scratch.add("-Xmx32m");
@@ -194,13 +197,23 @@
         scratch.add(ver);
         rv.add(Collections.nCopies(2, scratch));
 
-        data = new char[8192 + 1024];
+        data = new char[2*ARG_FILE_PARSER_BUF_SIZE + 1024];
         Arrays.fill(data, 'O');
         scratch = new ArrayList<>();
         scratch.add(bag + String.valueOf(data));
         scratch.add(ver);
         rv.add(Collections.nCopies(2, scratch));
 
+        // 8210810: position escaping character at boundary
+        // reserve space for quote and backslash
+        data = new char[ARG_FILE_PARSER_BUF_SIZE - bag.length() - 2];
+        Arrays.fill(data, 'O');
+        scratch = new ArrayList<>();
+        String filling = String.valueOf(data);
+        scratch.add(bag + "'" + filling + "\\\\aaa\\\\'");
+        scratch.add(ver);
+        rv.add(List.of(scratch, List.of(bag + filling + "\\aaa\\", ver)));
+
         return rv;
     }
 
--- a/test/jdk/tools/launcher/modules/addexports/manifest/AddExportsAndOpensInManifest.java	Wed Oct 03 15:54:35 2018 +0200
+++ b/test/jdk/tools/launcher/modules/addexports/manifest/AddExportsAndOpensInManifest.java	Wed Oct 03 16:02:24 2018 +0200
@@ -23,10 +23,10 @@
 
 /**
  * @test
- * @library /lib/testlibrary
  * @library /test/lib
  * @modules jdk.compiler
- * @build AddExportsAndOpensInManifest Test2 JarUtils jdk.testlibrary.*
+ * @build AddExportsAndOpensInManifest Test2
+ *        jdk.test.lib.util.JarUtils
  * @compile --add-exports=java.base/jdk.internal.misc=ALL-UNNAMED Test1.java
  * @run testng AddExportsAndOpensInManifest
  * @summary Basic test for Add-Exports and Add-Opens attributes in the
@@ -42,6 +42,7 @@
 
 import jdk.test.lib.process.OutputAnalyzer;
 import jdk.test.lib.process.ProcessTools;
+import jdk.test.lib.util.JarUtils;
 
 import org.testng.annotations.BeforeMethod;
 import org.testng.annotations.Test;
--- a/test/jdk/tools/launcher/modules/addreads/AddReadsTest.java	Wed Oct 03 15:54:35 2018 +0200
+++ b/test/jdk/tools/launcher/modules/addreads/AddReadsTest.java	Wed Oct 03 16:02:24 2018 +0200
@@ -23,10 +23,11 @@
 
 /**
  * @test
- * @library /lib/testlibrary /test/lib
+ * @library /test/lib
  * @modules jdk.compiler
- * @build AddReadsTest JarUtils
+ * @build AddReadsTest
  *        jdk.test.lib.compiler.CompilerUtils
+ *        jdk.test.lib.util.JarUtils
  * @run testng AddReadsTest
  * @summary Basic tests for java --add-reads
  */
@@ -36,6 +37,7 @@
 
 import jdk.test.lib.compiler.CompilerUtils;
 import jdk.test.lib.process.OutputAnalyzer;
+import jdk.test.lib.util.JarUtils;
 import static jdk.test.lib.process.ProcessTools.*;
 
 import org.testng.annotations.BeforeTest;
--- a/test/jdk/tools/launcher/modules/illegalaccess/IllegalAccessTest.java	Wed Oct 03 15:54:35 2018 +0200
+++ b/test/jdk/tools/launcher/modules/illegalaccess/IllegalAccessTest.java	Wed Oct 03 16:02:24 2018 +0200
@@ -26,9 +26,10 @@
  * @requires vm.compMode != "Xcomp"
  * @modules java.base/jdk.internal.misc
  *          java.base/sun.security.x509
- * @library /test/lib /lib/testlibrary modules
- * @build IllegalAccessTest TryAccess JarUtils
+ * @library /test/lib modules
+ * @build IllegalAccessTest TryAccess
  *        jdk.test.lib.compiler.CompilerUtils
+ *        jdk.test.lib.util.JarUtils
  * @build m/*
  * @run testng/othervm/timeout=180 IllegalAccessTest
  * @summary Basic test for java --illegal-access=$VALUE
@@ -46,6 +47,7 @@
 import jdk.test.lib.compiler.CompilerUtils;
 import jdk.test.lib.process.ProcessTools;
 import jdk.test.lib.process.OutputAnalyzer;
+import jdk.test.lib.util.JarUtils;
 
 import org.testng.annotations.DataProvider;
 import org.testng.annotations.Test;
--- a/test/jdk/tools/launcher/modules/patch/basic/PatchTest.java	Wed Oct 03 15:54:35 2018 +0200
+++ b/test/jdk/tools/launcher/modules/patch/basic/PatchTest.java	Wed Oct 03 16:02:24 2018 +0200
@@ -23,11 +23,12 @@
 
 /**
  * @test
- * @library /lib/testlibrary /test/lib
+ * @library /test/lib
  * @modules jdk.compiler
  *          jdk.naming.dns
- * @build PatchTest JarUtils
+ * @build PatchTest
  *        jdk.test.lib.compiler.CompilerUtils
+ *        jdk.test.lib.util.JarUtils
  * @run testng PatchTest
  * @summary Basic test for --patch-module
  */
@@ -40,6 +41,7 @@
 import java.util.stream.Stream;
 
 import jdk.test.lib.compiler.CompilerUtils;
+import jdk.test.lib.util.JarUtils;
 import static jdk.test.lib.process.ProcessTools.*;
 
 import org.testng.annotations.BeforeTest;
--- a/test/jdk/tools/launcher/modules/patch/basic/PatchTestWarningError.java	Wed Oct 03 15:54:35 2018 +0200
+++ b/test/jdk/tools/launcher/modules/patch/basic/PatchTestWarningError.java	Wed Oct 03 16:02:24 2018 +0200
@@ -25,10 +25,11 @@
  * @test
  * @bug 8168836
  * @summary Basic argument validation for --patch-module
- * @library /lib/testlibrary /test/lib
+ * @library /test/lib
  * @modules jdk.compiler
- * @build PatchTestWarningError JarUtils
+ * @build PatchTestWarningError
  *        jdk.test.lib.compiler.CompilerUtils
+ *        jdk.test.lib.util.JarUtils
  * @run testng PatchTestWarningError
  */
 
@@ -40,6 +41,7 @@
 import java.util.stream.Stream;
 
 import jdk.test.lib.compiler.CompilerUtils;
+import jdk.test.lib.util.JarUtils;
 import static jdk.test.lib.process.ProcessTools.*;
 
 import org.testng.annotations.BeforeTest;
--- a/test/jdk/tools/launcher/modules/validate/ValidateModulesTest.java	Wed Oct 03 15:54:35 2018 +0200
+++ b/test/jdk/tools/launcher/modules/validate/ValidateModulesTest.java	Wed Oct 03 16:02:24 2018 +0200
@@ -25,8 +25,8 @@
  * @test
  * @bug 8178380 8194937
  * @modules java.xml
- * @library src /lib/testlibrary /test/lib
- * @build ValidateModulesTest hello/* JarUtils
+ * @library src /test/lib
+ * @build ValidateModulesTest hello/* jdk.test.lib.util.JarUtils
  * @run testng ValidateModulesTest
  * @summary Basic test for java --validate-modules
  */
@@ -38,6 +38,7 @@
 
 import jdk.test.lib.process.ProcessTools;
 import jdk.test.lib.process.OutputAnalyzer;
+import jdk.test.lib.util.JarUtils;
 
 import org.testng.annotations.Test;
 import static org.testng.Assert.*;
--- a/test/jdk/tools/lib/tests/Helper.java	Wed Oct 03 15:54:35 2018 +0200
+++ b/test/jdk/tools/lib/tests/Helper.java	Wed Oct 03 16:02:24 2018 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2015, 2018, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -67,8 +67,8 @@
 
     public static Helper newHelper() throws IOException {
         Path jdkHome = Paths.get(System.getProperty("test.jdk"));
-        // JPRT not yet ready for jmods
         if (!Files.exists(jdkHome.resolve("jmods"))) {
+            // Skip test if the jmods directory is missing (e.g. exploded image)
             System.err.println("Test not run, NO jmods directory");
             return null;
         }
--- a/test/jdk/tools/pack200/Pack200Test.java	Wed Oct 03 15:54:35 2018 +0200
+++ b/test/jdk/tools/pack200/Pack200Test.java	Wed Oct 03 16:02:24 2018 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2007, 2016, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2007, 2018, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -133,7 +133,7 @@
      */
     public static void main(String[] args) throws Exception {
         // select the jars carefully, adding more jars will increase the
-        // testing time, especially for jprt.
+        // testing time.
         jarList.add(Utils.createRtJar());
         jarList.add(Utils.getGoldenJar());
         System.out.println(jarList);
--- a/test/jdk/tools/pack200/TestExceptions.java	Wed Oct 03 15:54:35 2018 +0200
+++ b/test/jdk/tools/pack200/TestExceptions.java	Wed Oct 03 16:02:24 2018 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2010, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2010, 2018, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -110,7 +110,7 @@
                     ti.checkException(e);
                 }
             }
-        } finally { // keep jprt happy
+        } finally { // clean up
             for (TestInput ti : tlist) {
                 if (ti != null) {
                     ti.close();
@@ -143,7 +143,7 @@
                     ti.checkException(e);
                 }
             }
-        } finally { // keep jprt happy
+        } finally { // clean up
             for (PackTestJarInputStream ti : tlist) {
                 if (ti != null) {
                     ti.close();
@@ -177,7 +177,7 @@
                     ti.checkException(e);
                 }
             }
-        } finally { // keep jprt happy
+        } finally { // clean up
             for (TestInput ti : tlist) {
                 if (ti != null) {
                     ti.close();
@@ -210,7 +210,7 @@
                     ti.checkException(e);
                 }
             }
-        } finally { // keep jprt happy
+        } finally { // clean up
             for (TestInput ti : tlist) {
                 if (ti != null) {
                     ti.close();
--- a/test/langtools/Makefile	Wed Oct 03 15:54:35 2018 +0200
+++ b/test/langtools/Makefile	Wed Oct 03 16:02:24 2018 +0200
@@ -12,10 +12,6 @@
 # build, and set TESTBOOTCLASSPATH to the compiled langtools classes --
 # for example build/classes or dist/lib/classes.jar.
 
-# JPRT
-# JPRT may invoke this Makefile directly, as part of a langtools build,
-# or indirectly, via FOREST/test/Makefile, as part of a control build.
-
 # Get OS/ARCH specifics
 OSNAME = $(shell uname -s)
 ifeq ($(OSNAME), SunOS)
@@ -71,12 +67,6 @@
 # Root of this test area (important to use full paths in some places)
 TEST_ROOT := $(shell pwd $(CYGPATH) )
 
-# Default bundle of all test results (passed or not) (JPRT only)
-ifdef JPRT_JOB_ID
-  JPRT_CLEAN = clean
-  JPRT_ARCHIVE_BUNDLE = $(TEST_ROOT)/JPRT_ARCHIVE_BUNDLE.zip
-endif
-
 ifeq ($(PLATFORM), windows)
   SLASH_JAVA = J:
 else
@@ -85,9 +75,7 @@
 
 # Default JTREG to run
 ifndef JTREG_HOME
-  ifdef JPRT_JTREG_HOME
-    JTREG_HOME = $(JPRT_JTREG_HOME)
-  else ifdef JT_HOME
+  ifdef JT_HOME
     JTREG_HOME = $(JT_HOME)
   else
     JTREG_HOME = $(SLASH_JAVA)/re/jtreg/4.2/promoted/latest/
@@ -108,11 +96,7 @@
 
 # Default JCK to run
 ifndef JCK_HOME
-  ifdef JPRT_JCK_HOME
-    JCK_HOME = $(JPRT_JCK_HOME)
-  else
-    JCK_HOME = $(SLASH_JAVA)/re/jck/8/promoted/latest/binaries
-  endif
+  JCK_HOME = $(SLASH_JAVA)/re/jck/8/promoted/latest/binaries
 endif
 
 # Default JDK for JTREG and JCK
@@ -120,21 +104,13 @@
 # JT_JAVA is the version of java used to run jtreg/JCK. 
 #
 ifndef JT_JAVA
-  ifdef JPRT_JAVA_HOME
-    JT_JAVA = $(JPRT_JAVA_HOME)
-  else
-    JT_JAVA = $(SLASH_JAVA)/re/jdk/1.9.0/archive/fcs/binaries/$(PLATFORM)-$(ARCH)
-  endif
+  JT_JAVA = $(SLASH_JAVA)/re/jdk/1.9.0/archive/fcs/binaries/$(PLATFORM)-$(ARCH)
 endif
 
 # Default JDK to test
-ifdef JPRT_IMPORT_PRODUCT_HOME
-  TESTJAVA = $(JPRT_IMPORT_PRODUCT_HOME)
-else
-  TESTJAVA = $(SLASH_JAVA)/re/jdk/1.9.0/promoted/latest/binaries/$(PLATFORM)-$(ARCH)
-endif
+TESTJAVA = $(SLASH_JAVA)/re/jdk/1.9.0/promoted/latest/binaries/$(PLATFORM)-$(ARCH)
 
-# PRODUCT_HOME is a JPRT variable pointing to a directory containing the output from
+# PRODUCT_HOME is a variable pointing to a directory containing the output from
 # make/Makefile
 # For langtools, this is a directory containing build and dist
 # For a control build, this is build/$(PRODUCT)-$(ARCH)/XYZ-image
@@ -199,12 +175,7 @@
 ###    -jtoptions:-Ejck.env.runtime.testCompile.groupMode.groupSize=$(JCK_GROUP_SIZE)
 endif
 
-# Timeouts -- by default, increase test timeouts when running on JPRT
-ifdef JPRT_JOB_ID
-  ifndef JTREG_TIMEOUT_FACTOR
-    JTREG_TIMEOUT_FACTOR = 3
-  endif
-endif
+# Timeouts
 ifdef JTREG_TIMEOUT_FACTOR
   JTREG_OPTIONS += -timeoutFactor:$(JTREG_TIMEOUT_FACTOR)
 endif
@@ -266,16 +237,16 @@
 endif
 
 # Default make rule -- warning, may take a while
-all: $(JPRT_CLEAN) jtreg-tests jck-compiler-tests jck-runtime-tests $(JPRT_ARCHIVE_BUNDLE) all-summary
+all: jtreg-tests jck-compiler-tests jck-runtime-tests all-summary
 	@echo "Testing completed successfully"
 
-jtreg apt javac javadoc javah javap jdeps: $(JPRT_CLEAN) jtreg-tests $(JPRT_ARCHIVE_BUNDLE) jtreg-summary
+jtreg apt javac javadoc javah javap jdeps: jtreg-tests jtreg-summary
 	@echo "Testing completed successfully"
 
-jck-compiler: $(JPRT_CLEAN) jck-compiler-tests $(JPRT_ARCHIVE_BUNDLE) jck-compiler-summary
+jck-compiler: jck-compiler-tests jck-compiler-summary
 	@echo "Testing completed successfully"
 
-jck-runtime: $(JPRT_CLEAN) jck-runtime-tests $(JPRT_ARCHIVE_BUNDLE) jck-runtime-summary
+jck-runtime: jck-runtime-tests jck-runtime-summary
 	@echo "Testing completed successfully"
 
 # a way to select tests from outside
@@ -286,7 +257,7 @@
   JCK_RUNTIME_TESTDIRS = $(TEST_SELECTION)
 endif
 
-# for use with JPRT -testrule
+# convenience targets
 all:		JTREG_TESTDIRS = .
 jtreg:		JTREG_TESTDIRS ?= .
 apt:		JTREG_TESTDIRS = tools/apt
@@ -476,15 +447,8 @@
 	    $(EXIT) 1
 	fi
 
-# Bundle up the results
-$(JPRT_ARCHIVE_BUNDLE): FRC
-	@rm -f $@
-	@mkdir -p $(@D)
-	( cd $(TEST_OUTPUT_DIR) && zip -q -r $@ . )
-
 # Cleanup
 clean:
-	rm -f $(JPRT_ARCHIVE_BUNDLE)
 
 # Used to force a target rules to run
 FRC:
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/langtools/jdk/javadoc/doclet/testJavaFX/TestJavaFxMode.java	Wed Oct 03 16:02:24 2018 +0200
@@ -0,0 +1,98 @@
+/*
+ * Copyright (c) 2018, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * 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 8208531
+ * @summary -javafx mode should be on by default when JavaFX is available.
+ * @library /tools/lib ../lib
+ * @modules jdk.javadoc/jdk.javadoc.internal.tool
+ * @build JavadocTester
+ * @run main TestJavaFxMode
+ */
+
+import toolbox.ToolBox;
+
+import java.nio.file.Path;
+import java.nio.file.Paths;
+
+public class TestJavaFxMode extends JavadocTester {
+
+    final ToolBox tb;
+
+    public static void main(String... args) throws Exception {
+        TestJavaFxMode tester = new TestJavaFxMode();
+        if (tester.sanity()) {
+            tester.runTests(m -> new Object[]{Paths.get(m.getName())});
+        }
+    }
+
+    TestJavaFxMode() {
+        tb = new ToolBox();
+    }
+
+    // Check if FX modules are available.
+    boolean sanity() {
+        try {
+            Class.forName("javafx.beans.Observable");
+        } catch (ClassNotFoundException cnfe) {
+            System.out.println("Note: javafx.beans.Observable: not found, test passes vacuously");
+            return false;
+        }
+        return true;
+    }
+
+    @Test
+    void test(Path base) throws Exception {
+        Path src = base.resolve("src");
+        createTestClass(src);
+        Path outDir = base.resolve("out");
+
+        javadoc("-d", outDir.toString(),
+                "-sourcepath", src.toString(),
+                "pkg");
+
+        checkExit(Exit.OK);
+        checkOrder("pkg/A.html",
+                "Property Summary",
+                "javafx.beans.property.Property", "<a href=\"#propProperty\">prop</a>",
+                "Field Summary",
+                "javafx.beans.property.Property", "<a href=\"#prop\">prop</a></span>",
+                "Method Summary",
+                "<a href=\"#getProp()\">getProp</a>", "Gets the value of the property prop.",
+                "<a href=\"#propProperty()\">propProperty</a>", "Sets the value of the property prop.");
+    }
+
+    void createTestClass(Path src) throws Exception {
+        tb.writeJavaFiles(src,
+                "package pkg;\n"
+                + "import javafx.beans.property.Property;\n"
+                + "public class A {\n"
+                + "    public Property prop;\n"
+                + "    public Property propProperty(){return null;}\n"
+                + "    public Property getProp(){return null;}\n"
+                + "    public void setProp(Property prop){}\n"
+                + "}");
+    }
+
+}
--- a/test/langtools/jdk/javadoc/doclet/testModules/TestModules.java	Wed Oct 03 15:54:35 2018 +0200
+++ b/test/langtools/jdk/javadoc/doclet/testModules/TestModules.java	Wed Oct 03 16:02:24 2018 +0200
@@ -26,7 +26,7 @@
  * @bug 8154119 8154262 8156077 8157987 8154261 8154817 8135291 8155995 8162363
  *      8168766 8168688 8162674 8160196 8175799 8174974 8176778 8177562 8175218
  *      8175823 8166306 8178043 8181622 8183511 8169819 8074407 8183037 8191464
-        8164407 8192007 8182765 8196200 8196201 8196202 8196202 8205593
+        8164407 8192007 8182765 8196200 8196201 8196202 8196202 8205593 8202462
  * @summary Test modules support in javadoc.
  * @author bpatel
  * @library ../lib
@@ -252,13 +252,11 @@
      */
     @Test
     void testAggregatorModuleSummary() {
-        setAutomaticCheckLinks(false); // @ignore JDK-8202628
         javadoc("-d", "out-aggregatorModuleSummary",
                 "-use",
                 "--module-source-path", testSrc,
                 "--expand-requires", "transitive",
                 "--module", "moduleT");
-        setAutomaticCheckLinks(true); // @ignore JDK-8202628
         checkExit(Exit.OK);
         checkAggregatorModuleSummary();
     }
--- a/test/langtools/jdk/javadoc/doclet/testNewLanguageFeatures/TestNewLanguageFeatures.java	Wed Oct 03 15:54:35 2018 +0200
+++ b/test/langtools/jdk/javadoc/doclet/testNewLanguageFeatures/TestNewLanguageFeatures.java	Wed Oct 03 16:02:24 2018 +0200
@@ -24,7 +24,7 @@
 /*
  * @test
  * @bug      4789689 4905985 4927164 4827184 4993906 5004549 7025314 7010344 8025633 8026567 8162363
- *           8175200 8186332 8182765 8196202 8187288
+ *           8175200 8186332 8182765 8196202 8187288 8173730
  * @summary  Run Javadoc on a set of source files that demonstrate new
  *           language features.  Check the output to ensure that the new
  *           language features are properly documented.
@@ -93,7 +93,6 @@
                 // Automatically insert documentation for values() and valueOf().
                 "Returns an array containing the constants of this enum type,",
                 "Returns the enum constant of this type with the specified name",
-                "for (Coin c : Coin.values())",
                 "Overloaded valueOf() method has correct documentation.",
                 "Overloaded values method  has correct documentation.",
                 "<pre class=\"methodSignature\">public static&nbsp;<a href=\"Coin.html\" title=\"enum in pkg\">Coin</a>" +
--- a/test/langtools/jdk/javadoc/tool/api/basic/IsSupportedOptionTest.java	Wed Oct 03 15:54:35 2018 +0200
+++ b/test/langtools/jdk/javadoc/tool/api/basic/IsSupportedOptionTest.java	Wed Oct 03 16:02:24 2018 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2012, 2016, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2012, 2018, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -23,7 +23,7 @@
 
 /*
  * @test
- * @bug 6493690
+ * @bug 6493690 8210555
  * @summary javadoc should have a javax.tools.Tool service provider
  * @modules java.compiler
  *          jdk.compiler
@@ -48,6 +48,8 @@
     @Test
     public void test() throws Exception {
         DocumentationTool tool = ToolProvider.getSystemDocumentationTool();
+        check(tool, "-source", 1);
+        check(tool, "--source", 1);
         check(tool, "-sourcepath", 1);
         check(tool, "-verbose", 0);
         check(tool, "-ZZZ", -1);
--- a/test/langtools/jdk/javadoc/tool/sourceOption/SourceOption.java	Wed Oct 03 15:54:35 2018 +0200
+++ b/test/langtools/jdk/javadoc/tool/sourceOption/SourceOption.java	Wed Oct 03 16:02:24 2018 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2006, 2016, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2006, 2018, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -33,25 +33,20 @@
  */
 
 /*
- * TEST NOTE
- * With JDK9, this test has been transformed into a NEGATIVE test.
+ * In order to test whether or not the -source option is working
+ * correctly, this test tries to parse source code that contains
+ * a feature that is not available in at least one of the currently
+ * supported previous versions.
  *
- * Generally speaking, this test should check a feature not in at least
- * one of the currently supported previous versions.  In this manner,
- * a failure of the -source option to be honored would mean a pass of
- * the test, and therefore a failure of the -source option.
+ * Parsing such code should be expected to fail; if the action
+ * passes, that means the -source option is (incorrectly) ineffective.
  *
- * For JDK9 and JDK10, both support 1.7, which did not support javac's
- * lambda construct.  So we set "-source 1.7" to compile a .java file
- * containing the lambda construct.  javac should fail, thus showing
- * -source to be working.  Thus the test passes.
- *
- * The second jtreg @run command checks to make sure that the source
+ * Additional actions are performed to ensure that the source
  * provided is valid for the current release of the JDK.
  *
- *  fixVersion: JDK11
- *      replace ./p/LambdaConstructTest.java with a missing from
- *      JDK8, JDK9, or JDK10.  Set -source below appropriately.
+ * As support for older versions of the platform are dropped, the
+ * source code (currently p/LambdaConstructTest.java) will need to
+ * be updated with a more recent feature.
  */
 
 import java.util.ArrayList;
--- a/test/langtools/tools/javac/RawStringLiteralLangAPI.java	Wed Oct 03 15:54:35 2018 +0200
+++ b/test/langtools/tools/javac/RawStringLiteralLangAPI.java	Wed Oct 03 16:02:24 2018 +0200
@@ -49,27 +49,41 @@
     /*
      * Check that correct/incorrect syntax is properly detected
      */
+    enum Test {
+        t0(false, "`*`*`"),
+        t1(false, "`\\u2022`\\u2022`"),
+        t2(false, "``*`*`"),
+        t3(false, "``\\u2022`\\u2022`"),
+        t4(false, "`*`*``"),
+        t5(false, "`\\u2022`\\u2022``"),
+        t6(true, "``*`*``"),
+        t7(true, "``\\u2022`\\u2022``"),
+        t8(true, "`*``*`"),
+        t9(true, "`\\u2022``\\u2022`"),
+        ;
+
+        Test(boolean pass, String string) {
+            this.pass = pass;
+            this.string = string;
+        }
+
+        boolean pass;
+        String string;
+    }
     static void test1() {
-        int[] n = new int[] { 1, 2, 3, 4, 5, 10, 16, 32, 1000, 10000 };
-        String[] s = new String[] { "a", "ab", "abc", "\u2022", "*".repeat(1000), "*".repeat(10000) };
-        for (int i : n) {
-        for (int j : n) {
-        for (int k : n) {
-        for (String a : s)  {
-        for (String b : s) {
+        for (Test t : Test.values()) {
             String code =
                     "public class RawStringLiteralTest {\n" +
                             "    public static void main(String... args) {\n" +
-                            "        String xxx = " +
-                            "`".repeat(i) + a + "`".repeat(j) + b + "`".repeat(k) + ";\n" +
+                            "        String xxx = " + t.string + ";\n" +
                             "    }\n" +
                             "}\n";
-            if (i == k && j != i) {
+            if (t.pass) {
                 compPass(code);
             } else {
                 compFail(code);
             }
-        }}}}}
+        }
     }
 
     /*
@@ -98,7 +112,6 @@
                 "        String xxx = `abc\u0000");
     }
 
-
     /*
      * Check line terminator translation
      */
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/langtools/tools/javac/analyzer/AnalyzersCheckSourceLevel.java	Wed Oct 03 16:02:24 2018 +0200
@@ -0,0 +1,15 @@
+/*
+ * @test /nodynamiccopyright/
+ * @bug 8211102
+ * @summary Ensure that the lambda analyzer does not run when -source 7 is specified,
+ *          even if explicitly requested
+ * @compile/fail/ref=AnalyzersCheckSourceLevel.out -Werror -XDfind=lambda -XDrawDiagnostics AnalyzersCheckSourceLevel.java
+ * @compile -Werror -source 7 -Xlint:-options -XDfind=lambda AnalyzersCheckSourceLevel.java
+ */
+public class AnalyzersCheckSourceLevel {
+    void t() {
+        Runnable r = new Runnable() {
+            @Override public void run() {}
+        };
+    }
+}
\ No newline at end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/langtools/tools/javac/analyzer/AnalyzersCheckSourceLevel.out	Wed Oct 03 16:02:24 2018 +0200
@@ -0,0 +1,4 @@
+AnalyzersCheckSourceLevel.java:11:37: compiler.warn.potential.lambda.found
+- compiler.err.warnings.and.werror
+1 error
+1 warning
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/langtools/tools/javac/analyzer/T8211102.java	Wed Oct 03 16:02:24 2018 +0200
@@ -0,0 +1,37 @@
+/*
+ * Copyright (c) 2018, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * 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 8211102
+ * @summary Verify javac does not crash in lambda analyzer
+ * @compile -Werror -XDfind=lambda -source 7 -Xlint:-options T8211102.java
+ */
+import java.util.*;
+
+public class T8211102 {
+    private void t(boolean b) {
+        (b ? Collections.emptyList()
+           : new Iterable<String>() { public Iterator<String> iterator() { return null; } }).toString();
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/langtools/tools/javac/flags/FlagsTest.java	Wed Oct 03 16:02:24 2018 +0200
@@ -0,0 +1,46 @@
+/*
+ * Copyright (c) 2018, Google LLC. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute 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.
+ */
+
+/**
+ * @test
+ * @bug 8211138
+ * @summary Missing Flag enum constants
+ * @library /tools/javac/lib
+ * @modules jdk.compiler/com.sun.tools.javac.code
+ * @run main FlagsTest
+ */
+import com.sun.tools.javac.code.Flags;
+import java.lang.reflect.Field;
+import java.lang.reflect.Modifier;
+
+public class FlagsTest {
+    public static void main(String[] args) throws IllegalAccessException {
+        for (Field f : Flags.class.getFields()) {
+            if (!Modifier.isStatic(f.getModifiers())) {
+                continue;
+            }
+            long flag = ((Number) f.get(null)).longValue();
+            try {
+                Flags.asFlagSet(flag);
+            } catch (AssertionError e) {
+                throw new AssertionError("missing Flags enum constant for: " + f.getName(), e);
+            }
+        }
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/langtools/tools/javac/lambda/LambdaNoFuncIntfFlow.java	Wed Oct 03 16:02:24 2018 +0200
@@ -0,0 +1,16 @@
+/**
+ * @test /nodynamiccopyright/
+ * @bug 8211102
+ * @summary Ensure Flow does not crash for recovered lambdas
+ * @compile/fail/ref=LambdaNoFuncIntfFlow.out -XDshould-stop.at=FLOW -XDrawDiagnostics LambdaNoFuncIntfFlow.java
+ */
+
+import java.util.*;
+
+public class LambdaNoFuncIntfFlow {
+    private void t(Object i) {
+        int j = i instanceof ArrayList ? (ArrayList<String>) i : () -> { return null; };
+        j = 0;
+        Runnable r = () -> t(j);
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/langtools/tools/javac/lambda/LambdaNoFuncIntfFlow.out	Wed Oct 03 16:02:24 2018 +0200
@@ -0,0 +1,6 @@
+LambdaNoFuncIntfFlow.java:12:42: compiler.err.prob.found.req: (compiler.misc.incompatible.type.in.conditional: (compiler.misc.inconvertible.types: java.util.ArrayList<java.lang.String>, int))
+LambdaNoFuncIntfFlow.java:12:66: compiler.err.prob.found.req: (compiler.misc.incompatible.type.in.conditional: (compiler.misc.not.a.functional.intf: int))
+LambdaNoFuncIntfFlow.java:14:30: compiler.err.cant.ref.non.effectively.final.var: j, (compiler.misc.lambda)
+- compiler.note.unchecked.filename: LambdaNoFuncIntfFlow.java
+- compiler.note.unchecked.recompile
+3 errors
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/langtools/tools/javac/lambda/NoTargetLambda.java	Wed Oct 03 16:02:24 2018 +0200
@@ -0,0 +1,12 @@
+/*
+ * @test /nodynamiccopyright/
+ * @bug 8211102
+ * @summary Ensure javac does not crash for (invalid) lambda in standalone conditional expression.
+ * @compile/fail/ref=NoTargetLambda.out -XDrawDiagnostics NoTargetLambda.java
+ */
+
+public class NoTargetLambda {
+    private void t(boolean b) {
+        (b ? "" : () -> { return null; }).toString();
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/langtools/tools/javac/lambda/NoTargetLambda.out	Wed Oct 03 16:02:24 2018 +0200
@@ -0,0 +1,2 @@
+NoTargetLambda.java:10:19: compiler.err.unexpected.lambda
+1 error
--- a/test/langtools/tools/javac/launcher/SourceLauncherTest.java	Wed Oct 03 15:54:35 2018 +0200
+++ b/test/langtools/tools/javac/launcher/SourceLauncherTest.java	Wed Oct 03 16:02:24 2018 +0200
@@ -47,6 +47,7 @@
 import java.util.Collections;
 import java.util.List;
 import java.util.Properties;
+import java.util.regex.Pattern;
 
 import com.sun.tools.javac.launcher.Main;
 
@@ -191,6 +192,80 @@
         checkEqual("stdout", log.trim(), "Hello World! [1, 2, 3]");
     }
 
+    @Test
+    public void testCodeSource(Path base) throws IOException {
+        tb.writeJavaFiles(base,
+            "import java.net.URL;\n" +
+            "class ShowCodeSource {\n" +
+            "    public static void main(String... args) {\n" +
+            "        URL u = ShowCodeSource.class.getProtectionDomain().getCodeSource().getLocation();\n" +
+            "        System.out.println(u);\n" +
+            "    }\n" +
+            "}");
+
+        Path file = base.resolve("ShowCodeSource.java");
+        String log = new JavaTask(tb)
+                .className(file.toString())
+                .run(Task.Expect.SUCCESS)
+                .getOutput(Task.OutputKind.STDOUT);
+        checkEqual("stdout", log.trim(), file.toAbsolutePath().toUri().toURL().toString());
+    }
+
+    @Test
+    public void testPermissions(Path base) throws IOException {
+        Path policyFile = base.resolve("test.policy");
+        Path sourceFile = base.resolve("TestPermissions.java");
+
+        tb.writeFile(policyFile,
+            "grant codeBase \"jrt:/jdk.compiler\" {\n" +
+            "    permission java.security.AllPermission;\n" +
+            "};\n" +
+            "grant codeBase \"" + sourceFile.toUri().toURL() + "\" {\n" +
+            "    permission java.util.PropertyPermission \"user.dir\", \"read\";\n" +
+            "};\n");
+
+        tb.writeJavaFiles(base,
+            "import java.net.URL;\n" +
+            "class TestPermissions {\n" +
+            "    public static void main(String... args) {\n" +
+            "        System.out.println(\"user.dir=\" + System.getProperty(\"user.dir\"));\n" +
+            "        try {\n" +
+            "            System.setProperty(\"user.dir\", \"\");\n" +
+            "            System.out.println(\"no exception\");\n" +
+            "            System.exit(1);\n" +
+            "        } catch (SecurityException e) {\n" +
+            "            System.out.println(\"exception: \" + e);\n" +
+            "        }\n" +
+            "    }\n" +
+            "}");
+
+        String log = new JavaTask(tb)
+                .vmOptions("-Djava.security.manager", "-Djava.security.policy=" + policyFile)
+                .className(sourceFile.toString())
+                .run(Task.Expect.SUCCESS)
+                .getOutput(Task.OutputKind.STDOUT);
+        checkEqual("stdout", log.trim(),
+                "user.dir=" + System.getProperty("user.dir") + "\n" +
+                "exception: java.security.AccessControlException: " +
+                    "access denied (\"java.util.PropertyPermission\" \"user.dir\" \"write\")");
+    }
+
+    public void testSystemProperty(Path base) throws IOException {
+        tb.writeJavaFiles(base,
+            "class ShowProperty {\n" +
+            "    public static void main(String... args) {\n" +
+            "        System.out.println(System.getProperty(\"jdk.launcher.sourcefile\"));\n" +
+            "    }\n" +
+            "}");
+
+        Path file = base.resolve("ShowProperty.java");
+        String log = new JavaTask(tb)
+                .className(file.toString())
+                .run(Task.Expect.SUCCESS)
+                .getOutput(Task.OutputKind.STDOUT);
+        checkEqual("stdout", log.trim(), file.toAbsolutePath().toString());
+    }
+
     void testSuccess(Path file, String expect) throws IOException {
         Result r = run(file, Collections.emptyList(), List.of("1", "2", "3"));
         checkEqual("stdout", r.stdOut, expect);
@@ -233,22 +308,98 @@
     }
 
     @Test
-    public void testWrongClass(Path base) throws IOException {
+    public void testLoadClass(Path base) throws IOException {
+        Path src1 = base.resolve("src1");
+        Path file1 = src1.resolve("LoadClass.java");
+        tb.writeJavaFiles(src1,
+                "class LoadClass {\n"
+                + "    public static void main(String... args) {\n"
+                + "        System.out.println(\"on classpath\");\n"
+                + "    };\n"
+                + "}\n");
+        Path classes1 = Files.createDirectories(base.resolve("classes"));
+        new JavacTask(tb)
+                .outdir(classes1)
+                .files(file1)
+                .run();
+        String log1 = new JavaTask(tb)
+                .classpath(classes1.toString())
+                .className("LoadClass")
+                .run(Task.Expect.SUCCESS)
+                .getOutput(Task.OutputKind.STDOUT);
+        checkEqual("stdout", log1.trim(),
+                "on classpath");
+
+        Path src2 = base.resolve("src2");
+        Path file2 = src2.resolve("LoadClass.java");
+        tb.writeJavaFiles(src2,
+                "class LoadClass {\n"
+                + "    public static void main(String... args) {\n"
+                + "        System.out.println(\"in source file\");\n"
+                + "    };\n"
+                + "}\n");
+        String log2 = new JavaTask(tb)
+                .classpath(classes1.toString())
+                .className(file2.toString())
+                .run(Task.Expect.SUCCESS)
+                .getOutput(Task.OutputKind.STDOUT);
+        checkEqual("stdout", log2.trim(),
+                "in source file");
+    }
+
+    @Test
+    public void testGetResource(Path base) throws IOException {
         Path src = base.resolve("src");
-        Path file = src.resolve("WrongClass.java");
-        tb.writeJavaFiles(src, "class WrongClass { }");
+        Path file = src.resolve("GetResource.java");
+        tb.writeJavaFiles(src,
+                "class GetResource {\n"
+                + "    public static void main(String... args) {\n"
+                + "        System.out.println(GetResource.class.getClassLoader().getResource(\"GetResource.class\"));\n"
+                + "    };\n"
+                + "}\n");
         Path classes = Files.createDirectories(base.resolve("classes"));
         new JavacTask(tb)
                 .outdir(classes)
                 .files(file)
                 .run();
+
         String log = new JavaTask(tb)
                 .classpath(classes.toString())
                 .className(file.toString())
-                .run(Task.Expect.FAIL)
-                .getOutput(Task.OutputKind.STDERR);
-        checkEqual("stderr", log.trim(),
-                "error: class found on application class path: WrongClass");
+                .run(Task.Expect.SUCCESS)
+                .getOutput(Task.OutputKind.STDOUT);
+        checkMatch("stdout", log.trim(),
+                Pattern.compile("sourcelauncher-memoryclassloader[0-9]+:GetResource.class"));
+    }
+
+    @Test
+    public void testGetResources(Path base) throws IOException {
+        Path src = base.resolve("src");
+        Path file = src.resolve("GetResources.java");
+        tb.writeJavaFiles(src,
+                "import java.io.*; import java.net.*; import java.util.*;\n"
+                + "class GetResources {\n"
+                + "    public static void main(String... args) throws IOException {\n"
+                + "        Enumeration<URL> e =\n"
+                + "            GetResources.class.getClassLoader().getResources(\"GetResources.class\");\n"
+                + "        while (e.hasMoreElements()) System.out.println(e.nextElement());\n"
+                + "    };\n"
+                + "}\n");
+        Path classes = Files.createDirectories(base.resolve("classes"));
+        new JavacTask(tb)
+                .outdir(classes)
+                .files(file)
+                .run();
+
+        List<String> log = new JavaTask(tb)
+                .classpath(classes.toString())
+                .className(file.toString())
+                .run(Task.Expect.SUCCESS)
+                .getOutputLines(Task.OutputKind.STDOUT);
+        checkMatch("stdout:0", log.get(0).trim(),
+                Pattern.compile("sourcelauncher-memoryclassloader[0-9]+:GetResources.class"));
+        checkMatch("stdout:1", log.get(1).trim(),
+                Pattern.compile("file:/.*/testGetResources/classes/GetResources.class"));
     }
 
     @Test
@@ -294,7 +445,37 @@
         checkEmpty("stdout", r.stdOut);
         checkEqual("stderr", r.stdErr, expectStdErr);
         checkFault("exception", r.exception, "error: compilation failed");
+    }
 
+    @Test
+    public void testClassNotFound(Path base) throws IOException {
+        Path src = base.resolve("src");
+        Path file = src.resolve("ClassNotFound.java");
+        tb.writeJavaFiles(src,
+                "class ClassNotFound {\n"
+                + "    public static void main(String... args) {\n"
+                + "        try {\n"
+                + "            Class.forName(\"NoSuchClass\");\n"
+                + "            System.out.println(\"no exception\");\n"
+                + "            System.exit(1);\n"
+                + "        } catch (ClassNotFoundException e) {\n"
+                + "            System.out.println(\"Expected exception thrown: \" + e);\n"
+                + "        }\n"
+                + "    };\n"
+                + "}\n");
+        Path classes = Files.createDirectories(base.resolve("classes"));
+        new JavacTask(tb)
+                .outdir(classes)
+                .files(file)
+                .run();
+
+        String log = new JavaTask(tb)
+                .classpath(classes.toString())
+                .className(file.toString())
+                .run(Task.Expect.SUCCESS)
+                .getOutput(Task.OutputKind.STDOUT);
+        checkEqual("stdout", log.trim(),
+                "Expected exception thrown: java.lang.ClassNotFoundException: NoSuchClass");
     }
 
     // For any source file that is invoked through the OS shebang mechanism, invalid shebang
@@ -471,12 +652,18 @@
     void checkEqual(String name, String found, String expect) {
         expect = expect.replace("\n", tb.lineSeparator);
         out.println(name + ": " + found);
-        out.println(name + ": " + found);
         if (!expect.equals(found)) {
             error("Unexpected output; expected: " + expect);
         }
     }
 
+    void checkMatch(String name, String found, Pattern expect) {
+        out.println(name + ": " + found);
+        if (!expect.matcher(found).matches()) {
+            error("Unexpected output; expected match for: " + expect);
+        }
+    }
+
     void checkEmpty(String name, String found) {
         out.println(name + ": " + found);
         if (!found.isEmpty()) {
--- a/test/langtools/tools/javac/launcher/src/CLTest.java	Wed Oct 03 15:54:35 2018 +0200
+++ b/test/langtools/tools/javac/launcher/src/CLTest.java	Wed Oct 03 16:02:24 2018 +0200
@@ -43,38 +43,38 @@
 import com.sun.tools.classfile.ClassFile;
 
 public class CLTest {
-        public static void main(String... args) throws Exception {
-                try {
-                        new CLTest().run();
-                } catch (Throwable t) {
-                        t.printStackTrace();
-                        System.exit(1);
-                }
+    public static void main(String... args) throws Exception {
+        try {
+            new CLTest().run();
+        } catch (Throwable t) {
+            t.printStackTrace();
+            System.exit(1);
+        }
+    }
+
+    void run() throws Exception {
+        String[] names = {
+                "p/q/CLTest.class",
+                "p/q/CLTest$Inner.class",
+                "p/q/CLTest2.class",
+                "java/lang/Object.class",
+                "UNKNOWN.class",
+                "UNKNOWN"
+        };
+
+        for (String name : names) {
+            testGetResource(name);
+            testGetResources(name);
+            testGetResourceAsStream(name);
         }
 
-        void run() throws Exception {
-                String[] names = {
-                                "p/q/CLTest.class",
-                                "p/q/CLTest$Inner.class",
-                                "p/q/CLTest2.class",
-                                "java/lang/Object.class",
-                                "UNKNOWN.class",
-                                "UNKNOWN"
-                };
-
-                for (String name : names) {
-                        testGetResource(name);
-                        testGetResources(name);
-                        testGetResourceAsStream(name);
-                }
-
-                if (errors > 0) {
-                        throw new Exception(errors + " errors found");
-                }
+        if (errors > 0) {
+            throw new Exception(errors + " errors found");
         }
+    }
 
     void testGetResource(String name) {
-                System.err.println("testGetResource: " + name);
+        System.err.println("testGetResource: " + name);
         try {
             ClassLoader cl = getClass().getClassLoader();
             URL u = cl.getResource(name);
@@ -95,7 +95,7 @@
     }
 
     void testGetResources(String name) {
-                System.err.println("testGetResources: " + name);
+        System.err.println("testGetResources: " + name);
         try {
             ClassLoader cl = getClass().getClassLoader();
             Enumeration<URL> e = cl.getResources(name);
--- a/test/langtools/tools/javac/options/IsSupportedOptionTest.java	Wed Oct 03 15:54:35 2018 +0200
+++ b/test/langtools/tools/javac/options/IsSupportedOptionTest.java	Wed Oct 03 16:02:24 2018 +0200
@@ -23,7 +23,7 @@
 
 /*
  * @test
- * @bug 8189782
+ * @bug 8189782 8210555
  * @summary Test for isSupportedOption
  * @modules java.compiler
  *          jdk.compiler
@@ -44,6 +44,9 @@
     public void run() throws Exception {
         JavaCompiler tool = ToolProvider.getSystemJavaCompiler();
         check(tool, "-source", 1);
+        check(tool, "--source", 1);
+        check(tool, "-target", 1);
+        check(tool, "--target", 1);
         check(tool, "--add-modules", 1);
         check(tool, "-verbose", 0);
         check(tool, "-proc:none", 0);
--- a/test/langtools/tools/javadoc/api/basic/IsSupportedOptionTest.java	Wed Oct 03 15:54:35 2018 +0200
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,69 +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 6493690
- * @summary javadoc should have a javax.tools.Tool service provider
- * @modules java.compiler
- *          jdk.compiler
- * @build APITest
- * @run main IsSupportedOptionTest
- */
-
-import javax.tools.DocumentationTool;
-import javax.tools.ToolProvider;
-
-/**
- * Tests for DocumentationTool.usSupportedOption method.
- */
-public class IsSupportedOptionTest extends APITest {
-    public static void main(String... args) throws Exception {
-        new IsSupportedOptionTest().run();
-    }
-
-    /**
-     * Verify that isSupportedOption method can be invoked.
-     */
-    @Test
-    public void test() throws Exception {
-        DocumentationTool tool = ToolProvider.getSystemDocumentationTool();
-        check(tool, "-sourcepath", 1);
-        check(tool, "-verbose", 0);
-        check(tool, "-ZZZ", -1);
-
-        try {
-            check(tool, null, -1);
-            error("null was accepted without exception");
-        } catch (NullPointerException e) {
-        }
-    }
-
-    private void check(DocumentationTool tool, String option, int numArgs) {
-        System.err.println("check " + option);
-        int n = tool.isSupportedOption(option);
-        if (n != numArgs)
-            error("unexpected result for option: " + option + ": " + n);
-    }
-}
-
--- a/test/langtools/tools/javadoc/sourceOption/SourceOption.java	Wed Oct 03 15:54:35 2018 +0200
+++ b/test/langtools/tools/javadoc/sourceOption/SourceOption.java	Wed Oct 03 16:02:24 2018 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2006, 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2006, 2018, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -33,25 +33,20 @@
  */
 
 /*
- * TEST NOTE
- * With JDK9, this test has been transformed into a NEGATIVE test.
+ * In order to test whether or not the -source option is working
+ * correctly, this test tries to parse source code that contains
+ * a feature that is not available in at least one of the currently
+ * supported previous versions.
  *
- * Generally speaking, this test should check a feature not in at least
- * one of the currently supported previous versions.  In this manner,
- * a failure of the -source option to be honored would mean a pass of
- * the test, and therefore a failure of the -source option.
+ * Parsing such code should be expected to fail; if the action
+ * passes, that means the -source option is (incorrectly) ineffective.
  *
- * For JDK9 and JDK10, both support 1.7, which did not support javac's
- * lambda construct.  So we set "-source 1.7" to compile a .java file
- * containing the lambda construct.  javac should fail, thus showing
- * -source to be working.  Thus the test passes.
- *
- * The second jtreg @run command checks to make sure that the source
+ * Additional actions are performed to ensure that the source
  * provided is valid for the current release of the JDK.
  *
- *  fixVersion: JDK11
- *      replace ./p/LambdaConstructTest.java with a missing from
- *      JDK8, JDK9, or JDK10.  Set -source below appropriately.
+ * As support for older versions of the platform are dropped, the
+ * source code (currently p/LambdaConstructTest.java) will need to
+ * be updated with a more recent feature.
  */
 
 import com.sun.javadoc.*;
--- a/test/lib/jdk/test/lib/jfr/EventNames.java	Wed Oct 03 15:54:35 2018 +0200
+++ b/test/lib/jdk/test/lib/jfr/EventNames.java	Wed Oct 03 16:02:24 2018 +0200
@@ -128,6 +128,7 @@
     public final static String G1EvacuationOldStatistics = PREFIX + "G1EvacuationOldStatistics";
     public final static String G1BasicIHOP = PREFIX + "G1BasicIHOP";
     public final static String AllocationRequiringGC = PREFIX + "AllocationRequiringGC";
+    public final static String GCPhaseParallel = PREFIX + "GCPhaseParallel";
 
     // Compiler
     public final static String Compilation = PREFIX + "Compilation";
--- a/test/lib/jdk/test/lib/util/JarUtils.java	Wed Oct 03 15:54:35 2018 +0200
+++ b/test/lib/jdk/test/lib/util/JarUtils.java	Wed Oct 03 16:02:24 2018 +0200
@@ -23,31 +23,173 @@
 
 package jdk.test.lib.util;
 
+import java.io.File;
 import java.io.FileInputStream;
 import java.io.FileNotFoundException;
 import java.io.FileOutputStream;
 import java.io.IOException;
+import java.io.OutputStream;
 import java.nio.file.Files;
 import java.nio.file.InvalidPathException;
 import java.nio.file.Path;
 import java.nio.file.Paths;
+import java.nio.file.StandardCopyOption;
+import java.util.ArrayList;
 import java.util.Enumeration;
 import java.util.HashMap;
+import java.util.List;
 import java.util.Map;
+import java.util.Set;
 import java.util.jar.JarEntry;
 import java.util.jar.JarFile;
 import java.util.jar.JarOutputStream;
 import java.util.jar.Manifest;
+import java.util.stream.Collectors;
+import java.util.stream.Stream;
 
 /**
- * Common library for various test jar file utility functions.
+ * This class consists exclusively of static utility methods that are useful
+ * for creating and manipulating JAR files.
  */
 public final class JarUtils {
+    private JarUtils() { }
+
+    /**
+     * Creates a JAR file.
+     *
+     * Equivalent to {@code jar cfm <jarfile> <manifest> -C <dir> file...}
+     *
+     * The input files are resolved against the given directory. Any input
+     * files that are directories are processed recursively.
+     */
+    public static void createJarFile(Path jarfile, Manifest man, Path dir, Path... files)
+            throws IOException
+    {
+        // create the target directory
+        Path parent = jarfile.getParent();
+        if (parent != null) {
+            Files.createDirectories(parent);
+        }
+
+        List<Path> entries = findAllRegularFiles(dir, files);
+
+        try (OutputStream out = Files.newOutputStream(jarfile);
+             JarOutputStream jos = new JarOutputStream(out)) {
+            if (man != null) {
+                JarEntry je = new JarEntry(JarFile.MANIFEST_NAME);
+                jos.putNextEntry(je);
+                man.write(jos);
+                jos.closeEntry();
+            }
+
+            for (Path entry : entries) {
+                String name = toJarEntryName(entry);
+                jos.putNextEntry(new JarEntry(name));
+                Files.copy(dir.resolve(entry), jos);
+                jos.closeEntry();
+            }
+        }
+    }
+
+    /**
+     * Creates a JAR file.
+     *
+     * Equivalent to {@code jar cf <jarfile>  -C <dir> file...}
+     *
+     * The input files are resolved against the given directory. Any input
+     * files that are directories are processed recursively.
+     */
+    public static void createJarFile(Path jarfile, Path dir, Path... files)
+            throws IOException
+    {
+        createJarFile(jarfile, null, dir, files);
+    }
+
+    /**
+     * Creates a JAR file from the contents of a directory.
+     *
+     * Equivalent to {@code jar cf <jarfile> -C <dir> .}
+     */
+    public static void createJarFile(Path jarfile, Path dir) throws IOException {
+        createJarFile(jarfile, dir, Paths.get("."));
+    }
+
+
+    /**
+     * Creates a JAR file.
+     *
+     * Equivalent to {@code jar cf <jarfile> -C <dir> file...}
+     *
+     * The input files are resolved against the given directory. Any input
+     * files that are directories are processed recursively.
+     */
+    public static void createJarFile(Path jarfile, Path dir, String... input)
+            throws IOException
+    {
+        Path[] paths = Stream.of(input).map(Paths::get).toArray(Path[]::new);
+        createJarFile(jarfile, dir, paths);
+    }
+
+    /**
+     * Updates a JAR file.
+     *
+     * Equivalent to {@code jar uf <jarfile> -C <dir> file...}
+     *
+     * The input files are resolved against the given directory. Any input
+     * files that are directories are processed recursively.
+     */
+    public static void updateJarFile(Path jarfile, Path dir, Path... files)
+            throws IOException
+    {
+        List<Path> entries = findAllRegularFiles(dir, files);
+
+        Set<String> names = entries.stream()
+                                   .map(JarUtils::toJarEntryName)
+                                   .collect(Collectors.toSet());
+
+        Path tmpfile = Files.createTempFile("jar", "jar");
+
+        try (OutputStream out = Files.newOutputStream(tmpfile);
+             JarOutputStream jos = new JarOutputStream(out)) {
+            // copy existing entries from the original JAR file
+            try (JarFile jf = new JarFile(jarfile.toString())) {
+                Enumeration<JarEntry> jentries = jf.entries();
+                while (jentries.hasMoreElements()) {
+                    JarEntry jentry = jentries.nextElement();
+                    if (!names.contains(jentry.getName())) {
+                        jos.putNextEntry(jentry);
+                        jf.getInputStream(jentry).transferTo(jos);
+                    }
+                }
+            }
+
+            // add the new entries
+            for (Path entry : entries) {
+                String name = toJarEntryName(entry);
+                jos.putNextEntry(new JarEntry(name));
+                Files.copy(dir.resolve(entry), jos);
+            }
+        }
+
+        // replace the original JAR file
+        Files.move(tmpfile, jarfile, StandardCopyOption.REPLACE_EXISTING);
+    }
+
+    /**
+     * Updates a JAR file.
+     *
+     * Equivalent to {@code jar uf <jarfile> -C <dir> .}
+     */
+    public static void updateJarFile(Path jarfile, Path dir) throws IOException {
+        updateJarFile(jarfile, dir, Paths.get("."));
+    }
+
 
     /**
      * Create jar file with specified files. If a specified file does not exist,
      * a new jar entry will be created with the file name itself as the content.
      */
+    @Deprecated
     public static void createJar(String dest, String... files)
             throws IOException {
         try (JarOutputStream jos = new JarOutputStream(
@@ -81,6 +223,7 @@
      *              will be removed. If no "-" exists, all files belong to
      *              the 1st group.
      */
+    @Deprecated
     public static void updateJar(String src, String dest, String... files)
             throws IOException {
         Map<String,Object> changes = new HashMap<>();
@@ -118,6 +261,7 @@
      *                Existing entries in src not a key is unmodified.
      * @throws IOException
      */
+    @Deprecated
     public static void updateJar(String src, String dest,
                                  Map<String,Object> changes)
             throws IOException {
@@ -172,4 +316,26 @@
             }
         }
     }
+
+    /**
+     * Maps a file path to the equivalent name in a JAR file
+     */
+    private static String toJarEntryName(Path file) {
+        Path normalized = file.normalize();
+        return normalized.subpath(0, normalized.getNameCount())  // drop root
+                         .toString()
+                         .replace(File.separatorChar, '/');
+    }
+
+    private static List<Path> findAllRegularFiles(Path dir, Path[] files) throws IOException {
+        List<Path> entries = new ArrayList<>();
+        for (Path file : files) {
+            try (Stream<Path> stream = Files.find(dir.resolve(file), Integer.MAX_VALUE,
+                    (p, attrs) -> attrs.isRegularFile())) {
+                stream.map(dir::relativize)
+                      .forEach(entries::add);
+            }
+        }
+        return entries;
+    }
 }